mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 16:29:39 +00:00
SyncController OVERHAUL PHASE #1:
- Refactored EnumSyncType into object based SyncType registry, so other mods can register their own types
This commit is contained in:
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.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -128,7 +128,7 @@ public class CustomEffectController implements ICustomEffectHandler {
|
||||
file.delete();
|
||||
}
|
||||
categoryManager.removeItem(id);
|
||||
SyncController.syncRemove(EnumSyncType.CUSTOM_EFFECTS, foundEffect.getID());
|
||||
SyncController.syncRemove(SyncType.CUSTOM_EFFECTS, foundEffect.getID());
|
||||
saveEffectLoadMap();
|
||||
}
|
||||
}
|
||||
@@ -700,7 +700,7 @@ public class CustomEffectController implements ICustomEffectHandler {
|
||||
file2.delete();
|
||||
file.renameTo(file2);
|
||||
nbtTagCompound.removeTag("ScriptData");
|
||||
SyncController.syncUpdate(EnumSyncType.CUSTOM_EFFECTS, -1, nbtTagCompound);
|
||||
SyncController.syncUpdate(SyncType.CUSTOM_EFFECTS, -1, nbtTagCompound);
|
||||
} catch (Exception e) {
|
||||
LogWriter.except(e);
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
@@ -159,7 +159,7 @@ public class FactionController implements IFactionHandler {
|
||||
|
||||
NBTTagCompound facCompound = new NBTTagCompound();
|
||||
faction.writeNBT(facCompound);
|
||||
SyncController.syncUpdate(EnumSyncType.FACTION, -1, facCompound);
|
||||
SyncController.syncUpdate(SyncType.FACTION, -1, facCompound);
|
||||
saveFactions();
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public class FactionController implements IFactionHandler {
|
||||
} else {
|
||||
this.saveFactions();
|
||||
faction.id = -1;
|
||||
SyncController.syncRemove(EnumSyncType.FACTION, id);
|
||||
SyncController.syncRemove(SyncType.FACTION, id);
|
||||
return faction;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -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.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -275,7 +275,7 @@ public class MagicController implements IMagicHandler {
|
||||
|
||||
NBTTagCompound magicCompound = new NBTTagCompound();
|
||||
mag.writeNBT(magicCompound);
|
||||
SyncController.syncUpdate(EnumSyncType.MAGIC, -1, magicCompound);
|
||||
SyncController.syncUpdate(SyncType.MAGIC, -1, magicCompound);
|
||||
|
||||
saveMagicData();
|
||||
}
|
||||
@@ -283,7 +283,7 @@ public class MagicController implements IMagicHandler {
|
||||
public void removeMagic(int magicID) {
|
||||
if (magics.containsKey(magicID)) {
|
||||
magics.remove(magicID);
|
||||
SyncController.syncRemove(EnumSyncType.MAGIC, magicID);
|
||||
SyncController.syncRemove(SyncType.MAGIC, magicID);
|
||||
saveMagicData();
|
||||
}
|
||||
}
|
||||
@@ -345,7 +345,7 @@ public class MagicController implements IMagicHandler {
|
||||
|
||||
NBTTagCompound cycleCompound = new NBTTagCompound();
|
||||
cycle.writeNBT(cycleCompound);
|
||||
SyncController.syncUpdate(EnumSyncType.MAGIC_CYCLE, -1, cycleCompound);
|
||||
SyncController.syncUpdate(SyncType.MAGIC_CYCLE, -1, cycleCompound);
|
||||
|
||||
saveMagicData();
|
||||
}
|
||||
@@ -353,7 +353,7 @@ public class MagicController implements IMagicHandler {
|
||||
public void removeCycle(int categoryId) {
|
||||
if (cycles.containsKey(categoryId)) {
|
||||
cycles.remove(categoryId);
|
||||
SyncController.syncRemove(EnumSyncType.MAGIC_CYCLE, categoryId);
|
||||
SyncController.syncRemove(SyncType.MAGIC_CYCLE, categoryId);
|
||||
saveMagicData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -158,7 +158,7 @@ public class QuestController implements IQuestHandler {
|
||||
for (int dia : cat.quests.keySet())
|
||||
quests.remove(dia);
|
||||
categories.remove(category);
|
||||
SyncController.syncRemove(EnumSyncType.QUEST_CATEGORY, category);
|
||||
SyncController.syncRemove(SyncType.QUEST_CATEGORY, category);
|
||||
}
|
||||
|
||||
public void saveCategory(QuestCategory category) {
|
||||
@@ -188,7 +188,7 @@ public class QuestController implements IQuestHandler {
|
||||
dir.mkdirs();
|
||||
}
|
||||
categories.put(category.id, category);
|
||||
SyncController.syncUpdate(EnumSyncType.QUEST_CATEGORY, -1, SyncController.updateQuestCat(category));
|
||||
SyncController.syncUpdate(SyncType.QUEST_CATEGORY, -1, SyncController.updateQuestCat(category));
|
||||
}
|
||||
|
||||
private boolean containsCategoryName(String name) {
|
||||
@@ -245,7 +245,7 @@ public class QuestController implements IQuestHandler {
|
||||
if (file2.exists())
|
||||
file2.delete();
|
||||
file.renameTo(file2);
|
||||
SyncController.syncUpdate(EnumSyncType.QUEST, category.id, quest.writeToNBT(new NBTTagCompound()));
|
||||
SyncController.syncUpdate(SyncType.QUEST, category.id, quest.writeToNBT(new NBTTagCompound()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user