mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-02-16 02:20:44 +00:00
minor cleanup and improved safeguard for missing dimension types
This commit is contained in:
@@ -97,7 +97,6 @@ public class NMSBinding implements INMSBinding {
|
||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = 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 Field biomeStorageCache = null;
|
||||
|
||||
@@ -643,16 +642,11 @@ public class NMSBinding implements INMSBinding {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
||||
if (generator == null)
|
||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
||||
.keySet()
|
||||
.stream()
|
||||
.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);
|
||||
public boolean missingDimensionTypes(String... keys) {
|
||||
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||
return !Arrays.stream(keys)
|
||||
.map(key -> new ResourceLocation("iris", key))
|
||||
.allMatch(type::containsKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -96,7 +96,6 @@ public class NMSBinding implements INMSBinding {
|
||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = 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 Field biomeStorageCache = null;
|
||||
|
||||
@@ -625,16 +624,11 @@ public class NMSBinding implements INMSBinding {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
||||
if (generator == null)
|
||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
||||
.keySet()
|
||||
.stream()
|
||||
.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);
|
||||
public boolean missingDimensionTypes(String... keys) {
|
||||
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||
return !Arrays.stream(keys)
|
||||
.map(key -> new ResourceLocation("iris", key))
|
||||
.allMatch(type::containsKey);
|
||||
}
|
||||
|
||||
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<MCAPalette<BlockState>> globalCache = 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 Field biomeStorageCache = null;
|
||||
|
||||
@@ -647,16 +646,11 @@ public class NMSBinding implements INMSBinding {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
||||
if (generator == null)
|
||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
||||
.keySet()
|
||||
.stream()
|
||||
.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);
|
||||
public boolean missingDimensionTypes(String... keys) {
|
||||
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||
return !Arrays.stream(keys)
|
||||
.map(key -> new ResourceLocation("iris", key))
|
||||
.allMatch(type::containsKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -97,7 +97,6 @@ public class NMSBinding implements INMSBinding {
|
||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = 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 Field biomeStorageCache = null;
|
||||
|
||||
@@ -665,16 +664,11 @@ public class NMSBinding implements INMSBinding {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
||||
if (generator == null)
|
||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
||||
.keySet()
|
||||
.stream()
|
||||
.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);
|
||||
public boolean missingDimensionTypes(String... keys) {
|
||||
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||
return !Arrays.stream(keys)
|
||||
.map(key -> new ResourceLocation("iris", key))
|
||||
.allMatch(type::containsKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -100,7 +100,6 @@ public class NMSBinding implements INMSBinding {
|
||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = 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 Field biomeStorageCache = null;
|
||||
|
||||
@@ -675,16 +674,11 @@ public class NMSBinding implements INMSBinding {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
||||
if (generator == null)
|
||||
return registry().registryOrThrow(Registries.DIMENSION_TYPE)
|
||||
.keySet()
|
||||
.stream()
|
||||
.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);
|
||||
public boolean missingDimensionTypes(String... keys) {
|
||||
var type = registry().registryOrThrow(Registries.DIMENSION_TYPE);
|
||||
return !Arrays.stream(keys)
|
||||
.map(key -> ResourceLocation.fromNamespaceAndPath("iris", key))
|
||||
.allMatch(type::containsKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -97,7 +97,6 @@ public class NMSBinding implements INMSBinding {
|
||||
private final AtomicCache<MCAIdMapper<BlockState>> registryCache = new AtomicCache<>();
|
||||
private final AtomicCache<MCAPalette<BlockState>> globalCache = 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 Field biomeStorageCache = null;
|
||||
|
||||
@@ -672,16 +671,11 @@ public class NMSBinding implements INMSBinding {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
||||
if (generator == null)
|
||||
return registry().lookupOrThrow(Registries.DIMENSION_TYPE)
|
||||
.keySet()
|
||||
.stream()
|
||||
.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);
|
||||
public boolean missingDimensionTypes(String... keys) {
|
||||
var type = registry().lookupOrThrow(Registries.DIMENSION_TYPE);
|
||||
return !Arrays.stream(keys)
|
||||
.map(key -> ResourceLocation.fromNamespaceAndPath("iris", key))
|
||||
.allMatch(type::containsKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.agent.Agent;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
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.hunk.Hunk;
|
||||
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.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.lang.reflect.Field;
|
||||
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<MCAPalette<BlockState>> globalCache = 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 Field biomeStorageCache = null;
|
||||
|
||||
@@ -672,16 +671,11 @@ public class NMSBinding implements INMSBinding {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean missingDimensionTypes(ChunkGenerator generator) {
|
||||
if (generator == null)
|
||||
return registry().lookupOrThrow(Registries.DIMENSION_TYPE)
|
||||
.keySet()
|
||||
.stream()
|
||||
.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);
|
||||
public boolean missingDimensionTypes(String... keys) {
|
||||
var type = registry().lookupOrThrow(Registries.DIMENSION_TYPE);
|
||||
return !Arrays.stream(keys)
|
||||
.map(key -> ResourceLocation.fromNamespaceAndPath("iris", key))
|
||||
.allMatch(type::containsKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -706,10 +700,6 @@ public class NMSBinding implements INMSBinding {
|
||||
return false;
|
||||
}
|
||||
|
||||
private ResourceLocation createIrisKey(ResourceKey<LevelStem> key) {
|
||||
return ResourceLocation.fromNamespaceAndPath("iris", key.location().getPath());
|
||||
}
|
||||
|
||||
public LevelStem levelStem(RegistryAccess access, ChunkGenerator raw) {
|
||||
if (!(raw instanceof PlatformChunkGenerator gen))
|
||||
throw new IllegalStateException("Generator is not platform chunk generator!");
|
||||
|
||||
Reference in New Issue
Block a user