mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 09:09:08 +00:00
Implemented version change and build events for linked items
This commit is contained in:
1 parent
f62ff8a474
commit
90bd8aeb02
6 files changed
+83
-13
No files matched your search
@@ -22,6 +22,7 @@ import noppes.npcs.api.gui.IItemSlot;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
import noppes.npcs.api.handler.data.IFrame;
|
||||
import noppes.npcs.api.item.IItemCustomizable;
|
||||
import noppes.npcs.api.item.IItemLinked;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.CustomGuiController;
|
||||
@@ -146,6 +147,24 @@ public class EventHooks {
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onLinkedItemVersionChange(IItemLinked item, int version, int prevVersion) {
|
||||
INpcScriptHandler handler = (INpcScriptHandler) item.getScriptHandler();
|
||||
LinkedItemEvent.VersionChangeEvent event = new LinkedItemEvent.VersionChangeEvent(item, version, prevVersion);
|
||||
if (handler != null) {
|
||||
handler.callScript(EnumScriptType.LINKED_ITEM_VERSION, event);
|
||||
}
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onLinkedItemBuild(IItemLinked item) {
|
||||
INpcScriptHandler handler = (INpcScriptHandler) item.getScriptHandler();
|
||||
LinkedItemEvent.BuildEvent event = new LinkedItemEvent.BuildEvent(item);
|
||||
if (handler != null) {
|
||||
handler.callScript(EnumScriptType.LINKED_ITEM_BUILD, event);
|
||||
}
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onNPCInit(EntityNPCInterface npc) {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user