Added localization support to guis.
This commit is contained in:
parent
198b6c0339
commit
760d6f316c
14 changed files with 89 additions and 44 deletions
|
@ -16,10 +16,12 @@ import net.minecraft.src.GuiContainer;
|
|||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.src.buildcraft.core.BptBase;
|
||||
import net.minecraft.src.buildcraft.core.BptPlayerIndex;
|
||||
import net.minecraft.src.buildcraft.core.GuiBuildCraft;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiBlueprintLibrary extends GuiContainer {
|
||||
public class GuiBlueprintLibrary extends GuiBuildCraft {
|
||||
|
||||
EntityPlayer player;
|
||||
TileBlueprintLibrary library;
|
||||
|
@ -64,21 +66,22 @@ public class GuiBlueprintLibrary extends GuiContainer {
|
|||
controlList.add(nextPageButton);
|
||||
|
||||
// if (library.owner.equals(player.username)) {
|
||||
deleteButton = new GuiButton(2, j + 100, k + 114, 25, 20, "Del");
|
||||
deleteButton = new GuiButton(2, j + 100, k + 114, 25, 20, StringUtil.localize("gui.del"));
|
||||
controlList.add(deleteButton);
|
||||
|
||||
lockButton = new GuiButton(3, j + 127, k + 114, 40, 20, "Lock");
|
||||
lockButton = new GuiButton(3, j + 127, k + 114, 40, 20, StringUtil.localize("gui.lock"));
|
||||
controlList.add(lockButton);
|
||||
|
||||
if (library.locked)
|
||||
lockButton.displayString = "Unlock";
|
||||
else lockButton.displayString = "Lock";
|
||||
lockButton.displayString = StringUtil.localize("gui.unlock");
|
||||
else lockButton.displayString = StringUtil.localize("gui.lock");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
// fontRenderer.drawString(library.owner + "'s Library", 6, 6, 0x404040);
|
||||
fontRenderer.drawString("Blueprint Library", 6, 6, 0x404040);
|
||||
String title = StringUtil.localize("tile.libraryBlock");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
|
||||
int c = 0;
|
||||
for (BptBase bpt : container.contents) {
|
||||
|
@ -165,9 +168,9 @@ public class GuiBlueprintLibrary extends GuiContainer {
|
|||
library.locked = !library.locked;
|
||||
|
||||
if (library.locked)
|
||||
lockButton.displayString = "Unlock";
|
||||
lockButton.displayString = StringUtil.localize("gui.unlock");
|
||||
else
|
||||
lockButton.displayString = "Lock";
|
||||
lockButton.displayString = StringUtil.localize("gui.lock");
|
||||
} else if (deleteButton != null && deleteButton.mousePressed(ModLoader.getMinecraftInstance(), i, j))
|
||||
if (library.selected != null) {
|
||||
index.deleteBluePrint (library.selected.file.getName());
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Collection;
|
|||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.ItemStack;
|
||||
import net.minecraft.src.buildcraft.core.GuiAdvancedInterface;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -40,12 +41,13 @@ public class GuiBuilder extends GuiAdvancedInterface {
|
|||
protected void drawGuiContainerForegroundLayer() {
|
||||
super.drawGuiContainerForegroundLayer ();
|
||||
|
||||
fontRenderer.drawString("Builder", 73, 12, 0x404040);
|
||||
fontRenderer.drawString("Building Resources", 8, 60, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, ySize - 97, 0x404040);
|
||||
String title = StringUtil.localize("tile.builderBlock");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 12, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.building.resources"), 8, 60, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
|
||||
|
||||
if (builder.isBuildingBlueprint())
|
||||
fontRenderer.drawString("Needed", 185, 7, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.needed"), 185, 7, 0x404040);
|
||||
|
||||
drawForegroundSelection();
|
||||
}
|
||||
|
|
|
@ -11,10 +11,12 @@ package net.minecraft.src.buildcraft.builders;
|
|||
|
||||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.buildcraft.core.GuiBuildCraft;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiFiller extends GuiContainer {
|
||||
public class GuiFiller extends GuiBuildCraft {
|
||||
|
||||
IInventory playerInventory;
|
||||
TileFiller filler;
|
||||
|
@ -29,9 +31,10 @@ public class GuiFiller extends GuiContainer {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
fontRenderer.drawString("Filler", 75, 6, 0x404040);
|
||||
fontRenderer.drawString("Filling Resources", 8, 74, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, 142, 0x404040);
|
||||
String title = StringUtil.localize("tile.fillerBlock");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.filling.resources"), 8, 74, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, 142, 0x404040);
|
||||
|
||||
if(filler.currentPattern != null)
|
||||
drawForegroundSelection(filler.currentPattern.getName());
|
||||
|
|
|
@ -14,10 +14,12 @@ import java.util.Date;
|
|||
import net.minecraft.src.BuildCraftBuilders;
|
||||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.IInventory;
|
||||
import net.minecraft.src.buildcraft.core.GuiBuildCraft;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiTemplate extends GuiContainer {
|
||||
public class GuiTemplate extends GuiBuildCraft {
|
||||
|
||||
IInventory playerInventory;
|
||||
TileArchitect template;
|
||||
|
@ -34,8 +36,8 @@ public class GuiTemplate extends GuiContainer {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
fontRenderer.drawString(template.getInvName(), 8, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, ySize - 152, 0x404040);
|
||||
fontRenderer.drawString(template.getInvName(), getCenteredOffset(template.getInvName()), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 152, 0x404040);
|
||||
|
||||
if (editMode && ((new Date ()).getTime() / 100) % 8 >= 4)
|
||||
fontRenderer.drawString(template.name + "|", 51, 62, 0x404040);
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.src.RenderHelper;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public abstract class GuiAdvancedInterface extends GuiContainer {
|
||||
public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
||||
|
||||
public abstract class AdvancedSlot {
|
||||
final public int x, y;
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package net.minecraft.src.buildcraft.core;
|
||||
|
||||
import net.minecraft.src.Container;
|
||||
import net.minecraft.src.GuiContainer;
|
||||
|
||||
public abstract class GuiBuildCraft extends GuiContainer {
|
||||
|
||||
public GuiBuildCraft(Container par1Container) {
|
||||
super(par1Container);
|
||||
}
|
||||
|
||||
protected int getCenteredOffset(String string) {
|
||||
return getCenteredOffset(string, xSize);
|
||||
}
|
||||
protected int getCenteredOffset(String string, int xWidth) {
|
||||
return (xWidth - fontRenderer.getStringWidth(string)) / 2;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -13,12 +13,14 @@ import net.minecraft.src.Block;
|
|||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.minecraft.src.Item;
|
||||
import net.minecraft.src.buildcraft.core.GuiBuildCraft;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
import net.minecraft.src.forge.ITextureProvider;
|
||||
import net.minecraft.src.forge.MinecraftForgeClient;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiCombustionEngine extends GuiContainer {
|
||||
public class GuiCombustionEngine extends GuiBuildCraft {
|
||||
|
||||
private TileEngine tileEngine;
|
||||
|
||||
|
@ -31,8 +33,9 @@ public class GuiCombustionEngine extends GuiContainer {
|
|||
@Override
|
||||
protected void drawGuiContainerForegroundLayer()
|
||||
{
|
||||
fontRenderer.drawString("Combustion Engine", 50, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
String title = StringUtil.localize("tile.engineIron");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,10 +11,12 @@ package net.minecraft.src.buildcraft.energy;
|
|||
|
||||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.minecraft.src.buildcraft.core.GuiBuildCraft;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiSteamEngine extends GuiContainer {
|
||||
public class GuiSteamEngine extends GuiBuildCraft {
|
||||
|
||||
private TileEngine tileEngine;
|
||||
|
||||
|
@ -25,8 +27,9 @@ public class GuiSteamEngine extends GuiContainer {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
fontRenderer.drawString("Steam Engine", 60, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
String title = StringUtil.localize("tile.engineStone");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,10 +12,12 @@ package net.minecraft.src.buildcraft.factory;
|
|||
import net.minecraft.src.GuiContainer;
|
||||
import net.minecraft.src.InventoryPlayer;
|
||||
import net.minecraft.src.World;
|
||||
import net.minecraft.src.buildcraft.core.GuiBuildCraft;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiAutoCrafting extends GuiContainer {
|
||||
public class GuiAutoCrafting extends GuiBuildCraft {
|
||||
|
||||
public GuiAutoCrafting(InventoryPlayer inventoryplayer, World world,
|
||||
TileAutoWorkbench tile) {
|
||||
|
@ -30,8 +32,9 @@ public class GuiAutoCrafting extends GuiContainer {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
fontRenderer.drawString("Crafting", 28, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
String title = StringUtil.localize("tile.tile.autoWorkBenchBlock");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.src.ItemStack;
|
|||
import net.minecraft.src.buildcraft.api.BuildCraftAPI;
|
||||
import net.minecraft.src.buildcraft.api.RefineryRecipe;
|
||||
import net.minecraft.src.buildcraft.core.GuiAdvancedInterface;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -39,10 +40,11 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
fontRenderer.drawString("Refinery Setup", 28, 6, 0x404040);
|
||||
String title = StringUtil.localize("tile.refineryBlock");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
fontRenderer.drawString("->", 63, 59, 0x404040);
|
||||
fontRenderer.drawString("<-", 106, 59, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
drawForegroundSelection ();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.minecraft.src.buildcraft.core.network.PacketPayload;
|
|||
import net.minecraft.src.buildcraft.core.network.PacketUpdate;
|
||||
import net.minecraft.src.buildcraft.factory.TileAssemblyTable;
|
||||
import net.minecraft.src.buildcraft.factory.TileAssemblyTable.SelectionMessage;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -84,9 +85,9 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
fontRenderer.drawString("Assembly Table", 60, 15, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, ySize - 97,
|
||||
0x404040);
|
||||
String title = StringUtil.localize("tile.assemblyTableBlock");
|
||||
fontRenderer.drawString(title, getCenteredOffset(title), 15, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
|
||||
|
||||
drawForegroundSelection();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.src.buildcraft.core.GuiAdvancedInterface;
|
|||
import net.minecraft.src.buildcraft.core.network.PacketIds;
|
||||
import net.minecraft.src.buildcraft.core.network.PacketSlotChange;
|
||||
import net.minecraft.src.buildcraft.transport.PipeLogicDiamond.PacketStack;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -47,9 +48,8 @@ public class GuiDiamondPipe extends GuiAdvancedInterface {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer() {
|
||||
fontRenderer.drawString(filterInventory.getInvName(), 8, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, ySize - 97,
|
||||
0x404040);
|
||||
fontRenderer.drawString(filterInventory.getInvName(), getCenteredOffset(filterInventory.getInvName()), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
|
||||
|
||||
drawForegroundSelection ();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.src.buildcraft.api.Trigger;
|
|||
import net.minecraft.src.buildcraft.api.TriggerParameter;
|
||||
import net.minecraft.src.buildcraft.core.GuiAdvancedInterface;
|
||||
import net.minecraft.src.buildcraft.transport.Gate.GateKind;
|
||||
import net.minecraft.src.forestry.core.utils.StringUtil;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -212,13 +213,8 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
protected void drawGuiContainerForegroundLayer() {
|
||||
String name = _container.getGateName();
|
||||
|
||||
if(name == "Gate")
|
||||
fontRenderer.drawString("Gate", 75, 15, 0x404040);
|
||||
else
|
||||
fontRenderer.drawString(name, 60, 15, 0x404040);
|
||||
|
||||
fontRenderer.drawString("Inventory", 8, ySize - 97,
|
||||
0x404040);
|
||||
fontRenderer.drawString(name, getCenteredOffset(name), 15, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
|
||||
|
||||
drawForegroundSelection ();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
# Master language file
|
||||
|
||||
gui.building.resources=Building Resources
|
||||
gui.del=Del
|
||||
gui.filling.resources=Filling Resources
|
||||
gui.inventory=Inventory
|
||||
gui.lock=Lock
|
||||
gui.needed=Needed
|
||||
gui.unlock=Unlock
|
||||
item.bucketFuel=Fuel Bucket
|
||||
item.bucketOil=Oil Bucket
|
||||
item.woodenGearItem=Wood Gear
|
||||
|
|
Loading…
Reference in a new issue