Java Code Examples for net.minecraft.entity.Entity#getDistanceToEntity()
The following examples show how to use
net.minecraft.entity.Entity#getDistanceToEntity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderManagerHook.java From SkyblockAddons with MIT License | 5 votes |
public static void shouldRender(Entity entityIn, ReturnValue<Boolean> returnValue) { SkyblockAddons main = SkyblockAddons.getInstance(); if (main.getUtils().isOnSkyblock()) { Location currentLocation = main.getUtils().getLocation(); if (entityIn instanceof EntityItem && entityIn.ridingEntity instanceof EntityArmorStand && entityIn.ridingEntity.isInvisible()) { // Conditions for skeleton helmet flying bones if (main.getConfigValues().isEnabled(Feature.HIDE_BONES)) { returnValue.cancel(); } } if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS)) { if (entityIn instanceof EntityOtherPlayerMP && NPCUtils.isNearAnyNPCWithTag(entityIn, Tag.IMPORTANT) && !NPCUtils.isNPC(entityIn)) { returnValue.cancel(); } } if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_IN_LOBBY)) { if (currentLocation == Location.VILLAGE || currentLocation == Location.AUCTION_HOUSE || currentLocation == Location.BANK) { if ((entityIn instanceof EntityOtherPlayerMP || entityIn instanceof EntityFX || entityIn instanceof EntityItemFrame) && entityIn.getDistanceToEntity(Minecraft.getMinecraft().thePlayer) > 7) { returnValue.cancel(); } } } if(main.getConfigValues().isEnabled(Feature.HIDE_SVEN_PUP_NAMETAGS)) { if (entityIn instanceof EntityArmorStand && entityIn.hasCustomName()) { String customNameTag = entityIn.getCustomNameTag(); if (customNameTag.contains("Sven Pup")) { returnValue.cancel(); } } } } }
Example 2
Source File: RenderListener.java From SkyblockAddons with MIT License | 5 votes |
/** * This renders a bar for the skeleton hat bones bar. */ public void drawSkeletonBar(Minecraft mc, float scale, ButtonLocation buttonLocation) { float x = main.getConfigValues().getActualX(Feature.SKELETON_BAR); float y = main.getConfigValues().getActualY(Feature.SKELETON_BAR); int bones = 0; if (!(mc.currentScreen instanceof LocationEditGui)) { for (Entity listEntity : mc.theWorld.loadedEntityList) { if (listEntity instanceof EntityItem && listEntity.ridingEntity instanceof EntityArmorStand && listEntity.ridingEntity.isInvisible() && listEntity.getDistanceToEntity(mc.thePlayer) <= 8) { bones++; } } } else { bones = 3; } if (bones > 3) bones = 3; int height = 16; int width = 3 * 16; x -= width * scale / 2F; y -= height * scale / 2F; x /= scale; y /= scale; if (buttonLocation != null) { buttonLocation.checkHoveredAndDrawBox(x, x+width, y, y+height, scale); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } main.getUtils().enableStandardGLOptions(); for (int boneCounter = 0; boneCounter < bones; boneCounter++) { renderItem(BONE_ITEM, x + boneCounter * 16, y); } main.getUtils().restoreGLOptions(); }
Example 3
Source File: ContainerClear.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
private float getDistanceToEntity(Entity from, Entity to) { return from.getDistanceToEntity(to); }
Example 4
Source File: RocketChaos.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
private float getDistanceToEntity(Entity from, Entity to) { return from.getDistanceToEntity(to); }
Example 5
Source File: NoLimitAura.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
private float getDistanceToEntity(Entity from, Entity to) { return from.getDistanceToEntity(to); }
Example 6
Source File: LimitedAura.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
private float getDistanceToEntity(Entity from, Entity to) { return from.getDistanceToEntity(to); }
Example 7
Source File: Forcefield.java From ehacks-pro with GNU General Public License v3.0 | 4 votes |
private float getDistanceToEntity(Entity from, Entity to) { return from.getDistanceToEntity(to); }
Example 8
Source File: WEntity.java From ForgeWurst with GNU General Public License v3.0 | 4 votes |
public static float getDistance(Entity e1, Entity e2) { return e1.getDistanceToEntity(e2); }
Example 9
Source File: TileKnowledgeBook.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
private void tryVortexUnfinishedResearchNotes() { float centerY = yCoord + 0.4F; List entityItems = worldObj.selectEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, centerY - 0.5, zCoord - 0.5, xCoord + 0.5, centerY + 0.5, zCoord + 0.5).expand(8, 8, 8), new IEntitySelector() { @Override public boolean isEntityApplicable(Entity e) { return !(e instanceof EntityPermanentItem) && !(e instanceof EntitySpecialItem) && e instanceof EntityItem && ((EntityItem) e).getEntityItem() != null && ((EntityItem) e).getEntityItem().getItem() instanceof ItemResearchNotes && shouldVortexResearchNote(((EntityItem) e).getEntityItem()); } }); Entity dummy = new EntityItem(worldObj); dummy.posX = xCoord + 0.5; dummy.posY = centerY + 0.5; dummy.posZ = zCoord + 0.5; //MC code. EntityItem entity = null; double d0 = Double.MAX_VALUE; for (Object entityItem : entityItems) { EntityItem entityIt = (EntityItem) entityItem; if (entityIt != dummy) { double d1 = dummy.getDistanceSqToEntity(entityIt); if (d1 <= d0) { entity = entityIt; d0 = d1; } } } if(entity == null) return; if(dummy.getDistanceToEntity(entity) < 1 && !worldObj.isRemote) { ItemStack inter = entity.getEntityItem(); inter.stackSize--; this.storedResearchNote = inter.copy(); this.storedResearchNote.stackSize = 1; EntityPermNoClipItem item = new EntityPermNoClipItem(entity.worldObj, xCoord + 0.5F, centerY + 0.3F, zCoord + 0.5F, storedResearchNote, xCoord, yCoord, zCoord); entity.worldObj.spawnEntityInWorld(item); item.motionX = 0; item.motionY = 0; item.motionZ = 0; item.hoverStart = entity.hoverStart; item.age = entity.age; item.noClip = true; timeSinceLastItemInfo = 0; if(inter.stackSize <= 0) entity.setDead(); entity.noClip = false; item.delayBeforeCanPickup = 60; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); } else { entity.noClip = true; applyMovementVectors(entity); } }
Example 10
Source File: TileAuraPylon.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
private void tryVortexPossibleItems() { TileAuraPylon io = getInputTile(); if (io == null) return; int masterY = yCoord + 1; float dst = ((float) (masterY - io.yCoord)) / 2F; float yC = masterY - dst; List entityItems = worldObj.selectEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5, yC - 0.5, zCoord - 0.5, xCoord + 0.5, yC + 0.5, zCoord + 0.5).expand(8, 8, 8), new IEntitySelector() { @Override public boolean isEntityApplicable(Entity e) { return !(e instanceof EntityPermanentItem) && !(e instanceof EntitySpecialItem) && e instanceof EntityItem && ((EntityItem) e).getEntityItem() != null && ((EntityItem) e).getEntityItem().getItem() instanceof ItemCrystalEssence && ((ItemCrystalEssence) ((EntityItem) e).getEntityItem().getItem()).getAspects(((EntityItem) e).getEntityItem()) != null; } }); Entity dummy = new EntityItem(worldObj); dummy.posX = xCoord + 0.5; dummy.posY = yC + 0.5; dummy.posZ = zCoord + 0.5; //MC code. EntityItem entity = null; double d0 = Double.MAX_VALUE; for (Object entityItem : entityItems) { EntityItem entityIt = (EntityItem) entityItem; if (entityIt != dummy) { double d1 = dummy.getDistanceSqToEntity(entityIt); if (d1 <= d0) { entity = entityIt; d0 = d1; } } } if(entity == null) return; if(dummy.getDistanceToEntity(entity) < 1 && !worldObj.isRemote) { ItemStack inter = entity.getEntityItem(); inter.stackSize--; this.crystalEssentiaStack = inter.copy(); this.crystalEssentiaStack.stackSize = 1; EntityPermNoClipItem item = new EntityPermNoClipItem(entity.worldObj, xCoord + 0.5F, yC + 0.3F, zCoord + 0.5F, crystalEssentiaStack, xCoord, yCoord, zCoord); entity.worldObj.spawnEntityInWorld(item); item.motionX = 0; item.motionY = 0; item.motionZ = 0; item.hoverStart = entity.hoverStart; item.age = entity.age; item.noClip = true; timeSinceLastItemInfo = 0; holdingAspect = ((ItemCrystalEssence) crystalEssentiaStack.getItem()).getAspects(crystalEssentiaStack).getAspects()[0]; distributeAspectInformation(); if(inter.stackSize <= 0) entity.setDead(); entity.noClip = false; item.delayBeforeCanPickup = 60; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); } else { entity.noClip = true; applyMovementVectors(entity); } }