Started by
Sir_sassypants
on
Topic category: Help with MCreator software
I was messing around with some java (pretty new, meaning to learn), but in the code for structures I found this:
int i = ci + random.nextInt(16);
int k = ck + random.nextInt(16);
int j = world.getHeight(Heightmap.Type.OCEAN_FLOOR_WG, i, k);
j -= 1;
This looks like some code that finds the surface of the x z co-ordinates (i, k). Could I hook this up to a teleporting procedure that will teleport you somewhere else but on the surface?
If I can, what else do I need to add? There are a few variables that I might need to state and also some imports that I don't know the name of.
Edit: Maybe something like this:
int x = dependencies.get("x") instanceof Integer ? (int) dependencies.get("x") : (double) dependencies.get("x");
int z = dependencies.get("z") instanceof Integer ? (int) dependencies.get("z") : (double) dependencies.get("z");
int y = world.getHeight(Heightmap.Type.OCEAN_FLOOR_WG, x, z);
y -= 1;
// Maybe do something like this (obviously this bit isn't java)
// tp Event/Target entity to surface using (x) (z)
// if block there isn't air: x + 1, z + 1
// repeat
Edited by Sir_sassypants on Thu, 01/07/2021 - 03:21