Skip to content

Commit

Permalink
Fix nbtedit using the wrong datatypes. (#164)
Browse files Browse the repository at this point in the history
(cherry picked from commit 148665e)
  • Loading branch information
C0bra5 authored and Dream-Master committed Dec 19, 2024
1 parent bfd4766 commit 49b8401
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/serverutils/client/gui/GuiEditNBT.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,21 @@ 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;
case Constants.NBT.TAG_LONG:
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());
Expand Down

0 comments on commit 49b8401

Please sign in to comment.