Overhaul system for dividing classes with lots of variants up into smaller "pages" - no longer uses generic enums with names like A,B,C,D - now uses meaningful names, new system also allows for filtering the enums to allow removal of (for example) giant_flower_planks

This commit is contained in:
Cheeserolls 2015-04-06 17:16:23 +01:00
parent 1597322d1c
commit 918dbdd5ff
59 changed files with 1212 additions and 479 deletions

View File

@ -39,8 +39,8 @@ public class BOPBlocks
public static Block sapling_2;
// TODO fruit tree leaves and saplings
public static Block planks_0;
public static Block half_wood_slab_0;
public static Block half_wood_slab_1;
public static Block wood_slab_0;
public static Block wood_slab_1;
public static Block double_wood_slab_0;
public static Block double_wood_slab_1;
public static Block sacred_oak_stairs;

View File

@ -27,68 +27,5 @@ public class BOPTreeEnums
return this.getName();
}
}
public static enum TwoTrees implements IStringSerializable {
A, B;
public AllTrees map(int page)
{
return AllTrees.values()[page * 2 + this.ordinal()];
}
public static TwoTrees mapFrom(AllTrees e)
{
return TwoTrees.values()[ e.ordinal() % 2 ];
}
@Override
public String getName() {
return this.name().toLowerCase();
}
@Override
public String toString()
{
return this.getName();
}
}
public static enum FourTrees implements IStringSerializable {
A, B, C, D;
public AllTrees map(int page)
{
return AllTrees.values()[page * 4 + this.ordinal()];
}
public static FourTrees mapFrom(AllTrees e)
{
return FourTrees.values()[ e.ordinal() % 4 ];
}
@Override
public String getName() {
return this.name().toLowerCase();
}
@Override
public String toString()
{
return this.getName();
}
}
public static enum EightTrees implements IStringSerializable {
A, B, C, D, E, F, G, H;
public AllTrees map(int page)
{
return AllTrees.values()[page * 8 + this.ordinal()];
}
public static EightTrees mapFrom(AllTrees e)
{
return EightTrees.values()[ e.ordinal() % 8 ];
}
@Override
public String getName() {
return this.name().toLowerCase();
}
@Override
public String toString()
{
return this.getName();
}
}
}

View File

@ -27,88 +27,4 @@ public class BOPWoodEnums
}
}
public static enum TwoWoods implements IStringSerializable {
A, B;
public AllWoods map(int page)
{
return AllWoods.values()[page * 2 + this.ordinal()];
}
public static TwoWoods mapFrom(AllWoods e)
{
return TwoWoods.values()[ e.ordinal() % 2 ];
}
@Override
public String getName() {
return this.name().toLowerCase();
}
@Override
public String toString()
{
return this.getName();
}
}
public static enum FourWoods implements IStringSerializable {
A, B, C, D;
public AllWoods map(int page)
{
return AllWoods.values()[page * 4 + this.ordinal()];
}
public static FourWoods mapFrom(AllWoods e)
{
return FourWoods.values()[ e.ordinal() % 4 ];
}
@Override
public String getName() {
return this.name().toLowerCase();
}
@Override
public String toString()
{
return this.getName();
}
}
public static enum EightWoods implements IStringSerializable {
A, B, C, D, E, F, G, H;
public AllWoods map(int page)
{
return AllWoods.values()[page * 8 + this.ordinal()];
}
public static EightWoods mapFrom(AllWoods e)
{
return EightWoods.values()[ e.ordinal() % 8 ];
}
@Override
public String getName() {
return this.name().toLowerCase();
}
@Override
public String toString()
{
return this.getName();
}
}
public static enum SixteenWoods implements IStringSerializable {
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P;
public AllWoods map(int page)
{
return AllWoods.values()[page * 16 + this.ordinal()];
}
public static SixteenWoods mapFrom(AllWoods e)
{
return SixteenWoods.values()[ e.ordinal() % 16 ];
}
@Override
public String getName() {
return this.name().toLowerCase();
}
@Override
public String toString()
{
return this.getName();
}
}
}

View File

