Updated and simplified supported GUIs.

This commit is contained in:
0xSeb
2015-10-27 19:15:37 +01:00
parent f656a8ff25
commit 676bc0aed9
3 changed files with 33 additions and 49 deletions
@@ -17,7 +17,9 @@ import de.skate702.craftingkeys.manager.CraftingManager;
import de.skate702.craftingkeys.proxies.CraftingKeysProxy;
import de.skate702.craftingkeys.util.Logger;
import de.skate702.craftingkeys.util.Util;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.client.gui.GuiMerchant;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.*;
/**
* The Main Class of the Mod with the important onTick-Method. Some Methods are
@@ -98,19 +100,37 @@ public class CraftingKeys {
Util.printWarning();
}
if (Util.isCraftingGUI(Util.client.currentScreen)) {
// Get current Screen, then test
GuiScreen currentScreen = Util.client.currentScreen;
if (currentScreen != null) {
if (currentScreen instanceof GuiCrafting) {
ContainerManager con = new CraftingManager(
((GuiCrafting) Util.client.currentScreen).inventorySlots);
((GuiCrafting) currentScreen).inventorySlots);
con.acceptKey();
} else if (Util.isInventoryGUI(Util.client.currentScreen)) {
// do do do
Logger.warn("onTick()", "Inventory");
} else if (Util.isVillagerGUI(Util.client.currentScreen)) {
// do do do
//((GuiMerchant) Util.client.currentScreen).inventorySlots
Logger.warn("onTick()", "Villager");
} else if (currentScreen instanceof GuiInventory) {
Logger.warn("onTick()", "Inventory not implemented");
} else if (currentScreen instanceof GuiMerchant) {
Logger.warn("onTick()", "Villager not implemented");
} else if (currentScreen instanceof GuiFurnace) {
Logger.warn("onTick()", "Furnace not implemented");
} else if (currentScreen instanceof GuiDispenser) {
Logger.warn("onTick()", "Dispenser not implemented");
} else if (currentScreen instanceof GuiBrewingStand) {
Logger.warn("onTick()", "BrewingStand not implemented");
}
// TODO: What else should we support?
}
}
@@ -2,9 +2,6 @@ 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.client.gui.inventory.GuiInventory;
import net.minecraft.util.ChatComponentTranslation;
/**
@@ -60,37 +57,4 @@ public class Util {
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;
}
public static boolean isInventoryGUI(GuiScreen screen) {
if (screen != null) {
if (screen instanceof GuiInventory) {
return true;
}
}
return false;
}
public static boolean isVillagerGUI(GuiScreen screen) {
if (screen != null) {
if (screen instanceof net.minecraft.client.gui.GuiMerchant) {
return true;
}
}
return false;
}
}
@@ -19,7 +19,7 @@ key.categories.craftingkeys=Crafting Keys
# Config Stuff
de.skate702.craftingkeys.config.keys=Tastaturbelegung
de.skate702.craftingkeys.config.other=Weiteres
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!