Povstalec / StargateJourney

A repository for the Stargate Journey Minecraft Mod
44 stars 23 forks source link

[Suggestion] Allow moving stargates with Create mod #16

Open slava110 opened 1 year ago

slava110 commented 1 year ago

2023-09-25_20 20 44 Not sure how hard this would be to implement but it would be awesome IMO. With that modpack makers will be able to make stargate unbreakable but actually movable. Canonically accurate 😉

Povstalec commented 1 year ago

I admit it would definitely be cool. First I'd need to learn how Create works internally with how it moves blocks, because there's a lot of stuff that just breaks functionality when moving a Stargate.

So yeah, hypothetically possible, but I doubt I'll be able to learn a system as complex as Create anytime soon.

slava110 commented 1 year ago

I'm asking Create devs about that. ~~But, I guess, you can mixin here: https://github.com/Creators-of-Create/Create/blob/2e1bcdb6198d4eeb294b63511df339125a14f903/src/main/java/com/simibubi/create/content/contraptions/Contraption.java#L301 And add custom block movement check if needed here: https://github.com/Creators-of-Create/Create/blob/2e1bcdb6198d4eeb294b63511df339125a14f903/src/main/java/com/simibubi/create/content/contraptions/BlockMovementChecks.java~~ UPD: Just add check in https://github.com/Creators-of-Create/Create/blob/2e1bcdb6198d4eeb294b63511df339125a14f903/src/main/java/com/simibubi/create/content/contraptions/BlockMovementChecks.java .

To make multiblock movable. Would be already awesome for modpacks c:

And if you want to keep stargate active while it's on contraption... Maybe custom movement behaviour will help? (here you can see how to affect entities while on contraption (in the example it's damaging entities but you can probably teleport them too): https://github.com/Creators-of-Create/Create/blob/2e1bcdb6198d4eeb294b63511df339125a14f903/src/main/java/com/simibubi/create/content/kinetics/base/BlockBreakingMovementBehaviour.java#L42) Also you can ask Create devs in their Discord to get more information (devchat channel): https://discord.gg/37DrvGZFeZ

Povstalec commented 1 year ago

Thanks for the info.

Unfortunately, it's not just moving multiple blocks together.

First problem entirety of the Stargate Network would need rewriting as it's based on finding saved block entity positions, which (as of now) only ever change the first time the block is placed, because it's just really hard to track a moving block across different dimensions when all you know about it is a 8 numbers that form an address.

Second one is that it's using a custom block rotation system that would just completely break with non-90 degree angles.

Thirdly, yes, while teleporting entities the same way as damaging them is possible, a Stargate Wormhole first checks if the entity's motion vector is likely to end up on its other side and then remembers all of its rotation and momentum and applies transformations to it in order to preserve the momentum and rotation relative to the gate. This whole detection system is also based on a box which, you guessed it, is also not made to be rotated.

So yeah, while block-wise it might be as simple as poking around and asking the devs, it's certainly gonna take a lot more than that to have everything else actually functional. Hopefully I'll be able to add some sort of compatibility in a few months, but I can make no promises.