Created
August 19, 2021 21:22
-
-
Save hube12/4dd1f5fda6fdd402058a57a830a31610 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package neil; | |
import kaptainwutax.featureutils.structure.DesertPyramid; | |
import kaptainwutax.featureutils.structure.RegionStructure; | |
import kaptainwutax.featureutils.structure.device.StructureDevice; | |
import kaptainwutax.featureutils.structure.device.node.UniformNode; | |
import kaptainwutax.mcutils.rand.ChunkRand; | |
import kaptainwutax.mcutils.util.pos.CPos; | |
import kaptainwutax.mcutils.util.pos.RPos; | |
import kaptainwutax.mcutils.version.MCVersion; | |
import java.util.Random; | |
public class StructureDeviceExample { | |
public static final DesertPyramid DESERT_PYRAMID = new DesertPyramid(MCVersion.v1_16); | |
public static final RegionStructure<?, ?> CURRENT_STRUCTURE = DESERT_PYRAMID; | |
public static void main(String[] args) { | |
StructureDevice structureDevice = new StructureDevice(); | |
CPos[] coords = generateDate(42); | |
for (CPos coord : coords) { | |
RPos rPos = coord.toRegionPos(DESERT_PYRAMID.getSpacing()); | |
structureDevice.addBranch( | |
UniformNode.node(DESERT_PYRAMID.getConfig(), rPos.getX(), rPos.getZ(), | |
((x, z, mask, parent) -> x == (coord.getX() & mask) && z == (coord.getZ() & mask)) | |
) | |
); | |
} | |
structureDevice.findSeeds(System.out::println, 0); | |
} | |
public static CPos[] generateDate(long structureSeed) { | |
CPos[] res = new CPos[10]; | |
ChunkRand rand = new ChunkRand(); | |
for (int i = 0; i < 10; i++) { | |
RPos rpos = getRandomRPos(); | |
res[i] = DESERT_PYRAMID.getInRegion(structureSeed, rpos.getX(), rpos.getZ(), rand); | |
} | |
return res; | |
} | |
public static RPos getRandomRPos() { | |
Random random = new Random(); | |
return new RPos(random.nextInt(10000) - 5000, random.nextInt(10000) - 5000, DESERT_PYRAMID.getSpacing()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment