jensvh / litematica-printer

Creative Commons Zero v1.0 Universal
8 stars 2 forks source link

Fix hardcoded things and add functionality to limit printer acting Y range #1

Closed aria1th closed 3 years ago

aria1th commented 3 years ago

Will cause a lot less lag while building big things Will allow any world height (in theory)

jensvh commented 3 years ago

This looks great! Just a little question, in the commit: Refers to world heights automatically you've created a new variable for the world, any reasons for doing so? Since you can access the world through the MinecraftClient parameter.

aria1th commented 3 years ago

Well I'm new at java so actually wanted static integer topY and bottomY, but it failed to do in static scope (?) because world.getTopY() and world.getBottomY() was not static(?), so I just made it work...

It would be much nicer if it can have just fixed world Y value references, and not refer to world every time

jensvh commented 3 years ago

That would be nice. I think the best solution is to create a static variable bottomY and topY (e.g. in the printer class). Then change these values every time a (new) world is loaded. As the height limit in the overworld could be different from the height limit in the nether. Your current implementation saves the first loaded world in a variable, whenever you change to a different world (nether, end, other server) it won't update the variable world unfortunately.

aria1th commented 3 years ago

okay, I built it without that world line and it worked hmm, but having two limit check is kinda messy so maybe its better to let player do config.. or setting up individual config for dimensions. I was trying to avoid NPE and it was enough with schematicWorld.getbottonY() / getTopY()

jensvh commented 3 years ago

That should do. Thanks!

jensvh commented 3 years ago

I've just made a commit (cb39dd3f258e2f1d9e58b1802fab0ed4616692dc). It should now automatically grab the build limits once (when a world is loaded).