mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 03:52:18 +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
+3
-6
@@ -64,14 +64,11 @@ public final class LinkedItemBuildPacket extends AbstractPacket {
|
||||
return;
|
||||
|
||||
int id = in.readInt();
|
||||
LinkedItem original = LinkedItemController.getInstance().get(id);
|
||||
if(original == null)
|
||||
LinkedItem linkedItem = LinkedItemController.getInstance().get(id);
|
||||
if(linkedItem == null)
|
||||
return;
|
||||
|
||||
LinkedItem copy = original.clone();
|
||||
EntityPlayerMP playerMP = (EntityPlayerMP) player;
|
||||
ItemStack stack = new ItemStack(CustomItems.linked_item, 1);
|
||||
ScriptLinkedItem scriptLinkedItem = new ScriptLinkedItem(stack, copy);
|
||||
playerMP.inventory.addItemStackToInventory(scriptLinkedItem.item);
|
||||
playerMP.inventory.addItemStackToInventory(linkedItem.createStack().getMCItemStack());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user