@ -1,12 +1,12 @@
package biomesoplenty.common.block;
import biomesoplenty.api.block.BOPWoodEnums.EightWoods;
import biomesoplenty.api.block.BOPWoodEnums.AllWoods;
import biomesoplenty.api.block.IBOPBlock;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
public class BlockBOPDoubleWoodSlab extends BlockBOPHalfWoodSlab implements IBOPBlock
public abstract class BlockBOPDoubleWoodSlab extends BlockBOPHalfWoodSlab implements IBOPBlock
{
// HALF isn't used in double slab because both halves are present
@ -15,23 +15,23 @@ public class BlockBOPDoubleWoodSlab extends BlockBOPHalfWoodSlab implements IBOP
@Override
public String getStateName(IBlockState state)
{
return "double_" + ((EightWoods) state.getValue(VARIANT)).map(this.pageNum).toString() + "_wood_slab";
}
return "double_" + super.getStateName(state);
}
public BlockBOPDoubleWoodSlab(int pageNum)
public BlockBOPDoubleWoodSlab()
{
super(pageNum);
super();
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(VARIANT, EightWoods.values()[meta & 7]);
return this.getDefaultState().withProperty(getMyVariantProperty(), variantFromMeta(meta & 7));
}
@Override
public int getMetaFromState(IBlockState state)
{
return ((EightWoods) state.getValue(VARIANT)).ordinal();
return metaFromVariant((AllWoods) state.getValue(getMyVariantProperty()));
}
@Override

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPDoubleWoodSlab0 extends BlockBOPDoubleWoodSlab {
public static final int PAGENUM = 0;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPDoubleWoodSlab0.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPDoubleWoodSlab1 extends BlockBOPDoubleWoodSlab {
public static final int PAGENUM = 1;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPDoubleWoodSlab0.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -2,9 +2,10 @@ package biomesoplenty.common.block;
import java.util.List;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import biomesoplenty.api.block.BOPWoodEnums.EightWoods;
import biomesoplenty.api.block.BOPWoodEnums.AllWoods;
import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.common.util.block.BlockStateUtils;
import net.minecraft.block.BlockSlab;
@ -21,15 +22,71 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockBOPHalfWoodSlab extends BlockSlab implements IBOPBlock
public abstract class BlockBOPHalfWoodSlab extends BlockSlab implements IBOPBlock
{
// store the variant properties for each page in this array
private static PropertyEnum[] variantProperties;
// number of variants per page - HALF requires 1 meta bit, so we have 3 left for the VARIANT, which means we can have eight woods per instance
public static final int variantsPerPage = 8;
// fetch a particular page's variant property
// the first time this is called, it also sets up the array of variant properties
protected static PropertyEnum getVariantProperty(int pageNum)
{
int len = AllWoods.values().length;
int numPages = (int) Math.ceil( (double)len / variantsPerPage);
if (variantProperties == null)
{
variantProperties = new PropertyEnum[numPages];
}
pageNum = Math.max(0, Math.min(pageNum, numPages - 1));
if (variantProperties[pageNum] == null)
{
variantProperties[pageNum] = PropertyEnum.create("variant", AllWoods.class, getVariantEnumFilter(pageNum));
}
return variantProperties[pageNum];
}
// define the filter function used to reduce the set of enum values to the subset for the given page
protected static Predicate<AllWoods> getVariantEnumFilter(final int pageNum)
{
return new Predicate<AllWoods>()
{
@Override
public boolean apply(AllWoods wood)
{
switch (wood)
{
case GIANT_FLOWER: case DEAD:
return false;
default:
return (wood.ordinal() >= (variantsPerPage * pageNum)) && (wood.ordinal() < (variantsPerPage * (pageNum+1)));
}
}
};
}
// child classes must implement to define their page number
abstract public int getPageNum();
// fetch the current instance's variant property
public PropertyEnum getMyVariantProperty()
{
return getVariantProperty(this.getPageNum());
}
public int metaFromVariant(AllWoods wood)
{
return wood.ordinal() % variantsPerPage;
}
public AllWoods variantFromMeta(int meta)
{
int i = Math.max(0, Math.min(meta + (this.getPageNum() * variantsPerPage), AllWoods.values().length)); // clamp to
return AllWoods.values()[i];
}
// add properties (note we inherit HALF property from parent BlockSlab)
// HALF requires 1 meta bit, so we have 3 left for the VARIANT, which means we can have eight woods per instance
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", EightWoods.class );
protected int pageNum;
@Override
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] {HALF, VARIANT});}
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] {HALF, getMyVariantProperty()});}
// implement IBOPBlock
@Override
@ -37,59 +94,59 @@ public class BlockBOPHalfWoodSlab extends BlockSlab implements IBOPBlock
@Override
public int getItemRenderColor(IBlockState state, int tintIndex) { return this.getRenderColor(state); }
@Override
public IProperty[] getPresetProperties() { return new IProperty[] {VARIANT}; }
public IProperty[] getPresetProperties() { return new IProperty[] {getMyVariantProperty()}; }
@Override
public IProperty[] getNonRenderingProperties() { return null; }
@Override
public String getStateName(IBlockState state)
{
return ((EightWoods) state.getValue(VARIANT)).map(this.pageNum).toString() + "_wood_slab";
}
return ((AllWoods) state.getValue(getMyVariantProperty())).getName() + "_wood_slab";
}
public BlockBOPHalfWoodSlab(int pageNum)
public BlockBOPHalfWoodSlab()
{
super(Material.wood);
this.pageNum = pageNum;
this.useNeighborBrightness = true;
this.setHardness(2.0F).setResistance(5.0F).setStepSound(soundTypeWood);
this.setHarvestLevel("axe", 0);
this.setDefaultState(this.blockState.getBaseState().withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM).withProperty(VARIANT, EightWoods.A));
this.setDefaultState(this.blockState.getBaseState().withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM));
}
// these 3 functions are required by BlockSlab for setting up the corresponding ItemSlab
@Override
public String getUnlocalizedName(int meta)
{
return this.getStateName(this.getStateFromMeta(meta));
}
@Override
public IProperty getVariantProperty()
{
return VARIANT;
return getMyVariantProperty();
}
@Override
public Object getVariant(ItemStack stack)
{
return EightWoods.values()[stack.getMetadata() & 7];
return variantFromMeta(stack.getMetadata() & 7);
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(VARIANT, EightWoods.values()[meta & 7]).withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
return this.getDefaultState().withProperty(getMyVariantProperty(), variantFromMeta(meta & 7)).withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP);
}
@Override
public int getMetaFromState(IBlockState state)
{
return (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP ? 8 : 0) + ((EightWoods) state.getValue(VARIANT)).ordinal();
return (state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP ? 8 : 0) + metaFromVariant((AllWoods) state.getValue(getMyVariantProperty()));
}
@Override
public int damageDropped(IBlockState state)
{
return this.getMetaFromState(this.getDefaultState().withProperty(VARIANT, (EightWoods) state.getValue(VARIANT)));
// always drop a bottom slab
return this.getMetaFromState(state.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM));
}
@Override
@ -110,4 +167,4 @@ public class BlockBOPHalfWoodSlab extends BlockSlab implements IBOPBlock
}
}
}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPHalfWoodSlab0 extends BlockBOPHalfWoodSlab {
public static final int PAGENUM = 0;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPHalfWoodSlab.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPHalfWoodSlab1 extends BlockBOPHalfWoodSlab {
public static final int PAGENUM = 1;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPHalfWoodSlab.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -11,9 +11,10 @@ package biomesoplenty.common.block;
import java.util.List;
import java.util.Random;
import com.google.common.base.Predicate;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.api.block.BOPTreeEnums.FourTrees;
import biomesoplenty.api.block.BOPTreeEnums.AllTrees;
import biomesoplenty.common.item.ItemBOPBlock;
import net.minecraft.block.BlockLeaves;
@ -37,15 +38,67 @@ import net.minecraftforge.fml.relauncher.SideOnly;
// TODO: sort out proper base color when using fast graphics
// TODO: flowers look tinted when using fast graphics
public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
public abstract class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
{
// store the variant properties for each page in this array
private static PropertyEnum[] variantProperties;
// CHECK_DECAY and DECAYABLE require one bit each, so we have 2 bits left for the VARIANT which means we can have four per instance
public static final int variantsPerPage = 4;
// fetch a particular page's variant property
// the first time this is called, it also sets up the array of variant properties
protected static PropertyEnum getVariantProperty(int pageNum)
{
int len = AllTrees.values().length;
int numPages = (int) Math.ceil( (double)len / variantsPerPage);
if (variantProperties == null)
{
variantProperties = new PropertyEnum[numPages];
}
pageNum = Math.max(0, Math.min(pageNum, numPages - 1));
if (variantProperties[pageNum] == null)
{
variantProperties[pageNum] = PropertyEnum.create("variant", AllTrees.class, getVariantEnumFilter(pageNum));
}
return variantProperties[pageNum];
}
// define the filter function used to reduce the set of enum values to the subset for the given page
protected static Predicate<AllTrees> getVariantEnumFilter(final int pageNum)
{
return new Predicate<AllTrees>()
{
@Override
public boolean apply(AllTrees tree)
{
return (tree.ordinal() >= (variantsPerPage * pageNum)) && (tree.ordinal() < (variantsPerPage * (pageNum+1)));
}
};
}
// child classes must implement to define their page number
abstract public int getPageNum();
// fetch the current instance's variant property
public PropertyEnum getMyVariantProperty()
{
return getVariantProperty(this.getPageNum());
}
public int metaFromVariant(AllTrees tree)
{
return tree.ordinal() % variantsPerPage;
}
public AllTrees variantFromMeta(int meta)
{
int i = Math.max(0, Math.min(meta + (this.getPageNum() * variantsPerPage), AllTrees.values().length)); // clamp to
return AllTrees.values()[i];
}
// 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
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", FourTrees.class );
protected int pageNum;
@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, getMyVariantProperty() });}
// implement IBOPBlock
@ -54,28 +107,26 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override
public int getItemRenderColor(IBlockState state, int tintIndex) { return this.getRenderColor(state); }
@Override
public IProperty[] getPresetProperties() { return new IProperty[] {VARIANT}; }
public IProperty[] getPresetProperties() { return new IProperty[] {getMyVariantProperty()}; }
@Override
public IProperty[] getNonRenderingProperties() { return new IProperty[] {CHECK_DECAY, DECAYABLE}; }
@Override
public String getStateName(IBlockState state)
{
AllTrees treeType = ((FourTrees) state.getValue(VARIANT)).map(this.pageNum);
switch (treeType)
AllTrees tree = ((AllTrees) state.getValue(getMyVariantProperty()));
switch (tree)
{
case RED_BIG_FLOWER: case YELLOW_BIG_FLOWER:
return treeType.getName() + "_petal";
return tree.getName() + "_petal";
default:
return treeType.getName() + "_leaves";
return tree.getName() + "_leaves";
}
}
public BlockBOPLeaves(int pageNum)
public BlockBOPLeaves()
{
super();
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(CHECK_DECAY, Boolean.valueOf(true)).withProperty(DECAYABLE, Boolean.valueOf(true)));
}
@ -86,12 +137,12 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override
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(getMyVariantProperty(), variantFromMeta(meta & 3)).withProperty(DECAYABLE, Boolean.valueOf((meta & 4) == 0)).withProperty(CHECK_DECAY, Boolean.valueOf((meta & 8) > 0));
}
@Override
public int getMetaFromState(IBlockState state)
{
int i = ((FourTrees)state.getValue(VARIANT)).ordinal();
int i = metaFromVariant(((AllTrees) state.getValue(getMyVariantProperty())));
if (!((Boolean)state.getValue(DECAYABLE)).booleanValue())
{
i |= 4;
@ -110,30 +161,33 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
return 20;
}
// TODO: use some kind of mapping to saplings
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
AllTrees treeType = ((FourTrees) state.getValue(VARIANT)).map(this.pageNum);
AllTrees treeType = ((AllTrees) state.getValue(getMyVariantProperty()));
int saplingPage = treeType.ordinal() / 8;
if (saplingPage == 2) {return Item.getItemFromBlock(BOPBlocks.sapling_2);}
if (saplingPage == 1) {return Item.getItemFromBlock(BOPBlocks.sapling_1);}
return Item.getItemFromBlock(BOPBlocks.sapling_0);
}
// TODO: use some kind of mapping to saplings
@Override
public int damageDropped(IBlockState state)
{
AllTrees treeType = ((FourTrees) state.getValue(VARIANT)).map(this.pageNum);
return treeType.ordinal() % 8;
AllTrees tree = ((AllTrees) state.getValue(getMyVariantProperty()));
return tree.ordinal() % 8;
}
// TODO: different fruits for different trees?
// TODO: fruit seems to be falling too often
@Override
protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance)
{
AllTrees treeType = ((FourTrees) state.getValue(VARIANT)).map(this.pageNum);
AllTrees tree = ((AllTrees) state.getValue(getMyVariantProperty()));
ItemStack fruit;
switch (treeType)
switch (tree)
{
case YELLOW_AUTUMN:
case ORANGE_AUTUMN:
@ -172,7 +226,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
public List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
{
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
int meta = this.getMetaFromState(this.getDefaultState().withProperty(VARIANT, world.getBlockState(pos).getValue(VARIANT)));
int meta = this.getMetaFromState(this.getDefaultState().withProperty(getMyVariantProperty(), world.getBlockState(pos).getValue(getMyVariantProperty())));
ret.add(new ItemStack(this, 1, meta));
return ret;
}
@ -180,7 +234,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
{
AllTrees tree = ((FourTrees) world.getBlockState(pos).getValue(VARIANT)).map(this.pageNum);
AllTrees tree = ((AllTrees) world.getBlockState(pos).getValue(getMyVariantProperty()));
switch (tree)
{
case HELLBARK:
@ -193,7 +247,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
@Override
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face)
{
AllTrees tree = ((FourTrees) world.getBlockState(pos).getValue(VARIANT)).map(this.pageNum);
AllTrees tree = ((AllTrees) world.getBlockState(pos).getValue(getMyVariantProperty()));
switch (tree)
{
case HELLBARK:

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLeaves0 extends BlockBOPLeaves {
public static final int PAGENUM = 0;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLeaves.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLeaves1 extends BlockBOPLeaves {
public static final int PAGENUM = 1;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLeaves.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLeaves2 extends BlockBOPLeaves {
public static final int PAGENUM = 2;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLeaves.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLeaves3 extends BlockBOPLeaves {
public static final int PAGENUM = 3;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLeaves.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLeaves4 extends BlockBOPLeaves {
public static final int PAGENUM = 4;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLeaves.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLeaves5 extends BlockBOPLeaves {
public static final int PAGENUM = 5;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLeaves.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -8,8 +8,9 @@
package biomesoplenty.common.block;
import com.google.common.base.Predicate;
import biomesoplenty.api.block.BOPWoodEnums.AllWoods;
import biomesoplenty.api.block.BOPWoodEnums.FourWoods;
import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.common.item.ItemBOPBlock;
import net.minecraft.block.BlockLog;
@ -19,15 +20,63 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemBlock;
public class BlockBOPLog extends BlockLog implements IBOPBlock
public abstract class BlockBOPLog extends BlockLog implements IBOPBlock
{
// 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
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", FourWoods.class );
protected int pageNum;
// store the variant properties for each page in this array
private static PropertyEnum[] variantProperties;
// number of variants per page
public static final int variantsPerPage = 4;
// fetch a particular page's variant property
// the first time this is called, it also sets up the array of variant properties
protected static PropertyEnum getVariantProperty(int pageNum)
{
int len = AllWoods.values().length;
int numPages = (int) Math.ceil( (double)len / variantsPerPage);
if (variantProperties == null)
{
variantProperties = new PropertyEnum[numPages];
}
pageNum = Math.max(0, Math.min(pageNum, numPages - 1));
if (variantProperties[pageNum] == null)
{
variantProperties[pageNum] = PropertyEnum.create("variant", AllWoods.class, getVariantEnumFilter(pageNum));
}
return variantProperties[pageNum];
}
// define the filter function used to reduce the set of enum values to the subset for the given page
protected static Predicate<AllWoods> getVariantEnumFilter(final int pageNum)
{
return new Predicate<AllWoods>()
{
@Override
public boolean apply(AllWoods wood)
{
return (wood.ordinal() >= (variantsPerPage * pageNum)) && (wood.ordinal() < (variantsPerPage * (pageNum+1)));
}
};
}
// child classes must implement to define their page number
abstract public int getPageNum();
// fetch the current instance's variant property
public PropertyEnum getMyVariantProperty()
{
return getVariantProperty(this.getPageNum());
}
public int metaFromVariant(AllWoods wood)
{
return wood.ordinal() % variantsPerPage;
}
public AllWoods variantFromMeta(int meta)
{
int i = Math.max(0, Math.min(meta + (this.getPageNum() * variantsPerPage), AllWoods.values().length)); // clamp to
return AllWoods.values()[i];
}
@Override
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { LOG_AXIS, VARIANT });}
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { LOG_AXIS, getMyVariantProperty() });}
// implement IBOPBlock
@ -36,13 +85,13 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
@Override
public int getItemRenderColor(IBlockState state, int tintIndex) { return this.getRenderColor(state); }
@Override
public IProperty[] getPresetProperties() { return new IProperty[] {VARIANT}; }
public IProperty[] getPresetProperties() { return new IProperty[] {getMyVariantProperty()}; }
@Override
public IProperty[] getNonRenderingProperties() { return null; }
@Override
public String getStateName(IBlockState state)
{
AllWoods wood = ((FourWoods) state.getValue(VARIANT)).map(this.pageNum);
AllWoods wood = (AllWoods) state.getValue(getMyVariantProperty());
switch (wood)
{
case GIANT_FLOWER:
@ -53,11 +102,10 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
}
public BlockBOPLog(int pageNum)
public BlockBOPLog()
{
super();
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));
this.setHarvestLevel("axe", 0);
}
@ -65,12 +113,12 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
@Override
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(getMyVariantProperty(), variantFromMeta(meta & 3));
}
@Override
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 + metaFromVariant((AllWoods) state.getValue(getMyVariantProperty()));
}
// discard the axis information - otherwise logs facing different directions would not stack together

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLog0 extends BlockBOPLog {
public static final int PAGENUM = 0;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLog.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLog1 extends BlockBOPLog {
public static final int PAGENUM = 1;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLog.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLog2 extends BlockBOPLog {
public static final int PAGENUM = 2;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLog.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPLog3 extends BlockBOPLog {
public static final int PAGENUM = 3;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPLog.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -8,6 +8,8 @@
package biomesoplenty.common.block;
import com.google.common.base.Predicate;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@ -17,18 +19,73 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemBlock;
import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.api.block.BOPWoodEnums.AllWoods;
import biomesoplenty.api.block.BOPWoodEnums.SixteenWoods;
import biomesoplenty.common.item.ItemBOPBlock;
public class BlockBOPPlanks extends Block implements IBOPBlock
public abstract class BlockBOPPlanks extends Block implements IBOPBlock
{
// store the variant properties for each page in this array
private static PropertyEnum[] variantProperties;
// number of variants per page - all 4 meta bits are available so we can have 16
public static final int variantsPerPage = 16;
// fetch a particular page's variant property
// the first time this is called, it also sets up the array of variant properties
protected static PropertyEnum getVariantProperty(int pageNum)
{
int len = AllWoods.values().length;
int numPages = (int) Math.ceil( (double)len / variantsPerPage);
if (variantProperties == null)
{
variantProperties = new PropertyEnum[numPages];
}
pageNum = Math.max(0, Math.min(pageNum, numPages - 1));
if (variantProperties[pageNum] == null)
{
variantProperties[pageNum] = PropertyEnum.create("variant", AllWoods.class, getVariantEnumFilter(pageNum));
}
return variantProperties[pageNum];
}
// define the filter function used to reduce the set of enum values to the subset for the given page
protected static Predicate<AllWoods> getVariantEnumFilter(final int pageNum)
{
return new Predicate<AllWoods>()
{
@Override
public boolean apply(AllWoods wood)
{
switch (wood)
{
case GIANT_FLOWER: case DEAD:
return false;
default:
return (wood.ordinal() >= (variantsPerPage * pageNum)) && (wood.ordinal() < (variantsPerPage * (pageNum+1)));
}
}
};
}
// child classes must implement to define their page number
abstract public int getPageNum();
// fetch the current instance's variant property
public PropertyEnum getMyVariantProperty()
{
return getVariantProperty(this.getPageNum());
}
public int metaFromVariant(AllWoods wood)
{
return wood.ordinal() % variantsPerPage;
}
public AllWoods variantFromMeta(int meta)
{
int i = Math.max(0, Math.min(meta + (this.getPageNum() * variantsPerPage), AllWoods.values().length)); // clamp to
return AllWoods.values()[i];
}
// 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
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", SixteenWoods.class );
protected int pageNum;
@Override
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { VARIANT });}
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { getMyVariantProperty() });}
// implement IBOPBlock
@ -37,21 +94,20 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
@Override
public int getItemRenderColor(IBlockState state, int tintIndex) { return this.getRenderColor(state); }
@Override
public IProperty[] getPresetProperties() { return new IProperty[] {VARIANT}; }
public IProperty[] getPresetProperties() { return new IProperty[] {getMyVariantProperty()}; }
@Override
public IProperty[] getNonRenderingProperties() { return null; }
@Override
public String getStateName(IBlockState state)
{
return ((SixteenWoods) state.getValue(VARIANT)).map(this.pageNum).getName() + "_planks";
return ((AllWoods) state.getValue(getMyVariantProperty())).getName() + "_planks";
}
public BlockBOPPlanks(int pageNum)
public BlockBOPPlanks()
{
super(Material.wood);
this.pageNum = pageNum;
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, SixteenWoods.A));
this.setDefaultState(this.blockState.getBaseState());
this.setHarvestLevel("axe", 0);
}
@ -59,12 +115,12 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(VARIANT, SixteenWoods.values()[meta]);
return this.getDefaultState().withProperty(getMyVariantProperty(), variantFromMeta(meta));
}
@Override
public int getMetaFromState(IBlockState state)
{
return ((SixteenWoods) state.getValue(VARIANT)).ordinal();
return metaFromVariant((AllWoods) state.getValue(getMyVariantProperty()));
}
@Override
@ -75,7 +131,7 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
public IBlockState getStateByWood(AllWoods wood)
{
return this.getDefaultState().withProperty(VARIANT, SixteenWoods.mapFrom(wood));
return this.getDefaultState().withProperty(getMyVariantProperty(), wood);
}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPPlanks0 extends BlockBOPPlanks {
public static final int PAGENUM = 0;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPPlanks.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -10,9 +10,10 @@ package biomesoplenty.common.block;
import java.util.Random;
import com.google.common.base.Predicate;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.block.BOPTreeEnums.AllTrees;
import biomesoplenty.api.block.BOPTreeEnums.EightTrees;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.properties.IProperty;
@ -27,33 +28,89 @@ import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;
public class BlockBOPSapling extends BlockDecoration implements IGrowable {
public abstract class BlockBOPSapling extends BlockDecoration implements IGrowable {
// store the variant properties for each page in this array
private static PropertyEnum[] variantProperties;
// STAGE require one bit, so we have 3 bits left for the VARIANT which means we can have eight per instance
public static final int variantsPerPage = 8;
// fetch a particular page's variant property
// the first time this is called, it also sets up the array of variant properties
protected static PropertyEnum getVariantProperty(int pageNum)
{
int len = AllTrees.values().length;
int numPages = (int) Math.ceil( (double)len / variantsPerPage);
if (variantProperties == null)
{
variantProperties = new PropertyEnum[numPages];
}
pageNum = Math.max(0, Math.min(pageNum, numPages - 1));
if (variantProperties[pageNum] == null)
{
variantProperties[pageNum] = PropertyEnum.create("variant", AllTrees.class, getVariantEnumFilter(pageNum));
}
return variantProperties[pageNum];
}
// define the filter function used to reduce the set of enum values to the subset for the given page
protected static Predicate<AllTrees> getVariantEnumFilter(final int pageNum)
{
return new Predicate<AllTrees>()
{
@Override
public boolean apply(AllTrees tree)
{
switch (tree)
{
case RED_BIG_FLOWER: case YELLOW_BIG_FLOWER:
return false;
default:
return (tree.ordinal() >= (variantsPerPage * pageNum)) && (tree.ordinal() < (variantsPerPage * (pageNum+1)));
}
}
};
}
// child classes must implement to define their page number
abstract public int getPageNum();
// fetch the current instance's variant property
public PropertyEnum getMyVariantProperty()
{
return getVariantProperty(this.getPageNum());
}
public int metaFromVariant(AllTrees tree)
{
return tree.ordinal() % variantsPerPage;
}
public AllTrees variantFromMeta(int meta)
{
int i = Math.max(0, Math.min(meta + (this.getPageNum() * variantsPerPage), AllTrees.values().length)); // clamp to
return AllTrees.values()[i];
}
// add properties
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
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", EightTrees.class );
protected int pageNum;
@Override
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { STAGE, VARIANT });}
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { STAGE, getMyVariantProperty() });}
// implement IBOPBlock
@Override
public IProperty[] getPresetProperties() { return new IProperty[] {VARIANT}; }
public IProperty[] getPresetProperties() { return new IProperty[] {getMyVariantProperty()}; }
@Override
public IProperty[] getNonRenderingProperties() { return new IProperty[] {STAGE}; }
@Override
public String getStateName(IBlockState state)
{
return ((EightTrees) state.getValue(VARIANT)).map(this.pageNum).getName() + "_sapling";
return ((AllTrees) state.getValue(getMyVariantProperty())).getName() + "_sapling";
}
public BlockBOPSapling(int pageNum)
public BlockBOPSapling()
{
super();
this.pageNum = pageNum;
this.setStepSound(Block.soundTypeGrass);
this.setBlockBoundsByRadiusAndHeight(0.4F, 0.8F);
this.setDefaultState(this.blockState.getBaseState().withProperty(STAGE, Integer.valueOf(0)));
@ -64,13 +121,13 @@ public class BlockBOPSapling extends BlockDecoration implements IGrowable {
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(VARIANT, EightTrees.values()[meta & 7]).withProperty(STAGE, Integer.valueOf(meta >> 3));
return this.getDefaultState().withProperty(getMyVariantProperty(), variantFromMeta(meta & 7)).withProperty(STAGE, Integer.valueOf(meta >> 3));
}
@Override
public int getMetaFromState(IBlockState state)
{
return ((Integer)state.getValue(STAGE)).intValue() * 8 + ((EightTrees)state.getValue(VARIANT)).ordinal();
}
return ((Integer)state.getValue(STAGE)).intValue() * 8 + metaFromVariant((AllTrees)state.getValue(getMyVariantProperty()));
}
// which types of block allow trees
// TODO: override for loftwood
@ -198,8 +255,8 @@ public class BlockBOPSapling extends BlockDecoration implements IGrowable {
public boolean generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) {return false;}
AllTrees treeType = ((EightTrees) state.getValue(VARIANT)).map(this.pageNum);
AllTrees treeType = ((AllTrees) state.getValue(getMyVariantProperty()));
WorldGenAbstractTree smallTreeGenerator = this.getSmallTreeGenerator(treeType);
WorldGenAbstractTree bigTreeGenerator = this.getBigTreeGenerator(treeType);
WorldGenAbstractTree megaTreeGenerator = this.getMegaTreeGenerator(treeType);

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPSapling0 extends BlockBOPSapling {
public static final int PAGENUM = 0;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPSapling.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPSapling1 extends BlockBOPSapling {
public static final int PAGENUM = 1;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPSapling.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockBOPSapling2 extends BlockBOPSapling {
public static final int PAGENUM = 2;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockBOPSapling.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,116 @@
/*******************************************************************************
* Copyright 2014, the Biomes O' Plenty Team
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
******************************************************************************/
package biomesoplenty.common.block;
import com.google.common.base.Predicate;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.IStringSerializable;
public abstract class BlockCheese extends Block
{
public enum AllCheeses implements IStringSerializable
{
CHEDDAR, EDAM, MOZARELLA, STILTON, PARMESAN, BRIE, LANCS, WENSLEYDALE, GRUYERE, COMTE;
@Override
public String getName()
{
return this.name().toLowerCase();
}
@Override
public String toString()
{
return this.getName();
}
}
// store the variant properties for each page in this array
private static PropertyEnum[] variantProperties;
// number of variants per page
public static final int variantsPerPage = 4;
// fetch a particular page's variant property
// the first time this is called, it also sets up the array of variant properties
protected static PropertyEnum getVariantProperty(int pageNum)
{
int len = AllCheeses.values().length;
int numPages = (int) Math.ceil( (double)len / variantsPerPage);
if (variantProperties == null)
{
variantProperties = new PropertyEnum[numPages];
}
pageNum = Math.max(0, Math.min(pageNum, numPages - 1));
if (variantProperties[pageNum] == null)
{
variantProperties[pageNum] = PropertyEnum.create("variant", AllCheeses.class, getVariantEnumFilter(pageNum));
}
return variantProperties[pageNum];
}
// child classes must implement to define their page number
abstract public int getPageNum();
// fetch the current instance's variant property
public PropertyEnum getMyVariantProperty()
{
return getVariantProperty(this.getPageNum());
}
// define the filter function used to reduce the set of enum values to the subset for the given page
protected static Predicate<AllCheeses> getVariantEnumFilter(final int pageNum)
{
return new Predicate<AllCheeses>()
{
@Override
public boolean apply(AllCheeses cheese)
{
return (cheese.ordinal() >= (variantsPerPage * pageNum)) && (cheese.ordinal() < (variantsPerPage * (pageNum+1)));
}
};
}
public int metaFromVariant(AllCheeses type)
{
return type.ordinal() % variantsPerPage;
}
public AllCheeses variantFromMeta(int meta)
{
int i = Math.max(0, Math.min(meta + (this.getPageNum() * variantsPerPage), AllCheeses.values().length)); // clamp to
return AllCheeses.values()[i];
}
@Override
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { getMyVariantProperty() });
}
public BlockCheese()
{
super(Material.cake);
}
// map from state to meta and vice verca
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(getMyVariantProperty(), variantFromMeta(meta & 3)); // in addition to other properties
}
@Override
public int getMetaFromState(IBlockState state)
{
return metaFromVariant((AllCheeses) state.getValue(getMyVariantProperty())); // plus bits from other properties
}
}

View File

@ -0,0 +1,17 @@
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockCheese0 extends BlockCheese
{
public static final int PAGENUM = 0;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockCheese.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -0,0 +1,17 @@
package biomesoplenty.common.block;
import net.minecraft.block.properties.PropertyEnum;
public class BlockCheese1 extends BlockCheese
{
public static final int PAGENUM = 1;
// create a static reference to this block's variant property
// this is for convenience, and for consistency with other Block classes
public static final PropertyEnum VARIANT = BlockCheese.getVariantProperty(PAGENUM);
@Override
public int getPageNum() {return PAGENUM;}
}

View File

@ -34,20 +34,33 @@ import biomesoplenty.api.item.BOPItems;
import biomesoplenty.common.block.BlockAsh;
import biomesoplenty.common.block.BlockBOPDirt;
import biomesoplenty.common.block.BlockBOPDoor;
import biomesoplenty.common.block.BlockBOPDoubleWoodSlab;
import biomesoplenty.common.block.BlockBOPDoubleWoodSlab0;
import biomesoplenty.common.block.BlockBOPDoubleWoodSlab1;
import biomesoplenty.common.block.BlockBOPFence;
import biomesoplenty.common.block.BlockBOPFenceGate;
import biomesoplenty.common.block.BlockBOPFlower1;
import biomesoplenty.common.block.BlockBOPFlower2;
import biomesoplenty.common.block.BlockBOPGeneric;
import biomesoplenty.common.block.BlockBOPGrass;
import biomesoplenty.common.block.BlockBOPHalfWoodSlab;
import biomesoplenty.common.block.BlockBOPLeaves;
import biomesoplenty.common.block.BlockBOPHalfWoodSlab0;
import biomesoplenty.common.block.BlockBOPHalfWoodSlab1;
import biomesoplenty.common.block.BlockBOPLeaves0;
import biomesoplenty.common.block.BlockBOPLeaves1;
import biomesoplenty.common.block.BlockBOPLeaves2;
import biomesoplenty.common.block.BlockBOPLeaves3;
import biomesoplenty.common.block.BlockBOPLeaves4;
import biomesoplenty.common.block.BlockBOPLeaves5;
import biomesoplenty.common.block.BlockBOPLilypad;
import biomesoplenty.common.block.BlockBOPLog;
import biomesoplenty.common.block.BlockBOPLog0;
import biomesoplenty.common.block.BlockBOPLog1;
import biomesoplenty.common.block.BlockBOPLog2;
import biomesoplenty.common.block.BlockBOPLog3;
import biomesoplenty.common.block.BlockBOPMushroom;
import biomesoplenty.common.block.BlockBOPPlanks;
import biomesoplenty.common.block.BlockBOPSapling;
import biomesoplenty.common.block.BlockBOPPlanks0;
import biomesoplenty.common.block.BlockBOPSapling0;
import biomesoplenty.common.block.BlockBOPSapling1;
import biomesoplenty.common.block.BlockBOPSapling2;
import biomesoplenty.common.block.BlockBOPStairs;
import biomesoplenty.common.block.BlockBOPStone;
import biomesoplenty.common.block.BlockBOPVine;
@ -115,32 +128,32 @@ public class ModBlocks
mud_brick = registerBlock( (new BlockBOPGeneric()).setResistance(2.0F), "mud_brick" );
// 16 wood types, 4 per BlockBOPLog instance, needs 4 'pages'
log_0 = registerBlock( new BlockBOPLog(0), "log_0" );
log_1 = registerBlock( new BlockBOPLog(1), "log_1" );
log_2 = registerBlock( new BlockBOPLog(2), "log_2" );
log_3 = registerBlock( new BlockBOPLog(3), "log_3" );
// 22 tree types, 4 per BlockBOPLeaves instance, needs 6 'pages'
leaves_0 = registerBlock( new BlockBOPLeaves(0), "leaves_0");
leaves_1 = registerBlock( new BlockBOPLeaves(1), "leaves_1" );
leaves_2 = registerBlock( new BlockBOPLeaves(2), "leaves_2" );
leaves_3 = registerBlock( new BlockBOPLeaves(3), "leaves_3" );
leaves_4 = registerBlock( new BlockBOPLeaves(4), "leaves_4" );
leaves_5 = registerBlock( new BlockBOPLeaves(5), "leaves_5" );
// 22 tree types, 8 per BlockBOPSapling instance, needs 3 'pages'
sapling_0 = registerBlock( new BlockBOPSapling(0), "sapling_0");
sapling_1 = registerBlock( new BlockBOPSapling(1), "sapling_1");
sapling_2 = registerBlock( new BlockBOPSapling(2), "sapling_2");
log_0 = registerBlock( new BlockBOPLog0(), "log_0" );
log_1 = registerBlock( new BlockBOPLog1(), "log_1" );
log_2 = registerBlock( new BlockBOPLog2(), "log_2" );
log_3 = registerBlock( new BlockBOPLog3(), "log_3" );
// TODO: check if hellbark planks, fence etc can burn
// 16 wood types, 8 per BlockBOPHalfWoodSlab and BlockBOPDoubleWoodSlab intance, needs 2 'pages'
registerWoodSlab( half_wood_slab_0, double_wood_slab_0, BOPItems.wood_slab_0, 0);
registerWoodSlab( half_wood_slab_1, double_wood_slab_1, BOPItems.wood_slab_1, 1);
registerWoodSlab( wood_slab_0, double_wood_slab_0, BOPItems.wood_slab_0, 0);
registerWoodSlab( wood_slab_1, double_wood_slab_1, BOPItems.wood_slab_1, 1);
// 16 wood types, 16 per BlockBOPPlanks instance, needs 1 'pages'
planks_0 = registerBlock( new BlockBOPPlanks(0), "planks_0");
planks_0 = registerBlock( new BlockBOPPlanks0(), "planks_0");
// 22 tree types, 4 per BlockBOPLeaves instance, needs 6 'pages'
leaves_0 = registerBlock( new BlockBOPLeaves0(), "leaves_0");
leaves_1 = registerBlock( new BlockBOPLeaves1(), "leaves_1" );
leaves_2 = registerBlock( new BlockBOPLeaves2(), "leaves_2" );
leaves_3 = registerBlock( new BlockBOPLeaves3(), "leaves_3" );
leaves_4 = registerBlock( new BlockBOPLeaves4(), "leaves_4" );
leaves_5 = registerBlock( new BlockBOPLeaves5(), "leaves_5" );
// 22 tree types, 8 per BlockBOPSapling instance, needs 3 'pages'
sapling_0 = registerBlock( new BlockBOPSapling0(), "sapling_0");
sapling_1 = registerBlock( new BlockBOPSapling1(), "sapling_1");
sapling_2 = registerBlock( new BlockBOPSapling2(), "sapling_2");
// 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" );
@ -226,8 +239,19 @@ public class ModBlocks
// use a separate function for registering slabs because the half slab, double slab, and item really need to be registered together
public static void registerWoodSlab(Block half_slab, Block double_slab, Item slab_item, int pageNum)
{
half_slab = registerBlock( new BlockBOPHalfWoodSlab(pageNum), "half_wood_slab_" + pageNum );
double_slab = registerBlock( new BlockBOPDoubleWoodSlab(pageNum), "double_wood_slab_" + pageNum, null ); // no creative tab for double slab
switch (pageNum)
{
case 0:
half_slab = registerBlock( new BlockBOPHalfWoodSlab0(), "wood_slab_0");
double_slab = registerBlock( new BlockBOPDoubleWoodSlab0(), "double_wood_slab_0", null ); // no creative tab for double slab
break;
case 1:
half_slab = registerBlock( new BlockBOPHalfWoodSlab1(), "wood_slab_1");
double_slab = registerBlock( new BlockBOPDoubleWoodSlab1(), "double_wood_slab_1", null ); // no creative tab for double slab
break;
default:
throw new IllegalArgumentException("No switch case yet for slab page " + pageNum);
}
slab_item = ModItems.registerItem( new ItemSlab(half_slab, (BlockSlab)half_slab, (BlockSlab)double_slab), "wood_slab_" + pageNum );
GameData.getBlockItemMap().put(half_slab, slab_item);
GameData.getBlockItemMap().put(double_slab, slab_item);

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "biomesoplenty:ash_block" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "biomesoplenty:ash_block" }
}
}

View File

@ -1,12 +1,12 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:sacred_oak_planks" },
"variant=b": { "model": "biomesoplenty:cherry_planks" },
"variant=c": { "model": "biomesoplenty:dark_planks" },
"variant=d": { "model": "biomesoplenty:fir_planks" },
"variant=e": { "model": "biomesoplenty:ethereal_planks" },
"variant=f": { "model": "biomesoplenty:magic_planks" },
"variant=g": { "model": "biomesoplenty:mangrove_planks" },
"variant=h": { "model": "biomesoplenty:palm_planks" }
"variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_planks" },
"variant=cherry": { "model": "biomesoplenty:cherry_planks" },
"variant=dark": { "model": "biomesoplenty:dark_planks" },
"variant=fir": { "model": "biomesoplenty:fir_planks" },
"variant=ethereal": { "model": "biomesoplenty:ethereal_planks" },
"variant=magic": { "model": "biomesoplenty:magic_planks" },
"variant=mangrove": { "model": "biomesoplenty:mangrove_planks" },
"variant=palm": { "model": "biomesoplenty:palm_planks" }
}
}
}

View File

@ -1,12 +1,10 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:redwood_planks" },
"variant=b": { "model": "biomesoplenty:willow_planks" },
"variant=c": { "model": "biomesoplenty:pine_planks" },
"variant=d": { "model": "biomesoplenty:hell_bark_planks" },
"variant=e": { "model": "biomesoplenty:jacaranda_planks" },
"variant=f": { "model": "biomesoplenty:mahogany_planks" },
"variant=g": { "model": "biomesoplenty:giant_flower_planks" },
"variant=h": { "model": "biomesoplenty:dead_planks" }
"variant=redwood": { "model": "biomesoplenty:redwood_planks" },
"variant=willow": { "model": "biomesoplenty:willow_planks" },
"variant=pine": { "model": "biomesoplenty:pine_planks" },
"variant=hell_bark": { "model": "biomesoplenty:hell_bark_planks" },
"variant=jacaranda": { "model": "biomesoplenty:jacaranda_planks" },
"variant=mahogany": { "model": "biomesoplenty:mahogany_planks" }
}
}
}

View File

@ -1,8 +1,8 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:yellow_autumn_leaves" },
"variant=b": { "model": "biomesoplenty:orange_autumn_leaves" },
"variant=c": { "model": "biomesoplenty:bamboo_leaves" },
"variant=d": { "model": "biomesoplenty:magic_leaves" }
"variant=yellow_autumn": { "model": "biomesoplenty:yellow_autumn_leaves" },
"variant=orange_autumn": { "model": "biomesoplenty:orange_autumn_leaves" },
"variant=bamboo": { "model": "biomesoplenty:bamboo_leaves" },
"variant=magic": { "model": "biomesoplenty:magic_leaves" }
}
}

