mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Added OreGeneration, New generation mode
This commit is contained in:
parent
824f74a4ce
commit
44beeec1d7
@ -21,6 +21,8 @@ package com.volmit.iris.engine.actuator;
|
|||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineAssignedActuator;
|
import com.volmit.iris.engine.framework.EngineAssignedActuator;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
@ -76,16 +78,20 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
|||||||
*/
|
*/
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
public void terrainSliver(int x, int z, int xf, Hunk<BlockData> h) {
|
public void terrainSliver(int x, int z, int xf, Hunk<BlockData> h) {
|
||||||
|
//
|
||||||
int zf, realX, realZ, hf, he;
|
int zf, realX, realZ, hf, he;
|
||||||
IrisBiome biome;
|
IrisBiome biome;
|
||||||
|
IrisRegion region;
|
||||||
|
|
||||||
for (zf = 0; zf < h.getDepth(); zf++) {
|
for (zf = 0; zf < h.getDepth(); zf++) {
|
||||||
realX = xf + x;
|
realX = xf + x;
|
||||||
realZ = zf + z;
|
realZ = zf + z;
|
||||||
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
|
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
|
||||||
|
region = getComplex().getRegionStream().get(realX, realZ);
|
||||||
he = (int) Math.round(Math.min(h.getHeight(), getComplex().getHeightStream().get(realX, realZ)));
|
he = (int) Math.round(Math.min(h.getHeight(), getComplex().getHeightStream().get(realX, realZ)));
|
||||||
hf = Math.round(Math.max(Math.min(h.getHeight(), getDimension().getFluidHeight()), he));
|
hf = Math.round(Math.max(Math.min(h.getHeight(), getDimension().getFluidHeight()), he));
|
||||||
|
|
||||||
|
// this 0 is where we are going to need to modify the world base height, the Zero, not this instance...
|
||||||
if (hf < 0) {
|
if (hf < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -94,11 +100,13 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
|||||||
KList<BlockData> fblocks = null;
|
KList<BlockData> fblocks = null;
|
||||||
int depth, fdepth;
|
int depth, fdepth;
|
||||||
|
|
||||||
|
// Fluid height and lower
|
||||||
for (int i = hf; i >= 0; i--) {
|
for (int i = hf; i >= 0; i--) {
|
||||||
if (i >= h.getHeight()) {
|
if (i >= h.getHeight()) { // h.getheight is terrain height
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// will need to change
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (getDimension().isBedrock()) {
|
if (getDimension().isBedrock()) {
|
||||||
h.set(xf, i, zf, BEDROCK);
|
h.set(xf, i, zf, BEDROCK);
|
||||||
@ -123,6 +131,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// top of surface
|
||||||
if (i <= he) {
|
if (i <= he) {
|
||||||
depth = he - i;
|
depth = he - i;
|
||||||
if (blocks == null) {
|
if (blocks == null) {
|
||||||
@ -133,13 +142,23 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
|
|||||||
getComplex());
|
getComplex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (blocks.hasIndex(depth)) {
|
if (blocks.hasIndex(depth)) {
|
||||||
h.set(xf, i, zf, blocks.get(depth));
|
h.set(xf, i, zf, blocks.get(depth));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BlockData ore = biome.generateOres(realX, i, realZ, rng, getData());
|
||||||
|
ore = ore == null ? region.generateOres(realX, i, realZ, rng, getData()) : ore;
|
||||||
|
ore = ore == null ? getDimension().generateOres(realX, i, realZ, rng, getData()) : ore;
|
||||||
|
|
||||||
|
if (ore != null) {
|
||||||
|
h.set(xf, i, zf, ore);
|
||||||
|
} else {
|
||||||
h.set(xf, i, zf, getComplex().getRockStream().get(realX, realZ));
|
h.set(xf, i, zf, getComplex().getRockStream().get(realX, realZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import com.volmit.iris.engine.modifier.IrisPerfectionModifier;
|
|||||||
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
|
||||||
public class ModeOverworld extends IrisEngineMode implements EngineMode {
|
public class ModeOverworld extends IrisEngineMode implements EngineMode {
|
||||||
public ModeOverworld(Engine engine) {
|
public ModeOverworld(Engine engine) {
|
||||||
super(engine);
|
super(engine);
|
||||||
|
@ -83,6 +83,8 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
|
|
||||||
positions.computeIfAbsent(Cache.key(rx, rz), (k) -> new KList<>()).qadd(yy);
|
positions.computeIfAbsent(Cache.key(rx, rz), (k) -> new KList<>()).qadd(yy);
|
||||||
|
|
||||||
|
//todo: Fix chunk decoration not working on chunk's border
|
||||||
|
|
||||||
if (rz < 15 && mantle.get(xx, yy, zz + 1, MatterCavern.class) == null) {
|
if (rz < 15 && mantle.get(xx, yy, zz + 1, MatterCavern.class) == null) {
|
||||||
walls.put(new IrisPosition(rx, yy, rz + 1), c);
|
walls.put(new IrisPosition(rx, yy, rz + 1), c);
|
||||||
}
|
}
|
||||||
|
@ -178,6 +178,24 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
@Desc("Define biome deposit generators that add onto the existing regional and global deposit generators")
|
@Desc("Define biome deposit generators that add onto the existing regional and global deposit generators")
|
||||||
private KList<IrisDepositGenerator> deposits = new KList<>();
|
private KList<IrisDepositGenerator> deposits = new KList<>();
|
||||||
private transient InferredType inferredType;
|
private transient InferredType inferredType;
|
||||||
|
@Desc("Collection of ores to be generated")
|
||||||
|
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
||||||
|
private KList<IrisOreGenerator> ores = new KList<>();
|
||||||
|
|
||||||
|
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||||
|
if (ores.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BlockData b = null;
|
||||||
|
for (IrisOreGenerator i : ores) {
|
||||||
|
|
||||||
|
b = i.generate(x,y,z,rng,data);
|
||||||
|
if(b != null ){
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public Biome getVanillaDerivative() {
|
public Biome getVanillaDerivative() {
|
||||||
return vanillaDerivative == null ? derivative : vanillaDerivative;
|
return vanillaDerivative == null ? derivative : vanillaDerivative;
|
||||||
|
@ -221,6 +221,24 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("water");
|
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("water");
|
||||||
@Desc("Cartographer map trade overrides")
|
@Desc("Cartographer map trade overrides")
|
||||||
private IrisVillagerOverride patchCartographers = new IrisVillagerOverride().setDisableTrade(false);
|
private IrisVillagerOverride patchCartographers = new IrisVillagerOverride().setDisableTrade(false);
|
||||||
|
@Desc("Collection of ores to be generated")
|
||||||
|
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
||||||
|
private KList<IrisOreGenerator> ores = new KList<>();
|
||||||
|
|
||||||
|
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||||
|
if (ores.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BlockData b = null;
|
||||||
|
for (IrisOreGenerator i : ores) {
|
||||||
|
|
||||||
|
b = i.generate(x,y,z,rng,data);
|
||||||
|
if(b != null ){
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public KList<Position2> getStrongholds(long seed) {
|
public KList<Position2> getStrongholds(long seed) {
|
||||||
return strongholdsCache.aquire(() -> {
|
return strongholdsCache.aquire(() -> {
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.noise.CNG;
|
||||||
|
import jdk.jfr.Description;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Desc("Ore Layer")
|
||||||
|
@Data
|
||||||
|
public class IrisOreGenerator {
|
||||||
|
@Desc("The palette of 'ore' generated")
|
||||||
|
private IrisMaterialPalette palette = new IrisMaterialPalette().qclear();
|
||||||
|
@Desc("The generator style for the 'ore'")
|
||||||
|
private IrisGeneratorStyle chanceStyle = new IrisGeneratorStyle(NoiseStyle.STATIC);
|
||||||
|
@Desc("Will ores generate on the surface of the terrain layer")
|
||||||
|
private boolean generateSurface = false;
|
||||||
|
@Desc("Threshold for rate of generation")
|
||||||
|
private double threshold = 0.5;
|
||||||
|
@Desc("Height limit (min, max)")
|
||||||
|
private IrisRange range = new IrisRange(30, 80);
|
||||||
|
|
||||||
|
private transient AtomicCache<CNG> chanceCache = new AtomicCache<>();
|
||||||
|
|
||||||
|
public BlockData generate(int x, int y, int z, RNG rng, IrisData data){
|
||||||
|
if(palette.getPalette().isEmpty()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!range.contains(y)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
CNG chance = chanceCache.aquire(() -> chanceStyle.create(rng, data));
|
||||||
|
|
||||||
|
if (chance.noise(x,y,z ) > threshold){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return palette.get( rng, x,y,z, data);
|
||||||
|
}
|
||||||
|
}
|
@ -44,6 +44,7 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -176,6 +177,24 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
|||||||
private double riverThickness = 0.1;
|
private double riverThickness = 0.1;
|
||||||
@Desc("A color for visualizing this region with a color. I.e. #F13AF5. This will show up on the map.")
|
@Desc("A color for visualizing this region with a color. I.e. #F13AF5. This will show up on the map.")
|
||||||
private String color = null;
|
private String color = null;
|
||||||
|
@Desc("Collection of ores to be generated")
|
||||||
|
@ArrayType(type = IrisOreGenerator.class, min = 1)
|
||||||
|
private KList<IrisOreGenerator> ores = new KList<>();
|
||||||
|
|
||||||
|
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||||
|
if (ores.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
BlockData b = null;
|
||||||
|
for (IrisOreGenerator i : ores) {
|
||||||
|
|
||||||
|
b = i.generate(x,y,z,rng,data);
|
||||||
|
if(b != null ){
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user