tcr/java/src/game/item/ItemDoublePlant.java
2025-03-12 18:13:11 +01:00

29 lines
1.2 KiB
Java
Executable file

package game.item;
import java.util.function.Function;
import game.block.Block;
import game.block.BlockDoublePlant;
import game.block.BlockDoublePlant.EnumPlantType;
import game.color.Colorizer;
import game.renderer.blockmodel.ModelBlock;
public class ItemDoublePlant extends ItemMultiTexture
{
public ItemDoublePlant(Block block, Block block2, Function<ItemStack, String> nameFunction)
{
super(block, block2, true, nameFunction);
}
public int getColorFromItemStack(ItemStack stack, int renderPass)
{
BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = BlockDoublePlant.EnumPlantType.byMetadata(stack.getMetadata());
return blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN ? super.getColorFromItemStack(stack, renderPass) : Colorizer.getGrassColor(0.5D, 1.0D);
}
public ModelBlock getModel(String name, int meta) {
return new ModelBlock(this.getTransform(), "blocks/" + (
BlockDoublePlant.EnumPlantType.byMetadata(meta) == EnumPlantType.SUNFLOWER ? "sunflower_front" :
BlockDoublePlant.EnumPlantType.byMetadata(meta).getName() + "_top"));
}
}