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
|
@ -18,5 +18,6 @@ public interface IBOPBlock {
|
|||
public Map<String, IBlockState> getNamedStates();
|
||||
public IBlockState getNamedState(String name);
|
||||
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 IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
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 IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return null;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
private Item doorItem;
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@ public class BlockBOPFence extends BlockFence implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockBOPFence()
|
||||
{
|
||||
|
|
|
@ -28,6 +28,8 @@ public class BlockBOPFenceGate extends BlockFenceGate implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockBOPFenceGate()
|
||||
{
|
||||
|
|
|
@ -26,6 +26,8 @@ public class BlockBOPGeneric extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockBOPGeneric() {
|
||||
// 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 IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
|
||||
public BlockBOPGrass()
|
||||
|
|
|
@ -43,6 +43,8 @@ public class BlockBOPLeaves extends BlockLeaves implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
private ItemStack sapling;
|
||||
private ItemStack fruit;
|
||||
|
|
|
@ -37,6 +37,8 @@ public class BlockBOPLilypad extends BlockLilyPad implements IBOPBlock
|
|||
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
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPLilypad.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
|
||||
public BlockBOPLilypad()
|
||||
|
|
|
@ -31,6 +31,8 @@ public class BlockBOPLog extends BlockLog implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockBOPLog()
|
||||
{
|
||||
|
|
|
@ -25,6 +25,8 @@ public class BlockBOPStairs extends BlockStairs implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockBOPStairs(IBlockState modelState)
|
||||
{
|
||||
|
|
|
@ -42,6 +42,8 @@ public class BlockBOPStone extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockBOPStone()
|
||||
{
|
||||
|
|
|
@ -28,6 +28,8 @@ public class BlockBOPVine extends BlockVine implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
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 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 IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockBones()
|
||||
|
|
|
@ -29,6 +29,8 @@ public class BlockCrystal extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockCrystal() {
|
||||
super(Material.glass);
|
||||
|
|
|
@ -36,6 +36,8 @@ public class BlockDecoration extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
// constructor
|
||||
public BlockDecoration() {
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
import biomesoplenty.api.block.BOPBlocks;
|
||||
import biomesoplenty.common.block.BlockFoliage.FoliageType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
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
|
||||
@Override
|
||||
|
|
|
@ -39,6 +39,8 @@ public class BlockFlesh extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockFlesh() {
|
||||
super(Material.sponge);
|
||||
|
|
|
@ -157,6 +157,20 @@ public class BlockFoliage extends BlockDecoration implements IShearable
|
|||
return BiomeColorHelper.getGrassColorAtPos(worldIn, pos);
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
|
|
@ -36,6 +36,8 @@ public class BlockGem extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
|
||||
public BlockGem()
|
||||
|
|
|
@ -38,6 +38,8 @@ public class BlockGemOre extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
|
||||
public BlockGemOre()
|
||||
|
|
|
@ -42,6 +42,8 @@ public class BlockHive extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
public BlockHive()
|
||||
{
|
||||
|
|
|
@ -45,6 +45,8 @@ public class BlockMud extends Block implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return ItemBOPBlock.class;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
// constructor
|
||||
public BlockMud() {
|
||||
|
|
|
@ -27,6 +27,8 @@ public class BlockTurnip extends BlockCrops implements IBOPBlock
|
|||
public Map<String, IBlockState> getNamedStates() {return this.namedStates;}
|
||||
public IBlockState getNamedState(String name) {return this.namedStates.get(name);}
|
||||
public Class<? extends ItemBlock> getItemClass() {return null;}
|
||||
public int getItemRenderColor(IBlockState state, int tintIndex) {return this.getRenderColor(state);}
|
||||
|
||||
|
||||
@Override
|
||||
protected Item getSeed()
|
||||
|
|
|
@ -59,10 +59,11 @@ public class ItemBOPBlock extends ItemBlock
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: renderPass is actually tintIndex - use for berries etc?
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
return this.block.getRenderColor(this.block.getStateFromMeta(stack.getMetadata()));
|
||||
public int getColorFromItemStack(ItemStack stack, int tintIndex)
|
||||
{
|
||||
return this.bopBlock.getItemRenderColor(this.block.getStateFromMeta(stack.getMetadata()), tintIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue