IDBCPlayer:

-Added void setInventoryItem(byte slot, IItemStack itemStack) function to set and remove (set null) items from DBC extra inventory.
This commit is contained in:
Luis C.M committed 2022-06-13 21:01:58 -05:00
1 parent dd207757ea
commit ab5775f8f3
2 files changed
+39

No files matched your search

@@ -428,6 +428,29 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
return compound.getCompoundTag("JRMCEP").getString("extracode");
}
public void setInventoryItem(byte slot, IItemStack itemStack) {
NBTTagCompound compound = new NBTTagCompound();
this.player.writeToNBT(compound);
NBTTagList newList = new NBTTagList();
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag",10);
for (int i = 0; i < list.tagCount(); i++) {
if (list.getCompoundTagAt(i).getByte("Slot") != slot) {
newList.appendTag(list.getCompoundTagAt(i));
}
}
NBTTagCompound compoundItem = new NBTTagCompound();
if (itemStack != null) {
itemStack.getMCItemStack().writeToNBT(compoundItem);
}
compoundItem.setByte("Slot", slot);
newList.appendTag(compoundItem);
compound.getCompoundTag("JRMCEP").setTag("dbcExtraInvTag", newList);
this.player.readFromNBT(compound);
}
public IItemStack[] getInventory(){
NBTTagCompound compound = new NBTTagCompound();
this.player.writeToNBT(compound);