0.1h More easily fix bug in NmsItem

This commit is contained in:
BuildTools 2016-03-10 07:53:32 +01:00 committed by Olof Larsson
parent bc1e4351f9
commit a1652849ea

View File

@ -55,11 +55,13 @@ public class NmsItem extends NmsAbstract
public static String itemToString(ItemStack item) public static String itemToString(ItemStack item)
{ {
if (item == null) throw new NullPointerException("item");
if ( ! get().isAvailable()) return null; if ( ! get().isAvailable()) return null;
try try
{ {
Object nmsItem = toNms.invoke(null, item); Object nmsItem = toNms.invoke(null, item);
if (nmsItem == null) throw new RuntimeException(); if (nmsItem == null) throw new RuntimeException(item.toString());
String str = toJson.invoke(nmsItem, nbtTag.newInstance()).toString(); String str = toJson.invoke(nmsItem, nbtTag.newInstance()).toString();
return str; return str;
} }