mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 06:40:05 +03:00
43 lines
2.2 KiB
Diff
43 lines
2.2 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenShrub.java
|
|
@@ -22,14 +22,14 @@
|
|
|
|
public boolean generate(World worldIn, Random rand, BlockPos position)
|
|
{
|
|
- for (IBlockState iblockstate = worldIn.getBlockState(position); (iblockstate.getMaterial() == Material.AIR || iblockstate.getMaterial() == Material.LEAVES) && position.getY() > 0; iblockstate = worldIn.getBlockState(position))
|
|
+ for (IBlockState iblockstate = worldIn.getBlockState(position); (iblockstate.getBlock().isAir(iblockstate, worldIn, position) || iblockstate.getBlock().isLeaves(iblockstate, worldIn, position)) && position.getY() > 0; iblockstate = worldIn.getBlockState(position))
|
|
{
|
|
position = position.down();
|
|
}
|
|
|
|
- Block block = worldIn.getBlockState(position).getBlock();
|
|
+ IBlockState state = worldIn.getBlockState(position);
|
|
|
|
- if (block == Blocks.DIRT || block == Blocks.GRASS)
|
|
+ if (state.getBlock().canSustainPlant(state, worldIn, position, net.minecraft.util.EnumFacing.UP, ((net.minecraft.block.BlockSapling)Blocks.SAPLING)))
|
|
{
|
|
position = position.up();
|
|
this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata);
|
|
@@ -50,9 +50,9 @@
|
|
if (Math.abs(i1) != k || Math.abs(k1) != k || rand.nextInt(2) != 0)
|
|
{
|
|
BlockPos blockpos = new BlockPos(l, i, j1);
|
|
- Material material = worldIn.getBlockState(blockpos).getMaterial();
|
|
+ state = worldIn.getBlockState(blockpos);
|
|
|
|
- if (material == Material.AIR || material == Material.LEAVES)
|
|
+ if (state.getBlock().canBeReplacedByLeaves(state, worldIn, blockpos))
|
|
{
|
|
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
|
|
}
|
|
@@ -60,6 +60,9 @@
|
|
}
|
|
}
|
|
}
|
|
+ // CraftBukkit start - Return false if gen was unsuccessful
|
|
+ } else {
|
|
+ return false;
|
|
}
|
|
|
|
return true;
|