Reformated code, minor tweaks.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package de.skate702.craftingkeys.config;
|
||||
|
||||
import de.skate702.craftingkeys.util.LanguageLocalizer;
|
||||
import de.skate702.craftingkeys.util.Logger;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -35,16 +36,6 @@ public class GuiConfig extends GuiScreen {
|
||||
private int buttonInventoryID = 306;
|
||||
private int buttonVillagerID = 307;
|
||||
|
||||
public enum GuiType{
|
||||
ANVIL,
|
||||
FURNACE,
|
||||
BREWINGSTAND,
|
||||
ENCHANTMENT,
|
||||
INVENTORY,
|
||||
VILAGER,
|
||||
DISPENSER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
|
||||
@@ -61,7 +52,6 @@ public class GuiConfig extends GuiScreen {
|
||||
addStandardButtons();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||
|
||||
@@ -82,21 +72,32 @@ public class GuiConfig extends GuiScreen {
|
||||
|
||||
drawCraftingTable();
|
||||
// Insert Gui by selected Type
|
||||
if(guiShowType == GuiType.FURNACE){
|
||||
|
||||
switch (guiShowType) {
|
||||
|
||||
case FURNACE:
|
||||
genFurnaceInfo();
|
||||
}else if(guiShowType == GuiType.BREWINGSTAND){
|
||||
break;
|
||||
case BREWINGSTAND:
|
||||
genBrewingStandInfo();
|
||||
}else if(guiShowType == GuiType.DISPENSER){
|
||||
break;
|
||||
case DISPENSER:
|
||||
genDispenserInfo();
|
||||
}else if(guiShowType == GuiType.ENCHANTMENT){
|
||||
break;
|
||||
case ENCHANTMENT:
|
||||
genEnchantmentInfo();
|
||||
}else if(guiShowType == GuiType.INVENTORY){
|
||||
break;
|
||||
case INVENTORY:
|
||||
genInventoryInfo();
|
||||
}else if(guiShowType == GuiType.VILAGER){
|
||||
break;
|
||||
case VILAGER:
|
||||
genVillagerInfo();
|
||||
}else if(guiShowType == GuiType.ANVIL){
|
||||
break;
|
||||
case ANVIL:
|
||||
genAnvilInfo();
|
||||
break;
|
||||
}
|
||||
|
||||
//Draw line to let it look better
|
||||
drawHorizontalLine(guiShowBasePosition - 86, guiShowBasePosition + 85, guiShowBaseHeight + 80, lightGray.getRGB());
|
||||
|
||||
@@ -107,9 +108,9 @@ public class GuiConfig extends GuiScreen {
|
||||
@Override
|
||||
public void actionPerformed(GuiButton button) {
|
||||
if (button.id == buttonAbortID) {
|
||||
|
||||
Logger.warn("actionPerformed(b)", "Not implemented yet");
|
||||
} else if (button.id == buttonSaveID) {
|
||||
|
||||
Logger.warn("actionPerformed(b)", "Not implemented yet");
|
||||
} else if (button.id == buttonInventoryID) {
|
||||
guiShowType = GuiType.INVENTORY;
|
||||
} else if (button.id == buttonEnchantmentID) {
|
||||
@@ -127,11 +128,6 @@ public class GuiConfig extends GuiScreen {
|
||||
}
|
||||
}
|
||||
|
||||
//GUI GENERATORS:
|
||||
/*
|
||||
TODO: Create strings for showing the Keybindings
|
||||
*/
|
||||
|
||||
private void drawCraftingTable() {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mc.renderEngine.bindTexture(new ResourceLocation("textures/gui/container/crafting_table.png"));
|
||||
@@ -139,6 +135,11 @@ public class GuiConfig extends GuiScreen {
|
||||
drawString(fontRendererObj, "Crafting Table", guiBasePosition - 33, height / 2 - 100 + 3, lightGray.getRGB());
|
||||
}
|
||||
|
||||
//GUI GENERATORS:
|
||||
/*
|
||||
TODO: Create strings for showing the Keybindings
|
||||
*/
|
||||
|
||||
private void genFurnaceInfo() {
|
||||
GL11.glColor4f(0.5F, 0.5F, 0.5F, 1F);
|
||||
mc.renderEngine.bindTexture(new ResourceLocation("textures/gui/container/furnace.png"));
|
||||
@@ -199,7 +200,6 @@ public class GuiConfig extends GuiScreen {
|
||||
drawString(fontRendererObj, "Dispenser", guiShowBasePosition - 23, guiShowBaseHeight + 3, lightGray.getRGB());
|
||||
}
|
||||
|
||||
|
||||
private void addStandardButtons() {
|
||||
// Add control buttons
|
||||
buttonList.add((new GuiButton(buttonAbortID, width - 53, 3, 50, 20, LanguageLocalizer.localize("craftingkeys.config.button.abort"))));
|
||||
@@ -211,10 +211,10 @@ public class GuiConfig extends GuiScreen {
|
||||
buttonList.add((new GuiButton(buttonInventoryID, guiShowBasePosition - 86 - 70 - 5, guiShowBaseHeight, 70, 20, "Inventory")));
|
||||
buttonList.add((new GuiButton(buttonFurnaceID, guiShowBasePosition - 86 - 70 - 5, guiShowBaseHeight + 20 + 1, 70, 20, "Furnace")));
|
||||
buttonList.add((new GuiButton(buttonBrewingstandID, guiShowBasePosition + 86 + 5, guiShowBaseHeight, 90, 20, "Brewing Stand")));
|
||||
buttonList.add((new GuiButton(buttonDispenserID, guiShowBasePosition - 86 - 70 - 5, guiShowBaseHeight + 2*20 + 2*1, 70, 20, "Dispenser")));
|
||||
buttonList.add((new GuiButton(buttonDispenserID, guiShowBasePosition - 86 - 70 - 5, guiShowBaseHeight + 2 * 20 + 2, 70, 20, "Dispenser")));
|
||||
buttonList.add((new GuiButton(buttonVillagerID, guiShowBasePosition + 86 + 5, guiShowBaseHeight + 20 + 1, 70, 20, "Villager")));
|
||||
buttonList.add((new GuiButton(buttonEnchantmentID, guiShowBasePosition + 86 + 5, guiShowBaseHeight + 2*20 + 2*1, 70, 20, "Enchanting")));
|
||||
buttonList.add((new GuiButton(buttonAnvilID, guiShowBasePosition - 86 - 70 - 5, guiShowBaseHeight + 3*20 + 3*1, 70, 20, "Anvil")));
|
||||
buttonList.add((new GuiButton(buttonEnchantmentID, guiShowBasePosition + 86 + 5, guiShowBaseHeight + 2 * 20 + 2, 70, 20, "Enchanting")));
|
||||
buttonList.add((new GuiButton(buttonAnvilID, guiShowBasePosition - 86 - 70 - 5, guiShowBaseHeight + 3 * 20 + 3, 70, 20, "Anvil")));
|
||||
|
||||
//Adding Crafting Buttons
|
||||
addCraftingButtons();
|
||||
@@ -233,6 +233,16 @@ public class GuiConfig extends GuiScreen {
|
||||
buttonList.add((new GuiButton(9, guiBasePosition + 34, height / 2 - 67, 22, 20, "Ctrl")));
|
||||
}
|
||||
|
||||
public enum GuiType {
|
||||
ANVIL,
|
||||
FURNACE,
|
||||
BREWINGSTAND,
|
||||
ENCHANTMENT,
|
||||
INVENTORY,
|
||||
VILAGER,
|
||||
DISPENSER
|
||||
}
|
||||
|
||||
//TODO:Get strings from language file(Localizer)...
|
||||
//TODO:Add things that make this GUI an Config ... :P
|
||||
}
|
||||
|
||||
@@ -3,13 +3,27 @@ package de.skate702.craftingkeys.manager;
|
||||
import de.skate702.craftingkeys.util.Logger;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
/**
|
||||
* Manages a Anvil GUI Inventory.
|
||||
*/
|
||||
public class AnvilManager extends ContainerManager {
|
||||
private static AnvilManager instance = null;
|
||||
|
||||
/**
|
||||
* Creates a new Anvil Manager with the given container.
|
||||
*
|
||||
* @param container The container from a crafting GUI
|
||||
*/
|
||||
private AnvilManager(Container container) {
|
||||
super(container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Anvil Manager Instance operating on the given container
|
||||
*
|
||||
* @param container A container from a GUI
|
||||
* @return manager-singleton
|
||||
*/
|
||||
public static AnvilManager getInstance(Container container) {
|
||||
if (instance == null) {
|
||||
instance = new AnvilManager(container);
|
||||
@@ -46,7 +60,10 @@ public class AnvilManager extends ContainerManager {
|
||||
|
||||
@Override
|
||||
protected void interact() {
|
||||
|
||||
Logger.info("interact()", "Clicked on Anvil Output.");
|
||||
leftClick(2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ public class LanguageLocalizer {
|
||||
* @return localized The localized String
|
||||
*/
|
||||
public static String localize(String unloc) {
|
||||
String localized = StatCollector.translateToLocal(unloc);
|
||||
return localized;
|
||||
return StatCollector.translateToLocal(unloc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ de.skate702.craftingkeys.warn.line2=Es gibt noch viele Fehler, und es fehlen noc
|
||||
de.skate702.craftingkeys.warn.line3=Mehr Info's findest du auf: https://github.com/0xSeb/CraftingKeys!
|
||||
|
||||
craftingkeys.config.title=Crafting Keys Konfiguration
|
||||
craftingkeys.config.description=Konfiguriere hier deine Tastenbelegung und klicke dann auf "Sichern".
|
||||
craftingkeys.config.button.save=Sichern
|
||||
craftingkeys.config.description=Konfiguriere hier deine Tastenbelegung und klicke dann auf "Speichern".
|
||||
craftingkeys.config.button.save=Speichern
|
||||
craftingkeys.config.button.abort=Abbruch
|
||||
craftingkeys.config.usage=Waehle das GUI, fuer das du die Tastenbelegung sehen moechtest.
|
||||
craftingkeys.config.usage=Waehle die Oberflaeche fuer die du die Tastenbelegung sehen moechtest.
|
||||
|
||||
|
||||
@@ -34,3 +34,4 @@ craftingkeys.config.button.save=Save
|
||||
craftingkeys.config.button.abort=Abort
|
||||
craftingkeys.config.usage=Use the buttons to select the GUI which you want to see the Keybindings for!
|
||||
|
||||
# TODO: Same style for the keys
|
||||
Reference in New Issue
Block a user