Backport accessory keybind.

This commit is contained in:
bconlon 2020-12-31 07:54:40 -08:00
parent fece29925c
commit 1d594045c4
20 changed files with 122 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package com.gildedgames.the_aether.client;
import java.security.Key;
import java.util.List;
import com.gildedgames.the_aether.client.gui.GuiCustomizationScreen;
@ -8,12 +9,14 @@ import com.gildedgames.the_aether.client.gui.button.GuiAccessoryButton;
import com.gildedgames.the_aether.client.gui.button.GuiCapeButton;
import com.gildedgames.the_aether.client.gui.button.GuiCustomizationScreenButton;
import com.gildedgames.the_aether.client.gui.button.*;
import com.gildedgames.the_aether.client.gui.inventory.GuiAccessories;
import com.gildedgames.the_aether.client.gui.menu.AetherMainMenu;
import com.gildedgames.the_aether.client.gui.menu.GuiMenuToggleButton;
import com.gildedgames.the_aether.network.packets.PacketCapeChanged;
import com.gildedgames.the_aether.network.packets.PacketExtendedAttack;
import com.gildedgames.the_aether.player.perks.AetherRankings;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.gameevent.InputEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.inventory.GuiContainer;
@ -22,6 +25,7 @@ import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.EntityDragon;
@ -51,6 +55,7 @@ import com.gildedgames.the_aether.player.PlayerAether;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
public class AetherClientEvents {
@ -274,6 +279,8 @@ public class AetherClientEvents {
private static int previousSelectedTabIndex = -1;
private static boolean shouldRemoveButton = false;
@SubscribeEvent
@SuppressWarnings("unchecked")
public void onGuiOpened(GuiScreenEvent.InitGuiEvent.Post event) {
@ -294,6 +301,18 @@ public class AetherClientEvents {
} else if (clazz == GuiInventory.class) {
event.buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 26, guiTop + 65));
}
if (clazz == GuiAccessories.class)
{
if (!shouldRemoveButton)
{
event.buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 8, guiTop + 65));
}
else
{
shouldRemoveButton = false;
}
}
}
if (AetherConfig.config.get("Misc", "Enables the Aether Menu toggle button", false).getBoolean() && event.gui instanceof GuiMainMenu)
@ -420,4 +439,20 @@ public class AetherClientEvents {
}
}
@SubscribeEvent
public void onKeyInputEvent(InputEvent.KeyInputEvent event)
{
if (Minecraft.getMinecraft().thePlayer != null)
{
if (AetherKeybinds.keyBindingAccessories.isPressed())
{
if (Minecraft.getMinecraft().currentScreen == null)
{
AetherNetwork.sendToServer(new PacketOpenContainer(AetherGuiHandler.accessories));
shouldRemoveButton = true;
}
}
}
}
}

View File

@ -0,0 +1,21 @@
package com.gildedgames.the_aether.client;
import cpw.mods.fml.client.registry.ClientRegistry;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
public class AetherKeybinds
{
public static KeyBinding[] keyBindings = new KeyBinding[1];
public static KeyBinding keyBindingAccessories = new KeyBinding("key.aether.accessory_menu", Keyboard.KEY_I, "key.aether.category");
public static void initialization()
{
keyBindings[0] = keyBindingAccessories;
for (int i = 0; i < keyBindings.length; ++i)
{
ClientRegistry.registerKeyBinding(keyBindings[i]);
}
}
}

View File

@ -81,6 +81,8 @@ public class ClientProxy extends CommonProxy {
RendersAether.initialization();
AetherKeybinds.initialization();
registerEvent(new AetherMusicHandler());
registerEvent(new AetherClientEvents());
registerEvent(new GuiAetherInGame(Minecraft.getMinecraft()));

View File

@ -1,6 +1,7 @@
package com.gildedgames.the_aether.client.gui.inventory;
import com.gildedgames.the_aether.Aether;
import com.gildedgames.the_aether.client.AetherKeybinds;
import com.gildedgames.the_aether.client.gui.button.GuiAccessoryButton;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
@ -9,6 +10,8 @@ import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiScreenEvent;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.gildedgames.the_aether.inventory.ContainerAccessories;
@ -40,7 +43,7 @@ public class GuiAccessories extends GuiContainer {
}
*/
this.buttonList.add(new GuiAccessoryButton(this.guiLeft + 8, this.guiTop + 65));
//this.buttonList.add(new GuiAccessoryButton(this.guiLeft + 8, this.guiTop + 65));
}
@Override
@ -91,4 +94,16 @@ public class GuiAccessories extends GuiContainer {
GuiInventory.func_147046_a(this.guiLeft + 35, this.guiTop + 75, 30, (float) (this.guiLeft + 51) - (float) mouseX, (float) (this.guiTop + 75 - 50) - (float) mouseY, this.mc.thePlayer);
}
@Override
public void handleKeyboardInput()
{
super.handleKeyboardInput();
int keyPressed = Keyboard.getEventKey();
if (keyPressed == AetherKeybinds.keyBindingAccessories.getKeyCode() && Keyboard.getEventKeyState())
{
Minecraft.getMinecraft().thePlayer.closeScreen();
}
}
}

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Utvecklarsken:
gui.button.aether_cape=Aethermantel:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!

View File

@ -374,6 +374,9 @@ gui.button.halo=Halo:
gui.button.glow=Developer Glow:
gui.button.aether_cape=Aether Cape:
key.aether.category=Aether
key.aether.accessory_menu=Open Accessories Menu
lore.aether_legacy.aechor_petal=The petal of an Aechor Plant, they have a sweet aroma to them. These are a Moa's favorite food, and can be used to feed baby Moas.
lore.aether_legacy.aerogel=The result of the Aether's unique climate and lava combining. It can be crafted into various decorative blocks and is blast resistant.
lore.aether_legacy.aerogel_slab=Crafted from Aerogel. Slabs are half blocks, versatile for decoration and smooth slopes. Try adding some to a buildings roofing!