mojira.dev
MC-298743

TNT with 30 degree momentum will clip into blocks

If TNT happens to get a specific X and Z momentum when primed it can clip into nearby blocks. The angle that causes this problem depends on which side the moving blocks are.
Clip of the bug: https://www.twitch.tv/raysworks/clip/RelatedFunStarlingYouDontSay-FoAZNS3JOsLRlPTW

First 3 images of random TNT momentum. Doesn’t move with slime walls on the sides.
Next 3 images of specific TNT momentum which causes it to stick into the slime blocks side walls.

Setup in the nbt structure blocks link. 210 degree will make this setup tnt clip into the wall.

Attachments

Comments 13

We found out in stream, that this bug is directional, that means, in some directions, there are a different number of angles. If there’s another angle, it’s 330°, but the angles will rotate generally with the contraption

This bug happens in vanilla, but is very difficult to reproduce, because it happens only after approx. 100 hours. I made I mod that let’s you choose the exact angle the tnt chooses when it’s primed making this much more reproduceable. the formula to get the angle is:

(main * 65 + off) * 360° / (64 * 65 + 64)

depending on how many items there are in the hand and off hand.

[media]

We made a chart that lists every way this machine breaks here:

[media]

we haven’t found yet, why this bug is happening, maybe this will come in the future

I found the problem that causes this error. Entity dimensions are saved as floats and Boxes are saved as doubles. In this function in the class EntityDimensions (fabric translation):

public Box getBoxAt(double x, double y, double z) {
    float f = this.width / 2.0F;
    float g = this.height;
    return new Box(x - f, y, z - f, x + f, y + g, z + f);
}

there is an implicit conversation from float to double causing roughly this calculation (e.g.)

8.490000001261839 - (double) 0.98F / 2 = 7.999999991725096

which makes the tnt barely clip into the neighboring block

Please do not patch this bug.

While this behaviour may seem inconvenient, the Wargear community (competitive tnt cannons) has relied on this mechanic, known to use as float alignment for a long time. It enables precise and fast movement of tnt using pistons and slime, which is critical to the design and functionality of our cannons.

This mechanic is consistent, reproducible (aligning with pistons), and almost never affects standard gameplay. However, removing it would severely disrupt our creations and layouts, setting the entire community back significantly.

We respectfully ask for this feature to not be removed, because of the mayor disruption it would cause us in comparison to the very small inconvenience it causes for normal gameplay.

Float alignment is similar to QC in the sense that yes it’s technically a bug but it’s also super useful and relied upon by the TMC community, and the pros drastically outweigh the cons. Please consider giving it a similar treatment.

3 more comments

Would it be possible to instead re-roll the random angle if it’s one of the 8 that cause this issue? That would fix this problem without fixing the float alignment “feature” and make both parties happy.

First of all, this isn't necessarily a bug, its just a collision delta, and yes it is commonly used in redstone contraptions for all sorts of entity conveyors and even in compact piston doors (the ones with cart spam).

But you are right that it would be nice if entities' random momentum wasn't able to accidentlly reach such problematic values.
Iirc recently the angle distribution for item prime momentum was in fact changed from gaussian to triangle one, but apparently this is not enough. Just blacklisting certain values as suggested in comment above wont work, because there are too many of them (think of all reasonably possible entity falling paths, which lead to accidental float alignment), however, such a distribution might be achievable. If the devs are willing to change it, then im willing to find a distribution which will never reach such problematic values. Please contact me if interested.

I suggest rounding the random angle to like 1/100 of a circle, that should avoid these cases and make it possible to exhaustively check contraptions, without breaking float alignment
the actual problem here is that it is extremely rare event that doesn’t happen in a reasonable reliability test

Please do not remove this mechanic and only remove the problematic angles/values

Guys, we’re not completed with understanding how this bug works. We also found out that sometimes it’s not the float that’s problematic, but more the way the clipping is reversed. There is somehow a problem with that, because when it’s barely clipping, sometimes the clipping is not reversed. And to @Savvvage_ yes, it is possible to blacklist the ranges for every 30° arrangement that causes this bug, namely the range 29.99995° to 30.00032 (yes not symmetric, source: https://www.youtube.com/watch?v=f632VX1WxPw&t=375s ). If this is really going to be fixed that way, we would probably have to double check, the angles have the symmetry I tested with a single layout (namely: more weight to 90°).

Ray

(Unassigned)

Community Consensus

Platform

Low

Collision, Entities

1.21.5

Retrieved