Command17 Posted March 5, 2023 Posted March 5, 2023 (edited) I'm currently making a tnt mod and trying to add custom tnt but the renderer renders the wrong texture (TNT). TNT Renderer (Most is copied over from vanilla): Reveal hidden contents public class PrimedFireworkTNTEntityRenderer extends EntityRenderer<PrimedFireworkTNT> { private final BlockRenderDispatcher blockRenderer; public PrimedFireworkTNTEntityRenderer(EntityRendererProvider.Context context) { super(context); this.shadowRadius = 0.5f; this.blockRenderer = context.getBlockRenderDispatcher(); } @Override public void render(PrimedFireworkTNT primedFireworkTNT, float entityYaw, float partialTicks, PoseStack stack, MultiBufferSource multiBufferSource, int packedLightIn) { stack.pushPose(); stack.translate(0.0F, 0.5F, 0.0F); int i = primedFireworkTNT.getFuse(); if (i - partialTicks + 1.0F < 10.0F) { float f = 1.0F - ((float) i - partialTicks + 1.0F) / 10.0F; f = Mth.clamp(f, 0.0f, 1.0f); f *= f; f *= f; float f1 = 1.0f + f * 0.3f; stack.scale(f1, f1, f1); } stack.mulPose(Axis.YP.rotationDegrees(-90.0F)); stack.translate(-0.5F, -0.5F, 0.5F); stack.mulPose(Axis.YP.rotationDegrees(90.0F)); TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Register.FIREWORK_TNT.get().defaultBlockState(), stack, multiBufferSource, packedLightIn, i / 5 % 2 == 0); stack.popPose(); super.render(primedFireworkTNT, entityYaw, partialTicks, stack, multiBufferSource, packedLightIn); } @Override public ResourceLocation getTextureLocation(PrimedFireworkTNT primedFireworkTNT) { return TextureAtlas.LOCATION_BLOCKS; } } TNT Entity: Reveal hidden contents public class PrimedFireworkTNT extends PrimedTnt { public PrimedFireworkTNT(EntityType<? extends PrimedTnt> type, Level level) { super(type, level); } public PrimedFireworkTNT(Level level, double x, double y, double z, @Nullable LivingEntity owner) { super(level, x, y, z, owner); } @Override protected void explode() { this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 1.0f, Level.ExplosionInteraction.TNT); } } The render is registered to the TNT Entity. Would be nice if someone could help. Thanks Edited March 5, 2023 by Command17 Quote
Command17 Posted March 5, 2023 Author Posted March 5, 2023 I fixed it. I needed to overrite a method in the entity class. Quote
DontNeg Posted June 15, 2023 Posted June 15, 2023 On 3/5/2023 at 10:46 AM, Command17 said: I fixed it. I needed to overrite a method in the entity class. Expand What method did you override for it to use your custom model instead of normal tnt? I'm having the same problem and it won't change no matter what I do. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.