mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 07:19:56 +03:00
73 lines
3.3 KiB
Diff
73 lines
3.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenCanopyTree.java
|
|
@@ -33,9 +33,10 @@
|
|
if (k >= 1 && k + i + 1 < 256)
|
|
{
|
|
BlockPos blockpos = position.down();
|
|
- Block block = worldIn.getBlockState(blockpos).getBlock();
|
|
+ IBlockState state = worldIn.getBlockState(blockpos);
|
|
+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.SAPLING));
|
|
|
|
- if (block != Blocks.GRASS && block != Blocks.DIRT)
|
|
+ if (!(isSoil && position.getY() < worldIn.getHeight() - i - 1))
|
|
{
|
|
return false;
|
|
}
|
|
@@ -45,10 +46,10 @@
|
|
}
|
|
else
|
|
{
|
|
- this.setDirtAt(worldIn, blockpos);
|
|
- this.setDirtAt(worldIn, blockpos.east());
|
|
- this.setDirtAt(worldIn, blockpos.south());
|
|
- this.setDirtAt(worldIn, blockpos.south().east());
|
|
+ this.onPlantGrow(worldIn, blockpos, position);
|
|
+ this.onPlantGrow(worldIn, blockpos.east(), position);
|
|
+ this.onPlantGrow(worldIn, blockpos.south(), position);
|
|
+ this.onPlantGrow(worldIn, blockpos.south().east(), position);
|
|
EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.random(rand);
|
|
int i1 = i - rand.nextInt(4);
|
|
int j1 = 2 - rand.nextInt(3);
|
|
@@ -67,9 +68,9 @@
|
|
|
|
int k2 = k + j2;
|
|
BlockPos blockpos1 = new BlockPos(k1, k2, l1);
|
|
- Material material = worldIn.getBlockState(blockpos1).getMaterial();
|
|
+ state = worldIn.getBlockState(blockpos1);
|
|
|
|
- if (material == Material.AIR || material == Material.LEAVES)
|
|
+ if (state.getBlock().isAir(state, worldIn, blockpos1) || state.getBlock().isLeaves(state, worldIn, blockpos1))
|
|
{
|
|
this.placeLogAt(worldIn, blockpos1);
|
|
this.placeLogAt(worldIn, blockpos1.east());
|
|
@@ -187,7 +188,7 @@
|
|
{
|
|
for (int k1 = -i1; k1 <= i1; ++k1)
|
|
{
|
|
- if (!this.canGrowInto(worldIn.getBlockState(blockpos$mutableblockpos.setPos(i + j1, j + l, k + k1)).getBlock()))
|
|
+ if (!this.isReplaceable(worldIn, blockpos$mutableblockpos.setPos(i + j1, j + l, k + k1)))
|
|
{
|
|
return false;
|
|
}
|
|
@@ -209,11 +210,18 @@
|
|
private void placeLeafAt(World worldIn, int x, int y, int z)
|
|
{
|
|
BlockPos blockpos = new BlockPos(x, y, z);
|
|
- Material material = worldIn.getBlockState(blockpos).getMaterial();
|
|
+ IBlockState state = worldIn.getBlockState(blockpos);
|
|
|
|
- if (material == Material.AIR)
|
|
+ if (state.getBlock().isAir(state, worldIn, blockpos))
|
|
{
|
|
this.setBlockAndNotifyAdequately(worldIn, blockpos, DARK_OAK_LEAVES);
|
|
}
|
|
}
|
|
+
|
|
+ //Just a helper macro
|
|
+ private void onPlantGrow(World world, BlockPos pos, BlockPos source)
|
|
+ {
|
|
+ IBlockState state = world.getBlockState(pos);
|
|
+ state.getBlock().onPlantGrow(state, world, pos, source);
|
|
+ }
|
|
}
|