mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-05 15:26:28 +00:00
Added OreGeneration, New generation mode
This commit is contained in:
@@ -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")
|
||||
private KList<IrisDepositGenerator> deposits = new KList<>();
|
||||
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() {
|
||||
return vanillaDerivative == null ? derivative : vanillaDerivative;
|
||||
|
||||
@@ -221,6 +221,24 @@ public class IrisDimension extends IrisRegistrant {
|
||||
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("water");
|
||||
@Desc("Cartographer map trade overrides")
|
||||
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) {
|
||||
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.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Random;
|
||||
@@ -176,6 +177,24 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
||||
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.")
|
||||
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() {
|
||||
return name;
|
||||
|
||||
Reference in New Issue
Block a user