SyncController OVERHAUL PHASE #1:

- Refactored EnumSyncType into object based SyncType registry, so other mods can register their own types
This commit is contained in:
bigguy345 committed 2026-03-31 19:59:53 +02:00
1 parent b2c279feeb
commit 48281c8d34
13 files changed
+673 -558

No files matched your search

@@ -1,7 +1,7 @@
package noppes.npcs.controllers;
import kamkeel.npcs.controllers.SyncController;
import kamkeel.npcs.network.enums.EnumSyncType;
import kamkeel.npcs.network.enums.SyncType;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -239,7 +239,7 @@ public class DialogController implements IDialogHandler {
dir.mkdirs();
}
categories.put(category.id, category);
SyncController.syncUpdate(EnumSyncType.DIALOG_CATEGORY, -1, SyncController.updateDialogCat(category));
SyncController.syncUpdate(SyncType.DIALOG_CATEGORY, -1, SyncController.updateDialogCat(category));
}
public void removeCategory(int category) {
@@ -252,7 +252,7 @@ public class DialogController implements IDialogHandler {
for (int dia : cat.dialogs.keySet())
dialogs.remove(dia);
categories.remove(category);
SyncController.syncRemove(EnumSyncType.DIALOG_CATEGORY, category);
SyncController.syncRemove(SyncType.DIALOG_CATEGORY, category);
}
private boolean containsCategoryName(String name) {
@@ -302,7 +302,7 @@ public class DialogController implements IDialogHandler {
if (file2.exists())
file2.delete();
file.renameTo(file2);
SyncController.syncUpdate(EnumSyncType.DIALOG, category.id, dialog.writeToNBT(new NBTTagCompound()));
SyncController.syncUpdate(SyncType.DIALOG, category.id, dialog.writeToNBT(new NBTTagCompound()));
} catch (Exception e) {
LogWriter.except(e);
}
@@ -316,7 +316,7 @@ public class DialogController implements IDialogHandler {
return;
category.dialogs.remove(dialog.id);
dialogs.remove(dialog.id);
SyncController.syncRemove(EnumSyncType.DIALOG, dialog.id);
SyncController.syncRemove(SyncType.DIALOG, dialog.id);
}
private File getDir() {