This commit is contained in:
eaglercraft 2024-02-19 02:02:25 -08:00
commit 401ebe2324
1261 changed files with 12766 additions and 138431 deletions

View file

@ -69,6 +69,29 @@ public class BlockGrass extends Block implements IGrowable {
return BiomeColorHelper.getGrassColorAtPos(iblockaccess, blockpos);
}
public void updateTick(World world, BlockPos blockpos, IBlockState var3, EaglercraftRandom random) {
if (!world.isRemote) {
if (world.getLightFromNeighbors(blockpos.up()) < 4
&& world.getBlockState(blockpos.up()).getBlock().getLightOpacity() > 2) {
world.setBlockState(blockpos, Blocks.dirt.getDefaultState());
} else {
if (world.getLightFromNeighbors(blockpos.up()) >= 9) {
for (int i = 0; i < 4; ++i) {
BlockPos blockpos1 = blockpos.add(random.nextInt(3) - 1, random.nextInt(5) - 3,
random.nextInt(3) - 1);
Block block = world.getBlockState(blockpos1.up()).getBlock();
IBlockState iblockstate = world.getBlockState(blockpos1);
if (iblockstate.getBlock() == Blocks.dirt
&& iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT
&& world.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2) {
world.setBlockState(blockpos1, Blocks.grass.getDefaultState());
}
}
}
}
}
}
/**+
* Get the Item that this Block should drop when harvested.
*/