Allow wool to be crafted from any combination of regular and tall cattail
This commit is contained in:
parent
4317a78f9e
commit
7019c0a68c
3 changed files with 21 additions and 22 deletions
|
@ -19,7 +19,7 @@ import biomesoplenty.api.biome.BOPBiome;
|
||||||
import biomesoplenty.api.biome.generation.GeneratorStage;
|
import biomesoplenty.api.biome.generation.GeneratorStage;
|
||||||
import biomesoplenty.api.biome.generation.GeneratorWeighted;
|
import biomesoplenty.api.biome.generation.GeneratorWeighted;
|
||||||
import biomesoplenty.api.block.BOPBlocks;
|
import biomesoplenty.api.block.BOPBlocks;
|
||||||
import biomesoplenty.common.block.BlockBOPDoublePlant.FoliageType;
|
import biomesoplenty.common.block.BlockBOPDoublePlant;
|
||||||
import biomesoplenty.common.block.BlockBOPPlant;
|
import biomesoplenty.common.block.BlockBOPPlant;
|
||||||
import biomesoplenty.common.block.BlockDoubleDecoration.Half;
|
import biomesoplenty.common.block.BlockDoubleDecoration.Half;
|
||||||
import biomesoplenty.common.block.BlockGem;
|
import biomesoplenty.common.block.BlockGem;
|
||||||
|
@ -49,7 +49,7 @@ public class BiomeGenShrubland extends BOPBiome
|
||||||
this.addGenerator("gravel", GeneratorStage.SAND_PASS2, new GeneratorWaterside(4, 7, Blocks.gravel.getDefaultState()));
|
this.addGenerator("gravel", GeneratorStage.SAND_PASS2, new GeneratorWaterside(4, 7, Blocks.gravel.getDefaultState()));
|
||||||
this.addGenerator("bushes", GeneratorStage.FLOWERS, new GeneratorFlora(7, BlockBOPPlant.paging.getVariantState(BOPPlants.BUSH)));
|
this.addGenerator("bushes", GeneratorStage.FLOWERS, new GeneratorFlora(7, BlockBOPPlant.paging.getVariantState(BOPPlants.BUSH)));
|
||||||
this.addGenerator("shrubs", GeneratorStage.FLOWERS, new GeneratorFlora(5, BlockBOPPlant.paging.getVariantState(BOPPlants.SHRUB)));
|
this.addGenerator("shrubs", GeneratorStage.FLOWERS, new GeneratorFlora(5, BlockBOPPlant.paging.getVariantState(BOPPlants.SHRUB)));
|
||||||
this.addGenerator("flax", GeneratorStage.FLOWERS, new GeneratorDoubleFlora(1, BOPBlocks.double_plant.getDefaultState().withProperty(VARIANT, FoliageType.FLAX).withProperty(HALF, Half.LOWER), BOPBlocks.double_plant.getDefaultState().withProperty(VARIANT, FoliageType.FLAX).withProperty(HALF, Half.UPPER), 24));
|
this.addGenerator("flax", GeneratorStage.FLOWERS, new GeneratorDoubleFlora(1, BOPBlocks.double_plant.getDefaultState().withProperty(VARIANT, BlockBOPDoublePlant.DoublePlantType.FLAX).withProperty(HALF, Half.LOWER), BOPBlocks.double_plant.getDefaultState().withProperty(VARIANT, BlockBOPDoublePlant.DoublePlantType.FLAX).withProperty(HALF, Half.UPPER), 24));
|
||||||
this.addGenerator("water_reeds", GeneratorStage.LILYPAD, new GeneratorFlora(3, BlockBOPPlant.paging.getVariantState(BOPPlants.REED), 128));
|
this.addGenerator("water_reeds", GeneratorStage.LILYPAD, new GeneratorFlora(3, BlockBOPPlant.paging.getVariantState(BOPPlants.REED), 128));
|
||||||
|
|
||||||
this.addGenerator("trees", GeneratorStage.TREE, new GeneratorBush(1, Blocks.log.getDefaultState(), Blocks.leaves.getDefaultState()));
|
this.addGenerator("trees", GeneratorStage.TREE, new GeneratorBush(1, Blocks.log.getDefaultState(), Blocks.leaves.getDefaultState()));
|
||||||
|
|
|
@ -35,8 +35,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
{
|
{
|
||||||
|
|
||||||
// add properties (note we inherit HALF from BlockDoubleDecoration)
|
// add properties (note we inherit HALF from BlockDoubleDecoration)
|
||||||
// TODO: rename this
|
public static enum DoublePlantType implements IStringSerializable
|
||||||
public static enum FoliageType implements IStringSerializable
|
|
||||||
{
|
{
|
||||||
FLAX, TALL_CATTAIL;
|
FLAX, TALL_CATTAIL;
|
||||||
@Override
|
@Override
|
||||||
|
@ -50,7 +49,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
return this.getName();
|
return this.getName();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", FoliageType.class);
|
public static final PropertyEnum VARIANT = PropertyEnum.create("variant", DoublePlantType.class);
|
||||||
@Override
|
@Override
|
||||||
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { HALF, VARIANT });}
|
protected BlockState createBlockState() {return new BlockState(this, new IProperty[] { HALF, VARIANT });}
|
||||||
|
|
||||||
|
@ -63,33 +62,33 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
@Override
|
@Override
|
||||||
public String getStateName(IBlockState state)
|
public String getStateName(IBlockState state)
|
||||||
{
|
{
|
||||||
return ((FoliageType) state.getValue(VARIANT)).getName();
|
return ((DoublePlantType) state.getValue(VARIANT)).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPDoublePlant()
|
public BlockBOPDoublePlant()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
this.setDefaultState( this.blockState.getBaseState().withProperty(HALF, Half.LOWER) .withProperty(VARIANT, FoliageType.FLAX) );
|
this.setDefaultState( this.blockState.getBaseState().withProperty(HALF, Half.LOWER) .withProperty(VARIANT, DoublePlantType.FLAX) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// map from state to meta and vice verca - use highest bit for Half, and lower bits for variant
|
// map from state to meta and vice verca - use highest bit for Half, and lower bits for variant
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta)
|
public IBlockState getStateFromMeta(int meta)
|
||||||
{
|
{
|
||||||
return this.getDefaultState().withProperty(HALF, Half.values()[meta >> 3]).withProperty(VARIANT, FoliageType.values()[meta & 7]);
|
return this.getDefaultState().withProperty(HALF, Half.values()[meta >> 3]).withProperty(VARIANT, DoublePlantType.values()[meta & 7]);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state)
|
public int getMetaFromState(IBlockState state)
|
||||||
{
|
{
|
||||||
return ((Half) state.getValue(HALF)).ordinal() * 8 + ((FoliageType) state.getValue(VARIANT)).ordinal();
|
return ((Half) state.getValue(HALF)).ordinal() * 8 + ((DoublePlantType) state.getValue(VARIANT)).ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public enum ColoringType {PLAIN, LIKE_LEAVES, LIKE_GRASS};
|
public enum ColoringType {PLAIN, LIKE_LEAVES, LIKE_GRASS};
|
||||||
|
|
||||||
public static ColoringType getColoringType(FoliageType plant)
|
public static ColoringType getColoringType(DoublePlantType plant)
|
||||||
{
|
{
|
||||||
switch (plant)
|
switch (plant)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +110,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderColor(IBlockState state)
|
public int getRenderColor(IBlockState state)
|
||||||
{
|
{
|
||||||
switch (getColoringType((FoliageType) state.getValue(VARIANT)))
|
switch (getColoringType((DoublePlantType) state.getValue(VARIANT)))
|
||||||
{
|
{
|
||||||
case LIKE_LEAVES:
|
case LIKE_LEAVES:
|
||||||
return ColorizerFoliage.getFoliageColorBasic();
|
return ColorizerFoliage.getFoliageColorBasic();
|
||||||
|
@ -126,7 +125,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
|
public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass)
|
||||||
{
|
{
|
||||||
switch (getColoringType((FoliageType) worldIn.getBlockState(pos).getValue(VARIANT)))
|
switch (getColoringType((DoublePlantType) worldIn.getBlockState(pos).getValue(VARIANT)))
|
||||||
{
|
{
|
||||||
case LIKE_LEAVES:
|
case LIKE_LEAVES:
|
||||||
return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos);
|
return BiomeColorHelper.getFoliageColorAtPos(worldIn, pos);
|
||||||
|
@ -141,7 +140,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
@Override
|
@Override
|
||||||
public int getItemRenderColor(IBlockState state, int tintIndex)
|
public int getItemRenderColor(IBlockState state, int tintIndex)
|
||||||
{
|
{
|
||||||
switch ((FoliageType) state.getValue(VARIANT))
|
switch ((DoublePlantType) state.getValue(VARIANT))
|
||||||
{
|
{
|
||||||
case FLAX:
|
case FLAX:
|
||||||
return 0xFFFFFF;
|
return 0xFFFFFF;
|
||||||
|
@ -156,7 +155,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
|
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
|
||||||
{
|
{
|
||||||
switch ((FoliageType) worldIn.getBlockState(pos).getValue(VARIANT))
|
switch ((DoublePlantType) worldIn.getBlockState(pos).getValue(VARIANT))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
this.setBlockBoundsByRadiusAndHeight(0.4F, 0.8F);
|
this.setBlockBoundsByRadiusAndHeight(0.4F, 0.8F);
|
||||||
|
@ -198,7 +197,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
|
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
|
||||||
|
|
||||||
// add items based on the VARIANT - default is to return nothing (require shears to collect the block)
|
// add items based on the VARIANT - default is to return nothing (require shears to collect the block)
|
||||||
switch ((FoliageType) lowerState.getValue(VARIANT))
|
switch ((DoublePlantType) lowerState.getValue(VARIANT))
|
||||||
{
|
{
|
||||||
case FLAX:
|
case FLAX:
|
||||||
if (rand.nextInt(8) == 0)
|
if (rand.nextInt(8) == 0)
|
||||||
|
@ -225,7 +224,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
|
List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
|
||||||
|
|
||||||
// add items based on the VARIANT
|
// add items based on the VARIANT
|
||||||
FoliageType type = (FoliageType) lowerState.getValue(VARIANT);
|
DoublePlantType type = (DoublePlantType) lowerState.getValue(VARIANT);
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -235,7 +234,7 @@ public class BlockBOPDoublePlant extends BlockDoubleDecoration implements IShear
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getVariantItem(FoliageType type) {
|
public ItemStack getVariantItem(DoublePlantType type) {
|
||||||
IBlockState state = this.getDefaultState().withProperty(HALF, Half.LOWER).withProperty(VARIANT, type);
|
IBlockState state = this.getDefaultState().withProperty(HALF, Half.LOWER).withProperty(VARIANT, type);
|
||||||
return new ItemStack(this, 1, this.getMetaFromState(state));
|
return new ItemStack(this, 1, this.getMetaFromState(state));
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class ModCrafting
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.brown_dye), new Object[] {new ItemStack(BOPBlocks.mushroom, 1, BlockBOPMushroom.MushroomType.FLAT_MUSHROOM.ordinal())});
|
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.brown_dye), new Object[] {new ItemStack(BOPBlocks.mushroom, 1, BlockBOPMushroom.MushroomType.FLAT_MUSHROOM.ordinal())});
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.blue_dye), new Object[] {new ItemStack(BOPBlocks.mushroom, 1, BlockBOPMushroom.MushroomType.BLUE_MILK_CAP.ordinal())});
|
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.blue_dye), new Object[] {new ItemStack(BOPBlocks.mushroom, 1, BlockBOPMushroom.MushroomType.BLUE_MILK_CAP.ordinal())});
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.brown_dye), new Object[] {BlockBOPPlant.paging.getVariantItem(BOPPlants.CATTAIL)});
|
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.brown_dye), new Object[] {BlockBOPPlant.paging.getVariantItem(BOPPlants.CATTAIL)});
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.brown_dye), new Object[] {((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.FoliageType.TALL_CATTAIL)});
|
GameRegistry.addShapelessRecipe(new ItemStack(BOPItems.brown_dye), new Object[] {((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.DoublePlantType.TALL_CATTAIL)});
|
||||||
|
|
||||||
|
|
||||||
/*** Brick stairs and slabs ***/
|
/*** Brick stairs and slabs ***/
|
||||||
|
@ -172,11 +172,9 @@ public class ModCrafting
|
||||||
|
|
||||||
/*** Misc Others ***/
|
/*** Misc Others ***/
|
||||||
|
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(Items.string), new Object[] {"FFF", "FFF", "FFF", 'F', ((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.FoliageType.FLAX)});
|
GameRegistry.addShapedRecipe(new ItemStack(Items.string), new Object[] {"FFF", "FFF", "FFF", 'F', ((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.DoublePlantType.FLAX)});
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.grass, 1, BlockBOPGrass.BOPGrassType.OVERGROWN_NETHERRACK.ordinal()), new Object[] {"SSS", "SNS", "SSS", 'S', Items.wheat_seeds, 'N', Blocks.netherrack});
|
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.grass, 1, BlockBOPGrass.BOPGrassType.OVERGROWN_NETHERRACK.ordinal()), new Object[] {"SSS", "SNS", "SSS", 'S', Items.wheat_seeds, 'N', Blocks.netherrack});
|
||||||
// TODO: use oredict so it works with any mixture of single or double cattail
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.wool), new Object [] {"CCC", "CCC", "CCC", 'C', "plantCattail"}));
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(Blocks.wool), new Object[] {"CCC", "CCC", "CCC", 'C', BlockBOPPlant.paging.getVariantItem(BOPPlants.CATTAIL)});
|
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(Blocks.wool), new Object[] {"CCC", "CCC", "CCC", 'C', ((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.FoliageType.TALL_CATTAIL)});
|
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(Items.coal), new Object[] {"AAA", "AAA", "AAA", 'A', new ItemStack(BOPItems.ash)});
|
GameRegistry.addShapedRecipe(new ItemStack(Items.coal), new Object[] {"AAA", "AAA", "AAA", 'A', new ItemStack(BOPItems.ash)});
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.ash_block), new Object[] {"AA", "AA", 'A', new ItemStack(BOPItems.ash)});
|
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.ash_block), new Object[] {"AA", "AA", 'A', new ItemStack(BOPItems.ash)});
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.mud, 1), new Object[] {"MM", "MM", 'M', BOPItems.mudball});
|
GameRegistry.addShapedRecipe(new ItemStack(BOPBlocks.mud, 1), new Object[] {"MM", "MM", 'M', BOPItems.mudball});
|
||||||
|
@ -308,6 +306,8 @@ public class ModCrafting
|
||||||
String plantName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, plant.name());
|
String plantName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, plant.name());
|
||||||
OreDictionary.registerOre("plant"+plantName, BlockBOPPlant.paging.getVariantItem(plant));
|
OreDictionary.registerOre("plant"+plantName, BlockBOPPlant.paging.getVariantItem(plant));
|
||||||
}
|
}
|
||||||
|
OreDictionary.registerOre("plantFlax", ((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.DoublePlantType.FLAX));
|
||||||
|
OreDictionary.registerOre("plantCattail", ((BlockBOPDoublePlant)BOPBlocks.double_plant).getVariantItem(BlockBOPDoublePlant.DoublePlantType.TALL_CATTAIL));
|
||||||
|
|
||||||
for (BOPTrees tree : BOPTrees.values())
|
for (BOPTrees tree : BOPTrees.values())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue