Move effect latches into the pack runtime

- Keep one effect interval latch per effect in the pack runtime
- Pass the pack runtime to effect checks on players and spawned entities
- Resolve the deposit pack runtime once per chunk instead of once per clump
This commit is contained in:
piexel committed 2026-11-26 20:17:47 +01:00
1 parent 66b4ab8bd2
commit 99a6e5ddb6
7 files changed
+38 -25

No files matched your search

@@ -19,6 +19,7 @@
package art.arcane.iris.modded;
import art.arcane.iris.generation.runtime.PackRuntime;
import art.arcane.iris.configuration.IrisSettings;
import art.arcane.iris.generation.runtime.Engine;
import art.arcane.iris.generation.runtime.BiomeEnvironment;
@@ -223,17 +224,18 @@ public final class ModdedEngineEffects extends EngineAssignedComponent implement
}
private void applyEffects(NativeWorld level, NativeProtocolPlayer player, Iterable<IrisEffect> effects) {
PackRuntime runtime = PackRuntime.of(getEngine());
for (IrisEffect effect : effects) {
try {
applyEffect(level, player, effect);
applyEffect(level, player, effect, runtime);
} catch (Throwable error) {
IrisLogging.reportError(error);
}
}
}
private void applyEffect(NativeWorld level, NativeProtocolPlayer player, IrisEffect effect) {
if (!effect.shouldApplyNow()) {
private void applyEffect(NativeWorld level, NativeProtocolPlayer player, IrisEffect effect, PackRuntime runtime) {
if (!effect.shouldApplyNow(runtime)) {
return;
}
@@ -18,6 +18,7 @@
package art.arcane.iris.modded;
import art.arcane.iris.generation.runtime.PackRuntime;
import art.arcane.iris.configuration.IrisSettings;
import art.arcane.iris.generation.decoration.IrisSurface;
import art.arcane.iris.generation.runtime.Engine;
@@ -127,7 +128,7 @@ public final class ModdedEntitySpawner {
entity.configureAnimal(irisEntity);
applySpawnEffect(irisEntity.getSpawnEffect(), entity, level);
applySpawnEffect(irisEntity.getSpawnEffect(), entity, level, PackRuntime.of(engine));
ModdedEntityCommandRunner.run(irisEntity.getRawCommands(), level.world(), blockX, blockY, blockZ);
if (riseEffectActive && entity.living()) {
startRiseEffect(engine, level, entity);
@@ -200,8 +201,9 @@ public final class ModdedEntitySpawner {
return level.chunksSafe(chunkX, chunkZ);
}
private static void applySpawnEffect(IrisEffect effect, NativeSpawnedEntity entity, NativeEntityRuntime level) {
if (effect == null || !effect.shouldApplyNow()) {
private static void applySpawnEffect(IrisEffect effect, NativeSpawnedEntity entity, NativeEntityRuntime level,
PackRuntime runtime) {
if (effect == null || !effect.shouldApplyNow(runtime)) {
return;
}