net.minecraft.util.AxisAlignedBB Java Examples
The following examples show how to use
net.minecraft.util.AxisAlignedBB.
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: BlockSlimePlant.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override public void executeFullGrownEffect(World world, int x, int y, int z, Random rand){ if(world.getBlockMetadata(x, y, z) == 14) { int nearbyEntityCount = world.getEntitiesWithinAABB(EntitySlime.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(SPAWN_RANGE * 2, 4.0D, SPAWN_RANGE * 2)).size(); if(nearbyEntityCount < MAX_NEARBY_ENTITIES) { EntitySlime SS = new EntitySlime(world); double randXmotion = rand.nextDouble() - 0.5D; double randYmotion = 1D;// rand.nextDouble(); double randZmotion = rand.nextDouble() - 0.5D; SS.setLocationAndAngles(x + 0.5D, y + 0.5D, z + 0.5D, rand.nextFloat() * 360.0F, 0.0F); SS.motionX = randXmotion; SS.motionY = randYmotion; SS.motionZ = randZmotion; world.spawnEntityInWorld(SS); SS.spawnExplosionParticle(); SS.playSound("mob.newsound.chickenplop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); world.setBlockMetadataWithNotify(x, y, z, 13 - SS.getSlimeSize(), 3); } } else { world.setBlockMetadataWithNotify(x, y, z, 14, 2); world.scheduleBlockUpdate(x, y, z, this, 60); } }
Example #2
Source File: BlockWallPlate.java From Artifacts with MIT License | 6 votes |
protected AxisAlignedBB getMetaSensitiveAABB(int x, int y, int z, int meta) { float f = 0.125F; switch(meta) { case 2: case 10: return AxisAlignedBB.getBoundingBox((double)((float)x + f), (double)((float)y + f), (double)((float)(z + 1)-0.25f), (double)((float)(x + 1) - f), (double)((float)(y + 1) - f), (double)(z + 1)); //break; case 3: case 11: return AxisAlignedBB.getBoundingBox((double)((float)x + f), (double)((float)y + f), (double)z, (double)((float)(x + 1) - f), (double)((float)(y + 1) - f), (double)z + 0.25D); //break; case 4: case 12: return AxisAlignedBB.getBoundingBox((double)((float)(x + 1)-0.25f), (double)((float)y + f), (double)((float)z + f), (double)(x + 1), (double)((float)(y + 1) - f), (double)((float)(z + 1) - f)); //break; case 5: case 13: return AxisAlignedBB.getBoundingBox((double)x, (double)((float)y + f), (double)((float)z + f), (double)x + 0.25D, (double)((float)(y + 1) - f), (double)((float)(z + 1) - f)); //break; } return AxisAlignedBB.getBoundingBox((double)((float)x + f), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)y + 0.25D, (double)((float)(z + 1) - f)); }
Example #3
Source File: BlockPressureTube.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
public BlockPressureTube(Material par2Material, float dangerPressure, float criticalPressure, int volume){ super(par2Material); double width = (BBConstants.PRESSURE_PIPE_MAX_POS - BBConstants.PRESSURE_PIPE_MIN_POS) / 2; double height = BBConstants.PRESSURE_PIPE_MIN_POS; boundingBoxes[0] = AxisAlignedBB.getBoundingBox(0.5 - width, BBConstants.PRESSURE_PIPE_MIN_POS - height, 0.5 - width, 0.5 + width, BBConstants.PRESSURE_PIPE_MIN_POS, 0.5 + width); boundingBoxes[1] = AxisAlignedBB.getBoundingBox(0.5 - width, BBConstants.PRESSURE_PIPE_MAX_POS, 0.5 - width, 0.5 + width, BBConstants.PRESSURE_PIPE_MAX_POS + height, 0.5 + width); boundingBoxes[2] = AxisAlignedBB.getBoundingBox(0.5 - width, 0.5 - width, BBConstants.PRESSURE_PIPE_MIN_POS - height, 0.5 + width, 0.5 + width, BBConstants.PRESSURE_PIPE_MIN_POS); boundingBoxes[3] = AxisAlignedBB.getBoundingBox(0.5 - width, 0.5 - width, BBConstants.PRESSURE_PIPE_MAX_POS, 0.5 + width, 0.5 + width, BBConstants.PRESSURE_PIPE_MAX_POS + height); boundingBoxes[4] = AxisAlignedBB.getBoundingBox(BBConstants.PRESSURE_PIPE_MIN_POS - height, 0.5 - width, 0.5 - width, BBConstants.PRESSURE_PIPE_MIN_POS, 0.5 + width, 0.5 + width); boundingBoxes[5] = AxisAlignedBB.getBoundingBox(BBConstants.PRESSURE_PIPE_MAX_POS, 0.5 - width, 0.5 - width, BBConstants.PRESSURE_PIPE_MAX_POS + height, 0.5 + width, 0.5 + width); this.dangerPressure = dangerPressure; this.criticalPressure = criticalPressure; this.volume = volume; }
Example #4
Source File: CrossedSquaresPlantRenderer.java From GardenCollection with MIT License | 6 votes |
@Override public void render (IBlockAccess world, int x, int y, int z, RenderBlocks renderer, Block block, int meta, int height, AxisAlignedBB[] bounds) { if (bounds == null) return; IPlantMetaResolver resolver = PlantRegistry.instance().getPlantMetaResolver(block, meta); if (resolver != null) meta = resolver.getPlantSectionMeta(block, meta, height); IIcon iicon = renderer.getBlockIconFromSideAndMetadata(block, 0, meta); for (AxisAlignedBB bound : bounds) { RenderHelper.instance.setRenderBounds(bound.minX, bound.minY, bound.minZ, bound.maxX, bound.maxY, bound.maxZ); RenderHelper.instance.drawCrossedSquaresBounded(iicon, x, y, z, 1); } }
Example #5
Source File: BlockPresent.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
public AxisAlignedBB getBoundingBox(TileEntityPresent me) { if (me == null) { return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); } int x = me.xCoord, y = me.yCoord, z = me.zCoord; if (me.isConnected()) { ForgeDirection dir = me.getConnectionDir(); // warning: magic below! Do not change this conditional if (dir == ForgeDirection.EAST || (me.isParent() && dir == ForgeDirection.SOUTH) || (!me.isParent() && dir == ForgeDirection.SOUTH)) { return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX + dir.offsetX, y + maxY, z + maxZ + dir.offsetZ); } else { return AxisAlignedBB.getBoundingBox(x + dir.offsetX + minX, y + minY, z + dir.offsetZ + minZ, x + maxX, y + maxY, z + maxZ); } } return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ); }
Example #6
Source File: WallClimb.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
@EventTarget public void onBlockBB(final BlockBBEvent event) { if(mc.thePlayer == null) return; final String mode = modeValue.get(); switch(mode.toLowerCase()) { case "checkerclimb": if(event.getY() > mc.thePlayer.posY) event.setBoundingBox(null); break; case "clip": if(event.getBlock() != null && mc.thePlayer != null && event.getBlock() instanceof BlockAir && event.getY() < mc.thePlayer.posY && mc.thePlayer.isCollidedHorizontally && !mc.thePlayer.isOnLadder() && !mc.thePlayer.isInWater() && !mc.thePlayer.isInLava()) event.setBoundingBox(new AxisAlignedBB(0, 0, 0, 1, 1, 1).offset(mc.thePlayer.posX, (int) mc.thePlayer.posY - 1, mc.thePlayer.posZ)); break; } }
Example #7
Source File: ItemESP.java From ehacks-pro with GNU General Public License v3.0 | 6 votes |
private void renderDebugBoundingBox(Entity p_85094_1_, double p_85094_2_, double p_85094_4_, double p_85094_6_, float p_85094_8_, float p_85094_9_) { GL11.glDepthMask(false); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); float f2 = p_85094_1_.width / 2.0F; AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(p_85094_2_ - f2, p_85094_4_, p_85094_6_ - f2, p_85094_2_ + f2, p_85094_4_ + p_85094_1_.height, p_85094_6_ + f2); GL11.glLineWidth(1f); RenderGlobal.drawOutlinedBoundingBox(axisalignedbb, 16777215); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); }
Example #8
Source File: TileEntityQuantumComputer.java From qcraft-mod with Apache License 2.0 | 6 votes |
private Set<EntityItem> getEntityItemsInArea( AreaShape shape ) { AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox( (double) ( xCoord + shape.m_xMin ), (double) ( yCoord + shape.m_yMin ), (double) ( zCoord + shape.m_zMin ), (double) ( xCoord + shape.m_xMax + 1 ), (double) ( yCoord + shape.m_yMax + 1 ), (double) ( zCoord + shape.m_zMax + 1 ) ); List list = worldObj.getEntitiesWithinAABBExcludingEntity( null, aabb ); Set<EntityItem> set = new HashSet<EntityItem>(); for( int i = 0; i < list.size(); ++i ) { Entity entity = (Entity) list.get( i ); if( entity instanceof EntityItem && !entity.isDead ) { set.add( (EntityItem) entity ); } } return set; }
Example #9
Source File: BlockTurbinePart.java From BigReactors with MIT License | 6 votes |
@Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { int metadata = world.getBlockMetadata(x, y, z); if(metadata == METADATA_BEARING) { TileEntity te = world.getTileEntity(x, y, z); if(te instanceof TileEntityTurbineRotorBearing) { TileEntityTurbineRotorBearing bearing = (TileEntityTurbineRotorBearing)te; if(bearing.isConnected() && bearing.getTurbine().getActive()) { return bearing.getAABB(); } } } return super.getCollisionBoundingBoxFromPool(world, x, y, z); }
Example #10
Source File: BlockArcaneDropper.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB boundingBox, List list, Entity entity) { ForgeDirection side = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z) & 7); for(int i = 0; i < COLLISION_BOXES.length; i++) { if(i != side.ordinal()) { this.setBlockBounds(COLLISION_BOXES[i]); super.addCollisionBoxesToList(world, x, y, z, boundingBox, list, entity); } } if(side.offsetX + side.offsetY + side.offsetZ < 0) { this.setBlockBounds(side.offsetX * -0.125f, side.offsetY * -0.125f, side.offsetZ * -0.125f, 1f, 1f, 1f); } else { this.setBlockBounds(0f, 0f, 0f, 1 - side.offsetX * 0.125f, 1 - side.offsetY * 0.125f, 1 - side.offsetZ * 0.125f); } super.addCollisionBoxesToList(world, x, y, z, boundingBox, list, entity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); }
Example #11
Source File: ProgWidgetArea.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
private AxisAlignedBB getAABB(){ ChunkPosition[] areaPoints = getAreaPoints(); if(areaPoints[0] == null) return null; int minX; int minY; int minZ; int maxX; int maxY; int maxZ; if(areaPoints[1] != null) { minX = Math.min(areaPoints[0].chunkPosX, areaPoints[1].chunkPosX); minY = Math.min(areaPoints[0].chunkPosY, areaPoints[1].chunkPosY); minZ = Math.min(areaPoints[0].chunkPosZ, areaPoints[1].chunkPosZ); maxX = Math.max(areaPoints[0].chunkPosX, areaPoints[1].chunkPosX); maxY = Math.max(areaPoints[0].chunkPosY, areaPoints[1].chunkPosY); maxZ = Math.max(areaPoints[0].chunkPosZ, areaPoints[1].chunkPosZ); } else { minX = maxX = areaPoints[0].chunkPosX; minY = maxY = areaPoints[0].chunkPosY; minZ = maxZ = areaPoints[0].chunkPosZ; } return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX + 1, maxY + 1, maxZ + 1); }
Example #12
Source File: FarmLogicHelium.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@Override public Collection<ItemStack> collect(){ List<ItemStack> col = new ArrayList<ItemStack>(); int[] coords = housing.getCoords(); int[] area = housing.getArea(); int[] offset = housing.getOffset(); AxisAlignedBB harvestBox = AxisAlignedBB.getBoundingBox(coords[0] + offset[0], coords[1] + offset[1], coords[2] + offset[2], coords[0] + offset[0] + area[0], coords[1] + offset[1] + area[1], coords[2] + offset[2] + area[2]); List<EntityItem> list = housing.getWorld().getEntitiesWithinAABB(EntityItem.class, harvestBox); for(EntityItem item : list) { if(!item.isDead) { ItemStack contained = item.getEntityItem(); if(isAcceptedGermling(contained)) { col.add(contained.copy()); item.setDead(); } } } return col; }
Example #13
Source File: WirelessBolt.java From WirelessRedstone with MIT License | 6 votes |
public WirelessBolt(World world, Vector3 jammervec, Vector3 targetvec, long seed) { this.world = world; this.seed = seed; this.rand = new Random(seed); ether = RedstoneEther.get(world.isRemote); start = jammervec; end = targetvec; numsegments0 = 1; length = end.copy().subtract(start).mag(); particleMaxAge = fadetime + rand.nextInt(fadetime) - (fadetime / 2); particleAge = -(int) (length * speed); boundingBox = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); boundingBox.setBB(AxisAlignedBB.getBoundingBox( Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z), Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z)) .expand(length / 2, length / 2, length / 2)); segments.add(new Segment(start, end)); }
Example #14
Source File: EntityLivingBaseHook.java From SkyblockAddons with MIT License | 6 votes |
public static void onResetHurtTime(EntityLivingBase entity) { if (entity == Minecraft.getMinecraft().thePlayer) { SkyblockAddons main = SkyblockAddons.getInstance(); if (!main.getUtils().isOnSkyblock() || !main.getConfigValues().isEnabled(Feature.COMBAT_TIMER_DISPLAY)) { return; } Minecraft mc = Minecraft.getMinecraft(); List<Entity> nearEntities = mc.theWorld.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(mc.thePlayer.posX - 3, mc.thePlayer.posY - 2, mc.thePlayer.posZ - 3, mc.thePlayer.posX + 3, mc.thePlayer.posY + 2, mc.thePlayer.posZ + 3)); boolean foundPossibleAttacker = false; for (Entity nearEntity : nearEntities) { if (nearEntity instanceof EntityMob || nearEntity instanceof EntityWolf || nearEntity instanceof IProjectile) { foundPossibleAttacker = true; break; } } if (foundPossibleAttacker) { SkyblockAddons.getInstance().getUtils().setLastDamaged(System.currentTimeMillis()); } } }
Example #15
Source File: EntityWirelessTracker.java From WirelessRedstone with MIT License | 6 votes |
private void attachToNearbyEntities() { if(isAttachedToEntity() || item || attachmentCounter > 0) return; for(Entity entity : (List<Entity>)worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(-10, -10, -10, 10, 10, 10).offset(posX, posY, posZ))) { AxisAlignedBB bb = entity.boundingBox; if(bb != null && entity.width >= 0.3) { if(tryAttach(entity, 0.4, 0.2)) return; } } }
Example #16
Source File: AABBRotator.java From archimedes-ships with MIT License | 5 votes |
/** * @param aabb * The axis aligned boundingbox to rotate * @param ang * The angle to rotate the aabb in radians */ public static void rotateAABBAroundY(AxisAlignedBB aabb, double xoff, double zoff, float ang) { double y0 = aabb.minY; double y1 = aabb.maxY; vec00.xCoord = aabb.minX - xoff; vec00.zCoord = aabb.minZ - zoff; vec01.xCoord = aabb.minX - xoff; vec01.zCoord = aabb.maxZ - zoff; vec10.xCoord = aabb.maxX - xoff; vec10.zCoord = aabb.minZ - zoff; vec11.xCoord = aabb.maxX - xoff; vec11.zCoord = aabb.maxZ - zoff; vec00.rotateAroundY(ang); vec01.rotateAroundY(ang); vec10.rotateAroundY(ang); vec11.rotateAroundY(ang); vec0h.xCoord = (vec00.xCoord + vec01.xCoord) / 2D; vec0h.zCoord = (vec00.zCoord + vec01.zCoord) / 2D; vec1h.xCoord = (vec10.xCoord + vec11.xCoord) / 2D; vec1h.zCoord = (vec10.zCoord + vec11.zCoord) / 2D; vech0.xCoord = (vec00.xCoord + vec10.xCoord) / 2D; vech0.zCoord = (vec00.zCoord + vec10.zCoord) / 2D; vech1.xCoord = (vec01.xCoord + vec11.xCoord) / 2D; vech1.zCoord = (vec01.zCoord + vec11.zCoord) / 2D; aabb.setBounds(minX(), y0, minZ(), maxX(), y1, maxZ()).offset(xoff, 0F, zoff); }
Example #17
Source File: TileEntitySelector.java From OpenPeripheral-Addons with MIT License | 5 votes |
public AxisAlignedBB getSelection(Vec3 hitVec, int side) { final Orientation orientation = getOrientation(); final Vec3 mappedVec = BlockSpaceTransform.instance.mapWorldToBlock(orientation, hitVec.xCoord - xCoord, hitVec.yCoord - yCoord, hitVec.zCoord - zCoord); final int gridSize = getGridSize(); for (ItemSlot center : getSlots(gridSize)) { final AxisAlignedBB aabb = center.box; if (aabb.isVecInside(mappedVec)) return BlockSpaceTransform.instance.mapBlockToWorld(orientation, aabb).offset(xCoord, yCoord, zCoord); } return null; }
Example #18
Source File: ShowArmor.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
public Entity getMouseOver(float partialTicks, double distance, boolean canBeCollidedWith) { Minecraft mc = Wrapper.INSTANCE.mc(); Entity pointedEntity = null; MovingObjectPosition rayTrace = null; if (mc.renderViewEntity != null) { if (mc.theWorld != null) { Vec3 positionVec = mc.renderViewEntity.getPosition(partialTicks); Vec3 lookVec = mc.renderViewEntity.getLook(partialTicks); Vec3 posDistVec = positionVec.addVector(lookVec.xCoord * distance, lookVec.yCoord * distance, lookVec.zCoord * distance); double boxExpand = 1.0F; @SuppressWarnings("unchecked") List<Entity> entities = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.renderViewEntity, mc.renderViewEntity.boundingBox.addCoord(lookVec.xCoord * distance, lookVec.yCoord * distance, lookVec.zCoord * distance).expand(boxExpand, boxExpand, boxExpand)); double mincalc = Double.MAX_VALUE; for (Entity entity : entities) { if (!canBeCollidedWith || entity.canBeCollidedWith()) { double borderSize = entity.getCollisionBorderSize(); AxisAlignedBB expEntityBox = entity.boundingBox.expand(borderSize, borderSize, borderSize); MovingObjectPosition calculateInterceptPos = expEntityBox.calculateIntercept(positionVec, posDistVec); if (calculateInterceptPos != null) { double calcInterceptPosDist = positionVec.distanceTo(calculateInterceptPos.hitVec); if (mincalc > calcInterceptPosDist) { mincalc = calcInterceptPosDist; pointedEntity = entity; } } } } if (pointedEntity != null) { return pointedEntity; } } } return null; }
Example #19
Source File: Entity.java From TickDynamic with MIT License | 5 votes |
/** * Checks if the offset position from the entity's current position is inside of liquid. Args: x, y, z */ public boolean isOffsetPositionInLiquid(double p_70038_1_, double p_70038_3_, double p_70038_5_) { AxisAlignedBB axisalignedbb = this.boundingBox.getOffsetBoundingBox(p_70038_1_, p_70038_3_, p_70038_5_); List list = this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb); return !list.isEmpty() ? false : !this.worldObj.isAnyLiquid(axisalignedbb); }
Example #20
Source File: BlockLightChain.java From GardenCollection with MIT License | 5 votes |
@Override public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z) { float minX = 1; float minZ = 1; float maxX = 0; float maxZ = 0; for (Vec3 point : getAttachPoints(world, x, y, z)) { if (point.xCoord < minX) minX = (float) point.xCoord; if (point.zCoord < minZ) minZ = (float) point.zCoord; if (point.xCoord > maxX) maxX = (float) point.xCoord; if (point.zCoord > maxZ) maxZ = (float) point.zCoord; } if (maxX - minX < .125) { minX = .5f - .0625f; maxX = .5f + .0625f; } if (maxZ - minZ < .125) { minZ = .5f - .0625f; maxZ = .5f + .0625f; } return AxisAlignedBB.getBoundingBox(x + minX, y + 0, z + minZ, x + maxX, y + 1, z + maxZ); }
Example #21
Source File: BlockQuickSand.java From Artifacts with MIT License | 5 votes |
/** * Returns the bounding box of the wired rectangular prism to render. */ @SideOnly(Side.CLIENT) @Override public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); return AxisAlignedBB.getBoundingBox((double)x + this.minX, (double)y + this.minY, (double)z + this.minZ, (double)x + this.maxX, (double)y + this.maxY - (meta / 16), (double)z + this.maxZ); }
Example #22
Source File: SemiBlockRendererHeatFrame.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void render(SemiBlockHeatFrame semiBlock, float partialTick){ GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(Textures.MODEL_HEAT_FRAME); int heatLevel = semiBlock.getHeatLevel(); double[] color = TileEntityCompressedIronBlock.getColorForHeatLevel(heatLevel); GL11.glColor4d(color[0], color[1], color[2], 1); AxisAlignedBB aabb; if(semiBlock.getWorld() != null) { semiBlock.getBlock().setBlockBoundsBasedOnState(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ); aabb = semiBlock.getBlock().getSelectedBoundingBoxFromPool(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ); aabb.minX -= semiBlock.getX(); aabb.maxX -= semiBlock.getX(); aabb.minY -= semiBlock.getY(); aabb.maxY -= semiBlock.getY(); aabb.minZ -= semiBlock.getZ(); aabb.maxZ -= semiBlock.getZ(); } else { aabb = AxisAlignedBB.getBoundingBox(1 / 16D, 1 / 16D, 1 / 16D, 15 / 16D, 15 / 16D, 15 / 16D); } GL11.glTranslated(aabb.minX, aabb.minY, aabb.minZ); GL11.glScaled(aabb.maxX - aabb.minX, aabb.maxY - aabb.minY, aabb.maxZ - aabb.minZ); GL11.glTranslated(0.5, -0.5, 0.5); model.render(null, 0, 0, 0, 0, 0, 1 / 16F); GL11.glPopMatrix(); GL11.glColor4d(1, 1, 1, 1); }
Example #23
Source File: SubTileBloodthorn.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
@Override public void onUpdate() { super.onUpdate(); if(redstoneSignal > 0) return; final int range = 6; final int cost = 40; List<EntityLivingBase> entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range)); for(EntityLivingBase entity : entities) { if(!(entity instanceof EntityPlayer) && entity.getActivePotionEffect(Potion.weakness) == null && mana >= cost && !entity.worldObj.isRemote) { entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2)); mana -= cost; } } }
Example #24
Source File: BlockArcaneCake.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
@Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { int l = world.getBlockMetadata(x, y, z); float f = 0.0625F; float f1 = (float) (1 + l) / 12.0F; float f2 = 0.5F; //return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + f1), (double) y, (double) ((float) z + f), (double) ((float) (x + 1) - f), (double) ((float) y + f2 - f), (double) ((float) (z + 1) - f)); return AxisAlignedBB.getBoundingBox((double)((float)x + f1), (double)y, (double)((float)z + f), (double)((float)(x + 1) - f), (double)((float)y + f2 - f), (double)((float)(z + 1) - f)); }
Example #25
Source File: AltAxisAlignedBB.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
public AxisAlignedBB addCoord(double par1, double par3, double par5) { double var7 = this.minX; double var9 = this.minY; double var11 = this.minZ; double var13 = this.maxX; double var15 = this.maxY; double var17 = this.maxZ; if (par1 < 0.0) { var7 += par1; } if (par1 > 0.0) { var13 += par1; } if (par3 < 0.0) { var9 += par3; } if (par3 > 0.0) { var15 += par3; } if (par5 < 0.0) { var11 += par5; } if (par5 > 0.0) { var17 += par5; } AltAxisAlignedBB.getAABBPool(); return AxisAlignedBB.getBoundingBox(var7, var9, var11, var13, var15, var17); }
Example #26
Source File: AltAxisAlignedBB.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
public AxisAlignedBB expand(double par1, double par3, double par5) { double var7 = this.minX - par1; double var9 = this.minY - par3; double var11 = this.minZ - par5; double var13 = this.maxX + par1; double var15 = this.maxY + par3; double var17 = this.maxZ + par5; AltAxisAlignedBB.getAABBPool(); return AxisAlignedBB.getBoundingBox(var7, var9, var11, var13, var15, var17); }
Example #27
Source File: BlockTrap.java From Artifacts with MIT License | 5 votes |
/** * Ticks the block if it's been scheduled */ @Override public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (!par1World.isRemote) { TileEntity te = par1World.getTileEntity(par2, par3, par4); TileEntityDispenser dis; if(te instanceof TileEntityDispenser) { dis = ((TileEntityDispenser) te); AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(par2-0.2, par3-0.2, par4-0.2, par2+1.2, par3+1.2, par4+1.2); List<EntitySpecialArrow> arrs = par1World.getEntitiesWithinAABB(EntitySpecialArrow.class, aabb); for(int a = arrs.size()-1; a>=0; a--) { EntityArrow arr = arrs.get(a); for(int s=0; s<9; s++) { ItemStack is = dis.getStackInSlot(s); if(is == null) { dis.setInventorySlotContents(s, new ItemStack(Items.arrow, 1)); arr.setDead(); break; } else if(is != null && is.getItem() == Items.arrow) { if(is.stackSize < 64) { is.stackSize++; arr.setDead(); break; } } } } this.dispense(par1World, par2, par3, par4, par5Random.nextInt(4)+1); this.dispense(par1World, par2, par3, par4, par5Random.nextInt(4)+1); } } }
Example #28
Source File: AltAxisAlignedBB.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
public AxisAlignedBB contract(double par1, double par3, double par5) { double var7 = this.minX + par1; double var9 = this.minY + par3; double var11 = this.minZ + par5; double var13 = this.maxX - par1; double var15 = this.maxY - par3; double var17 = this.maxZ - par5; AltAxisAlignedBB.getAABBPool(); return AxisAlignedBB.getBoundingBox(var7, var9, var11, var13, var15, var17); }
Example #29
Source File: FWBlock.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
@Override public AxisAlignedBB getSelectedBoundingBox(World world, BlockPos pos) { Block blockInstance = getBlockInstance(world, VectorConverter.instance().toNova(pos)); if (blockInstance.components.has(Collider.class)) { Cuboid cuboid = blockInstance.components.get(Collider.class).boundingBox.get(); return CuboidConverter.instance().toNative(cuboid.add(VectorConverter.instance().toNova(pos))); } return super.getSelectedBoundingBox(world, pos); }
Example #30
Source File: BWWorld.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public Set<Entity> getEntities(Cuboid bound) { return ((List<net.minecraft.entity.Entity>) world().getEntitiesWithinAABB(net.minecraft.entity.Entity.class, AxisAlignedBB.fromBounds(bound.min.getX(), bound.min.getY(), bound.min.getZ(), bound.max.getX(), bound.max.getY(), bound.max.getZ()))) .stream() .map(EntityConverter.instance()::toNova) .collect(Collectors.toSet()); }