mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 04:57:27 +00:00
NBT Tag Helpers
This commit is contained in:
1 parent
311e45b010
commit
1d2e00a0fb
1 file changed
+29
-4
@@ -1,10 +1,7 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagDouble;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.*;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.data.IScriptHandler;
|
||||
|
||||
@@ -12,6 +9,19 @@ import java.util.*;
|
||||
|
||||
public class NBTTags {
|
||||
|
||||
public static int TAG_End = 0;
|
||||
public static int TAG_Byte = 1;
|
||||
public static int TAG_Short = 2;
|
||||
public static int TAG_Int = 3;
|
||||
public static int TAG_Long = 4;
|
||||
public static int TAG_Float = 5;
|
||||
public static int TAG_Double = 6;
|
||||
public static int TAG_Byte_Array = 7;
|
||||
public static int TAG_String = 8;
|
||||
public static int TAG_List = 9;
|
||||
public static int TAG_Compound = 10;
|
||||
public static int TAG_Int_Array = 11;
|
||||
|
||||
public static HashMap<Integer, ItemStack> getItemStackList(
|
||||
NBTTagList tagList) {
|
||||
HashMap<Integer, ItemStack> list = new HashMap<Integer, ItemStack>();
|
||||
@@ -585,4 +595,19 @@ public class NBTTags {
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static int getIntAt(NBTTagList tagList, int index)
|
||||
{
|
||||
if (index >= 0 && index < tagList.tagCount())
|
||||
{
|
||||
NBTBase nbtbase = tagList.getCompoundTagAt(index);
|
||||
|
||||
if (nbtbase.getId() == 3)
|
||||
{
|
||||
return ((NBTTagInt)nbtbase).func_150287_d();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user