Implemented version change and build events for linked items

This commit is contained in:
Luis C.M. committed 2025-02-17 18:01:11 -06:00
1 parent f62ff8a474
commit 90bd8aeb02
6 files changed
+83 -13

No files matched your search

@@ -5,6 +5,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt;
import net.minecraftforge.common.util.Constants;
import noppes.npcs.CustomItems;
import noppes.npcs.EventHooks;
import noppes.npcs.api.handler.data.ILinkedItem;
import noppes.npcs.api.item.IItemStack;
import noppes.npcs.controllers.CustomEffectController;
@@ -41,13 +42,6 @@ public class LinkedItem implements ILinkedItem {
this.name = name;
}
public IItemStack createStack() {
LinkedItem copy = this.clone();
ItemStack stack = new ItemStack(CustomItems.linked_item, 1);
ScriptLinkedItem scriptLinkedItem = new ScriptLinkedItem(stack, copy);
return NpcAPI.Instance().getIItemStack(scriptLinkedItem.item);
}
public LinkedItemScript getScriptHandler() {
return (LinkedItemScript) LinkedItemController.getInstance().getScriptHandler(this.getId());
}
@@ -116,6 +110,14 @@ public class LinkedItem implements ILinkedItem {
LinkedItemController.getInstance().linkedItemsScripts.put(this.id, handler);
}
public IItemStack createStack() {
LinkedItem copy = this.clone();
ItemStack stack = new ItemStack(CustomItems.linked_item, 1);
ScriptLinkedItem scriptLinkedItem = new ScriptLinkedItem(stack, copy);
EventHooks.onLinkedItemBuild(scriptLinkedItem);
return NpcAPI.Instance().getIItemStack(scriptLinkedItem.item);
}
@Override
public int getId() {
return id;