Fix item rendering for blocks with a tinted model but non-tinted item (flax and berry_bush)
This commit is contained in:
parent
c2b80ce5fd
commit
8ca7e90be0
25 changed files with 74 additions and 3 deletions
|
@ -18,5 +18,6 @@ public interface IBOPBlock {
|
||||||
public Map<String, IBlockState> getNamedStates();
|
public Map<String, IBlockState> getNamedStates();
|
||||||
public IBlockState getNamedState(String name);
|
public IBlockState getNamedState(String name);
|
||||||
public Class<? extends ItemBlock> getItemClass();
|
public Class<? extends ItemBlock> getItemClass();
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex);
|
||||||
|
|
||||||
}
|
}
|
|
@ -43,6 +43,8 @@ public class BlockBOPDirt extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@ public class BlockBOPDoor extends BlockDoor implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return null;}
|
public Class<? extends ItemBlock> getItemClass() {return null;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
private Item doorItem;
|
private Item doorItem;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ public class BlockBOPFence extends BlockFence implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPFence()
|
public BlockBOPFence()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class BlockBOPFenceGate extends BlockFenceGate implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPFenceGate()
|
public BlockBOPFenceGate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,8 @@ public class BlockBOPGeneric extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPGeneric() {
|
public BlockBOPGeneric() {
|
||||||
// use rock as default material
|
// use rock as default material
|
||||||
|
|
|
@ -54,6 +54,8 @@ public class BlockBOPGrass extends BlockGrass implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPGrass()
|
public BlockBOPGrass()
|
||||||
|
|
|
@ -43,6 +43,8 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
private ItemStack sapling;
|
private ItemStack sapling;
|
||||||
private ItemStack fruit;
|
private ItemStack fruit;
|
||||||
|
|
|
@ -37,6 +37,8 @@ public class BlockBOPLilypad extends BlockLilyPad implements IBOPBlock
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
// need to use a custom item class because of the unique way lilies are placed
|
// need to use a custom item class because of the unique way lilies are placed
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPLilypad.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPLilypad.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPLilypad()
|
public BlockBOPLilypad()
|
||||||
|
|
|
@ -31,6 +31,8 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPLog()
|
public BlockBOPLog()
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,8 @@ public class BlockBOPStairs extends BlockStairs implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPStairs(IBlockState modelState)
|
public BlockBOPStairs(IBlockState modelState)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,6 +42,8 @@ public class BlockBOPStone extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockBOPStone()
|
public BlockBOPStone()
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class BlockBOPVine extends BlockVine implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
// 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
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class BlockBones extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockBones()
|
public BlockBones()
|
||||||
|
|
|
@ -29,6 +29,8 @@ public class BlockCrystal extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockCrystal() {
|
public BlockCrystal() {
|
||||||
super(Material.glass);
|
super(Material.glass);
|
||||||
|
|
|
@ -36,6 +36,8 @@ public class BlockDecoration extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
public BlockDecoration() {
|
public BlockDecoration() {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import biomesoplenty.api.block.BOPBlocks;
|
import biomesoplenty.api.block.BOPBlocks;
|
||||||
|
import biomesoplenty.common.block.BlockFoliage.FoliageType;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.properties.IProperty;
|
import net.minecraft.block.properties.IProperty;
|
||||||
import net.minecraft.block.properties.PropertyEnum;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
@ -91,6 +92,19 @@ public class BlockDoubleFoliage extends BlockDoubleDecoration implements ISheara
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// flax item should not be tinted, even though the model is
|
||||||
|
@Override
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex)
|
||||||
|
{
|
||||||
|
switch ((FoliageType) state.getValue(VARIANT))
|
||||||
|
{
|
||||||
|
case FLAX:
|
||||||
|
return 0xFFFFFF;
|
||||||
|
default:
|
||||||
|
return this.getRenderColor(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// different variants have different sizes
|
// different variants have different sizes
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -39,6 +39,8 @@ public class BlockFlesh extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockFlesh() {
|
public BlockFlesh() {
|
||||||
super(Material.sponge);
|
super(Material.sponge);
|
||||||
|
|
|
@ -158,6 +158,20 @@ public class BlockFoliage extends BlockDecoration implements IShearable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// berrybush item should not be tinted, even though the model is
|
||||||
|
@Override
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex)
|
||||||
|
{
|
||||||
|
switch ((FoliageType) state.getValue(VARIANT))
|
||||||
|
{
|
||||||
|
case BERRYBUSH:
|
||||||
|
return 0xFFFFFF;
|
||||||
|
default:
|
||||||
|
return this.getRenderColor(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// different variants have different sizes
|
// different variants have different sizes
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -36,6 +36,8 @@ public class BlockGem extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BlockGem()
|
public BlockGem()
|
||||||
|
|
|
@ -38,6 +38,8 @@ public class BlockGemOre extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public BlockGemOre()
|
public BlockGemOre()
|
||||||
|
|
|
@ -42,6 +42,8 @@ public class BlockHive extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
public BlockHive()
|
public BlockHive()
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,8 @@ public class BlockMud extends Block implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
public BlockMud() {
|
public BlockMud() {
|
||||||
|
|
|
@ -27,6 +27,8 @@ public class BlockTurnip extends BlockCrops implements IBOPBlock
|
||||||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||||
public Class<? extends ItemBlock> getItemClass() {return null;}
|
public Class<? extends ItemBlock> getItemClass() {return null;}
|
||||||
|
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Item getSeed()
|
protected Item getSeed()
|
||||||
|
|
|
@ -59,10 +59,11 @@ public class ItemBOPBlock extends ItemBlock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: renderPass is actually tintIndex - use for berries etc?
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
public int getColorFromItemStack(ItemStack stack, int tintIndex)
|
||||||
{
|
{
|
||||||
return this.block.getRenderColor(this.block.getStateFromMeta(stack.getMetadata()));
|
return this.bopBlock.getItemRenderColor(this.block.getStateFromMeta(stack.getMetadata()), tintIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue