Fix NPC biome spawn settings not persisting after editing

When users modified biomes, dimensions, or spawning options through the
sub-GUI dialogs, changes were only stored in client memory and never sent
to the server. This caused spawn configurations to appear correct in the
UI but fail to work after server restarts.

The closeSubGui() method now calls save() when SubGuiNpcBiomes,
SubGuiNpcDimensions, or SubGuiSpawningOptions dialogs close, ensuring
changes are immediately sent to the server via NaturalSpawnSavePacket.

Added @Override annotation for consistency with other GUI classes.
This commit is contained in:
Claude committed 2026-01-02 09:50:28 +00:00
1 parent 8dad290486
commit f6114dfa5e
1 file changed
+4
@@ -262,6 +262,7 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
public void setSelected(String selected) {
}
@Override
public void closeSubGui(SubGuiInterface gui) {
super.closeSubGui(gui);
if (gui instanceof GuiNpcMobSpawnerSelector && this.spawnEntryScroll.hasSelected()) {
@@ -270,6 +271,9 @@ public class GuiNpcNaturalSpawns extends GuiNPCInterface2 implements IGuiData, I
this.spawn.spawnCompounds.put(selected, selector.getCompound());
initGui();
}
if (gui instanceof SubGuiNpcBiomes || gui instanceof SubGuiNpcDimensions || gui instanceof SubGuiSpawningOptions) {
save();
}
}
@Override