mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-21 19:55:00 +00:00
minor cleanup and improved safeguard for missing dimension types
This commit is contained in:
parent
2008975a8a
commit
6724b0f4c5
@ -63,6 +63,7 @@ import com.volmit.iris.util.scheduling.J;
|
|||||||
import com.volmit.iris.util.scheduling.Queue;
|
import com.volmit.iris.util.scheduling.Queue;
|
||||||
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
import lombok.NonNull;
|
||||||
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.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
@ -748,25 +749,11 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisDimension dim;
|
if (id == null || id.isEmpty()) id = IrisSettings.get().getGenerator().getDefaultWorldType();
|
||||||
if (id == null || id.isEmpty()) {
|
|
||||||
dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType());
|
|
||||||
} else {
|
|
||||||
dim = IrisData.loadAnyDimension(id);
|
|
||||||
}
|
|
||||||
Iris.debug("Generator ID: " + id + " requested by bukkit/plugin");
|
Iris.debug("Generator ID: " + id + " requested by bukkit/plugin");
|
||||||
|
IrisDimension dim = loadDimension(worldName, id);
|
||||||
if (dim == null) {
|
if (dim == null) {
|
||||||
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
throw new RuntimeException("Can't find dimension " + id + "!");
|
||||||
|
|
||||||
service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
|
|
||||||
dim = IrisData.loadAnyDimension(id);
|
|
||||||
|
|
||||||
if (dim == null) {
|
|
||||||
throw new RuntimeException("Can't find dimension " + id + "!");
|
|
||||||
} else {
|
|
||||||
Iris.info("Resolved missing dimension, proceeding with generation.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.debug("Assuming IrisDimension: " + dim.getName());
|
Iris.debug("Assuming IrisDimension: " + dim.getName());
|
||||||
@ -791,6 +778,24 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
return new BukkitChunkGenerator(w, false, ff, dim.getLoadKey());
|
return new BukkitChunkGenerator(w, false, ff, dim.getLoadKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static IrisDimension loadDimension(@NonNull String worldName, @NonNull String id) {
|
||||||
|
var data = IrisData.get(new File(Bukkit.getWorldContainer(), String.join(File.separator, worldName, "iris", "pack")));
|
||||||
|
var dimension = data.getDimensionLoader().load(id);
|
||||||
|
if (dimension == null) dimension = IrisData.loadAnyDimension(id);
|
||||||
|
if (dimension == null) {
|
||||||
|
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
||||||
|
Iris.service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
|
||||||
|
dimension = IrisData.loadAnyDimension(id);
|
||||||
|
|
||||||
|
if (dimension != null) {
|
||||||
|
Iris.info("Resolved missing dimension, proceeding.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dimension;
|
||||||
|
}
|
||||||
|
|
||||||
public void splash() {
|
public void splash() {
|
||||||
if (!IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
if (!IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
||||||
return;
|
return;
|
||||||
|
@ -21,6 +21,7 @@ package com.volmit.iris.core.nms;
|
|||||||
import com.volmit.iris.core.nms.container.BiomeColor;
|
import com.volmit.iris.core.nms.container.BiomeColor;
|
||||||
import com.volmit.iris.core.nms.datapack.DataVersion;
|
import com.volmit.iris.core.nms.datapack.DataVersion;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
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.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
@ -89,9 +90,9 @@ public interface INMSBinding {
|
|||||||
MCABiomeContainer newBiomeContainer(int min, int max);
|
MCABiomeContainer newBiomeContainer(int min, int max);
|
||||||
|
|
||||||
default World createWorld(WorldCreator c) {
|
default World createWorld(WorldCreator c) {
|
||||||
if (missingDimensionTypes(c.generator()))
|
if (c.generator() instanceof PlatformChunkGenerator gen
|
||||||
throw new IllegalStateException("Missing dimenstion types to create world");
|
&& missingDimensionTypes(gen.getTarget().getDimension().getDimensionTypeKey()))
|
||||||
|
throw new IllegalStateException("Missing dimension types to create world");
|
||||||
return c.createWorld();
|
return c.createWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +128,7 @@ public interface INMSBinding {
|
|||||||
|
|
||||||
KList<String> getStructureKeys();
|
KList<String> getStructureKeys();
|
||||||
|
|
||||||
boolean missingDimensionTypes(@Nullable ChunkGenerator generator);
|
boolean missingDimensionTypes(String... keys);
|
||||||
|
|
||||||
default boolean injectBukkit() {
|
default boolean injectBukkit() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -120,7 +120,12 @@ public class NMSBinding1X implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean missingDimensionTypes(@Nullable ChunkGenerator generator) {
|
public KList<String> getLevelStems() {
|
||||||
|
return new KList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean missingDimensionTypes(String... keys) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
package com.volmit.iris.core.safeguard;
|
package com.volmit.iris.core.safeguard;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
import com.volmit.iris.util.agent.Agent;
|
import com.volmit.iris.util.agent.Agent;
|
||||||
|
import com.volmit.iris.util.collection.KSet;
|
||||||
|
import com.volmit.iris.util.misc.ServerProperties;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import javax.tools.JavaCompiler;
|
import javax.tools.JavaCompiler;
|
||||||
@ -184,6 +189,31 @@ public class ServerBootSFG {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean missingDimensionTypes() {
|
private static boolean missingDimensionTypes() {
|
||||||
return INMS.get().missingDimensionTypes(null);
|
return INMS.get().missingDimensionTypes(getDimensionTypes().toArray(String[]::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static KSet<String> getDimensionTypes() {
|
||||||
|
var bukkit = YamlConfiguration.loadConfiguration(ServerProperties.BUKKIT_YML);
|
||||||
|
var worlds = bukkit.getConfigurationSection("worlds");
|
||||||
|
if (worlds == null) return new KSet<>();
|
||||||
|
|
||||||
|
var types = new KSet<String>();
|
||||||
|
for (String world : worlds.getKeys(false)) {
|
||||||
|
var gen = worlds.getString(world + ".generator");
|
||||||
|
if (gen == null) continue;
|
||||||
|
|
||||||
|
String loadKey;
|
||||||
|
if (gen.equalsIgnoreCase("iris")) {
|
||||||
|
loadKey = IrisSettings.get().getGenerator().getDefaultWorldType();
|
||||||
|
} else if (gen.startsWith("Iris:")) {
|
||||||
|
loadKey = gen.substring(5);
|
||||||
|
} else continue;
|
||||||
|
|
||||||
|
IrisDimension dimension = Iris.loadDimension(world, loadKey);
|
||||||
|
if (dimension == null) continue;
|
||||||
|
types.add(dimension.getDimensionTypeKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
return types;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,6 @@ public class NMSBinding implements INMSBinding {
|
|||||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
||||||
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
||||||
private final KMap<World.Environment, LevelStem> stems = new KMap<>();
|
|
||||||
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
||||||
private Field biomeStorageCache = null;
|
private Field biomeStorageCache = null;
|
||||||
|
|
||||||
@ -643,16 +642,11 @@ public class NMSBinding implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
public boolean missingDimensionTypes(String... keys) {
|
||||||
if (generator == null)
|
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
return !Arrays.stream(keys)
|
||||||
.keySet()
|
.map(key -> new ResourceLocation("iris", key))
|
||||||
.stream()
|
.allMatch(type::containsKey);
|
||||||
.noneMatch(loc -> loc.getNamespace().equals("iris"));
|
|
||||||
if (!(generator instanceof PlatformChunkGenerator pcg))
|
|
||||||
return false;
|
|
||||||
var dimensionKey = new ResourceLocation("iris", pcg.getTarget().getDimension().getDimensionTypeKey());
|
|
||||||
return !registry().registryOrThrow(Registries.DIMENSION_TYPE).containsKey(dimensionKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,7 +96,6 @@ public class NMSBinding implements INMSBinding {
|
|||||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
||||||
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
||||||
private final KMap<World.Environment, LevelStem> stems = new KMap<>();
|
|
||||||
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
||||||
private Field biomeStorageCache = null;
|
private Field biomeStorageCache = null;
|
||||||
|
|
||||||
@ -625,16 +624,11 @@ public class NMSBinding implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
public boolean missingDimensionTypes(String... keys) {
|
||||||
if (generator == null)
|
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
return !Arrays.stream(keys)
|
||||||
.keySet()
|
.map(key -> new ResourceLocation("iris", key))
|
||||||
.stream()
|
.allMatch(type::containsKey);
|
||||||
.noneMatch(loc -> loc.getNamespace().equals("iris"));
|
|
||||||
if (!(generator instanceof PlatformChunkGenerator pcg))
|
|
||||||
return false;
|
|
||||||
var dimensionKey = new ResourceLocation("iris", pcg.getTarget().getDimension().getDimensionTypeKey());
|
|
||||||
return !registry().registryOrThrow(Registries.DIMENSION_TYPE).containsKey(dimensionKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Field getField(Class<?> clazz, Class<?> fieldType) throws NoSuchFieldException {
|
private static Field getField(Class<?> clazz, Class<?> fieldType) throws NoSuchFieldException {
|
||||||
|
@ -96,7 +96,6 @@ public class NMSBinding implements INMSBinding {
|
|||||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
||||||
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
||||||
private final KMap<World.Environment, LevelStem> stems = new KMap<>();
|
|
||||||
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
||||||
private Field biomeStorageCache = null;
|
private Field biomeStorageCache = null;
|
||||||
|
|
||||||
@ -647,16 +646,11 @@ public class NMSBinding implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
public boolean missingDimensionTypes(String... keys) {
|
||||||
if (generator == null)
|
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
return !Arrays.stream(keys)
|
||||||
.keySet()
|
.map(key -> new ResourceLocation("iris", key))
|
||||||
.stream()
|
.allMatch(type::containsKey);
|
||||||
.noneMatch(loc -> loc.getNamespace().equals("iris"));
|
|
||||||
if (!(generator instanceof PlatformChunkGenerator pcg))
|
|
||||||
return false;
|
|
||||||
var dimensionKey = new ResourceLocation("iris", pcg.getTarget().getDimension().getDimensionTypeKey());
|
|
||||||
return !registry().registryOrThrow(Registries.DIMENSION_TYPE).containsKey(dimensionKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,7 +97,6 @@ public class NMSBinding implements INMSBinding {
|
|||||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
||||||
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
||||||
private final KMap<World.Environment, LevelStem> stems = new KMap<>();
|
|
||||||
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
||||||
private Field biomeStorageCache = null;
|
private Field biomeStorageCache = null;
|
||||||
|
|
||||||
@ -665,16 +664,11 @@ public class NMSBinding implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
public boolean missingDimensionTypes(String... keys) {
|
||||||
if (generator == null)
|
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
return !Arrays.stream(keys)
|
||||||
.keySet()
|
.map(key -> new ResourceLocation("iris", key))
|
||||||
.stream()
|
.allMatch(type::containsKey);
|
||||||
.noneMatch(loc -> loc.getNamespace().equals("iris"));
|
|
||||||
if (!(generator instanceof PlatformChunkGenerator pcg))
|
|
||||||
return false;
|
|
||||||
var dimensionKey = new ResourceLocation("iris", pcg.getTarget().getDimension().getDimensionTypeKey());
|
|
||||||
return !registry().registryOrThrow(Registries.DIMENSION_TYPE).containsKey(dimensionKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,7 +100,6 @@ public class NMSBinding implements INMSBinding {
|
|||||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
||||||
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
||||||
private final KMap<World.Environment, LevelStem> stems = new KMap<>();
|
|
||||||
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
||||||
private Field biomeStorageCache = null;
|
private Field biomeStorageCache = null;
|
||||||
|
|
||||||
@ -675,16 +674,11 @@ public class NMSBinding implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
public boolean missingDimensionTypes(String... keys) {
|
||||||
if (generator == null)
|
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
return !Arrays.stream(keys)
|
||||||
.keySet()
|
.map(key -> ResourceLocation.fromNamespaceAndPath("iris", key))
|
||||||
.stream()
|
.allMatch(type::containsKey);
|
||||||
.noneMatch(loc -> loc.getNamespace().equals("iris"));
|
|
||||||
if (!(generator instanceof PlatformChunkGenerator pcg))
|
|
||||||
return false;
|
|
||||||
var dimensionKey = ResourceLocation.fromNamespaceAndPath("iris", pcg.getTarget().getDimension().getDimensionTypeKey());
|
|
||||||
return !registry().registryOrThrow(Registries.DIMENSION_TYPE).containsKey(dimensionKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,7 +97,6 @@ public class NMSBinding implements INMSBinding {
|
|||||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
||||||
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
||||||
private final KMap<World.Environment, LevelStem> stems = new KMap<>();
|
|
||||||
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
||||||
private Field biomeStorageCache = null;
|
private Field biomeStorageCache = null;
|
||||||
|
|
||||||
@ -672,16 +671,11 @@ public class NMSBinding implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
public boolean missingDimensionTypes(String... keys) {
|
||||||
if (generator == null)
|
var type = registry().lookupOrThrow(Registries.DIMENSION_TYPE);
|
||||||
return registry().lookupOrThrow(Registries.DIMENSION_TYPE)
|
return !Arrays.stream(keys)
|
||||||
.keySet()
|
.map(key -> ResourceLocation.fromNamespaceAndPath("iris", key))
|
||||||
.stream()
|
.allMatch(type::containsKey);
|
||||||
.noneMatch(loc -> loc.getNamespace().equals("iris"));
|
|
||||||
if (!(generator instanceof PlatformChunkGenerator pcg))
|
|
||||||
return false;
|
|
||||||
var dimensionKey = ResourceLocation.fromNamespaceAndPath("iris", pcg.getTarget().getDimension().getDimensionTypeKey());
|
|
||||||
return !registry().lookupOrThrow(Registries.DIMENSION_TYPE).containsKey(dimensionKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,6 +11,7 @@ import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
|||||||
import com.volmit.iris.util.agent.Agent;
|
import com.volmit.iris.util.agent.Agent;
|
||||||
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.collection.KSet;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
@ -77,7 +78,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -97,7 +97,6 @@ public class NMSBinding implements INMSBinding {
|
|||||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
private final AtomicCache<MCAPalette<BlockState>> globalCache = new AtomicCache<>();
|
||||||
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
private final AtomicCache<RegistryAccess> registryAccess = new AtomicCache<>();
|
||||||
private final KMap<World.Environment, LevelStem> stems = new KMap<>();
|
|
||||||
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
|
||||||
private Field biomeStorageCache = null;
|
private Field biomeStorageCache = null;
|
||||||
|
|
||||||
@ -672,16 +671,11 @@ public class NMSBinding implements INMSBinding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
public boolean missingDimensionTypes(String... keys) {
|
||||||
if (generator == null)
|
var type = registry().lookupOrThrow(Registries.DIMENSION_TYPE);
|
||||||
return registry().lookupOrThrow(Registries.DIMENSION_TYPE)
|
return !Arrays.stream(keys)
|
||||||
.keySet()
|
.map(key -> ResourceLocation.fromNamespaceAndPath("iris", key))
|
||||||
.stream()
|
.allMatch(type::containsKey);
|
||||||
.noneMatch(loc -> loc.getNamespace().equals("iris"));
|
|
||||||
if (!(generator instanceof PlatformChunkGenerator pcg))
|
|
||||||
return false;
|
|
||||||
var dimensionKey = ResourceLocation.fromNamespaceAndPath("iris", pcg.getTarget().getDimension().getDimensionTypeKey());
|
|
||||||
return !registry().lookupOrThrow(Registries.DIMENSION_TYPE).containsKey(dimensionKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -706,10 +700,6 @@ public class NMSBinding implements INMSBinding {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResourceLocation createIrisKey(ResourceKey<LevelStem> key) {
|
|
||||||
return ResourceLocation.fromNamespaceAndPath("iris", key.location().getPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
public LevelStem levelStem(RegistryAccess access, ChunkGenerator raw) {
|
public LevelStem levelStem(RegistryAccess access, ChunkGenerator raw) {
|
||||||
if (!(raw instanceof PlatformChunkGenerator gen))
|
if (!(raw instanceof PlatformChunkGenerator gen))
|
||||||
throw new IllegalStateException("Generator is not platform chunk generator!");
|
throw new IllegalStateException("Generator is not platform chunk generator!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user