Scheduled Actions

This commit is contained in:
Kam committed 2025-03-03 20:05:19 -05:00
1 parent 150b8bfe2d
commit c2fa74c541
5 files changed
+19 -38

No files matched your search

+1 -1
Submodule src/api updated: e13c6762f3...18d72cc96c.
@@ -154,32 +154,6 @@ public class NoppesUtil {
}
private static HashMap<String,Integer> data = new HashMap<String,Integer>();
private static HashMap<String,Integer> group = new HashMap<String,Integer>();
public static void setScrollGroup(ByteBuf buffer) {
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if(gui == null)
return;
try {
int size = buffer.readInt();
for(int i = 0; i < size; i++){
int id = buffer.readInt();
String name = ByteBufUtils.readString(buffer);
group.put(name, id);
}
} catch (Exception ignored) {
}
if(gui instanceof GuiNPCInterface && ((GuiNPCInterface)gui).hasSubGui()){
gui = (GuiScreen) ((GuiNPCInterface)gui).getSubGui();
}
if(gui instanceof GuiContainerNPCInterface && ((GuiContainerNPCInterface)gui).hasSubGui()){
gui = (GuiScreen) ((GuiContainerNPCInterface)gui).getSubGui();
}
if(gui instanceof IScrollGroup)
((IScrollGroup)gui).setScrollGroup(new Vector<String>(group.keySet()), group);
group = new HashMap<String,Integer>();
}
public static void setScrollData(ByteBuf buffer) {
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if(gui == null)
@@ -28,7 +28,7 @@ public class MagicController {
public HashMap<Integer, MagicCycle> cyclesSync = new HashMap<>();
public int lastUsedCycleID = 0;
private int lastUsedID = 0;
private int lastUsedMagicID = 0;
private static MagicController instance;
@@ -49,6 +49,12 @@ public class MagicController {
}
public void load() {
magics.clear();
cycles.clear();
lastUsedCycleID = 0;
lastUsedMagicID = 0;
File saveDir = CustomNpcs.getWorldSaveDirectory();
if (saveDir == null) return;
try {
@@ -135,7 +141,7 @@ public class MagicController {
public void loadMagic(DataInputStream stream) throws IOException {
NBTTagCompound compound = CompressedStreamTools.read(stream);
lastUsedID = compound.getInteger("lastID");
lastUsedMagicID = compound.getInteger("lastID");
lastUsedCycleID = compound.getInteger("lastCatID");
// Load magics
@@ -173,7 +179,7 @@ public class MagicController {
catList.appendTag(catCompound);
}
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("lastID", lastUsedID);
compound.setInteger("lastID", lastUsedMagicID);
compound.setInteger("lastCycleID", lastUsedCycleID);
compound.setTag("Magics", magicList);
compound.setTag("Cycles", catList);
@@ -213,13 +219,13 @@ public class MagicController {
}
public int getUnusedId() {
if (lastUsedID == 0) {
if (lastUsedMagicID == 0) {
for (int id : magics.keySet())
if (id > lastUsedID)
lastUsedID = id;
if (id > lastUsedMagicID)
lastUsedMagicID = id;
}
lastUsedID++;
return lastUsedID;
lastUsedMagicID++;
return lastUsedMagicID;
}
public boolean hasName(String newName) {
@@ -1,7 +1,8 @@
package noppes.npcs.scripted;
import noppes.npcs.api.IAction;
import noppes.npcs.api.IActionManager;
import noppes.npcs.api.handler.IActionManager;
import noppes.npcs.api.handler.data.IAction;
import java.util.HashMap;
import java.util.LinkedList;
@@ -3,13 +3,13 @@ package noppes.npcs.scripted.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.api.IActionManager;
import noppes.npcs.api.IPos;
import noppes.npcs.api.ITimers;
import noppes.npcs.api.entity.ICustomNpc;
import noppes.npcs.api.entity.IEntityLivingBase;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.entity.data.IModelData;
import noppes.npcs.api.handler.IActionManager;
import noppes.npcs.api.handler.IOverlayHandler;
import noppes.npcs.api.handler.data.IAnimationData;
import noppes.npcs.api.handler.data.IDialog;