Files
MinecraftForge/patches/minecraft/net/minecraft/block/BlockFire.java.patch
T
Christian 94eb5cc29b Fix a couple of forge patches
Update FML: d075daf
d075daf Merge branch 'master' into snapshot15 Fix up compilation and patching errors
1bd6847 Fix up packages.csv ordering for easier diffing
dd832f2 Update for MCP7.30c - fixes redstone rendering issues
aebf6eb Add in a registry method to allow for alternative TileEntity names- they will be used to support loading maps containing the older definiti
8921cfe Remember to add the new patches!
cd67596 The "ServerStarting" event should now properly crash the server if it fails, so the client will properly exit. Also, added in a "pre-server
e1c6630 Javadoc cleanup
5ce4e31 Fix breaking change
a99c488 Merge branch 'patch-1' of https://github.com/bspkrs/FML into gh-updates
94282c5 Merge branch 'FMLLogFormatter' of https://github.com/donington/FML into gh-updates
7ad8529 Update MCP to MCP7.26a and refresh MCP names
15534ed Update address of the FML repository to the new location in all the files
aa822e3 Fix logical error in comment text
a14ab91 Update license text to make clear that FML is not a way to sidestep MCP licensing.
0165742 Fix mcp conf md5 signatures for the snapshot
26a5b31 FMLLogFormatter: dynamic log level name
2013-01-22 17:03:33 -05:00

256 lines
11 KiB
Diff

--- ../src_base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFire.java
@@ -11,6 +11,9 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderEnd;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+
public class BlockFire extends Block
{
/** The chance this block will encourage nearby blocks to catch on fire */
@@ -36,6 +39,8 @@
*/
public void initializeBlock()
{
+ abilityToCatchFire = Block.blockFlammability;
+ chanceToEncourageFire = Block.blockFireSpreadSpeed;
this.setBurnRate(Block.planks.blockID, 5, 20);
this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20);
this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20);
@@ -60,8 +65,7 @@
*/
private void setBurnRate(int par1, int par2, int par3)
{
- this.chanceToEncourageFire[par1] = par2;
- this.abilityToCatchFire[par1] = par3;
+ Block.setBurnProperties(par1, par2, par3);
}
/**
@@ -121,12 +125,8 @@
{
if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick"))
{
- boolean flag = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID;
-
- if (par1World.provider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID)
- {
- flag = true;
- }
+ Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ boolean flag = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), UP));
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{
@@ -155,7 +155,7 @@
par1World.func_94571_i(par2, par3, par4);
}
}
- else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && l == 15 && par5Random.nextInt(4) == 0)
+ else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP) && l == 15 && par5Random.nextInt(4) == 0)
{
par1World.func_94571_i(par2, par3, par4);
}
@@ -169,12 +169,12 @@
b0 = -50;
}
- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l);
+ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, WEST );
+ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, EAST );
+ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, UP );
+ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, DOWN );
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, SOUTH);
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, NORTH);
for (int i1 = par2 - 1; i1 <= par2 + 1; ++i1)
{
@@ -228,9 +228,20 @@
return false;
}
+ @Deprecated
private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7)
{
- int j1 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)];
+ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, UP);
+ }
+
+ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, ForgeDirection face)
+ {
+ int j1 = 0;
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)];
+ if (block != null)
+ {
+ j1 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face);
+ }
if (par6Random.nextInt(par5) < j1)
{
@@ -264,7 +275,12 @@
*/
private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
{
- return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1)))));
+ return canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST ) ||
+ canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST ) ||
+ canBlockCatchFire(par1World, par2, par3 - 1, par4, UP ) ||
+ canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN ) ||
+ canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH) ||
+ canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH);
}
/**
@@ -280,12 +296,12 @@
}
else
{
- int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0);
- l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l);
+ int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0, WEST);
+ l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l, EAST);
+ l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l, UP);
+ l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l, DOWN);
+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l, SOUTH);
+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l, NORTH);
return l;
}
}
@@ -300,21 +316,24 @@
/**
* Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z
- */
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
- return this.chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0;
+ return canBlockCatchFire(par1IBlockAccess, par2, par3, par4, UP);
}
/**
* Retrieves a specified block's chance to encourage their neighbors to burn and if the number is greater than the
* current number passed in it will return its number instead of the passed in one. Args: world, x, y, z,
* curChanceToEncourageFire
- */
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5)
{
- int i1 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)];
- return i1 > par5 ? i1 : par5;
+ return getChanceToEncourageFire(par1World, par2, par3, par4, par5, UP);
}
/**
@@ -372,9 +391,9 @@
float f1;
float f2;
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4))
- {
- if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4))
+ if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP))
+ {
+ if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST))
{
for (l = 0; l < 2; ++l)
{
@@ -385,7 +404,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST))
{
for (l = 0; l < 2; ++l)
{
@@ -396,7 +415,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH))
{
for (l = 0; l < 2; ++l)
{
@@ -407,7 +426,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH))
{
for (l = 0; l < 2; ++l)
{
@@ -418,7 +437,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN))
{
for (l = 0; l < 2; ++l)
{
@@ -462,4 +481,46 @@
{
return this.field_94439_c[0];
}
+
+ /**
+ * Side sensitive version that calls the block function.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param face The side the fire is coming from
+ * @return True if the face can catch fire.
+ */
+ public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
+ {
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ return false;
+ }
+
+ /**
+ * Side sensitive version that calls the block function.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param oldChance The previous maximum chance.
+ * @param face The side the fire is coming from
+ * @return The chance of the block catching fire, or oldChance if it is higher
+ */
+ public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, ForgeDirection face)
+ {
+ int newChance = 0;
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ return (newChance > oldChance ? newChance : oldChance);
+ }
}