Added hooks to BlockFire for setting block flame interaction properties.

This commit is contained in:
LexManos 2011-12-21 04:30:53 +00:00
parent 2936697302
commit a38c8bd427
5 changed files with 702 additions and 2 deletions

View file

@ -130,7 +130,7 @@
}
}
@@ -805,6 +848,107 @@
@@ -805,6 +848,200 @@
return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F;
}
@ -234,6 +234,99 @@
+ public void addCreativeItems(ArrayList itemList)
+ {
+ }
+
+ private static int blockFireSpreadSpeed[] = new int[256];
+ private static int blockFlammability[] = new int[256];
+
+ /**
+ * Chance that fire will spread and consume this block.
+ * 300 being a 100% chance, 0, being a 0% chance.
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire
+ */
+ public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, int face)
+ {
+ return blockFlammability[blockID];
+ }
+
+ /**
+ * Called when fire is updating, checks if a block face can catch fire.
+ *
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return True if the face can be on fire, false otherwise.
+ */
+ public boolean isFlammable(IBlockAccess world, int x, int y, int z, int metadata, int face)
+ {
+ return getFlammability(world, x, y, z, metadata, face) > 0;
+ }
+
+ /**
+ * Called when fire is updating on a neighbor block.
+ * The higher the number returned, the faster fire will spread around this block.
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return A number that is used to determine the speed of fire growth around the block
+ */
+ public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, int face)
+ {
+ return blockFireSpreadSpeed[blockID];
+ }
+
+ /**
+ * Currently only called by fire when it is on top of this block.
+ * Returning true will prevent the fire from naturally dying during updating.
+ * Also prevents firing from dying from rain.
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return
+ */
+ public boolean isFireSource(World world, int x, int y, int z, int metadata, int face)
+ {
+ if (blockID == Block.netherrack.blockID && face == 0)
+ {
+ return true;
+ }
+ if ((world.worldProvider instanceof WorldProviderEnd) && blockID == Block.bedrock.blockID && face == 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Called by BlockFire to setup the burn values of vanilla blocks.
+ * @param id The block id
+ * @param encouragement How much the block encourages fire to spread
+ * @param flammability how easy a block is to catch fire
+ */
+ protected static void setBurnRate(int id, int encouragement, int flammability)
+ {
+ blockFireSpreadSpeed[id] = encouragement;
+ blockFlammability[id] = flammability;
+ }
+
+
static Class _mthclass$(String s)
{

View file

@ -0,0 +1,257 @@
--- ../src_base/minecraft/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
@@ -14,14 +14,9 @@
public class BlockFire extends Block
{
- private int chanceToEncourageFire[];
- private int abilityToCatchFire[];
-
protected BlockFire(int i, int j)
{
super(i, j, Material.fire);
- chanceToEncourageFire = new int[256];
- abilityToCatchFire = new int[256];
setTickOnLoad(true);
}
@@ -39,12 +34,6 @@
setBurnRate(Block.vine.blockID, 15, 100);
}
- private void setBurnRate(int i, int j, int k)
- {
- chanceToEncourageFire[i] = j;
- abilityToCatchFire[i] = k;
- }
-
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
@@ -77,11 +66,9 @@
public void updateTick(World world, int i, int j, int k, Random random)
{
- boolean flag = world.getBlockId(i, j - 1, k) == Block.netherrack.blockID;
- if((world.worldProvider instanceof WorldProviderEnd) && world.getBlockId(i, j - 1, k) == Block.bedrock.blockID)
- {
- flag = true;
- }
+ Block base = Block.blocksList[world.getBlockId(i, j - 1, k)];
+ boolean flag = (base != null && base.isFireSource(world, i, j - 1, k, world.getBlockMetadata(i, j - 1, k), 0));
+
if(!canPlaceBlockAt(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
@@ -99,23 +86,23 @@
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
if(!flag && !func_263_h(world, i, j, k))
{
- if(!world.isBlockNormalCube(i, j - 1, k) || l > 3)
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) || l > 3)
{
world.setBlockWithNotify(i, j, k, 0);
}
return;
}
- if(!flag && !canBlockCatchFire(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0)
+ if(!flag && !canBlockCatchFire(world, i, j - 1, k, 0) && l == 15 && random.nextInt(4) == 0)
{
world.setBlockWithNotify(i, j, k, 0);
return;
}
- tryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l);
- tryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l);
- tryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l);
- tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l);
- tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l);
- tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l);
+ tryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l, 4);
+ tryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l, 5);
+ tryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l, 0);
+ tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l, 1);
+ tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l, 3);
+ tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l, 2);
for(int i1 = i - 1; i1 <= i + 1; i1++)
{
for(int j1 = k - 1; j1 <= k + 1; j1++)
@@ -155,9 +142,14 @@
}
- private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1)
+ private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1, int face)
{
- int j1 = abilityToCatchFire[world.getBlockId(i, j, k)];
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ int j1 = 0;
+ if (block != null)
+ {
+ j1 = block.getFlammability(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
if(random.nextInt(l) < j1)
{
boolean flag = world.getBlockId(i, j, k) == Block.tnt.blockID;
@@ -182,27 +174,27 @@
private boolean func_263_h(World world, int i, int j, int k)
{
- if(canBlockCatchFire(world, i + 1, j, k))
+ if(canBlockCatchFire(world, i + 1, j, k, 4))
{
return true;
}
- if(canBlockCatchFire(world, i - 1, j, k))
+ if(canBlockCatchFire(world, i - 1, j, k, 5))
{
return true;
}
- if(canBlockCatchFire(world, i, j - 1, k))
+ if(canBlockCatchFire(world, i, j - 1, k, 0))
{
return true;
}
- if(canBlockCatchFire(world, i, j + 1, k))
+ if(canBlockCatchFire(world, i, j + 1, k, 1))
{
return true;
}
- if(canBlockCatchFire(world, i, j, k - 1))
+ if(canBlockCatchFire(world, i, j, k - 1, 3))
{
return true;
}
- return canBlockCatchFire(world, i, j, k + 1);
+ return canBlockCatchFire(world, i, j, k + 1, 2);
}
private int getChanceOfNeighborsEncouragingFire(World world, int i, int j, int k)
@@ -213,12 +205,12 @@
return 0;
} else
{
- l = getChanceToEncourageFire(world, i + 1, j, k, l);
- l = getChanceToEncourageFire(world, i - 1, j, k, l);
- l = getChanceToEncourageFire(world, i, j - 1, k, l);
- l = getChanceToEncourageFire(world, i, j + 1, k, l);
- l = getChanceToEncourageFire(world, i, j, k - 1, l);
- l = getChanceToEncourageFire(world, i, j, k + 1, l);
+ l = getChanceToEncourageFire(world, i + 1, j, k, l, 5);
+ l = getChanceToEncourageFire(world, i - 1, j, k, l, 4);
+ l = getChanceToEncourageFire(world, i, j - 1, k, l, 0);
+ l = getChanceToEncourageFire(world, i, j + 1, k, l, 1);
+ l = getChanceToEncourageFire(world, i, j, k - 1, l, 3);
+ l = getChanceToEncourageFire(world, i, j, k + 1, l, 2);
return l;
}
}
@@ -228,14 +220,25 @@
return false;
}
- public boolean canBlockCatchFire(IBlockAccess iblockaccess, int i, int j, int k)
- {
- return chanceToEncourageFire[iblockaccess.getBlockId(i, j, k)] > 0;
- }
- public int getChanceToEncourageFire(World world, int i, int j, int k, int l)
+ public boolean canBlockCatchFire(IBlockAccess world, int i, int j, int k, int face)
{
- int i1 = chanceToEncourageFire[world.getBlockId(i, j, k)];
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ if (block != null)
+ {
+ return block.isFlammable(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
+ return false;
+ }
+
+ public int getChanceToEncourageFire(World world, int i, int j, int k, int l, int face)
+ {
+ int i1 = 0;
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ if (block != null)
+ {
+ i1 = block.getFireSpreadSpeed(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
if(i1 > l)
{
return i1;
@@ -247,12 +250,12 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || func_263_h(world, i, j, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 0) || func_263_h(world, i, j, k);
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
- if(!world.isBlockNormalCube(i, j - 1, k) && !func_263_h(world, i, j, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) && !func_263_h(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -268,7 +271,7 @@
{
return;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && !func_263_h(world, i, j, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) && !func_263_h(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -285,7 +288,7 @@
{
world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, "fire.fire", 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F);
}
- if(world.isBlockNormalCube(i, j - 1, k) || Block.fire.canBlockCatchFire(world, i, j - 1, k))
+ if(world.isBlockSolidOnSide(i, j - 1, k, 0) || Block.fire.canBlockCatchFire(world, i, j - 1, k, 0))
{
for(int l = 0; l < 3; l++)
{
@@ -297,7 +300,7 @@
} else
{
- if(Block.fire.canBlockCatchFire(world, i - 1, j, k))
+ if(Block.fire.canBlockCatchFire(world, i - 1, j, k, 4))
{
for(int i1 = 0; i1 < 2; i1++)
{
@@ -308,7 +311,7 @@
}
}
- if(Block.fire.canBlockCatchFire(world, i + 1, j, k))
+ if(Block.fire.canBlockCatchFire(world, i + 1, j, k, 5))
{
for(int j1 = 0; j1 < 2; j1++)
{
@@ -319,7 +322,7 @@
}
}
- if(Block.fire.canBlockCatchFire(world, i, j, k - 1))
+ if(Block.fire.canBlockCatchFire(world, i, j, k - 1, 3))
{
for(int k1 = 0; k1 < 2; k1++)
{
@@ -330,7 +333,7 @@
}
}
- if(Block.fire.canBlockCatchFire(world, i, j, k + 1))
+ if(Block.fire.canBlockCatchFire(world, i, j, k + 1, 2))
{
for(int l1 = 0; l1 < 2; l1++)
{
@@ -341,7 +344,7 @@
}
}
- if(Block.fire.canBlockCatchFire(world, i, j + 1, k))
+ if(Block.fire.canBlockCatchFire(world, i, j + 1, k, 1))
{
for(int i2 = 0; i2 < 2; i2++)
{

View file

@ -1,5 +1,59 @@
--- ../src_base/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000
@@ -1332,7 +1332,7 @@
double d2 = (float)j1 / 256F;
double d3 = ((float)j1 + 15.99F) / 256F;
float f = 1.4F;
- if(!blockAccess.isBlockNormalCube(i, j - 1, k) && !Block.fire.canBlockCatchFire(blockAccess, i, j - 1, k))
+ if(!blockAccess.isBlockNormalCube(i, j - 1, k) && !Block.fire.canBlockCatchFire(blockAccess, i, j - 1, k, 0))
{
float f1 = 0.2F;
float f2 = 0.0625F;
@@ -1349,7 +1349,7 @@
d1 = d;
d = d4;
}
- if(Block.fire.canBlockCatchFire(blockAccess, i - 1, j, k))
+ if(Block.fire.canBlockCatchFire(blockAccess, i - 1, j, k, 4))
{
tessellator.addVertexWithUV((float)i + f1, (float)j + f + f2, k + 1, d1, d2);
tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 1, d1, d3);
@@ -1360,7 +1360,7 @@
tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 1, d1, d3);
tessellator.addVertexWithUV((float)i + f1, (float)j + f + f2, k + 1, d1, d2);
}
- if(Block.fire.canBlockCatchFire(blockAccess, i + 1, j, k))
+ if(Block.fire.canBlockCatchFire(blockAccess, i + 1, j, k, 5))
{
tessellator.addVertexWithUV((float)(i + 1) - f1, (float)j + f + f2, k + 0, d, d2);
tessellator.addVertexWithUV((i + 1) - 0, (float)(j + 0) + f2, k + 0, d, d3);
@@ -1371,7 +1371,7 @@
tessellator.addVertexWithUV((i + 1) - 0, (float)(j + 0) + f2, k + 0, d, d3);
tessellator.addVertexWithUV((float)(i + 1) - f1, (float)j + f + f2, k + 0, d, d2);
}
- if(Block.fire.canBlockCatchFire(blockAccess, i, j, k - 1))
+ if(Block.fire.canBlockCatchFire(blockAccess, i, j, k - 1, 3))
{
tessellator.addVertexWithUV(i + 0, (float)j + f + f2, (float)k + f1, d1, d2);
tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 0, d1, d3);
@@ -1382,7 +1382,7 @@
tessellator.addVertexWithUV(i + 0, (float)(j + 0) + f2, k + 0, d1, d3);
tessellator.addVertexWithUV(i + 0, (float)j + f + f2, (float)k + f1, d1, d2);
}
- if(Block.fire.canBlockCatchFire(blockAccess, i, j, k + 1))
+ if(Block.fire.canBlockCatchFire(blockAccess, i, j, k + 1, 2))
{
tessellator.addVertexWithUV(i + 1, (float)j + f + f2, (float)(k + 1) - f1, d, d2);
tessellator.addVertexWithUV(i + 1, (float)(j + 0) + f2, (k + 1) - 0, d, d3);
@@ -1393,7 +1393,7 @@
tessellator.addVertexWithUV(i + 1, (float)(j + 0) + f2, (k + 1) - 0, d, d3);
tessellator.addVertexWithUV(i + 1, (float)j + f + f2, (float)(k + 1) - f1, d, d2);
}
- if(Block.fire.canBlockCatchFire(blockAccess, i, j + 1, k))
+ if(Block.fire.canBlockCatchFire(blockAccess, i, j + 1, k, 1))
{
double d5 = (double)i + 0.5D + 0.5D;
double d7 = ((double)i + 0.5D) - 0.5D;
@@ -3301,7 +3301,7 @@
colorBlueTopRight *= f27;
int k2 = block.getBlockTexture(blockAccess, i, j, k, 2);

View file

@ -115,7 +115,7 @@
}
}
@@ -725,6 +767,99 @@
@@ -725,6 +767,191 @@
return blockMaterial.getMaterialMobility();
}
@ -211,6 +211,98 @@
+ int i, int j, int k) {
+ return world.setBlockWithNotify(i, j, k, 0);
+ }
+
+ private static int chanceToEncourageFire[] = new int[256];
+ private static int blockFlammability[] = new int[256];
+
+ /**
+ * Chance that fire will spread and consume this block.
+ * 300 being a 100% chance, 0, being a 0% chance.
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire
+ */
+ public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, int face)
+ {
+ return blockFlammability[blockID];
+ }
+
+ /**
+ * Called when fire is updating, checks if a block face can catch fire.
+ *
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return True if the face can be on fire, false otherwise.
+ */
+ public boolean isFlammable(IBlockAccess world, int x, int y, int z, int metadata, int face)
+ {
+ return getFlammability(world, x, y, z, metadata, face) > 0;
+ }
+
+ /**
+ * Called when fire is updating on a neighbor block.
+ * The higher the number returned, the faster fire will spread around this block.
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return A number that is used to determine the speed of fire growth around the block
+ */
+ public int chanceToEncourageFire(World world, int x, int y, int z, int metadata, int face)
+ {
+ return chanceToEncourageFire[blockID];
+ }
+
+ /**
+ * Currently only called by fire when it is on top of this block.
+ * Returning true will prevent the fire from naturally dieing during updating.
+ * Also prevents firing from dieing from rain.
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return
+ */
+ public boolean isFireSource(World world, int x, int y, int z, int metadata, int face)
+ {
+ if (blockID == Block.netherrack.blockID && face == 0)
+ {
+ return true;
+ }
+ if ((world.worldProvider instanceof WorldProviderEnd) && blockID == Block.bedrock.blockID && face == 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Called by BlockFire to setup the burn values of vanilla blocks.
+ * @param id The block id
+ * @param encouragement How much the block encourages fire to spread
+ * @param flammability how easy a block is to catch fire
+ */
+ protected static void setBurnRate(int id, int encouragement, int flammability)
+ {
+ chanceToEncourageFire[id] = encouragement;
+ blockFlammability[id] = flammability;
+ }
+
static Class _mthclass$(String s)
{

View file

@ -0,0 +1,204 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
@@ -13,15 +13,9 @@
public class BlockFire extends Block
{
-
- private int chanceToEncourageFire[];
- private int abilityToCatchFire[];
-
protected BlockFire(int i, int j)
{
super(i, j, Material.fire);
- chanceToEncourageFire = new int[256];
- abilityToCatchFire = new int[256];
setTickOnLoad(true);
}
@@ -39,12 +33,6 @@
setBurnRate(Block.vine.blockID, 15, 100);
}
- private void setBurnRate(int i, int j, int k)
- {
- chanceToEncourageFire[i] = j;
- abilityToCatchFire[i] = k;
- }
-
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
return null;
@@ -77,11 +65,9 @@
public void updateTick(World world, int i, int j, int k, Random random)
{
- boolean flag = world.getBlockId(i, j - 1, k) == Block.netherrack.blockID;
- if((world.worldProvider instanceof WorldProviderEnd) && world.getBlockId(i, j - 1, k) == Block.bedrock.blockID)
- {
- flag = true;
- }
+ Block base = Block.blocksList[world.getBlockId(i, j - 1, k)];
+ boolean flag = (base != null && base.isFireSource(world, i, j - 1, k, world.getBlockMetadata(i, j - 1, k), 0));
+
if(!canPlaceBlockAt(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
@@ -99,23 +85,23 @@
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
if(!flag && !func_268_g(world, i, j, k))
{
- if(!world.isBlockNormalCube(i, j - 1, k) || l > 3)
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) || l > 3)
{
world.setBlockWithNotify(i, j, k, 0);
}
return;
}
- if(!flag && !canBlockCatchFire(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0)
+ if(!flag && !canBlockCatchFire(world, i, j - 1, k, 0) && l == 15 && random.nextInt(4) == 0)
{
world.setBlockWithNotify(i, j, k, 0);
return;
}
- tryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l);
- tryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l);
- tryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l);
- tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l);
- tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l);
- tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l);
+ tryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l, 4);
+ tryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l, 5);
+ tryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l, 0);
+ tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l, 1);
+ tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l, 3);
+ tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l, 2);
for(int i1 = i - 1; i1 <= i + 1; i1++)
{
for(int j1 = k - 1; j1 <= k + 1; j1++)
@@ -155,9 +141,14 @@
}
- private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1)
+ private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1, int face)
{
- int j1 = abilityToCatchFire[world.getBlockId(i, j, k)];
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ int j1 = 0;
+ if (block != null)
+ {
+ j1 = block.getFlammability(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
if(random.nextInt(l) < j1)
{
boolean flag = world.getBlockId(i, j, k) == Block.tnt.blockID;
@@ -182,27 +173,27 @@
private boolean func_268_g(World world, int i, int j, int k)
{
- if(canBlockCatchFire(world, i + 1, j, k))
+ if(canBlockCatchFire(world, i + 1, j, k, 4))
{
return true;
}
- if(canBlockCatchFire(world, i - 1, j, k))
+ if(canBlockCatchFire(world, i - 1, j, k, 5))
{
return true;
}
- if(canBlockCatchFire(world, i, j - 1, k))
+ if(canBlockCatchFire(world, i, j - 1, k, 0))
{
return true;
}
- if(canBlockCatchFire(world, i, j + 1, k))
+ if(canBlockCatchFire(world, i, j + 1, k, 1))
{
return true;
}
- if(canBlockCatchFire(world, i, j, k - 1))
+ if(canBlockCatchFire(world, i, j, k - 1, 3))
{
return true;
}
- return canBlockCatchFire(world, i, j, k + 1);
+ return canBlockCatchFire(world, i, j, k + 1, 2);
}
private int getChanceOfNeighborsEncouragingFire(World world, int i, int j, int k)
@@ -213,12 +204,12 @@
return 0;
} else
{
- l = getChanceToEncourageFire(world, i + 1, j, k, l);
- l = getChanceToEncourageFire(world, i - 1, j, k, l);
- l = getChanceToEncourageFire(world, i, j - 1, k, l);
- l = getChanceToEncourageFire(world, i, j + 1, k, l);
- l = getChanceToEncourageFire(world, i, j, k - 1, l);
- l = getChanceToEncourageFire(world, i, j, k + 1, l);
+ l = getChanceToEncourageFire(world, i + 1, j, k, l, 5);
+ l = getChanceToEncourageFire(world, i - 1, j, k, l, 4);
+ l = getChanceToEncourageFire(world, i, j - 1, k, l, 0);
+ l = getChanceToEncourageFire(world, i, j + 1, k, l, 1);
+ l = getChanceToEncourageFire(world, i, j, k - 1, l, 3);
+ l = getChanceToEncourageFire(world, i, j, k + 1, l, 2);
return l;
}
}
@@ -228,14 +219,24 @@
return false;
}
- public boolean canBlockCatchFire(IBlockAccess iblockaccess, int i, int j, int k)
- {
- return chanceToEncourageFire[iblockaccess.getBlockId(i, j, k)] > 0;
- }
-
- public int getChanceToEncourageFire(World world, int i, int j, int k, int l)
+ public boolean canBlockCatchFire(IBlockAccess world, int i, int j, int k, int face)
{
- int i1 = chanceToEncourageFire[world.getBlockId(i, j, k)];
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ if (block != null)
+ {
+ return block.isFlammable(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
+ return false;
+ }
+
+ public int getChanceToEncourageFire(World world, int i, int j, int k, int l, int face)
+ {
+ int i1 = 0;
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ if (block != null)
+ {
+ i1 = block.chanceToEncourageFire(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ }
if(i1 > l)
{
return i1;
@@ -247,12 +248,12 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || func_268_g(world, i, j, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 0) || func_268_g(world, i, j, k);
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
- if(!world.isBlockNormalCube(i, j - 1, k) && !func_268_g(world, i, j, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) && !func_268_g(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -268,7 +269,7 @@
{
return;
}
- if(!world.isBlockNormalCube(i, j - 1, k) && !func_268_g(world, i, j, k))
+ if(!world.isBlockSolidOnSide(i, j - 1, k, 0) && !func_268_g(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;