ForgePatch/patches/minecraft/net/minecraft/block/FireBlock.java.patch

139 lines
7.7 KiB
Diff

--- a/net/minecraft/block/FireBlock.java
+++ b/net/minecraft/block/FireBlock.java
@@ -92,13 +92,13 @@
protected BlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) {
BlockPos blockpos = p_196448_2_.func_177977_b();
BlockState blockstate = p_196448_1_.func_180495_p(blockpos);
- if (!this.func_196446_i(blockstate) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) {
+ if (!this.canCatchFire(p_196448_1_, p_196448_2_, Direction.UP) && !blockstate.func_224755_d(p_196448_1_, blockpos, Direction.UP)) {
BlockState blockstate1 = this.func_176223_P();
for(Direction direction : Direction.values()) {
BooleanProperty booleanproperty = field_196449_B.get(direction);
if (booleanproperty != null) {
- blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.func_196446_i(p_196448_1_.func_180495_p(p_196448_2_.func_177972_a(direction)))));
+ blockstate1 = blockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.func_177972_a(direction), direction.func_176734_d())));
}
}
@@ -121,7 +121,7 @@
}
BlockState blockstate = p_225534_2_.func_180495_p(p_225534_3_.func_177977_b());
- boolean flag = blockstate.func_235714_a_(p_225534_2_.func_230315_m_().func_241515_q_());
+ boolean flag = blockstate.isFireSource(p_225534_2_, p_225534_3_, Direction.UP);
int i = p_225534_1_.func_177229_b(field_176543_a);
if (!flag && p_225534_2_.func_72896_J() && this.func_176537_d(p_225534_2_, p_225534_3_) && p_225534_4_.nextFloat() < 0.2F + (float)i * 0.03F) {
p_225534_2_.func_217377_a(p_225534_3_, false);
@@ -142,7 +142,7 @@
return;
}
- if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.func_196446_i(p_225534_2_.func_180495_p(p_225534_3_.func_177977_b()))) {
+ if (i == 15 && p_225534_4_.nextInt(4) == 0 && !this.canCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), Direction.UP)) {
p_225534_2_.func_217377_a(p_225534_3_, false);
return;
}
@@ -150,12 +150,12 @@
boolean flag1 = p_225534_2_.func_180502_D(p_225534_3_);
int k = flag1 ? -50 : 0;
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i);
- this.func_176536_a(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177974_f(), 300 + k, p_225534_4_, i, Direction.WEST);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177976_e(), 300 + k, p_225534_4_, i, Direction.EAST);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177977_b(), 250 + k, p_225534_4_, i, Direction.UP);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177984_a(), 250 + k, p_225534_4_, i, Direction.DOWN);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177978_c(), 300 + k, p_225534_4_, i, Direction.SOUTH);
+ this.tryCatchFire(p_225534_2_, p_225534_3_.func_177968_d(), 300 + k, p_225534_4_, i, Direction.NORTH);
BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable();
for(int l = -1; l <= 1; ++l) {
@@ -193,16 +193,18 @@
return p_176537_1_.func_175727_C(p_176537_2_) || p_176537_1_.func_175727_C(p_176537_2_.func_177976_e()) || p_176537_1_.func_175727_C(p_176537_2_.func_177974_f()) || p_176537_1_.func_175727_C(p_176537_2_.func_177978_c()) || p_176537_1_.func_175727_C(p_176537_2_.func_177968_d());
}
+ @Deprecated //Forge: Use IForgeBlockState.getFlammability, Public for default implementation only.
public int func_220274_q(BlockState p_220274_1_) {
return p_220274_1_.func_235901_b_(BlockStateProperties.field_208198_y) && p_220274_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149848_b.getInt(p_220274_1_.func_177230_c());
}
+ @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed
public int func_220275_r(BlockState p_220275_1_) {
return p_220275_1_.func_235901_b_(BlockStateProperties.field_208198_y) && p_220275_1_.func_177229_b(BlockStateProperties.field_208198_y) ? 0 : this.field_149849_a.getInt(p_220275_1_.func_177230_c());
}
- private void func_176536_a(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_) {
- int i = this.func_220274_q(p_176536_1_.func_180495_p(p_176536_2_));
+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, Direction face) {
+ int i = p_176536_1_.func_180495_p(p_176536_2_).getFlammability(p_176536_1_, p_176536_2_, face);
if (p_176536_4_.nextInt(p_176536_3_) < i) {
BlockState blockstate = p_176536_1_.func_180495_p(p_176536_2_);
if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.func_175727_C(p_176536_2_)) {
@@ -212,11 +214,7 @@
p_176536_1_.func_217377_a(p_176536_2_, false);
}
- Block block = blockstate.func_177230_c();
- if (block instanceof TNTBlock) {
- TNTBlock tntblock = (TNTBlock)block;
- TNTBlock.func_196534_a(p_176536_1_, p_176536_2_);
- }
+ blockstate.catchFire(p_176536_1_, p_176536_2_, face, null);
}
}
@@ -228,7 +226,7 @@
private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) {
for(Direction direction : Direction.values()) {
- if (this.func_196446_i(p_196447_1_.func_180495_p(p_196447_2_.func_177972_a(direction)))) {
+ if (this.canCatchFire(p_196447_1_, p_196447_2_.func_177972_a(direction), direction.func_176734_d())) {
return true;
}
}
@@ -244,13 +242,14 @@
for(Direction direction : Direction.values()) {
BlockState blockstate = p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(direction));
- i = Math.max(this.func_220275_r(blockstate), i);
+ i = Math.max(blockstate.getFireSpreadSpeed(p_176538_1_, p_176538_2_.func_177972_a(direction), direction.func_176734_d()), i);
}
return i;
}
}
+ @Deprecated //Forge: Use canCatchFire with more context
protected boolean func_196446_i(BlockState p_196446_1_) {
return this.func_220275_r(p_196446_1_) > 0;
}
@@ -269,10 +268,23 @@
}
private void func_180686_a(Block p_180686_1_, int p_180686_2_, int p_180686_3_) {
+ if (p_180686_1_ == Blocks.field_150350_a) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
this.field_149849_a.put(p_180686_1_, p_180686_2_);
this.field_149848_b.put(p_180686_1_, p_180686_3_);
}
+ /**
+ * Side sensitive version that calls the block function.
+ *
+ * @param world The current world
+ * @param pos Block position
+ * @param face The side the fire is coming from
+ * @return True if the face can catch fire.
+ */
+ public boolean canCatchFire(IBlockReader world, BlockPos pos, Direction face) {
+ return world.func_180495_p(pos).isFlammable(world, pos, face);
+ }
+
public static void func_149843_e() {
FireBlock fireblock = (FireBlock)Blocks.field_150480_ab;
fireblock.func_180686_a(Blocks.field_196662_n, 5, 20);