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:
Luis C.M. committed 2025-02-17 17:26:40 -06:00
1 parent 5c04b1aae6
commit f62ff8a474
3 files changed
+25 -6

No files matched your search

@@ -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());
}
}