3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Bump OpenNBT lib to 1.4-SNAPSHOT

This fixes the NPE when sending an ItemStack with a null NBT tag.
This also fixes some item movement bugs on pure vanilla servers.
Dieser Commit ist enthalten in:
AJ Ferguson 2020-01-30 23:15:18 -09:00
Ursprung 1a9aa4255f
Commit 3d61b3ce28
4 geänderte Dateien mit 4 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -79,7 +79,7 @@
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>opennbt</artifactId>
<version>1.3-SNAPSHOT</version>
<version>1.4-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>

Datei anzeigen

@ -182,7 +182,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
} else {
javaItem = TranslatorsInit.getItemTranslator().translateToJava(action.getToItem());
}
ClientCreativeInventoryActionPacket creativePacket = new ClientCreativeInventoryActionPacket(javaSlot, InventoryUtils.fixStack(javaItem));
ClientCreativeInventoryActionPacket creativePacket = new ClientCreativeInventoryActionPacket(javaSlot, javaItem);
session.getDownstream().getSession().send(creativePacket);
inventory.setItem(javaSlot, javaItem);
break;
@ -195,7 +195,7 @@ public class PlayerInventoryTranslator extends InventoryTranslator {
if (action.getSource().getType() == InventorySource.Type.WORLD_INTERACTION
&& action.getSource().getFlag() == InventorySource.Flag.DROP_ITEM) {
javaItem = TranslatorsInit.getItemTranslator().translateToJava(action.getToItem());
ClientCreativeInventoryActionPacket creativeDropPacket = new ClientCreativeInventoryActionPacket(-1, InventoryUtils.fixStack(javaItem));
ClientCreativeInventoryActionPacket creativeDropPacket = new ClientCreativeInventoryActionPacket(-1, javaItem);
session.getDownstream().getSession().send(creativeDropPacket);
}
break;

Datei anzeigen

@ -61,7 +61,7 @@ class ClickPlan {
refresh = true;
ClientWindowActionPacket clickPacket = new ClientWindowActionPacket(inventory.getId(),
actionId, action.slot, !planIter.hasNext() && refresh ? InventoryUtils.REFRESH_ITEM : InventoryUtils.fixStack(clickedItem),
actionId, action.slot, !planIter.hasNext() && refresh ? InventoryUtils.REFRESH_ITEM : clickedItem,
WindowAction.CLICK_ITEM, action.click.actionParam);
if (translator.getSlotType(action.slot) == SlotType.OUTPUT) {

Datei anzeigen

@ -87,13 +87,6 @@ public class InventoryUtils {
session.getUpstream().sendPacket(cursorPacket);
}
//NPE if compound tag is null
public static ItemStack fixStack(ItemStack stack) {
if (stack == null || stack.getId() == 0)
return null;
return new ItemStack(stack.getId(), stack.getAmount(), stack.getNbt() == null ? new CompoundTag("") : stack.getNbt());
}
public static boolean canStack(ItemStack item1, ItemStack item2) {
if (item1 == null || item2 == null)
return false;