From 148665e55eeb6818707adf067f91c652aeae4c2e Mon Sep 17 00:00:00 2001 From: Guillaume Mercier Date: Thu, 19 Dec 2024 10:09:26 -0500 Subject: [PATCH] Fix nbtedit using the wrong datatypes. (#164) --- src/main/java/serverutils/client/gui/GuiEditNBT.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/serverutils/client/gui/GuiEditNBT.java b/src/main/java/serverutils/client/gui/GuiEditNBT.java index 94370819..934e96a3 100644 --- a/src/main/java/serverutils/client/gui/GuiEditNBT.java +++ b/src/main/java/serverutils/client/gui/GuiEditNBT.java @@ -212,7 +212,12 @@ public void onCallback(ConfigValue value, boolean set) { if (set) { switch (nbt.getId()) { case Constants.NBT.TAG_BYTE: + nbt = new NBTTagByte((byte) Math.max(Byte.MIN_VALUE, Math.min(Byte.MAX_VALUE, value.getInt()))); + break; case Constants.NBT.TAG_SHORT: + nbt = new NBTTagShort( + (short) Math.max(Short.MIN_VALUE, Math.min(Short.MAX_VALUE, value.getInt()))); + break; case Constants.NBT.TAG_INT: nbt = new NBTTagInt(value.getInt()); break; @@ -220,6 +225,8 @@ public void onCallback(ConfigValue value, boolean set) { nbt = new NBTTagLong(Long.parseLong(value.getString())); break; case Constants.NBT.TAG_FLOAT: + nbt = new NBTTagFloat((float) value.getDouble()); + break; case Constants.NBT.TAG_DOUBLE: case Constants.NBT.TAG_ANY_NUMERIC: nbt = new NBTTagDouble(value.getDouble());