other updates!

This commit is contained in:
Brian Neumann-Fopiano 2023-05-16 23:38:37 -04:00
parent e3d2dfa99e
commit 12a6d022cf
19 changed files with 5626 additions and 5621 deletions

View File

@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1" id "de.undercouch.download" version "5.0.1"
} }
version '2.6.1-1.19.4' version '2.6.2-1.19.4'
def nmsVersion = "1.19.4" //[NMS] def nmsVersion = "1.19.4" //[NMS]
def apiVersion = '1.19' def apiVersion = '1.19'
def specialSourceVersion = '1.11.0' //[NMS] def specialSourceVersion = '1.11.0' //[NMS]
@ -134,7 +134,7 @@ dependencies {
// Third Party Integrations // Third Party Integrations
implementation 'com.github.oraxen:oraxen:1.152.5' implementation 'com.github.oraxen:oraxen:1.152.5'
implementation 'com.github.LoneDev6:api-itemsadder:3.2.5' implementation 'com.github.LoneDev6:api-itemsadder:3.4.1-r4'
implementation 'me.clip:placeholderapi:2.11.3' implementation 'me.clip:placeholderapi:2.11.3'
//implementation files('libs/CustomItems.jar') //implementation files('libs/CustomItems.jar')

View File

@ -62,7 +62,10 @@ import com.volmit.iris.util.scheduling.ShurikenQueue;
import io.papermc.lib.PaperLib; import io.papermc.lib.PaperLib;
import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.serializer.ComponentSerializer; import net.kyori.adventure.text.serializer.ComponentSerializer;
import org.bukkit.*; import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.WorldCreator;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -464,20 +467,20 @@ public class Iris extends VolmitPlugin implements Listener {
try { try {
fc.load(new File("bukkit.yml")); fc.load(new File("bukkit.yml"));
ConfigurationSection section = fc.getConfigurationSection("worlds"); ConfigurationSection section = fc.getConfigurationSection("worlds");
if(section == null) { if (section == null) {
return; return;
} }
for(String s : section.getKeys(false)){ for (String s : section.getKeys(false)) {
ConfigurationSection entry = section.getConfigurationSection(s); ConfigurationSection entry = section.getConfigurationSection(s);
if(!entry.contains("generator", true)) { if (!entry.contains("generator", true)) {
continue; continue;
} }
String generator = entry.getString("generator"); String generator = entry.getString("generator");
if(generator.startsWith("Iris:")) { if (generator.startsWith("Iris:")) {
generator = generator.split("\\Q:\\E")[1]; generator = generator.split("\\Q:\\E")[1];
} else if(generator.equalsIgnoreCase("Iris")) { } else if (generator.equalsIgnoreCase("Iris")) {
generator = IrisSettings.get().getGenerator().getDefaultWorldType(); generator = IrisSettings.get().getGenerator().getDefaultWorldType();
} else { } else {
continue; continue;
@ -485,7 +488,7 @@ public class Iris extends VolmitPlugin implements Listener {
Iris.info("2 World: %s | Generator: %s", s, generator); Iris.info("2 World: %s | Generator: %s", s, generator);
if(Bukkit.getWorlds().stream().anyMatch(w -> w.getName().equals(s))) { if (Bukkit.getWorlds().stream().anyMatch(w -> w.getName().equals(s))) {
continue; continue;
} }

View File

@ -24,7 +24,6 @@ import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt; import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEntity;
import com.volmit.iris.engine.platform.PlatformChunkGenerator; import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.decree.DecreeContext; import com.volmit.iris.util.decree.DecreeContext;
@ -41,9 +40,7 @@ import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.jobs.QueueJob; import com.volmit.iris.util.scheduling.jobs.QueueJob;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.util.Vector;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View File

@ -51,8 +51,7 @@ public class IrisRenderer {
colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB(); colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case HEIGHT -> case HEIGHT ->
colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB(); colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
case CONTINENT -> case CONTINENT -> colorFunction = (x, z) -> {
colorFunction = (x, z) -> {
IrisBiome b = renderer.getBiome((int) Math.round(x), renderer.getMaxHeight() - 1, (int) Math.round(z)); IrisBiome b = renderer.getBiome((int) Math.round(x), renderer.getMaxHeight() - 1, (int) Math.round(z));
IrisBiomeGeneratorLink g = b.getGenerators().get(0); IrisBiomeGeneratorLink g = b.getGenerators().get(0);
Color c; Color c;

View File

@ -8,7 +8,7 @@ public record Identifier(String namespace, String key) {
public static Identifier fromString(String id) { public static Identifier fromString(String id) {
String[] strings = id.split(":", 2); String[] strings = id.split(":", 2);
if(strings.length == 1) { if (strings.length == 1) {
return new Identifier(DEFAULT_NAMESPACE, strings[0]); return new Identifier(DEFAULT_NAMESPACE, strings[0]);
} else { } else {
return new Identifier(strings[0], strings[1]); return new Identifier(strings[0], strings[1]);
@ -22,9 +22,9 @@ public record Identifier(String namespace, String key) {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if(obj instanceof Identifier i) { if (obj instanceof Identifier i) {
return i.namespace().equals(this.namespace) && i.key().equals(this.key); return i.namespace().equals(this.namespace) && i.key().equals(this.key);
} else if(obj instanceof NamespacedKey i) { } else if (obj instanceof NamespacedKey i) {
return i.getNamespace().equals(this.namespace) && i.getKey().equals(this.key); return i.getNamespace().equals(this.namespace) && i.getKey().equals(this.key);
} else { } else {
return false; return false;

View File

@ -7,7 +7,6 @@ import dev.lone.itemsadder.api.CustomStack;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.MissingResourceException; import java.util.MissingResourceException;
public class ItemAdderDataProvider extends ExternalDataProvider { public class ItemAdderDataProvider extends ExternalDataProvider {

View File

@ -53,7 +53,7 @@ public class OraxenDataProvider extends ExternalDataProvider {
public void init() { public void init() {
Iris.info("Setting up Oraxen Link..."); Iris.info("Setting up Oraxen Link...");
this.factories = new WrappedField<>(MechanicsManager.class, FIELD_FACTORIES_MAP); this.factories = new WrappedField<>(MechanicsManager.class, FIELD_FACTORIES_MAP);
if(this.factories.hasFailed()) { if (this.factories.hasFailed()) {
Iris.error("Failed to set up Oraxen Link: Unable to fetch MechanicFactoriesMap!"); Iris.error("Failed to set up Oraxen Link: Unable to fetch MechanicFactoriesMap!");
} }
} }
@ -87,7 +87,8 @@ public class OraxenDataProvider extends ExternalDataProvider {
Identifier key = new Identifier("oraxen", name); Identifier key = new Identifier("oraxen", name);
if (getBlockData(key) != null) if (getBlockData(key) != null)
names.add(key); names.add(key);
} catch (MissingResourceException ignored) { } } catch (MissingResourceException ignored) {
}
} }
return names.toArray(new Identifier[0]); return names.toArray(new Identifier[0]);
@ -101,7 +102,8 @@ public class OraxenDataProvider extends ExternalDataProvider {
Identifier key = new Identifier("oraxen", name); Identifier key = new Identifier("oraxen", name);
if (getItemStack(key) != null) if (getItemStack(key) != null)
names.add(key); names.add(key);
} catch (MissingResourceException ignored) { } } catch (MissingResourceException ignored) {
}
} }
return names.toArray(new Identifier[0]); return names.toArray(new Identifier[0]);
@ -109,8 +111,8 @@ public class OraxenDataProvider extends ExternalDataProvider {
@Override @Override
public boolean isReady() { public boolean isReady() {
if(super.isReady()) { if (super.isReady()) {
if(factories == null) { if (factories == null) {
this.factories = new WrappedField<>(MechanicsManager.class, FIELD_FACTORIES_MAP); this.factories = new WrappedField<>(MechanicsManager.class, FIELD_FACTORIES_MAP);
} }
return super.isReady() && !factories.hasFailed(); return super.isReady() && !factories.hasFailed();

View File

@ -47,15 +47,6 @@ public class CustomBiomeSource extends BiomeSource {
this.customBiomes = fillCustomBiomes(biomeCustomRegistry, engine); this.customBiomes = fillCustomBiomes(biomeCustomRegistry, engine);
} }
@Override
protected Stream<Holder<Biome>> collectPossibleBiomes() {
return getAllBiomes(
((RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()))
.registry(Registries.BIOME).orElse(null),
((CraftWorld) engine.getWorld().realWorld()).getHandle().registryAccess().registry(Registries.BIOME).orElse(null),
engine).stream();
}
private static List<Holder<Biome>> getAllBiomes(Registry<Biome> customRegistry, Registry<Biome> registry, Engine engine) { private static List<Holder<Biome>> getAllBiomes(Registry<Biome> customRegistry, Registry<Biome> registry, Engine engine) {
List<Holder<Biome>> b = new ArrayList<>(); List<Holder<Biome>> b = new ArrayList<>();
@ -119,6 +110,15 @@ public class CustomBiomeSource extends BiomeSource {
return null; return null;
} }
@Override
protected Stream<Holder<Biome>> collectPossibleBiomes() {
return getAllBiomes(
((RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()))
.registry(Registries.BIOME).orElse(null),
((CraftWorld) engine.getWorld().realWorld()).getHandle().registryAccess().registry(Registries.BIOME).orElse(null),
engine).stream();
}
private KMap<String, Holder<Biome>> fillCustomBiomes(Registry<Biome> customRegistry, Engine engine) { private KMap<String, Holder<Biome>> fillCustomBiomes(Registry<Biome> customRegistry, Engine engine) {
KMap<String, Holder<Biome>> m = new KMap<>(); KMap<String, Holder<Biome>> m = new KMap<>();

View File

@ -19,10 +19,12 @@
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.*; import com.volmit.iris.core.link.ExternalDataProvider;
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 io.th0rgal.oraxen.api.OraxenBlocks;
import lombok.Data; import lombok.Data;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
@ -44,11 +46,11 @@ public class ExternalDataSVC implements IrisService {
Bukkit.getPluginManager().registerEvents(this, Iris.instance); Bukkit.getPluginManager().registerEvents(this, Iris.instance);
providers.add(new OraxenDataProvider()); providers.add(new OraxenDataProvider());
if (Bukkit.getPluginManager().getPlugin("Oraxen") != null){ if (Bukkit.getPluginManager().getPlugin("Oraxen") != null) {
Iris.info("Oraxen found, loading OraxenDataProvider..."); Iris.info("Oraxen found, loading OraxenDataProvider...");
} }
providers.add(new ItemAdderDataProvider()); providers.add(new ItemAdderDataProvider());
if (Bukkit.getPluginManager().getPlugin("ItemAdder") != null){ if (Bukkit.getPluginManager().getPlugin("ItemAdder") != null) {
Iris.info("ItemAdder found, loading ItemAdderDataProvider..."); Iris.info("ItemAdder found, loading ItemAdderDataProvider...");
} }
@ -62,11 +64,12 @@ public class ExternalDataSVC implements IrisService {
} }
@Override @Override
public void onDisable() { } public void onDisable() {
}
@EventHandler @EventHandler
public void onPluginEnable(PluginEnableEvent e) { public void onPluginEnable(PluginEnableEvent e) {
if(activeProviders.stream().noneMatch(p -> p.getPlugin().equals(e.getPlugin()))) { if (activeProviders.stream().noneMatch(p -> p.getPlugin().equals(e.getPlugin()))) {
providers.stream().filter(p -> p.isReady() && p.getPlugin().equals(e.getPlugin())).findFirst().ifPresent(edp -> { providers.stream().filter(p -> p.isReady() && p.getPlugin().equals(e.getPlugin())).findFirst().ifPresent(edp -> {
activeProviders.add(edp); activeProviders.add(edp);
edp.init(); edp.init();

View File

@ -50,7 +50,6 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import lombok.Data; import lombok.Data;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -555,6 +555,7 @@ public class IrisDimension extends IrisRegistrant {
obj.put("logical_height", logicalHeight); obj.put("logical_height", logicalHeight);
return obj.toString(4); return obj.toString(4);
} }
private String generateDatapackJsonNether() { private String generateDatapackJsonNether() {
JSONObject obj = new JSONObject(DP_NETHER_DEFAULT); JSONObject obj = new JSONObject(DP_NETHER_DEFAULT);
obj.put("min_y", dimensionHeightNether.getMin()); obj.put("min_y", dimensionHeightNether.getMin());
@ -562,6 +563,7 @@ public class IrisDimension extends IrisRegistrant {
obj.put("logical_height", logicalHeightNether); obj.put("logical_height", logicalHeightNether);
return obj.toString(4); return obj.toString(4);
} }
private String generateDatapackJsonEnd() { private String generateDatapackJsonEnd() {
JSONObject obj = new JSONObject(DP_END_DEFAULT); JSONObject obj = new JSONObject(DP_END_DEFAULT);
obj.put("min_y", dimensionHeightEnd.getMin()); obj.put("min_y", dimensionHeightEnd.getMin());

View File

@ -198,7 +198,7 @@ public class IrisLoot {
colorable.setColor(getDyeColor()); colorable.setColor(getDyeColor());
} }
if(displayName != null) { if (displayName != null) {
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName)); m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName)); m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
} }

View File

@ -30,7 +30,10 @@ import com.volmit.iris.util.data.B;
import com.volmit.iris.util.format.Form; import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.interpolation.IrisInterpolation; import com.volmit.iris.util.interpolation.IrisInterpolation;
import com.volmit.iris.util.json.JSONObject; import com.volmit.iris.util.json.JSONObject;
import com.volmit.iris.util.math.*; import com.volmit.iris.util.math.AxisAlignedBB;
import com.volmit.iris.util.math.BlockPosition;
import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RNG;
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;

View File

@ -126,7 +126,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@EventHandler @EventHandler
public void onWorldInit(WorldInitEvent event) { public void onWorldInit(WorldInitEvent event) {
try { try {
if(!initialized) { if (!initialized) {
world.setRawWorldSeed(event.getWorld().getSeed()); world.setRawWorldSeed(event.getWorld().getSeed());
if (world.name().equals(event.getWorld().getName())) { if (world.name().equals(event.getWorld().getName())) {
ServerLevel serverLevel = ((CraftWorld) event.getWorld()).getHandle(); ServerLevel serverLevel = ((CraftWorld) event.getWorld()).getHandle();

View File

@ -18,8 +18,6 @@
package com.volmit.iris.util.decree.context; package com.volmit.iris.util.decree.context;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.util.decree.DecreeContextHandler; import com.volmit.iris.util.decree.DecreeContextHandler;
import com.volmit.iris.util.plugin.VolmitSender; import com.volmit.iris.util.plugin.VolmitSender;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;

View File

@ -13,7 +13,7 @@ public class WrappedField<C, T> {
try { try {
f = origin.getDeclaredField(methodName); f = origin.getDeclaredField(methodName);
f.setAccessible(true); f.setAccessible(true);
} catch(NoSuchFieldException e) { } catch (NoSuchFieldException e) {
Iris.error("Failed to created WrappedField %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage()); Iris.error("Failed to created WrappedField %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
} }
this.field = f; this.field = f;
@ -24,13 +24,13 @@ public class WrappedField<C, T> {
} }
public T get(C instance) { public T get(C instance) {
if(field == null) { if (field == null) {
return null; return null;
} }
try { try {
return (T)field.get(instance); return (T) field.get(instance);
} catch(IllegalAccessException e) { } catch (IllegalAccessException e) {
Iris.error("Failed to get WrappedField %s#%s: %s%s", field.getDeclaringClass().getSimpleName(), field.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage()); Iris.error("Failed to get WrappedField %s#%s: %s%s", field.getDeclaringClass().getSimpleName(), field.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
return null; return null;
} }

View File

@ -14,7 +14,7 @@ public final class WrappedReturningMethod<C, R> {
try { try {
m = origin.getDeclaredMethod(methodName, paramTypes); m = origin.getDeclaredMethod(methodName, paramTypes);
m.setAccessible(true); m.setAccessible(true);
} catch(NoSuchMethodException e) { } catch (NoSuchMethodException e) {
Iris.error("Failed to created WrappedMethod %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage()); Iris.error("Failed to created WrappedMethod %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
} }
this.method = m; this.method = m;
@ -25,13 +25,13 @@ public final class WrappedReturningMethod<C, R> {
} }
public R invoke(C instance, Object... args) { public R invoke(C instance, Object... args) {
if(method == null) { if (method == null) {
return null; return null;
} }
try { try {
return (R)method.invoke(instance, args); return (R) method.invoke(instance, args);
} catch(InvocationTargetException | IllegalAccessException e) { } catch (InvocationTargetException | IllegalAccessException e) {
Iris.error("Failed to invoke WrappedMethod %s#%s: %s%s", method.getDeclaringClass().getSimpleName(), method.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage()); Iris.error("Failed to invoke WrappedMethod %s#%s: %s%s", method.getDeclaringClass().getSimpleName(), method.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
return null; return null;
} }

View File

@ -35,9 +35,9 @@ public class UniqueRenderer {
private final int height; private final int height;
private final KMap<String, String> writing = new KMap<>(); private final KMap<String, String> writing = new KMap<>();
private final ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2); private final ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
int cores = Runtime.getRuntime().availableProcessors();
private final KList<NoiseStyle> sortedStyles = new KList<NoiseStyle>(); private final KList<NoiseStyle> sortedStyles = new KList<NoiseStyle>();
private final KList<InterpolationMethod> sortedInterpolators = new KList<InterpolationMethod>(); private final KList<InterpolationMethod> sortedInterpolators = new KList<InterpolationMethod>();
int cores = Runtime.getRuntime().availableProcessors();
public UniqueRenderer(String seed, int width, int height) { public UniqueRenderer(String seed, int width, int height) {
renderer = this; renderer = this;