The Bug:
Pay close attention to the block inside as it gets bigger, it appears to get bigger in a corner direction instead of centered on the block.
Steps to Reproduce:
Switch into creative mode, place down an activator rail and ensure that it's powered.
Place a TNT minecart on the activator rail and watch how the TNT swells from above.
Take note as to whether or not TNT in TNT minecarts swells in offset directions.
Observed Behavior:
TNT in TNT minecarts swells in offset directions.
Expected Behavior:
TNT in TNT minecarts would not swell in offset directions. Instead, it should swell according to the center of the block and not the corner.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Related issues
relates to
Attachments
Comments


Affects 20w45a
Relates to MC-85241
Can confirm in 21w05b.
Can confirm in 21w06a.
Can confirm in 21w13a.
Can confirm in 21w14a.

Affects 1.17
Can confirm in 1.17.1.

Affects 21w40a
Can confirm this in 1.18 Pre-release 1. Here are some extra details regarding this problem.
The Bug:
TNT in TNT minecarts swells in offset directions.
Steps to Reproduce:
Switch into creative mode, place down an activator rail and ensure that it's powered.
Place a TNT minecart on the activator rail and watch how the TNT swells from above.
Take note as to whether or not TNT in TNT minecarts swells in offset directions.
Observed Behavior:
TNT in TNT minecarts swells in offset directions.
Expected Behavior:
TNT in TNT minecarts would not swell in offset directions. Instead, it should swell according to the center of the block and not the corner.

Can confirm in 1.18 Pre-release 2.

Affects 1.18
Can confirm in 1.18.2 and 22w16b.
Can confirm in 1.19.
Can confirm in 1.19.2.

Can confirm in 1.19.3
It would be of great help if you could attach this code analysis as it provides useful information for fixing this bug:
This bug happens because the Block rendered inside scales its model at ignition in the wrong order. At "TntMinecartRenderer.java
" method "renderMinecartContents()
" the renderer gets the fuse of the Tnt inside the minecart to scale the block, but the problem is that in the super class "MinecartRenderer.java
", after scaling the block to 75% of its size but before calling "renderMinecartContents
" it translates (moves) the render pose, causing "TntMinecartRenderer
" to scale the already translated pose, making the swelling block look offset.
The way I propose to fix this would be by creating a new method (I called it "scaleMinecartContents
") in "MinecartRenderer
" that scales the minecart contents that will be rendered so "TntMinecartRenderer" could be able to scale it on the proper order, similarly to "scale(MinecartTNT, PoseStack, float)
" in class "LivingEntityRenderer.java
". Here is the example:
//At MinecartRenderer.java
@Override
public void render(T p_115418_, float p_115419_, float p_115420_, PoseStack p_115421_, MultiBufferSource p_115422_, int p_115423_) {
//start of modified code...
int j = p_115418_.getDisplayOffset();
BlockState blockstate = p_115418_.getDisplayBlockState();
if (blockstate.getRenderShape() != RenderShape.INVISIBLE) {
p_115421_.pushPose();
this.scaleMinecartContents(p_115418_, p_115421_, p_115420_);//scale minecart contents in a different method
p_115421_.translate(-0.5F, (float)(j - 8) / 16.0F, 0.5F);
p_115421_.mulPose(Axis.YP.rotationDegrees(90.0F));
this.renderMinecartContents(p_115418_, p_115420_, blockstate, p_115421_, p_115422_, p_115423_);
p_115421_.popPose();
}
//...end of modified code
}
/* scale contents on a different method so TntMinecartRenderer can re-scale them properly */
protected void scaleMinecartContents(T p_115314_, PoseStack p_115315_, float p_115316_) {
p_115315_.scale(0.75F, 0.75F, 0.75F);
}
//At TntMinecartRenderer.java
@Override
protected void renderMinecartContents(MinecartTNT p_116151_, float p_116152_, BlockState p_116153_, PoseStack p_116154_, MultiBufferSource p_116155_, int p_116156_) {
int i = p_116151_.getFuse();
//Removed swell scaling from here
renderWhiteSolidBlock(this.blockRenderer, p_116153_, p_116154_, p_116155_, p_116156_, i > -1 && i / 5 % 2 == 0);
}
@Override
/* scale contents with default scale and swell scaling */
protected void scaleMinecartContents(MinecartTNT p_115314_, PoseStack p_115315_, float p_115316_) {
super.scaleMinecartContents(p_115314_, p_115315_, p_115316_);//Use default block scaling in minecarts
int i = p_115314_.getFuse();
if (i > -1 && (float)i - p_115316_ + 1.0F < 10.0F) {//this is the same swell scaling that was in renderMinecartContents:
float f = 1.0F - ((float)i - p_115316_ + 1.0F) / 10.0F;
f = Mth.clamp(f, 0.0F, 1.0F);
f *= f;
f *= f;
float f1 = 1.0F + f * 0.3F;
p_115315_.scale(f1, f1, f1);
}
}
Can confirm in 1.20.3
[media]