TelepathicGrunt / StructureTutorialMod

A short example showing how to register a structure and get it to generate in all biomes in NeoForge, Forge, and Fabric! (check the branches)
MIT License
264 stars 29 forks source link

Question: forced structure rotation #27

Closed Quatryl23 closed 5 months ago

Quatryl23 commented 5 months ago

Is there a way to force the rotation of structures? I make a datapack but there is no json argument for rotation. But if my structures are rotated, they contain glitched blocks like the Create mod train track which can´t really rotate. The only solution would be disabling rotation of the structure.

TelepathicGrunt commented 5 months ago

I think the best ideal solution is report the issue to the create devs and ask them to fix their block rotation. That’s ultimately a mod issue. The rotation is randomly chosen within the jigsaw piece generator code which is not easy to adjust.

Quatryl23 commented 5 months ago

Thank you for your quick answer. I reported the issue and hope they'll fix it.

Quatryl23 commented 5 months ago

Sorry to disturb again, but unfortunately, they seem to not fix this soon and when I set my mind to something, I'm determined to see it through. So I found your answer at r/feedthebeast and clicked the link where you said "Or you can copy the JigsawPlacement.addPieces method and just remove the start piece rotation part of it". I skimmed the code, although I don't really know how Java works, but I didn't see something like "start piece rotation" Would you mind explaining that?

TelepathicGrunt commented 5 months ago

It's the line that is getting a random rotation in jigsawPlacement's addPieces method. But requires copying the whole method to your own code and setting the rotation to a specific kind. image

Quatryl23 commented 5 months ago

Which file is that?

TelepathicGrunt commented 5 months ago

net\minecraft\world\level\levelgen\structure\pools\JigsawPlacement.java

Quatryl23 commented 5 months ago

I can´t find it

TelepathicGrunt commented 5 months ago

What Minecraft version are you on and are you using yarn mappings?

(This class is what SkyStructure Java file is calling for creating the piece layout)

Quatryl23 commented 5 months ago

Minecraft Version 1.20.1 with Forge Modpack

Quatryl23 commented 5 months ago

Unbenannt

Quatryl23 commented 5 months ago

That´s the folder of the modpack

Quatryl23 commented 5 months ago

Unbenannt And this is the world folder I placed my datapack in

TelepathicGrunt commented 5 months ago

Uhh. This StructureTutorialMod is for modders. Not players or packmakers. What I was describing is something only a modder can do by writing custom code to change how a structure generates. A datapack has no ability to change direction of a structure.

TelepathicGrunt commented 5 months ago

A modder would have their own structure class and basically unwrap out this method and change the rotation for their structure type. Then call that structure type in their Structure json file. https://github.com/TelepathicGrunt/StructureTutorialMod/blob/187fc889b840f273bec64f9d811e8850b510afca/src/main/java/com/telepathicgrunt/structuretutorial/structures/SkyStructures.java#L118

This would have to be done by a modder since the mod will need to be compiled and ran to in order to work in production.

Quatryl23 commented 5 months ago

Ok, I thought it would be something easy to change in some files in addition to the datapack, but if I have to make a mod myself, then I think I can´t do it. thank you anyway for the help

TelepathicGrunt commented 5 months ago

Yeah it’s a limitation of the vanilla structure json system. Sorry about that