mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-01 08:50:06 +00:00
Fixed Structure Crash
- Don't carash anymore when you disable structures in the server.properties.
This commit is contained in:
1 parent
65ae3f1b45
commit
ee5aaec87c
6 files changed
+12
-74
No files matched your search
-32
@@ -195,8 +195,6 @@ public final class IrisModdedChunkGenerator implements NativeGeneratorOwner, Nat
|
||||
if (!nativeGenerator.represents(level)) {
|
||||
throw new IllegalArgumentException("NativeWorld does not use Iris generator '" + dimensionKey + "'");
|
||||
}
|
||||
requireGlobalStructureGeneration(
|
||||
NativeModdedServer.forWorld(level).generateStructures(), dimensionKey);
|
||||
Engine activeEngine = engineIfBound();
|
||||
Engine replacement = ModdedWorldEngines.prepareReplacement(
|
||||
level,
|
||||
@@ -462,13 +460,6 @@ public final class IrisModdedChunkGenerator implements NativeGeneratorOwner, Nat
|
||||
// A recorded failure stands until repoint or unbind resets the binding; re-running the bind would repeat the
|
||||
// history verification on every chunk call and fail the same way.
|
||||
engineBinding.throwIfFailed(dimensionKey);
|
||||
try {
|
||||
requireGlobalStructureGeneration(
|
||||
NativeModdedServer.forWorld(level).generateStructures(), dimensionKey);
|
||||
} catch (RuntimeException error) {
|
||||
recordBindFailure(level, error);
|
||||
throw error;
|
||||
}
|
||||
// Cache the owning level so hot paths never scan the level map to find themselves.
|
||||
boundLevel = level;
|
||||
Engine cached = engine;
|
||||
@@ -575,29 +566,6 @@ public final class IrisModdedChunkGenerator implements NativeGeneratorOwner, Nat
|
||||
}
|
||||
}
|
||||
|
||||
static void requireGlobalStructureGeneration(boolean enabled, String dimensionKey) {
|
||||
if (enabled) {
|
||||
return;
|
||||
}
|
||||
String remedy = integratedEnvironment()
|
||||
? "enable 'Generate Structures' for this world; Iris requires it, then deny families through "
|
||||
+ "importedStructures.disabled or complete keys through importedStructures.disabledExact"
|
||||
: "set generate-structures=true in server.properties, restart the server, "
|
||||
+ "then deny families through importedStructures.disabled or complete keys through "
|
||||
+ "importedStructures.disabledExact";
|
||||
throw new IllegalStateException("Iris generator '" + dimensionKey
|
||||
+ "' cannot bind while generate-structures=false; " + remedy);
|
||||
}
|
||||
|
||||
private static boolean integratedEnvironment() {
|
||||
try {
|
||||
return ModdedEngineBootstrap.loader().clientEnvironment();
|
||||
} catch (Throwable e) {
|
||||
// No loader bound (unit tests, very early boot): assume dedicated wording.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Null only while no level uses this generator (world creation screens, codec validation). A bound level whose
|
||||
* engine is refused, unloading or stopping throws, so no stage can mistake it for an unbound generator.
|
||||
|
||||
-11
@@ -122,17 +122,6 @@ final class ModdedNativeStructurePolicy implements NativeModdedStructureStage.Po
|
||||
return ((IrisMaterialPalette) source).get(rng, x, y, z, generator.engine().getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeException structuresDisabled(int chunkX, int chunkZ) {
|
||||
return new IllegalStateException("Iris cannot generate native structures in chunk "
|
||||
+ chunkX + "," + chunkZ
|
||||
+ " because generate-structures=false disables them outside the pack. That flag is fixed when "
|
||||
+ "the world is created (server.properties generate-structures, or the Generate Structures "
|
||||
+ "toggle in singleplayer), so it cannot be changed for this world: create a new world with "
|
||||
+ "structures enabled, then deny families through importedStructures.disabled or complete keys "
|
||||
+ "through importedStructures.disabledExact");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generationLabel(String structureId) {
|
||||
return "Iris native structure " + structureId;
|
||||
|
||||
Reference in new issue
Block a user