From 5487aba3a206e8092c70df1e503e786124bd9cf9 Mon Sep 17 00:00:00 2001 From: mezz Date: Mon, 3 Nov 2014 00:30:19 -0800 Subject: [PATCH] Close #287. Add fireproof logs and planks, and recipes --- .../arboriculture/IWoodFireproof.java | 14 ++ .../gadgets/BlockFireproofLog.java | 60 ++++++++ .../gadgets/BlockFireproofPlanks.java | 55 ++++++++ .../arboriculture/gadgets/BlockLog.java | 8 +- .../arboriculture/gadgets/BlockPlanks.java | 8 +- .../arboriculture/items/ItemWoodBlock.java | 23 +-- .../worldgen/WorldGenAcacia.java | 6 - .../arboriculture/worldgen/WorldGenBalsa.java | 6 - .../worldgen/WorldGenBaobab.java | 6 - .../worldgen/WorldGenCherry.java | 6 - .../worldgen/WorldGenChestnut.java | 6 - .../arboriculture/worldgen/WorldGenDate.java | 5 - .../arboriculture/worldgen/WorldGenEbony.java | 6 - .../worldgen/WorldGenGiganteum.java | 6 - .../worldgen/WorldGenGreenheart.java | 6 - .../arboriculture/worldgen/WorldGenKapok.java | 6 - .../arboriculture/worldgen/WorldGenLarch.java | 6 - .../arboriculture/worldgen/WorldGenLemon.java | 5 - .../arboriculture/worldgen/WorldGenLime.java | 6 - .../arboriculture/worldgen/WorldGenMahoe.java | 5 - .../worldgen/WorldGenMahogany.java | 6 - .../arboriculture/worldgen/WorldGenMaple.java | 6 - .../worldgen/WorldGenPapaya.java | 5 - .../arboriculture/worldgen/WorldGenPine.java | 6 - .../arboriculture/worldgen/WorldGenPlum.java | 5 - .../worldgen/WorldGenPoplar.java | 5 - .../worldgen/WorldGenSequoia.java | 6 - .../worldgen/WorldGenSpruce.java | 6 - .../arboriculture/worldgen/WorldGenTeak.java | 6 - .../arboriculture/worldgen/WorldGenTree.java | 26 +++- .../worldgen/WorldGenWalnut.java | 6 - .../arboriculture/worldgen/WorldGenWenge.java | 6 - .../worldgen/WorldGenWillow.java | 6 - .../forestry/core/config/ForestryBlock.java | 10 ++ .../forestry/plugins/PluginArboriculture.java | 132 ++++++++++++++++-- 35 files changed, 306 insertions(+), 180 deletions(-) create mode 100644 src/main/java/forestry/arboriculture/IWoodFireproof.java create mode 100644 src/main/java/forestry/arboriculture/gadgets/BlockFireproofLog.java create mode 100644 src/main/java/forestry/arboriculture/gadgets/BlockFireproofPlanks.java diff --git a/src/main/java/forestry/arboriculture/IWoodFireproof.java b/src/main/java/forestry/arboriculture/IWoodFireproof.java new file mode 100644 index 000000000..9ee99ce72 --- /dev/null +++ b/src/main/java/forestry/arboriculture/IWoodFireproof.java @@ -0,0 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.arboriculture; + +public interface IWoodFireproof { +} diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockFireproofLog.java b/src/main/java/forestry/arboriculture/gadgets/BlockFireproofLog.java new file mode 100644 index 000000000..561969364 --- /dev/null +++ b/src/main/java/forestry/arboriculture/gadgets/BlockFireproofLog.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.arboriculture.gadgets; + +import forestry.arboriculture.IWoodFireproof; +import forestry.core.config.ForestryBlock; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockFireproofLog extends BlockLog implements IWoodFireproof { + + public static Material fireproofWood = new Material(MapColor.woodColor); + + public BlockFireproofLog(LogCat cat) { + super(cat, fireproofWood); + } + + public static ForestryBlock getFireproofLog(BlockLog log) { + return getFireproofLog(log.cat); + } + + private static ForestryBlock getFireproofLog(BlockLog.LogCat logCat) { + switch (logCat) { + case CAT0: return ForestryBlock.fireproofLog1; + case CAT1: return ForestryBlock.fireproofLog2; + case CAT2: return ForestryBlock.fireproofLog3; + case CAT3: return ForestryBlock.fireproofLog4; + case CAT4: return ForestryBlock.fireproofLog5; + case CAT5: return ForestryBlock.fireproofLog6; + case CAT6: return ForestryBlock.fireproofLog7; + case CAT7: return ForestryBlock.fireproofLog8; + } + throw new IllegalArgumentException("No fireproof log for this category: " + logCat); + } + + @Override + public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + return 0; + } + + @Override + public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + return false; + } + + @Override + public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + return 0; + } +} diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockFireproofPlanks.java b/src/main/java/forestry/arboriculture/gadgets/BlockFireproofPlanks.java new file mode 100644 index 000000000..8e71992e8 --- /dev/null +++ b/src/main/java/forestry/arboriculture/gadgets/BlockFireproofPlanks.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.arboriculture.gadgets; + +import forestry.arboriculture.IWoodFireproof; +import forestry.core.config.ForestryBlock; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockFireproofPlanks extends BlockPlanks implements IWoodFireproof { + + public static Material fireproofWood = new Material(MapColor.woodColor); + + public BlockFireproofPlanks(PlankCat cat) { + super(cat, fireproofWood); + } + + public static ForestryBlock getFireproofPlanks(BlockPlanks planks) { + return getFireproofPlanks(planks.cat); + } + + private static ForestryBlock getFireproofPlanks(PlankCat plankCat) { + switch (plankCat) { + case CAT0: return ForestryBlock.fireproofPlanks1; + case CAT1: return ForestryBlock.fireproofPlanks2; + } + throw new IllegalArgumentException("No fireproof log for this category: " + plankCat); + } + + @Override + public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + return 0; + } + + @Override + public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + return false; + } + + @Override + public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) { + return 0; + } + +} diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockLog.java b/src/main/java/forestry/arboriculture/gadgets/BlockLog.java index 2054ed499..86279c6a2 100755 --- a/src/main/java/forestry/arboriculture/gadgets/BlockLog.java +++ b/src/main/java/forestry/arboriculture/gadgets/BlockLog.java @@ -38,18 +38,20 @@ public class BlockLog extends Block implements IWoodTyped { CAT0, CAT1, CAT2, CAT3, CAT4, CAT5, CAT6, CAT7 } - private final LogCat cat; + protected final LogCat cat; public BlockLog(LogCat cat) { + this(cat, Material.wood); + } - super(Material.wood); + protected BlockLog(LogCat cat, Material material) { + super(material); this.cat = cat; setHardness(2.0F); setResistance(5.0F); setStepSound(soundTypeWood); setCreativeTab(Tabs.tabArboriculture); - } public static int getTypeFromMeta(int damage) { diff --git a/src/main/java/forestry/arboriculture/gadgets/BlockPlanks.java b/src/main/java/forestry/arboriculture/gadgets/BlockPlanks.java index 6f9684619..2404d5f62 100755 --- a/src/main/java/forestry/arboriculture/gadgets/BlockPlanks.java +++ b/src/main/java/forestry/arboriculture/gadgets/BlockPlanks.java @@ -37,10 +37,14 @@ public class BlockPlanks extends Block implements IWoodTyped { CAT0, CAT1 } - private final PlankCat cat; + protected final PlankCat cat; public BlockPlanks(PlankCat cat) { - super(Material.wood); + this(cat, Material.wood); + } + + protected BlockPlanks(PlankCat cat, Material material) { + super(material); this.cat = cat; setResistance(5.0F); setStepSound(soundTypeWood); diff --git a/src/main/java/forestry/arboriculture/items/ItemWoodBlock.java b/src/main/java/forestry/arboriculture/items/ItemWoodBlock.java index 62387fae2..6a1435151 100755 --- a/src/main/java/forestry/arboriculture/items/ItemWoodBlock.java +++ b/src/main/java/forestry/arboriculture/items/ItemWoodBlock.java @@ -10,6 +10,8 @@ ******************************************************************************/ package forestry.arboriculture.items; +import forestry.arboriculture.IWoodFireproof; +import forestry.core.utils.StringUtil; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -23,22 +25,23 @@ public class ItemWoodBlock extends ItemForestryBlock { super(block); } - public static int getTypeFromMeta(int damage) { - return damage & 3; - } - @Override - public String getUnlocalizedName(ItemStack itemstack) { - + public String getItemStackDisplayName(ItemStack itemstack) { if (this.getBlock() instanceof IWoodTyped) { IWoodTyped block = (IWoodTyped) getBlock(); int meta = itemstack.getItemDamage(); WoodType woodType = block.getWoodType(meta); if (woodType == null) return null; - return "tile.for." + block.getBlockKind() + "." + woodType.ordinal(); - } - return super.getUnlocalizedName(itemstack); - } + String unlocalizedName = block.getBlockKind() + "." + woodType.ordinal() + ".name"; + String displayName = StringUtil.localizeTile(unlocalizedName); + + if (this.getBlock() instanceof IWoodFireproof) + displayName = StringUtil.localizeAndFormatRaw("tile.for.fireproof", displayName); + + return displayName; + } + return super.getItemStackDisplayName(itemstack); + } } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenAcacia.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenAcacia.java index 0f435fc39..56a233291 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenAcacia.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenAcacia.java @@ -48,10 +48,4 @@ public class WorldGenAcacia extends WorldGenTree { height = determineHeight(5, 2); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log1, 2); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenBalsa.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenBalsa.java index 8a1ac8cb0..0bdcde71b 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenBalsa.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenBalsa.java @@ -46,10 +46,4 @@ public class WorldGenBalsa extends WorldGenTree { height = determineHeight(6, 6); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log3, 3); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenBaobab.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenBaobab.java index ff518b3ed..e4e22fb73 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenBaobab.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenBaobab.java @@ -64,10 +64,4 @@ public class WorldGenBaobab extends WorldGenTree { height = determineHeight(6, 6); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log2, 2); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenCherry.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenCherry.java index 6de78d4e3..775ae8030 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenCherry.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenCherry.java @@ -40,10 +40,4 @@ public class WorldGenCherry extends WorldGenTree { height = determineHeight(4, 4); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log4, 3); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenChestnut.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenChestnut.java index 48cea69df..28bfc8589 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenChestnut.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenChestnut.java @@ -44,10 +44,4 @@ public class WorldGenChestnut extends WorldGenTree { height = determineHeight(7, 3); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log2, 0); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenDate.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenDate.java index d80e20d53..896debc79 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenDate.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenDate.java @@ -32,11 +32,6 @@ public class WorldGenDate extends WorldGenTree { } - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log5, 2); - } - @Override public void preGenerate() { height = determineHeight(6, 2); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenEbony.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenEbony.java index 4e7122aad..7e876e6bf 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenEbony.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenEbony.java @@ -61,10 +61,4 @@ public class WorldGenEbony extends WorldGenTree { height = determineHeight(10, 4); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log3, 1); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenGiganteum.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenGiganteum.java index f5f25a9b0..ad32a8c94 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenGiganteum.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenGiganteum.java @@ -31,10 +31,4 @@ public class WorldGenGiganteum extends WorldGenSequoia { height = determineHeight(35, 15); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log7, 0); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenGreenheart.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenGreenheart.java index 7e4cdb2a8..3ebdf1b27 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenGreenheart.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenGreenheart.java @@ -55,10 +55,4 @@ public class WorldGenGreenheart extends WorldGenTree { height = determineHeight(10, 8); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log4, 2); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenKapok.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenKapok.java index 45c0aeca3..bf5024372 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenKapok.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenKapok.java @@ -54,10 +54,4 @@ public class WorldGenKapok extends WorldGenTree { height = determineHeight(10, 8); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log3, 0); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenLarch.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenLarch.java index 84e792955..5acc0af6c 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenLarch.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenLarch.java @@ -41,10 +41,4 @@ public class WorldGenLarch extends WorldGenTree { height = determineHeight(6, 5); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log1, 0); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenLemon.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenLemon.java index 665c92f11..0dbf4ddc2 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenLemon.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenLemon.java @@ -30,11 +30,6 @@ public class WorldGenLemon extends WorldGenTree { } - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log6, 3); - } - @Override public void preGenerate() { height = determineHeight(6, 3); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenLime.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenLime.java index 860d664f6..aa17569fc 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenLime.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenLime.java @@ -38,10 +38,4 @@ public class WorldGenLime extends WorldGenTree { height = determineHeight(6, 4); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log1, 3); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenMahoe.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenMahoe.java index 42624af2a..37256c938 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenMahoe.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenMahoe.java @@ -30,11 +30,6 @@ public class WorldGenMahoe extends WorldGenTree { } - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log5, 0); - } - @Override public void preGenerate() { height = determineHeight(6, 3); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenMahogany.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenMahogany.java index fe62b4d89..e43b3246d 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenMahogany.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenMahogany.java @@ -43,10 +43,4 @@ public class WorldGenMahogany extends WorldGenTree { height = determineHeight(12, 6); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log3, 2); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenMaple.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenMaple.java index 02b4cbc46..239abd278 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenMaple.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenMaple.java @@ -44,10 +44,4 @@ public class WorldGenMaple extends WorldGenTree { height = determineHeight(7, 5); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log6, 2); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenPapaya.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenPapaya.java index 696987206..1c86f58f9 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenPapaya.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenPapaya.java @@ -29,11 +29,6 @@ public class WorldGenPapaya extends WorldGenTree { generateSphere(getCenteredAt(yCenter, 0), 2 + rand.nextInt(girth), leaf, EnumReplaceMode.NONE); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log5, 3); - } @Override public void preGenerate() { diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenPine.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenPine.java index 5c13eb77c..5c93ebedf 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenPine.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenPine.java @@ -44,10 +44,4 @@ public class WorldGenPine extends WorldGenTree { height = determineHeight(6, 4); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log6, 0); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenPlum.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenPlum.java index d8cc6f180..9036dbf7a 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenPlum.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenPlum.java @@ -30,11 +30,6 @@ public class WorldGenPlum extends WorldGenTree { } - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log6, 1); - } - @Override public void preGenerate() { height = determineHeight(6, 3); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenPoplar.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenPoplar.java index e404a7c6b..9de0d72f0 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenPoplar.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenPoplar.java @@ -31,11 +31,6 @@ public class WorldGenPoplar extends WorldGenTree { } - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log5, 1); - } - @Override public void preGenerate() { height = determineHeight(8, 3); diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenSequoia.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenSequoia.java index a79462bc9..b6ab46e0e 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenSequoia.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenSequoia.java @@ -55,10 +55,4 @@ public class WorldGenSequoia extends WorldGenTree { height = determineHeight(20, 5); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log2, 3); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenSpruce.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenSpruce.java index d1041d75b..0889e7cf2 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenSpruce.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenSpruce.java @@ -42,10 +42,4 @@ public class WorldGenSpruce extends WorldGenTree { height = determineHeight(5, 3); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(Blocks.log, 1); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenTeak.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenTeak.java index ebd016f34..1a7e0bd0b 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenTeak.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenTeak.java @@ -43,10 +43,4 @@ public class WorldGenTeak extends WorldGenTree { height = determineHeight(6, 3); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log1, 1); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java index bb5747096..f0bde07ce 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenTree.java @@ -12,9 +12,17 @@ package forestry.arboriculture.worldgen; import com.mojang.authlib.GameProfile; +import forestry.api.arboriculture.EnumTreeChromosome; +import forestry.api.genetics.IAlleleBoolean; import forestry.api.world.ITreeGenData; +import forestry.arboriculture.gadgets.BlockFireproofLog; +import forestry.arboriculture.gadgets.BlockLog; +import forestry.core.config.ForestryBlock; +import forestry.core.utils.StackUtils; import forestry.core.worldgen.BlockType; import forestry.plugins.PluginArboriculture; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; public abstract class WorldGenTree extends WorldGenArboriculture { @@ -93,6 +101,22 @@ public abstract class WorldGenTree extends WorldGenArboriculture { } @Override - public abstract BlockType getWood(); + public BlockType getWood() { + ItemStack woodStack = tree.getGenome().getPrimary().getLogStacks()[0]; + Block block = StackUtils.getBlock(woodStack); + int meta = woodStack.getItemDamage(); + + // if we have a fireproof tree, return the fireproof log + if (block instanceof BlockLog) { + IAlleleBoolean fireproof = (IAlleleBoolean) tree.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF.ordinal()); + if (fireproof.getValue()) { + BlockLog blockLog = (BlockLog) block; + ForestryBlock fireproofLogBlock = BlockFireproofLog.getFireproofLog(blockLog); + return new BlockType(fireproofLogBlock.block(), meta); + } + } + + return new BlockType(block, meta); + } } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenWalnut.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenWalnut.java index 9fae24f89..98e62a503 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenWalnut.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenWalnut.java @@ -46,10 +46,4 @@ public class WorldGenWalnut extends WorldGenTree { height = determineHeight(7, 3); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log4, 1); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenWenge.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenWenge.java index 502009bb5..f962592ed 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenWenge.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenWenge.java @@ -43,10 +43,4 @@ public class WorldGenWenge extends WorldGenTree { height = determineHeight(6, 2); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log2, 1); - } - } diff --git a/src/main/java/forestry/arboriculture/worldgen/WorldGenWillow.java b/src/main/java/forestry/arboriculture/worldgen/WorldGenWillow.java index c4131ec63..a81ec973a 100755 --- a/src/main/java/forestry/arboriculture/worldgen/WorldGenWillow.java +++ b/src/main/java/forestry/arboriculture/worldgen/WorldGenWillow.java @@ -47,10 +47,4 @@ public class WorldGenWillow extends WorldGenTree { height = determineHeight(5, 2); girth = determineGirth(tree.getGirth(world, startX, startY, startZ)); } - - @Override - public BlockType getWood() { - return new BlockType(ForestryBlock.log4, 0); - } - } diff --git a/src/main/java/forestry/core/config/ForestryBlock.java b/src/main/java/forestry/core/config/ForestryBlock.java index f17651b69..c57013531 100755 --- a/src/main/java/forestry/core/config/ForestryBlock.java +++ b/src/main/java/forestry/core/config/ForestryBlock.java @@ -52,6 +52,8 @@ public enum ForestryBlock { glass, planks1, planks2, + fireproofPlanks1, + fireproofPlanks2, slabs1, slabs2, slabs3, @@ -64,6 +66,14 @@ public enum ForestryBlock { log6, log7, log8, + fireproofLog1, + fireproofLog2, + fireproofLog3, + fireproofLog4, + fireproofLog5, + fireproofLog6, + fireproofLog7, + fireproofLog8, fences1, fences2, stairs, diff --git a/src/main/java/forestry/plugins/PluginArboriculture.java b/src/main/java/forestry/plugins/PluginArboriculture.java index 5ddf410ed..bc14e41af 100644 --- a/src/main/java/forestry/plugins/PluginArboriculture.java +++ b/src/main/java/forestry/plugins/PluginArboriculture.java @@ -11,20 +11,6 @@ package forestry.plugins; import cpw.mods.fml.common.IFuelHandler; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.command.ICommand; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.WeightedRandomChestContent; -import net.minecraftforge.common.ChestGenHooks; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; import cpw.mods.fml.common.network.IGuiHandler; @@ -58,6 +44,8 @@ import forestry.arboriculture.WoodType; import forestry.arboriculture.gadgets.BlockArbFence; import forestry.arboriculture.gadgets.BlockArbFence.FenceCat; import forestry.arboriculture.gadgets.BlockArbStairs; +import forestry.arboriculture.gadgets.BlockFireproofLog; +import forestry.arboriculture.gadgets.BlockFireproofPlanks; import forestry.arboriculture.gadgets.BlockFruitPod; import forestry.arboriculture.gadgets.BlockLog; import forestry.arboriculture.gadgets.BlockLog.LogCat; @@ -137,7 +125,21 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.LiquidHelper; import forestry.core.utils.RecipeUtil; import forestry.core.utils.ShapedRecipeCustom; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.command.ICommand; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.ArrayList; import java.util.EnumSet; +import java.util.List; @Plugin(pluginID = "Arboriculture", name = "Arboriculture", author = "Binnie & SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.arboriculture.description") public class PluginArboriculture extends ForestryPlugin { @@ -160,9 +162,20 @@ public class PluginArboriculture extends ForestryPlugin { ForestryBlock.log5, ForestryBlock.log6, ForestryBlock.log7); + public static final EnumSet fireproofLogs = EnumSet.of( + ForestryBlock.fireproofLog1, + ForestryBlock.fireproofLog2, + ForestryBlock.fireproofLog3, + ForestryBlock.fireproofLog4, + ForestryBlock.fireproofLog5, + ForestryBlock.fireproofLog6, + ForestryBlock.fireproofLog7); private static final EnumSet planks = EnumSet.of( ForestryBlock.planks1, ForestryBlock.planks2); + private static final EnumSet fireproofPlanks = EnumSet.of( + ForestryBlock.fireproofPlanks1, + ForestryBlock.fireproofPlanks2); private static final EnumSet slabs = EnumSet.of( ForestryBlock.slabs1, ForestryBlock.slabs2, @@ -188,6 +201,19 @@ public class PluginArboriculture extends ForestryPlugin { OreDictionary.registerOre("logWood", log.getWildcard()); } + ForestryBlock.fireproofLog1.registerBlock(new BlockFireproofLog(LogCat.CAT0), ItemWoodBlock.class, "fireproofLog1"); + ForestryBlock.fireproofLog2.registerBlock(new BlockFireproofLog(LogCat.CAT1), ItemWoodBlock.class, "fireproofLog2"); + ForestryBlock.fireproofLog3.registerBlock(new BlockFireproofLog(LogCat.CAT2), ItemWoodBlock.class, "fireproofLog3"); + ForestryBlock.fireproofLog4.registerBlock(new BlockFireproofLog(LogCat.CAT3), ItemWoodBlock.class, "fireproofLog4"); + ForestryBlock.fireproofLog5.registerBlock(new BlockFireproofLog(LogCat.CAT4), ItemWoodBlock.class, "fireproofLog5"); + ForestryBlock.fireproofLog6.registerBlock(new BlockFireproofLog(LogCat.CAT5), ItemWoodBlock.class, "fireproofLog6"); + ForestryBlock.fireproofLog7.registerBlock(new BlockFireproofLog(LogCat.CAT6), ItemWoodBlock.class, "fireproofLog7"); + + for (ForestryBlock fireproofLog : fireproofLogs) { + fireproofLog.block().setHarvestLevel("axe", 0); + OreDictionary.registerOre("logWood", fireproofLog.getWildcard()); + } + ForestryBlock.planks1.registerBlock(new BlockPlanks(PlankCat.CAT0), ItemWoodBlock.class, "planks"); ForestryBlock.planks2.registerBlock(new BlockPlanks(PlankCat.CAT1), ItemWoodBlock.class, "planks2"); @@ -196,6 +222,14 @@ public class PluginArboriculture extends ForestryPlugin { OreDictionary.registerOre("plankWood", plank.getWildcard()); } + ForestryBlock.fireproofPlanks1.registerBlock(new BlockFireproofPlanks(PlankCat.CAT0), ItemWoodBlock.class, "fireproofPlanks1"); + ForestryBlock.fireproofPlanks2.registerBlock(new BlockFireproofPlanks(PlankCat.CAT1), ItemWoodBlock.class, "fireproofPlanks2"); + + for (ForestryBlock plank : fireproofPlanks) { + plank.block().setHarvestLevel("axe", 0); + OreDictionary.registerOre("plankWood", plank.getWildcard()); + } + ForestryBlock.slabs1.registerBlock(new BlockSlab(SlabCat.CAT0), ItemWoodBlock.class, "slabs1"); ForestryBlock.slabs2.registerBlock(new BlockSlab(SlabCat.CAT1), ItemWoodBlock.class, "slabs2"); ForestryBlock.slabs3.registerBlock(new BlockSlab(SlabCat.CAT2), ItemWoodBlock.class, "slabs3"); @@ -318,6 +352,9 @@ public class PluginArboriculture extends ForestryPlugin { for (ForestryBlock block : logs) BackpackManager.definitions.get("forester").addValidItem(block.getWildcard()); + for (ForestryBlock block : fireproofLogs) + BackpackManager.definitions.get("forester").addValidItem(block.getWildcard()); + BackpackManager.definitions.get("forester").addValidItem(ForestryItem.sapling.getWildcard()); BackpackManager.definitions.get("forester").addValidItem(ForestryItem.fruits.getWildcard()); @@ -355,6 +392,73 @@ public class PluginArboriculture extends ForestryPlugin { for (int i = 0; i < 4; i++) Proxies.common.addShapelessRecipe(ForestryBlock.planks2.getItemStack(4, 4 + i), ForestryBlock.log6.getItemStack(1, i)); + // Fabricator recipes + if (PluginManager.Module.FACTORY.isEnabled() && PluginManager.Module.APICULTURE.isEnabled()) { + + // Fireproof log recipes + for (ForestryBlock forestryBlock : logs) { + BlockLog blockLog = (BlockLog) forestryBlock.block(); + ForestryBlock fireproofLog = BlockFireproofLog.getFireproofLog(blockLog); + + if (forestryBlock == ForestryBlock.log8) + continue; + + for (int i = 0; i < 4; i++) { + if (forestryBlock == ForestryBlock.log7 && i > 0) + break; + + ItemStack logStack = forestryBlock.getItemStack(1, i); + ItemStack fireproofLogStack = fireproofLog.getItemStack(1, i); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), fireproofLogStack, new Object[]{ + " # ", + "#X#", + " # ", + '#', ForestryItem.refractoryWax, + 'X', logStack}); + } + } + + // Fireproof plank recipes + ForestryBlock plank = ForestryBlock.planks1; + for (int i = 0; i < 16; i++) { + ForestryBlock fireproofPlank = BlockFireproofPlanks.getFireproofPlanks((BlockPlanks)plank.block()); + ItemStack plankStack = plank.getItemStack(1, i); + ItemStack fireproofPlankStack = fireproofPlank.getItemStack(5, i); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), fireproofPlankStack, new Object[]{ + "X#X", + "#X#", + "X#X", + '#', ForestryItem.refractoryWax, + 'X', plankStack}); + } + plank = ForestryBlock.planks2; + for (int i = 0; i < 8; i++) { + ForestryBlock fireproofPlank = BlockFireproofPlanks.getFireproofPlanks((BlockPlanks)plank.block()); + ItemStack plankStack = plank.getItemStack(1, i); + ItemStack fireproofPlankStack = fireproofPlank.getItemStack(5, i); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), fireproofPlankStack, new Object[]{ + "X#X", + "#X#", + "X#X", + '#', ForestryItem.refractoryWax, + 'X', plankStack}); + } + } + + // / Fireproof Plank recipes + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks1.getItemStack(4, i), ForestryBlock.fireproofLog1.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks1.getItemStack(4, 4 + i), ForestryBlock.fireproofLog2.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks1.getItemStack(4, 8 + i), ForestryBlock.fireproofLog3.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks1.getItemStack(4, 12 + i), ForestryBlock.fireproofLog4.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks2.getItemStack(4, i), ForestryBlock.fireproofLog5.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.fireproofPlanks2.getItemStack(4, 4 + i), ForestryBlock.fireproofLog6.getItemStack(1, i)); + // Slab recipes for (int i = 0; i < 8; i++) Proxies.common.addPriorityRecipe(ForestryBlock.slabs1.getItemStack(6, i), "###", '#', ForestryBlock.planks1.getItemStack(1, i));