2013-05-03 13:00:44 +00:00
|
|
|
package biomesoplenty.blocks;
|
|
|
|
|
2013-05-26 07:23:41 +00:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.BlockStairs;
|
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
|
|
|
import net.minecraft.util.Icon;
|
2013-05-29 01:05:27 +00:00
|
|
|
import biomesoplenty.BiomesOPlenty;
|
2013-05-03 13:00:44 +00:00
|
|
|
|
|
|
|
public class BlockBOPStairs extends BlockStairs
|
|
|
|
{
|
2013-05-26 07:23:41 +00:00
|
|
|
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<String> values;
|
|
|
|
private String type;
|
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
private Category(String type)
|
2013-05-26 07:23:41 +00:00
|
|
|
{
|
|
|
|
this.type = type;
|
2013-05-31 10:34:02 +00:00
|
|
|
values = Arrays.asList(type);
|
2013-05-26 07:23:41 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
super(blockID, model, 0);
|
|
|
|
category = cat;
|
|
|
|
setBurnProperties(this.blockID, 5, 20);
|
|
|
|
this.setLightOpacity(0);
|
|
|
|
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerIcons(IconRegister iconRegister)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
int adjCat = category.ordinal();
|
|
|
|
|
|
|
|
if (isStoneCategory(category.toString()))
|
|
|
|
{
|
|
|
|
adjCat = adjCat - getWoodCategoryAmount();
|
|
|
|
}
|
|
|
|
|
|
|
|
return textures[adjCat];
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int damageDropped(int meta)
|
|
|
|
{
|
|
|
|
return meta;
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|