Files
2019-02-24 22:29:41 +08:00

57 lines
3.2 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java
+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenBirchTree.java
@@ -56,9 +56,9 @@
{
for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1)
{
- if (j >= 0 && j < 256)
+ if (j >= 0 && j < worldIn.getHeight())
{
- if (!this.canGrowInto(worldIn.getBlockState(blockpos$mutableblockpos.setPos(l, j, i1)).getBlock()))
+ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.setPos(l, j, i1)))
{
flag = false;
}
@@ -77,11 +77,13 @@
}
else
{
- Block block = worldIn.getBlockState(position.down()).getBlock();
+ BlockPos down = position.down();
+ IBlockState state = worldIn.getBlockState(down);
+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.SAPLING);
- if ((block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.FARMLAND) && position.getY() < 256 - i - 1)
+ if (isSoil && position.getY() < worldIn.getHeight() - i - 1)
{
- this.setDirtAt(worldIn, position.down());
+ state.getBlock().onPlantGrow(state, worldIn, down, position);
for (int i2 = position.getY() - 3 + i; i2 <= position.getY() + i; ++i2)
{
@@ -99,9 +101,9 @@
if (Math.abs(j1) != l2 || Math.abs(l1) != l2 || rand.nextInt(2) != 0 && k2 != 0)
{
BlockPos blockpos = new BlockPos(i3, i2, k1);
- Material material = worldIn.getBlockState(blockpos).getMaterial();
+ IBlockState state2 = worldIn.getBlockState(blockpos);
- if (material == Material.AIR || material == Material.LEAVES)
+ if (state2.getBlock().isAir(state2, worldIn, blockpos) || state2.getBlock().isAir(state2, worldIn, blockpos))
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, LEAF);
}
@@ -112,9 +114,10 @@
for (int j2 = 0; j2 < i; ++j2)
{
- Material material1 = worldIn.getBlockState(position.up(j2)).getMaterial();
+ BlockPos upN = position.up(j2);
+ IBlockState state2 = worldIn.getBlockState(upN);
- if (material1 == Material.AIR || material1 == Material.LEAVES)
+ if (state2.getBlock().isAir(state2, worldIn, upN) || state2.getBlock().isLeaves(state2, worldIn, upN))
{
this.setBlockAndNotifyAdequately(worldIn, position.up(j2), LOG);
}