mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 14:21:33 +00:00
Merge branch 'master' into Pixeldev
This commit is contained in:
@@ -300,6 +300,13 @@ task iris(type: Copy) {
|
|||||||
dependsOn(build)
|
dependsOn(build)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task setup() {
|
||||||
|
group "iris"
|
||||||
|
NMS_BINDINGS.each {
|
||||||
|
dependsOn(project(":nms:${it.key}").executeBuildTools)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def registerCustomOutputTask(name, path) {
|
def registerCustomOutputTask(name, path) {
|
||||||
if (!System.properties['os.name'].toLowerCase().contains('windows')) {
|
if (!System.properties['os.name'].toLowerCase().contains('windows')) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ dependencies {
|
|||||||
implementation 'com.github.oraxen:oraxen:1.158.0'
|
implementation 'com.github.oraxen:oraxen:1.158.0'
|
||||||
implementation 'com.github.LoneDev6:api-itemsadder:3.4.1-r4'
|
implementation 'com.github.LoneDev6:api-itemsadder:3.4.1-r4'
|
||||||
implementation 'com.github.PlaceholderAPI:placeholderapi:2.11.3'
|
implementation 'com.github.PlaceholderAPI:placeholderapi:2.11.3'
|
||||||
|
implementation 'com.github.Ssomar-Developement:SCore:4.23.10.8'
|
||||||
//implementation files('libs/CustomItems.jar')
|
//implementation files('libs/CustomItems.jar')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.volmit.iris.core.link;
|
||||||
|
|
||||||
|
import com.ssomar.score.api.executableitems.ExecutableItemsAPI;
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class ExecutableItemsDataProvider extends ExternalDataProvider {
|
||||||
|
public ExecutableItemsDataProvider() {
|
||||||
|
super("ExecutableItems");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
Iris.info("Setting up ExecutableItems Link...");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockData getBlockData(Identifier blockId) throws MissingResourceException {
|
||||||
|
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemStack(Identifier itemId) throws MissingResourceException {
|
||||||
|
return ExecutableItemsAPI.getExecutableItemsManager().getExecutableItem(itemId.key())
|
||||||
|
.map(item -> item.buildItem(1, Optional.empty()))
|
||||||
|
.orElseThrow(() -> new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier[] getBlockTypes() {
|
||||||
|
return new Identifier[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier[] getItemTypes() {
|
||||||
|
KList<Identifier> names = new KList<>();
|
||||||
|
for (String name : ExecutableItemsAPI.getExecutableItemsManager().getExecutableItemIdsList()) {
|
||||||
|
try {
|
||||||
|
Identifier key = new Identifier("executable_items", name);
|
||||||
|
if (getItemStack(key) != null)
|
||||||
|
names.add(key);
|
||||||
|
} catch (MissingResourceException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return names.toArray(new Identifier[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidProvider(Identifier key, boolean isItem) {
|
||||||
|
return key.namespace().equalsIgnoreCase("executable_items") && isItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,7 +46,7 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean persist() {
|
public boolean persist() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,10 +19,7 @@
|
|||||||
package com.volmit.iris.core.service;
|
package com.volmit.iris.core.service;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.link.ExternalDataProvider;
|
import com.volmit.iris.core.link.*;
|
||||||
import com.volmit.iris.core.link.Identifier;
|
|
||||||
import com.volmit.iris.core.link.ItemAdderDataProvider;
|
|
||||||
import com.volmit.iris.core.link.OraxenDataProvider;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.plugin.IrisService;
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -53,6 +50,10 @@ public class ExternalDataSVC implements IrisService {
|
|||||||
if (Bukkit.getPluginManager().getPlugin("ItemAdder") != null) {
|
if (Bukkit.getPluginManager().getPlugin("ItemAdder") != null) {
|
||||||
Iris.info("ItemAdder found, loading ItemAdderDataProvider...");
|
Iris.info("ItemAdder found, loading ItemAdderDataProvider...");
|
||||||
}
|
}
|
||||||
|
providers.add(new ExecutableItemsDataProvider());
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("ExecutableItems") != null) {
|
||||||
|
Iris.info("ExecutableItems found, loading ExecutableItemsDataProvider...");
|
||||||
|
}
|
||||||
|
|
||||||
for (ExternalDataProvider p : providers) {
|
for (ExternalDataProvider p : providers) {
|
||||||
if (p.isReady()) {
|
if (p.isReady()) {
|
||||||
|
|||||||
+14
-18
@@ -23,10 +23,7 @@ import com.volmit.iris.engine.data.cache.Cache;
|
|||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
import com.volmit.iris.engine.object.IrisBiome;
|
import com.volmit.iris.engine.object.*;
|
||||||
import com.volmit.iris.engine.object.IrisObject;
|
|
||||||
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
|
||||||
import com.volmit.iris.engine.object.IrisRegion;
|
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.context.ChunkContext;
|
import com.volmit.iris.util.context.ChunkContext;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
@@ -35,6 +32,8 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
|
|||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterStructurePOI;
|
import com.volmit.iris.util.matter.MatterStructurePOI;
|
||||||
|
import com.volmit.iris.util.noise.CNG;
|
||||||
|
import com.volmit.iris.util.noise.NoiseType;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateLayer(MantleWriter writer, int x, int z, ChunkContext context) {
|
public void generateLayer(MantleWriter writer, int x, int z, ChunkContext context) {
|
||||||
RNG rng = new RNG(Cache.key(x, z) + seed());
|
RNG rng = applyNoise(x, z, Cache.key(x, z) + seed());
|
||||||
int xxx = 8 + (x << 4);
|
int xxx = 8 + (x << 4);
|
||||||
int zzz = 8 + (z << 4);
|
int zzz = 8 + (z << 4);
|
||||||
IrisRegion region = getComplex().getRegionStream().get(xxx, zzz);
|
IrisRegion region = getComplex().getRegionStream().get(xxx, zzz);
|
||||||
@@ -53,15 +52,17 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
placeObjects(writer, rng, x, z, biome, region);
|
placeObjects(writer, rng, x, z, biome, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RNG applyNoise(int x, int z, long seed) {
|
||||||
|
CNG noise = CNG.signatureFast(new RNG(seed), NoiseType.WHITE, NoiseType.GLOB);
|
||||||
|
return new RNG((long) (seed * noise.noise(x, z)));
|
||||||
|
}
|
||||||
|
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
private void placeObjects(MantleWriter writer, RNG rng, int x, int z, IrisBiome biome, IrisRegion region) {
|
private void placeObjects(MantleWriter writer, RNG rng, int x, int z, IrisBiome biome, IrisRegion region) {
|
||||||
long s = Cache.key(x, z) + seed();
|
|
||||||
RNG rnp = new RNG(s);
|
|
||||||
for (IrisObjectPlacement i : biome.getSurfaceObjects()) {
|
for (IrisObjectPlacement i : biome.getSurfaceObjects()) {
|
||||||
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005))) {
|
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005))) {
|
||||||
try {
|
try {
|
||||||
placeObject(writer, rnp, x << 4, z << 4, i);
|
placeObject(writer, rng, x << 4, z << 4, i);
|
||||||
rnp.setSeed(s);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
Iris.error("Failed to place objects in the following biome: " + biome.getName());
|
Iris.error("Failed to place objects in the following biome: " + biome.getName());
|
||||||
@@ -75,8 +76,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
for (IrisObjectPlacement i : region.getSurfaceObjects()) {
|
for (IrisObjectPlacement i : region.getSurfaceObjects()) {
|
||||||
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005))) {
|
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005))) {
|
||||||
try {
|
try {
|
||||||
placeObject(writer, rnp, x << 4, z << 4, i);
|
placeObject(writer, rng, x << 4, z << 4, i);
|
||||||
rnp.setSeed(s);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
Iris.error("Failed to place objects in the following region: " + region.getName());
|
Iris.error("Failed to place objects in the following region: " + region.getName());
|
||||||
@@ -123,23 +123,19 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> guess(int x, int z) {
|
public Set<String> guess(int x, int z) {
|
||||||
RNG rng = new RNG(Cache.key(x, z) + seed());
|
RNG rng = applyNoise(x, z, Cache.key(x, z) + seed());
|
||||||
long s = Cache.key(x, z) + seed();
|
|
||||||
RNG rngd = new RNG(s);
|
|
||||||
IrisBiome biome = getEngineMantle().getEngine().getSurfaceBiome((x << 4) + 8, (z << 4) + 8);
|
IrisBiome biome = getEngineMantle().getEngine().getSurfaceBiome((x << 4) + 8, (z << 4) + 8);
|
||||||
IrisRegion region = getEngineMantle().getEngine().getRegion((x << 4) + 8, (z << 4) + 8);
|
IrisRegion region = getEngineMantle().getEngine().getRegion((x << 4) + 8, (z << 4) + 8);
|
||||||
Set<String> v = new KSet<>();
|
Set<String> v = new KSet<>();
|
||||||
for (IrisObjectPlacement i : biome.getSurfaceObjects()) {
|
for (IrisObjectPlacement i : biome.getSurfaceObjects()) {
|
||||||
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005))) {
|
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005))) {
|
||||||
v.addAll(guessPlacedKeys(rngd, x, z, i));
|
v.addAll(guessPlacedKeys(rng, x, z, i));
|
||||||
rngd.setSeed(s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IrisObjectPlacement i : region.getSurfaceObjects()) {
|
for (IrisObjectPlacement i : region.getSurfaceObjects()) {
|
||||||
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005))) {
|
if (rng.chance(i.getChance() + rng.d(-0.005, 0.005))) {
|
||||||
v.addAll(guessPlacedKeys(rngd, x, z, i));
|
v.addAll(guessPlacedKeys(rng, x, z, i));
|
||||||
rngd.setSeed(s);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
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.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.placer.HeightmapObjectPlacer;
|
import com.volmit.iris.engine.framework.placer.HeightmapObjectPlacer;
|
||||||
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;
|
||||||
@@ -688,6 +689,25 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config.getAllowedCollisions().isEmpty() || !config.getForbiddenCollisions().isEmpty()) {
|
||||||
|
Engine engine = rdata.getEngine();
|
||||||
|
String key;
|
||||||
|
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
||||||
|
for (int i = x - Math.floorDiv(w, 2) + (int) offset.getX(); i <= x + Math.floorDiv(w, 2) - (w % 2 == 0 ? 1 : 0) + (int) offset.getX(); i++) {
|
||||||
|
for (int j = y - Math.floorDiv(h, 2) + (int) offset.getY(); j <= y + Math.floorDiv(h, 2) - (h % 2 == 0 ? 1 : 0) + (int) offset.getY(); j++) {
|
||||||
|
for (int k = z - Math.floorDiv(d, 2) + (int) offset.getZ(); k <= z + Math.floorDiv(d, 2) - (d % 2 == 0 ? 1 : 0) + (int) offset.getX(); k++) {
|
||||||
|
key = engine.getObjectPlacementKey(i, j, k);
|
||||||
|
if (key != null) {
|
||||||
|
if (config.getForbiddenCollisions().contains(key) && !config.getAllowedCollisions().contains(key)) {
|
||||||
|
Iris.warn("%s collides with %s (%s / %s / %s)", getLoadKey(), key, i, j, k);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (config.isBore()) {
|
if (config.isBore()) {
|
||||||
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
|
||||||
for (int i = x - Math.floorDiv(w, 2) + (int) offset.getX(); i <= x + Math.floorDiv(w, 2) - (w % 2 == 0 ? 1 : 0) + (int) offset.getX(); i++) {
|
for (int i = x - Math.floorDiv(w, 2) + (int) offset.getX(); i <= x + Math.floorDiv(w, 2) - (w % 2 == 0 ? 1 : 0) + (int) offset.getX(); i++) {
|
||||||
|
|||||||
@@ -128,6 +128,14 @@ public class IrisObjectPlacement {
|
|||||||
@Desc("This object / these objects override the following trees when they grow...")
|
@Desc("This object / these objects override the following trees when they grow...")
|
||||||
@ArrayType(min = 1, type = IrisTree.class)
|
@ArrayType(min = 1, type = IrisTree.class)
|
||||||
private KList<IrisTree> trees = new KList<>();
|
private KList<IrisTree> trees = new KList<>();
|
||||||
|
@RegistryListResource(IrisObject.class)
|
||||||
|
@ArrayType(type = String.class)
|
||||||
|
@Desc("List of objects to this object is allowed to collied with")
|
||||||
|
private KList<String> allowedCollisions = new KList<>();
|
||||||
|
@RegistryListResource(IrisObject.class)
|
||||||
|
@ArrayType(type = String.class)
|
||||||
|
@Desc("List of objects to this object is forbidden to collied with")
|
||||||
|
private KList<String> forbiddenCollisions = new KList<>();
|
||||||
private transient AtomicCache<TableCache> cache = new AtomicCache<>();
|
private transient AtomicCache<TableCache> cache = new AtomicCache<>();
|
||||||
|
|
||||||
public IrisObjectPlacement toPlacement(String... place) {
|
public IrisObjectPlacement toPlacement(String... place) {
|
||||||
|
|||||||
Reference in New Issue
Block a user