mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 13:25:10 +00:00
Fix Magic Crashes
This commit is contained in:
1 parent
180d257024
commit
06a8317860
4 files changed
+50
-4
No files matched your search
@@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.api.handler.IMagicHandler;
|
||||
import noppes.npcs.controllers.data.Magic;
|
||||
import noppes.npcs.controllers.data.MagicAssociation;
|
||||
import noppes.npcs.controllers.data.MagicCycle;
|
||||
@@ -17,7 +18,7 @@ import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
public class MagicController {
|
||||
public class MagicController implements IMagicHandler {
|
||||
public HashMap<Integer, Magic> magics = new HashMap<>();
|
||||
public HashMap<Integer, Magic> magicSync = new HashMap<>();
|
||||
|
||||
@@ -37,10 +38,12 @@ public class MagicController {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Magic getMagic(int magicId) {
|
||||
return magics.get(magicId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MagicCycle getCycle(int cycleID) {
|
||||
return cycles.get(cycleID);
|
||||
}
|
||||
@@ -322,6 +325,7 @@ public class MagicController {
|
||||
/**
|
||||
* Associates a magic with a category along with its per-category ordering data.
|
||||
*/
|
||||
@Override
|
||||
public void addMagicToCycle(int magicId, int cycleId, int index, int priority) {
|
||||
MagicCycle cat = cycles.get(cycleId);
|
||||
if (cat == null)
|
||||
@@ -340,6 +344,7 @@ public class MagicController {
|
||||
saveCycle(cat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMagicFromCycle(int magicId, int cycleId) {
|
||||
MagicCycle cat = cycles.get(cycleId);
|
||||
if (cat == null) return;
|
||||
|
||||
Reference in new issue
Block a user