@Override public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockFalling.fallInstantly = true; int var4 = par2 * 16; int var5 = par3 * 16; this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); this.rand.setSeed(this.worldObj.getSeed()); final long var7 = this.rand.nextLong() / 2L * 2L + 1L; final long var9 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed(par2 * var7 + par3 * var9 ^ this.worldObj.getSeed()); this.decoratePlanet(this.worldObj, this.rand, var4, var5); this.onPopulate(par1IChunkProvider, par2, par3); BlockFalling.fallInstantly = false; }
@Override public void populate(IChunkProvider chunk, int x, int z) { BlockFalling.fallInstantly = true; int var4 = x * 16; int var5 = z * 16; BiomeGenBase biomeGen = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); this.rand.setSeed(this.worldObj.getSeed()); long var7 = this.rand.nextLong() / 2L * 2L + 1L; long var9 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed(x * var7 + z * var9 ^ this.worldObj.getSeed()); biomeGen.decorate(this.worldObj, this.rand, var4, var5); this.decoratePlanet(this.worldObj, this.rand, var4, var5); SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomeGen, var4 + 8, var5 + 8, 16, 16, this.rand); this.onPopulate(chunk, x, z); BlockFalling.fallInstantly = false; }
private int getHotbarBlock() { for (int index = 36; index < 45; index++) { ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(index).getStack(); if (itemStack != null) { if (itemStack.getItem() instanceof ItemBlock) { if (((ItemBlock) itemStack.getItem()).getBlock() instanceof BlockFalling) continue; if (itemStack.stackSize >= 1) { return index - 36; } } } } return -1; }
@Nullable public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) { IBlockState iblockstate = Block.getStateById(p_178902_15_[0]); if (iblockstate.getBlock() != Blocks.AIR && iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE) { return null; } else { int i = Minecraft.getMinecraft().getBlockColors().getColor(iblockstate); if (iblockstate.getBlock() instanceof BlockFalling) { i = ((BlockFalling)iblockstate.getBlock()).getDustColor(iblockstate); } float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; return new ParticleFallingDust(worldIn, xCoordIn, yCoordIn, zCoordIn, f, f1, f2); } }
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) { IBlockState iblockstate = Block.getStateById(p_178902_15_[0]); if (iblockstate.getBlock() != Blocks.AIR && iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE) { return null; } else { int i = Minecraft.getMinecraft().getBlockColors().getColor(iblockstate); if (iblockstate.getBlock() instanceof BlockFalling) { i = ((BlockFalling)iblockstate.getBlock()).getDustColor(iblockstate); } float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; return new ParticleFallingDust(worldIn, xCoordIn, yCoordIn, zCoordIn, f, f1, f2); } }
@Override public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockFalling.fallInstantly = true; final int var4 = par2 * 16; final int var5 = par3 * 16; this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); this.rand.setSeed(this.worldObj.getSeed()); final long var7 = this.rand.nextLong() / 2L * 2L + 1L; final long var9 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed(par2 * var7 + par3 * var9 ^ this.worldObj.getSeed()); this.dungeonGenerator.handleTileEntities(this.rand); if (!ConfigManagerCore.disableMoonVillageGen) { this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); } this.decoratePlanet(this.worldObj, this.rand, var4, var5); BlockFalling.fallInstantly = false; }
@Override public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockFalling.fallInstantly = true; final int k = par2 * 16; final int l = par3 * 16; this.rand.setSeed(this.worldObj.getSeed()); final long i1 = this.rand.nextLong() / 2L * 2L + 1L; final long j1 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed(par2 * i1 + par3 * j1 ^ this.worldObj.getSeed()); if (k == 0 && l == 0) { this.worldObj.setBlock(k, 64, l, GCBlocks.spaceStationBase, 0, 3); final TileEntity var8 = this.worldObj.getTileEntity(k, 64, l); if (var8 instanceof IMultiBlock) { ((IMultiBlock) var8).onCreate(new BlockVec3(k, 64, l)); } new WorldGenSpaceStation().generate(this.worldObj, this.rand, k - 10, 62, l - 3); } BlockFalling.fallInstantly = false; }
@Override public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockFalling.fallInstantly = true; int var4 = par2 * 16; int var5 = par3 * 16; worldObject.getBiomeGenForCoords(var4 + 16, var5 + 16); random.setSeed(worldObject.getSeed()); long var7 = random.nextLong() / 2l * 2l + 1l; long var9 = random.nextLong() / 2l * 2l + 1l; random.setSeed(par2 * var7 + par3 * var9 ^ worldObject.getSeed()); decoratePlanet(this.worldObject, random, var4, var5); if (pitNest != null) { pitNest.generateStructuresInChunk(worldObject, new Random(), par2, par3); } BlockFalling.fallInstantly = false; if (villageGenerator != null) { villageGenerator.generateStructuresInChunk(worldObject, random, par2, par3); } }
private void updateBlocks() { try { BlockFalling.fallInstantly = true; for (BlockPos pos : blocksToUpdate) { IBlockState state = serverWorld.getBlockState(pos); if (state.getBlock() instanceof BlockFalling) { state.getBlock().updateTick(serverWorld, pos, state, serverWorld.rand); } state.neighborChanged(serverWorld, pos, Blocks.AIR, pos); serverWorld.notifyNeighborsOfStateChange(pos, state.getBlock(), true); } } catch (Throwable e) { e.printStackTrace(); } BlockFalling.fallInstantly = false; }
public static void placeHut(final World world, BlockPos startpos, int[][][] data, IBlockState[] states, Random rand) { for (int pass = 0; pass <= 1; pass++) { for (int y = 0; y < data.length; y++) { for (int x = 0; x < 6; x++) { for (int z = 0; z < 6; z++) { BlockPos pos = startpos.add(x + 5, -y + 5, z + 5); if (data[y][z][x] != -1) { IBlockState state = states[data[y][z][x]]; if (state == null || (pass == 0 && (state.getBlock() instanceof BlockCarpet || state.getBlock() instanceof BlockSapling))) { world.setBlockToAir(pos); } else if (state.getBlock() instanceof BlockFalling) { while (world.getBlockState(pos).getBlock().isReplaceable(world, pos) && !world.isAirBlock(new BlockPos(pos.getX(), 0, pos.getZ()))) { world.setBlockState(pos, state); world.immediateBlockTick(pos, state, rand); } } else if (!(state.getBlock() instanceof BlockSlab) || (world.getBlockState(pos).getBlock().isReplaceable(world, pos) && world.getBlockState(pos).getMaterial() != Material.WATER)) { world.setBlockState(pos, state); } } } } } } }
public static boolean isValidTankBlock(World world, BlockPos pos, IBlockState state, EnumFacing facing) { if(state == null) { return false; } if(world.isAirBlock(pos)) { return false; } if(state.getBlock() instanceof BlockFalling) { return false; } if(Compatibility.INSTANCE.isCNBLoaded) { if(CNBAPIAccess.apiInstance.isBlockChiseled(world, pos)) { return facing != null && CNBCompatibility.INSTANCE.isValid(world, pos, facing); } } return isBlockGlass(state) || facing == null || world.isSideSolid(pos, facing); }
@Override public void populate(int x, int z) { BlockFalling.fallInstantly = true; net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, this.worldObj, this.rand, x, z, false); BlockPos blockpos = new BlockPos(x * 16, 0, z * 16); this.worldObj.getBiomeForCoordsBody(blockpos.add(16, 0, 16)).decorate(this.worldObj, this.worldObj.rand, blockpos); long i = (long)x * (long)x + (long)z * (long)z; if (i > 4096L) { } net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(false, this, this.worldObj, this.rand, x, z, false); BlockFalling.fallInstantly = false; }
protected void fall(World worldIn, BlockPos pos, IBlockState state) { int i = 32; if ((!BlockFalling.fallInstantly) && (worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))) { if (!worldIn.isRemote) { EntityFallingBlockTFC entityfallingblock = new EntityFallingBlockTFC(worldIn, pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D, state); onStartFalling(entityfallingblock); worldIn.spawnEntity(entityfallingblock); } } else { ((World)worldIn).setBlockToAir(pos); BlockPos blockpos; for (blockpos = pos.down(); (canFallInto(worldIn, blockpos)) && (blockpos.getY() > 0); blockpos = blockpos.down()) {} if (blockpos.getY() > 0) { worldIn.setBlockState(blockpos.up(), getDefaultState()); } } }
@Override public void populate(IChunkProvider par1IChunkProvider, int chunkX, int chunkZ) { BlockFalling.fallInstantly = true; final int blockX = chunkX * 16; final int blockZ = chunkZ * 16; this.rand.setSeed(this.worldObjNonPrivate.getSeed()); final long seed1 = this.rand.nextLong() / 2L * 2L + 1L; final long seed2 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed(chunkX * seed1 + chunkZ * seed2 ^ this.worldObjNonPrivate.getSeed()); if (blockX == 0 && blockZ == 0) { // this generates the basis structure new MothershipWorldGen().generate(this.worldObjNonPrivate, this.rand, 0, 64, 0); } BlockFalling.fallInstantly = false; }
/** * Populates chunk with ores etc etc */ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.fallInstantly = true; MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, worldObj.rand, p_73153_2_, p_73153_3_, false)); int k = p_73153_2_ * 16; int l = p_73153_3_ * 16; BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); biomegenbase.decorate(this.worldObj, this.worldObj.rand, k, l); MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, worldObj.rand, p_73153_2_, p_73153_3_, false)); BlockFalling.fallInstantly = false; }
private void handleFallingBlocks(World worldIn, BlockPos pos, IBlockState state) { if(worldIn.isRemote) return; final BlockPos upPos = pos.up(); final IBlockState upState = worldIn.getBlockState(upPos); final Block upBlock = upState.getBlock(); if(upBlock instanceof BlockFalling) { worldIn.setBlockToAir(upPos); } else if(upBlock == Blocks.FLOWING_WATER || upBlock == Blocks.FLOWING_LAVA) { if(upBlock instanceof BlockDynamicLiquid) { int level = upState.getValue(BlockLiquid.LEVEL); if( level < 8) { worldIn.setBlockToAir(upPos); } } } }
@Override public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockFalling.fallInstantly = true; int var4 = par2 * 16; int var5 = par3 * 16; this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); this.rand.setSeed(this.worldObj.getSeed()); long var7 = this.rand.nextLong() / 2L * 2L + 1L; long var9 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed(par2 * var7 + par3 * var9 ^ this.worldObj.getSeed()); this.decoratePlanet(this.worldObj, this.rand, var4, var5); if (!ConfigManagerCore.idRealisticEnabled) { this.blazeNest.generateStructuresInChunk(this.worldObj, new Random(), par2, par3); } BlockFalling.fallInstantly = false; if (!ConfigManagerCore.idRealisticEnabled) { this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); } }
public Particle getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) { IBlockState iblockstate = Block.getStateById(p_178902_15_[0]); if (iblockstate.getBlock() != Blocks.AIR && iblockstate.getRenderType() == EnumBlockRenderType.INVISIBLE) { return null; } else { int i = Minecraft.getMinecraft().getBlockColors().func_189991_a(iblockstate); if (iblockstate.getBlock() instanceof BlockFalling) { i = ((BlockFalling)iblockstate.getBlock()).func_189876_x(iblockstate); } float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; return new ParticleFallingDust(worldIn, xCoordIn, yCoordIn, zCoordIn, f, f1, f2); } }
/** * Populates chunk with ores etc etc */ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.fallInstantly = true; int k = p_73153_2_ * 16; int l = p_73153_3_ * 16; BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); this.rand.setSeed(this.worldObj.getSeed()); long i1 = this.rand.nextLong() / 2L * 2L + 1L; long j1 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed()); boolean flag = false; MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag)); BlockFalling.fallInstantly = false; }
private void assertSpring(World world, int x, int y, int z, Random random) { int meta = world.getBlockMetadata(x, y, z); Spring spring = this.getSpring(meta); world.scheduleBlockUpdate(x, y, z, this, spring.getTickRate()); if (spring.getChance() != -1 && random.nextInt(spring.getChance()) != 0) { return; } Block fluid = spring.getFluidBlock(); int nextY; for (nextY = y + 1; nextY < world.getActualHeight() && world.getBlock(x, nextY, z) == fluid; nextY++) { } int curY = nextY - 1; Block block = world.getBlock(x, nextY, z); boolean seepable = nextY < world.getActualHeight() && (block.getMaterial() == Material.air || block instanceof BlockFalling); boolean canSpring = seepable && (y == curY || (world.getBlock(x+1, curY, z).getMaterial().isSolid() && world.getBlock(x-1, curY, z).getMaterial().isSolid() && world.getBlock(x, curY, z+1).getMaterial().isSolid() && world.getBlock(x, curY, z-1).getMaterial().isSolid())); if (canSpring) { world.setBlock(x, nextY, z, fluid); } }
/** * Populates chunk with ores etc etc */ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.fallInstantly = true; MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, world, world.rand, p_73153_2_, p_73153_3_, false)); int k = p_73153_2_ * 16; int l = p_73153_3_ * 16; BiomeGenBase biomegenbase = this.world.getBiomeGenForCoords(k + 16, l + 16); biomegenbase.decorate(this.world, this.world.rand, k, l); MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, world, world.rand, p_73153_2_, p_73153_3_, false)); BlockFalling.fallInstantly = false; }
@Override public void fall(World world, int x, int y, int z) { if(canFall(world, x, y - 1, z) && y >= 0) { byte radius = 32; if(!BlockFalling.fallInstantly && world.checkChunksExist(x - radius, y - radius, z - radius, x + radius, y + radius, z + radius)) { if(!world.isRemote) { EntityFallingBlock entity = new EntityFallingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this, world.getBlockMetadata(x, y, z)); addFallData(world, x, y, z, entity); world.spawnEntityInWorld(entity); } } else { world.setBlockToAir(x, y, z); while(canFall(world, x, y - 1, z) && y > 0) { y--; } if(y > 0) { world.setBlock(x, y, z, this); } } } }
/** * Populates chunk with ores etc etc */ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.fallInstantly = true; BlockPos blockpos = new BlockPos(p_73153_2_ * 16, 0, p_73153_3_ * 16); this.endWorld.getBiomeGenForCoords(blockpos.add(16, 0, 16)).decorate(this.endWorld, this.endWorld.rand, blockpos); BlockFalling.fallInstantly = false; }
public boolean canBuildAt(BlockPos blockpos) { return !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.EAST))) || !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.WEST))) || !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.UP))) || !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.DOWN))) || !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.SOUTH))) || !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.NORTH))); }
@Override public BuildingStage getBuildStage () { if (block instanceof BlockFalling) { return BuildingStage.SUPPORTED; } else if (block instanceof BlockFluidBase || block instanceof BlockLiquid) { return BuildingStage.EXPANDING; } else if (block.isOpaqueCube()) { return BuildingStage.STANDALONE; } else { return BuildingStage.SUPPORTED; } }
/** * Populates chunk with ores etc etc */ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) { BlockFalling.fallInstantly = true; int k = p_73153_2_ * 16; int l = p_73153_3_ * 16; BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); this.rand.setSeed(this.worldObj.getSeed()); long i1 = this.rand.nextLong() / 2L * 2L + 1L; long j1 = this.rand.nextLong() / 2L * 2L + 1L; this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed()); MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false)); int k1; int l1; int i2; if (this.rand.nextInt(4) == 0) { k1 = k + this.rand.nextInt(16) + 8; l1 = this.rand.nextInt(256); i2 = l + this.rand.nextInt(16) + 8; (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2); } if (biomegenbase.theBiomeDecorator.currentWorld == null) biomegenbase.decorate(this.worldObj, this.rand, k, l); if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false, ANIMALS)) { SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); } k += 8; l += 8; MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, false)); BlockFalling.fallInstantly = false; }
public void die(double X, double Y, double Z) { int x = MathHelper.floor_double(X); int y = MathHelper.floor_double(Y); int z = MathHelper.floor_double(Z); setDead(); worldObj.setBlock(x, y, z, block, metadata, 3); if (block instanceof BlockFalling) ((BlockFalling) block).func_149828_a(worldObj, x, y, z, metadata); if (tileEntityData != null && block instanceof ITileEntityProvider) { TileEntity tileentity = worldObj.getTileEntity(x, y, z); if (tileentity != null) { NBTTagCompound nbttagcompound = new NBTTagCompound(); tileentity.writeToNBT(nbttagcompound); Iterator iter = tileEntityData.func_150296_c().iterator(); while (iter.hasNext()) { String s = (String) iter.next(); NBTBase nbtbase = tileEntityData.getTag(s); if (!s.equals("x") && !s.equals("y") && !s.equals("z")) { nbttagcompound.setTag(s, nbtbase.copy()); } } tileentity.readFromNBT(nbttagcompound); tileentity.markDirty(); } } }
/** Makes the block fall if needed. */ private void tryFall(World world, BlockPos pos) { if (world.isRemote) { return; } if (canFallThrough(world, pos.down())) { if (!BlockFalling.fallInstantly && world .isAreaLoaded(pos.add(-32,-32,-32), pos.add(32,32,32))) { EntityFallingBlock fall = new EntityFallingBlock(world, pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D, world.getBlockState(pos)); world.spawnEntity(fall); } else { IBlockState current = world.getBlockState(pos); world.setBlockToAir(pos); BlockPos check; for (check = pos.down(); canFallThrough(world, check) && check.getY() > 0; check = check.down()) { ; } if (check.getY() > 0) { world.setBlockState(check.up(), current); } } } }
void biomeifyBlocks(Coord col, ChunkPrimer primer, BiomeGenBase biome, double stoneNoise, int min, int max) { if (col == null) return; biome.genTerrainBlocks(col.w, rand, primer, 0, 0, stoneNoise); Coord at = col.copy(); boolean onSolid = false; for (int y = min; y <= max; y++) { IBlockState bs = primer.getBlockState(0, y, 0); Block id = bs.getBlock(); if (id == Blocks.bedrock) continue; if (id == Blocks.air) { onSolid = false; continue; } if (!onSolid && id instanceof BlockFalling) { if (id == Blocks.sand) { boolean isRed = bs.getValue(BlockSand.VARIANT) == BlockSand.EnumType.RED_SAND; if (isRed) { bs = Blocks.red_sandstone.getDefaultState(); } else { bs = Blocks.sandstone.getDefaultState(); } } else { bs = Blocks.stone.getDefaultState(); } } at.y = y; if (id == Blocks.grass) { at.y++; if (at.isSolid()) bs = Blocks.dirt.getDefaultState(); at.y--; } at.set(bs, true); // Notify only if triggered by command? onSolid = true; } }
private void vanillaUpdateMod(){ if (getBlock().getMaterial() == Material.AIR){ this.setDead(); } else{ this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; if (!this.hasNoGravity()) { this.motionY -= 0.03999999910593033D; } if(onGround || no_gravity)this.motionY = 0; this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; if (!this.getEntityWorld().isRemote){ if (this.onGround){ if (this.getEntityWorld().isAirBlock(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))) //Forge: Don't indent below. if (BlockFalling.canFallThrough(this.getEntityWorld().getBlockState(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))) && !no_gravity){ this.onGround = false; return; } this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; this.motionY *= -0.5D; } } } }
private void handleFalling(World world, BlockPos pos) { if (canFallInto(world, pos.down()) && pos.getY() >= 0) { byte b0 = 32; if (!BlockFalling.fallInstantly && world.isAreaLoaded(pos, b0)) { if (!world.isRemote) { IBlockState state = world.getBlockState(pos); EntityFallingFreshWaterBlock entityfallingblock = new EntityFallingFreshWaterBlock(world, (pos.getX() + 0.5F), (pos.getY() + 0.5F), (pos.getZ() + 0.5F), state); WorldTools.spawnEntity(world, entityfallingblock); } } else { world.setBlockToAir(pos); int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); while (canFallInto(world, new BlockPos(x, y-1, z)) && y > 0) { --y; } if (y > 0) { world.setBlockState(new BlockPos(x, y, z), getDefaultState()); world.scheduleUpdate(new BlockPos(x, y, z), this, this.tickRate(world)); } } } }
/** * Populates chunk with ores etc etc */ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockFalling.fallInstantly = true; MinecraftForge.EVENT_BUS .post(new PopulateChunkEvent.Pre(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false)); MinecraftForge.EVENT_BUS .post(new PopulateChunkEvent.Post(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false)); BlockFalling.fallInstantly = false; }