ValkyrienSkies / Valkyrien-Skies-2

Valkyrien Skies 2
https://valkyrienskies.org/
GNU Lesser General Public License v3.0
227 stars 99 forks source link

Item entity and primed TNT velocity aren't calculated correctly when fired from dispenser/dropper on moving ship #887

Open Spongebosch opened 4 months ago

Spongebosch commented 4 months ago

This issue occurs when only Valkyrien Skies and addons are installed and no other mods

Minecraft Version

1.18

Mod Loader

Forge

Issue description

I would expect the speed of an item entity and TNT entity when spawned with a dispenser and/or dropper on a moving ship to be the speed of the ship + the initial speed of the entity. For an item, this would mean that I expect the item to be essentially stationary relative to the moving ship, behaving as though the ship wasn't moving at all. I would expect the same sort of behavior for primed TNT entities.

However, what does happen is that the items shoot forward with incredible speed, moving much faster than the ship. The items are not falling out behind the ship, but maintaining the correct direction vector but with a much larger magnitude than should be. TNT entities don't have nearly as much momentum coming out, but they still have extra speed. This becomes apparent when the ship is moving very fast or is spinning with lots of speed when the dispenser is activated.

This doesn't happen with projectiles. Neither eggs, snowballs, arrows, splash potions, lingering potions, fireballs, or fireworks seem to suffer from any issue here. They all have their initial velocity + the speed of the ship. However, mobs spawned from spawn eggs on the ship don't seem to have any of the ship velocity imparted on them, and instead just phase through blocks.

1.18 - Item entities https://discord.com/channels/244934352092397568/1256897154669346817/1257078565699325962

The only footage I took of the TNT behaving weirdly is from a 1.20 mod pack, but I've tested it in the above version and it behaves the same in all. It would appear that this issue likely affects all versions of the mod and is not caused in 1.20.1 by mere compatibility issues.

1.16 - Item entities https://discord.com/channels/244934352092397568/1256897154669346817/1256901184430669965

1.20.1 - Item entities https://discord.com/channels/244934352092397568/1256897154669346817/1256897595951939617

1.20.1 - TNT phasing through blocks https://discord.com/channels/244934352092397568/1088199254658523289/1256869927202328606

Issue reproduction

You can see how I've built the ship in those Discord links I've posted. It's fairly simple: just accelerate the ship to any speed above zero and use a dispenser or dropper to spawn in an item entity. The entity will fly off in the direction of travel with great speed. As I've said, it's harder to notice for TNT because the TNT doesn't get nearly the same insane speed boost, but it still suffers from the same issue. If you place a dispenser on the front of the ship while it's moving at 15 m/s, the TNT will fly forward a few blocks too much. When the ship is moving at speeds around 30 m/s, the TNT will travel fast enough to start phasing through blocks. You can also notice the incorrect behavior when spinning; angular velocity is also applied incorrectly. If you build a long ship and start spinning it with dispensers/droppers at the end, items and TNT entities fly out too fast.

It's not difficult to reproduce.

Logs

No response