View File

@ -1,8 +1,8 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:dark_leaves" },
"variant=b": { "model": "biomesoplenty:dead_leaves" },
"variant=c": { "model": "biomesoplenty:fir_leaves" },
"variant=d": { "model": "biomesoplenty:ethereal_leaves" }
"variant=dark": { "model": "biomesoplenty:dark_leaves" },
"variant=dead": { "model": "biomesoplenty:dead_leaves" },
"variant=fir": { "model": "biomesoplenty:fir_leaves" },
"variant=ethereal": { "model": "biomesoplenty:ethereal_leaves" }
}
}

View File

@ -1,8 +1,8 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:origin_leaves" },
"variant=b": { "model": "biomesoplenty:pink_cherry_leaves" },
"variant=c": { "model": "biomesoplenty:white_cherry_leaves" },
"variant=d": { "model": "biomesoplenty:maple_leaves" }
"variant=origin": { "model": "biomesoplenty:origin_leaves" },
"variant=pink_cherry": { "model": "biomesoplenty:pink_cherry_leaves" },
"variant=white_cherry": { "model": "biomesoplenty:white_cherry_leaves" },
"variant=maple": { "model": "biomesoplenty:maple_leaves" }
}
}

View File

@ -1,8 +1,8 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:hellbark_leaves" },
"variant=b": { "model": "biomesoplenty:flowering_leaves" },
"variant=c": { "model": "biomesoplenty:jacaranda_leaves" },
"variant=d": { "model": "biomesoplenty:sacred_oak_leaves" }
"variant=hellbark": { "model": "biomesoplenty:hellbark_leaves" },
"variant=flowering": { "model": "biomesoplenty:flowering_leaves" },
"variant=jacaranda": { "model": "biomesoplenty:jacaranda_leaves" },
"variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_leaves" }
}
}

View File

@ -1,8 +1,8 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:mangrove_leaves" },
"variant=b": { "model": "biomesoplenty:palm_leaves" },
"variant=c": { "model": "biomesoplenty:redwood_leaves" },
"variant=d": { "model": "biomesoplenty:willow_leaves" }
"variant=mangrove": { "model": "biomesoplenty:mangrove_leaves" },
"variant=palm": { "model": "biomesoplenty:palm_leaves" },
"variant=redwood": { "model": "biomesoplenty:redwood_leaves" },
"variant=willow": { "model": "biomesoplenty:willow_leaves" }
}
}

View File

@ -1,8 +1,8 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:pine_leaves" },
"variant=b": { "model": "biomesoplenty:mahogany_leaves" },
"variant=c": { "model": "biomesoplenty:red_big_flower_petal" },
"variant=d": { "model": "biomesoplenty:yellow_big_flower_petal" }
"variant=pine": { "model": "biomesoplenty:pine_leaves" },
"variant=mahogany": { "model": "biomesoplenty:mahogany_leaves" },
"variant=red_big_flower": { "model": "biomesoplenty:red_big_flower_petal" },
"variant=yellow_big_flower": { "model": "biomesoplenty:yellow_big_flower_petal" }
}
}

View File

@ -1,21 +1,21 @@
{
"variants": {
"axis=y,variant=a": { "model": "biomesoplenty:sacred_oak_log" },
"axis=z,variant=a": { "model": "biomesoplenty:sacred_oak_log_side" },
"axis=x,variant=a": { "model": "biomesoplenty:sacred_oak_log_side", "y": 90 },
"axis=none,variant=a": { "model": "biomesoplenty:sacred_oak_bark" },
"axis=y,variant=b": { "model": "biomesoplenty:cherry_log" },
"axis=z,variant=b": { "model": "biomesoplenty:cherry_log_side" },
"axis=x,variant=b": { "model": "biomesoplenty:cherry_log_side", "y": 90 },
"axis=none,variant=b": { "model": "biomesoplenty:cherry_bark" },
"axis=y,variant=c": { "model": "biomesoplenty:dark_log" },
"axis=z,variant=c": { "model": "biomesoplenty:dark_log_side" },
"axis=x,variant=c": { "model": "biomesoplenty:dark_log_side", "y": 90 },
"axis=none,variant=c": { "model": "biomesoplenty:dark_bark" },
"axis=y,variant=d": { "model": "biomesoplenty:fir_log" },
"axis=z,variant=d": { "model": "biomesoplenty:fir_log_side" },
"axis=x,variant=d": { "model": "biomesoplenty:fir_log_side", "y": 90 },
"axis=none,variant=d": { "model": "biomesoplenty:fir_bark" }
"axis=y,variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_log" },
"axis=z,variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_log_side" },
"axis=x,variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_log_side", "y": 90 },
"axis=none,variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_bark" },
"axis=y,variant=cherry": { "model": "biomesoplenty:cherry_log" },
"axis=z,variant=cherry": { "model": "biomesoplenty:cherry_log_side" },
"axis=x,variant=cherry": { "model": "biomesoplenty:cherry_log_side", "y": 90 },
"axis=none,variant=cherry": { "model": "biomesoplenty:cherry_bark" },
"axis=y,variant=dark": { "model": "biomesoplenty:dark_log" },
"axis=z,variant=dark": { "model": "biomesoplenty:dark_log_side" },
"axis=x,variant=dark": { "model": "biomesoplenty:dark_log_side", "y": 90 },
"axis=none,variant=dark": { "model": "biomesoplenty:dark_bark" },
"axis=y,variant=fir": { "model": "biomesoplenty:fir_log" },
"axis=z,variant=fir": { "model": "biomesoplenty:fir_log_side" },
"axis=x,variant=fir": { "model": "biomesoplenty:fir_log_side", "y": 90 },
"axis=none,variant=fir": { "model": "biomesoplenty:fir_bark" }
}
}

View File

@ -1,21 +1,21 @@
{
"variants": {
"axis=y,variant=a": { "model": "biomesoplenty:ethereal_log" },
"axis=z,variant=a": { "model": "biomesoplenty:ethereal_log_side" },
"axis=x,variant=a": { "model": "biomesoplenty:ethereal_log_side", "y": 90 },
"axis=none,variant=a": { "model": "biomesoplenty:ethereal_bark" },
"axis=y,variant=b": { "model": "biomesoplenty:magic_log" },
"axis=z,variant=b": { "model": "biomesoplenty:magic_log_side" },
"axis=x,variant=b": { "model": "biomesoplenty:magic_log_side", "y": 90 },
"axis=none,variant=b": { "model": "biomesoplenty:magic_bark" },
"axis=y,variant=c": { "model": "biomesoplenty:mangrove_log" },
"axis=z,variant=c": { "model": "biomesoplenty:mangrove_log_side" },
"axis=x,variant=c": { "model": "biomesoplenty:mangrove_log_side", "y": 90 },
"axis=none,variant=c": { "model": "biomesoplenty:mangrove_bark" },
"axis=y,variant=d": { "model": "biomesoplenty:palm_log" },
"axis=z,variant=d": { "model": "biomesoplenty:palm_log_side" },
"axis=x,variant=d": { "model": "biomesoplenty:palm_log_side", "y": 90 },
"axis=none,variant=d": { "model": "biomesoplenty:palm_bark" }
"axis=y,variant=ethereal": { "model": "biomesoplenty:ethereal_log" },
"axis=z,variant=ethereal": { "model": "biomesoplenty:ethereal_log_side" },
"axis=x,variant=ethereal": { "model": "biomesoplenty:ethereal_log_side", "y": 90 },
"axis=none,variant=ethereal": { "model": "biomesoplenty:ethereal_bark" },
"axis=y,variant=magic": { "model": "biomesoplenty:magic_log" },
"axis=z,variant=magic": { "model": "biomesoplenty:magic_log_side" },
"axis=x,variant=magic": { "model": "biomesoplenty:magic_log_side", "y": 90 },
"axis=none,variant=magic": { "model": "biomesoplenty:magic_bark" },
"axis=y,variant=mangrove": { "model": "biomesoplenty:mangrove_log" },
"axis=z,variant=mangrove": { "model": "biomesoplenty:mangrove_log_side" },
"axis=x,variant=mangrove": { "model": "biomesoplenty:mangrove_log_side", "y": 90 },
"axis=none,variant=mangrove": { "model": "biomesoplenty:mangrove_bark" },
"axis=y,variant=palm": { "model": "biomesoplenty:palm_log" },
"axis=z,variant=palm": { "model": "biomesoplenty:palm_log_side" },
"axis=x,variant=palm": { "model": "biomesoplenty:palm_log_side", "y": 90 },
"axis=none,variant=palm": { "model": "biomesoplenty:palm_bark" }
}
}

