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"
}
version '2.6.1-1.19.4'
version '2.6.2-1.19.4'
def nmsVersion = "1.19.4" //[NMS]
def apiVersion = '1.19'
def specialSourceVersion = '1.11.0' //[NMS]
@ -134,7 +134,7 @@ dependencies {
// Third Party Integrations
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 files('libs/CustomItems.jar')

View File

@ -62,7 +62,10 @@ import com.volmit.iris.util.scheduling.ShurikenQueue;
import io.papermc.lib.PaperLib;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
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.command.Command;
import org.bukkit.command.CommandSender;
@ -464,20 +467,20 @@ public class Iris extends VolmitPlugin implements Listener {
try {
fc.load(new File("bukkit.yml"));
ConfigurationSection section = fc.getConfigurationSection("worlds");
if(section == null) {
if (section == null) {
return;
}
for(String s : section.getKeys(false)){
for (String s : section.getKeys(false)) {
ConfigurationSection entry = section.getConfigurationSection(s);
if(!entry.contains("generator", true)) {
if (!entry.contains("generator", true)) {
continue;
}
String generator = entry.getString("generator");
if(generator.startsWith("Iris:")) {
if (generator.startsWith("Iris:")) {
generator = generator.split("\\Q:\\E")[1];
} else if(generator.equalsIgnoreCase("Iris")) {
} else if (generator.equalsIgnoreCase("Iris")) {
generator = IrisSettings.get().getGenerator().getDefaultWorldType();
} else {
continue;
@ -485,7 +488,7 @@ public class Iris extends VolmitPlugin implements Listener {
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;
}

View File

@ -24,7 +24,6 @@ import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine;
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.util.collection.KList;
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 org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.util.Vector;
import java.io.File;
import java.io.IOException;

View File

@ -51,23 +51,22 @@ public class IrisRenderer {
colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case HEIGHT ->
colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
case CONTINENT ->
colorFunction = (x, z) -> {
IrisBiome b = renderer.getBiome((int) Math.round(x), renderer.getMaxHeight() - 1, (int) Math.round(z));
IrisBiomeGeneratorLink g = b.getGenerators().get(0);
Color c;
if (g.getMax() <= 0) {
// Max is below water level, so it is most likely an ocean biome
c = Color.BLUE;
} else if (g.getMin() < 0) {
// Min is below water level, but max is not, so it is most likely a shore biome
c = Color.YELLOW;
} else {
// Both min and max are above water level, so it is most likely a land biome
c = Color.GREEN;
}
return c.getRGB();
};
case CONTINENT -> colorFunction = (x, z) -> {
IrisBiome b = renderer.getBiome((int) Math.round(x), renderer.getMaxHeight() - 1, (int) Math.round(z));
IrisBiomeGeneratorLink g = b.getGenerators().get(0);
Color c;
if (g.getMax() <= 0) {
// Max is below water level, so it is most likely an ocean biome
c = Color.BLUE;
} else if (g.getMin() < 0) {
// Min is below water level, but max is not, so it is most likely a shore biome
c = Color.YELLOW;
} else {
// Both min and max are above water level, so it is most likely a land biome
c = Color.GREEN;
}
return c.getRGB();
};
}
double x, z;

View File

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

View File

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

View File

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

View File

@ -47,15 +47,6 @@ public class CustomBiomeSource extends BiomeSource {
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) {
List<Holder<Biome>> b = new ArrayList<>();
@ -119,6 +110,15 @@ public class CustomBiomeSource extends BiomeSource {
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) {
KMap<String, Holder<Biome>> m = new KMap<>();

View File

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

View File

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

View File

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

View File

@ -198,7 +198,7 @@ public class IrisLoot {
colorable.setColor(getDyeColor());
}
if(displayName != null) {
if (displayName != null) {
m.setLocalizedName(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.interpolation.IrisInterpolation;
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.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst;

View File

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

View File

@ -18,8 +18,6 @@
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.plugin.VolmitSender;
import org.bukkit.util.Vector;

View File

@ -13,7 +13,7 @@ public class WrappedField<C, T> {
try {
f = origin.getDeclaredField(methodName);
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());
}
this.field = f;
@ -24,13 +24,13 @@ public class WrappedField<C, T> {
}
public T get(C instance) {
if(field == null) {
if (field == null) {
return null;
}
try {
return (T)field.get(instance);
} catch(IllegalAccessException e) {
return (T) field.get(instance);
} 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());
return null;
}

View File

@ -14,7 +14,7 @@ public final class WrappedReturningMethod<C, R> {
try {
m = origin.getDeclaredMethod(methodName, paramTypes);
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());
}
this.method = m;
@ -25,13 +25,13 @@ public final class WrappedReturningMethod<C, R> {
}
public R invoke(C instance, Object... args) {
if(method == null) {
if (method == null) {
return null;
}
try {
return (R)method.invoke(instance, args);
} catch(InvocationTargetException | IllegalAccessException e) {
return (R) method.invoke(instance, args);
} 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());
return null;
}

View File

@ -35,9 +35,9 @@ public class UniqueRenderer {
private final int height;
private final KMap<String, String> writing = new KMap<>();
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<InterpolationMethod> sortedInterpolators = new KList<InterpolationMethod>();
int cores = Runtime.getRuntime().availableProcessors();
public UniqueRenderer(String seed, int width, int height) {
renderer = this;