mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 09:26:08 +03:00
70 lines
3.5 KiB
Diff
70 lines
3.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenHugeTrees.java
|
|
@@ -59,7 +59,7 @@
|
|
{
|
|
for (int l = -j; l <= j && flag; ++l)
|
|
{
|
|
- if (leavesPos.getY() + i < 0 || leavesPos.getY() + i >= 256 || !this.canGrowInto(worldIn.getBlockState(leavesPos.add(k, i, l)).getBlock()))
|
|
+ if (leavesPos.getY() + i < 0 || leavesPos.getY() + i >= 256 || (!this.isReplaceable(worldIn,leavesPos.add(k, i, l)) && worldIn.getBlockState(leavesPos.add(k, i, l)).getBlock() != Blocks.SAPLING)) // CraftBukkit - ignore our own saplings
|
|
{
|
|
flag = false;
|
|
}
|
|
@@ -78,14 +78,15 @@
|
|
private boolean ensureDirtsUnderneath(BlockPos pos, World worldIn)
|
|
{
|
|
BlockPos blockpos = pos.down();
|
|
- Block block = worldIn.getBlockState(blockpos).getBlock();
|
|
+ IBlockState state = worldIn.getBlockState(blockpos);
|
|
+ boolean isSoil = state.getBlock().canSustainPlant(state, worldIn, blockpos, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.SAPLING));
|
|
|
|
- if ((block == Blocks.GRASS || block == Blocks.DIRT) && pos.getY() >= 2)
|
|
+ if (isSoil && pos.getY() >= 2)
|
|
{
|
|
- this.setDirtAt(worldIn, blockpos);
|
|
- this.setDirtAt(worldIn, blockpos.east());
|
|
- this.setDirtAt(worldIn, blockpos.south());
|
|
- this.setDirtAt(worldIn, blockpos.south().east());
|
|
+ this.onPlantGrow(worldIn, blockpos, pos);
|
|
+ this.onPlantGrow(worldIn, blockpos.east(), pos);
|
|
+ this.onPlantGrow(worldIn, blockpos.south(), pos);
|
|
+ this.onPlantGrow(worldIn, blockpos.south().east(), pos);
|
|
return true;
|
|
}
|
|
else
|
|
@@ -113,9 +114,9 @@
|
|
if (j * j + k * k <= i || l * l + i1 * i1 <= i || j * j + i1 * i1 <= i || l * l + k * k <= i)
|
|
{
|
|
BlockPos blockpos = layerCenter.add(j, 0, k);
|
|
- Material material = worldIn.getBlockState(blockpos).getMaterial();
|
|
+ IBlockState 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.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
|
|
}
|
|
@@ -135,9 +136,9 @@
|
|
if (j * j + k * k <= i)
|
|
{
|
|
BlockPos blockpos = layerCenter.add(j, 0, k);
|
|
- Material material = worldIn.getBlockState(blockpos).getMaterial();
|
|
+ IBlockState 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.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
|
|
}
|
|
@@ -145,4 +146,11 @@
|
|
}
|
|
}
|
|
}
|
|
+
|
|
+ //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);
|
|
+ }
|
|
}
|