总览
让物品纹理在世界内渲染出来
就是像原版那样,把手上的东西渲染出来
分为以下几个步骤
1、继承ItemInHandLayer
2、添加这个layer
3、注册这个layer
另外,莱特兰团队制作的一系列模组也是很赞的,可以支持一下国内团队!
实现ItemInHandLayer
为什么是ItemInHandLayer?
因为只渲染纹理,没有模型的话,原版就是这样实现的
如果你想渲染模型,那就需要RenderLayer
这里,以ItemInHandLayer为例
public class TestLayer extends ItemInHandLayer{
//纹理大小预设
float scaleX=1;
float scaleY=1;
float scaleZ=1;
ItemInHandRenderer itemInHandRenderer;
//这里的EntityModelSet我们不需要,先不用管
public TestLayer(RenderLayerParent parent, EntityModelSet set, ItemInHandRenderer renderer) {
this(parent, set, 1.0F, 1.0F, 1.0F, renderer);
}
public TestLayer(RenderLayerParent parent, EntityModelSet set, float x, float y, float z, ItemInHandRenderer renderer) {
super(parent,renderer);
this.scaleX = x;
this.scaleY = y;
this.scaleZ = z;
this.itemInHandRenderer = renderer;
}
public void render(PoseStack pose, MultiBufferSource buffer, int i, LivingEntity entity, float f0, float f1, float f2,

文章介绍了如何在Minecraft中实现和注册ItemInHandLayer,用于渲染玩家手上的物品,包括继承、添加层、注册过程以及使用的一些API。同时提到了饰品栏API和可能存在的问题,如多个古遗物渲染位置冲突。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



