Add support for binding a key to toggle the Travellers Belt toolbar in inventories

This adds support for swapping the toolbar in inventories. For now, no key is assigned by default, so one must be added from the NEI options for this to take effect.
This commit is contained in:
David Lindström committed 2020-09-04 00:53:40 +02:00
1 parent a6066582a2
commit 996d9adb48
4 files changed
+83 -5

No files matched your search

@@ -174,10 +174,7 @@ public class ArmorControls {
}
}
if (key == ArmorControls.beltSwap) {
if (ArmorProxyClient.armorExtended.inventory[3] != null) {
PlayerAbilityHelper.swapBelt(mc.thePlayer, ArmorProxyClient.armorExtended);
toggleBelt();
}
doBeltSwapIfPossible();
}
if (key == ArmorControls.zoomKey) {
zoom = !zoom;
@@ -217,7 +214,17 @@ public class ArmorControls {
updateServer(packet);
}
private void toggleBelt() {
public static boolean doBeltSwapIfPossible()
{
if (ArmorProxyClient.armorExtended.inventory[3] != null) {
PlayerAbilityHelper.swapBelt(mc.thePlayer, ArmorProxyClient.armorExtended);
toggleBelt();
return true;
}
return false;
}
private static void toggleBelt() {
AbstractPacket packet = new BeltPacket();
updateServer(packet);
}