|
@@ -143,9 +143,6 @@ public class ItemStackUtils {
|
|
return (com.getInt("HideFlags") & b) == b;
|
|
return (com.getInt("HideFlags") & b) == b;
|
|
}
|
|
}
|
|
|
|
|
|
- // -----------------------------------------------------------------------------------
|
|
|
|
- // Converter
|
|
|
|
- // -----------------------------------------------------------------------------------
|
|
|
|
public static String getNbtString(ItemStack stack) {
|
|
public static String getNbtString(ItemStack stack) {
|
|
return stack.write(new CompoundNBT()).toString();
|
|
return stack.write(new CompoundNBT()).toString();
|
|
}
|
|
}
|
|
@@ -155,55 +152,6 @@ public class ItemStackUtils {
|
|
return ItemStack.read(c);
|
|
return ItemStack.read(c);
|
|
}
|
|
}
|
|
|
|
|
|
- // -----------------------------------------------------------------------------------
|
|
|
|
- // Misc
|
|
|
|
- // -----------------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
- /*public ITextComponent getDisplayName() {
|
|
|
|
- CompoundNBT compoundnbt = this.getChildTag("display");
|
|
|
|
- if (compoundnbt != null && compoundnbt.contains("Name", 8)) {
|
|
|
|
- try {
|
|
|
|
- ITextComponent itextcomponent = ITextComponent.Serializer.fromJson(compoundnbt.getString("Name"));
|
|
|
|
- if (itextcomponent != null) {
|
|
|
|
- return itextcomponent;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- compoundnbt.remove("Name");
|
|
|
|
- } catch (JsonParseException var3) {
|
|
|
|
- compoundnbt.remove("Name");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return this.getItem().getDisplayName(this);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public ItemStack setDisplayName(@Nullable ITextComponent name) {
|
|
|
|
- CompoundNBT compoundnbt = this.getOrCreateChildTag("display");
|
|
|
|
- if (name != null) {
|
|
|
|
- compoundnbt.putString("Name", ITextComponent.Serializer.toJson(name));
|
|
|
|
- } else {
|
|
|
|
- compoundnbt.remove("Name");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return this;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (compoundnbt.getTagId("Lore") == 9) {
|
|
|
|
- ListNBT listnbt = compoundnbt.getList("Lore", 8);
|
|
|
|
-
|
|
|
|
- for(int j = 0; j < listnbt.size(); ++j) {
|
|
|
|
- String s = listnbt.getString(j);
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- ITextComponent itextcomponent1 = ITextComponent.Serializer.fromJson(s);
|
|
|
|
- if (itextcomponent1 != null) {
|
|
|
|
- list.add(TextComponentUtils.mergeStyles(itextcomponent1, (new Style()).setColor(TextFormatting.DARK_PURPLE).setItalic(true)));
|
|
|
|
- }
|
|
|
|
- } catch (JsonParseException var19) {
|
|
|
|
- compoundnbt.remove("Lore");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }*/
|
|
|
|
public static void setLore(ItemStack stack, List<Object> list) {
|
|
public static void setLore(ItemStack stack, List<Object> list) {
|
|
CompoundNBT com = stack.getOrCreateChildTag("display");
|
|
CompoundNBT com = stack.getOrCreateChildTag("display");
|
|
ListNBT nbtList = new ListNBT();
|
|
ListNBT nbtList = new ListNBT();
|