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

219 lines
12 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -39,7 +39,15 @@
public IBlockState func_176221_a(IBlockState p_176221_1_, IBlockAccess p_176221_2_, BlockPos p_176221_3_)
{
- return !p_176221_2_.func_180495_p(p_176221_3_.func_177977_b()).func_185896_q() && !Blocks.field_150480_ab.func_176535_e(p_176221_2_, p_176221_3_.func_177977_b()) ? p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177978_c()))).func_177226_a(field_176546_O, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177974_f()))).func_177226_a(field_176541_P, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177968_d()))).func_177226_a(field_176539_Q, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177976_e()))).func_177226_a(field_176542_R, Boolean.valueOf(this.func_176535_e(p_176221_2_, p_176221_3_.func_177984_a()))) : this.func_176223_P();
+ if (!p_176221_2_.func_180495_p(p_176221_3_.func_177977_b()).isSideSolid(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP) && !Blocks.field_150480_ab.canCatchFire(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP))
+ {
+ return p_176221_1_.func_177226_a(field_176545_N, this.canCatchFire(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH))
+ .func_177226_a(field_176546_O, this.canCatchFire(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.WEST))
+ .func_177226_a(field_176541_P, this.canCatchFire(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH))
+ .func_177226_a(field_176539_Q, this.canCatchFire(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST))
+ .func_177226_a(field_176542_R, this.canCatchFire(p_176221_2_, p_176221_3_.func_177984_a(), EnumFacing.DOWN));
+ }
+ return this.func_176223_P();
}
protected BlockFire()
@@ -92,6 +100,7 @@
public 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_, Integer.valueOf(p_180686_2_));
this.field_149848_b.put(p_180686_1_, Integer.valueOf(p_180686_3_));
}
@@ -126,19 +135,15 @@
{
if (p_180650_1_.func_82736_K().func_82766_b("doFireTick"))
{
+ if (!p_180650_1_.func_175697_a(p_180650_2_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire
if (!this.func_176196_c(p_180650_1_, p_180650_2_))
{
p_180650_1_.func_175698_g(p_180650_2_);
}
Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c();
- boolean flag = block == Blocks.field_150424_aL || block == Blocks.field_189877_df;
+ boolean flag = block.isFireSource(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP);
- if (p_180650_1_.field_73011_w instanceof WorldProviderEnd && block == Blocks.field_150357_h)
- {
- flag = true;
- }
-
int i = ((Integer)p_180650_3_.func_177229_b(field_176543_a)).intValue();
if (!flag && p_180650_1_.func_72896_J() && this.func_176537_d(p_180650_1_, p_180650_2_) && p_180650_4_.nextFloat() < 0.2F + (float)i * 0.03F)
@@ -159,7 +164,7 @@
{
if (!this.func_176533_e(p_180650_1_, p_180650_2_))
{
- if (!p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_185896_q() || i > 3)
+ if (!p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).isSideSolid(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP) || i > 3)
{
p_180650_1_.func_175698_g(p_180650_2_);
}
@@ -167,7 +172,7 @@
return;
}
- if (!this.func_176535_e(p_180650_1_, p_180650_2_.func_177977_b()) && i == 15 && p_180650_4_.nextInt(4) == 0)
+ if (!this.canCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), EnumFacing.UP) && i == 15 && p_180650_4_.nextInt(4) == 0)
{
p_180650_1_.func_175698_g(p_180650_2_);
return;
@@ -182,12 +187,12 @@
j = -50;
}
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177974_f(), 300 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177976_e(), 300 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177977_b(), 250 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177984_a(), 250 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177978_c(), 300 + j, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177968_d(), 300 + j, p_180650_4_, i);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177974_f(), 300 + j, p_180650_4_, i, EnumFacing.WEST);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177976_e(), 300 + j, p_180650_4_, i, EnumFacing.EAST);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), 250 + j, p_180650_4_, i, EnumFacing.UP);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177984_a(), 250 + j, p_180650_4_, i, EnumFacing.DOWN);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177978_c(), 300 + j, p_180650_4_, i, EnumFacing.SOUTH);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177968_d(), 300 + j, p_180650_4_, i, EnumFacing.NORTH);
for (int k = -1; k <= 1; ++k)
{
@@ -246,22 +251,30 @@
return false;
}
+ @Deprecated // Use Block.getFlammability
public int func_176532_c(Block p_176532_1_)
{
Integer integer = this.field_149848_b.get(p_176532_1_);
return integer == null ? 0 : integer.intValue();
}
+ @Deprecated // Use Block.getFireSpreadSpeed
public int func_176534_d(Block p_176534_1_)
{
Integer integer = this.field_149849_a.get(p_176534_1_);
return integer == null ? 0 : integer.intValue();
}
+ @Deprecated // Use tryCatchFire with face below
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_176532_c(p_176536_1_.func_180495_p(p_176536_2_).func_177230_c());
+ this.tryCatchFire(p_176536_1_, p_176536_2_, p_176536_3_, p_176536_4_, p_176536_5_, EnumFacing.UP);
+ }
+ private void tryCatchFire(World p_176536_1_, BlockPos p_176536_2_, int p_176536_3_, Random p_176536_4_, int p_176536_5_, EnumFacing face)
+ {
+ int i = p_176536_1_.func_180495_p(p_176536_2_).func_177230_c().getFlammability(p_176536_1_, p_176536_2_, face);
+
if (p_176536_4_.nextInt(p_176536_3_) < i)
{
IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_);
@@ -293,7 +306,7 @@
{
for (EnumFacing enumfacing : EnumFacing.values())
{
- if (this.func_176535_e(p_176533_1_, p_176533_2_.func_177972_a(enumfacing)))
+ if (this.canCatchFire(p_176533_1_, p_176533_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()))
{
return true;
}
@@ -314,7 +327,7 @@
for (EnumFacing enumfacing : EnumFacing.values())
{
- i = Math.max(this.func_176534_d(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c()), i);
+ i = Math.max(p_176538_1_.func_180495_p(p_176538_2_.func_177972_a(enumfacing)).func_177230_c().getFireSpreadSpeed(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i);
}
return i;
@@ -326,9 +339,10 @@
return false;
}
+ @Deprecated // Use canCatchFire with face sensitive version below
public boolean func_176535_e(IBlockAccess p_176535_1_, BlockPos p_176535_2_)
{
- return this.func_176534_d(p_176535_1_.func_180495_p(p_176535_2_).func_177230_c()) > 0;
+ return canCatchFire(p_176535_1_, p_176535_2_, EnumFacing.UP);
}
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
@@ -372,9 +386,9 @@
p_180655_2_.func_184134_a((double)((float)p_180655_3_.func_177958_n() + 0.5F), (double)((float)p_180655_3_.func_177956_o() + 0.5F), (double)((float)p_180655_3_.func_177952_p() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + p_180655_4_.nextFloat(), p_180655_4_.nextFloat() * 0.7F + 0.3F, false);
}
- if (!p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).func_185896_q() && !Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177977_b()))
+ if (!p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).isSideSolid(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP) && !Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP))
{
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177976_e()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177976_e(), EnumFacing.EAST))
{
for (int j = 0; j < 2; ++j)
{
@@ -385,7 +399,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177974_f()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177974_f(), EnumFacing.WEST))
{
for (int k = 0; k < 2; ++k)
{
@@ -396,7 +410,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177978_c()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177978_c(), EnumFacing.SOUTH))
{
for (int l = 0; l < 2; ++l)
{
@@ -407,7 +421,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177968_d()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177968_d(), EnumFacing.NORTH))
{
for (int i1 = 0; i1 < 2; ++i1)
{
@@ -418,7 +432,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_2_, p_180655_3_.func_177984_a()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_2_, p_180655_3_.func_177984_a(), EnumFacing.DOWN))
{
for (int j1 = 0; j1 < 2; ++j1)
{
@@ -462,6 +476,21 @@
return new BlockStateContainer(this, new IProperty[] {field_176543_a, field_176545_N, field_176546_O, field_176541_P, field_176539_Q, field_176542_R});
}
+ /*================================= Forge Start ======================================*/
+ /**
+ * 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(IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ return world.func_180495_p(pos).func_177230_c().isFlammable(world, pos, face);
+ }
+ /*================================= Forge Start ======================================*/
+
public BlockFaceShape func_193383_a(IBlockAccess p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_)
{
return BlockFaceShape.UNDEFINED;