mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 18:49:39 +00:00
Added a function to create an item stack from a linked item in the LinkedItem class, referenced in the controller and creation packet as well.
This commit is contained in:
1 parent
5c04b1aae6
commit
f62ff8a474
3 files changed
+25
-6
No files matched your search
@@ -1,10 +1,16 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.api.handler.data.ILinkedItem;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.controllers.CustomEffectController;
|
||||
import noppes.npcs.controllers.LinkedItemController;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.item.ScriptLinkedItem;
|
||||
|
||||
public class LinkedItem implements ILinkedItem {
|
||||
public static final String LINKED_VERSION_VERSION_TAG = "LinkedVersion";
|
||||
@@ -35,6 +41,13 @@ 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());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user