mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 16:55:12 +00:00
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:
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);
|
||||
|
||||
@@ -45,6 +45,22 @@ public interface IDBCPlayer extends IPlayer {
|
||||
void setExtraCode(String extraCode);
|
||||
String getExtraCode();
|
||||
|
||||
/**
|
||||
* @param slot The DBC extra inventory slot the item stack parameter will go into:
|
||||
* 0 - Weight
|
||||
* 1 - Body
|
||||
* 2 - Head
|
||||
* 3 - 4th Vanity Slot Down to the left
|
||||
* 4 - 3rd Vanity Slot Down to the left
|
||||
* 5 - 2nd Vanity Slot Down to the left
|
||||
* 6 - 1st Vanity Slot Down to the left
|
||||
* 7 - 4th Vanity Slot Down to the right
|
||||
* 8 - 3rd Vanity Slot Down to the right
|
||||
* 9 - 2nd Vanity Slot Down to the right
|
||||
* 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);
|
||||
IItemStack[] getInventory();
|
||||
|
||||
void setForm(byte form);
|
||||
|
||||
Reference in new issue
Block a user