Files
CatServer/patches/net/minecraft/world/gen/feature/WorldGenSavannaTree.java.patch
2019-02-24 22:29:41 +08:00

65 lines
3.4 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java
+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenSavannaTree.java
@@ -52,7 +52,7 @@
{
if (j >= 0 && j < 256)
{
- if (!this.canGrowInto(worldIn.getBlockState(blockpos$mutableblockpos.setPos(l, j, i1)).getBlock()))
+ if (!this.isReplaceable(worldIn,blockpos$mutableblockpos.setPos(l, j, i1)))
{
flag = false;
}
@@ -71,11 +71,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, EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.SAPLING));
- if ((block == Blocks.GRASS || block == Blocks.DIRT) && 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);
EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand);
int k2 = i - rand.nextInt(4) - 1;
int l2 = 3 - rand.nextInt(3);
@@ -95,9 +97,9 @@
}
BlockPos blockpos = new BlockPos(i3, i2, j1);
- Material material = worldIn.getBlockState(blockpos).getMaterial();
+ state = worldIn.getBlockState(blockpos);
- if (material == Material.AIR || material == Material.LEAVES)
+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos))
{
this.placeLogAt(worldIn, blockpos);
k1 = i2;
@@ -149,9 +151,9 @@
i3 += enumfacing1.getFrontOffsetX();
j1 += enumfacing1.getFrontOffsetZ();
BlockPos blockpos1 = new BlockPos(i3, j2, j1);
- Material material1 = worldIn.getBlockState(blockpos1).getMaterial();
+ state = worldIn.getBlockState(blockpos1);
- if (material1 == Material.AIR || material1 == Material.LEAVES)
+ if (state.getBlock().isAir(state, worldIn, blockpos1) || state.getBlock().isLeaves(state, worldIn, blockpos1))
{
this.placeLogAt(worldIn, blockpos1);
k1 = j2;
@@ -209,9 +211,9 @@
private void placeLeafAt(World worldIn, BlockPos pos)
{
- Material material = worldIn.getBlockState(pos).getMaterial();
+ IBlockState state = worldIn.getBlockState(pos);
- if (material == Material.AIR || material == Material.LEAVES)
+ if (state.getBlock().isAir(state, worldIn, pos) || state.getBlock().isLeaves(state, worldIn, pos))
{
this.setBlockAndNotifyAdequately(worldIn, pos, LEAF);
}