Java Code Examples for net.minecraft.util.math.BlockPos#getZ()
The following examples show how to use
net.minecraft.util.math.BlockPos#getZ() .
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: RecipeLogicSteam.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
protected void tryDoVenting() { BlockPos machinePos = metaTileEntity.getPos(); EnumFacing ventingSide = getVentingSide(); BlockPos ventingBlockPos = machinePos.offset(ventingSide); IBlockState blockOnPos = metaTileEntity.getWorld().getBlockState(ventingBlockPos); if (blockOnPos.getCollisionBoundingBox(metaTileEntity.getWorld(), ventingBlockPos) == Block.NULL_AABB) { metaTileEntity.getWorld() .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET) .forEach(entity -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0f)); WorldServer world = (WorldServer) metaTileEntity.getWorld(); double posX = machinePos.getX() + 0.5 + ventingSide.getFrontOffsetX() * 0.6; double posY = machinePos.getY() + 0.5 + ventingSide.getFrontOffsetY() * 0.6; double posZ = machinePos.getZ() + 0.5 + ventingSide.getFrontOffsetZ() * 0.6; world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ, 7 + world.rand.nextInt(3), ventingSide.getFrontOffsetX() / 2.0, ventingSide.getFrontOffsetY() / 2.0, ventingSide.getFrontOffsetZ() / 2.0, 0.1); world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); setNeedsVenting(false); } else if (!ventingStuck) { setVentingStuck(true); } }
Example 2
Source File: WorldUtils.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
public static void loadChunksClientWorld(WorldClient world, BlockPos origin, Vec3i areaSize) { BlockPos posEnd = origin.add(PositionUtils.getRelativeEndPositionFromAreaSize(areaSize)); BlockPos posMin = fi.dy.masa.malilib.util.PositionUtils.getMinCorner(origin, posEnd); BlockPos posMax = fi.dy.masa.malilib.util.PositionUtils.getMaxCorner(origin, posEnd); final int cxMin = posMin.getX() >> 4; final int czMin = posMin.getZ() >> 4; final int cxMax = posMax.getX() >> 4; final int czMax = posMax.getZ() >> 4; for (int cz = czMin; cz <= czMax; ++cz) { for (int cx = cxMin; cx <= cxMax; ++cx) { world.getChunkProvider().loadChunk(cx, cz); } } }
Example 3
Source File: BlockOrbHolder.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = playerIn.getHeldItem(hand); TileOrbHolder te = getTE(worldIn, pos); if (!te.containsCell()) { if (heldItem.getItem() == ModItems.ORB || heldItem.getItem() == ModItems.PEARL_NACRE) { te.setItemStack(heldItem.copy()); te.getItemStack().setCount(1); heldItem.shrink(1); } else return false; } else { ItemStack stack = te.getItemStack().copy(); te.setItemStack(ItemStack.EMPTY); if (playerIn.inventory.addItemStackToInventory(stack)) playerIn.openContainer.detectAndSendChanges(); else { EntityItem entityItem = new EntityItem(worldIn, pos.getX(), pos.getY() + 1, pos.getZ(), stack); worldIn.spawnEntity(entityItem); } } te.markDirty(); return true; }
Example 4
Source File: EntityUtil.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
public static BlockPos findRandomLandingSurface(EntityLiving entity, int searchRange, int minY, int maxY) { BlockPos ep = entity.getPosition(); World worldObj = entity.getEntityWorld(); int x = ep.getX() + -searchRange + (worldObj.rand.nextInt(searchRange + 1) * 2); int z = ep.getZ() + -searchRange + (worldObj.rand.nextInt(searchRange + 1) * 2); return findClearLandingSurface(entity, x, z, minY, maxY); }
Example 5
Source File: TileEntityElevator.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private Vec3d getMoveVector(boolean goingUp) { BlockPos center = goingUp ? this.getPos().up() : this.getPos().down(); int rangeHorizontal = 64; int rangeVerticalUp = goingUp ? 256 : 0; int rangeVerticalDown = goingUp ? 0 : 256; IBlockState state = this.getWorld().getBlockState(this.getPos()); if ((state.getBlock() instanceof BlockElevator) == false) { EnderUtilities.logger.warn("Wrong block in {}#getMoveVector", this.getClass().getSimpleName()); return null; } List<BlockPosDistance> elevators = PositionUtils.getTileEntityPositions(this.getWorld(), center, rangeHorizontal, rangeVerticalUp, rangeVerticalDown, isMatchingElevator(state.getValue(BlockElevator.COLOR))); if (elevators.size() > 0) { World world = this.getWorld(); BlockPos posFound = elevators.get(0).pos; AxisAlignedBB bbThis = world.getBlockState(this.getPos()).getBoundingBox(world, this.getPos()); AxisAlignedBB bbFound = world.getBlockState(posFound).getBoundingBox(world, posFound); double yDiff = (posFound.getY() + bbFound.maxY) - (this.getPos().getY() + bbThis.maxY); return new Vec3d(posFound.getX() - this.getPos().getX(), yDiff, posFound.getZ() - this.getPos().getZ()); } return null; }
Example 6
Source File: WorldPhysicsCollider.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
private boolean handleLikelyCollision(BlockPos inWorldPos, BlockPos inLocalPos, IBlockState inWorldState, IBlockState inLocalState) { // System.out.println("Handling a likely collision"); AxisAlignedBB inLocalBB = new AxisAlignedBB(inLocalPos.getX(), inLocalPos.getY(), inLocalPos.getZ(), inLocalPos.getX() + 1, inLocalPos.getY() + 1, inLocalPos.getZ() + 1); AxisAlignedBB inGlobalBB = new AxisAlignedBB(inWorldPos.getX(), inWorldPos.getY(), inWorldPos.getZ(), inWorldPos.getX() + 1, inWorldPos.getY() + 1, inWorldPos.getZ() + 1); // This changes the box bounding box to the real bounding box, not sure if this // is better or worse for this mod // List<AxisAlignedBB> colBB = worldObj.getCollisionBoxes(inLocalBB); // inLocalBB = colBB.get(0); Polygon shipInWorld = new Polygon(inLocalBB, parent.getShipTransformationManager().getCurrentPhysicsTransform(), TransformType.SUBSPACE_TO_GLOBAL); Polygon worldPoly = new Polygon(inGlobalBB); PhysPolygonCollider collider = new PhysPolygonCollider(shipInWorld, worldPoly, parent.getShipTransformationManager().normals); if (!collider.seperated) { return handleActualCollision(collider, inWorldPos, inLocalPos, inWorldState, inLocalState); } return false; }
Example 7
Source File: BlockElectricMushroom.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if(!world.isRemote && Configuration.electricPlantsSpawnLightning && world.isRaining() && world.getBiome(pos) == AdvancedRocketryBiomes.stormLandsBiome) { int lightningX = pos.getX() + rand.nextInt(24) - 12; int lightningZ = pos.getZ() + rand.nextInt(24) - 12; BlockPos lightning = new BlockPos(lightningX, 0, lightningZ ); lightning = world.getTopSolidOrLiquidBlock(lightning); world.addWeatherEffect(new EntityLightningBolt(world, lightning.getX(), lightning.getY(), lightning.getZ(), true)); } }
Example 8
Source File: VSWorldEventListener.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
@Override public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) { if (!worldObj.isRemote) { for (EntityPlayer entityplayermp : worldObj.playerEntities) { if (entityplayermp != null && entityplayermp.getEntityId() != breakerId) { Vector posVector = new Vector(pos.getX(), pos.getY(), pos.getZ()); Optional<PhysicsObject> physicsObject = ValkyrienUtils .getPhysicsObject(worldObj, pos); physicsObject.ifPresent(object -> object .getShipTransformationManager() .getCurrentTickTransform() .transform(posVector, TransformType.SUBSPACE_TO_GLOBAL)); double d0 = posVector.X - entityplayermp.posX; double d1 = posVector.Y - entityplayermp.posY; double d2 = posVector.Z - entityplayermp.posZ; if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { ((EntityPlayerMP) entityplayermp).connection .sendPacket(new SPacketBlockBreakAnim(breakerId, pos, progress)); } } } } }
Example 9
Source File: RenderUtils.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
public static void drawBlockBoundingBoxOutlinesBatchedLines(BlockPos pos, Color4f color, double expand, BufferBuilder buffer, Entity renderViewEntity, float partialTicks) { double dx = renderViewEntity.lastTickPosX + (renderViewEntity.posX - renderViewEntity.lastTickPosX) * partialTicks; double dy = renderViewEntity.lastTickPosY + (renderViewEntity.posY - renderViewEntity.lastTickPosY) * partialTicks; double dz = renderViewEntity.lastTickPosZ + (renderViewEntity.posZ - renderViewEntity.lastTickPosZ) * partialTicks; double minX = pos.getX() - dx - expand; double minY = pos.getY() - dy - expand; double minZ = pos.getZ() - dz - expand; double maxX = pos.getX() - dx + expand + 1; double maxY = pos.getY() - dy + expand + 1; double maxZ = pos.getZ() - dz + expand + 1; fi.dy.masa.malilib.render.RenderUtils.drawBoxAllEdgesBatchedLines(minX, minY, minZ, maxX, maxY, maxZ, color, buffer); }
Example 10
Source File: ChunkCacheSchematic.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
@Nullable public TileEntity getTileEntity(BlockPos pos, Chunk.EnumCreateEntityType type) { int i = (pos.getX() >> 4) - this.chunkStartX; int j = (pos.getZ() >> 4) - this.chunkStartZ; return this.chunkArray[i][j].getTileEntity(pos, type); }
Example 11
Source File: PositionUtils.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
/** * Mirrors and then rotates the given position around the origin */ public static BlockPos getTransformedBlockPos(BlockPos pos, Mirror mirror, Rotation rotation) { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); boolean isMirrored = true; switch (mirror) { // LEFT_RIGHT is essentially NORTH_SOUTH case LEFT_RIGHT: z = -z; break; // FRONT_BACK is essentially EAST_WEST case FRONT_BACK: x = -x; break; default: isMirrored = false; } switch (rotation) { case CLOCKWISE_90: return new BlockPos(-z, y, x); case COUNTERCLOCKWISE_90: return new BlockPos( z, y, -x); case CLOCKWISE_180: return new BlockPos(-x, y, -z); default: return isMirrored ? new BlockPos(x, y, z) : pos; } }
Example 12
Source File: ScorchedRockBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Override public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { double x = (double) pos.getX() + random.nextDouble() * 0.10000000149011612D; double y = (double) pos.getY() + random.nextDouble(); double z = (double) pos.getZ() + random.nextDouble(); world.addParticle(ParticleTypes.LARGE_SMOKE, x, y, z, 0.0D, 0.0D, 0.0D); }
Example 13
Source File: EntityAIWanderHex.java From TFC2 with GNU General Public License v3.0 | 4 votes |
@Nullable public static Vec3d generateRandomPosInCenter(EntityCreature entity, int xz, int y,boolean pathThroughWater, IslandMap map, Center c) { PathNavigate pathnavigate = entity.getNavigator(); Random random = entity.getRNG(); boolean flag; BlockPos centerPos = c.point.toBlockPos().add(map.getParams().getWorldX(), 0, map.getParams().getWorldZ()); if (entity.hasHome()) { double d0 = entity.getHomePosition().distanceSq((double)MathHelper.floor(entity.posX), (double)MathHelper.floor(entity.posY), (double)MathHelper.floor(entity.posZ)) + 4.0D; double d1 = (double)(entity.getMaximumHomeDistance() + (float)xz); flag = d0 < d1 * d1; } else { flag = false; } boolean flag1 = false; float weight = -99999.0F; int outX = 0; int outY = 0; int outZ = 0; for (int k = 0; k < 10; ++k) { int _x = random.nextInt(2 * xz + 1) - xz; int _y = random.nextInt(2 * y + 1) - y; int _z = random.nextInt(2 * xz + 1) - xz; if (entity.hasHome() && xz > 1) { BlockPos blockpos = entity.getHomePosition(); if (entity.posX > (double)blockpos.getX()) { _x -= random.nextInt(xz / 2); } else { _x += random.nextInt(xz / 2); } if (entity.posZ > (double)blockpos.getZ()) { _z -= random.nextInt(xz / 2); } else { _z += random.nextInt(xz / 2); } } BlockPos blockpos1 = new BlockPos((double)_x + centerPos.getX(), (double)_y + centerPos.getY(), (double)_z + centerPos.getZ()); if ((!flag || entity.isWithinHomeDistanceFromPosition(blockpos1)) && pathnavigate.canEntityStandOnPos(blockpos1)) { if (!pathThroughWater) { blockpos1 = moveAboveSolid(blockpos1, entity); if (isWaterDestination(blockpos1, entity)) { continue; } } float _weight = entity.getBlockPathWeight(blockpos1); if (_weight > weight) { weight = _weight; outX = _x; outY = _y; outZ = _z; flag1 = true; } } } if (flag1) { return new Vec3d((double)outX + centerPos.getX(), (double)outY + centerPos.getY(), (double)outZ + centerPos.getZ()); } else { return null; } }
Example 14
Source File: ChunkUpgrader.java From multiconnect with MIT License | 4 votes |
public static UpgradeData fixChunk(WorldChunk chunk) { IntList centerIndicesToUpgrade = new IntArrayList(); int sidesToUpgrade = 0; BlockPos.Mutable otherPos = new BlockPos.Mutable(); for (BlockPos pos : BlockPos.iterate(chunk.getPos().getStartX(), 0, chunk.getPos().getStartZ(), chunk.getPos().getEndX(), chunk.getHighestNonEmptySectionYOffset() + 15, chunk.getPos().getEndZ())) { BlockState state = chunk.getBlockState(pos); Block block = state.getBlock(); inPlaceFix(chunk, state, pos, otherPos); int blockId = Registry.BLOCK.getRawId(block) & 4095; if (ChunkPalettedStorageFixAccessor.getBlocksNeedingSideUpdate().get(blockId)) { boolean west = (pos.getX() & 15) == 0; boolean east = (pos.getX() & 15) == 15; boolean north = (pos.getZ() & 15) == 0; boolean south = (pos.getZ() & 15) == 15; if (north) { if (east) { sidesToUpgrade |= 2; } else if (west) { sidesToUpgrade |= 128; } else { sidesToUpgrade |= 1; } } else if (south) { if (west) { sidesToUpgrade |= 32; } else if (east) { sidesToUpgrade |= 8; } else { sidesToUpgrade |= 16; } } else if (east) { sidesToUpgrade |= 4; } else if (west) { sidesToUpgrade |= 64; } else { centerIndicesToUpgrade.add(pos.getY() << 8 | (pos.getZ() & 15) << 4 | (pos.getX() & 15)); } } } if (centerIndicesToUpgrade.isEmpty() && sidesToUpgrade == 0) return null; CompoundTag upgradeData = new CompoundTag(); upgradeData.putInt("Sides", sidesToUpgrade); CompoundTag centerIndices = new CompoundTag(); centerIndicesToUpgrade.forEach((IntConsumer) index -> { int low = index & 4095; int high = index >>> 12; Tag tag = centerIndices.get(String.valueOf(high)); if (tag == null) centerIndices.put(String.valueOf(high), tag = new ListTag()); ((ListTag) tag).add(IntTag.of(low)); }); for (String key : centerIndices.getKeys()) { //noinspection ConstantConditions centerIndices.put(key, new IntArrayTag(((ListTag) centerIndices.get(key)).stream().mapToInt(val -> ((IntTag) val).getInt()).toArray())); } upgradeData.put("Indices", centerIndices); return new UpgradeData(upgradeData); }
Example 15
Source File: WorldGenFallenTree.java From Traverse-Legacy-1-12-2 with MIT License | 4 votes |
public boolean generate(World worldIn, Random rand, BlockPos position) { int num = rand.nextInt(5); EnumFacing orientation; if (num == 0) { orientation = EnumFacing.EAST; stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X); } else if (num == 1) { orientation = EnumFacing.WEST; stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X); } else if (num == 1) { orientation = EnumFacing.SOUTH; stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z); } else { orientation = EnumFacing.NORTH; stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z); } int i = rand.nextInt(2) + this.minTreeLength; boolean flag = true; if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) { for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) { int k = 1; if (j == position.getY()) { k = 0; } if (j >= position.getY() + 1 + i - 2) { k = 2; } BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) { if (j >= 0 && j < worldIn.getHeight()) { if (!this.isReplaceable(worldIn, mutablePos.setPos(l, j, i1))) { flag = false; } } else { flag = false; } } } } if (!flag) { return false; } else { IBlockState state = worldIn.getBlockState(position.down()); if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) { state.getBlock().onPlantGrow(state, worldIn, position.down(), position); for (int j3 = 0; j3 < i; ++j3) { BlockPos offsetPos = position.offset(orientation, j3); state = worldIn.getBlockState(offsetPos); if (state.getBlock().isAir(state, worldIn, offsetPos) || state.getBlock().isLeaves(state, worldIn, offsetPos) || state.getMaterial() == Material.VINE) { this.setBlockAndNotifyAdequately(worldIn, position.offset(orientation, j3), this.stateWood); } } return true; } else { return false; } } } else { return false; } }
Example 16
Source File: BlockPosBox.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
public boolean containsPosition(BlockPos pos) { return pos.getX() >= this.posMin.getX() && pos.getX() <= this.posMax.getX() && pos.getY() >= this.posMin.getY() && pos.getY() <= this.posMax.getY() && pos.getZ() >= this.posMin.getZ() && pos.getZ() <= this.posMax.getZ(); }
Example 17
Source File: BlockPosEU.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
public BlockPosEU(BlockPos pos) { this(pos.getX(), pos.getY(), pos.getZ()); }
Example 18
Source File: WorldGenBigSakura.java From Sakura_mod with MIT License | 4 votes |
public FoliageCoordinates(BlockPos pos, int p_i45635_2_) { super(pos.getX(), pos.getY(), pos.getZ()); this.branchBase = p_i45635_2_; }
Example 19
Source File: WorldGenSakuraTree.java From Sakura_mod with MIT License | 4 votes |
public boolean generate(World worldIn, Random rand, BlockPos position) { int i = rand.nextInt(3) + this.minTreeHeight; boolean flag = true; if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) { for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) { int k = 1; if (j == position.getY()) { k = 0; } if (j >= position.getY() + 1 + i - 2) { k = 2; } BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) { for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) { if (j >= 0 && j < worldIn.getHeight()) { if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.setPos(l, j, i1))) { flag = false; } } else { flag = false; } } } } if (!flag) { return false; } IBlockState state = worldIn.getBlockState(position.down()); if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) { state.getBlock().onPlantGrow(state, worldIn, position.down(), position); for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) { int i4 = i3 - (position.getY() + i); int j1 = 1 - i4 / 2; for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) { int l1 = k1 - position.getX(); for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) { int j2 = i2 - position.getZ(); if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) { BlockPos blockpos = new BlockPos(k1, i3, i2); state = worldIn.getBlockState(blockpos); if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) { this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves); } } } } } for (int j3 = 0; j3 < i; ++j3) { BlockPos upN = position.up(j3); state = worldIn.getBlockState(upN); if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) { this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood); } } return true; } return false; } return false; }
Example 20
Source File: WeatherRenderer.java From TFC2 with GNU General Public License v3.0 | 4 votes |
public static void addRainParticles(Random random, int rendererUpdateCount) { Minecraft mc = Minecraft.getMinecraft(); WorldClient worldclient = mc.world; if(worldclient.provider.getDimension() != 0) return; float rainStrength = (float)WeatherManager.getInstance().getPrecipitation((int)mc.player.posX, (int)mc.player.posZ); double tempPlayer = WeatherManager.getInstance().getTemperature((int)mc.player.posX,(int)mc.player.posY, (int)mc.player.posZ); if(tempPlayer <= 0) return; if (!mc.gameSettings.fancyGraphics) { rainStrength /= 2.0F; } if (rainStrength > 0.0F) { worldclient.rand.setSeed((long)rendererUpdateCount * 312987231L); Entity entity = mc.getRenderViewEntity(); BlockPos blockpos = new BlockPos(entity); byte b0 = 10; double d0 = 0.0D; double d1 = 0.0D; double d2 = 0.0D; int i = 0; int rainParticles = Math.max((int)(100.0F * rainStrength * rainStrength), 4); if (mc.gameSettings.particleSetting == 1) { rainParticles >>= 1; } else if (mc.gameSettings.particleSetting == 2) { rainParticles = 0; } for (int k = 0; k < rainParticles; ++k) { BlockPos blockPos1 = worldclient.getPrecipitationHeight(blockpos.add(worldclient.rand.nextInt(b0) - worldclient.rand.nextInt(b0), 0, worldclient.rand.nextInt(b0) - worldclient.rand.nextInt(b0))); double temp = WeatherManager.getInstance().getTemperature(blockPos1); BlockPos blockpos2 = blockPos1.down(); IBlockState state = worldclient.getBlockState(blockpos2); Block block = worldclient.getBlockState(blockpos2).getBlock(); if (blockPos1.getY() <= blockpos.getY() + b0 && blockPos1.getY() >= blockpos.getY() - b0 && temp > 0) { float f1 = worldclient.rand.nextFloat(); float f2 = worldclient.rand.nextFloat(); AxisAlignedBB axisalignedbb = state.getBoundingBox(worldclient, blockpos2); if (block.getMaterial(state) == Material.LAVA) { mc.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)((float)blockPos1.getX() + f1), (double)((float)blockPos1.getY() + 0.1F) - axisalignedbb.minY, (double)((float)blockPos1.getZ() + f2), 0.0D, 0.0D, 0.0D, new int[0]); } else if (block.getMaterial(state) != Material.AIR) { //block.setBlockBoundsBasedOnState(worldclient, blockpos2); ++i; if (worldclient.rand.nextInt(i) == 0) { d0 = (double)((float)blockpos2.getX() + f1); d1 = (double)((float)blockpos2.getY() + 0.1F) + axisalignedbb.maxY - 1.0D; d2 = (double)((float)blockpos2.getZ() + f2); } mc.world.spawnParticle(EnumParticleTypes.WATER_DROP, (double)((float)blockpos2.getX() + f1), (double)((float)blockpos2.getY() + 0.1F) + axisalignedbb.maxY, (double)((float)blockpos2.getZ() + f2), 0.0D, 0.0D, 0.0D, new int[0]); } } } if (i > 0 && worldclient.rand.nextInt(3) < rainSoundCounter++) { rainSoundCounter = 0; if (d1 > (double)(blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos).getY() > MathHelper.floor((float)blockpos.getY())) { mc.world.playSound(d0, d1, d2, SoundEvents.WEATHER_RAIN_ABOVE, SoundCategory.WEATHER, 0.1F*rainStrength, 0.5F, false); } else { mc.world.playSound(d0, d1, d2, SoundEvents.WEATHER_RAIN, SoundCategory.WEATHER, 0.2F*rainStrength, 1.0F, false); } } } }