mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 04:57:27 +00:00
IDBCPlayer:
-Added getItem(byte slot) to get IItemStack objects from DBC EP slots. -Renamed setInventoryItem to setItem
This commit is contained in:
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);
|
||||
|
||||
Reference in new issue
Block a user