3
0
Mirror von https://github.com/Moulberry/AxiomPaperPlugin.git synchronisiert 2024-09-29 07:50:05 +02:00

fix: hotbar switch on 1.20.6

Dieser Commit ist enthalten in:
Barnaby 2024-06-23 21:07:50 +01:00
Ursprung b9225711d0
Commit 5a12999ad8

Datei anzeigen

@ -62,10 +62,20 @@ public class SwitchActiveHotbarPacketListener implements PluginMessageListener {
} else {
stack = stack.clone();
}
containerHotbarItems.set(new NamespacedKey("axiom", "slot_"+index), ItemStackDataType.INSTANCE, stack);
if (stack.isEmpty()) {
containerHotbarItems.remove(new NamespacedKey("axiom", "slot_" + index));
} else {
containerHotbarItems.set(new NamespacedKey("axiom", "slot_" + index), ItemStackDataType.INSTANCE, stack);
}
}
int index = activeHotbarIndex*9 + i;
containerHotbarItems.set(new NamespacedKey("axiom", "slot_"+index), ItemStackDataType.INSTANCE, hotbarItems[i].clone());
ItemStack hotbarItem = hotbarItems[i].clone();
if (hotbarItem.isEmpty()) {
containerHotbarItems.remove(new NamespacedKey("axiom", "slot_" + index));
} else {
containerHotbarItems.set(new NamespacedKey("axiom", "slot_"+index), ItemStackDataType.INSTANCE, hotbarItem);
}
if (player.getGameMode() == GameMode.CREATIVE) player.getInventory().setItem(i, hotbarItems[i]);
}