-
Posts
197 -
Joined
-
Last visited
-
Days Won
1
That_Martin_Guy last won the day on August 20 2018
That_Martin_Guy had the most liked content!
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
That_Martin_Guy's Achievements
Creeper Killer (4/8)
7
Reputation
-
[1.16.5] Model not binding texture correctly
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
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
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
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
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
I really am not sure how this differs from the enchanting table in a meaningful way -
[1.16.5] Model not binding texture correctly
That_Martin_Guy replied to That_Martin_Guy's topic in Modder Support
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); } } -
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.
-
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.
-
What is this for?
-
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); } }
-
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.
-
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.