-
[1.16.5] Model not binding texture correctly
Tried several varations of the path: Writing out the full path like Luis said above Including and excluding "textures/" Including and excluding the file extension Nothing seems to be working. No error for anything either. Probably the biggest clue so far.
-
[1.16.5] Model not binding texture correctly
Didn't seem to change anything at all. Interestingly I noticed that it's not giving me errors for missing textures in the log either.
-
[1.16.5] Model not binding texture correctly
I really am not sure how this differs from the enchanting table in a meaningful way
-
[1.16.5] Model not binding texture correctly
The code I posted was in fact the entire tile entity renderer, minus the class declaration. I have added some small stuff since for testing, but overall its the same and should be very similar to the enchanting table renderer. public class ClockworksDoorTileEntityRenderer extends TileEntityRenderer<ClockworksDoorTileEntity> { private static final ResourceLocation TEXTURE = ResourceHelper.createNew("block/test.png"); private final ClockworksDoorModel model; private final RenderMaterial doorMaterial; public ClockworksDoorTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { super(dispatcher); model = new ClockworksDoorModel(); doorMaterial = new RenderMaterial(PlayerContainer.BLOCK_ATLAS, TEXTURE); } @Override public void render(ClockworksDoorTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { matrixStack.pushPose(); IVertexBuilder builder = doorMaterial.buffer(buffer, RenderType::entitySolid); model.renderToBuffer(matrixStack, builder, combinedLight, combinedOverlay, 1, 1, 1, 1); matrixStack.popPose(); } } The model itself is just a basic model. Not much to showcase, but since I was asked I'll do it anyway. public class ClockworksDoorModel extends Model { private final ModelRenderer model; public ClockworksDoorModel() { super(RenderType::entitySolid); texWidth = 64; texHeight = 64; model = new ModelRenderer(this); model.setPos(8, 32, 8); model.texOffs(0, 0).addBox(-8.0F, -32.0F, -8.0F, 16.0F, 32.0F, 3.0F, 0.0F, false); } @Override public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder builder, int partialLight, int partialOverlay, float red, float green, float blue, float alpha) { model.render(matrixStack, builder, partialLight, partialOverlay); } }
-
[1.16.5] Model not binding texture correctly
I have a tile entity renderer that renders a model. Code looks like this private static final ResourceLocation TEXTURE = ResourceHelper.createNew("block/test.png"); private final ClockworksDoorModel model; private final RenderMaterial doorMaterial; public ClockworksDoorTileEntityRenderer(TileEntityRendererDispatcher dispatcher) { super(dispatcher); model = new ClockworksDoorModel(); doorMaterial = new RenderMaterial(PlayerContainer.BLOCK_ATLAS, TEXTURE); } @Override public void render(ClockworksDoorTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { IVertexBuilder builder = doorMaterial.buffer(buffer, RenderType::entityCutoutNoCull); model.renderToBuffer(matrixStack, builder, combinedLight, combinedOverlay, 1, 1, 1, 1); } In game, however, it has the black and purple missing texture. When examining the log it does not report anything about missing textures if I put the path correctly, so I can only assume it's correctly finding my texture.
-
[1.16.5] Bind texture to model rendered in tile entity renderer
private final ModelRenderer model; public ClockworksKnobModel() { super(RenderType::entityCutoutNoCull); texWidth = 48; texHeight = 48; model = new ModelRenderer(this); model.setPos(8.0F, 8, 0); model.texOffs(0, 1).addBox(-1.0F, -1.0F, -1.0F, 2.0F, 2.0F, 1.0F, 0.0F, false); model.texOffs(1, 2).addBox(-0.5F, -4.0F, -2.0F, 1.0F, 5.0F, 2.0F, 0.0F, false); } @Override public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ model.render(matrixStack, buffer, packedLight, packedOverlay); } The rendering code is part of vanilla.
-
[1.16.5] Bind texture to model rendered in tile entity renderer
There is an overloaded version that does take those parameters as inputs, but the overload I'm using inputs the default color values (1, 1, 1, 1). So that would make no difference.
-
[1.16.5] Bind texture to model rendered in tile entity renderer
Those values are not used in the model. @Override public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){ modelGroup.render(matrixStack, buffer, packedLight, packedOverlay); }
-
[1.16.5] Bind texture to model rendered in tile entity renderer
I really am not sure what's going on
-
WorldPos to ScreenPos (coordinates)?
What is this for?
-
[1.16.5] Bind texture to model rendered in tile entity renderer
There are no errors. Tried purposefully inputting a texture that doesn't exist to see if that error comes up, and it does. So it's clearly finding the texture.
-
[1.16.5] Bind texture to model rendered in tile entity renderer
Right now it doesn't crash, but the model is still untextured in game (as in, it's completely black). public class ClockworksTileEntityRenderer extends TileEntityRenderer<TheClockworksTileEntity> { public static final ResourceLocation TEXTURE = ResourceHelper.createNew("block/test.png"); private RenderMaterial renderMaterial; public ClockworksTileEntityRenderer(TileEntityRendererDispatcher p_i226006_1_) { super(p_i226006_1_); //Instantiate model renderMaterial = new RenderMaterial(PlayerContainer.BLOCK_ATLAS, TEXTURE); } @Override public void render(TheClockworksTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { IVertexBuilder builder = renderMaterial.buffer(buffer, RenderType::entityCutout); model.renderToBuffer(matrixStack, builder, combinedLight, combinedOverlay, 0, 0, 0, 0); } }
-
[1.16.5] Bind texture to model rendered in tile entity renderer
That's just a shorthand for creating a new resource location with the mod id prefixed. Okay then... that doesn't tell me what to do instead though.
-
[1.16.5] Bind texture to model rendered in tile entity renderer
I have a custom model as a part of a tile entity renderer. I want to give this model a texture. I am struggling a bit with figuring out all the steps required to do this. I currently have the following code in my tile entity renderer public class ClockworksTileEntityRenderer extends TileEntityRenderer<TheClockworksTileEntity> { public static final ResourceLocation ATLAS_REGION = ResourceHelper.createNew("textures/atlas/test.png"); public static final ResourceLocation TEXTURE = ResourceHelper.createNew("block/test.png"); private RenderMaterial renderMaterial; public ClockworksTileEntityRenderer(TileEntityRendererDispatcher p_i226006_1_) { super(p_i226006_1_); //Instantiate model renderMaterial = new RenderMaterial(ATLAS_REGION, TEXTURE); } @Override public void render(TheClockworksTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) { System.out.println(ATLAS_REGION); IVertexBuilder builder = renderMaterial.buffer(buffer, RenderType::entityCutout); model.renderToBuffer(matrixStack, builder, combinedLight, combinedOverlay, 0, 0, 0, 0); } } When I created this code I crashed with the following message. I asked on discord if I was missing something and got told I should use the TextureStitchEvent to stitch the texture to the atlas. That code looks like this: @SubscribeEvent public static void preTextureStitch(TextureStitchEvent.Pre event) { if(event.getMap().location().equals(ClockworksTileEntityRenderer.ATLAS_REGION)) event.addSprite(ClockworksTileEntityRenderer.TEXTURE); } While the event itself runs, the code inside the if statement does not. Not sure how to proceed.
-
[1.16.5] Rotation angles/axis not consistent when rotated
Just looked at the code for ModelRenderer, sorry for not doing that earlier. It actually rotates around the z-axis first, if I understand it correctly. public void translateAndRotate(MatrixStack p_228307_1_) { p_228307_1_.translate((double)(this.x / 16.0F), (double)(this.y / 16.0F), (double)(this.z / 16.0F)); if (this.zRot != 0.0F) { p_228307_1_.mulPose(Vector3f.ZP.rotation(this.zRot)); } if (this.yRot != 0.0F) { p_228307_1_.mulPose(Vector3f.YP.rotation(this.yRot)); } if (this.xRot != 0.0F) { p_228307_1_.mulPose(Vector3f.XP.rotation(this.xRot)); } } I'm not sure how I would go about setting up this parent-child relationship when doing the rotations separately with this knowledge. Not the greatest at this sort of math.
IPS spam blocked by CleanTalk.