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

109 lines
6.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java
+++ ../src-work/minecraft/net/minecraft/world/gen/feature/WorldGenTrees.java
@@ -44,7 +44,7 @@
int i = rand.nextInt(3) + this.minTreeHeight;
boolean flag = true;
- if (position.getY() >= 1 && position.getY() + i + 1 <= 256)
+ if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight())
{
for (int j = position.getY(); j <= position.getY() + 1 + i; ++j)
{
@@ -66,9 +66,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;
}
@@ -87,11 +87,11 @@
}
else
{
- Block block = worldIn.getBlockState(position.down()).getBlock();
+ IBlockState state = worldIn.getBlockState(position.down());
- if ((block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.FARMLAND) && position.getY() < 256 - i - 1)
+ if (state.getBlock().canSustainPlant(state, worldIn, position.down(), EnumFacing.UP, (net.minecraft.block.BlockSapling)Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1)
{
- this.setDirtAt(worldIn, position.down());
+ state.getBlock().onPlantGrow(state, worldIn, position.down(), position);
int k2 = 3;
int l2 = 0;
@@ -111,9 +111,9 @@
if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0)
{
BlockPos blockpos = new BlockPos(k1, i3, i2);
- Material material = worldIn.getBlockState(blockpos).getMaterial();
+ state = worldIn.getBlockState(blockpos);
- if (material == Material.AIR || material == Material.LEAVES || material == Material.VINE)
+ if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
}
@@ -124,9 +124,10 @@
for (int j3 = 0; j3 < i; ++j3)
{
- Material material1 = worldIn.getBlockState(position.up(j3)).getMaterial();
+ BlockPos upN = position.up(j3);
+ state = worldIn.getBlockState(upN);
- if (material1 == Material.AIR || material1 == Material.LEAVES || material1 == Material.VINE)
+ if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE)
{
this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
@@ -169,29 +170,30 @@
{
blockpos$mutableblockpos1.setPos(l4, k3, i5);
- if (worldIn.getBlockState(blockpos$mutableblockpos1).getMaterial() == Material.LEAVES)
+ state = worldIn.getBlockState(blockpos$mutableblockpos1);
+ if (state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos1))
{
BlockPos blockpos2 = blockpos$mutableblockpos1.west();
BlockPos blockpos3 = blockpos$mutableblockpos1.east();
BlockPos blockpos4 = blockpos$mutableblockpos1.north();
BlockPos blockpos1 = blockpos$mutableblockpos1.south();
- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getMaterial() == Material.AIR)
+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos2))
{
this.addHangingVine(worldIn, blockpos2, BlockVine.EAST);
}
- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos3).getMaterial() == Material.AIR)
+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos3))
{
this.addHangingVine(worldIn, blockpos3, BlockVine.WEST);
}
- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getMaterial() == Material.AIR)
+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos4))
{
this.addHangingVine(worldIn, blockpos4, BlockVine.SOUTH);
}
- if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getMaterial() == Material.AIR)
+ if (rand.nextInt(4) == 0 && worldIn.isAirBlock(blockpos1))
{
this.addHangingVine(worldIn, blockpos1, BlockVine.NORTH);
}
@@ -245,7 +247,7 @@
this.addVine(worldIn, pos, prop);
int i = 4;
- for (BlockPos blockpos = pos.down(); worldIn.getBlockState(blockpos).getMaterial() == Material.AIR && i > 0; --i)
+ for (BlockPos blockpos = pos.down(); worldIn.isAirBlock(blockpos) && i > 0; --i)
{
this.addVine(worldIn, blockpos, prop);
blockpos = blockpos.down();