mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 04:25:26 +02:00
Repair rewrite continues
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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() {
|
||||
|
Reference in New Issue
Block a user