Purpur icon indicating copy to clipboard operation
Purpur copied to clipboard

Add a setting to retain projectile owner after hit when owner is disconnected

Open Lemonzyy opened this issue 7 months ago • 9 comments

After building a wireless-activated teleporter on a Purpur server, my friends and I noticed that the teleporter stopped working after re-logging into the server. Interestingly, this mechanism functions correctly in Vanilla Minecraft.

Upon digging into the issue, I discovered that the Owner property of the arrow disappears when the owner logs out. This happens because the arrow continuously collides with an entity (specifically, a wind charge), and due to a fix implemented in Paper, the Owner is set to null when the owner is disconnected from the server.

I introduced a configuration option under gameplay-mechanics.retain-projectile-owner-on-hit-if-owner-offline. When enabled, this option prevents the projectile from losing its owner upon hitting an entity while the owner is offline, thereby restoring the expected behavior and ensuring compatibility with redstone contraptions that rely on projectile ownership.

Lemonzyy avatar May 27 '25 23:05 Lemonzyy

I don't see any major issues, granny or trouble will need to do a full review

If you haven't already, also make a PR to add the new option to the purpur documentation :3

RhythmicSys avatar May 28 '25 00:05 RhythmicSys

I'm AFK, I will do it tomorrow :)

Lemonzyy avatar May 28 '25 00:05 Lemonzyy

@Lemonzyy Can you link the paper patch that supposedly causes the owner to be removed?

YouHaveTrouble avatar May 28 '25 07:05 YouHaveTrouble

@YouHaveTrouble On paper-archive it is patches/server/0803-Refresh-ProjectileSource-for-projectiles.patch.

Lemonzyy avatar May 28 '25 07:05 Lemonzyy

Maybe you can also pr this to paper as an unsupported-setting? i think they would accept this if it breaks vanilla in some way

Toffikk avatar May 28 '25 07:05 Toffikk

Looks like this was the original PR that added the lines you're changing: https://github.com/PaperMC/Paper/pull/9715

That area of the code changed in 1.21.6. Looks like the issue you were running into now happens on vanilla 1.21.6 as well (needs more testing).

granny avatar Jun 25 '25 03:06 granny

Yeah, the issue you're trying to solve now exists on vanilla 1.21.6 (and 1.21.7) as well. I've found two tickets on mojira about it but no confirmation from mojang: MC-299067 & MC-299115

granny avatar Jun 30 '25 18:06 granny

If projectile ownership loss is the correct behavior on Vanilla, I think that there's no need to add my feature. We will have to wait and see.

Lemonzyy avatar Jul 02 '25 22:07 Lemonzyy

I feel like it's an oversight on mojang/paper tbh

I think this could still be "fixed" in a different way that doesn't change the same area of the code

granny avatar Jul 03 '25 01:07 granny