/** * Add all collision boxes of this Block to the list that intersect with the given mask. */ public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); float f = 0.125F; this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBoundsForItemRender(); }
public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) { this.setPosition(x, y, z); this.setRotation(yaw, pitch); List<AxisAlignedBB> list = this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox().contract(0.03125D, 0.0D, 0.03125D)); if (!list.isEmpty()) { double d0 = 0.0D; for (AxisAlignedBB axisalignedbb : list) { if (axisalignedbb.maxY > d0) { d0 = axisalignedbb.maxY; } } y = y + (d0 - this.getEntityBoundingBox().minY); this.setPosition(x, y, z); } }
/** * Add all collision boxes of this Block to the list that intersect with the given mask. */ public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); float f = 0.125F; this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
public <T extends Entity> List<T> getEntitiesWithinAABB(Class <? extends T > clazz, AxisAlignedBB aabb, Predicate <? super T > filter) { int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D); int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D); int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D); int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D); List<T> list = Lists.<T>newArrayList(); for (int i1 = i; i1 <= j; ++i1) { for (int j1 = k; j1 <= l; ++j1) { if (this.isChunkLoaded(i1, j1, true)) { this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(clazz, aabb, list, filter); } } } return list; }
public List<Entity> getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate <? super Entity > predicate) { List<Entity> list = Lists.<Entity>newArrayList(); int i = MathHelper.floor_double((boundingBox.minX - 2.0D) / 16.0D); int j = MathHelper.floor_double((boundingBox.maxX + 2.0D) / 16.0D); int k = MathHelper.floor_double((boundingBox.minZ - 2.0D) / 16.0D); int l = MathHelper.floor_double((boundingBox.maxZ + 2.0D) / 16.0D); for (int i1 = i; i1 <= j; ++i1) { for (int j1 = k; j1 <= l; ++j1) { if (this.isChunkLoaded(i1, j1, true)) { this.getChunkFromChunkCoords(i1, j1).getEntitiesWithinAABBForEntity(entityIn, boundingBox, list, predicate); } } } return list; }
private static Entity getEntityHit(ProjectileType type, Vec3 source, Vec3 destination) { for (Object o : Minecraft.getMinecraft().theWorld.loadedEntityList) { if (o == Minecraft.getMinecraft().getRenderViewEntity()) continue; if (o instanceof EntityLivingBase) { EntityLivingBase entity = (EntityLivingBase) o; double expander = (type == ProjectileType.ARROW) ? 0.2 : 0.125; AxisAlignedBB boundingBox = entity.getEntityBoundingBox().expand(expander, expander, expander); MovingObjectPosition raytraceResult = boundingBox.calculateIntercept(source, destination); if (raytraceResult != null) { return entity; } } } return null; }
public static EntityLeashKnot getKnotForPosition(World worldIn, BlockPos pos) { int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); for (EntityLeashKnot entityleashknot : worldIn.getEntitiesWithinAABB(EntityLeashKnot.class, new AxisAlignedBB((double)i - 1.0D, (double)j - 1.0D, (double)k - 1.0D, (double)i + 1.0D, (double)j + 1.0D, (double)k + 1.0D))) { if (entityleashknot.getHangingPosition().equals(pos)) { return entityleashknot; } } return null; }
public <T extends Entity> T findNearestEntityWithinAABB(Class <? extends T > entityType, AxisAlignedBB aabb, T closestTo) { List<T> list = this.<T>getEntitiesWithinAABB(entityType, aabb); T t = null; double d0 = Double.MAX_VALUE; for (int i = 0; i < list.size(); ++i) { T t1 = list.get(i); if (t1 != closestTo && EntitySelectors.NOT_SPECTATING.apply(t1)) { double d1 = closestTo.getDistanceSqToEntity(t1); if (d1 <= d0) { t = t1; d0 = d1; } } } return t; }
private boolean isNotColliding(double p_179926_1_, double p_179926_3_, double p_179926_5_, double p_179926_7_) { double d0 = (p_179926_1_ - this.parentEntity.posX) / p_179926_7_; double d1 = (p_179926_3_ - this.parentEntity.posY) / p_179926_7_; double d2 = (p_179926_5_ - this.parentEntity.posZ) / p_179926_7_; AxisAlignedBB axisalignedbb = this.parentEntity.getEntityBoundingBox(); for (int i = 1; (double)i < p_179926_7_; ++i) { axisalignedbb = axisalignedbb.offset(d0, d1, d2); if (!this.parentEntity.worldObj.getCollidingBoundingBoxes(this.parentEntity, axisalignedbb).isEmpty()) { return false; } } return true; }
/** * Sets the width and height of the entity. Args: width, height */ protected void setSize(float width, float height) { if (width != this.width || height != this.height) { float f = this.width; this.width = width; this.height = height; this.setEntityBoundingBox(new AxisAlignedBB(this.getEntityBoundingBox().minX, this.getEntityBoundingBox().minY, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().minX + (double)this.width, this.getEntityBoundingBox().minY + (double)this.height, this.getEntityBoundingBox().minZ + (double)this.width)); if (this.width > f && !this.firstUpdate && !this.worldObj.isRemote) { this.moveEntity((double)(f - this.width), 0.0D, (double)(f - this.width)); } } }
/** * Renders a white box with the bounds of the AABB translated by the offset. Args: aabb, x, y, z */ public static void renderOffsetAABB(AxisAlignedBB boundingBox, double x, double y, double z) { GlStateManager.disableTexture2D(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); worldrenderer.setTranslation(x, y, z); worldrenderer.begin(7, DefaultVertexFormats.POSITION_NORMAL); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); tessellator.draw(); worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); GlStateManager.enableTexture2D(); }
public static void drawBoxOutline(AxisAlignedBB boundingBox, int color, boolean depthOff) { if (boundingBox == null) return; enableRender3D(depthOff); glColor(color); GL11.glBegin(3); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c); GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72339_c); GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72334_f); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72334_f); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c); GL11.glEnd(); GL11.glBegin(3); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c); GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72339_c); GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72334_f); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72334_f); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c); GL11.glEnd(); GL11.glBegin(1); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c); GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72339_c); GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72339_c); GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72334_f); GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72334_f); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72334_f); GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72334_f); GL11.glEnd(); disableRender3D(depthOff); }
/** * Add all collision boxes of this Block to the list that intersect with the given mask. */ public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); if (((Boolean)worldIn.getBlockState(pos).getValue(EYE)).booleanValue()) { this.setBlockBounds(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); } this.setBlockBoundsForItemRender(); }
/** * Sets the x,y,z of the entity from the given parameters. Also seems to set up a bounding box. */ public void setPosition(double x, double y, double z) { this.posX = x; this.posY = y; this.posZ = z; float f = this.width / 2.0F; float f1 = this.height; this.setEntityBoundingBox(new AxisAlignedBB(x - (double)f, y, z - (double)f, x + (double)f, y + (double)f1, z + (double)f)); }
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { if (((Boolean)state.getValue(OPEN)).booleanValue()) { return null; } else { EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis(); return enumfacing$axis == EnumFacing.Axis.Z ? new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)((float)pos.getZ() + 0.375F), (double)(pos.getX() + 1), (double)((float)pos.getY() + 1.5F), (double)((float)pos.getZ() + 0.625F)) : new AxisAlignedBB((double)((float)pos.getX() + 0.375F), (double)pos.getY(), (double)pos.getZ(), (double)((float)pos.getX() + 0.625F), (double)((float)pos.getY() + 1.5F), (double)(pos.getZ() + 1)); } }
private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos) { for (Entity entity : worldIn.getEntitiesWithinAABB(EntityOcelot.class, new AxisAlignedBB((double)pos.getX(), (double)(pos.getY() + 1), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 2), (double)(pos.getZ() + 1)))) { EntityOcelot entityocelot = (EntityOcelot)entity; if (entityocelot.isSitting()) { return true; } } return false; }
/** * Add all collision boxes of this Block to the list that intersect with the given mask. */ public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) { this.setBaseCollisionBounds(worldIn, pos); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); boolean flag = this.func_176306_h(worldIn, pos); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); if (flag && this.func_176304_i(worldIn, pos)) { super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); } this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
public static boolean isOnLiquid() { AxisAlignedBB par1AxisAlignedBB = Minecraft.getMinecraft().thePlayer.boundingBox.offset(0.0, -0.01, 0.0).contract(0.001, 0.001, 0.001); int var4 = MathHelper.floor_double((double)par1AxisAlignedBB.minX); int var5 = MathHelper.floor_double((double)(par1AxisAlignedBB.maxX + 1.0)); int var6 = MathHelper.floor_double((double)par1AxisAlignedBB.minY); int var7 = MathHelper.floor_double((double)(par1AxisAlignedBB.maxY + 1.0)); int var8 = MathHelper.floor_double((double)par1AxisAlignedBB.minZ); int var9 = MathHelper.floor_double((double)(par1AxisAlignedBB.maxZ + 1.0)); Vec3 var11 = new Vec3(0.0, 0.0, 0.0); int var12 = var4; while (var12 < var5) { int var13 = var6; while (var13 < var7) { int var14 = var8; while (var14 < var9) { Block var15 = Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(var12, var13, var14)).getBlock(); if (!(var15 instanceof BlockAir) && !(var15 instanceof BlockLiquid)) { return false; } ++var14; } ++var13; } ++var12; } return true; }
public static void func_181561_a(AxisAlignedBB p_181561_0_) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(3, DefaultVertexFormats.POSITION); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); tessellator.draw(); worldrenderer.begin(3, DefaultVertexFormats.POSITION); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); tessellator.draw(); worldrenderer.begin(1, DefaultVertexFormats.POSITION); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.minZ).endVertex(); worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.minZ).endVertex(); worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); worldrenderer.pos(p_181561_0_.maxX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.minY, p_181561_0_.maxZ).endVertex(); worldrenderer.pos(p_181561_0_.minX, p_181561_0_.maxY, p_181561_0_.maxZ).endVertex(); tessellator.draw(); }
@Overwrite public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) { AxisAlignedBB boundingBox = this.getCollisionBoundingBox(worldIn, pos, state); if (collidingEntity instanceof EntityPlayerSP) boundingBox = EventManager.post(new BlockBB((Block) (Object) this, state, pos.getX(), pos.getY(), pos.getZ(), boundingBox)).getBoundingBox(); if (boundingBox != null && mask.intersectsWith(boundingBox)) { list.add(boundingBox); } }
private static AxisAlignedBB func_179661_a(BlockPos p_179661_0_, int p_179661_1_, int p_179661_2_, int p_179661_3_) { boolean flag = p_179661_1_ < 0; boolean flag1 = p_179661_2_ < 0; boolean flag2 = p_179661_3_ < 0; int i = p_179661_0_.getX() + (flag ? p_179661_1_ : 0); int j = p_179661_0_.getY() + (flag1 ? p_179661_2_ : 0); int k = p_179661_0_.getZ() + (flag2 ? p_179661_3_ : 0); int l = p_179661_0_.getX() + (flag ? 0 : p_179661_1_) + 1; int i1 = p_179661_0_.getY() + (flag1 ? 0 : p_179661_2_) + 1; int j1 = p_179661_0_.getZ() + (flag2 ? 0 : p_179661_3_) + 1; return new AxisAlignedBB((double)i, (double)j, (double)k, (double)l, (double)i1, (double)j1); }
private EntityItemFrame findItemFrame(World worldIn, final EnumFacing facing, BlockPos pos) { List<EntityItemFrame> list = worldIn.<EntityItemFrame>getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)), new Predicate<Entity>() { public boolean apply(Entity p_apply_1_) { return p_apply_1_ != null && p_apply_1_.getHorizontalFacing() == facing; } }); return list.size() == 1 ? (EntityItemFrame)list.get(0) : null; }
public EntityLeashKnot(World worldIn, BlockPos hangingPositionIn) { super(worldIn, hangingPositionIn); this.setPosition((double)hangingPositionIn.getX() + 0.5D, (double)hangingPositionIn.getY() + 0.5D, (double)hangingPositionIn.getZ() + 0.5D); float f = 0.125F; float f1 = 0.1875F; float f2 = 0.25F; this.setEntityBoundingBox(new AxisAlignedBB(this.posX - 0.1875D, this.posY - 0.25D + 0.125D, this.posZ - 0.1875D, this.posX + 0.1875D, this.posY + 0.25D + 0.125D, this.posZ + 0.1875D)); }
public void setPosition(BlockPos pos) { this.stopCompileTask(); this.position = pos; this.boundingBox = new AxisAlignedBB(pos, pos.add(16, 16, 16)); this.initModelviewMatrix(); for (int i = 0; i < this.positionOffsets16.length; ++i) { this.positionOffsets16[i] = null; } }
public static void drawSearchBlock(Block block, BlockPos blockPos, EventRender3D event) { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; GlStateManager.pushMatrix(); GL11.glLineWidth((float)1.0f); GlStateManager.disableDepth(); RenderUtils.disableLighting(); double var8 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)event.particlTicks; double var10 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)event.particlTicks; double var12 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)event.particlTicks; drawOutlinedBoundingBox((AxisAlignedBB)block.getSelectedBoundingBox((World)Minecraft.getMinecraft().theWorld, blockPos).expand(0.0020000000949949026, 0.0020000000949949026, 0.0020000000949949026).offset(- var8, - var10, - var12), (int)-1); GlStateManager.popMatrix(); }
/** * Add all collision boxes of this Block to the list that intersect with the given mask. */ public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity) { this.applyHeadBounds(state); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.applyCoreBounds(state); super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
/** * First layer of player interaction */ public boolean interactFirst(EntityPlayer playerIn) { ItemStack itemstack = playerIn.getHeldItem(); boolean flag = false; if (itemstack != null && itemstack.getItem() == Items.lead && !this.worldObj.isRemote) { double d0 = 7.0D; for (EntityLiving entityliving : this.worldObj.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + d0, this.posZ + d0))) { if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == playerIn) { entityliving.setLeashedToEntity(this, true); flag = true; } } } if (!this.worldObj.isRemote && !flag) { this.setDead(); if (playerIn.capabilities.isCreativeMode) { double d1 = 7.0D; for (EntityLiving entityliving1 : this.worldObj.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB(this.posX - d1, this.posY - d1, this.posZ - d1, this.posX + d1, this.posY + d1, this.posZ + d1))) { if (entityliving1.getLeashed() && entityliving1.getLeashedToEntity() == this) { entityliving1.clearLeashed(true, false); } } } } return true; }
private void updateState(World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); boolean flag = ((Boolean)iblockstate.getValue(POWERED)).booleanValue(); boolean flag1 = false; List <? extends Entity > list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ)); if (!list.isEmpty()) { for (Entity entity : list) { if (!entity.doesEntityNotTriggerPressurePlate()) { flag1 = true; break; } } } if (flag1 != flag) { iblockstate = iblockstate.withProperty(POWERED, Boolean.valueOf(flag1)); worldIn.setBlockState(pos, iblockstate, 3); this.notifyHook(worldIn, pos, iblockstate); } if (flag1) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); } }
/** * Returns true if there are any blocks in the region constrained by an AxisAlignedBB */ public boolean checkBlockCollision(AxisAlignedBB bb) { int i = MathHelper.floor_double(bb.minX); int j = MathHelper.floor_double(bb.maxX); int k = MathHelper.floor_double(bb.minY); int l = MathHelper.floor_double(bb.maxY); int i1 = MathHelper.floor_double(bb.minZ); int j1 = MathHelper.floor_double(bb.maxZ); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for (int k1 = i; k1 <= j; ++k1) { for (int l1 = k; l1 <= l; ++l1) { for (int i2 = i1; i2 <= j1; ++i2) { Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock(); if (block.getMaterial() != Material.air) { return true; } } } } return false; }
public boolean isFlammableWithin(AxisAlignedBB bb) { int i = MathHelper.floor_double(bb.minX); int j = MathHelper.floor_double(bb.maxX + 1.0D); int k = MathHelper.floor_double(bb.minY); int l = MathHelper.floor_double(bb.maxY + 1.0D); int i1 = MathHelper.floor_double(bb.minZ); int j1 = MathHelper.floor_double(bb.maxZ + 1.0D); if (this.isAreaLoaded(i, k, i1, j, l, j1, true)) { BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock(); if (block == Blocks.fire || block == Blocks.flowing_lava || block == Blocks.lava) { return true; } } } } } return false; }
public ModuleChestESP() { super("ChestESP", "Chest esp", Ordering.RENDER, 0, 0); addValue(rainbow); addListener(new Listener("chestesp_3d", Render3DEvent.class) { @Override public void call(Event e) { GL11.glPushMatrix(); for (TileEntity ent : Wrapper.loadedTileEntityList()) { if (!(ent instanceof TileEntityChest) && !(ent instanceof TileEntityEnderChest)) continue; double posX = ent.field_145851_c - RenderManager.field_78725_b; double posY = ent.field_145848_d - RenderManager.field_78726_c; double posZ = ent.field_145849_e - RenderManager.field_78723_d; AxisAlignedBB box = null; if (ent instanceof TileEntityChest) { TileEntityChest chest = (TileEntityChest) ent; if (ReflectionUtil.getFieldValue("field_145990_j", chest) != null) box = AxisAlignedBB.func_72330_a(posX + 0.06, posY, posZ + 0.06, posX + 1.94, posY + 0.875, posZ + 0.9375); else if (ReflectionUtil.getFieldValue("field_145988_l", chest) != null) box = AxisAlignedBB.func_72330_a(posX + 0.06, posY, posZ + 0.06, posX + 0.94, posY + 0.875, posZ + 1.9375); else if (ReflectionUtil.getFieldValue("field_145988_l", chest) != null || ReflectionUtil.getFieldValue("field_145990_j", chest) != null || ReflectionUtil.getFieldValue("field_145992_i", chest) != null || ReflectionUtil.getFieldValue("field_145991_k", chest) != null) { } else box = AxisAlignedBB.func_72330_a(posX + 0.06, posY, posZ + 0.06, posX + 0.94, posY + 0.875, posZ + 0.9375); } else { box = AxisAlignedBB.func_72330_a(posX + 0.06, posY, posZ + 0.06, posX + 0.94, posY + 0.875, posZ + 0.9375); } if (box == null) continue; int color = ent instanceof TileEntityChest ? new Color(43, 179, 255).getRGB() : new Color(216, 27, 255).getRGB(); if (rainbow.getValue()) color = ColorUtil.rainbow(Wrapper.loadedTileEntityList().indexOf(ent)); GL11.glPushMatrix(); RenderUtil.drawBox(box, new ColorBuilder(color).withAlpha(65).build_hex(), true); RenderUtil.drawBoxOutline(box, new ColorBuilder(color).withAlpha(125).build_hex(), true); GL11.glPopMatrix(); } GL11.glPopMatrix(); } }); }
private AxisAlignedBB getDectectionBox(BlockPos pos) { float f = 0.2F; return new AxisAlignedBB((double)((float)pos.getX() + 0.2F), (double)pos.getY(), (double)((float)pos.getZ() + 0.2F), (double)((float)(pos.getX() + 1) - 0.2F), (double)((float)(pos.getY() + 1) - 0.2F), (double)((float)(pos.getZ() + 1) - 0.2F)); }
public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) { this.setBlockBoundsBasedOnState(worldIn, pos); return super.getSelectedBoundingBox(worldIn, pos); }
public static void drawBoundingBox(AxisAlignedBB boundingBox) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrender = Tessellator.getInstance().getWorldRenderer(); worldrender.startDrawingQuads(); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); // tessellator.draw(); // worldrender.startDrawingQuads(); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); // tessellator.draw(); // worldrender.startDrawingQuads(); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); // tessellator.draw(); // worldrender.startDrawingQuads(); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); // tessellator.draw(); // worldrender.startDrawingQuads(); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); // tessellator.draw(); // worldrender.startDrawingQuads(); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.maxZ); worldrender.addVertex(boundingBox.minX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.minX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.minZ); worldrender.addVertex(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); worldrender.addVertex(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); tessellator.draw(); }