Repair rewrite continues

This commit is contained in:
nossr50
2019-06-19 23:28:11 -07:00
parent 458e198fdb
commit b41a30fa26
25 changed files with 511 additions and 155 deletions

View File

@@ -1,6 +1,26 @@
package com.gmail.nossr50.util.nbt;
import com.gmail.nossr50.mcMMO;
import net.minecraft.server.v1_13_R2.NBTBase;
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftItem;
import org.bukkit.craftbukkit.v1_13_R2.util.CraftNBTTagConfigSerializer;
import org.bukkit.inventory.ItemStack;
public class NBTUtils {
public RawNBT<?> constructNBT(String nbtString) {
try {
return new RawNBT<NBTBase>(nbtString, CraftNBTTagConfigSerializer.deserialize(nbtString));
} catch (Exception e) {
e.printStackTrace();
mcMMO.p.getLogger().severe("mcMMO was unable parse the NBT string from your config! Double check that it is proper NBT!");
return null;
}
}
public boolean hasNBT(ItemStack itemStack) {
if(CraftItem)
}
}

View File

@@ -1,10 +1,22 @@
package com.gmail.nossr50.util.nbt;
public class RawNBT {
String nbtContents;
/**
* A simple class that acts as a container for raw NBT data
* NBT data will be constructed from the raw NBT string using server internals
* This type is mostly used to take a raw string of NBT and transform it into the NBT data type used by internals
* the transformed data can then be used to check NBT data of entities in Minecraft
*
* One use of this type is as follows
* 1) Read partial or complete NBT from the config file for an item
* 2) Check an items NBT tree for this NBT data during runtime once transformed
*/
public class RawNBT<T> {
private String nbtContents;
private T nbtTree; //Will be constructed using server internals to make matching NBT easier
public RawNBT(String nbtContents) {
public RawNBT(String nbtContents, T nbtTree) {
this.nbtContents = nbtContents;
NBTUtils
}
public String getNbtContents() {