Code cleanup - ProperCase for tree/wood enums

This commit is contained in:
Cheeserolls 2015-04-05 01:30:57 +01:00
parent 666c3b2e3f
commit 7846b72311
7 changed files with 90 additions and 90 deletions

View File

@ -13,7 +13,7 @@ import net.minecraft.util.IStringSerializable;
public class BOPTreeEnums public class BOPTreeEnums
{ {
public static enum allTrees implements IStringSerializable { public static enum AllTrees implements IStringSerializable {
// UNUSED_A and UNUSED_B are present to make the number up to 24 so that we can have 3 'pages' of 8 saplings without out-of-range index errors // UNUSED_A and UNUSED_B are present to make the number up to 24 so that we can have 3 'pages' of 8 saplings without out-of-range index errors
YELLOW_AUTUMN, ORANGE_AUTUMN, BAMBOO, MAGIC, DARK, DEAD, FIR, ETHEREAL, ORIGIN, PINK_CHERRY, WHITE_CHERRY, MAPLE, HELLBARK, FLOWERING, JACARANDA, SACRED_OAK, MANGROVE, PALM, REDWOOD, WILLOW, PINE, MAHOGANY, UNUSED_A, UNUSED_B; YELLOW_AUTUMN, ORANGE_AUTUMN, BAMBOO, MAGIC, DARK, DEAD, FIR, ETHEREAL, ORIGIN, PINK_CHERRY, WHITE_CHERRY, MAPLE, HELLBARK, FLOWERING, JACARANDA, SACRED_OAK, MANGROVE, PALM, REDWOOD, WILLOW, PINE, MAHOGANY, UNUSED_A, UNUSED_B;
@ -29,15 +29,15 @@ public class BOPTreeEnums
} }
} }
public static enum twoTrees implements IStringSerializable { public static enum TwoTrees implements IStringSerializable {
A, B; A, B;
public allTrees map(int page) public AllTrees map(int page)
{ {
return allTrees.values()[page * 2 + this.ordinal()]; return AllTrees.values()[page * 2 + this.ordinal()];
} }
public static twoTrees mapFrom(allTrees e) public static TwoTrees mapFrom(AllTrees e)
{ {
return twoTrees.values()[ e.ordinal() % 2 ]; return TwoTrees.values()[ e.ordinal() % 2 ];
} }
@Override @Override
public String getName() { public String getName() {
@ -50,15 +50,15 @@ public class BOPTreeEnums
} }
} }
public static enum fourTrees implements IStringSerializable { public static enum FourTrees implements IStringSerializable {
A, B, C, D; A, B, C, D;
public allTrees map(int page) public AllTrees map(int page)
{ {
return allTrees.values()[page * 4 + this.ordinal()]; return AllTrees.values()[page * 4 + this.ordinal()];
} }
public static fourTrees mapFrom(allTrees e) public static FourTrees mapFrom(AllTrees e)
{ {
return fourTrees.values()[ e.ordinal() % 4 ]; return FourTrees.values()[ e.ordinal() % 4 ];
} }
@Override @Override
public String getName() { public String getName() {
@ -71,15 +71,15 @@ public class BOPTreeEnums
} }
} }
public static enum eightTrees implements IStringSerializable { public static enum EightTrees implements IStringSerializable {
A, B, C, D, E, F, G, H; A, B, C, D, E, F, G, H;
public allTrees map(int page) public AllTrees map(int page)
{ {
return allTrees.values()[page * 8 + this.ordinal()]; return AllTrees.values()[page * 8 + this.ordinal()];
} }
public static eightTrees mapFrom(allTrees e) public static EightTrees mapFrom(AllTrees e)
{ {
return eightTrees.values()[ e.ordinal() % 8 ]; return EightTrees.values()[ e.ordinal() % 8 ];
} }
@Override @Override
public String getName() { public String getName() {

View File

@ -13,7 +13,7 @@ import net.minecraft.util.IStringSerializable;
public class BOPWoodEnums public class BOPWoodEnums
{ {
public static enum allWoods implements IStringSerializable { public static enum AllWoods implements IStringSerializable {
// TODO: change HELL_BARK to HELLBARK for consistency with BOPTreeEnums // TODO: change HELL_BARK to HELLBARK for consistency with BOPTreeEnums
SACRED_OAK, CHERRY, DARK, FIR, ETHEREAL, MAGIC, MANGROVE, PALM, REDWOOD, WILLOW, PINE, HELL_BARK, JACARANDA, MAHOGANY, GIANT_FLOWER, DEAD; SACRED_OAK, CHERRY, DARK, FIR, ETHEREAL, MAGIC, MANGROVE, PALM, REDWOOD, WILLOW, PINE, HELL_BARK, JACARANDA, MAHOGANY, GIANT_FLOWER, DEAD;
@Override @Override
@ -27,15 +27,15 @@ public class BOPWoodEnums
} }
} }
public static enum twoWoods implements IStringSerializable { public static enum TwoWoods implements IStringSerializable {
A, B; A, B;
public allWoods map(int page) public AllWoods map(int page)
{ {
return allWoods.values()[page * 2 + this.ordinal()]; return AllWoods.values()[page * 2 + this.ordinal()];
} }
public static twoWoods mapFrom(allWoods e) public static TwoWoods mapFrom(AllWoods e)
{ {
return twoWoods.values()[ e.ordinal() % 2 ]; return TwoWoods.values()[ e.ordinal() % 2 ];
} }
@Override @Override
public String getName() { public String getName() {
@ -48,15 +48,15 @@ public class BOPWoodEnums
} }
} }
public static enum fourWoods implements IStringSerializable { public static enum FourWoods implements IStringSerializable {
A, B, C, D; A, B, C, D;
public allWoods map(int page) public AllWoods map(int page)
{ {
return allWoods.values()[page * 4 + this.ordinal()]; return AllWoods.values()[page * 4 + this.ordinal()];
} }
public static fourWoods mapFrom(allWoods e) public static FourWoods mapFrom(AllWoods e)
{ {
return fourWoods.values()[ e.ordinal() % 4 ]; return FourWoods.values()[ e.ordinal() % 4 ];
} }
@Override @Override
public String getName() { public String getName() {
@ -69,15 +69,15 @@ public class BOPWoodEnums
} }
} }
public static enum eightWoods implements IStringSerializable { public static enum EightWoods implements IStringSerializable {
A, B, C, D, E, F, G, H; A, B, C, D, E, F, G, H;
public allWoods map(int page) public AllWoods map(int page)
{ {
return allWoods.values()[page * 8 + this.ordinal()]; return AllWoods.values()[page * 8 + this.ordinal()];
} }
public static eightWoods mapFrom(allWoods e) public static EightWoods mapFrom(AllWoods e)
{ {
return eightWoods.values()[ e.ordinal() % 8 ]; return EightWoods.values()[ e.ordinal() % 8 ];
} }
@Override @Override
public String getName() { public String getName() {
@ -90,15 +90,15 @@ public class BOPWoodEnums
} }
} }
public static enum sixteenWoods implements IStringSerializable { public static enum SixteenWoods implements IStringSerializable {
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P; A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P;
public allWoods map(int page) public AllWoods map(int page)
{ {
return allWoods.values()[page * 16 + this.ordinal()]; return AllWoods.values()[page * 16 + this.ordinal()];
} }
public static sixteenWoods mapFrom(allWoods e) public static SixteenWoods mapFrom(AllWoods e)
{ {
return sixteenWoods.values()[ e.ordinal() % 16 ]; return SixteenWoods.values()[ e.ordinal() % 16 ];
} }
@Override @Override
public String getName() { public String getName() {

View File

@ -13,8 +13,8 @@ import java.util.Random;
import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.api.block.BOPTreeEnums.fourTrees; import biomesoplenty.api.block.BOPTreeEnums.FourTrees;
import biomesoplenty.api.block.BOPTreeEnums.allTrees; import biomesoplenty.api.block.BOPTreeEnums.AllTrees;
import biomesoplenty.common.item.ItemBOPBlock; import biomesoplenty.common.item.ItemBOPBlock;
import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockPlanks; import net.minecraft.block.BlockPlanks;
@ -42,7 +42,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
// add properties - note CHECK_DECAY and DECAYABLE are both inherited from BlockLeaves // add properties - note CHECK_DECAY and DECAYABLE are both inherited from BlockLeaves
// both are boolean, requiring one bit each, so we have 2 bits left for the VARIANT which means we can have four per instance // both are boolean, requiring one bit each, so we have 2 bits left for the VARIANT which means we can have four per instance
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", fourTrees.class ); public static final PropertyEnum VARIANT = PropertyEnum.create("variant", FourTrees.class );
protected int pageNum; protected int pageNum;
@Override @Override
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { CHECK_DECAY, DECAYABLE, VARIANT });} protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { CHECK_DECAY, DECAYABLE, VARIANT });}
@ -60,7 +60,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) public String getStateName(IBlockState state)
{ {
return ((fourTrees) state.getValue(VARIANT)).map(this.pageNum).getName() + "_leaves"; return ((FourTrees) state.getValue(VARIANT)).map(this.pageNum).getName() + "_leaves";
} }
public BlockBOPLeaves(int pageNum) public BlockBOPLeaves(int pageNum)
@ -68,7 +68,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
super(); super();
this.pageNum = pageNum; this.pageNum = pageNum;
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, fourTrees.A).withProperty(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true))); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, FourTrees.A).withProperty(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true)));
} }
@ -79,12 +79,12 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override @Override
public IBlockState getStateFromMeta(int meta) public IBlockState getStateFromMeta(int meta)
{ {
return this.getDefaultState().withProperty(VARIANT, fourTrees.values()[meta & 3]).withProperty(DECAYABLE, Boolean.valueOf((meta & 4) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta & 8) > 0)); return this.getDefaultState().withProperty(VARIANT, FourTrees.values()[meta & 3]).withProperty(DECAYABLE, Boolean.valueOf((meta & 4) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta & 8) > 0));
} }
@Override @Override
public int getMetaFromState(IBlockState state) public int getMetaFromState(IBlockState state)
{ {
int i = ((fourTrees)state.getValue(VARIANT)).ordinal(); int i = ((FourTrees)state.getValue(VARIANT)).ordinal();
if (!((Boolean)state.getValue(DECAYABLE)).booleanValue()) if (!((Boolean)state.getValue(DECAYABLE)).booleanValue())
{ {
i |= 4; i |= 4;
@ -106,7 +106,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override @Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) public Item getItemDropped(IBlockState state, Random rand, int fortune)
{ {
allTrees treeType = ((fourTrees) state.getValue(VARIANT)).map(this.pageNum); AllTrees treeType = ((FourTrees) state.getValue(VARIANT)).map(this.pageNum);
int saplingPage = treeType.ordinal() / 8; int saplingPage = treeType.ordinal() / 8;
if (saplingPage == 2) {return Item.getItemFromBlock(BOPBlocks.sapling_2);} if (saplingPage == 2) {return Item.getItemFromBlock(BOPBlocks.sapling_2);}
if (saplingPage == 1) {return Item.getItemFromBlock(BOPBlocks.sapling_1);} if (saplingPage == 1) {return Item.getItemFromBlock(BOPBlocks.sapling_1);}
@ -116,7 +116,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override @Override
public int damageDropped(IBlockState state) public int damageDropped(IBlockState state)
{ {
allTrees treeType = ((fourTrees) state.getValue(VARIANT)).map(this.pageNum); AllTrees treeType = ((FourTrees) state.getValue(VARIANT)).map(this.pageNum);
return treeType.ordinal() % 8; return treeType.ordinal() % 8;
} }
@ -124,7 +124,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override @Override
protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance)
{ {
allTrees treeType = ((fourTrees) state.getValue(VARIANT)).map(this.pageNum); AllTrees treeType = ((FourTrees) state.getValue(VARIANT)).map(this.pageNum);
ItemStack fruit; ItemStack fruit;
switch (treeType) switch (treeType)
{ {
@ -171,7 +171,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override @Override
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{ {
allTrees tree = ((fourTrees) world.getBlockState(pos).getValue(VARIANT)).map(this.pageNum); AllTrees tree = ((FourTrees) world.getBlockState(pos).getValue(VARIANT)).map(this.pageNum);
switch (tree) switch (tree)
{ {
case HELLBARK: case HELLBARK:
@ -184,7 +184,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override @Override
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face)
{ {
allTrees tree = ((fourTrees) world.getBlockState(pos).getValue(VARIANT)).map(this.pageNum); AllTrees tree = ((FourTrees) world.getBlockState(pos).getValue(VARIANT)).map(this.pageNum);
switch (tree) switch (tree)
{ {
case HELLBARK: case HELLBARK:

View File

@ -8,8 +8,8 @@
package biomesoplenty.common.block; package biomesoplenty.common.block;
import biomesoplenty.api.block.BOPWoodEnums.allWoods; import biomesoplenty.api.block.BOPWoodEnums.AllWoods;
import biomesoplenty.api.block.BOPWoodEnums.fourWoods; import biomesoplenty.api.block.BOPWoodEnums.FourWoods;
import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.common.item.ItemBOPBlock; import biomesoplenty.common.item.ItemBOPBlock;
import net.minecraft.block.BlockLog; import net.minecraft.block.BlockLog;
@ -24,7 +24,7 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
// add properties (note we inherit LOG_AXIS property from parent BlockLog) // add properties (note we inherit LOG_AXIS property from parent BlockLog)
// LOG_AXIS requires 2 meta bits, so we have 2 left for the VARIANT, which means we can have four woods per instance // LOG_AXIS requires 2 meta bits, so we have 2 left for the VARIANT, which means we can have four woods per instance
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", fourWoods.class ); public static final PropertyEnum VARIANT = PropertyEnum.create("variant", FourWoods.class );
protected int pageNum; protected int pageNum;
@Override @Override
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { LOG_AXIS, VARIANT });} protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { LOG_AXIS, VARIANT });}
@ -42,7 +42,7 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) public String getStateName(IBlockState state)
{ {
allWoods wood = ((fourWoods) state.getValue(VARIANT)).map(this.pageNum); AllWoods wood = ((FourWoods) state.getValue(VARIANT)).map(this.pageNum);
switch (wood) switch (wood)
{ {
case GIANT_FLOWER: case GIANT_FLOWER:
@ -57,7 +57,7 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
{ {
super(); super();
this.pageNum = pageNum; this.pageNum = pageNum;
this.setDefaultState(this.blockState.getBaseState().withProperty(LOG_AXIS, BlockLog.EnumAxis.Y).withProperty(VARIANT, fourWoods.A)); this.setDefaultState(this.blockState.getBaseState().withProperty(LOG_AXIS, BlockLog.EnumAxis.Y).withProperty(VARIANT, FourWoods.A));
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
} }
@ -65,12 +65,12 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
@Override @Override
public IBlockState getStateFromMeta(int meta) public IBlockState getStateFromMeta(int meta)
{ {
return this.getDefaultState().withProperty(LOG_AXIS, BlockLog.EnumAxis.values()[meta >> 2]).withProperty(VARIANT, fourWoods.values()[meta & 3]); return this.getDefaultState().withProperty(LOG_AXIS, BlockLog.EnumAxis.values()[meta >> 2]).withProperty(VARIANT, FourWoods.values()[meta & 3]);
} }
@Override @Override
public int getMetaFromState(IBlockState state) public int getMetaFromState(IBlockState state)
{ {
return ((BlockLog.EnumAxis) state.getValue(LOG_AXIS)).ordinal() * 4 + ((fourWoods) state.getValue(VARIANT)).ordinal(); return ((BlockLog.EnumAxis) state.getValue(LOG_AXIS)).ordinal() * 4 + ((FourWoods) state.getValue(VARIANT)).ordinal();
} }
// discard the axis information - otherwise logs facing different directions would not stack together // discard the axis information - otherwise logs facing different directions would not stack together

View File

@ -16,8 +16,8 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.api.block.BOPWoodEnums.allWoods; import biomesoplenty.api.block.BOPWoodEnums.AllWoods;
import biomesoplenty.api.block.BOPWoodEnums.sixteenWoods; import biomesoplenty.api.block.BOPWoodEnums.SixteenWoods;
import biomesoplenty.common.item.ItemBOPBlock; import biomesoplenty.common.item.ItemBOPBlock;
public class BlockBOPPlanks extends Block implements IBOPBlock public class BlockBOPPlanks extends Block implements IBOPBlock
@ -25,7 +25,7 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
// add properties (note we inherit LOG_AXIS property from parent BlockLog) // add properties (note we inherit LOG_AXIS property from parent BlockLog)
// all 4 bits available for VARIANT, which means we can have 16 woods per instance // all 4 bits available for VARIANT, which means we can have 16 woods per instance
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", sixteenWoods.class ); public static final PropertyEnum VARIANT = PropertyEnum.create("variant", SixteenWoods.class );
protected int pageNum; protected int pageNum;
@Override @Override
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { VARIANT });} protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { VARIANT });}
@ -43,7 +43,7 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) public String getStateName(IBlockState state)
{ {
return ((sixteenWoods) state.getValue(VARIANT)).map(this.pageNum).getName() + "_planks"; return ((SixteenWoods) state.getValue(VARIANT)).map(this.pageNum).getName() + "_planks";
} }
@ -51,7 +51,7 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
{ {
super(Material.wood); super(Material.wood);
this.pageNum = pageNum; this.pageNum = pageNum;
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, sixteenWoods.A)); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, SixteenWoods.A));
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
} }
@ -59,12 +59,12 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
@Override @Override
public IBlockState getStateFromMeta(int meta) public IBlockState getStateFromMeta(int meta)
{ {
return this.getDefaultState().withProperty(VARIANT, sixteenWoods.values()[meta]); return this.getDefaultState().withProperty(VARIANT, SixteenWoods.values()[meta]);
} }
@Override @Override
public int getMetaFromState(IBlockState state) public int getMetaFromState(IBlockState state)
{ {
return ((sixteenWoods) state.getValue(VARIANT)).ordinal(); return ((SixteenWoods) state.getValue(VARIANT)).ordinal();
} }
@Override @Override
@ -73,9 +73,9 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
return this.getMetaFromState(state); return this.getMetaFromState(state);
} }
public IBlockState getStateByWood(allWoods wood) public IBlockState getStateByWood(AllWoods wood)
{ {
return this.getDefaultState().withProperty(VARIANT, sixteenWoods.mapFrom(wood)); return this.getDefaultState().withProperty(VARIANT, SixteenWoods.mapFrom(wood));
} }
} }

View File

@ -11,8 +11,8 @@ package biomesoplenty.common.block;
import java.util.Random; import java.util.Random;
import biomesoplenty.api.block.BOPBlocks; import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BOPTreeEnums.allTrees; import biomesoplenty.api.block.BOPTreeEnums.AllTrees;
import biomesoplenty.api.block.BOPTreeEnums.eightTrees; import biomesoplenty.api.block.BOPTreeEnums.EightTrees;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.IGrowable; import net.minecraft.block.IGrowable;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
@ -32,7 +32,7 @@ public class BlockBOPSapling extends BlockDecoration implements IGrowable {
// add properties // add properties
public static final PropertyInteger STAGE = PropertyInteger.create("stage", 0, 1); public static final PropertyInteger STAGE = PropertyInteger.create("stage", 0, 1);
// stage requires one bit, so we have 3 bits left for the VARIANT which means we can have eight per instance // stage requires one bit, so we have 3 bits left for the VARIANT which means we can have eight per instance
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", eightTrees.class ); public static final PropertyEnum VARIANT = PropertyEnum.create("variant", EightTrees.class );
protected int pageNum; protected int pageNum;
@Override @Override
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { STAGE, VARIANT });} protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { STAGE, VARIANT });}
@ -46,7 +46,7 @@ public class BlockBOPSapling extends BlockDecoration implements IGrowable {
@Override @Override
public String getStateName(IBlockState state) public String getStateName(IBlockState state)
{ {
return ((eightTrees) state.getValue(VARIANT)).map(this.pageNum).getName() + "_sapling"; return ((EightTrees) state.getValue(VARIANT)).map(this.pageNum).getName() + "_sapling";
} }
@ -64,12 +64,12 @@ public class BlockBOPSapling extends BlockDecoration implements IGrowable {
@Override @Override
public IBlockState getStateFromMeta(int meta) public IBlockState getStateFromMeta(int meta)
{ {
return this.getDefaultState().withProperty(VARIANT, eightTrees.values()[meta & 7]).withProperty(STAGE, Integer.valueOf(meta >> 3)); return this.getDefaultState().withProperty(VARIANT, EightTrees.values()[meta & 7]).withProperty(STAGE, Integer.valueOf(meta >> 3));
} }
@Override @Override
public int getMetaFromState(IBlockState state) public int getMetaFromState(IBlockState state)
{ {
return ((Integer)state.getValue(STAGE)).intValue() * 8 + ((eightTrees)state.getValue(VARIANT)).ordinal(); return ((Integer)state.getValue(STAGE)).intValue() * 8 + ((EightTrees)state.getValue(VARIANT)).ordinal();
} }
// which types of block allow trees // which types of block allow trees
@ -121,7 +121,7 @@ public class BlockBOPSapling extends BlockDecoration implements IGrowable {
// TODO: specify generator for each sapling // TODO: specify generator for each sapling
protected WorldGenAbstractTree getSmallTreeGenerator(allTrees treeType) protected WorldGenAbstractTree getSmallTreeGenerator(AllTrees treeType)
{ {
switch (treeType) switch (treeType)
{ {
@ -153,13 +153,13 @@ public class BlockBOPSapling extends BlockDecoration implements IGrowable {
} }
// TODO: specify generator for each sapling // TODO: specify generator for each sapling
protected WorldGenAbstractTree getBigTreeGenerator(allTrees treeType) protected WorldGenAbstractTree getBigTreeGenerator(AllTrees treeType)
{ {
return null; return null;
} }
// TODO: specify generator for each sapling // TODO: specify generator for each sapling
protected WorldGenAbstractTree getMegaTreeGenerator(allTrees treeType) protected WorldGenAbstractTree getMegaTreeGenerator(AllTrees treeType)
{ {
return null; return null;
} }
@ -199,7 +199,7 @@ public class BlockBOPSapling extends BlockDecoration implements IGrowable {
{ {
if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) {return false;} if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) {return false;}
allTrees treeType = ((eightTrees) state.getValue(VARIANT)).map(this.pageNum); AllTrees treeType = ((EightTrees) state.getValue(VARIANT)).map(this.pageNum);
WorldGenAbstractTree smallTreeGenerator = this.getSmallTreeGenerator(treeType); WorldGenAbstractTree smallTreeGenerator = this.getSmallTreeGenerator(treeType);
WorldGenAbstractTree bigTreeGenerator = this.getBigTreeGenerator(treeType); WorldGenAbstractTree bigTreeGenerator = this.getBigTreeGenerator(treeType);
WorldGenAbstractTree megaTreeGenerator = this.getMegaTreeGenerator(treeType); WorldGenAbstractTree megaTreeGenerator = this.getMegaTreeGenerator(treeType);

View File

@ -22,7 +22,7 @@ import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import biomesoplenty.api.block.BOPWoodEnums.allWoods; import biomesoplenty.api.block.BOPWoodEnums.AllWoods;
import biomesoplenty.api.block.IBOPBlock; import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.api.item.BOPItems; import biomesoplenty.api.item.BOPItems;
import biomesoplenty.common.block.BlockAsh; import biomesoplenty.common.block.BlockAsh;
@ -126,20 +126,20 @@ public class ModBlocks
// 16 wood types, 16 per BlockBOPPlanks instance, needs 1 'pages' // 16 wood types, 16 per BlockBOPPlanks instance, needs 1 'pages'
planks_0 = registerBlock( new BlockBOPPlanks(0), "planks_0"); planks_0 = registerBlock( new BlockBOPPlanks(0), "planks_0");
// stairs have no variant metadata, use a new BlockBOPStairs instance for each (note there's no giant_flower_stairs or dead_stairs) // stairs have no variant metadata, use a new BlockBOPStairs instance for each (note there's no giant_flower_stairs or dead_stairs)
sacred_oak_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.SACRED_OAK)), "sacred_oak_stairs" ); sacred_oak_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.SACRED_OAK)), "sacred_oak_stairs" );
cherry_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.CHERRY)), "cherry_stairs" ); cherry_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.CHERRY)), "cherry_stairs" );
dark_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.DARK)), "dark_stairs" ); dark_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.DARK)), "dark_stairs" );
fir_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.FIR)), "fir_stairs" ); fir_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.FIR)), "fir_stairs" );
ethereal_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.ETHEREAL)), "ethereal_stairs" ); ethereal_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.ETHEREAL)), "ethereal_stairs" );
magic_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.MAGIC)), "magic_stairs" ); magic_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.MAGIC)), "magic_stairs" );
mangrove_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.MANGROVE)), "mangrove_stairs" ); mangrove_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.MANGROVE)), "mangrove_stairs" );
palm_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.PALM)), "palm_stairs" ); palm_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.PALM)), "palm_stairs" );
redwood_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.REDWOOD)), "redwood_stairs" ); redwood_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.REDWOOD)), "redwood_stairs" );
willow_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.WILLOW)), "willow_stairs" ); willow_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.WILLOW)), "willow_stairs" );
pine_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.PINE)), "pine_stairs" ); pine_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.PINE)), "pine_stairs" );
hell_bark_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.HELL_BARK)), "hell_bark_stairs" ); hell_bark_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.HELL_BARK)), "hell_bark_stairs" );
jacaranda_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.JACARANDA)), "jacaranda_stairs" ); jacaranda_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.JACARANDA)), "jacaranda_stairs" );
mahogany_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(allWoods.MAHOGANY)), "mahogany_stairs" ); mahogany_stairs = registerBlock( new BlockBOPStairs(((BlockBOPPlanks)planks_0).getStateByWood(AllWoods.MAHOGANY)), "mahogany_stairs" );
// fences have no variant metadata, use a new BlockBOPFence instance for each (note there's no giant_flower_fence or dead_fence) // fences have no variant metadata, use a new BlockBOPFence instance for each (note there's no giant_flower_fence or dead_fence)
sacred_oak_fence = registerBlock( new BlockBOPFence(), "sacred_oak_fence" ); sacred_oak_fence = registerBlock( new BlockBOPFence(), "sacred_oak_fence" );
cherry_fence = registerBlock( new BlockBOPFence(), "cherry_fence" ); cherry_fence = registerBlock( new BlockBOPFence(), "cherry_fence" );