Add some more stuff to the NBTHelper

This commit is contained in:
Pahimar 2014-07-21 16:19:25 -04:00
parent e1c677d3d8
commit 5718da1aa9

View file

@ -3,6 +3,7 @@ package com.pahimar.ee3.util;
import com.pahimar.ee3.reference.Names;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import java.util.UUID;
@ -228,13 +229,34 @@ public class NBTHelper
itemStack.stackTagCompound.setDouble(keyName, keyValue);
}
// tag list
public static NBTTagList getTagList(ItemStack itemStack, String keyName, int nbtBaseType)
{
initNBTTagCompound(itemStack);
if (!itemStack.stackTagCompound.hasKey(keyName))
{
setTagList(itemStack, keyName, new NBTTagList());
}
return itemStack.stackTagCompound.getTagList(keyName, nbtBaseType);
}
public static void setTagList(ItemStack itemStack, String keyName, NBTTagList nbtTagList)
{
initNBTTagCompound(itemStack);
itemStack.stackTagCompound.setTag(keyName, nbtTagList);
}
// tag compound
public static NBTTagCompound getTagCompound(ItemStack itemStack, String keyName)
{
initNBTTagCompound(itemStack);
if (!itemStack.stackTagCompound.hasKey(keyName))
{
setDouble(itemStack, keyName, 0);
setTagCompound(itemStack, keyName, new NBTTagCompound());
}
return itemStack.stackTagCompound.getCompoundTag(keyName);