自己制作了几颗树,但是树叶是以灰度图的样子被渲染了出来。
构造树叶方块仿照了原版的方法:
new LeavesBlock(Block.Properties.create(Material.LEAVES).hardnessAndResistance(0.2F).tickRandomly().sound(SoundType.PLANT)
在mod主类中添加了如下方法:
@SubscribeEvent
public void blockColors(ColorHandlerEvent.Block event) {
event.getBlockColors().register(new ModBlockTinter(), OTLBlocks.pinus_caribaea_leaves, OTLBlocks.pinus_palustris_leaves, OTLBlocks.pinus_taeda_leaves);
}
ModBlockTinter类:
public class ModBlockTinter implements IBlockColor {
@Override
public int getColor(BlockState state, @Nullable IEnviromentBlockReader p_getColor_2_, @Nullable BlockPos pos, int tineIndex) {
return 2319364;
}
}
blockstates:
{
"variants": {
"": { "model": "ontheland:block/pinus_caribaea_leaves" }
}
}
models/block:
"parent": "block/block",
"textures": {
"all": "ontheland:block/pinus_caribaea_leaves",
"particle": "#all"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"down": {"texture": "#all","tintindex": 1,"cullface": "down"},
"up": {"texture": "#all","tintindex": 2,"cullface": "up"},
"north": {"texture": "#all","tintindex": 3,"cullface": "north"},
"south": {"texture": "#all","tintindex": 4,"cullface": "south"},
"west": {"texture": "#all","tintindex": 5,"cullface": "west"},
"east": {"texture": "#all","tintindex": 6,"cullface": "east"}
}
}
]
}
对了,tags标签也加了。我应该怎么做