Fixed a crash with biome config files, fixed inventory colouring

This commit is contained in:
Adubbz 2016-03-18 23:52:38 +11:00
parent 711f8d94d7
commit 32a814b7e2
37 changed files with 187 additions and 64 deletions

View file

@ -415,11 +415,7 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome
public PropsBuilder(String name) { this.biomeName = name; } public PropsBuilder(String name) { this.biomeName = name; }
public PropsBuilder withGuiColour(int colour) public PropsBuilder withGuiColour(Integer colour) { if (colour != null) this.guiColour = colour; return this; }
{
this.guiColour = colour; return this;
}
public PropsBuilder withTemperature(Float temperature) { if (temperature != null) this.temperature = temperature; return this; } public PropsBuilder withTemperature(Float temperature) { if (temperature != null) this.temperature = temperature; return this; }
public PropsBuilder withRainfall(Float rainfall) { if (rainfall != null) this.rainfall = rainfall; return this; } public PropsBuilder withRainfall(Float rainfall) { if (rainfall != null) this.rainfall = rainfall; return this; }
public PropsBuilder withBaseHeight(Float baseHeight) { if (baseHeight != null) this.baseHeight = baseHeight; return this; } public PropsBuilder withBaseHeight(Float baseHeight) { if (baseHeight != null) this.baseHeight = baseHeight; return this; }
@ -427,7 +423,7 @@ public class BOPBiome extends BiomeGenBase implements IExtendedBiome
public PropsBuilder withRainDisabled() { this.enableRain = false; return this; } public PropsBuilder withRainDisabled() { this.enableRain = false; return this; }
public PropsBuilder withSnowEnabled() { this.enableSnow = true; return this; } public PropsBuilder withSnowEnabled() { this.enableSnow = true; return this; }
public PropsBuilder withWaterColor(Integer waterColor) { if (waterColor != null) this.waterColor = waterColor; return this; } public PropsBuilder withWaterColor(Integer waterColor) { if (waterColor != null) this.waterColor = waterColor; return this; }
public PropsBuilder withBaseBiome(String name) { this.baseBiomeRegName = name; return this; } public PropsBuilder withBaseBiome(String name) { if (name != null) this.baseBiomeRegName = name; return this; }
public BiomeProps build() public BiomeProps build()
{ {

View file

@ -11,6 +11,7 @@ package biomesoplenty.api.block;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
public interface IBOPBlock { public interface IBOPBlock {
@ -20,6 +21,6 @@ public interface IBOPBlock {
public IProperty[] getNonRenderingProperties(); public IProperty[] getNonRenderingProperties();
public String getStateName(IBlockState state); public String getStateName(IBlockState state);
public IBlockColor getColourHandler(); public IBlockColor getBlockColor();
public IItemColor getItemColor();
} }

View file

@ -18,6 +18,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -53,7 +54,9 @@ public class BlockBOPBones extends Block implements IBOPBlock
@Override @Override
protected BlockStateContainer createBlockState() {return new BlockStateContainer(this, new IProperty[] { AXIS, VARIANT });} protected BlockStateContainer createBlockState() {return new BlockStateContainer(this, new IProperty[] { AXIS, VARIANT });}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
// implement IBOPBlock // implement IBOPBlock
@Override @Override

View file

@ -19,6 +19,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -39,7 +40,9 @@ public class BlockBOPCrystal extends Block implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPCrystal() { public BlockBOPCrystal() {
super(Material.glass); super(Material.glass);

View file

@ -19,6 +19,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -44,7 +45,9 @@ public class BlockBOPDecoration extends Block implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
// constructor // constructor
public BlockBOPDecoration() { public BlockBOPDecoration() {

View file

@ -24,6 +24,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -68,7 +69,9 @@ public class BlockBOPDirt extends Block implements IBOPBlock, ISustainsPlantType
return (Boolean.TRUE.equals(state.getValue(COARSE)) ? "coarse_" : "") + ((BOPDirtType) state.getValue(VARIANT)).getName() + "_dirt"; return (Boolean.TRUE.equals(state.getValue(COARSE)) ? "coarse_" : "") + ((BOPDirtType) state.getValue(VARIANT)).getName() + "_dirt";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPDirt() { public BlockBOPDirt() {

View file

@ -19,6 +19,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -44,7 +45,9 @@ public class BlockBOPDoor extends BlockDoor implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
// Map from woods to BlockBOPDoor instance and back // Map from woods to BlockBOPDoor instance and back
private static Map<BOPWoods, BlockBOPDoor> variantToBlock = new HashMap<BOPWoods, BlockBOPDoor>(); private static Map<BOPWoods, BlockBOPDoor> variantToBlock = new HashMap<BOPWoods, BlockBOPDoor>();

View file

@ -86,7 +86,7 @@ public class BlockBOPDoublePlant extends BlockBOPDoubleDecoration implements ISh
} }
} }
public IBlockColor getColourHandler() public IBlockColor getBlockColor()
{ {
return new IBlockColor() return new IBlockColor()
{ {

View file

@ -24,6 +24,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -87,7 +88,9 @@ public class BlockBOPDoubleWoodSlab extends BlockSlab implements IBOPBlock
return "double_" + ((BOPWoods)state.getValue(this.variantProperty)).getName() + "_wood_slab"; return "double_" + ((BOPWoods)state.getValue(this.variantProperty)).getName() + "_wood_slab";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
private BlockBOPDoubleWoodSlab() private BlockBOPDoubleWoodSlab()
{ {

View file

@ -23,6 +23,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -78,7 +79,9 @@ public class BlockBOPFarmland extends BlockFarmland implements IBOPBlock
return ((BlockBOPDirt.BOPDirtType) state.getValue(this.variantProperty)).getName() + "_farmland"; return ((BlockBOPDirt.BOPDirtType) state.getValue(this.variantProperty)).getName() + "_farmland";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPFarmland() public BlockBOPFarmland()
{ {

View file

@ -21,6 +21,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -40,7 +41,9 @@ public class BlockBOPFence extends BlockFence implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
// Map from woods to BlockBOPFence instance and back // Map from woods to BlockBOPFence instance and back
private static Map<BOPWoods, BlockBOPFence> variantToBlock = new HashMap<BOPWoods, BlockBOPFence>(); private static Map<BOPWoods, BlockBOPFence> variantToBlock = new HashMap<BOPWoods, BlockBOPFence>();

View file

@ -20,6 +20,7 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -40,7 +41,9 @@ public class BlockBOPFenceGate extends BlockFenceGate implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
// Map from woods to BlockBOPFenceGate instance and back // Map from woods to BlockBOPFenceGate instance and back
private static Map<BOPWoods, BlockBOPFenceGate> variantToBlock = new HashMap<BOPWoods, BlockBOPFenceGate>(); private static Map<BOPWoods, BlockBOPFenceGate> variantToBlock = new HashMap<BOPWoods, BlockBOPFenceGate>();

View file

@ -19,6 +19,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
@ -44,7 +45,9 @@ public class BlockBOPFlesh extends Block implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPFlesh() { public BlockBOPFlesh() {
super(Material.sponge); super(Material.sponge);

View file

@ -19,6 +19,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
public class BlockBOPGem extends Block implements IBOPBlock public class BlockBOPGem extends Block implements IBOPBlock
@ -42,7 +43,9 @@ public class BlockBOPGem extends Block implements IBOPBlock
return ((BOPGems) state.getValue(VARIANT)).getName() + "_block"; return ((BOPGems) state.getValue(VARIANT)).getName() + "_block";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPGem() public BlockBOPGem()
{ {

View file

@ -24,6 +24,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -52,7 +53,9 @@ public class BlockBOPGemOre extends Block implements IBOPBlock
return ((BOPGems) state.getValue(VARIANT)).getName() + "_ore"; return ((BOPGems) state.getValue(VARIANT)).getName() + "_ore";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPGemOre() public BlockBOPGemOre()
{ {

View file

@ -20,6 +20,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -39,7 +40,9 @@ public class BlockBOPGeneric extends Block implements IBOPBlock, ISustainsPlantT
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPGeneric() { public BlockBOPGeneric() {
// use rock as default material // use rock as default material

View file

@ -27,6 +27,7 @@ import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -87,7 +88,9 @@ public class BlockBOPGrass extends BlockGrass implements IBOPBlock, ISustainsPla
} }
} }
@Override @Override
public IBlockColor getColourHandler() { return ModBlocks.GRASS_COLORING; } public IBlockColor getBlockColor() { return ModBlocks.GRASS_COLORING; }
@Override
public IItemColor getItemColor() { return ModBlocks.BLOCK_ITEM_COLORING; }
public BlockBOPGrass() public BlockBOPGrass()
{ {

View file

@ -23,6 +23,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@ -85,7 +86,9 @@ public class BlockBOPHalfOtherSlab extends BlockSlab implements IBOPBlock
return ((SlabType) state.getValue(VARIANT)).getName() + "_slab"; return ((SlabType) state.getValue(VARIANT)).getName() + "_slab";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public IBlockState getFullBlockVariantState(SlabType type) public IBlockState getFullBlockVariantState(SlabType type)
{ {

View file

@ -23,6 +23,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -85,7 +86,9 @@ public class BlockBOPHalfWoodSlab extends BlockSlab implements IBOPBlock
return ((BOPWoods) state.getValue(this.variantProperty)).getName() + "_wood_slab"; return ((BOPWoods) state.getValue(this.variantProperty)).getName() + "_wood_slab";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
private BlockBOPHalfWoodSlab() private BlockBOPHalfWoodSlab()
{ {

View file

@ -22,6 +22,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@ -64,7 +65,9 @@ public class BlockBOPHive extends Block implements IBOPBlock
return ((HiveType) state.getValue(VARIANT)).getName() + "_block"; return ((HiveType) state.getValue(VARIANT)).getName() + "_block";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPHive() public BlockBOPHive()
{ {

View file

@ -16,6 +16,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
@ -34,7 +35,9 @@ public class BlockBOPHoney extends Block implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPHoney() { public BlockBOPHoney() {
super(Material.glass); super(Material.glass);

View file

@ -15,6 +15,7 @@ import biomesoplenty.api.block.IBOPBlock;
import biomesoplenty.api.item.BOPItems; import biomesoplenty.api.item.BOPItems;
import biomesoplenty.common.enums.BOPPlants; import biomesoplenty.common.enums.BOPPlants;
import biomesoplenty.common.enums.BOPTrees; import biomesoplenty.common.enums.BOPTrees;
import biomesoplenty.common.init.ModBlocks;
import biomesoplenty.common.item.ItemBOPBlock; import biomesoplenty.common.item.ItemBOPBlock;
import biomesoplenty.common.util.block.VariantPagingHelper; import biomesoplenty.common.util.block.VariantPagingHelper;
import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockLeaves;
@ -23,6 +24,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -117,7 +119,7 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
} }
@Override @Override
public IBlockColor getColourHandler() public IBlockColor getBlockColor()
{ {
final IProperty variantProp = this.variantProperty; final IProperty variantProp = this.variantProperty;
@ -142,6 +144,8 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
} }
}; };
} }
@Override
public IItemColor getItemColor() { return ModBlocks.BLOCK_ITEM_COLORING; }
private BlockBOPLeaves() private BlockBOPLeaves()
{ {

View file

@ -17,6 +17,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -64,7 +65,9 @@ public class BlockBOPLilypad extends BlockLilyPad implements IBOPBlock
return "lily_"+type.getName(); return "lily_"+type.getName();
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPLilypad() public BlockBOPLilypad()
{ {

View file

@ -17,6 +17,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -79,7 +80,9 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
} }
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
private BlockBOPLog() private BlockBOPLog()
{ {

View file

@ -22,6 +22,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
@ -71,7 +72,9 @@ public class BlockBOPMud extends Block implements IBOPBlock, ISustainsPlantType
return ((MudType) state.getValue(VARIANT)).getName(); return ((MudType) state.getValue(VARIANT)).getName();
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPMud() { public BlockBOPMud() {

View file

@ -19,6 +19,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -75,7 +76,9 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
return ((BOPWoods) state.getValue(this.variantProperty)).getName() + "_planks"; return ((BOPWoods) state.getValue(this.variantProperty)).getName() + "_planks";
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPPlanks() public BlockBOPPlanks()
{ {

View file

@ -21,6 +21,7 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
@ -125,10 +126,8 @@ public class BlockBOPPlant extends BlockBOPDecoration implements IShearable
} }
@Override @Override
public IBlockColor getColourHandler() public IBlockColor getBlockColor()
{ {
final IProperty variantProp = this.variantProperty;
return new IBlockColor() return new IBlockColor()
{ {
@Override @Override
@ -136,7 +135,7 @@ public class BlockBOPPlant extends BlockBOPDecoration implements IShearable
{ {
boolean inWorld = world != null && pos != null; boolean inWorld = world != null && pos != null;
switch (getColoringType((BOPPlants) state.getValue(variantProp))) switch (getColoringType((BOPPlants) state.getValue(BlockBOPPlant.this.variantProperty)))
{ {
case LIKE_LEAVES: case LIKE_LEAVES:
return inWorld ? BiomeColorHelper.getFoliageColorAtPos(world, pos) : ColorizerFoliage.getFoliageColorBasic(); return inWorld ? BiomeColorHelper.getFoliageColorAtPos(world, pos) : ColorizerFoliage.getFoliageColorBasic();
@ -150,6 +149,28 @@ public class BlockBOPPlant extends BlockBOPDecoration implements IShearable
}; };
} }
@Override
public IItemColor getItemColor()
{
return new IItemColor()
{
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex)
{
IBlockState state = ((ItemBlock)stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata());
switch ((BOPPlants) state.getValue(BlockBOPPlant.this.variantProperty))
{
case BERRYBUSH: case SHRUB:
return 0xFFFFFF;
default:
return BlockBOPPlant.this.getBlockColor().colorMultiplier(state, null, null, tintIndex);
}
}
};
}
private BlockBOPPlant() private BlockBOPPlant()
{ {
super(); super();

View file

@ -19,6 +19,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -65,7 +66,9 @@ public class BlockBOPSand extends BlockFalling implements IBOPBlock, ISustainsPl
return ((SandType) state.getValue(VARIANT)).getName(); return ((SandType) state.getValue(VARIANT)).getName();
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPSand() { public BlockBOPSand() {

View file

@ -19,6 +19,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@ -63,7 +64,9 @@ public class BlockBOPStone extends Block implements IBOPBlock
return (Boolean.TRUE.equals(state.getValue(POLISHED)) ? "polished_" : "") + ((StoneType) state.getValue(VARIANT)).getName(); return (Boolean.TRUE.equals(state.getValue(POLISHED)) ? "polished_" : "") + ((StoneType) state.getValue(VARIANT)).getName();
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPStone() public BlockBOPStone()
{ {

View file

@ -17,6 +17,7 @@ import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
@ -64,7 +65,9 @@ public class BlockBOPTerrarium extends Block implements IBOPBlock
} }
} }
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
public BlockBOPTerrarium() public BlockBOPTerrarium()
{ {

View file

@ -16,6 +16,7 @@ import net.minecraft.block.BlockCrops;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -36,7 +37,9 @@ public class BlockBOPTurnip extends BlockCrops implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
@Override @Override
protected Item getSeed() protected Item getSeed()

View file

@ -16,6 +16,7 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -39,7 +40,9 @@ public class BlockBOPVine extends BlockVine implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return useGreyScaleTextures ? ModBlocks.FOLIAGE_COLOURING : null; } public IBlockColor getBlockColor() { return useGreyScaleTextures ? ModBlocks.FOLIAGE_COLORING : null; }
@Override
public IItemColor getItemColor() { return ModBlocks.BLOCK_ITEM_COLORING; }
// if set to true, (the default), use BlockVine getBlockColor(), getRenderColor() and colorMultiplier() functions to color the texture based on biome // if set to true, (the default), use BlockVine getBlockColor(), getRenderColor() and colorMultiplier() functions to color the texture based on biome
// if set to false, use 0xFFFFFF for all the color functions so that the texture is used as it is // if set to false, use 0xFFFFFF for all the color functions so that the texture is used as it is

View file

@ -18,6 +18,7 @@ import net.minecraft.block.BlockStairs;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -38,7 +39,9 @@ public class BlockBOPWoodStairs extends BlockStairs implements IBOPBlock
@Override @Override
public String getStateName(IBlockState state) {return "";} public String getStateName(IBlockState state) {return "";}
@Override @Override
public IBlockColor getColourHandler() { return null; } public IBlockColor getBlockColor() { return null; }
@Override
public IItemColor getItemColor() { return null; }
// Map from woods to BlockBOPStairs instance and back // Map from woods to BlockBOPStairs instance and back
private static Map<BOPWoods, BlockBOPWoodStairs> variantToBlock = new HashMap<BOPWoods, BlockBOPWoodStairs>(); private static Map<BOPWoods, BlockBOPWoodStairs> variantToBlock = new HashMap<BOPWoods, BlockBOPWoodStairs>();

View file

@ -78,6 +78,7 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -85,6 +86,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemDoor; import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.ColorizerGrass; import net.minecraft.world.ColorizerGrass;
@ -98,7 +100,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
public class ModBlocks public class ModBlocks
{ {
public static final IBlockColor FOLIAGE_COLOURING = new IBlockColor() public static final IBlockColor FOLIAGE_COLORING = new IBlockColor()
{ {
@Override @Override
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex)
@ -116,6 +118,17 @@ public class ModBlocks
} }
}; };
public static final IItemColor BLOCK_ITEM_COLORING = new IItemColor()
{
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex)
{
IBlockState state = ((ItemBlock)stack.getItem()).getBlock().getStateFromMeta(stack.getMetadata());
IBlockColor blockColor = ((IBOPBlock)state.getBlock()).getBlockColor();
return blockColor == null ? 0xFFFFFF : blockColor.colorMultiplier(state, null, null, tintIndex);
}
};
// TODO: use getDrops() in classes where the drops are very specific, instead of implementing all 3 of quantityDropped() getItemDropped() and damageDropped() // TODO: use getDrops() in classes where the drops are very specific, instead of implementing all 3 of quantityDropped() getItemDropped() and damageDropped()
// TODO: docblocks! // TODO: docblocks!
// TODO: make better use of canSustainPlant() in BlockDecoration and children // TODO: make better use of canSustainPlant() in BlockDecoration and children

View file

@ -84,7 +84,7 @@ public class BiomesOPlenty
@EventHandler @EventHandler
public void init(FMLInitializationEvent event) public void init(FMLInitializationEvent event)
{ {
BiomesOPlenty.proxy.registerColouredBlocks(); BiomesOPlenty.proxy.registerColouring();
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
} }

View file

@ -84,12 +84,16 @@ public class ClientProxy extends CommonProxy
} }
@Override @Override
public void registerColouredBlocks() public void registerColouring()
{ {
for (Block block : blocksToColour) for (Block block : blocksToColour)
{ {
IBOPBlock bopBlock = (IBOPBlock)block; IBOPBlock bopBlock = (IBOPBlock)block;
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(bopBlock.getColourHandler(), block);
if (bopBlock.getBlockColor() != null)
Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(bopBlock.getBlockColor(), block);
if (bopBlock.getItemColor() != null)
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(bopBlock.getItemColor(), block);
} }
} }
@ -121,7 +125,7 @@ public class ClientProxy extends CommonProxy
} }
//Register colour handlers //Register colour handlers
if (bopBlock.getColourHandler() != null) if (bopBlock.getBlockColor() != null || bopBlock.getItemColor() != null)
{ {
blocksToColour.add(block); blocksToColour.add(block);
} }

View file

@ -15,7 +15,7 @@ import net.minecraft.item.Item;
public class CommonProxy public class CommonProxy
{ {
public void registerRenderers() {} public void registerRenderers() {}
public void registerColouredBlocks() {} public void registerColouring() {}
public void registerItemVariantModel(Item item, String name, int metadata) {} public void registerItemVariantModel(Item item, String name, int metadata) {}
public void registerBlockSided(Block block) {} public void registerBlockSided(Block block) {}
public void registerFluidBlockRendering(Block block, String name) {} public void registerFluidBlockRendering(Block block, String name) {}