Java Code Examples for net.minecraft.entity.player.EntityPlayer.isInvisible()
The following are Jave code examples for showing how to use
isInvisible() of the
net.minecraft.entity.player.EntityPlayer
class.
You can vote up the examples you like. Your votes will be used in our system to get
more good examples.
+ Save this method
Example 1
Project: SerenityCE File: CopsVsCrims.java View Source Code | 5 votes |
public boolean isValidTarget(EntityPlayer p) { return (p.ticksExisted > 20) && (p.isEntityAlive()) && (canPlayerSee(predict(p).up(p.getEyeHeight()))) && (!p.isInvisible()) && (isOnEnemyTeam(p)) && (!Serenity.getInstance().getFriendManager().isFriend(p.getCommandSenderName())); }
Example 2
Project: Mods File: ItemCloak.java View Source Code | 5 votes |
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer living, EnumHand hand) { ItemStack stack=living.getHeldItem(hand); if (living.isInvisible() || (!isFeignDeath(stack, living) && stack.getItemDamage() < 528)) { this.setCloak(!WeaponsCapability.get(living).isInvisible(), stack, living, world); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack); } else if(!living.isInvisible() && this.isFeignDeath(stack, living) && stack.getItemDamage() == 0) { WeaponsCapability.get(living).setFeign(!WeaponsCapability.get(living).isFeign()); if(WeaponsCapability.get(living).isFeign()) living.playSound(getSound(stack, PropertyType.CHARGE_SOUND), 1.0f, 1.0f); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack); } return new ActionResult<ItemStack>(EnumActionResult.PASS, stack); }
Example 3
Project: Wurst-MC-1.12 File: TracersMod.java View Source Code | 4 votes |
@Override public void onRender(float partialTicks) { // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslated(-mc.getRenderManager().renderPosX, -mc.getRenderManager().renderPosY, -mc.getRenderManager().renderPosZ); // set start position Vec3d start = RotationUtils.getClientLookVec() .addVector(0, WMinecraft.getPlayer().getEyeHeight(), 0) .addVector(mc.getRenderManager().renderPosX, mc.getRenderManager().renderPosY, mc.getRenderManager().renderPosZ); GL11.glBegin(GL11.GL_LINES); for(EntityPlayer entity : WMinecraft.getWorld().playerEntities) { if(entity == WMinecraft.getPlayer() || entity instanceof EntityFakePlayer) continue; // fake entities with crazy vertical position if(Math.abs(entity.posY - WMinecraft.getPlayer().posY) > 1e6) continue; if(!wurst.special.targetSpf.sleepingPlayers.isChecked() && entity.isPlayerSleeping()) continue; if(!wurst.special.targetSpf.invisiblePlayers.isChecked() && entity.isInvisible()) continue; // set end position Vec3d end = entity.boundingBox.getCenter() .subtract(new Vec3d(entity.posX, entity.posY, entity.posZ) .subtract(entity.prevPosX, entity.prevPosY, entity.prevPosZ) .scale(1 - partialTicks)); // set color if(wurst.friends.contains(entity.getName())) GL11.glColor4f(0, 0, 1, 0.5F); else { float factor = WMinecraft.getPlayer().getDistanceToEntity(entity) / 40F; if(factor > 1) factor = 1; GL11.glColor4f(2 - factor * 2F, factor * 2F, 0, 0.5F); } // draw line GL11.glVertex3d(start.xCoord, start.yCoord, start.zCoord); GL11.glVertex3d(end.xCoord, end.yCoord, end.zCoord); } GL11.glEnd(); GL11.glPopMatrix(); // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
Example 4
Project: Wurst-MC-1.12 File: PlayerEspMod.java View Source Code | 4 votes |
@Override public void onRender(float partialTicks) { // GL settings GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glLineWidth(2); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glPushMatrix(); GL11.glTranslated(-mc.getRenderManager().renderPosX, -mc.getRenderManager().renderPosY, -mc.getRenderManager().renderPosZ); // draw boxes for(EntityPlayer entity : WMinecraft.getWorld().playerEntities) { if(entity == WMinecraft.getPlayer() || entity instanceof EntityFakePlayer) continue; if(!wurst.special.targetSpf.sleepingPlayers.isChecked() && entity.isPlayerSleeping()) continue; if(!wurst.special.targetSpf.invisiblePlayers.isChecked() && entity.isInvisible()) continue; // set color if(wurst.friends.contains(entity.getName())) GL11.glColor4f(0, 0, 1, 0.5F); else { float factor = WMinecraft.getPlayer().getDistanceToEntity(entity) / 20F; if(factor > 2) factor = 2; GL11.glColor4f(2 - factor, factor, 0, 0.5F); } // set position GL11.glPushMatrix(); GL11.glTranslated( entity.prevPosX + (entity.posX - entity.prevPosX) * partialTicks, entity.prevPosY + (entity.posY - entity.prevPosY) * partialTicks, entity.prevPosZ + (entity.posZ - entity.prevPosZ) * partialTicks); // draw box RenderUtils.drawOutlinedBox(PLAYER_BOX); GL11.glPopMatrix(); } GL11.glPopMatrix(); // GL resets GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_LINE_SMOOTH); }
Example 5
Project: BackTools File: LayerBackTool.java View Source Code | 4 votes |
@Override //func_177093_a(entity, f8, f7, partialTicks, f5, f4, f9, 0.0625F); public void doRenderLayer(EntityPlayer player, float f, float f1, float renderTick, float f2, float f3, float f4, float f5) { if(iChunUtil.hasMorphMod() && MorphApi.getApiImpl().hasMorph(player.getName(), Side.CLIENT) && (MorphApi.getApiImpl().morphProgress(player.getName(), Side.CLIENT) < 1.0F || !(MorphApi.getApiImpl().getMorphEntity(player.getEntityWorld(), player.getName(), Side.CLIENT) instanceof EntityPlayer))) { return; } if(!(player.isWearing(EnumPlayerModelParts.CAPE) && ((AbstractClientPlayer)player).getLocationCape() != null) && !player.isInvisible() && !player.isPlayerSleeping()) { ItemStack is = BackTools.eventHandlerClient.playerTool.get(player.getName()); ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND); if(!heldItem.isEmpty()) { ItemStack is1 = heldItem.copy(); is1.setItemDamage(0); heldItem = is1; } if(is != null && !is.isEmpty() && !ItemStack.areItemStacksEqual(is, heldItem)) { GlStateManager.pushMatrix(); GlStateManager.translate(0.0f, 0.35F, 0.16F); if(!player.inventory.armorItemInSlot(2).isEmpty()) { GlStateManager.translate(0.0F, player.isSneaking() ? -0.1F : 0.0F, player.isSneaking() ? 0.025F : 0.06F); } if(player.isSneaking()) { GlStateManager.translate(0F, 0.08F, 0.13F); GlStateManager.rotate(28.8F, 1.0F, 0.0F, 0.0F); } GlStateManager.rotate((float)(BackTools.getOrientation(is.getItem().getClass()) - 1) * -90F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(180F, 0.0F, 1.0F, 0.0F); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(is); RendererHelper.renderBakedModel(model, -1, is); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.enableAlpha(); GlStateManager.popMatrix(); } } }
Example 6
Project: Backmemed File: World.java View Source Code | 4 votes |
@Nullable public EntityPlayer getNearestAttackablePlayer(double posX, double posY, double posZ, double maxXZDistance, double maxYDistance, @Nullable Function<EntityPlayer, Double> playerToDouble, @Nullable Predicate<EntityPlayer> p_184150_12_) { double d0 = -1.0D; EntityPlayer entityplayer = null; for (int i = 0; i < this.playerEntities.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i); if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive() && !entityplayer1.isSpectator() && (p_184150_12_ == null || p_184150_12_.apply(entityplayer1))) { double d1 = entityplayer1.getDistanceSq(posX, entityplayer1.posY, posZ); double d2 = maxXZDistance; if (entityplayer1.isSneaking()) { d2 = maxXZDistance * 0.800000011920929D; } if (entityplayer1.isInvisible()) { float f = entityplayer1.getArmorVisibility(); if (f < 0.1F) { f = 0.1F; } d2 *= (double)(0.7F * f); } if (playerToDouble != null) { d2 *= ((Double)Objects.firstNonNull(playerToDouble.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue(); } if ((maxYDistance < 0.0D || Math.abs(entityplayer1.posY - posY) < maxYDistance * maxYDistance) && (maxXZDistance < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) { d0 = d1; entityplayer = entityplayer1; } } } return entityplayer; }
Example 7
Project: CustomWorldGen File: World.java View Source Code | 4 votes |
@Nullable public EntityPlayer getNearestAttackablePlayer(double posX, double posY, double posZ, double maxXZDistance, double maxYDistance, @Nullable Function<EntityPlayer, Double> playerToDouble, @Nullable Predicate<EntityPlayer> p_184150_12_) { double d0 = -1.0D; EntityPlayer entityplayer = null; for (int i = 0; i < this.playerEntities.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i); if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive() && !entityplayer1.isSpectator() && (p_184150_12_ == null || p_184150_12_.apply(entityplayer1))) { double d1 = entityplayer1.getDistanceSq(posX, entityplayer1.posY, posZ); double d2 = maxXZDistance; if (entityplayer1.isSneaking()) { d2 = maxXZDistance * 0.800000011920929D; } if (entityplayer1.isInvisible()) { float f = entityplayer1.getArmorVisibility(); if (f < 0.1F) { f = 0.1F; } d2 *= (double)(0.7F * f); } if (playerToDouble != null) { d2 *= ((Double)Objects.firstNonNull(playerToDouble.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue(); } d2 = net.minecraftforge.common.ForgeHooks.getPlayerVisibilityDistance(entityplayer1, d2, maxXZDistance); if ((maxYDistance < 0.0D || Math.abs(entityplayer1.posY - posY) < maxYDistance * maxYDistance) && (maxXZDistance < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) { d0 = d1; entityplayer = entityplayer1; } } } return entityplayer; }