View File

@ -1,21 +1,21 @@
{
"variants": {
"axis=y,variant=a": { "model": "biomesoplenty:redwood_log" },
"axis=z,variant=a": { "model": "biomesoplenty:redwood_log_side" },
"axis=x,variant=a": { "model": "biomesoplenty:redwood_log_side", "y": 90 },
"axis=none,variant=a": { "model": "biomesoplenty:redwood_bark" },
"axis=y,variant=b": { "model": "biomesoplenty:willow_log" },
"axis=z,variant=b": { "model": "biomesoplenty:willow_log_side" },
"axis=x,variant=b": { "model": "biomesoplenty:willow_log_side", "y": 90 },
"axis=none,variant=b": { "model": "biomesoplenty:willow_bark" },
"axis=y,variant=c": { "model": "biomesoplenty:pine_log" },
"axis=z,variant=c": { "model": "biomesoplenty:pine_log_side" },
"axis=x,variant=c": { "model": "biomesoplenty:pine_log_side", "y": 90 },
"axis=none,variant=c": { "model": "biomesoplenty:pine_bark" },
"axis=y,variant=d": { "model": "biomesoplenty:hell_bark_log" },
"axis=z,variant=d": { "model": "biomesoplenty:hell_bark_log_side" },
"axis=x,variant=d": { "model": "biomesoplenty:hell_bark_log_side", "y": 90 },
"axis=none,variant=d": { "model": "biomesoplenty:hell_bark_bark" }
"axis=y,variant=redwood": { "model": "biomesoplenty:redwood_log" },
"axis=z,variant=redwood": { "model": "biomesoplenty:redwood_log_side" },
"axis=x,variant=redwood": { "model": "biomesoplenty:redwood_log_side", "y": 90 },
"axis=none,variant=redwood": { "model": "biomesoplenty:redwood_bark" },
"axis=y,variant=willow": { "model": "biomesoplenty:willow_log" },
"axis=z,variant=willow": { "model": "biomesoplenty:willow_log_side" },
"axis=x,variant=willow": { "model": "biomesoplenty:willow_log_side", "y": 90 },
"axis=none,variant=willow": { "model": "biomesoplenty:willow_bark" },
"axis=y,variant=pine": { "model": "biomesoplenty:pine_log" },
"axis=z,variant=pine": { "model": "biomesoplenty:pine_log_side" },
"axis=x,variant=pine": { "model": "biomesoplenty:pine_log_side", "y": 90 },
"axis=none,variant=pine": { "model": "biomesoplenty:pine_bark" },
"axis=y,variant=hell_bark": { "model": "biomesoplenty:hell_bark_log" },
"axis=z,variant=hell_bark": { "model": "biomesoplenty:hell_bark_log_side" },
"axis=x,variant=hell_bark": { "model": "biomesoplenty:hell_bark_log_side", "y": 90 },
"axis=none,variant=hell_bark": { "model": "biomesoplenty:hell_bark_bark" }
}
}

View File

@ -1,21 +1,21 @@
{
"variants": {
"axis=y,variant=a": { "model": "biomesoplenty:jacaranda_log" },
"axis=z,variant=a": { "model": "biomesoplenty:jacaranda_log_side" },
"axis=x,variant=a": { "model": "biomesoplenty:jacaranda_log_side", "y": 90 },
"axis=none,variant=a": { "model": "biomesoplenty:jacaranda_bark" },
"axis=y,variant=b": { "model": "biomesoplenty:mahogany_log" },
"axis=z,variant=b": { "model": "biomesoplenty:mahogany_log_side" },
"axis=x,variant=b": { "model": "biomesoplenty:mahogany_log_side", "y": 90 },
"axis=none,variant=b": { "model": "biomesoplenty:mahogany_bark" },
"axis=y,variant=c": { "model": "biomesoplenty:giant_flower_stem" },
"axis=z,variant=c": { "model": "biomesoplenty:giant_flower_stem_side" },
"axis=x,variant=c": { "model": "biomesoplenty:giant_flower_stem_side", "y": 90 },
"axis=none,variant=c": { "model": "biomesoplenty:giant_flower_bark" },
"axis=y,variant=d": { "model": "biomesoplenty:dead_log" },
"axis=z,variant=d": { "model": "biomesoplenty:dead_log_side" },
"axis=x,variant=d": { "model": "biomesoplenty:dead_log_side", "y": 90 },
"axis=none,variant=d": { "model": "biomesoplenty:dead_bark" }
"axis=y,variant=jacaranda": { "model": "biomesoplenty:jacaranda_log" },
"axis=z,variant=jacaranda": { "model": "biomesoplenty:jacaranda_log_side" },
"axis=x,variant=jacaranda": { "model": "biomesoplenty:jacaranda_log_side", "y": 90 },
"axis=none,variant=jacaranda": { "model": "biomesoplenty:jacaranda_bark" },
"axis=y,variant=mahogany": { "model": "biomesoplenty:mahogany_log" },
"axis=z,variant=mahogany": { "model": "biomesoplenty:mahogany_log_side" },
"axis=x,variant=mahogany": { "model": "biomesoplenty:mahogany_log_side", "y": 90 },
"axis=none,variant=mahogany": { "model": "biomesoplenty:mahogany_bark" },
"axis=y,variant=giant_flower": { "model": "biomesoplenty:giant_flower_stem" },
"axis=z,variant=giant_flower": { "model": "biomesoplenty:giant_flower_stem_side" },
"axis=x,variant=giant_flower": { "model": "biomesoplenty:giant_flower_stem_side", "y": 90 },
"axis=none,variant=giant_flower": { "model": "biomesoplenty:giant_flower_bark" },
"axis=y,variant=dead": { "model": "biomesoplenty:dead_log" },
"axis=z,variant=dead": { "model": "biomesoplenty:dead_log_side" },
"axis=x,variant=dead": { "model": "biomesoplenty:dead_log_side", "y": 90 },
"axis=none,variant=dead": { "model": "biomesoplenty:dead_bark" }
}
}

View File

@ -1,20 +1,18 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:sacred_oak_planks" },
"variant=b": { "model": "biomesoplenty:cherry_planks" },
"variant=c": { "model": "biomesoplenty:dark_planks" },
"variant=d": { "model": "biomesoplenty:fir_planks" },
"variant=e": { "model": "biomesoplenty:ethereal_planks" },
"variant=f": { "model": "biomesoplenty:magic_planks" },
"variant=g": { "model": "biomesoplenty:mangrove_planks" },
"variant=h": { "model": "biomesoplenty:palm_planks" },
"variant=i": { "model": "biomesoplenty:redwood_planks" },
"variant=j": { "model": "biomesoplenty:willow_planks" },
"variant=k": { "model": "biomesoplenty:pine_planks" },
"variant=l": { "model": "biomesoplenty:hell_bark_planks" },
"variant=m": { "model": "biomesoplenty:jacaranda_planks" },
"variant=n": { "model": "biomesoplenty:mahogany_planks" },
"variant=o": { "model": "biomesoplenty:giant_flower_planks" },
"variant=p": { "model": "biomesoplenty:dead_planks" }
"variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_planks" },
"variant=cherry": { "model": "biomesoplenty:cherry_planks" },
"variant=dark": { "model": "biomesoplenty:dark_planks" },
"variant=fir": { "model": "biomesoplenty:fir_planks" },
"variant=ethereal": { "model": "biomesoplenty:ethereal_planks" },
"variant=magic": { "model": "biomesoplenty:magic_planks" },
"variant=mangrove": { "model": "biomesoplenty:mangrove_planks" },
"variant=palm": { "model": "biomesoplenty:palm_planks" },
"variant=redwood": { "model": "biomesoplenty:redwood_planks" },
"variant=willow": { "model": "biomesoplenty:willow_planks" },
"variant=pine": { "model": "biomesoplenty:pine_planks" },
"variant=hell_bark": { "model": "biomesoplenty:hell_bark_planks" },
"variant=jacaranda": { "model": "biomesoplenty:jacaranda_planks" },
"variant=mahogany": { "model": "biomesoplenty:mahogany_planks" }
}
}
}

