Rework AbstractTreeFeature patches to reduce impact and avoid name conflicts

This commit is contained in:
tterrag 2019-06-12 00:48:11 -04:00
parent d5ee80a70a
commit dc95130526
13 changed files with 47 additions and 429 deletions

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/gen/feature/AbstractTreeFeature.java
+++ b/net/minecraft/world/gen/feature/AbstractTreeFeature.java
@@ -27,10 +27,13 @@
@@ -27,19 +27,25 @@
import net.minecraft.world.gen.feature.template.Template;
public abstract class AbstractTreeFeature<T extends IFeatureConfig> extends Feature<T> {
@ -10,83 +10,65 @@
super(p_i49920_1_, p_i49920_2_);
}
+ @Deprecated //Forge: Moved to canBeReplacedByLog
protected static boolean func_214587_a(IWorldGenerationBaseReader p_214587_0_, BlockPos p_214587_1_) {
+ if (!(p_214587_0_ instanceof net.minecraft.world.IWorldReader)) // FORGE: Redirect to state method when possible
return p_214587_0_.func_217375_a(p_214587_1_, (p_214573_0_) -> {
Block block = p_214573_0_.func_177230_c();
@@ -38,10 +41,23 @@
return p_214573_0_.func_196958_f() || p_214573_0_.func_203425_a(BlockTags.field_206952_E) || block == Blocks.field_196658_i || Block.func_196245_f(block) || block.func_203417_a(BlockTags.field_200031_h) || block.func_203417_a(BlockTags.field_200030_g) || block == Blocks.field_150395_bd;
});
+ else return p_214587_0_.func_217375_a(p_214587_1_, state -> state.canBeReplacedByLogs((net.minecraft.world.IWorldReader)p_214587_0_, p_214587_1_));
}
+ protected boolean canBeReplacedByLog(IWorldGenerationBaseReader reader, BlockPos pos) {
+ if (!(reader instanceof net.minecraft.world.IWorldReader))
+ return func_214587_a(reader, pos);
+ return reader.func_217375_a(pos, state -> state.canBeReplacedByLogs((net.minecraft.world.IWorldReader)reader, pos));
+ }
+
+ @Deprecated //Forge: Moved to isAir
protected static boolean func_214574_b(IWorldGenerationBaseReader p_214574_0_, BlockPos p_214574_1_) {
+ if (!(p_214574_0_ instanceof net.minecraft.world.IBlockReader)) // FORGE: Redirect to state method when possible
return p_214574_0_.func_217375_a(p_214574_1_, BlockState::func_196958_f);
+ else return p_214574_0_.func_217375_a(p_214574_1_, state -> state.isAir((net.minecraft.world.IBlockReader)p_214574_0_, p_214574_1_));
}
+ protected static boolean isAir(IWorldGenerationBaseReader reader, BlockPos pos) {
+ if (!(reader instanceof net.minecraft.world.IBlockReader))
+ return func_214574_b(reader, pos);
+ return reader.func_217375_a(pos, state -> state.isAir((net.minecraft.world.IBlockReader)reader, pos));
+ }
+
protected static boolean func_214578_c(IWorldGenerationBaseReader p_214578_0_, BlockPos p_214578_1_) {
return p_214578_0_.func_217375_a(p_214578_1_, (p_214590_0_) -> {
return Block.func_196245_f(p_214590_0_.func_177230_c());
@@ -60,12 +76,20 @@
});
@@ -61,11 +67,14 @@
}
+ @Deprecated //Forge: moved to canBeReplacedByLeaves
protected static boolean func_214572_g(IWorldGenerationBaseReader p_214572_0_, BlockPos p_214572_1_) {
+ if (!(p_214572_0_ instanceof net.minecraft.world.IWorldReader)) // FORGE: Redirect to state method when possible
return p_214572_0_.func_217375_a(p_214572_1_, (p_214581_0_) -> {
return p_214581_0_.func_196958_f() || p_214581_0_.func_203425_a(BlockTags.field_206952_E);
});
+ else return p_214572_0_.func_217375_a(p_214572_1_, state -> state.canBeReplacedByLeaves((net.minecraft.world.IWorldReader)p_214572_0_, p_214572_1_));
}
+ protected boolean canBeReplacedByLeaves(IWorldGenerationBaseReader reader, BlockPos pos) {
+ if (!(reader instanceof net.minecraft.world.IWorldReader))
+ return func_214572_g(reader, pos);
+ return reader.func_217375_a(pos, state -> state.canBeReplacedByLeaves((net.minecraft.world.IWorldReader)reader, pos));
+ }
+
+ @Deprecated //Forge: moved to isSoil
protected static boolean func_214589_h(IWorldGenerationBaseReader p_214589_0_, BlockPos p_214589_1_) {
return p_214589_0_.func_217375_a(p_214589_1_, (p_214582_0_) -> {
Block block = p_214582_0_.func_177230_c();
@@ -73,6 +97,13 @@
@@ -73,6 +82,13 @@
});
}
+ protected boolean isSoil(IWorldGenerationBaseReader reader, BlockPos pos) {
+ if (!(reader instanceof net.minecraft.world.IBlockReader) || getSapling() == null)
+ protected static boolean isSoil(IWorldGenerationBaseReader reader, BlockPos pos, net.minecraftforge.common.IPlantable sapling) {
+ if (!(reader instanceof net.minecraft.world.IBlockReader) || sapling == null)
+ return func_214589_h(reader, pos);
+ return reader.func_217375_a(pos, state -> state.canSustainPlant((net.minecraft.world.IBlockReader)reader, pos, Direction.UP, getSapling()));
+ return reader.func_217375_a(pos, state -> state.canSustainPlant((net.minecraft.world.IBlockReader)reader, pos, Direction.UP, sapling));
+ }
+
+ @Deprecated //Forge: moved to isSoilOrFarm
protected static boolean func_214585_i(IWorldGenerationBaseReader p_214585_0_, BlockPos p_214585_1_) {
return p_214585_0_.func_217375_a(p_214585_1_, (p_214586_0_) -> {
Block block = p_214586_0_.func_177230_c();
@@ -80,6 +111,12 @@
@@ -80,6 +96,12 @@
});
}
+ protected boolean isSoilOrFarm(IWorldGenerationBaseReader reader, BlockPos pos) {
+ if (!(reader instanceof net.minecraft.world.IBlockReader) || getSapling() == null)
+ protected static boolean isSoilOrFarm(IWorldGenerationBaseReader reader, BlockPos pos, net.minecraftforge.common.IPlantable sapling) {
+ if (!(reader instanceof net.minecraft.world.IBlockReader) || sapling == null)
+ return func_214585_i(reader, pos);
+ return reader.func_217375_a(pos, state -> state.canSustainPlant((net.minecraft.world.IBlockReader)reader, pos, Direction.UP, getSapling()));
+ return reader.func_217375_a(pos, state -> state.canSustainPlant((net.minecraft.world.IBlockReader)reader, pos, Direction.UP, sapling));
+ }
+
protected static boolean func_214576_j(IWorldGenerationBaseReader p_214576_0_, BlockPos p_214576_1_) {
return p_214576_0_.func_217375_a(p_214576_1_, (p_214588_0_) -> {
Material material = p_214588_0_.func_185904_a();
@@ -87,6 +124,7 @@
@@ -87,6 +109,7 @@
});
}
@ -94,7 +76,7 @@
protected void func_214584_a(IWorldGenerationReader p_214584_1_, BlockPos p_214584_2_) {
if (!func_214578_c(p_214584_1_, p_214584_2_)) {
this.func_202278_a(p_214584_1_, p_214584_2_, Blocks.field_150346_d.func_176223_P());
@@ -94,6 +132,14 @@
@@ -94,6 +117,14 @@
}
@ -109,7 +91,7 @@
protected void func_202278_a(IWorldWriter p_202278_1_, BlockPos p_202278_2_, BlockState p_202278_3_) {
this.func_208521_b(p_202278_1_, p_202278_2_, p_202278_3_);
}
@@ -104,7 +150,6 @@
@@ -104,7 +135,6 @@
if (BlockTags.field_200031_h.func_199685_a_(p_208520_4_.func_177230_c())) {
p_208520_1_.add(p_208520_3_.func_185334_h());
}
@ -117,7 +99,7 @@
}
private void func_208521_b(IWorldWriter p_208521_1_, BlockPos p_208521_2_, BlockState p_208521_3_) {
@@ -192,4 +237,13 @@
@@ -192,4 +222,13 @@
}
protected abstract boolean func_208519_a(Set<BlockPos> p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_);

View file

@ -1,23 +1,5 @@
--- a/net/minecraft/world/gen/feature/BigTreeFeature.java
+++ b/net/minecraft/world/gen/feature/BigTreeFeature.java
@@ -31,7 +31,7 @@
for(int k = -i; k <= i; ++k) {
if (Math.pow((double)Math.abs(j) + 0.5D, 2.0D) + Math.pow((double)Math.abs(k) + 0.5D, 2.0D) <= (double)(p_208529_3_ * p_208529_3_)) {
BlockPos blockpos = p_208529_2_.func_177982_a(j, 0, k);
- if (func_214572_g(p_208529_1_, blockpos)) {
+ if (canBeReplacedByLeaves(p_208529_1_, blockpos)) {
this.func_208520_a(p_208529_5_, p_208529_1_, blockpos, field_208531_b, p_208529_4_);
}
}
@@ -86,7 +86,7 @@
BlockPos blockpos1 = p_208523_3_.func_177963_a((double)(0.5F + (float)j * f), (double)(0.5F + (float)j * f1), (double)(0.5F + (float)j * f2));
if (p_208523_5_) {
this.func_208520_a(p_208523_1_, p_208523_2_, blockpos1, field_208530_a.func_206870_a(LogBlock.field_176298_M, this.func_197170_b(p_208523_3_, blockpos1)), p_208523_6_);
- } else if (!func_214587_a(p_208523_2_, blockpos1)) {
+ } else if (!canBeReplacedByLog(p_208523_2_, blockpos1)) {
return j;
}
}
@@ -156,7 +156,7 @@
if (i == -1) {
return false;
@ -32,7 +14,7 @@
private int func_208528_b(Set<BlockPos> p_208528_1_, IWorldGenerationReader p_208528_2_, BlockPos p_208528_3_, int p_208528_4_, MutableBoundingBox p_208528_5_) {
- if (!func_214585_i(p_208528_2_, p_208528_3_.func_177977_b())) {
+ if (!isSoilOrFarm(p_208528_2_, p_208528_3_.func_177977_b())) {
+ if (!isSoilOrFarm(p_208528_2_, p_208528_3_.func_177977_b(), getSapling())) {
return -1;
} else {
int i = this.func_208523_a(p_208528_1_, p_208528_2_, p_208528_3_, p_208528_3_.func_177981_b(p_208528_4_ - 1), false, p_208528_5_);

View file

@ -17,43 +17,23 @@
for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) {
int k = 1;
if (j == p_208519_4_.func_177956_o()) {
@@ -42,8 +43,8 @@
@@ -42,7 +43,7 @@
for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) {
for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) {
- if (j >= 0 && j < 256) {
- if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
+ if (j >= 0 && j < p_208519_2_.getMaxHeight()) {
+ if (!canBeReplacedByLog(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
flag = false;
}
} else {
@@ -55,8 +56,8 @@
if (!flag) {
return false;
- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) {
- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b());
+ } else if ((isSoil(p_208519_2_, p_208519_4_.func_177977_b())) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ } else if ((isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling())) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_);
for(int l1 = p_208519_4_.func_177956_o() - 3 + i; l1 <= p_208519_4_.func_177956_o() + i; ++l1) {
int j2 = l1 - (p_208519_4_.func_177956_o() + i);
@@ -69,7 +70,7 @@
int k1 = j1 - p_208519_4_.func_177952_p();
if (Math.abs(i3) != k2 || Math.abs(k1) != k2 || p_208519_3_.nextInt(2) != 0 && j2 != 0) {
BlockPos blockpos = new BlockPos(l2, l1, j1);
- if (func_214572_g(p_208519_2_, blockpos)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, field_181630_b, p_208519_5_);
}
}
@@ -78,7 +79,7 @@
}
for(int i2 = 0; i2 < i; ++i2) {
- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(i2))) {
+ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(i2))) {
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(i2), field_181629_a, p_208519_5_);
}
}

View file

@ -13,7 +13,7 @@
if (k >= 1 && k + i + 1 < 256) {
BlockPos blockpos = p_208519_4_.func_177977_b();
- if (!func_214589_h(p_208519_2_, blockpos)) {
+ if (!isSoil(p_208519_2_, blockpos)) {
+ if (!isSoil(p_208519_2_, blockpos, getSapling())) {
return false;
} else if (!this.func_214615_a(p_208519_2_, p_208519_4_, i)) {
return false;
@ -29,39 +29,3 @@
Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_208519_3_);
int i1 = i - p_208519_3_.nextInt(4);
int j1 = 2 - p_208519_3_.nextInt(3);
@@ -52,7 +53,7 @@
int k2 = k + j2;
BlockPos blockpos1 = new BlockPos(k1, k2, l1);
- if (func_214572_g(p_208519_2_, blockpos1)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos1)) {
this.func_214616_a(p_208519_1_, p_208519_2_, blockpos1, p_208519_5_);
this.func_214616_a(p_208519_1_, p_208519_2_, blockpos1.func_177974_f(), p_208519_5_);
this.func_214616_a(p_208519_1_, p_208519_2_, blockpos1.func_177968_d(), p_208519_5_);
@@ -143,7 +144,7 @@
for(int j1 = -i1; j1 <= i1; ++j1) {
for(int k1 = -i1; k1 <= i1; ++k1) {
- if (!func_214587_a(p_214615_1_, blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1))) {
+ if (!canBeReplacedByLog(p_214615_1_, blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1))) {
return false;
}
}
@@ -154,7 +155,7 @@
}
private void func_214616_a(Set<BlockPos> p_214616_1_, IWorldGenerationReader p_214616_2_, BlockPos p_214616_3_, MutableBoundingBox p_214616_4_) {
- if (func_214587_a(p_214616_2_, p_214616_3_)) {
+ if (canBeReplacedByLog(p_214616_2_, p_214616_3_)) {
this.func_208520_a(p_214616_1_, p_214616_2_, p_214616_3_, field_214618_a, p_214616_4_);
}
@@ -162,7 +163,7 @@
private void func_214617_a(IWorldGenerationReader p_214617_1_, int p_214617_2_, int p_214617_3_, int p_214617_4_, MutableBoundingBox p_214617_5_, Set<BlockPos> p_214617_6_) {
BlockPos blockpos = new BlockPos(p_214617_2_, p_214617_3_, p_214617_4_);
- if (func_214574_b(p_214617_1_, blockpos)) {
+ if (isAir(p_214617_1_, blockpos)) {
this.func_208520_a(p_214617_6_, p_214617_1_, blockpos, field_214619_aS, p_214617_5_);
}

View file

@ -22,7 +22,7 @@
for(int k = -j; k <= j && flag; ++k) {
for(int l = -j; l <= j && flag; ++l) {
- if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= 256 || !func_214587_a(p_175926_1_, p_175926_2_.func_177982_a(k, i, l))) {
+ if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= p_175926_1_.getMaxHeight() || !canBeReplacedByLog(p_175926_1_, p_175926_2_.func_177982_a(k, i, l))) {
+ if (p_175926_2_.func_177956_o() + i < 0 || p_175926_2_.func_177956_o() + i >= p_175926_1_.getMaxHeight() || !func_214587_a(p_175926_1_, p_175926_2_.func_177982_a(k, i, l))) {
flag = false;
}
}
@ -36,7 +36,7 @@
- this.func_214584_a(p_202405_1_, blockpos.func_177968_d());
- this.func_214584_a(p_202405_1_, blockpos.func_177968_d().func_177974_f());
+
+ if (isSoil(p_202405_1_, blockpos) && p_202405_2_.func_177956_o() >= 2) {
+ if (isSoil(p_202405_1_, blockpos, getSapling()) && p_202405_2_.func_177956_o() >= 2) {
+ setDirtAt(p_202405_1_, blockpos, p_202405_2_);
+ setDirtAt(p_202405_1_, blockpos.func_177974_f(), p_202405_2_);
+ setDirtAt(p_202405_1_, blockpos.func_177968_d(), p_202405_2_);
@ -44,21 +44,3 @@
return true;
} else {
return false;
@@ -85,7 +87,7 @@
int i1 = Math.min(Math.abs(k), Math.abs(k - 1));
if (l + i1 < 7 && l * l + i1 * i1 <= i) {
BlockPos blockpos = p_222839_2_.func_177982_a(j, 0, k);
- if (func_214572_g(p_222839_1_, blockpos)) {
+ if (canBeReplacedByLeaves(p_222839_1_, blockpos)) {
this.func_208520_a(p_222839_5_, p_222839_1_, blockpos, this.field_76521_c, p_222839_4_);
}
}
@@ -101,7 +103,7 @@
for(int k = -p_222838_3_; k <= p_222838_3_; ++k) {
if (j * j + k * k <= i) {
BlockPos blockpos = p_222838_2_.func_177982_a(j, 0, k);
- if (func_214572_g(p_222838_1_, blockpos)) {
+ if (canBeReplacedByLeaves(p_222838_1_, blockpos)) {
this.func_208520_a(p_222838_5_, p_222838_1_, blockpos, this.field_76521_c, p_222838_4_);
}
}

View file

@ -8,48 +8,3 @@
}
public boolean func_208519_a(Set<BlockPos> p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) {
@@ -47,7 +48,7 @@
for(int i2 = 0; i2 < i; ++i2) {
BlockPos blockpos = p_208519_4_.func_177981_b(i2);
- if (func_214587_a(p_208519_2_, blockpos)) {
+ if (canBeReplacedByLog(p_208519_2_, blockpos)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, this.field_76520_b, p_208519_5_);
if (i2 > 0) {
this.func_202407_a(p_208519_2_, p_208519_3_, blockpos.func_177976_e(), VineBlock.field_176278_M);
@@ -57,7 +58,7 @@
if (i2 < i - 1) {
BlockPos blockpos1 = blockpos.func_177974_f();
- if (func_214587_a(p_208519_2_, blockpos1)) {
+ if (canBeReplacedByLog(p_208519_2_, blockpos1)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos1, this.field_76520_b, p_208519_5_);
if (i2 > 0) {
this.func_202407_a(p_208519_2_, p_208519_3_, blockpos1.func_177974_f(), VineBlock.field_176280_O);
@@ -66,7 +67,7 @@
}
BlockPos blockpos2 = blockpos.func_177968_d().func_177974_f();
- if (func_214587_a(p_208519_2_, blockpos2)) {
+ if (canBeReplacedByLog(p_208519_2_, blockpos2)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos2, this.field_76520_b, p_208519_5_);
if (i2 > 0) {
this.func_202407_a(p_208519_2_, p_208519_3_, blockpos2.func_177974_f(), VineBlock.field_176280_O);
@@ -75,7 +76,7 @@
}
BlockPos blockpos3 = blockpos.func_177968_d();
- if (func_214587_a(p_208519_2_, blockpos3)) {
+ if (canBeReplacedByLog(p_208519_2_, blockpos3)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos3, this.field_76520_b, p_208519_5_);
if (i2 > 0) {
this.func_202407_a(p_208519_2_, p_208519_3_, blockpos3.func_177976_e(), VineBlock.field_176278_M);
@@ -90,7 +91,7 @@
}
private void func_202407_a(IWorldGenerationReader p_202407_1_, Random p_202407_2_, BlockPos p_202407_3_, BooleanProperty p_202407_4_) {
- if (p_202407_2_.nextInt(3) > 0 && func_214574_b(p_202407_1_, p_202407_3_)) {
+ if (p_202407_2_.nextInt(3) > 0 && isAir(p_202407_1_, p_202407_3_)) {
this.func_202278_a(p_202407_1_, p_202407_3_, Blocks.field_150395_bd.func_176223_P().func_206870_a(p_202407_4_, Boolean.valueOf(true)));
}

View file

@ -8,43 +8,12 @@
}
public boolean func_208519_a(Set<BlockPos> p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) {
@@ -30,20 +31,20 @@
this.func_214596_a(p_208519_2_, p_208519_4_.func_177958_n(), p_208519_4_.func_177952_p(), p_208519_4_.func_177956_o() + i, 0, p_208519_3_, p_208519_5_, p_208519_1_);
for(int j = 0; j < i; ++j) {
- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(j))) {
+ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(j))) {
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(j), this.field_76520_b, p_208519_5_);
}
if (j < i - 1) {
- if (func_214572_g(p_208519_2_, p_208519_4_.func_177982_a(1, j, 0))) {
+ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177982_a(1, j, 0))) {
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(1, j, 0), this.field_76520_b, p_208519_5_);
}
- if (func_214572_g(p_208519_2_, p_208519_4_.func_177982_a(1, j, 1))) {
+ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177982_a(1, j, 1))) {
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(1, j, 1), this.field_76520_b, p_208519_5_);
}
- if (func_214572_g(p_208519_2_, p_208519_4_.func_177982_a(0, j, 1))) {
+ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177982_a(0, j, 1))) {
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177982_a(0, j, 1), this.field_76520_b, p_208519_5_);
}
}
@@ -98,12 +99,12 @@
@@ -98,7 +99,7 @@
private void func_175934_c(IWorldGenerationReader p_175934_1_, BlockPos p_175934_2_) {
for(int i = 2; i >= -3; --i) {
BlockPos blockpos = p_175934_2_.func_177981_b(i);
- if (func_214589_h(p_175934_1_, blockpos)) {
+ if (isSoil(p_175934_1_, blockpos)) {
+ if (isSoil(p_175934_1_, blockpos, getSapling())) {
this.func_202278_a(p_175934_1_, blockpos, field_181635_g);
break;
}
- if (!func_214574_b(p_175934_1_, blockpos) && i < 0) {
+ if (!isAir(p_175934_1_, blockpos) && i < 0) {
break;
}
}

View file

@ -17,43 +17,23 @@
boolean flag = true;
for(int i1 = p_208519_4_.func_177956_o(); i1 <= p_208519_4_.func_177956_o() + 1 + i && flag; ++i1) {
@@ -38,8 +39,8 @@
@@ -38,7 +39,7 @@
for(int k1 = p_208519_4_.func_177958_n() - j1; k1 <= p_208519_4_.func_177958_n() + j1 && flag; ++k1) {
for(int l1 = p_208519_4_.func_177952_p() - j1; l1 <= p_208519_4_.func_177952_p() + j1 && flag; ++l1) {
- if (i1 >= 0 && i1 < 256) {
- if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) {
+ if (i1 >= 0 && i1 < p_208519_2_.getMaxHeight()) {
+ if (!canBeReplacedByLog(p_208519_2_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) {
if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(k1, i1, l1))) {
flag = false;
}
} else {
@@ -51,8 +52,8 @@
if (!flag) {
return false;
- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) {
- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b());
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_);
int j2 = 0;
for(int k2 = p_208519_4_.func_177956_o() + i; k2 >= p_208519_4_.func_177956_o() + j; --k2) {
@@ -63,7 +64,7 @@
int i2 = k3 - p_208519_4_.func_177952_p();
if (Math.abs(j3) != j2 || Math.abs(i2) != j2 || j2 <= 0) {
BlockPos blockpos = new BlockPos(i3, k2, k3);
- if (func_214572_g(p_208519_2_, blockpos)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, field_181637_b, p_208519_5_);
}
}
@@ -78,7 +79,7 @@
}
for(int l2 = 0; l2 < i - 1; ++l2) {
- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(l2))) {
+ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(l2))) {
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(l2), field_181636_a, p_208519_5_);
}
}

View file

@ -9,52 +9,23 @@
for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) {
int k = 1;
if (j == p_208519_4_.func_177956_o()) {
@@ -38,8 +38,8 @@
@@ -38,7 +38,7 @@
for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) {
for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) {
- if (j >= 0 && j < 256) {
- if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
+ if (j >= 0 && j < p_208519_2_.getMaxHeight()) {
+ if (!canBeReplacedByLog(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
flag = false;
}
} else {
@@ -51,8 +51,8 @@
if (!flag) {
return false;
- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) {
- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b());
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_);
Direction direction = Direction.Plane.HORIZONTAL.func_179518_a(p_208519_3_);
int k2 = i - p_208519_3_.nextInt(4) - 1;
int l2 = 3 - p_208519_3_.nextInt(3);
@@ -69,7 +69,7 @@
}
BlockPos blockpos = new BlockPos(i3, l1, j3);
- if (func_214572_g(p_208519_2_, blockpos)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos)) {
this.func_208532_a(p_208519_1_, p_208519_2_, blockpos, p_208519_5_);
j1 = l1;
}
@@ -111,7 +111,7 @@
i3 += direction1.func_82601_c();
j3 += direction1.func_82599_e();
BlockPos blockpos1 = new BlockPos(i3, j2, j3);
- if (func_214572_g(p_208519_2_, blockpos1)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos1)) {
this.func_208532_a(p_208519_1_, p_208519_2_, blockpos1, p_208519_5_);
j1 = j2;
}
@@ -155,7 +155,7 @@
}
private void func_175924_b(Set<BlockPos> p_175924_1_, IWorldGenerationReader p_175924_2_, BlockPos p_175924_3_, MutableBoundingBox p_175924_4_) {
- if (func_214572_g(p_175924_2_, p_175924_3_)) {
+ if (canBeReplacedByLeaves(p_175924_2_, p_175924_3_)) {
this.func_208520_a(p_175924_1_, p_175924_2_, p_175924_3_, field_181644_b, p_175924_4_);
}

View file

@ -10,7 +10,7 @@
public boolean func_208519_a(Set<BlockPos> p_208519_1_, IWorldGenerationReader p_208519_2_, Random p_208519_3_, BlockPos p_208519_4_, MutableBoundingBox p_208519_5_) {
p_208519_4_ = p_208519_2_.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, p_208519_4_).func_177977_b();
- if (func_214589_h(p_208519_2_, p_208519_4_)) {
+ if (isSoil(p_208519_2_, p_208519_4_)) {
+ if (isSoil(p_208519_2_, p_208519_4_, getSapling())) {
p_208519_4_ = p_208519_4_.func_177984_a();
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_, this.field_150527_b, p_208519_5_);
@ -19,7 +19,7 @@
if (Math.abs(i1) != k || Math.abs(k1) != k || p_208519_3_.nextInt(2) != 0) {
BlockPos blockpos = new BlockPos(l, i, j1);
- if (func_214572_g(p_208519_2_, blockpos)) {
+ if (canBeReplacedByLog(p_208519_2_, blockpos)) {
+ if (func_214587_a(p_208519_2_, blockpos)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, this.field_150528_a, p_208519_5_);
}
}

View file

@ -9,77 +9,23 @@
for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) {
int k = 1;
if (j == p_208519_4_.func_177956_o()) {
@@ -40,9 +40,9 @@
@@ -40,7 +40,7 @@
for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) {
for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) {
- if (j >= 0 && j < 256) {
+ if (j >= 0 && j < p_208519_2_.getMaxHeight()) {
blockpos$mutableblockpos.func_181079_c(l, j, i1);
- if (!func_214572_g(p_208519_2_, blockpos$mutableblockpos)) {
+ if (!canBeReplacedByLeaves(p_208519_2_, blockpos$mutableblockpos)) {
if (!func_214572_g(p_208519_2_, blockpos$mutableblockpos)) {
if (func_214571_e(p_208519_2_, blockpos$mutableblockpos)) {
if (j > p_208519_4_.func_177956_o()) {
flag = false;
@@ -60,8 +60,8 @@
if (!flag) {
return false;
- } else if (func_214589_h(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) {
- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b());
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_);
for(int l1 = p_208519_4_.func_177956_o() - 3 + i; l1 <= p_208519_4_.func_177956_o() + i; ++l1) {
int k2 = l1 - (p_208519_4_.func_177956_o() + i);
@@ -74,7 +74,7 @@
int k1 = j1 - p_208519_4_.func_177952_p();
if (Math.abs(l3) != i3 || Math.abs(k1) != i3 || p_208519_3_.nextInt(2) != 0 && k2 != 0) {
BlockPos blockpos = new BlockPos(k3, l1, j1);
- if (func_214572_g(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, field_181649_b, p_208519_5_);
}
}
@@ -84,7 +84,7 @@
for(int i2 = 0; i2 < i; ++i2) {
BlockPos blockpos3 = p_208519_4_.func_177981_b(i2);
- if (func_214572_g(p_208519_2_, blockpos3) || func_214571_e(p_208519_2_, blockpos3)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos3) || func_214571_e(p_208519_2_, blockpos3)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos3, field_181648_a, p_208519_5_);
}
}
@@ -102,19 +102,19 @@
BlockPos blockpos5 = blockpos$mutableblockpos1.func_177974_f();
BlockPos blockpos1 = blockpos$mutableblockpos1.func_177978_c();
BlockPos blockpos2 = blockpos$mutableblockpos1.func_177968_d();
- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos4)) {
+ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos4)) {
this.func_181647_a(p_208519_2_, blockpos4, VineBlock.field_176278_M);
}
- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos5)) {
+ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos5)) {
this.func_181647_a(p_208519_2_, blockpos5, VineBlock.field_176280_O);
}
- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos1)) {
+ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos1)) {
this.func_181647_a(p_208519_2_, blockpos1, VineBlock.field_176279_N);
}
- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos2)) {
+ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos2)) {
this.func_181647_a(p_208519_2_, blockpos2, VineBlock.field_176273_b);
}
}
@@ -136,7 +136,7 @@
this.func_202278_a(p_181647_1_, p_181647_2_, blockstate);
int i = 4;
- for(BlockPos blockpos = p_181647_2_.func_177977_b(); func_214574_b(p_181647_1_, blockpos) && i > 0; --i) {
+ for(BlockPos blockpos = p_181647_2_.func_177977_b(); isAir(p_181647_1_, blockpos) && i > 0; --i) {
this.func_202278_a(p_181647_1_, blockpos, blockstate);
blockpos = blockpos.func_177977_b();
}

View file

@ -17,44 +17,23 @@
for(int i1 = p_208519_4_.func_177956_o(); i1 <= p_208519_4_.func_177956_o() + 1 + i && flag; ++i1) {
int j1;
if (i1 - p_208519_4_.func_177956_o() < j) {
@@ -37,9 +38,9 @@
@@ -37,7 +38,7 @@
for(int k1 = p_208519_4_.func_177958_n() - j1; k1 <= p_208519_4_.func_177958_n() + j1 && flag; ++k1) {
for(int l1 = p_208519_4_.func_177952_p() - j1; l1 <= p_208519_4_.func_177952_p() + j1 && flag; ++l1) {
- if (i1 >= 0 && i1 < 256) {
+ if (i1 >= 0 && i1 < p_208519_2_.getMaxHeight()) {
blockpos$mutableblockpos.func_181079_c(k1, i1, l1);
- if (!func_214572_g(p_208519_2_, blockpos$mutableblockpos)) {
+ if (!canBeReplacedByLeaves(p_208519_2_, blockpos$mutableblockpos)) {
if (!func_214572_g(p_208519_2_, blockpos$mutableblockpos)) {
flag = false;
}
} else {
@@ -51,8 +52,8 @@
if (!flag) {
return false;
- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) {
- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b());
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_);
int i3 = p_208519_3_.nextInt(2);
int j3 = 1;
int k3 = 0;
@@ -67,7 +68,7 @@
int l2 = k2 - p_208519_4_.func_177952_p();
if (Math.abs(j2) != i3 || Math.abs(l2) != i3 || i3 <= 0) {
BlockPos blockpos = new BlockPos(i2, j4, k2);
- if (func_214572_g(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, field_181646_b, p_208519_5_);
}
}
@@ -89,7 +90,7 @@
int i4 = p_208519_3_.nextInt(3);
for(int k4 = 0; k4 < i - i4; ++k4) {
- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(k4))) {
+ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(k4))) {
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(k4), field_181645_a, p_208519_5_);
}
}

View file

@ -9,95 +9,23 @@
for(int j = p_208519_4_.func_177956_o(); j <= p_208519_4_.func_177956_o() + 1 + i; ++j) {
int k = 1;
if (j == p_208519_4_.func_177956_o()) {
@@ -53,8 +53,8 @@
@@ -53,7 +53,7 @@
for(int l = p_208519_4_.func_177958_n() - k; l <= p_208519_4_.func_177958_n() + k && flag; ++l) {
for(int i1 = p_208519_4_.func_177952_p() - k; i1 <= p_208519_4_.func_177952_p() + k && flag; ++i1) {
- if (j >= 0 && j < 256) {
- if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
+ if (j >= 0 && j < p_208519_2_.getMaxHeight()) {
+ if (!canBeReplacedByLog(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
if (!func_214587_a(p_208519_2_, blockpos$mutableblockpos.func_181079_c(l, j, i1))) {
flag = false;
}
} else {
@@ -66,8 +66,8 @@
if (!flag) {
return false;
- } else if (func_214585_i(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < 256 - i - 1) {
- this.func_214584_a(p_208519_2_, p_208519_4_.func_177977_b());
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ } else if (isSoil(p_208519_2_, p_208519_4_.func_177977_b(), getSapling()) && p_208519_4_.func_177956_o() < p_208519_2_.getMaxHeight() - i - 1) {
+ this.setDirtAt(p_208519_2_, p_208519_4_.func_177977_b(), p_208519_4_);
int j2 = 3;
int k2 = 0;
@@ -82,7 +82,7 @@
int i2 = l1 - p_208519_4_.func_177952_p();
if (Math.abs(k1) != j4 || Math.abs(i2) != j4 || p_208519_3_.nextInt(2) != 0 && l3 != 0) {
BlockPos blockpos = new BlockPos(j1, l2, l1);
- if (func_214572_g(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) {
+ if (canBeReplacedByLeaves(p_208519_2_, blockpos) || func_214576_j(p_208519_2_, blockpos)) {
this.func_208520_a(p_208519_1_, p_208519_2_, blockpos, this.field_76530_d, p_208519_5_);
}
}
@@ -91,22 +91,22 @@
}
for(int i3 = 0; i3 < i; ++i3) {
- if (func_214572_g(p_208519_2_, p_208519_4_.func_177981_b(i3)) || func_214576_j(p_208519_2_, p_208519_4_.func_177981_b(i3))) {
+ if (canBeReplacedByLeaves(p_208519_2_, p_208519_4_.func_177981_b(i3)) || func_214576_j(p_208519_2_, p_208519_4_.func_177981_b(i3))) {
this.func_208520_a(p_208519_1_, p_208519_2_, p_208519_4_.func_177981_b(i3), this.field_76532_c, p_208519_5_);
if (this.field_76531_b && i3 > 0) {
- if (p_208519_3_.nextInt(3) > 0 && func_214574_b(p_208519_2_, p_208519_4_.func_177982_a(-1, i3, 0))) {
+ if (p_208519_3_.nextInt(3) > 0 && isAir(p_208519_2_, p_208519_4_.func_177982_a(-1, i3, 0))) {
this.func_181651_a(p_208519_2_, p_208519_4_.func_177982_a(-1, i3, 0), VineBlock.field_176278_M);
}
- if (p_208519_3_.nextInt(3) > 0 && func_214574_b(p_208519_2_, p_208519_4_.func_177982_a(1, i3, 0))) {
+ if (p_208519_3_.nextInt(3) > 0 && isAir(p_208519_2_, p_208519_4_.func_177982_a(1, i3, 0))) {
this.func_181651_a(p_208519_2_, p_208519_4_.func_177982_a(1, i3, 0), VineBlock.field_176280_O);
}
- if (p_208519_3_.nextInt(3) > 0 && func_214574_b(p_208519_2_, p_208519_4_.func_177982_a(0, i3, -1))) {
+ if (p_208519_3_.nextInt(3) > 0 && isAir(p_208519_2_, p_208519_4_.func_177982_a(0, i3, -1))) {
this.func_181651_a(p_208519_2_, p_208519_4_.func_177982_a(0, i3, -1), VineBlock.field_176279_N);
}
- if (p_208519_3_.nextInt(3) > 0 && func_214574_b(p_208519_2_, p_208519_4_.func_177982_a(0, i3, 1))) {
+ if (p_208519_3_.nextInt(3) > 0 && isAir(p_208519_2_, p_208519_4_.func_177982_a(0, i3, 1))) {
this.func_181651_a(p_208519_2_, p_208519_4_.func_177982_a(0, i3, 1), VineBlock.field_176273_b);
}
}
@@ -127,19 +127,19 @@
BlockPos blockpos4 = blockpos$mutableblockpos1.func_177974_f();
BlockPos blockpos1 = blockpos$mutableblockpos1.func_177978_c();
BlockPos blockpos2 = blockpos$mutableblockpos1.func_177968_d();
- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos3)) {
+ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos3)) {
this.func_181650_b(p_208519_2_, blockpos3, VineBlock.field_176278_M);
}
- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos4)) {
+ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos4)) {
this.func_181650_b(p_208519_2_, blockpos4, VineBlock.field_176280_O);
}
- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos1)) {
+ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos1)) {
this.func_181650_b(p_208519_2_, blockpos1, VineBlock.field_176279_N);
}
- if (p_208519_3_.nextInt(4) == 0 && func_214574_b(p_208519_2_, blockpos2)) {
+ if (p_208519_3_.nextInt(4) == 0 && isAir(p_208519_2_, blockpos2)) {
this.func_181650_b(p_208519_2_, blockpos2, VineBlock.field_176273_b);
}
}
@@ -184,7 +184,7 @@
this.func_181651_a(p_181650_1_, p_181650_2_, p_181650_3_);
int i = 4;
- for(BlockPos blockpos = p_181650_2_.func_177977_b(); func_214574_b(p_181650_1_, blockpos) && i > 0; --i) {
+ for(BlockPos blockpos = p_181650_2_.func_177977_b(); isAir(p_181650_1_, blockpos) && i > 0; --i) {
this.func_181651_a(p_181650_1_, blockpos, p_181650_3_);
blockpos = blockpos.func_177977_b();
}