This commit is contained in:
YuTian 2024-07-27 17:10:03 +08:00
parent f57af31969
commit d1cffafcfd
3 changed files with 15 additions and 15 deletions

View File

@ -127,32 +127,32 @@ public interface INBT {
}
static INBT as(net.minecraft.nbt.NBTBase nbtBase) {
byte type = nbtBase.a();
byte type = nbtBase.b();
switch (type) {
case 1:
NBTTagByte nbtTagByte = (NBTTagByte) nbtBase;
return new NBTByte(nbtTagByte.h());
return new NBTByte(nbtTagByte.i());
case 2:
NBTTagShort nbtTagShort = (NBTTagShort) nbtBase;
return new NBTShort(nbtTagShort.g());
return new NBTShort(nbtTagShort.h());
case 3:
NBTTagInt nbtTagInt = (NBTTagInt) nbtBase;
return new NBTInt(nbtTagInt.f());
return new NBTInt(nbtTagInt.g());
case 4:
NBTTagLong nbtTagLong = (NBTTagLong) nbtBase;
return new NBTLong(nbtTagLong.e());
return new NBTLong(nbtTagLong.f());
case 5:
NBTTagFloat nbtTagFloat = (NBTTagFloat) nbtBase;
return new NBTFloat(nbtTagFloat.j());
return new NBTFloat(nbtTagFloat.k());
case 6:
NBTTagDouble nbtTagDouble = (NBTTagDouble) nbtBase;
return new NBTDouble(nbtTagDouble.i());
return new NBTDouble(nbtTagDouble.j());
case 7:
NBTTagByteArray tagByteArray = (NBTTagByteArray) nbtBase;
return new NBTByteArray(tagByteArray.d());
return new NBTByteArray(tagByteArray.e());
case 8:
NBTTagString nbtTagString = (NBTTagString) nbtBase;
return new NBTString(nbtTagString.e_());
return new NBTString(nbtTagString.m_());
case 9:
NBTTagList nbtTagList = (NBTTagList) nbtBase;
List<INBT> list = new ArrayList<>();
@ -163,16 +163,16 @@ public interface INBT {
case 10:
NBTTagCompound nbtTagCompound = (NBTTagCompound) nbtBase;
Map<String, INBT> map = new HashMap<>();
for (String key : nbtTagCompound.d()) {
for (String key : nbtTagCompound.e()) {
map.put(key, as(nbtTagCompound.c(key)));
}
return new NBTCompound(map);
case 11:
NBTTagIntArray nbtTagIntArray = (NBTTagIntArray) nbtBase;
return new NBTIntArray(nbtTagIntArray.f());
return new NBTIntArray(nbtTagIntArray.g());
case 12:
NBTTagLongArray nbtTagLongArray = (NBTTagLongArray) nbtBase;
return new NBTLongArray(nbtTagLongArray.f());
return new NBTLongArray(nbtTagLongArray.g());
}
return null;
}

View File

@ -1,7 +1,7 @@
package com.io.yutian.elementoriginlib.nbt;
import net.minecraft.nbt.NBTTagCompound;
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@ -22,7 +22,7 @@ public class NBTItem {
@NotNull
public NBTCompound getTag() {
NBTTagCompound tag = nmsItemStack.u();
NBTTagCompound tag = nmsItemStack.w();
if (tag == null) {
tag = new NBTTagCompound();
}

View File

@ -4,7 +4,7 @@ import com.io.yutian.elementoriginlib.exception.SerializeException;
import com.io.yutian.elementoriginlib.serialize.serializers.ItemStackSerializer;
import com.io.yutian.elementoriginlib.serialize.serializers.UUIDSerializer;
import com.io.yutian.elementoriginlib.util.ReflectionUtil;
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import org.json.JSONArray;
import org.json.JSONObject;