Added new Keybinding. Config GUI is 95% finished. Only the info part is left.
This commit is contained in:
@@ -10,10 +10,13 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.InputEvent;
|
||||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import de.skate702.craftingkeys.config.Config;
|
import de.skate702.craftingkeys.config.Config;
|
||||||
|
import de.skate702.craftingkeys.config.GuiConfig;
|
||||||
import de.skate702.craftingkeys.config.GuiConfigHandler;
|
import de.skate702.craftingkeys.config.GuiConfigHandler;
|
||||||
|
import de.skate702.craftingkeys.config.KeyBindings;
|
||||||
import de.skate702.craftingkeys.manager.*;
|
import de.skate702.craftingkeys.manager.*;
|
||||||
import de.skate702.craftingkeys.proxies.CraftingKeysProxy;
|
import de.skate702.craftingkeys.proxies.CraftingKeysProxy;
|
||||||
import de.skate702.craftingkeys.util.Logger;
|
import de.skate702.craftingkeys.util.Logger;
|
||||||
@@ -29,8 +32,7 @@ import net.minecraftforge.common.MinecraftForge;
|
|||||||
*
|
*
|
||||||
* @author skate702
|
* @author skate702
|
||||||
*/
|
*/
|
||||||
@Mod(modid = CraftingKeys.MODID, name = CraftingKeys.NAME, version = CraftingKeys.VERSION,
|
@Mod(modid = CraftingKeys.MODID, name = CraftingKeys.NAME, version = CraftingKeys.VERSION)
|
||||||
guiFactory = "de.skate702.craftingkeys.config.ConfigGuiFactory")
|
|
||||||
public class CraftingKeys {
|
public class CraftingKeys {
|
||||||
|
|
||||||
public static final String MODID = "craftingkeys";
|
public static final String MODID = "craftingkeys";
|
||||||
@@ -74,6 +76,7 @@ public class CraftingKeys {
|
|||||||
FMLCommonHandler.instance().bus().register(this);
|
FMLCommonHandler.instance().bus().register(this);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiConfigHandler());
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiConfigHandler());
|
||||||
|
KeyBindings.init();
|
||||||
Logger.info("load(e)", "Registered Mod.");
|
Logger.info("load(e)", "Registered Mod.");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -87,6 +90,18 @@ public class CraftingKeys {
|
|||||||
public void postInit(FMLPostInitializationEvent event) {
|
public void postInit(FMLPostInitializationEvent event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onKeyInput(InputEvent.KeyInputEvent event) {
|
||||||
|
if (KeyBindings.openGuiBinding.isPressed()) {
|
||||||
|
Logger.info("onKeyInput(e)", "Open Crafting Keys Config Gui.");
|
||||||
|
Util.client.thePlayer.openGui(instance, GuiConfig.GuiID, Util.client.theWorld,
|
||||||
|
((int) Util.client.thePlayer.posX), (int) Util.client.thePlayer.posY,
|
||||||
|
(int) Util.client.thePlayer.posZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be executed when the Config is changed. Update!
|
* This method will be executed when the Config is changed. Update!
|
||||||
*
|
*
|
||||||
@@ -108,7 +123,7 @@ public class CraftingKeys {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onGuiOpened(GuiOpenEvent event) {
|
public void onGuiOpened(GuiOpenEvent event) {
|
||||||
if (event.gui instanceof GuiMainMenu) {
|
if (event.gui instanceof GuiMainMenu) {
|
||||||
//event.gui = new GuiConfig(); // Delete this!
|
//event.gui = new GuiConfig(); // (Only for testing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,10 +135,6 @@ public class CraftingKeys {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTick(TickEvent.ClientTickEvent tick) {
|
public void onTick(TickEvent.ClientTickEvent tick) {
|
||||||
|
|
||||||
if (Util.client.currentScreen == null) {
|
|
||||||
Util.client.thePlayer.openGui(instance, 702, Util.client.theWorld, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get current Screen, then test
|
// Get current Screen, then test
|
||||||
GuiScreen currentScreen = Util.client.currentScreen;
|
GuiScreen currentScreen = Util.client.currentScreen;
|
||||||
|
|
||||||
|
|||||||
@@ -146,40 +146,27 @@ public class Config {
|
|||||||
private static void syncProperties() {
|
private static void syncProperties() {
|
||||||
// Standard Keys
|
// Standard Keys
|
||||||
|
|
||||||
keyTopLeft = configFile.get(categoryKeys, "1.0-keyTopLeft", Keyboard.KEY_Q, "Top Left crafting key (key value)");
|
keyTopLeft = configFile.get(categoryKeys, "keyTopLeft", Keyboard.KEY_Q);
|
||||||
keyTopLeft.setLanguageKey("key.topleft");
|
keyTopCenter = configFile.get(categoryKeys, "keyTopCenter", Keyboard.KEY_W);
|
||||||
keyTopCenter = configFile.get(categoryKeys, "1.1-2keyTopCenter", Keyboard.KEY_W, "Top Center crafting key (key value)");
|
keyTopRight = configFile.get(categoryKeys, "keyTopRight", Keyboard.KEY_E);
|
||||||
keyTopCenter.setLanguageKey("key.topcenter");
|
|
||||||
keyTopRight = configFile.get(categoryKeys, "1.2-keyTopRight", Keyboard.KEY_E, "Top Right crafting key (key value)");
|
|
||||||
keyTopRight.setLanguageKey("key.topright");
|
|
||||||
|
|
||||||
keyCenterLeft = configFile.get(categoryKeys, "2.0-keyCenterLeft", Keyboard.KEY_A, "Center Left crafting key (key value)");
|
keyCenterLeft = configFile.get(categoryKeys, "keyCenterLeft", Keyboard.KEY_A);
|
||||||
keyCenterLeft.setLanguageKey("key.centerleft");
|
keyCenterCenter = configFile.get(categoryKeys, "keyCenterCenter", Keyboard.KEY_S);
|
||||||
keyCenterCenter = configFile.get(categoryKeys, "2.1-keyCenterCenter", Keyboard.KEY_S, "Center Center crafting key (key value)");
|
keyCenterRight = configFile.get(categoryKeys, "keyCenterRight", Keyboard.KEY_D);
|
||||||
keyCenterCenter.setLanguageKey("key.centercenter");
|
|
||||||
keyCenterRight = configFile.get(categoryKeys, "2.2-keyCenterRight", Keyboard.KEY_D, "Center Right crafting key (key value)");
|
|
||||||
keyCenterRight.setLanguageKey("key.centerright");
|
|
||||||
|
|
||||||
keyLowerLeft = configFile.get(categoryKeys, "3.0-keyLowerLeft", Keyboard.KEY_Y, "Lower Left crafting key (key value)"); // German Keyboard Layout
|
keyLowerLeft = configFile.get(categoryKeys, "keyLowerLeft", Keyboard.KEY_Y); // German Keyboard Layout
|
||||||
keyLowerLeft.setLanguageKey("key.lowerleft");
|
keyLowerCenter = configFile.get(categoryKeys, "keyLowerCenter", Keyboard.KEY_X);
|
||||||
keyLowerCenter = configFile.get(categoryKeys, "3.1-keyLowerCenter", Keyboard.KEY_X, "Lower Center crafting key (key value)");
|
keyLowerRight = configFile.get(categoryKeys, "keyLowerRight", Keyboard.KEY_C);
|
||||||
keyLowerCenter.setLanguageKey("key.lowercenter");
|
|
||||||
keyLowerRight = configFile.get(categoryKeys, "3.2-keyLowerRight", Keyboard.KEY_C, "Lower Right crafting key (key value)");
|
|
||||||
keyLowerRight.setLanguageKey("key.lowerright");
|
|
||||||
|
|
||||||
// Special Keys
|
// Special Keys
|
||||||
|
|
||||||
keyStack = configFile.get(categoryKeys, "4.0-keyStack", Keyboard.KEY_LSHIFT, "Key to move stacks instead of single items (key value)");
|
keyStack = configFile.get(categoryKeys, "keyStack", Keyboard.KEY_LSHIFT);
|
||||||
keyStack.setLanguageKey("key.stack");
|
keyInteract = configFile.get(categoryKeys, "keyInteract", Keyboard.KEY_LCONTROL);
|
||||||
keyInteract = configFile.get(categoryKeys, "4.1-keyInteract", Keyboard.KEY_LCONTROL, "Key to interact with e.g. crafting output (key value)");
|
keyDrop = configFile.get(categoryKeys, "keyDrop", Keyboard.KEY_SPACE);
|
||||||
keyInteract.setLanguageKey("key.interact");
|
|
||||||
keyDrop = configFile.get(categoryKeys, "4.2-keyDrop", Keyboard.KEY_SPACE, "Key to drop all items from crafting (key value)");
|
|
||||||
keyDrop.setLanguageKey("key.drop");
|
|
||||||
|
|
||||||
// Other Settings
|
// Other Settings
|
||||||
|
|
||||||
enableNumPad = configFile.get(categoryOther, "numPadEnabled", true, "Activates the NumPad for crafting");
|
enableNumPad = configFile.get(categoryOther, "numPadEnabled", true, "Activates the NumPad for crafting");
|
||||||
enableNumPad.setLanguageKey("options.numpadEnabled");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package de.skate702.craftingkeys.config;
|
|||||||
|
|
||||||
import de.skate702.craftingkeys.util.LanguageLocalizer;
|
import de.skate702.craftingkeys.util.LanguageLocalizer;
|
||||||
import de.skate702.craftingkeys.util.Logger;
|
import de.skate702.craftingkeys.util.Logger;
|
||||||
import de.skate702.craftingkeys.util.Util;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
@@ -131,13 +130,11 @@ public class GuiConfig extends GuiScreen {
|
|||||||
public void actionPerformed(GuiButton button) {
|
public void actionPerformed(GuiButton button) {
|
||||||
if (button.id == buttonAbortID) {
|
if (button.id == buttonAbortID) {
|
||||||
Logger.info("actionPerformed(b)", "Closing Crafting Keys GUI now!");
|
Logger.info("actionPerformed(b)", "Closing Crafting Keys GUI now!");
|
||||||
Util.client.thePlayer.closeScreen();
|
|
||||||
mc.thePlayer.closeScreen();
|
mc.thePlayer.closeScreen();
|
||||||
Util.client.displayGuiScreen(null);
|
|
||||||
} else if (button.id == buttonSaveID) {
|
} else if (button.id == buttonSaveID) {
|
||||||
save();
|
save();
|
||||||
Logger.info("actionPerformed(b)", "Saving & closing Crafting Keys GUI now!");
|
Logger.info("actionPerformed(b)", "Saving & closing Crafting Keys GUI now!");
|
||||||
Util.client.thePlayer.closeScreen();
|
mc.thePlayer.closeScreen();
|
||||||
} else if (button.id >= 0 && button.id <= 11) {
|
} else if (button.id >= 0 && button.id <= 11) {
|
||||||
if (selectedButtonID == -1) {
|
if (selectedButtonID == -1) {
|
||||||
selectedButtonID = button.id;
|
selectedButtonID = button.id;
|
||||||
@@ -166,8 +163,14 @@ public class GuiConfig extends GuiScreen {
|
|||||||
public void keyTyped(char character, int keyCode) {
|
public void keyTyped(char character, int keyCode) {
|
||||||
|
|
||||||
if (keyCode == Keyboard.KEY_ESCAPE) {
|
if (keyCode == Keyboard.KEY_ESCAPE) {
|
||||||
selectedButtonID = -1;
|
if (selectedButtonID != -1) {
|
||||||
drawKeyValues();
|
selectedButtonID = -1;
|
||||||
|
drawKeyValues();
|
||||||
|
} else {
|
||||||
|
Logger.info("keyTyped(c,i)", "Trying to close inventory with esc.");
|
||||||
|
super.keyTyped(character, keyCode); // Enable standard gui closing
|
||||||
|
}
|
||||||
|
|
||||||
} else if (selectedButtonID != -1) {
|
} else if (selectedButtonID != -1) {
|
||||||
if (!ArrayUtils.contains(keyValues, keyCode)) { // No double keys
|
if (!ArrayUtils.contains(keyValues, keyCode)) { // No double keys
|
||||||
keyValues[selectedButtonID] = keyCode;
|
keyValues[selectedButtonID] = keyCode;
|
||||||
@@ -178,10 +181,7 @@ public class GuiConfig extends GuiScreen {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Lang files
|
// TODO: Crafting symbols & labels
|
||||||
// TODO: Config files
|
|
||||||
// TODO: Crafting symbols
|
|
||||||
// TODO: KeyBindings
|
|
||||||
|
|
||||||
private void drawCraftingTable() {
|
private void drawCraftingTable() {
|
||||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||||
|
|||||||
@@ -1,49 +1,24 @@
|
|||||||
package de.skate702.craftingkeys.config;
|
package de.skate702.craftingkeys.config;
|
||||||
|
|
||||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides all Key Bindings and methods to register and check them.
|
* Provides all Key Bindings and methods to register and check them.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public class KeyBindings {
|
public class KeyBindings {
|
||||||
|
|
||||||
// WARNING: This does NOT work! Have to use own Option Dialog OR Settings file. Bindings are exclusive. Shit!
|
private static final String category = "craftingkeys.binding.cat";
|
||||||
|
|
||||||
|
public static KeyBinding openGuiBinding = new KeyBinding("craftingkeys.binding.opengui",
|
||||||
private static final String category = "key.categories.craftingkeys";
|
Keyboard.KEY_K, category);
|
||||||
|
|
||||||
private static KeyBinding[] bindings = { // Inspired by CSS Position Properties
|
|
||||||
new KeyBinding("key.topleft", Keyboard.KEY_Q, category),
|
|
||||||
new KeyBinding("key.topcenter", Keyboard.KEY_W, category),
|
|
||||||
new KeyBinding("key.topright", Keyboard.KEY_E, category),
|
|
||||||
|
|
||||||
new KeyBinding("key.centerleft", Keyboard.KEY_A, category),
|
|
||||||
new KeyBinding("key.centercenter", Keyboard.KEY_S, category),
|
|
||||||
new KeyBinding("key.centerright", Keyboard.KEY_D, category),
|
|
||||||
|
|
||||||
new KeyBinding("key.lowerleft", Keyboard.KEY_Y, category), // GERMAN Keyboard layout
|
|
||||||
new KeyBinding("key.lowercenter", Keyboard.KEY_X, category),
|
|
||||||
new KeyBinding("key.lowerright", Keyboard.KEY_C, category),
|
|
||||||
|
|
||||||
new KeyBinding("key.stack", Keyboard.KEY_LSHIFT, category),
|
|
||||||
new KeyBinding("key.interact", Keyboard.KEY_LCONTROL, category),
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes all key bindings and registers them to the client-side. Bindings are exclusive.
|
* Initializes all key bindings and registers them to the client-side.
|
||||||
* Do NOT use until there is a solution for this!
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
for (KeyBinding binding : bindings) {
|
ClientRegistry.registerKeyBinding(openGuiBinding);
|
||||||
ClientRegistry.registerKeyBinding(binding);
|
|
||||||
}
|
|
||||||
ClientRegistry.registerKeyBinding(Minecraft.getMinecraft().gameSettings.keyBindRight);
|
|
||||||
//Minecraft.getMinecraft().gameSettings.keybind
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,4 @@
|
|||||||
# Control Names
|
|
||||||
key.topleft=1. Oben Links
|
|
||||||
key.topcenter=2. Oben Mitte
|
|
||||||
key.topright=3. Oben Rechts
|
|
||||||
key.centerleft=4. Mitte Links
|
|
||||||
key.centercenter=5. Mitte Mitte
|
|
||||||
key.centerright=6. Mitte Rechts
|
|
||||||
key.lowerleft=7. Unten Links
|
|
||||||
key.lowercenter=8. Unten Mitte
|
|
||||||
key.lowerright=9. Unten Rechts
|
|
||||||
key.stack=Stack Taste
|
|
||||||
key.interact=Interaktions Taste
|
|
||||||
key.drop=Drop Taste
|
|
||||||
|
|
||||||
options.numpadEnabled=Aktiviere Num pad
|
|
||||||
|
|
||||||
# Control Category Name
|
|
||||||
key.categories.craftingkeys=Crafting Keys
|
|
||||||
|
|
||||||
# Config Stuff
|
# Config Stuff
|
||||||
de.skate702.craftingkeys.config.keys=Tastaturbelegung
|
|
||||||
de.skate702.craftingkeys.config.other=Anderes
|
|
||||||
de.skate702.craftingkeys.config.keys.tooltip=Belege hier deine Tasten (Einfach mal "LWJGL Key codes" googlen!)
|
|
||||||
de.skate702.craftingkeys.config.other.tooltip=Saemtliche anderen Einstellungen sind hier!
|
|
||||||
|
|
||||||
# Warning
|
|
||||||
de.skate702.craftingkeys.warn.line1=Achtung: Crafting-Keys befindet sich in der Alpha!
|
|
||||||
de.skate702.craftingkeys.warn.line2=Es gibt noch viele Fehler, und es fehlen noch einige Funktionen.
|
|
||||||
de.skate702.craftingkeys.warn.line3=Mehr Info's findest du auf: https://github.com/0xSeb/CraftingKeys!
|
|
||||||
|
|
||||||
craftingkeys.config.title=Crafting Keys Konfiguration
|
craftingkeys.config.title=Crafting Keys Konfiguration
|
||||||
craftingkeys.config.description=Konfiguriere hier deine Tastenbelegung und klicke dann auf "Speichern".
|
craftingkeys.config.description=Konfiguriere hier deine Tastenbelegung und klicke dann auf "Speichern".
|
||||||
craftingkeys.config.button.save=Speichern
|
craftingkeys.config.button.save=Speichern
|
||||||
@@ -35,3 +6,6 @@ craftingkeys.config.button.abort=Abbruch
|
|||||||
craftingkeys.config.stack=Stapel Taste
|
craftingkeys.config.stack=Stapel Taste
|
||||||
craftingkeys.config.drop=Wegwerf Taste
|
craftingkeys.config.drop=Wegwerf Taste
|
||||||
|
|
||||||
|
# Key Bindings
|
||||||
|
craftingkeys.binding.opengui=Konfigurieren-Fenster oeffnen
|
||||||
|
craftingkeys.binding.cat=Crafting Keys
|
||||||
@@ -1,36 +1,11 @@
|
|||||||
# Control Names
|
# Config Stuff
|
||||||
key.topleft=1. Top Left
|
|
||||||
key.topcenter=2. Top Center
|
|
||||||
key.topright=3. Top Right
|
|
||||||
key.centerleft=4. Center Left
|
|
||||||
key.centercenter=5. Center Center
|
|
||||||
key.centerright=6. Center Right
|
|
||||||
key.lowerleft=7. Lower Left
|
|
||||||
key.lowercenter=8. Lower Center
|
|
||||||
key.lowerright=9. Lower Right
|
|
||||||
key.stack=Stack Key
|
|
||||||
key.interact=Interaction Key
|
|
||||||
key.drop=Drop Key
|
|
||||||
|
|
||||||
options.numpadEnabled=Enable Num Pad
|
|
||||||
|
|
||||||
# Control Category Name
|
|
||||||
key.categories.craftingkeys=Crafting Keys
|
|
||||||
|
|
||||||
# Config Stuff
|
|
||||||
de.skate702.craftingkeys.config.keys=Keys
|
|
||||||
de.skate702.craftingkeys.config.other=Other
|
|
||||||
de.skate702.craftingkeys.config.keys.tooltip=Set your Keys here (Just google "LWJGL Key codes"!)
|
|
||||||
de.skate702.craftingkeys.config.other.tooltip=All other settings are here!
|
|
||||||
|
|
||||||
# Warning
|
|
||||||
de.skate702.craftingkeys.warn.line1=Warning: Crafting Keys is still in development!
|
|
||||||
de.skate702.craftingkeys.warn.line2=This mod is not complete and there are some errors left.
|
|
||||||
de.skate702.craftingkeys.warn.line3=More Information: https://github.com/0xSeb/CraftingKeys!
|
|
||||||
|
|
||||||
craftingkeys.config.title=Crafting Keys Config
|
craftingkeys.config.title=Crafting Keys Config
|
||||||
craftingkeys.config.description=Configure your keys here. Click "Save" when finished!
|
craftingkeys.config.description=Configure your keys here. Click "Save" when finished!
|
||||||
craftingkeys.config.button.save=Save
|
craftingkeys.config.button.save=Save
|
||||||
craftingkeys.config.button.abort=Abort
|
craftingkeys.config.button.abort=Abort
|
||||||
craftingkeys.config.stack=Stack key
|
craftingkeys.config.stack=Stack key
|
||||||
craftingkeys.config.drop=Drop key
|
craftingkeys.config.drop=Drop key
|
||||||
|
|
||||||
|
# Key Bindings
|
||||||
|
craftingkeys.binding.opengui=Open config-gui
|
||||||
|
craftingkeys.binding.cat=Crafting Keys
|
||||||
Reference in New Issue
Block a user