use of net.minecraft.server.v1_8_R3.Item in project MyPet by xXKeyleXx.
the class ConfigItem method load.
public void load(MaterialHolder material, String data) {
MinecraftKey key = new MinecraftKey(material.getLegacyName().getName());
Item item = Item.REGISTRY.get(key);
if (item == null) {
return;
}
net.minecraft.server.v1_9_R2.ItemStack is = new net.minecraft.server.v1_9_R2.ItemStack(item, 1, material.getLegacyName().getData());
if (data != null) {
NBTTagCompound tag = null;
String nbtString = data.trim();
if (nbtString.startsWith("{") && nbtString.endsWith("}")) {
try {
tag = MojangsonParser.parse(nbtString);
} catch (Exception e) {
MyPetApi.getLogger().warning("Error" + ChatColor.RESET + " in config: " + ChatColor.UNDERLINE + e.getLocalizedMessage() + ChatColor.RESET + " caused by:");
MyPetApi.getLogger().warning(item.getName() + " " + nbtString);
}
if (tag != null) {
is.setTag(tag);
}
}
}
this.item = CraftItemStack.asCraftMirror(is);
}
Aggregations