Fix Iris entity spawn delegation

This commit is contained in:
Brian Neumann-Fopiano committed 2026-07-29 18:10:55 -04:00
1 parent 74741ac83e
commit 7ad4909518
14 files changed
+150 -35

No files matched your search

@@ -295,7 +295,7 @@ public class IrisSettings {
public boolean studio = true;
public boolean openVSCode = true;
public boolean disableTimeAndWeather = true;
public boolean enableEntitySpawning = false;
public boolean entitySpawning = true;
public boolean autoStartDefaultStudio = false;
}
@@ -295,7 +295,7 @@ public class IrisProject {
}
if (sender.isPlayer() && sender.player() != null) {
J.runEntity(sender.player(), () -> sender.player().setGameMode(GameMode.SPECTATOR));
J.runEntity(sender.player(), () -> sender.player().setGameMode(GameMode.CREATIVE));
}
activeProvider = IrisToolbelt.access(result.world());
maintenanceWorld = result.world();
@@ -82,6 +82,7 @@ public final class WorldRuntimeControlService {
IrisServices.get(art.arcane.iris.core.link.MultiverseCoreLink.class).removeFromConfig(world);
setIntGameRule(world, 0, "SPAWN_CHUNK_RADIUS", "spawnChunkRadius");
enableStudioEntitySpawning(world);
if (!IrisSettings.get().getStudio().isDisableTimeAndWeather()) {
return true;
}
@@ -100,17 +101,12 @@ public final class WorldRuntimeControlService {
applyStudioWorldRules(world);
setBooleanGameRule(world, false, "DO_FIRE_TICK", "doFireTick");
setBooleanGameRule(world, false, "DO_MOB_SPAWNING", "doMobSpawning");
setBooleanGameRule(world, false, "DO_MOB_LOOT", "doMobLoot");
setBooleanGameRule(world, false, "DO_TRADER_SPAWNING", "doTraderSpawning");
setBooleanGameRule(world, false, "DO_PATROL_SPAWNING", "doPatrolSpawning");
setBooleanGameRule(world, false, "DO_INSOMNIA", "doInsomnia");
setBooleanGameRule(world, true, "DO_IMMEDIATE_RESPAWN", "doImmediateRespawn");
setBooleanGameRule(world, false, "FALL_DAMAGE", "fallDamage");
setBooleanGameRule(world, false, "FIRE_DAMAGE", "fireDamage");
setBooleanGameRule(world, false, "DROWNING_DAMAGE", "drowningDamage");
setBooleanGameRule(world, false, "FREEZE_DAMAGE", "freezeDamage");
setBooleanGameRule(world, false, "DO_WARDEN_SPAWNING", "doWardenSpawning");
setBooleanGameRule(world, false, "MOB_GRIEFING", "mobGriefing");
setBooleanGameRule(world, false, "DO_TILE_DROPS", "doTileDrops");
setBooleanGameRule(world, true, "KEEP_INVENTORY", "keepInventory");
@@ -121,6 +117,14 @@ public final class WorldRuntimeControlService {
return true;
}
static void enableStudioEntitySpawning(World world) {
setBooleanGameRule(world, true, "DO_MOB_SPAWNING", "doMobSpawning");
setBooleanGameRule(world, true, "DO_TRADER_SPAWNING", "doTraderSpawning");
setBooleanGameRule(world, true, "DO_PATROL_SPAWNING", "doPatrolSpawning");
setBooleanGameRule(world, true, "DO_INSOMNIA", "doInsomnia");
setBooleanGameRule(world, true, "DO_WARDEN_SPAWNING", "doWardenSpawning");
}
public boolean applyNoonTimeLock(World world) {
if (world == null) {
return false;
@@ -40,8 +40,6 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.inventory.EquipmentSlot;
@@ -129,26 +127,6 @@ public class ObjectStudioSaveService implements IrisService {
unregister(event.getWorld());
}
@EventHandler(ignoreCancelled = true)
public void onCreatureSpawn(CreatureSpawnEvent event) {
if (!studios.containsKey(event.getLocation().getWorld().getUID())) return;
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
if (reason == CreatureSpawnEvent.SpawnReason.CUSTOM
|| reason == CreatureSpawnEvent.SpawnReason.COMMAND
|| reason == CreatureSpawnEvent.SpawnReason.SPAWNER_EGG) {
return;
}
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onEntitySpawn(EntitySpawnEvent event) {
if (event instanceof CreatureSpawnEvent) return;
if (!studios.containsKey(event.getLocation().getWorld().getUID())) return;
if (event.getEntity() instanceof org.bukkit.entity.Player) return;
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) return;
@@ -979,7 +979,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
return true;
}
return IrisSettings.get().getStudio().isEnableEntitySpawning();
return IrisSettings.get().getStudio().isEntitySpawning();
}
private KList<IrisEntitySpawn> spawnRandomly(List<IrisEntitySpawn> types) {