Support icon amount > 1 for API calls

This commit is contained in:
filoghost 2019-10-17 16:21:20 +02:00
parent 0c0ec27233
commit 8293f8b642
12 changed files with 12 additions and 27 deletions

View File

@ -221,9 +221,8 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.count = 0;
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -197,8 +197,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.setCount(1);
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -197,8 +197,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.setCount(1);
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -197,8 +197,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.setCount(1);
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -197,8 +197,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.setCount(1);
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -199,8 +199,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.setCount(1);
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -178,14 +178,13 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagCompound display = newItem.getTag().getCompound("display"); NBTTagCompound display = newItem.getTag().getCompound("display");
if (!newItem.getTag().hasKey("display")) { if (!newItem.getTag().hasKey("display")) {
newItem.getTag().set("display", display); newItem.getTag().set("display", display);
} }
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.count = 0;
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -178,14 +178,13 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagCompound display = newItem.getTag().getCompound("display"); NBTTagCompound display = newItem.getTag().getCompound("display");
if (!newItem.getTag().hasKey("display")) { if (!newItem.getTag().hasKey("display")) {
newItem.getTag().set("display", display); newItem.getTag().set("display", display);
} }
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.count = 0;
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -178,14 +178,13 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagCompound display = newItem.getTag().getCompound("display"); NBTTagCompound display = newItem.getTag().getCompound("display");
if (!newItem.getTag().hasKey("display")) { if (!newItem.getTag().hasKey("display")) {
newItem.getTag().set("display", display); newItem.getTag().set("display", display);
} }
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.count = 0;
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -215,14 +215,13 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagCompound display = newItem.getTag().getCompound("display"); NBTTagCompound display = newItem.getTag().getCompound("display");
if (!newItem.getTag().hasKey("display")) { if (!newItem.getTag().hasKey("display")) {
newItem.getTag().set("display", display); newItem.getTag().set("display", display);
} }
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.count = 0;
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -216,14 +216,13 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
NBTTagCompound display = newItem.getTag().getCompound("display"); NBTTagCompound display = newItem.getTag().getCompound("display");
if (!newItem.getTag().hasKey("display")) { if (!newItem.getTag().hasKey("display")) {
newItem.getTag().set("display", display); newItem.getTag().set("display", display);
} }
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore tagList.add(new NBTTagString(ItemUtils.ANTISTACK_LORE)); // Antistack lore
display.set("Lore", tagList); display.set("Lore", tagList);
newItem.count = 0;
setItemStack(newItem); setItemStack(newItem);
} }

View File

@ -50,6 +50,7 @@ public class CraftItemLine extends CraftTouchableLine implements ItemLine {
@Override @Override
public void setItemStack(ItemStack itemStack) { public void setItemStack(ItemStack itemStack) {
Validator.notNull(itemStack, "itemStack"); Validator.notNull(itemStack, "itemStack");
Validator.isTrue(0 < itemStack.getAmount() && itemStack.getAmount() <= 64, "Item must have amount between 1 and 64");
this.itemStack = itemStack; this.itemStack = itemStack;
if (nmsItem != null) { if (nmsItem != null) {