Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

That_Martin_Guy

Members
  • 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!

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

That_Martin_Guy's Achievements

Creeper Killer

Creeper Killer (4/8)

7

Reputation

  1. 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.
  2. 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.
  3. I really am not sure how this differs from the enchanting table in a meaningful way
  4. 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); } }
  5. 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.
  6. 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.
  7. 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.
  8. 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); }
  9. 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.
  10. 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); } }
  11. 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.
  12. 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.
  13. 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.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.