44 | *
Theory:
45 | *
For up to 2*maximum_tries pick a random spot in the spawn zone do:
46 | *
Check the 5x5x5 region around that spot for the fluid:
47 | *
if found, store the BlockPos of the fluid, if this store has reached maximum_tries entries, stop iteration
48 | *
For each of the found positions, if any, seek up and down from the position to find the lower bound of the fluid
49 | *
At the fluids lower bound, generate the node.
50 | *
51 | *
52 | * @param world {@link net.minecraft.world.World} World this chunk is in
53 | * @param chunkGenerator {@link net.minecraft.world.gen.IChunkGenerator} Chunk generator for this chunk
54 | * @param chunkProvider {@link net.minecraft.world.chunk.IChunkProvider} Chunk provider for this chunk
55 | * @param spawnData {@link com.mcmoddev.orespawn.api.os3.ISpawnEntry} Parameters and data on this spawn from the configuration file
56 | * @param chunkPos {@link net.minecraft.util.math.ChunkPos} Absolute in-world coordinates, on the chunk grid, for this chunk (can get lowest value X/Z block coordinates for this chunk by multiplying provided X/Z by 16)
57 | * @see com.mcmoddev.orespawn.api.IFeature#generate(net.minecraft.world.World, net.minecraft.world.gen.IChunkGenerator, net.minecraft.world.chunk.IChunkProvider, com.mcmoddev.orespawn.api.os3.ISpawnEntry, net.minecraft.util.math.ChunkPos)
58 | */
59 | @Override
60 | public void generate(final World world, final IChunkGenerator chunkGenerator,
61 | final IChunkProvider chunkProvider, final ISpawnEntry spawnData, final ChunkPos chunkPos) {
62 | final ChunkPos pos = chunkPos;
63 | final JsonObject params = spawnData.getFeature().getFeatureParameters();
64 |
65 | // First, load cached blocks for neighboring chunk ore spawns
66 | final int chunkX = pos.x;
67 | final int chunkZ = pos.z;
68 |
69 | mergeDefaults(params, getDefaultParameters());
70 |
71 | runCache(chunkX, chunkZ, world, spawnData);
72 |
73 | // now to ore spawn
74 |
75 | final int blockX = chunkX * 16 + 8;
76 | final int blockZ = chunkZ * 16 + 8;
77 |
78 |
79 | final int minHeight = params.get(Constants.FormatBits.MIN_HEIGHT).getAsInt();
80 | final int maxHeight = params.get(Constants.FormatBits.MAX_HEIGHT).getAsInt();
81 | final int variance = params.get(Constants.FormatBits.VARIATION).getAsInt();
82 | final int triesMin = params.get(Constants.FormatBits.ATTEMPTS_MIN).getAsInt();
83 | final int triesMax = params.get(Constants.FormatBits.ATTEMPTS_MAX).getAsInt();
84 | final int nodeSize = params.get(Constants.FormatBits.NODE_SIZE).getAsInt();
85 | final Fluid fluid = FluidRegistry.getFluid(params.get(Constants.FormatBits.FLUID).getAsString());
86 |
87 | int tries = this.random.nextInt(triesMax - triesMin + 1) + triesMin;
88 | int ySpan = maxHeight - minHeight;
89 | int surveySize = ((256 * (16 * ySpan)) / 4) / 125;
90 | BlockPos refBlock = new BlockPos(blockX, minHeight, blockZ);
91 | Block fluidBlock = fluid.getBlock();
92 |
93 | Set