IDBCPlayer:

-Items can be set in vanity or armor slots, based on a "vanity" boolean value in setItem().

ISkinOverlay:
-Renamed setScale to setTextureScale.
This commit is contained in:
Luis C.M committed 2022-06-19 15:18:13 -05:00
1 parent 3f8910f5bd
commit 1ca5a306fc
5 files changed
+20 -18

No files matched your search

@@ -428,14 +428,16 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
return compound.getCompoundTag("JRMCEP").getString("extracode");
}
public void setItem(byte slot, IItemStack itemStack) {
public void setItem(IItemStack itemStack, byte slot, boolean vanity) {
NBTTagCompound compound = new NBTTagCompound();
this.player.writeToNBT(compound);
byte offset = (byte) (vanity ? 10 : 2);
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) {
if (offset - list.getCompoundTagAt(i).getByte("Slot") != slot) {
newList.appendTag(list.getCompoundTagAt(i));
}
}
@@ -444,20 +446,22 @@ public class ScriptDBCPlayer<T extends EntityPlayerMP> extends ScriptPlayer<T> i
if (itemStack != null) {
itemStack.getMCItemStack().writeToNBT(compoundItem);
}
compoundItem.setByte("Slot", slot);
compoundItem.setByte("Slot", (byte) (offset - slot));
newList.appendTag(compoundItem);
compound.getCompoundTag("JRMCEP").setTag("dbcExtraInvTag", newList);
this.player.readFromNBT(compound);
}
public IItemStack getItem(byte slot) {
public IItemStack getItem(byte slot, boolean vanity) {
NBTTagCompound compound = new NBTTagCompound();
this.player.writeToNBT(compound);
byte offset = (byte) (vanity ? 10 : 2);
NBTTagList list = compound.getCompoundTag("JRMCEP").getTagList("dbcExtraInvTag",10);
for (int i = 0; i < list.tagCount(); i++) {
if (list.getCompoundTagAt(i).getByte("Slot") == slot) {
if (offset - list.getCompoundTagAt(i).getByte("Slot") == slot) {
return NpcAPI.Instance().getIItemStack(ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i)));
}
}