From 6e45433c9eada46efd629d782cdedbb13b32966a Mon Sep 17 00:00:00 2001 From: Forstride Date: Sat, 30 Jan 2016 20:33:50 -0500 Subject: [PATCH] Fixed flammabilty/fire spread for slabs, planks, logs, foliage/plants, and flowers --- .../common/block/BlockBOPDoubleWoodSlab.java | 29 ++++++++++ .../common/block/BlockBOPFlower.java | 28 ++++++++++ .../common/block/BlockBOPHalfWoodSlab.java | 30 ++++++++++ .../common/block/BlockBOPLog.java | 31 +++++++++++ .../common/block/BlockBOPPlanks.java | 31 +++++++++++ .../common/block/BlockBOPPlant.java | 55 +++++++++++++++++++ 6 files changed, 204 insertions(+) diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPDoubleWoodSlab.java b/src/main/java/biomesoplenty/common/block/BlockBOPDoubleWoodSlab.java index 92da88aff..1250f8f05 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPDoubleWoodSlab.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDoubleWoodSlab.java @@ -24,10 +24,12 @@ import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -158,4 +160,31 @@ public class BlockBOPDoubleWoodSlab extends BlockSlab implements IBOPBlock } } + @Override + public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPWoods wood = ((BOPWoods) world.getBlockState(pos).getValue(this.variantProperty)); + switch (wood) + { + case HELLBARK: + return 0; + default: + return Blocks.double_wooden_slab.getFlammability(world, pos, face); + } + } + + @Override + public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPWoods wood = ((BOPWoods) world.getBlockState(pos).getValue(this.variantProperty)); + switch (wood) + { + case HELLBARK: + return 0; + default: + return Blocks.double_wooden_slab.getFireSpreadSpeed(world, pos, face); + } + } + + } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPFlower.java b/src/main/java/biomesoplenty/common/block/BlockBOPFlower.java index 47fe5f5dd..57f4dbf28 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPFlower.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPFlower.java @@ -15,6 +15,7 @@ import java.util.Random; import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.common.config.GameplayConfigurationHandler; import biomesoplenty.common.enums.BOPFlowers; +import biomesoplenty.common.enums.BOPWoods; import biomesoplenty.common.item.ItemBOPFlower; import biomesoplenty.common.util.block.VariantPagingHelper; import net.minecraft.block.Block; @@ -32,6 +33,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -320,6 +322,32 @@ public class BlockBOPFlower extends BlockBOPDecoration implements IShearable super.dropBlockAsItemWithChance(world, pos, state, chance, fortune); } + + @Override + public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPFlowers flower = ((BOPFlowers) world.getBlockState(pos).getValue(this.variantProperty)); + switch (flower) + { + case BURNING_BLOSSOM: + return 0; + default: + return Blocks.red_flower.getFlammability(world, pos, face); + } + } + + @Override + public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPFlowers flower = ((BOPFlowers) world.getBlockState(pos).getValue(this.variantProperty)); + switch (flower) + { + case BURNING_BLOSSOM: + return 0; + default: + return Blocks.red_flower.getFireSpreadSpeed(world, pos, face); + } + } @Override public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { return new ArrayList(); } diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPHalfWoodSlab.java b/src/main/java/biomesoplenty/common/block/BlockBOPHalfWoodSlab.java index 6e884b24e..6d45bc2d2 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPHalfWoodSlab.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPHalfWoodSlab.java @@ -22,9 +22,13 @@ import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -146,4 +150,30 @@ public class BlockBOPHalfWoodSlab extends BlockSlab implements IBOPBlock } } + @Override + public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPWoods wood = ((BOPWoods) world.getBlockState(pos).getValue(this.variantProperty)); + switch (wood) + { + case HELLBARK: + return 0; + default: + return Blocks.wooden_slab.getFlammability(world, pos, face); + } + } + + @Override + public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPWoods wood = ((BOPWoods) world.getBlockState(pos).getValue(this.variantProperty)); + switch (wood) + { + case HELLBARK: + return 0; + default: + return Blocks.wooden_slab.getFireSpreadSpeed(world, pos, face); + } + } + } diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPLog.java b/src/main/java/biomesoplenty/common/block/BlockBOPLog.java index 8fd842fee..64d925235 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPLog.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPLog.java @@ -9,6 +9,7 @@ package biomesoplenty.common.block; import biomesoplenty.api.block.IBOPBlock; +import biomesoplenty.common.enums.BOPTrees; import biomesoplenty.common.enums.BOPWoods; import biomesoplenty.common.item.ItemBOPBlock; import biomesoplenty.common.util.block.VariantPagingHelper; @@ -16,7 +17,11 @@ import net.minecraft.block.BlockLog; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; public class BlockBOPLog extends BlockLog implements IBOPBlock { @@ -105,5 +110,31 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock return this.getMetaFromState(state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y)); } + @Override + public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPWoods wood = ((BOPWoods) world.getBlockState(pos).getValue(this.variantProperty)); + switch (wood) + { + case HELLBARK: + return 0; + default: + return Blocks.log.getFlammability(world, pos, face); + } + } + + @Override + public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPWoods wood = ((BOPWoods) world.getBlockState(pos).getValue(this.variantProperty)); + switch (wood) + { + case HELLBARK: + return 0; + default: + return Blocks.log.getFireSpreadSpeed(world, pos, face); + } + } + } diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPPlanks.java b/src/main/java/biomesoplenty/common/block/BlockBOPPlanks.java index 6ab77a254..50c51abe5 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPPlanks.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPPlanks.java @@ -13,7 +13,11 @@ import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.common.enums.BOPWoods; import biomesoplenty.common.item.ItemBOPBlock; @@ -99,4 +103,31 @@ public class BlockBOPPlanks extends Block implements IBOPBlock return this.getMetaFromState(state); } + @Override + public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPWoods wood = ((BOPWoods) world.getBlockState(pos).getValue(this.variantProperty)); + switch (wood) + { + case HELLBARK: + return 0; + default: + return Blocks.planks.getFlammability(world, pos, face); + } + } + + @Override + public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPWoods wood = ((BOPWoods) world.getBlockState(pos).getValue(this.variantProperty)); + switch (wood) + { + case HELLBARK: + return 0; + default: + return Blocks.planks.getFireSpreadSpeed(world, pos, face); + } + } + + } \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java b/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java index de4e779a6..bc774e41a 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java @@ -14,6 +14,7 @@ import java.util.Random; import biomesoplenty.api.block.BlockQueries; import biomesoplenty.api.item.BOPItems; import biomesoplenty.common.enums.BOPPlants; +import biomesoplenty.common.enums.BOPWoods; import biomesoplenty.common.item.ItemBOPPlant; import biomesoplenty.common.util.block.VariantPagingHelper; import net.minecraft.block.Block; @@ -546,6 +547,60 @@ public class BlockBOPPlant extends BlockBOPDecoration implements IShearable return ret; } + @Override + public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPPlants plant = ((BOPPlants) world.getBlockState(pos).getValue(this.variantProperty)); + switch (plant) + { + case WILDRICE: + return 0; + case CATTAIL: + return 0; + case RIVERCANE: + return 0; + case WILDCARROT: + return 0; + case WITHERWART: + return 0; + case REED: + return 0; + case ROOT: + return 0; + case RAFFLESIA: + return 0; + default: + return Blocks.tallgrass.getFlammability(world, pos, face); + } + } + + @Override + public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) + { + BOPPlants plant = ((BOPPlants) world.getBlockState(pos).getValue(this.variantProperty)); + switch (plant) + { + case WILDRICE: + return 0; + case CATTAIL: + return 0; + case RIVERCANE: + return 0; + case WILDCARROT: + return 0; + case WITHERWART: + return 0; + case REED: + return 0; + case ROOT: + return 0; + case RAFFLESIA: + return 0; + default: + return Blocks.tallgrass.getFireSpreadSpeed(world, pos, face); + } + } + // TODO: pickblock on carrot?