mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
abandon ship
This commit is contained in:
parent
af0d282a1f
commit
6e1c4f682e
@ -33,6 +33,7 @@ import com.volmit.iris.engine.data.cache.AtomicCache;
|
|||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.*;
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
|
import com.volmit.iris.engine.object.matter.IrisMatterObject;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
|
@ -20,8 +20,7 @@ package com.volmit.iris.core.loader;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.engine.object.IrisMatterObject;
|
import com.volmit.iris.engine.object.matter.IrisMatterObject;
|
||||||
import com.volmit.iris.engine.object.IrisObject;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.data.KCache;
|
import com.volmit.iris.util.data.KCache;
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
|
||||||
* Copyright (c) 2022 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.ObjectResourceLoader;
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
@Snippet("matter-placer")
|
|
||||||
@EqualsAndHashCode()
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Desc("Represents an iris object placer. It places matter objects.")
|
|
||||||
@Data
|
|
||||||
public class IrisMatterPlacement {
|
|
||||||
@RegistryListResource(IrisMatterObject.class)
|
|
||||||
@Required
|
|
||||||
@ArrayType(min = 1, type = String.class)
|
|
||||||
@Desc("List of objects to place")
|
|
||||||
private KList<String> place = new KList<>();
|
|
||||||
}
|
|
@ -34,6 +34,8 @@ import com.volmit.iris.util.math.AxisAlignedBB;
|
|||||||
import com.volmit.iris.util.math.BlockPosition;
|
import com.volmit.iris.util.math.BlockPosition;
|
||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.matter.IrisMatter;
|
||||||
|
import com.volmit.iris.util.matter.Matter;
|
||||||
import com.volmit.iris.util.matter.MatterMarker;
|
import com.volmit.iris.util.matter.MatterMarker;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object.matter;
|
||||||
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
import com.volmit.iris.util.matter.IrisMatter;
|
import com.volmit.iris.util.matter.IrisMatter;
|
||||||
import com.volmit.iris.util.matter.Matter;
|
import com.volmit.iris.util.matter.Matter;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import jdk.jfr.DataAmount;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2022 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.matter;
|
||||||
|
|
||||||
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
|
import com.volmit.iris.engine.IrisEngine;
|
||||||
|
import com.volmit.iris.engine.object.IRare;
|
||||||
|
import com.volmit.iris.engine.object.IrisStyledRange;
|
||||||
|
import com.volmit.iris.engine.object.annotations.*;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.matter.MatterSlice;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Snippet("matter-placer")
|
||||||
|
@EqualsAndHashCode()
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Desc("Represents an iris object placer. It places matter objects.")
|
||||||
|
@Data
|
||||||
|
public class IrisMatterPlacement implements IRare {
|
||||||
|
@RegistryListResource(IrisMatterObject.class)
|
||||||
|
@Required
|
||||||
|
@ArrayType(min = 1, type = String.class)
|
||||||
|
@Desc("List of objects to place")
|
||||||
|
private KList<String> place = new KList<>();
|
||||||
|
|
||||||
|
@MinNumber(0)
|
||||||
|
@Desc("The rarity of this object placing")
|
||||||
|
private int rarity = 0;
|
||||||
|
|
||||||
|
@MinNumber(0)
|
||||||
|
@Desc("The styled density of this object")
|
||||||
|
private IrisStyledRange densityRange;
|
||||||
|
|
||||||
|
@Desc("The absolute density for this object")
|
||||||
|
private double density = 1;
|
||||||
|
|
||||||
|
@Desc("Translate this matter object before placement")
|
||||||
|
private IrisMatterTranslate translate;
|
||||||
|
|
||||||
|
@Desc("Place this object on the surface height, bedrock or the sky, then use translate if need be.")
|
||||||
|
private IrisMatterPlacementLocation location = IrisMatterPlacementLocation.SURFACE;
|
||||||
|
|
||||||
|
public void place(IrisEngine engine, IrisData data, RNG rng, int ax, int az)
|
||||||
|
{
|
||||||
|
IrisMatterObject object = data.getMatterLoader().load(place.getRandom(rng));
|
||||||
|
int x = ax;
|
||||||
|
int z = az;
|
||||||
|
int yoff = 0;
|
||||||
|
|
||||||
|
if(translate != null)
|
||||||
|
{
|
||||||
|
x += translate.xOffset(data, rng, x, z);
|
||||||
|
yoff += translate.yOffset(data, rng, x, z);
|
||||||
|
z += translate.zOffset(data, rng, x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
int y = yoff + location.at(engine, x, z);
|
||||||
|
Mantle mantle = engine.getMantle().getMantle();
|
||||||
|
|
||||||
|
int xx = x;
|
||||||
|
int yy = y;
|
||||||
|
int zz = z;
|
||||||
|
|
||||||
|
for(MatterSlice<?> slice : object.getMatter().getSliceMap().values())
|
||||||
|
{
|
||||||
|
slice.iterate((mx, my, mz, v) -> {
|
||||||
|
mantle.set(xx + mx, yy + my, zz + mz, v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.volmit.iris.engine.object.matter;
|
||||||
|
|
||||||
|
import com.volmit.iris.engine.IrisEngine;
|
||||||
|
import com.volmit.iris.util.function.Function3;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public enum IrisMatterPlacementLocation {
|
||||||
|
SURFACE((e, x, z) -> e.getHeight(x, z, true)),
|
||||||
|
SURFACE_ON_FLUID((e, x, z) -> e.getHeight(x, z, false)),
|
||||||
|
BEDROCK((e, x, z) -> 0),
|
||||||
|
SKY((e, x, z) -> e.getHeight());
|
||||||
|
|
||||||
|
private final Function3<IrisEngine, Integer, Integer, Integer> computer;
|
||||||
|
|
||||||
|
private IrisMatterPlacementLocation(Function3<IrisEngine, Integer, Integer, Integer> computer)
|
||||||
|
{
|
||||||
|
this.computer = computer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int at(IrisEngine engine, int x, int z) {
|
||||||
|
return computer.apply(engine, x, z);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.volmit.iris.engine.object.matter;
|
||||||
|
|
||||||
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
|
import com.volmit.iris.engine.IrisEngine;
|
||||||
|
import com.volmit.iris.engine.object.IrisStyledRange;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode()
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@Desc("Represents a matter translator")
|
||||||
|
public class IrisMatterTranslate {
|
||||||
|
@Desc("For varied coordinate shifts use ranges not the literal coordinate")
|
||||||
|
private IrisStyledRange rangeX = null;
|
||||||
|
@Desc("For varied coordinate shifts use ranges not the literal coordinate")
|
||||||
|
private IrisStyledRange rangeY = null;
|
||||||
|
@Desc("For varied coordinate shifts use ranges not the literal coordinate")
|
||||||
|
private IrisStyledRange rangeZ = null;
|
||||||
|
@Desc("Define an absolute shift instead of varied.")
|
||||||
|
private int x = 0;
|
||||||
|
@Desc("Define an absolute shift instead of varied.")
|
||||||
|
private int y = 0;
|
||||||
|
@Desc("Define an absolute shift instead of varied.")
|
||||||
|
private int z = 0;
|
||||||
|
|
||||||
|
public int xOffset(IrisData data, RNG rng, int rx, int rz)
|
||||||
|
{
|
||||||
|
if(rangeX != null)
|
||||||
|
{
|
||||||
|
return (int) Math.round(rangeX.get(rng, rx, rz, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int yOffset(IrisData data, RNG rng, int rx, int rz)
|
||||||
|
{
|
||||||
|
if(rangeY != null)
|
||||||
|
{
|
||||||
|
return (int) Math.round(rangeY.get(rng, rx, rz, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int zOffset(IrisData data, RNG rng, int rx, int rz)
|
||||||
|
{
|
||||||
|
if(rangeZ != null)
|
||||||
|
{
|
||||||
|
return (int) Math.round(rangeZ.get(rng, rx, rz, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
}
|
@ -379,6 +379,14 @@ public class Mantle {
|
|||||||
return closed.get();
|
return closed.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void set(int x, int y, int z, Matter matter)
|
||||||
|
{
|
||||||
|
for(MatterSlice<?> i : matter.getSliceMap().values())
|
||||||
|
{
|
||||||
|
i.iterate((mx, my, mz, v) -> set(mx + x, my + y, mz + z, v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the Mantle. By closing the mantle, you can no longer read or writeNodeData
|
* Closes the Mantle. By closing the mantle, you can no longer read or writeNodeData
|
||||||
* any data to the mantle or it's Tectonic Plates. Closing will also flush any
|
* any data to the mantle or it's Tectonic Plates. Closing will also flush any
|
||||||
|
Loading…
x
Reference in New Issue
Block a user