diff --git a/src/minecraft/biomesoplenty/api/Blocks.java b/src/minecraft/biomesoplenty/api/Blocks.java index e48b28f55..e60f83d79 100644 --- a/src/minecraft/biomesoplenty/api/Blocks.java +++ b/src/minecraft/biomesoplenty/api/Blocks.java @@ -49,6 +49,9 @@ public class Blocks public static Optional mudBricksStairs = Optional.absent(); public static Optional holyCobbleStairs = Optional.absent(); public static Optional holyBricksStairs = Optional.absent(); + public static Optional pineStairs = Optional.absent(); + public static Optional hellBarkStairs = Optional.absent(); + public static Optional jacarandaStairs = Optional.absent(); // Slabs public static Optional woodenSingleSlab1 = Optional.absent(); diff --git a/src/minecraft/biomesoplenty/blocks/BlockBOPStairs.java b/src/minecraft/biomesoplenty/blocks/BlockBOPStairs.java index 6cc3fc44b..dd98c42dc 100644 --- a/src/minecraft/biomesoplenty/blocks/BlockBOPStairs.java +++ b/src/minecraft/biomesoplenty/blocks/BlockBOPStairs.java @@ -1,23 +1,42 @@ package biomesoplenty.blocks; +import java.util.Arrays; +import java.util.List; + +import com.google.common.base.Optional; + import biomesoplenty.BiomesOPlenty; +import biomesoplenty.api.BlockReferences.EnumBlocks; +import biomesoplenty.blocks.BlockBOPSlab.SlabCategory; import net.minecraft.block.Block; import net.minecraft.block.BlockStairs; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.util.Icon; +import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockBOPStairs extends BlockStairs { - public static enum Category - { - ACACIA, CHERRY, DARK, FIR, HOLY, MAGIC, MANGROVE, PALM, REDWOOD, WILLOW, RED_COBBLE, RED_BRICKS, MUD_BRICKS, HOLY_COBBLE, HOLY_BRICKS; - } + public static enum Category + { + ACACIA ("wood"), CHERRY ("wood"), DARK ("wood"), FIR ("wood"), HOLY ("wood"), MAGIC ("wood"), MANGROVE ("wood"), PALM ("wood"), REDWOOD ("wood"), WILLOW ("wood"), PINE ("wood"), HELL_BARK ("wood"), JACARANDA ("wood"), RED_COBBLE ("stone"), RED_BRICKS ("stone"), MUD_BRICKS ("stone"), HOLY_COBBLE ("stone"), HOLY_BRICKS ("stone"); + + private final List values; + private String type; + + private Category(String type) + { + this.type = type; + this.values = Arrays.asList(type); + } + } - private static final String[] types = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow", "redcobble", "redbrick", "mudbrick", "holycobble", "holybrick"}; + private static final String[] woodTypes = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow", "pine", "hell_bark", "jacaranda"}; + private static final String[] stoneTypes = new String[] {"redcobble", "redbrick", "mudbrick", "holycobble", "holybrick"}; private Icon[] textures; + private final Category category; public BlockBOPStairs(int blockID, Block model, Category cat) @@ -32,20 +51,83 @@ public class BlockBOPStairs extends BlockStairs @Override public void registerIcons(IconRegister iconRegister) { - textures = new Icon[types.length]; + if (isStoneCategory(category.toString())) + { + textures = new Icon[stoneTypes.length]; + + for (int i = 0; i < stoneTypes.length; ++i) + textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+stoneTypes[i]); + } + else + { + textures = new Icon[woodTypes.length]; + + for (int i = 0; i < woodTypes.length; ++i) + textures[i] = iconRegister.registerIcon("BiomesOPlenty:plank_"+woodTypes[i]); + } + } + + public boolean isWoodCategory(String block) + { + String type = Category.valueOf(block).type; + + if (type == "wood") + return true; + else + return false; + } + + public boolean isStoneCategory(String block) + { + String type = Category.valueOf(block).type; + + if (type == "stone") + return true; + else + return false; + } + + public static int getWoodCategoryAmount() + { + int woodCatNo = 0; + + for (Category cat : Category.values()) + { + if (cat.values.contains("wood")) + { + ++woodCatNo; + } + } - for (int i = 0; i < types.length; ++i) - if (i < types.length - 5) - textures[i] = iconRegister.registerIcon("BiomesOPlenty:plank_"+types[i]); - else - textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+types[i]); + return woodCatNo; + } + + public static int getStoneCategoryAmount() + { + int woodCatNo = 0; + + for (Category cat : Category.values()) + { + if (cat.values.contains("stone")) + { + ++woodCatNo; + } + } + return woodCatNo; } @Override public Icon getIcon(int side, int meta) - { - return textures[category.ordinal()]; + { + int adjCat = category.ordinal(); + + if (isStoneCategory(category.toString())) + { + adjCat = adjCat - getWoodCategoryAmount(); + } + + return textures[adjCat]; } @Override diff --git a/src/minecraft/biomesoplenty/configuration/BOPBlocks.java b/src/minecraft/biomesoplenty/configuration/BOPBlocks.java index 728b7f0f0..52fe98c0d 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPBlocks.java +++ b/src/minecraft/biomesoplenty/configuration/BOPBlocks.java @@ -174,6 +174,9 @@ public class BOPBlocks { Blocks.palmStairs = Optional.of((new BlockBOPStairs(BOPConfiguration.palmStairsID, Blocks.planks.get(), Category.PALM)).setUnlocalizedName("palmStairs")); Blocks.redwoodStairs = Optional.of((new BlockBOPStairs(BOPConfiguration.redwoodStairsID, Blocks.planks.get(), Category.REDWOOD)).setUnlocalizedName("redwoodStairs")); Blocks.willowStairs = Optional.of((new BlockBOPStairs(BOPConfiguration.willowStairsID, Blocks.planks.get(), Category.WILLOW)).setUnlocalizedName("willowStairs")); + Blocks.pineStairs = Optional.of((new BlockBOPStairs(BOPConfiguration.pineStairsID, Blocks.planks.get(), Category.PINE)).setUnlocalizedName("pineStairs")); + Blocks.hellBarkStairs = Optional.of((new BlockBOPStairs(BOPConfiguration.hellBarkStairsID, Blocks.planks.get(), Category.HELL_BARK)).setUnlocalizedName("hellBarkStairs")); + Blocks.jacarandaStairs = Optional.of((new BlockBOPStairs(BOPConfiguration.jacarandaStairsID, Blocks.planks.get(), Category.JACARANDA)).setUnlocalizedName("jacarandaStairs")); Blocks.leavesColorized = Optional.of((new BlockBOPColorizedLeaves(BOPConfiguration.colourizedLeavesID)).setUnlocalizedName("leavesColorized")); } @@ -254,6 +257,9 @@ public class BOPBlocks { GameRegistry.registerBlock(Blocks.palmStairs.get(), "palmStairs"); GameRegistry.registerBlock(Blocks.redwoodStairs.get(), "redwoodStairs"); GameRegistry.registerBlock(Blocks.willowStairs.get(), "willowStairs"); + GameRegistry.registerBlock(Blocks.pineStairs.get(), "pineStairs"); + GameRegistry.registerBlock(Blocks.hellBarkStairs.get(), "hellBarkStairs"); + GameRegistry.registerBlock(Blocks.jacarandaStairs.get(), "jacarandaStairs"); GameRegistry.registerBlock(Blocks.leavesColorized.get(), ItemBOPColorizedLeaves.class, "leavesColorized"); } @@ -306,7 +312,7 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(Blocks.plants.get(),1,6), "Barley"); LanguageRegistry.addName(new ItemStack(Blocks.petals.get(),1,0), "Giant Red Flower"); LanguageRegistry.addName(new ItemStack(Blocks.petals.get(),1,1), "Giant Yellow Flower"); - + LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,10), "Waterlily"); LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,11), "Tiny Cactus"); LanguageRegistry.addName(new ItemStack(Blocks.flowers.get(),1,12), "Aloe"); @@ -435,7 +441,7 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(Blocks.leaves2.get(),1,3), "White Cherry Leaves"); LanguageRegistry.addName(new ItemStack(Blocks.leaves2.get(),1,4), "Hell Bark Leaves"); LanguageRegistry.addName(new ItemStack(Blocks.leaves2.get(),1,5), "Jacaranda Leaves"); - + LanguageRegistry.addName(new ItemStack(Blocks.woodenDoubleSlab1.get(),1,0), "Acacia Wood Slab"); LanguageRegistry.addName(new ItemStack(Blocks.woodenDoubleSlab1.get(),1,1), "Cherry Wood Slab"); LanguageRegistry.addName(new ItemStack(Blocks.woodenDoubleSlab1.get(),1,2), "Dark Wood Slab"); @@ -474,17 +480,16 @@ public class BOPBlocks { LanguageRegistry.addName(Blocks.palmStairs.get(), "Palm Wood Stairs"); LanguageRegistry.addName(Blocks.redwoodStairs.get(), "Redwood Wood Stairs"); LanguageRegistry.addName(Blocks.willowStairs.get(), "Willow Wood Stairs"); + LanguageRegistry.addName(Blocks.pineStairs.get(), "Pine Wood Stairs"); + LanguageRegistry.addName(Blocks.hellBarkStairs.get(), "Hell Bark Stairs"); + LanguageRegistry.addName(Blocks.jacarandaStairs.get(), "Jacaranda Wood Stairs"); LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,3), "Redwood Leaves"); LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,4), "Willow Leaves"); LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,5), "Pine Leaves"); - LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,6), "Hellbark Leaves"); - LanguageRegistry.addName(new ItemStack(Blocks.leaves1.get(),1,5), "Fir Leaves"); LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,0), "Acacia Leaves"); - LanguageRegistry.addName(new ItemStack(Blocks.leaves1.get(),1,3), "Dark Leaves"); LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,2), "Palm Leaves"); LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,1), "Mangrove Leaves"); - LanguageRegistry.addName(new ItemStack(Blocks.leaves1.get(),1,6), "Loftwood Leaves"); } private static void addGrassPlants() diff --git a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java index 12062fce0..f3cfba203 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java +++ b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java @@ -182,6 +182,9 @@ public class BOPConfiguration { public static int palmStairsID; public static int redwoodStairsID; public static int willowStairsID; + public static int pineStairsID; + public static int hellBarkStairsID; + public static int jacarandaStairsID; public static int colourizedLeavesID; @@ -717,6 +720,10 @@ public class BOPConfiguration { //1970, 1971, 1972 & 1973 used by Liquids logs4ID = config.getBlock("Log Block ID 4", 1974, null).getInt(); + + pineStairsID = config.getBlock("Pine Stairs ID", 1975, null).getInt(); + hellBarkStairsID = config.getBlock("Hell Bark Stairs ID", 1976, null).getInt(); + jacarandaStairsID = config.getBlock("Jacaranda ID", 1977, null).getInt(); // Get Item ID's shroomPowderID = config.getItem("Shroom Powder ID", 21001, null).getInt(); diff --git a/src/minecraft/biomesoplenty/configuration/BOPCrafting.java b/src/minecraft/biomesoplenty/configuration/BOPCrafting.java index afaaf0451..8cde2c8fa 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPCrafting.java +++ b/src/minecraft/biomesoplenty/configuration/BOPCrafting.java @@ -242,6 +242,9 @@ public class BOPCrafting OreDictionary.registerOre("stairWood", new ItemStack(Blocks.palmStairs.get())); OreDictionary.registerOre("stairWood", new ItemStack(Blocks.mangroveStairs.get())); OreDictionary.registerOre("stairWood", new ItemStack(Blocks.holyStairs.get())); + OreDictionary.registerOre("stairWood", new ItemStack(Blocks.pineStairs.get())); + OreDictionary.registerOre("stairWood", new ItemStack(Blocks.hellBarkStairs.get())); + OreDictionary.registerOre("stairWood", new ItemStack(Blocks.jacarandaStairs.get())); OreDictionary.registerOre("treeLeaves", new ItemStack(Blocks.leavesColorized.get(), 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("treeLeaves", new ItemStack(Blocks.leaves1.get(), 1, OreDictionary.WILDCARD_VALUE));