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

212 lines
11 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -42,18 +42,24 @@
int j = p_176221_3_.func_177956_o();
int k = p_176221_3_.func_177952_p();
- if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_176221_2_, p_176221_3_.func_177977_b()))
+ if (!World.func_175683_a(p_176221_2_, p_176221_3_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_176221_2_, p_176221_3_.func_177977_b(), EnumFacing.UP))
{
boolean flag = (i + j + k & 1) == 1;
boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1;
int l = 0;
- if (this.func_176535_e(p_176221_2_, p_176221_3_.func_177984_a()))
+ if (this.canCatchFire(p_176221_2_, p_176221_3_.func_177984_a(), EnumFacing.DOWN))
{
l = flag ? 1 : 2;
}
- return 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, Integer.valueOf(l)).func_177226_a(field_176540_b, Boolean.valueOf(flag1)).func_177226_a(field_176544_M, Boolean.valueOf(flag));
+ return p_176221_1_.func_177226_a(field_176545_N, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177978_c(), EnumFacing.SOUTH)))
+ .func_177226_a(field_176546_O, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177974_f(), EnumFacing.EAST )))
+ .func_177226_a(field_176541_P, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177968_d(), EnumFacing.NORTH)))
+ .func_177226_a(field_176539_Q, Boolean.valueOf(this.canCatchFire(p_176221_2_, p_176221_3_.func_177976_e(), EnumFacing.EAST )))
+ .func_177226_a(field_176542_R, Integer.valueOf(l))
+ .func_177226_a(field_176540_b, Boolean.valueOf(flag1))
+ .func_177226_a(field_176544_M, Boolean.valueOf(flag));
}
else
{
@@ -109,6 +115,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_));
}
@@ -148,13 +155,8 @@
}
Block block = p_180650_1_.func_180495_p(p_180650_2_.func_177977_b()).func_177230_c();
- boolean flag = block == Blocks.field_150424_aL;
+ 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;
- }
-
if (!flag && p_180650_1_.func_72896_J() && this.func_176537_d(p_180650_1_, p_180650_2_))
{
p_180650_1_.func_175698_g(p_180650_2_);
@@ -183,7 +185,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;
@@ -198,12 +200,12 @@
b0 = -50;
}
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177974_f(), 300 + b0, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177976_e(), 300 + b0, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177977_b(), 250 + b0, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177984_a(), 250 + b0, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177978_c(), 300 + b0, p_180650_4_, i);
- this.func_176536_a(p_180650_1_, p_180650_2_.func_177968_d(), 300 + b0, p_180650_4_, i);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177974_f(), 300 + b0, p_180650_4_, i, EnumFacing.WEST);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177976_e(), 300 + b0, p_180650_4_, i, EnumFacing.EAST);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177977_b(), 250 + b0, p_180650_4_, i, EnumFacing.UP);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177984_a(), 250 + b0, p_180650_4_, i, EnumFacing.DOWN);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177978_c(), 300 + b0, p_180650_4_, i, EnumFacing.SOUTH);
+ this.tryCatchFire(p_180650_1_, p_180650_2_.func_177968_d(), 300 + b0, p_180650_4_, i, EnumFacing.NORTH);
for (int j = -1; j <= 1; ++j)
{
@@ -262,22 +264,30 @@
return false;
}
+ @Deprecated // Use Block.getFlammability
public int func_176532_c(Block p_176532_1_)
{
Integer integer = (Integer)this.field_149848_b.get(p_176532_1_);
return integer == null ? 0 : integer.intValue();
}
+ @Deprecated // Use Block.getFlammability
public int func_176534_d(Block p_176534_1_)
{
Integer 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 k = 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 k = 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_) < k)
{
IBlockState iblockstate = p_176536_1_.func_180495_p(p_176536_2_);
@@ -314,7 +324,7 @@
{
EnumFacing enumfacing = aenumfacing[j];
- 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;
}
@@ -338,7 +348,7 @@
for (int k = 0; k < j; ++k)
{
EnumFacing enumfacing = aenumfacing[k];
- 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().getFlammability(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i);
}
return i;
@@ -350,9 +360,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_)
@@ -396,9 +407,9 @@
double d1;
double d2;
- if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177977_b()))
+ if (!World.func_175683_a(p_180655_1_, p_180655_2_.func_177977_b()) && !Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177977_b(), EnumFacing.UP))
{
- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177976_e()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177976_e(), EnumFacing.EAST))
{
for (i = 0; i < 2; ++i)
{
@@ -409,7 +420,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177974_f()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177974_f(), EnumFacing.WEST))
{
for (i = 0; i < 2; ++i)
{
@@ -420,7 +431,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177978_c()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177978_c(), EnumFacing.SOUTH))
{
for (i = 0; i < 2; ++i)
{
@@ -431,7 +442,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177968_d()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177968_d(), EnumFacing.NORTH))
{
for (i = 0; i < 2; ++i)
{
@@ -442,7 +453,7 @@
}
}
- if (Blocks.field_150480_ab.func_176535_e(p_180655_1_, p_180655_2_.func_177984_a()))
+ if (Blocks.field_150480_ab.canCatchFire(p_180655_1_, p_180655_2_.func_177984_a(), EnumFacing.DOWN))
{
for (i = 0; i < 2; ++i)
{
@@ -490,4 +501,19 @@
{
return new BlockState(this, new IProperty[] {field_176543_a, field_176545_N, field_176546_O, field_176541_P, field_176539_Q, field_176542_R, field_176540_b, field_176544_M});
}
+
+ /*================================= 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 ======================================*/
}