IDBCPlayer:

-Added getItem(byte slot) to get IItemStack objects from DBC EP slots.
-Renamed setInventoryItem to setItem
This commit is contained in:
Luis C.M committed 2022-06-13 21:24:55 -05:00
1 parent ab5775f8f3
commit c7085f7acb
2 files changed
+17 -2

No files matched your search

@@ -428,7 +428,7 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
return compound.getCompoundTag("JRMCEP").getString("extracode");
}
public void setInventoryItem(byte slot, IItemStack itemStack) {
public void setItem(byte slot, IItemStack itemStack) {
NBTTagCompound compound = new NBTTagCompound();
this.player.writeToNBT(compound);
@@ -451,6 +451,20 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
this.player.readFromNBT(compound);
}
public IItemStack getItem(byte slot) {
NBTTagCompound compound = new NBTTagCompound();
this.player.writeToNBT(compound);
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag",10);
for (int i = 0; i < list.tagCount(); i++) {
if (list.getCompoundTagAt(i).getByte("Slot") == slot) {
return NpcAPI.Instance().getIItemStack(ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i)));
}
}
return null;
}
public IItemStack[] getInventory(){
NBTTagCompound compound = new NBTTagCompound();
this.player.writeToNBT(compound);
@@ -60,7 +60,8 @@ public interface IDBCPlayer extends IPlayer {
* 10 - 1st Vanity Slot Down to the right
* @param itemStack The item stack to be set into the slot. Set to null to remove the stack in that slot.
*/
void setInventoryItem(byte slot, IItemStack itemStack);
void setItem(byte slot, IItemStack itemStack);
IItemStack getItem(byte slot);
IItemStack[] getInventory();
void setForm(byte form);