mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 13:09:53 +00:00
Restore methods so other addons work again (#193)
Co-authored-by: Alexdoru <[email protected]>
This commit is contained in:
1 parent
0d412603ab
commit
fcca10b1b9
8 files changed
+378
-290
No files matched your search
@@ -84,6 +84,19 @@ public class ArmorControls {
|
||||
invKey = mc.gameSettings.keyBindInventory;
|
||||
}
|
||||
|
||||
public void keyEvent(KeyInputEvent event) {
|
||||
if (!isNotEnoughKeysLoaded) {
|
||||
checkAndPerformKeyActions(null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "notenoughkeys")
|
||||
public void keyEventSpecial(KeyBindingPressedEvent event) {
|
||||
if (event.keyBinding != null && event.isKeyBindingPressed) {
|
||||
checkAndPerformKeyActions(event.keyBinding, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndPerformKeyActions(KeyBinding keyBinding, boolean inputFromNotEnoughKeys) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == armorKey : armorKey.isPressed()) {
|
||||
openArmorGui();
|
||||
@@ -202,18 +215,14 @@ public class ArmorControls {
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void keyEvent(KeyInputEvent event) {
|
||||
if (!isNotEnoughKeysLoaded) {
|
||||
checkAndPerformKeyActions(null, false);
|
||||
}
|
||||
public void keyEventWrapper(KeyInputEvent event) {
|
||||
ArmorControls.this.keyEvent(event);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "notenoughkeys")
|
||||
@SubscribeEvent
|
||||
public void keyEventSpecial(KeyBindingPressedEvent event) {
|
||||
if (event.keyBinding != null && event.isKeyBindingPressed) {
|
||||
checkAndPerformKeyActions(event.keyBinding, true);
|
||||
}
|
||||
public void keyEventSpecialWrapper(KeyBindingPressedEvent event) {
|
||||
ArmorControls.this.keyEventSpecial(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,20 @@ public class TabRegistry {
|
||||
return tabList;
|
||||
}
|
||||
|
||||
// Client method
|
||||
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
if ((event.gui instanceof GuiInventory)) {
|
||||
int xSize = 176;
|
||||
int ySize = 166;
|
||||
int guiLeft = (event.gui.width - xSize) / 2;
|
||||
int guiTop = (event.gui.height - ySize) / 2;
|
||||
guiLeft += getPotionOffset();
|
||||
|
||||
updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
|
||||
addTabsToList(event.gui.buttonList);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
public static void openInventoryGui() {
|
||||
@@ -80,20 +94,6 @@ public class TabRegistry {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Client method
|
||||
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
if ((event.gui instanceof GuiInventory)) {
|
||||
int xSize = 176;
|
||||
int ySize = 166;
|
||||
int guiLeft = (event.gui.width - xSize) / 2;
|
||||
int guiTop = (event.gui.height - ySize) / 2;
|
||||
guiLeft += getPotionOffset();
|
||||
|
||||
updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
|
||||
addTabsToList(event.gui.buttonList);
|
||||
}
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
Reference in new issue
Block a user