Refactored a lot. Only ContainerManager and Main Class are missing.

This commit is contained in:
0xSeb
2015-10-25 12:09:43 +01:00
parent 2dbac86289
commit 43056a8152
11 changed files with 350 additions and 288 deletions
@@ -10,11 +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 de.skate702.craftingkeys.config.Config; import de.skate702.craftingkeys.config.Config;
import de.skate702.craftingkeys.manager.ContainerManager; import de.skate702.craftingkeys.manager.ContainerManager;
import de.skate702.craftingkeys.proxies.CraftingKeysProxy; import de.skate702.craftingkeys.proxies.CraftingKeysProxy;
import de.skate702.craftingkeys.util.Helper;
import de.skate702.craftingkeys.util.InputUtil;
import de.skate702.craftingkeys.util.Util;
import net.minecraft.client.gui.inventory.GuiCrafting; import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
@@ -24,7 +26,7 @@ import net.minecraft.inventory.Slot;
* *
* @author skate702 * @author skate702
*/ */
@Mod(modid = CraftingKeys.MODID, name = CraftingKeys.VERSION, version = CraftingKeys.NAME, @Mod(modid = CraftingKeys.MODID, name = CraftingKeys.NAME, version = CraftingKeys.VERSION,
guiFactory = "de.skate702.craftingkeys.config.ConfigGuiFactory") guiFactory = "de.skate702.craftingkeys.config.ConfigGuiFactory")
public class CraftingKeys { public class CraftingKeys {
@@ -53,7 +55,6 @@ public class CraftingKeys {
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent event) { public void preInit(FMLPreInitializationEvent event) {
Config.loadConfig(event); Config.loadConfig(event);
} }
/** /**
@@ -68,16 +69,11 @@ public class CraftingKeys {
proxy.registerRenderers(); proxy.registerRenderers();
FMLCommonHandler.instance().bus().register(this); FMLCommonHandler.instance().bus().register(this);
// TODO: Helper!
Helper.debugPrint("load(): Loaded CraftingKeys successful"); Helper.debugPrint("load(): Loaded CraftingKeys successful");
} }
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
System.out.println(event.toString());
}
/** /**
* This method will be executed after Init. * This method will be executed after Init.
* *
@@ -102,22 +98,22 @@ public class CraftingKeys {
public void onTick(TickEvent.ClientTickEvent tick) { public void onTick(TickEvent.ClientTickEvent tick) {
// Message // Message
if (Helper.isFirstInWorldTick()) { if (Util.isFirstInWorldTick()) {
Helper.printWarning(); Util.printWarning();
} }
// Case 1: Classic GUI Screen // Case 1: Classic GUI Screen
if (Helper.isCraftingGUI(Helper.client.currentScreen)) { if (Util.isCraftingGUI(Util.client.currentScreen)) {
GuiCrafting guiCrafting = (GuiCrafting) Helper.client.currentScreen; GuiCrafting guiCrafting = (GuiCrafting) Util.client.currentScreen;
Slot currentHoveredSlot = Helper.getSlotAtMousePosition(guiCrafting); Slot currentHoveredSlot = InputUtil.getSlotAtMousePosition(guiCrafting);
int keyDown = Helper.craftingKeyDownToSlotNumber(); int keyDown = Helper.craftingKeyDownToSlotNumber();
ContainerManager con = new ContainerManager(guiCrafting.inventorySlots); ContainerManager con = new ContainerManager(guiCrafting.inventorySlots);
// Block Key Interval (avoid multiple Runs) // Block Key Interval (avoid multiple Runs)
if (!Helper.isSameKey(keyDown)) { if (!InputUtil.isSameKey(keyDown)) {
// Moving item to crafting table // Moving item to crafting table
if (keyDown > 0 && currentHoveredSlot != null) { if (keyDown > 0 && currentHoveredSlot != null) {
@@ -1,241 +0,0 @@
package de.skate702.craftingkeys;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
/**
* This helper class provides some static helping Methods and Constants.
*
* @author sebastian
*/
public class Helper {
/**
* If true, there are Debug-Output-Prints from debugPrint(msg).
*/
public static final boolean DEBUG = true;
/**
* Current Instance Client, used for a lot of operations.
*/
public static Minecraft client = FMLClientHandler.instance().getClient();
/**
* Saves the last Key that was Pressed
*/
private static int lastKeyDown = -1;
/**
* Saves the times strg was pressed before reseting
*/
private static int strgTimesDown = 0;
private static boolean firstInWorldTick = true;
/**
* Private Constructor. This is a helping class!
*/
private Helper() {
// Nope.
}
/**
* Returns, if this is the first method call in a fresh opened world.
*
* @return True, if this is the first tick
*/
public static boolean isFirstInWorldTick() {
if (firstInWorldTick && client.theWorld != null) {
firstInWorldTick = false;
return true;
} else if (client.theWorld == null) {
firstInWorldTick = true;
}
return false;
}
public static void printWarning() {
client.thePlayer.addChatMessage(new ChatComponentText(
"Achtung: Crafting-Keys befindet sich in der Alpha!"));
client.thePlayer.addChatMessage(new ChatComponentText(
"Es gibt noch viele Fehler, und es fehlen noch einige Funktionen."));
client.thePlayer.addChatMessage(new ChatComponentText(
"Mehr Info's findest du auf: https://github.com/0xSeb/CraftingKeys!"));
client.thePlayer.addChatMessage(new ChatComponentTranslation("key.topleft"));
}
/**
* Standart Output for Debug-Messages - Depends on DEBUG-Constant.
*
* @param message The Debug-Message. Syntax: "methodname(): Message"
*/
public static void debugPrint(String message) {
if (DEBUG) {
System.out.println("CK-DEBUG: " + message);
}
}
/**
* Returns true, if the current Screen is a instance of GUI-Screen.
*
* @param screen The input Screen
* @return True, if GuiScreen; False if null
*/
public static boolean isCraftingGUI(GuiScreen screen) {
if (screen != null) {
if (screen instanceof GuiCrafting) {
return true;
}
}
return false;
}
/**
* Returns the Slot at the current Mouse Position. [FROM GUICONTAINER]
*
* @param guiContainer The (Inventory) Container to work with.
* @return Returns the slot (or null)
*/
public static Slot getSlotAtMousePosition(GuiContainer guiContainer) {
if (guiContainer != null) {
Container container = guiContainer.inventorySlots;
int x = getMouseX(guiContainer);
int y = getMouseY(guiContainer);
for (int k = 0; k < container.inventorySlots.size(); k++) {
Slot slot = (Slot) container.inventorySlots.get(k);
if (getIsMouseOverSlot(guiContainer, slot, x, y)) {
return slot;
}
}
return null;
} else {
Helper.debugPrint("getSlotAtMousePosition(): guiContainer == null");
return null;
}
}
/**
* Returns, if the mouse cursor is over a specified slot [FROM GUICONTAINER]
*
* @param guiContainer the GuiContainer to work with
* @param slot The spcified slot
* @param x The Mouse x-Position
* @param y The Mouse y-Position
* @return True, if the mouse is positioned over this slot. Otherwise false
*/
private static boolean getIsMouseOverSlot(GuiContainer guiContainer, Slot slot, int x, int y) {
if (guiContainer != null) {
// Constants from Minecraft Source Code
x -= (guiContainer.width - 176) / 2;
y -= (guiContainer.height - 166) / 2;
return x >= slot.xDisplayPosition - 1 && x < slot.xDisplayPosition + 16 + 1
&& y >= slot.yDisplayPosition - 1 && y < slot.yDisplayPosition + 16 + 1;
} else {
return false;
}
}
/**
* Returns a calculated Mouse Position for getSlotAtMousePosition().
*
* @param guiContainer the GuiContainer to work with
* @return The relative Mouse-Position
*/
private static int getMouseX(GuiContainer guiContainer) {
return (Mouse.getEventX() * guiContainer.width) / client.displayWidth;
}
/**
* Returns a calculated Mouse Position for getSlotAtMousePosition().
*
* @param guiContainer the GuiContainer to work with
* @return The relative Mouse-Position
*/
private static int getMouseY(GuiContainer guiContainer) {
return guiContainer.height - (Mouse.getEventY() * guiContainer.height) / client.displayHeight - 1;
}
/**
* Reads the current Keyboard-Input and converts it to a Inventory-Slot.
*
* @return A Inventory-Slot (based on CraftingGUI), -1 for wrong input, -2
* for space
*/
public static int craftingKeyDownToSlotNumber() {
// TODO: Make this dynamic! // Use Settings
int returnValue = -1;
if (Keyboard.isKeyDown(Keyboard.KEY_Q)) {
returnValue = 1;
} else if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
returnValue = 2;
} else if (Keyboard.isKeyDown(Keyboard.KEY_E)) {
returnValue = 3;
} else if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
returnValue = 4;
} else if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
returnValue = 5;
} else if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
returnValue = 6;
} else if (Keyboard.isKeyDown(Keyboard.KEY_Y)) {
returnValue = 7;
} else if (Keyboard.isKeyDown(Keyboard.KEY_X)) {
returnValue = 8;
} else if (Keyboard.isKeyDown(Keyboard.KEY_C)) {
returnValue = 9;
} else if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
returnValue = -2;
}
return returnValue;
}
/**
* Returns, if the current KeyValue is the same
*
* @param currentKey the new input value, saved in the method
* @return True, if these are the same keys
*/
public static boolean isSameKey(int currentKey) {
boolean returnValue = false;
if (lastKeyDown == currentKey && currentKey != -1) {
returnValue = true;
}
lastKeyDown = currentKey;
return returnValue;
}
/**
* Return the times Strg was pressed before reseting
*
* @param strgDown false, if reset
* @return A number of tick strg was down before
*/
public static int getStrgTimesDown(boolean strgDown) {
if (!strgDown)
strgTimesDown = 0;
return ++strgTimesDown;
}
}
@@ -14,28 +14,37 @@ public class Config {
/** /**
* Defines the config string for the keys-category. * Defines the config string for the keys-category.
*/ */
public static final String categoryKeys = "keys"; protected static final String categoryKeys = "keys";
/** /**
* Defines the config string for the other-category. * Defines the config string for the other-category.
*/ */
public static final String categoryOther = "other"; protected static final String categoryOther = "other";
/**
* Defines all 11 Keys you can use with Crafting Keys.
*/
public static Property keyTopLeft, keyTopCenter, keyTopRight,
keyCenterLeft, keyCenterCenter, keyCenterRight,
keyLowerLeft, keyLowerCenter, keyLowerRight,
keyStack, keyInteract;
/**
* Defines, if NumPad is always active for crafting.
*/
public static Property enableNumPad;
/** /**
* Provides the Suggested Config File. * Provides the Suggested Config File.
*/ */
public static Configuration configFile; protected static Configuration configFile = null;
/**
* Defines all 11 Keys you can use with Crafting Keys.
*/
private static Property keyTopLeft, keyTopCenter, keyTopRight,
keyCenterLeft, keyCenterCenter, keyCenterRight,
keyLowerLeft, keyLowerCenter, keyLowerRight,
keyStack, keyInteract, keyDrop;
/**
* Defines, if NumPad is always active for crafting.
*/
private static Property enableNumPad;
public static boolean isNumPadEnabled() {
return enableNumPad.getBoolean(true);
}
public static int getKeyCode(KeyType key) {
//return ((Property)(Config.class.getField((key.toString())))..getInt(-1); // TODO!
return 0;
}
/** /**
* Initializes the configFile Files, loads all values (or sets them to default). * Initializes the configFile Files, loads all values (or sets them to default).
@@ -59,7 +68,12 @@ public class Config {
*/ */
public static void syncConfig() { public static void syncConfig() {
syncProperties(); if (configFile == null) {
// TODO: Throw Error!
return;
}
syncProperties(); // TODO: Why here?
if (configFile.hasChanged()) if (configFile.hasChanged())
configFile.save(); configFile.save();
@@ -101,8 +115,9 @@ public class Config {
// Special Keys // Special Keys
keyStack = configFile.get(categoryKeys, "Stack Key", Keyboard.KEY_LSHIFT, "Key to move stacks instead of single items"); keyStack = configFile.get(categoryKeys, "Stack Key", Keyboard.KEY_LSHIFT, "Key to move stacks instead of single items (key value)");
keyInteract = configFile.get(categoryKeys, "Interaction Key", Keyboard.KEY_LCONTROL, "Key to interact with e.g. crafting output"); keyInteract = configFile.get(categoryKeys, "Interaction Key", Keyboard.KEY_LCONTROL, "Key to interact with e.g. crafting output (key value)");
keyDrop = configFile.get(categoryKeys, "Drop Key", Keyboard.KEY_SPACE, "Key to drop all items from crafting (key value)");
// Other Settings // Other Settings
@@ -110,4 +125,11 @@ public class Config {
} }
public enum KeyType {
keyTopLeft, keyTopCenter, keyTopRight,
keyCenterLeft, keyCenterCenter, keyCenterRight,
keyLowerLeft, keyLowerCenter, keyLowerRight,
keyStack, keyInteract, keyDrop
}
} }
@@ -17,7 +17,6 @@ public class ConfigGui extends GuiConfig {
public ConfigGui(GuiScreen parent) { public ConfigGui(GuiScreen parent) {
super(parent, getConfigElements(), super(parent, getConfigElements(),
CraftingKeys.MODID, false, false, CraftingKeys.NAME); CraftingKeys.MODID, false, false, CraftingKeys.NAME);
} }
/** /**
@@ -28,8 +27,8 @@ public class ConfigGui extends GuiConfig {
private static List<IConfigElement> getConfigElements() { private static List<IConfigElement> getConfigElements() {
List<IConfigElement> list = new ArrayList<IConfigElement>(); List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(categoryElement(Config.categoryKeys, Config.categoryKeys, "de.skate702.craftingkeys.keys")); list.add(categoryElement(Config.categoryKeys, Config.categoryKeys, "de.skate702.craftingkeys.config.keys"));
list.add(categoryElement(Config.categoryOther, Config.categoryOther, "de.skate702.craftingkeys.other")); list.add(categoryElement(Config.categoryOther, Config.categoryOther, "de.skate702.craftingkeys.config.other"));
return list; return list;
} }
@@ -1,4 +1,4 @@
package de.skate702.craftingkeys; 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.Minecraft;
@@ -1,7 +1,8 @@
package de.skate702.craftingkeys.manager; package de.skate702.craftingkeys.manager;
import de.skate702.craftingkeys.CraftingKeys; import de.skate702.craftingkeys.CraftingKeys;
import de.skate702.craftingkeys.Helper; import de.skate702.craftingkeys.util.Helper;
import de.skate702.craftingkeys.util.Util;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -143,7 +144,7 @@ public class ContainerManager {
// Check for Item-Type // Check for Item-Type
ItemStack stackToMove; ItemStack stackToMove;
if (isHeld) { if (isHeld) {
stackToMove = Helper.client.thePlayer.inventory.getItemStack(); stackToMove = Util.client.thePlayer.inventory.getItemStack();
} else { } else {
putItemAway(isCraftingGUI); putItemAway(isCraftingGUI);
stackToMove = getItemStack(sourceIndex); stackToMove = getItemStack(sourceIndex);
@@ -177,7 +178,7 @@ public class ContainerManager {
private void putItemAway(boolean isCraftingGUI) { private void putItemAway(boolean isCraftingGUI) {
// Put current Item away // Put current Item away
if (Helper.client.thePlayer.inventory.getItemStack() != null) { if (Util.client.thePlayer.inventory.getItemStack() != null) {
putStackToNextEmptySlot(-1, isCraftingGUI, true); putStackToNextEmptySlot(-1, isCraftingGUI, true);
} }
} }
@@ -247,8 +248,8 @@ public class ContainerManager {
int rightClickData = (rightClick) ? 1 : 0; int rightClickData = (rightClick) ? 1 : 0;
CraftingKeys.instance.proxy.sendSlotClick(Helper.client.playerController, container.windowId, index, CraftingKeys.instance.proxy.sendSlotClick(Util.client.playerController, container.windowId, index,
rightClickData, 0, Helper.client.thePlayer); rightClickData, 0, Util.client.thePlayer);
} }
@@ -0,0 +1,91 @@
package de.skate702.craftingkeys.util;
import org.lwjgl.input.Keyboard;
/**
* This helper class provides some static helping Methods and Constants.
*
* @author sebastian
*/
public class Helper {
/**
* If true, there are Debug-Output-Prints from debugPrint(msg).
*/
public static final boolean DEBUG = true;
/**
* Saves the times strg was pressed before reseting
*/
private static int strgTimesDown = 0;
/**
* Standart Output for Debug-Messages - Depends on DEBUG-Constant.
*
* @param message The Debug-Message. Syntax: "methodname(): Message"
*/
@Deprecated
public static void debugPrint(String message) {
if (DEBUG) {
System.out.println("CK-DEBUG: " + message);
}
}
/**
* Reads the current Keyboard-Input and converts it to a Inventory-Slot.
*
* @return A Inventory-Slot (based on CraftingGUI), -1 for wrong input, -2
* for space
*/
@Deprecated
public static int craftingKeyDownToSlotNumber() {
// TODO: Make this dynamic! // Use Settings
// TODO: This has to be the job of the manager
int returnValue = -1;
if (Keyboard.isKeyDown(Keyboard.KEY_Q)) {
returnValue = 1;
} else if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
returnValue = 2;
} else if (Keyboard.isKeyDown(Keyboard.KEY_E)) {
returnValue = 3;
} else if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
returnValue = 4;
} else if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
returnValue = 5;
} else if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
returnValue = 6;
} else if (Keyboard.isKeyDown(Keyboard.KEY_Y)) {
returnValue = 7;
} else if (Keyboard.isKeyDown(Keyboard.KEY_X)) {
returnValue = 8;
} else if (Keyboard.isKeyDown(Keyboard.KEY_C)) {
returnValue = 9;
} else if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
returnValue = -2;
}
return returnValue;
}
/**
* Return the times Strg was pressed before reseting
*
* @param strgDown false, if reset
* @return A number of tick strg was down before
*/
@Deprecated
public static int getStrgTimesDown(boolean strgDown) {
if (!strgDown)
strgTimesDown = 0;
return ++strgTimesDown;
}
}
@@ -0,0 +1,109 @@
package de.skate702.craftingkeys.util;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import org.lwjgl.input.Mouse;
/**
* This class provides methods to interact with the Mouse and key input.
*/
public class InputUtil {
/**
* Saves the last Key that was Pressed
*/
private static int lastKeyDown = -1;
/**
* Private Constructor, Utility Class.
*/
private InputUtil() {
}
/**
* Returns the Slot at the current Mouse Position. [FROM GUICONTAINER]
*
* @param guiContainer The (Inventory) Container to work with.
* @return Returns the slot (or null)
*/
public static Slot getSlotAtMousePosition(GuiContainer guiContainer) {
if (guiContainer != null) {
Container container = guiContainer.inventorySlots;
int x = getMouseX(guiContainer);
int y = getMouseY(guiContainer);
for (int k = 0; k < container.inventorySlots.size(); k++) {
Slot slot = (Slot) container.inventorySlots.get(k);
if (getIsMouseOverSlot(guiContainer, slot, x, y)) {
return slot;
}
}
return null;
} else {
Helper.debugPrint("getSlotAtMousePosition(): guiContainer == null");
return null;
}
}
/**
* Returns, if the mouse cursor is over a specified slot [FROM GUICONTAINER]
*
* @param guiContainer the GuiContainer to work with
* @param slot The spcified slot
* @param x The Mouse x-Position
* @param y The Mouse y-Position
* @return True, if the mouse is positioned over this slot. Otherwise false
*/
private static boolean getIsMouseOverSlot(GuiContainer guiContainer, Slot slot, int x, int y) {
if (guiContainer != null) {
// Constants from Minecraft Source Code
x -= (guiContainer.width - 176) / 2;
y -= (guiContainer.height - 166) / 2;
return x >= slot.xDisplayPosition - 1 && x < slot.xDisplayPosition + 16 + 1
&& y >= slot.yDisplayPosition - 1 && y < slot.yDisplayPosition + 16 + 1;
} else {
return false;
}
}
/**
* Returns a calculated Mouse Position for getSlotAtMousePosition().
*
* @param guiContainer the GuiContainer to work with
* @return The relative Mouse-Position
*/
private static int getMouseX(GuiContainer guiContainer) {
return (Mouse.getEventX() * guiContainer.width) / Util.client.displayWidth;
}
/**
* Returns a calculated Mouse Position for getSlotAtMousePosition().
*
* @param guiContainer the GuiContainer to work with
* @return The relative Mouse-Position
*/
private static int getMouseY(GuiContainer guiContainer) {
return guiContainer.height - (Mouse.getEventY() * guiContainer.height) / Util.client.displayHeight - 1;
}
/**
* Returns, if the current KeyValue is the same
*
* @param currentKey the new input value, saved in the method
* @return True, if these are the same keys
*/
public static boolean isSameKey(int currentKey) {
boolean returnValue = false;
if (lastKeyDown == currentKey && currentKey != -1) {
returnValue = true;
}
lastKeyDown = currentKey;
return returnValue;
}
}
@@ -0,0 +1,77 @@
package de.skate702.craftingkeys.util;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.util.ChatComponentTranslation;
/**
* Provides basic utility methods. For input methods, look at InputUtil.
*/
public class Util {
/**
* Current Instance Client, used for a lot of operations.
*/
public static Minecraft client = FMLClientHandler.instance().getClient();
/**
* Only used by isFirstInWorldTick()
*/
private static boolean firstInWorldTick = true;
/**
* Private Constructor. This is a utility class!
*/
private Util() {
}
/**
* Returns, if this is the first method call in a fresh opened world.
*
* @return True, if this is the first tick
*/
public static boolean isFirstInWorldTick() {
if (firstInWorldTick && client.theWorld != null) {
firstInWorldTick = false;
return true;
} else if (client.theWorld == null) {
firstInWorldTick = true;
}
return false;
}
/**
* Prints a Message in chat with the given language key from lang-files.
*
* @param lang_key key from lang-file
*/
public static void printMessage(String lang_key) {
client.thePlayer.addChatMessage(new ChatComponentTranslation(lang_key));
}
/**
* Prints a warning, that this mod is still in alpha-state.
*/
public static void printWarning() {
printMessage("de.skate702.craftingkeys.warn.line1");
printMessage("de.skate702.craftingkeys.warn.line2");
printMessage("de.skate702.craftingkeys.warn.line3");
}
/**
* Returns true, if the current Screen is a instance of GUI-Screen.
*
* @param screen The input Screen
* @return True, if GuiScreen; False if null
*/
public static boolean isCraftingGUI(GuiScreen screen) {
if (screen != null) {
if (screen instanceof GuiCrafting) {
return true;
}
}
return false;
}
}
@@ -1 +1,4 @@
# dummy # 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!
@@ -15,7 +15,12 @@ key.interact=Interaction Key
key.categories.craftingkeys=Crafting Keys key.categories.craftingkeys=Crafting Keys
# Config Stuff # Config Stuff
de.skate702.craftingkeys.keys=Keys de.skate702.craftingkeys.config.keys=Keys
de.skate702.craftingkeys.other=Other de.skate702.craftingkeys.config.other=Other
de.skate702.craftingkeys.keys.tooltip=Set your Keys here (Just google "LWJGL Key codes"!) de.skate702.craftingkeys.config.keys.tooltip=Set your Keys here (Just google "LWJGL Key codes"!)
de.skate702.craftingkeys.other.tooltip=All other settings are here! 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!