Started on adding new logs

This commit is contained in:
Adubbz 2013-05-26 08:32:23 +10:00
parent ab70482b37
commit 4b29a47402
5 changed files with 55 additions and 13 deletions

View file

@ -22,6 +22,9 @@ public class BlockReferences {
willowLog (Blocks.logs3, 1),
deadLog (Blocks.logs3, 2),
bigFlowerStem (Blocks.logs3, 3),
pine (Blocks.logs4, 0),
hellbark (Blocks.logs4, 1),
jacaranda (Blocks.logs4, 2),
acaciaPlank (Blocks.planks, 0),
cherryPlank (Blocks.planks, 1),

View file

@ -31,6 +31,7 @@ public class Blocks
public static Optional<? extends Block> logs1 = Optional.absent();
public static Optional<? extends Block> logs2 = Optional.absent();
public static Optional<? extends Block> logs3 = Optional.absent();
public static Optional<? extends Block> logs4 = Optional.absent();
// Stairs
public static Optional<? extends Block> acaciaStairs = Optional.absent();

View file

@ -18,10 +18,10 @@ public class BlockBOPLog extends Block
{
public static enum LogCategory
{
CAT1, CAT2, CAT3;
CAT1, CAT2, CAT3, CAT4;
}
private static final String[] types = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow", "dead", "bigflowerstem"};
private static final String[] types = new String[] {"acacia", "cherry", "dark", "fir", "holy", "magic", "mangrove", "palm", "redwood", "willow", "dead", "bigflowerstem", "pine", "hellbark", "jacaranda"};
private Icon[] textures;
private Icon[] logHearts;
@ -44,30 +44,52 @@ public class BlockBOPLog extends Block
textures = new Icon[types.length];
logHearts = new Icon[types.length];
for (int i = 0; i < types.length - 1; ++i)
for (int i = 0; i < types.length; ++i)
{
textures[i] = iconRegister.registerIcon("BiomesOPlenty:log_"+types[i]+"_side");
logHearts[i] = iconRegister.registerIcon("BiomesOPlenty:log_"+types[i]+"_heart");
if (1 != 11)
{
textures[i] = iconRegister.registerIcon("BiomesOPlenty:log_"+types[i]+"_side");
logHearts[i] = iconRegister.registerIcon("BiomesOPlenty:log_"+types[i]+"_heart");
}
}
textures[types.length - 1] = iconRegister.registerIcon("BiomesOPlenty:bigflowerstem_side");
logHearts[types.length - 1] = iconRegister.registerIcon("BiomesOPlenty:bigflowerstem_heart");
textures[11] = iconRegister.registerIcon("BiomesOPlenty:bigflowerstem_side");
logHearts[11] = iconRegister.registerIcon("BiomesOPlenty:bigflowerstem_heart");
}
@Override
public Icon getIcon(int side, int meta)
{
int pos = meta & 12;
if (pos == 0 && (side == 1 || side == 0) || pos == 4 && (side == 5 || side == 4) || pos == 8 && (side == 2 || side == 3))
return logHearts[(getTypeFromMeta(meta) + this.category.ordinal() * 4)];
return textures[(getTypeFromMeta(meta) + this.category.ordinal() * 4)];
if (category != LogCategory.CAT4)
{
if (pos == 0 && (side == 1 || side == 0) || pos == 4 && (side == 5 || side == 4) || pos == 8 && (side == 2 || side == 3))
return logHearts[(getTypeFromMeta(meta) + this.category.ordinal() * 4)];
else
return textures[(getTypeFromMeta(meta) + this.category.ordinal() * 4)];
}
else
{
if (pos == 0 && (side == 1 || side == 0) || pos == 4 && (side == 5 || side == 4) || pos == 8 && (side == 2 || side == 3))
return logHearts[(getTypeFromMeta(meta) + this.category.ordinal() * 3)];
else
return textures[(getTypeFromMeta(meta) + this.category.ordinal() * 3)];
}
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) {
for (int i = 0; i < 4; ++i)
list.add(new ItemStack(this, 1, i));
if (category != LogCategory.CAT4)
{
for (int i = 0; i < 4; ++i)
list.add(new ItemStack(this, 1, i));
}
else
{
for (int i = 0; i < 3; ++i)
list.add(new ItemStack(this, 1, i));
}
}
@Override
@ -146,7 +168,14 @@ public class BlockBOPLog extends Block
public String getWoodType(int meta)
{
return types[getTypeFromMeta(meta) + category.ordinal() * 4];
if (category != LogCategory.CAT4)
{
return types[getTypeFromMeta(meta) + category.ordinal() * 4];
}
else
{
return types[getTypeFromMeta(meta) + category.ordinal() * 3];
}
}
private static int getTypeFromMeta(int meta)

View file

@ -129,6 +129,7 @@ public class BOPBlocks {
Blocks.logs1 = Optional.of((new BlockBOPLog(BOPConfiguration.logs1ID,LogCategory.CAT1)).setUnlocalizedName("wood1"));
Blocks.logs2 = Optional.of((new BlockBOPLog(BOPConfiguration.logs2ID,LogCategory.CAT2)).setUnlocalizedName("wood2"));
Blocks.logs3 = Optional.of((new BlockBOPLog(BOPConfiguration.logs3ID,LogCategory.CAT3)).setUnlocalizedName("wood3"));
Blocks.logs4 = Optional.of((new BlockBOPLog(BOPConfiguration.logs4ID,LogCategory.CAT4)).setUnlocalizedName("wood4"));
Blocks.petals = Optional.of((new BlockBOPPetals(BOPConfiguration.petalsID)).setUnlocalizedName("petals"));
Blocks.saplings = Optional.of((new BlockBOPSapling(BOPConfiguration.saplingsID)).setUnlocalizedName("saplings"));
Blocks.colorizedSaplings = Optional.of((new BlockBOPColorizedSapling(BOPConfiguration.colourizedSaplingsID)).setUnlocalizedName("colorizedSaplings"));
@ -203,6 +204,7 @@ public class BOPBlocks {
GameRegistry.registerBlock(Blocks.logs1.get(), ItemBOPLog.class, "wood1");
GameRegistry.registerBlock(Blocks.logs2.get(), ItemBOPLog.class, "wood2");
GameRegistry.registerBlock(Blocks.logs3.get(), ItemBOPLog.class, "wood3");
GameRegistry.registerBlock(Blocks.logs4.get(), ItemBOPLog.class, "wood4");
GameRegistry.registerBlock(Blocks.petals.get(), ItemBOPPetals.class, "petals");
GameRegistry.registerBlock(Blocks.saplings.get(), ItemBOPSapling.class, "saplings");
GameRegistry.registerBlock(Blocks.colorizedSaplings.get(), ItemBOPColorizedSapling.class, "colorizedSaplings");
@ -417,6 +419,10 @@ public class BOPBlocks {
LanguageRegistry.addName(new ItemStack(Blocks.logs3.get(),1,2), "Dead Wood");
LanguageRegistry.addName(new ItemStack(Blocks.logs3.get(),1,3), "Giant Flower Stem");
LanguageRegistry.addName(new ItemStack(Blocks.logs4.get(),1,0), "Pine Wood");
LanguageRegistry.addName(new ItemStack(Blocks.logs4.get(),1,1), "Hellbark");
LanguageRegistry.addName(new ItemStack(Blocks.logs4.get(),1,2), "Jacaranda Wood");
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");

View file

@ -146,6 +146,7 @@ public class BOPConfiguration {
public static int logs1ID;
public static int logs2ID;
public static int logs3ID;
public static int logs4ID;
public static int petalsID;
public static int saplingsID;
public static int colourizedSaplingsID;
@ -714,6 +715,8 @@ public class BOPConfiguration {
coralID = config.getBlock("Coral ID", 1969, null).getInt();
//1970, 1971, 1972 & 1973 used by Liquids
logs4ID = config.getBlock("Log Block ID 4", 1974, null).getInt();
// Get Item ID's
shroomPowderID = config.getItem("Shroom Powder ID", 21001, null).getInt();