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

View File

@ -1,7 +1,7 @@
package com.io.yutian.elementoriginlib.nbt; package com.io.yutian.elementoriginlib.nbt;
import net.minecraft.nbt.NBTTagCompound; 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.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -22,7 +22,7 @@ public class NBTItem {
@NotNull @NotNull
public NBTCompound getTag() { public NBTCompound getTag() {
NBTTagCompound tag = nmsItemStack.u(); NBTTagCompound tag = nmsItemStack.w();
if (tag == null) { if (tag == null) {
tag = new NBTTagCompound(); 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.ItemStackSerializer;
import com.io.yutian.elementoriginlib.serialize.serializers.UUIDSerializer; import com.io.yutian.elementoriginlib.serialize.serializers.UUIDSerializer;
import com.io.yutian.elementoriginlib.util.ReflectionUtil; 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.bukkit.inventory.ItemStack;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;