Added Pine, Hell Bark and Jacaranda stairs

This commit is contained in:
Adubbz 2013-05-26 17:23:41 +10:00
parent 3befd832b3
commit 6eda158465
5 changed files with 119 additions and 19 deletions

View file

@ -49,6 +49,9 @@ public class Blocks
public static Optional<? extends Block> mudBricksStairs = Optional.absent(); public static Optional<? extends Block> mudBricksStairs = Optional.absent();
public static Optional<? extends Block> holyCobbleStairs = Optional.absent(); public static Optional<? extends Block> holyCobbleStairs = Optional.absent();
public static Optional<? extends Block> holyBricksStairs = Optional.absent(); public static Optional<? extends Block> holyBricksStairs = Optional.absent();
public static Optional<? extends Block> pineStairs = Optional.absent();
public static Optional<? extends Block> hellBarkStairs = Optional.absent();
public static Optional<? extends Block> jacarandaStairs = Optional.absent();
// Slabs // Slabs
public static Optional<? extends BlockHalfSlab> woodenSingleSlab1 = Optional.absent(); public static Optional<? extends BlockHalfSlab> woodenSingleSlab1 = Optional.absent();

View file

@ -1,23 +1,42 @@
package biomesoplenty.blocks; package biomesoplenty.blocks;
import java.util.Arrays;
import java.util.List;
import com.google.common.base.Optional;
import biomesoplenty.BiomesOPlenty; import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BlockReferences.EnumBlocks;
import biomesoplenty.blocks.BlockBOPSlab.SlabCategory;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs; import net.minecraft.block.BlockStairs;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockBOPStairs extends BlockStairs public class BlockBOPStairs extends BlockStairs
{ {
public static enum Category public static enum Category
{ {
ACACIA, CHERRY, DARK, FIR, HOLY, MAGIC, MANGROVE, PALM, REDWOOD, WILLOW, RED_COBBLE, RED_BRICKS, MUD_BRICKS, HOLY_COBBLE, HOLY_BRICKS; 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 static final String[] types = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow", "redcobble", "redbrick", "mudbrick", "holycobble", "holybrick"}; private final List<String> values;
private String type;
private Category(String type)
{
this.type = type;
this.values = Arrays.asList(type);
}
}
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 Icon[] textures;
private final Category category; private final Category category;
public BlockBOPStairs(int blockID, Block model, Category cat) public BlockBOPStairs(int blockID, Block model, Category cat)
@ -32,20 +51,83 @@ public class BlockBOPStairs extends BlockStairs
@Override @Override
public void registerIcons(IconRegister iconRegister) public void registerIcons(IconRegister iconRegister)
{ {
textures = new Icon[types.length]; if (isStoneCategory(category.toString()))
{
textures = new Icon[stoneTypes.length];
for (int i = 0; i < types.length; ++i) for (int i = 0; i < stoneTypes.length; ++i)
if (i < types.length - 5) textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+stoneTypes[i]);
textures[i] = iconRegister.registerIcon("BiomesOPlenty:plank_"+types[i]); }
else else
textures[i] = iconRegister.registerIcon("BiomesOPlenty:"+types[i]); {
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;
}
}
return woodCatNo;
}
public static int getStoneCategoryAmount()
{
int woodCatNo = 0;
for (Category cat : Category.values())
{
if (cat.values.contains("stone"))
{
++woodCatNo;
}
}
return woodCatNo;
} }
@Override @Override
public Icon getIcon(int side, int meta) 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 @Override

View file

@ -174,6 +174,9 @@ public class BOPBlocks {
Blocks.palmStairs = Optional.of((new BlockBOPStairs(BOPConfiguration.palmStairsID, Blocks.planks.get(), Category.PALM)).setUnlocalizedName("palmStairs")); 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.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.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")); 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.palmStairs.get(), "palmStairs");
GameRegistry.registerBlock(Blocks.redwoodStairs.get(), "redwoodStairs"); GameRegistry.registerBlock(Blocks.redwoodStairs.get(), "redwoodStairs");
GameRegistry.registerBlock(Blocks.willowStairs.get(), "willowStairs"); 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"); GameRegistry.registerBlock(Blocks.leavesColorized.get(), ItemBOPColorizedLeaves.class, "leavesColorized");
} }
@ -474,17 +480,16 @@ public class BOPBlocks {
LanguageRegistry.addName(Blocks.palmStairs.get(), "Palm Wood Stairs"); LanguageRegistry.addName(Blocks.palmStairs.get(), "Palm Wood Stairs");
LanguageRegistry.addName(Blocks.redwoodStairs.get(), "Redwood Wood Stairs"); LanguageRegistry.addName(Blocks.redwoodStairs.get(), "Redwood Wood Stairs");
LanguageRegistry.addName(Blocks.willowStairs.get(), "Willow 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,3), "Redwood Leaves");
LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,4), "Willow 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,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.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,2), "Palm Leaves");
LanguageRegistry.addName(new ItemStack(Blocks.leavesColorized.get(),1,1), "Mangrove 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() private static void addGrassPlants()

View file

@ -182,6 +182,9 @@ public class BOPConfiguration {
public static int palmStairsID; public static int palmStairsID;
public static int redwoodStairsID; public static int redwoodStairsID;
public static int willowStairsID; public static int willowStairsID;
public static int pineStairsID;
public static int hellBarkStairsID;
public static int jacarandaStairsID;
public static int colourizedLeavesID; public static int colourizedLeavesID;
@ -718,6 +721,10 @@ public class BOPConfiguration {
logs4ID = config.getBlock("Log Block ID 4", 1974, null).getInt(); 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 // Get Item ID's
shroomPowderID = config.getItem("Shroom Powder ID", 21001, null).getInt(); shroomPowderID = config.getItem("Shroom Powder ID", 21001, null).getInt();
sunflowerSeedsID = config.getItem("Sunflower Seeds ID", 21002, null).getInt(); sunflowerSeedsID = config.getItem("Sunflower Seeds ID", 21002, null).getInt();

View file

@ -242,6 +242,9 @@ public class BOPCrafting
OreDictionary.registerOre("stairWood", new ItemStack(Blocks.palmStairs.get())); OreDictionary.registerOre("stairWood", new ItemStack(Blocks.palmStairs.get()));
OreDictionary.registerOre("stairWood", new ItemStack(Blocks.mangroveStairs.get())); OreDictionary.registerOre("stairWood", new ItemStack(Blocks.mangroveStairs.get()));
OreDictionary.registerOre("stairWood", new ItemStack(Blocks.holyStairs.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.leavesColorized.get(), 1, OreDictionary.WILDCARD_VALUE));
OreDictionary.registerOre("treeLeaves", new ItemStack(Blocks.leaves1.get(), 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("treeLeaves", new ItemStack(Blocks.leaves1.get(), 1, OreDictionary.WILDCARD_VALUE));