mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
DimensionType is not unique per Dimension. See DimensionManager for more details. Vanilla now has a chunk loading system, so Forge's will need to be deprecated/adapted.
189 lines
11 KiB
Diff
189 lines
11 KiB
Diff
--- a/net/minecraft/block/BlockFire.java
|
|
+++ b/net/minecraft/block/BlockFire.java
|
|
@@ -64,13 +64,13 @@
|
|
|
|
public IBlockState func_196448_a(IBlockReader p_196448_1_, BlockPos p_196448_2_) {
|
|
IBlockState iblockstate = p_196448_1_.func_180495_p(p_196448_2_.func_177977_b());
|
|
- if (!iblockstate.func_185896_q() && !this.func_196446_i(iblockstate)) {
|
|
+ if (!iblockstate.func_185896_q() && !this.canCatchFire(p_196448_1_, p_196448_2_, EnumFacing.UP)) {
|
|
IBlockState iblockstate1 = this.func_176223_P();
|
|
|
|
for(EnumFacing enumfacing : EnumFacing.values()) {
|
|
BooleanProperty booleanproperty = field_196449_B.get(enumfacing);
|
|
if (booleanproperty != null) {
|
|
- iblockstate1 = iblockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.func_196446_i(p_196448_1_.func_180495_p(p_196448_2_.func_177972_a(enumfacing)))));
|
|
+ iblockstate1 = iblockstate1.func_206870_a(booleanproperty, Boolean.valueOf(this.canCatchFire(p_196448_1_, p_196448_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())));
|
|
}
|
|
}
|
|
|
|
@@ -98,12 +98,13 @@
|
|
|
|
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
|
|
if (p_196267_2_.func_82736_K().func_82766_b("doFireTick")) {
|
|
+ if (!p_196267_2_.func_205050_e(p_196267_3_, 2)) return; // Forge: prevent loading unloaded chunks when spreading fire
|
|
if (!p_196267_1_.func_196955_c(p_196267_2_, p_196267_3_)) {
|
|
p_196267_2_.func_175698_g(p_196267_3_);
|
|
}
|
|
|
|
- Block block = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_177230_c();
|
|
- boolean flag = p_196267_2_.field_73011_w instanceof EndDimension && block == Blocks.field_150357_h || block == Blocks.field_150424_aL || block == Blocks.field_196814_hQ;
|
|
+ IBlockState other = p_196267_2_.func_180495_p(p_196267_3_.func_177977_b());
|
|
+ boolean flag = other.isFireSource(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP);
|
|
int i = p_196267_1_.func_177229_b(field_176543_a);
|
|
if (!flag && p_196267_2_.func_72896_J() && this.func_176537_d(p_196267_2_, p_196267_3_) && p_196267_4_.nextFloat() < 0.2F + (float)i * 0.03F) {
|
|
p_196267_2_.func_175698_g(p_196267_3_);
|
|
@@ -117,14 +118,14 @@
|
|
if (!flag) {
|
|
p_196267_2_.func_205220_G_().func_205360_a(p_196267_3_, this, this.func_149738_a(p_196267_2_) + p_196267_4_.nextInt(10));
|
|
if (!this.func_196447_a(p_196267_2_, p_196267_3_)) {
|
|
- if (!p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_185896_q() || i > 3) {
|
|
+ if (p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()).func_193401_d(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID || i > 3) {
|
|
p_196267_2_.func_175698_g(p_196267_3_);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
- if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.func_196446_i(p_196267_2_.func_180495_p(p_196267_3_.func_177977_b()))) {
|
|
+ if (i == 15 && p_196267_4_.nextInt(4) == 0 && !this.canCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), EnumFacing.UP)) {
|
|
p_196267_2_.func_175698_g(p_196267_3_);
|
|
return;
|
|
}
|
|
@@ -132,12 +133,12 @@
|
|
|
|
boolean flag1 = p_196267_2_.func_180502_D(p_196267_3_);
|
|
int k = flag1 ? -50 : 0;
|
|
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177974_f(), 300 + k, p_196267_4_, i);
|
|
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177976_e(), 300 + k, p_196267_4_, i);
|
|
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177977_b(), 250 + k, p_196267_4_, i);
|
|
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i);
|
|
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i);
|
|
- this.func_176536_a(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i);
|
|
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177974_f(), 300 + k, p_196267_4_, i, EnumFacing.WEST);
|
|
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177976_e(), 300 + k, p_196267_4_, i, EnumFacing.EAST);
|
|
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177977_b(), 250 + k, p_196267_4_, i, EnumFacing.UP);
|
|
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177984_a(), 250 + k, p_196267_4_, i, EnumFacing.DOWN);
|
|
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177978_c(), 300 + k, p_196267_4_, i, EnumFacing.SOUTH);
|
|
+ this.tryCatchFire(p_196267_2_, p_196267_3_.func_177968_d(), 300 + k, p_196267_4_, i, EnumFacing.NORTH);
|
|
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
|
|
|
for(int l = -1; l <= 1; ++l) {
|
|
@@ -175,16 +176,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 int func_176532_c(Block p_176532_1_) {
|
|
return this.field_149848_b.getInt(p_176532_1_);
|
|
}
|
|
|
|
+ @Deprecated //Forge: Use IForgeBlockState.getFireSpreadSpeed
|
|
public int func_176534_d(Block p_176534_1_) {
|
|
return this.field_149849_a.getInt(p_176534_1_);
|
|
}
|
|
|
|
- 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());
|
|
+ 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_).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_);
|
|
if (p_176536_4_.nextInt(p_176536_5_ + 10) < 5 && !p_176536_1_.func_175727_C(p_176536_2_)) {
|
|
@@ -204,7 +207,7 @@
|
|
|
|
private boolean func_196447_a(IBlockReader p_196447_1_, BlockPos p_196447_2_) {
|
|
for(EnumFacing enumfacing : EnumFacing.values()) {
|
|
- if (this.func_196446_i(p_196447_1_.func_180495_p(p_196447_2_.func_177972_a(enumfacing)))) {
|
|
+ if (this.canCatchFire(p_196447_1_, p_196447_2_.func_177972_a(enumfacing), enumfacing.func_176734_d())) {
|
|
return true;
|
|
}
|
|
}
|
|
@@ -219,7 +222,7 @@
|
|
int i = 0;
|
|
|
|
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)).getFlammability(p_176538_1_, p_176538_2_.func_177972_a(enumfacing), enumfacing.func_176734_d()), i);
|
|
}
|
|
|
|
return i;
|
|
@@ -230,6 +233,7 @@
|
|
return false;
|
|
}
|
|
|
|
+ @Deprecated //Forge: Use canCatchFire with more context
|
|
public boolean func_196446_i(IBlockState p_196446_1_) {
|
|
return this.func_176534_d(p_196446_1_.func_177230_c()) > 0;
|
|
}
|
|
@@ -252,8 +256,8 @@
|
|
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() && !this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()))) {
|
|
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177976_e()))) {
|
|
+ if (p_180655_2_.func_180495_p(p_180655_3_.func_177977_b()).func_193401_d(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID && !this.canCatchFire(p_180655_2_, p_180655_3_.func_177977_b(), EnumFacing.UP)) {
|
|
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177976_e(), EnumFacing.EAST)) {
|
|
for(int j = 0; j < 2; ++j) {
|
|
double d3 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble() * (double)0.1F;
|
|
double d8 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
|
|
@@ -262,7 +266,7 @@
|
|
}
|
|
}
|
|
|
|
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177974_f()))) {
|
|
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177974_f(), EnumFacing.WEST)) {
|
|
for(int k = 0; k < 2; ++k) {
|
|
double d4 = (double)(p_180655_3_.func_177958_n() + 1) - p_180655_4_.nextDouble() * (double)0.1F;
|
|
double d9 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
|
|
@@ -271,7 +275,7 @@
|
|
}
|
|
}
|
|
|
|
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177978_c()))) {
|
|
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177978_c(), EnumFacing.SOUTH)) {
|
|
for(int l = 0; l < 2; ++l) {
|
|
double d5 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
|
|
double d10 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
|
|
@@ -280,7 +284,7 @@
|
|
}
|
|
}
|
|
|
|
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177968_d()))) {
|
|
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177968_d(), EnumFacing.NORTH)) {
|
|
for(int i1 = 0; i1 < 2; ++i1) {
|
|
double d6 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
|
|
double d11 = (double)p_180655_3_.func_177956_o() + p_180655_4_.nextDouble();
|
|
@@ -289,7 +293,7 @@
|
|
}
|
|
}
|
|
|
|
- if (this.func_196446_i(p_180655_2_.func_180495_p(p_180655_3_.func_177984_a()))) {
|
|
+ if (this.canCatchFire(p_180655_2_, p_180655_3_.func_177984_a(), EnumFacing.DOWN)) {
|
|
for(int j1 = 0; j1 < 2; ++j1) {
|
|
double d7 = (double)p_180655_3_.func_177958_n() + p_180655_4_.nextDouble();
|
|
double d12 = (double)(p_180655_3_.func_177956_o() + 1) - p_180655_4_.nextDouble() * (double)0.1F;
|
|
@@ -321,10 +325,23 @@
|
|
}
|
|
|
|
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_, 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, EnumFacing face) {
|
|
+ return world.func_180495_p(pos).isFlammable(world, pos, face);
|
|
+ }
|
|
+
|
|
public static void func_149843_e() {
|
|
BlockFire blockfire = (BlockFire)Blocks.field_150480_ab;
|
|
blockfire.func_180686_a(Blocks.field_196662_n, 5, 20);
|