View File

@ -1,12 +1,12 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:yellow_autumn_sapling" },
"variant=b": { "model": "biomesoplenty:orange_autumn_sapling" },
"variant=c": { "model": "biomesoplenty:bamboo_sapling" },
"variant=d": { "model": "biomesoplenty:magic_sapling" },
"variant=e": { "model": "biomesoplenty:dark_sapling" },
"variant=f": { "model": "biomesoplenty:dead_sapling" },
"variant=g": { "model": "biomesoplenty:fir_sapling" },
"variant=h": { "model": "biomesoplenty:ethereal_sapling" }
"variant=yellow_autumn": { "model": "biomesoplenty:yellow_autumn_sapling" },
"variant=orange_autumn": { "model": "biomesoplenty:orange_autumn_sapling" },
"variant=bamboo": { "model": "biomesoplenty:bamboo_sapling" },
"variant=magic": { "model": "biomesoplenty:magic_sapling" },
"variant=dark": { "model": "biomesoplenty:dark_sapling" },
"variant=dead": { "model": "biomesoplenty:dead_sapling" },
"variant=fir": { "model": "biomesoplenty:fir_sapling" },
"variant=ethereal": { "model": "biomesoplenty:ethereal_sapling" }
}
}
}

View File

@ -1,12 +1,12 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:origin_sapling" },
"variant=b": { "model": "biomesoplenty:pink_cherry_sapling" },
"variant=c": { "model": "biomesoplenty:white_cherry_sapling" },
"variant=d": { "model": "biomesoplenty:maple_sapling" },
"variant=e": { "model": "biomesoplenty:hellbark_sapling" },
"variant=f": { "model": "biomesoplenty:flowering_sapling" },
"variant=g": { "model": "biomesoplenty:jacaranda_sapling" },
"variant=h": { "model": "biomesoplenty:sacred_oak_sapling" }
"variant=origin": { "model": "biomesoplenty:origin_sapling" },
"variant=pink_cherry": { "model": "biomesoplenty:pink_cherry_sapling" },
"variant=white_cherry": { "model": "biomesoplenty:white_cherry_sapling" },
"variant=maple": { "model": "biomesoplenty:maple_sapling" },
"variant=hellbark": { "model": "biomesoplenty:hellbark_sapling" },
"variant=flowering": { "model": "biomesoplenty:flowering_sapling" },
"variant=jacaranda": { "model": "biomesoplenty:jacaranda_sapling" },
"variant=sacred_oak": { "model": "biomesoplenty:sacred_oak_sapling" }
}
}
}

View File

@ -1,12 +1,10 @@
{
"variants": {
"variant=a": { "model": "biomesoplenty:mangrove_sapling" },
"variant=b": { "model": "biomesoplenty:palm_sapling" },
"variant=c": { "model": "biomesoplenty:redwood_sapling" },
"variant=d": { "model": "biomesoplenty:willow_sapling" },
"variant=e": { "model": "biomesoplenty:pine_sapling" },
"variant=f": { "model": "biomesoplenty:mahogany_sapling" },
"variant=g": { "model": "biomesoplenty:red_big_flower_sapling" },
"variant=h": { "model": "biomesoplenty:yellow_big_flower_sapling" }
"variant=mangrove": { "model": "biomesoplenty:mangrove_sapling" },
"variant=palm": { "model": "biomesoplenty:palm_sapling" },
"variant=redwood": { "model": "biomesoplenty:redwood_sapling" },
"variant=willow": { "model": "biomesoplenty:willow_sapling" },
"variant=pine": { "model": "biomesoplenty:pine_sapling" },
"variant=mahogany": { "model": "biomesoplenty:mahogany_sapling" }
}
}
}

View File

@ -0,0 +1,20 @@
{
"variants": {
"half=bottom,variant=sacred_oak": { "model": "biomesoplenty:half_slab_sacred_oak" },
"half=top,variant=sacred_oak": { "model": "biomesoplenty:upper_slab_sacred_oak" },
"half=bottom,variant=cherry": { "model": "biomesoplenty:half_slab_cherry" },
"half=top,variant=cherry": { "model": "biomesoplenty:upper_slab_cherry" },
"half=bottom,variant=dark": { "model": "biomesoplenty:half_slab_dark" },
"half=top,variant=dark": { "model": "biomesoplenty:upper_slab_dark" },
"half=bottom,variant=fir": { "model": "biomesoplenty:half_slab_fir" },
"half=top,variant=fir": { "model": "biomesoplenty:upper_slab_fir" },
"half=bottom,variant=ethereal": { "model": "biomesoplenty:half_slab_ethereal" },
"half=top,variant=ethereal": { "model": "biomesoplenty:upper_slab_ethereal" },
"half=bottom,variant=magic": { "model": "biomesoplenty:half_slab_magic" },
"half=top,variant=magic": { "model": "biomesoplenty:upper_slab_magic" },
"half=bottom,variant=mangrove": { "model": "biomesoplenty:half_slab_mangrove" },
"half=top,variant=mangrove": { "model": "biomesoplenty:upper_slab_mangrove" },
"half=bottom,variant=palm": { "model": "biomesoplenty:half_slab_palm" },
"half=top,variant=palm": { "model": "biomesoplenty:upper_slab_palm" }
}
}

View File

@ -0,0 +1,16 @@
{
"variants": {
"half=bottom,variant=redwood": { "model": "biomesoplenty:half_slab_redwood" },
"half=top,variant=redwood": { "model": "biomesoplenty:upper_slab_redwood" },
"half=bottom,variant=willow": { "model": "biomesoplenty:half_slab_willow" },
"half=top,variant=willow": { "model": "biomesoplenty:upper_slab_willow" },
"half=bottom,variant=pine": { "model": "biomesoplenty:half_slab_pine" },
"half=top,variant=pine": { "model": "biomesoplenty:upper_slab_pine" },
"half=bottom,variant=hell_bark": { "model": "biomesoplenty:half_slab_hell_bark" },
"half=top,variant=hell_bark": { "model": "biomesoplenty:upper_slab_hell_bark" },
"half=bottom,variant=jacaranda": { "model": "biomesoplenty:half_slab_jacaranda" },
"half=top,variant=jacaranda": { "model": "biomesoplenty:upper_slab_jacaranda" },
"half=bottom,variant=mahogany": { "model": "biomesoplenty:half_slab_mahogany" },
"half=top,variant=mahogany": { "model": "biomesoplenty:upper_slab_mahogany" }
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "block/cube_all",
"textures": {
"all": "biomesoplenty:blocks/dead_planks"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "block/cube_all",
"textures": {
"all": "biomesoplenty:blocks/giant_flower_planks"
}
}

View File

@ -1,8 +0,0 @@
{
"parent": "block/half_slab",
"textures": {
"bottom": "biomesoplenty:blocks/dead_planks",
"top": "biomesoplenty:blocks/dead_planks",
"side": "biomesoplenty:blocks/dead_planks"
}
}

View File

@ -1,8 +0,0 @@
{
"parent": "block/half_slab",
"textures": {
"bottom": "biomesoplenty:blocks/giant_flower_planks",
"top": "biomesoplenty:blocks/giant_flower_planks",
"side": "biomesoplenty:blocks/giant_flower_planks"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "block/cross",
"textures": {
"cross": "biomesoplenty:blocks/sapling_red_big_flower"
}
}

View File

@ -1,8 +0,0 @@
{
"parent": "block/upper_slab",
"textures": {
"bottom": "biomesoplenty:blocks/dead_planks",
"top": "biomesoplenty:blocks/dead_planks",
"side": "biomesoplenty:blocks/dead_planks"
}
}

View File

@ -1,8 +0,0 @@
{
"parent": "block/upper_slab",
"textures": {
"bottom": "biomesoplenty:blocks/giant_flower_planks",
"top": "biomesoplenty:blocks/giant_flower_planks",
"side": "biomesoplenty:blocks/giant_flower_planks"
}
}

View File

@ -1,6 +0,0 @@
{
"parent": "block/cross",
"textures": {
"cross": "biomesoplenty:blocks/sapling_yellow_big_flower"
}
}