Refactoring
Type-safety Minor performance improvements
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.gui;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
@@ -29,7 +30,11 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import appeng.container.slot.*;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -42,10 +47,10 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
@@ -55,7 +60,17 @@ import appeng.client.me.SlotDisconnected;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.AppEngCraftingSlot;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotCraftingTerm;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.container.slot.SlotInaccessible;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotPatternTerm;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
@@ -66,10 +81,6 @@ import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.INEI;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
|
||||
@@ -495,7 +506,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
if ( y < 15 )
|
||||
y = 15;
|
||||
|
||||
String msg = tooltip.getMsg();
|
||||
String msg = tooltip.getMessage();
|
||||
if ( msg != null )
|
||||
drawTooltip( x + 11, y + 4, 0, msg );
|
||||
}
|
||||
@@ -567,7 +578,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
|
||||
if ( var13 == 0 )
|
||||
{
|
||||
var14 = "\u00a7" + Integer.toHexString( 15 ) + var14;
|
||||
var14 = '\u00a7' + Integer.toHexString( 15 ) + var14;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -702,20 +713,11 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static String join(Collection<?> s, String delimiter)
|
||||
protected static String join(Collection<String> toolTip, String delimiter)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator iterator = s.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
builder.append( iterator.next() );
|
||||
if ( !iterator.hasNext() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
builder.append( delimiter );
|
||||
}
|
||||
return builder.toString();
|
||||
final Joiner joiner = Joiner.on( delimiter );
|
||||
|
||||
return joiner.join( toolTip );
|
||||
}
|
||||
|
||||
boolean useNEI = false;
|
||||
|
||||
@@ -18,17 +18,20 @@
|
||||
|
||||
package appeng.client.gui.config;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
import cpw.mods.fml.client.config.GuiConfig;
|
||||
import cpw.mods.fml.client.config.IConfigElement;
|
||||
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class AEConfigGui extends GuiConfig
|
||||
{
|
||||
|
||||
@@ -57,7 +60,7 @@ public class AEConfigGui extends GuiConfig
|
||||
}
|
||||
|
||||
public AEConfigGui(GuiScreen parent) {
|
||||
super( parent, getConfigElements(), AppEng.modid, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) );
|
||||
super( parent, getConfigElements(), AppEng.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
@@ -89,7 +90,7 @@ public class GuiCondenser extends AEBaseGui
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
|
||||
mode.set( cvc.output );
|
||||
mode.FillVar = "" + cvc.output.requiredPower;
|
||||
mode.fillVar = String.valueOf( cvc.output.requiredPower );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -25,12 +26,14 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
@@ -51,8 +54,6 @@ import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
public class GuiCraftConfirm extends AEBaseGui
|
||||
{
|
||||
|
||||
@@ -369,7 +370,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
{
|
||||
long BytesUsed = ccc.bytesUsed;
|
||||
String byteUsed = NumberFormat.getInstance().format( BytesUsed );
|
||||
String Add = BytesUsed > 0 ? (byteUsed + " " + GuiText.BytesUsed.getLocal()) : GuiText.CalculatingWait.getLocal();
|
||||
String Add = BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal()) : GuiText.CalculatingWait.getLocal();
|
||||
fontRendererObj.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 );
|
||||
|
||||
String dsp = null;
|
||||
@@ -428,9 +429,9 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
{
|
||||
String str = Long.toString( stored.getStackSize() );
|
||||
if ( stored.getStackSize() >= 10000 )
|
||||
str = Long.toString( stored.getStackSize() / 1000 ) + "k";
|
||||
str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
|
||||
if ( stored.getStackSize() >= 10000000 )
|
||||
str = Long.toString( stored.getStackSize() / 1000000 ) + "m";
|
||||
str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
|
||||
|
||||
str = GuiText.FromStorage.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
@@ -447,9 +448,9 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
{
|
||||
String str = Long.toString( missingStack.getStackSize() );
|
||||
if ( missingStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( missingStack.getStackSize() / 1000 ) + "k";
|
||||
str = Long.toString( missingStack.getStackSize() / 1000 ) + 'k';
|
||||
if ( missingStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( missingStack.getStackSize() / 1000000 ) + "m";
|
||||
str = Long.toString( missingStack.getStackSize() / 1000000 ) + 'm';
|
||||
|
||||
str = GuiText.Missing.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
@@ -467,9 +468,9 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
{
|
||||
String str = Long.toString( pendingStack.getStackSize() );
|
||||
if ( pendingStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000 ) + "k";
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
|
||||
if ( pendingStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + "m";
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
|
||||
|
||||
str = GuiText.ToCraft.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
@@ -492,7 +493,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
|
||||
if ( lineList.size() > 0 )
|
||||
dspToolTip = dspToolTip + "\n" + Joiner.on( "\n" ).join( lineList );
|
||||
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
|
||||
|
||||
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
|
||||
toolPosY = y * offY + yo;
|
||||
|
||||
@@ -18,17 +18,20 @@
|
||||
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SortDir;
|
||||
@@ -46,8 +49,6 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
|
||||
public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
{
|
||||
|
||||
@@ -321,9 +322,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
{
|
||||
String str = Long.toString( stored.getStackSize() );
|
||||
if ( stored.getStackSize() >= 10000 )
|
||||
str = Long.toString( stored.getStackSize() / 1000 ) + "k";
|
||||
str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
|
||||
if ( stored.getStackSize() >= 10000000 )
|
||||
str = Long.toString( stored.getStackSize() / 1000000 ) + "m";
|
||||
str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
|
||||
|
||||
str = GuiText.Stored.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
@@ -340,9 +341,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
{
|
||||
String str = Long.toString( activeStack.getStackSize() );
|
||||
if ( activeStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( activeStack.getStackSize() / 1000 ) + "k";
|
||||
str = Long.toString( activeStack.getStackSize() / 1000 ) + 'k';
|
||||
if ( activeStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( activeStack.getStackSize() / 1000000 ) + "m";
|
||||
str = Long.toString( activeStack.getStackSize() / 1000000 ) + 'm';
|
||||
|
||||
str = GuiText.Crafting.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
@@ -359,9 +360,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
{
|
||||
String str = Long.toString( pendingStack.getStackSize() );
|
||||
if ( pendingStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000 ) + "k";
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
|
||||
if ( pendingStack.getStackSize() >= 10000000 )
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + "m";
|
||||
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
|
||||
|
||||
str = GuiText.Scheduled.getLocal() + ": " + str;
|
||||
int w = 4 + fontRendererObj.getStringWidth( str );
|
||||
@@ -384,7 +385,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
||||
dspToolTip = Platform.getItemDisplayName( is );
|
||||
|
||||
if ( lineList.size() > 0 )
|
||||
dspToolTip = dspToolTip + "\n" + Joiner.on( "\n" ).join( lineList );
|
||||
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
|
||||
|
||||
toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
|
||||
toolPosY = y * offY + yo;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -27,12 +28,14 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
@@ -45,8 +48,6 @@ import appeng.core.localization.GuiText;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
|
||||
public class GuiInterfaceTerminal extends AEBaseGui
|
||||
{
|
||||
|
||||
@@ -182,7 +183,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
String name = (String) lineObj;
|
||||
int rows = byName.get( name ).size();
|
||||
if ( rows > 1 )
|
||||
name = name + " (" + rows + ")";
|
||||
name = name + " (" + rows + ')';
|
||||
|
||||
while (name.length() > 2 && fontRendererObj.getStringWidth( name ) > 155)
|
||||
name = name.substring( 0, name.length() - 1 );
|
||||
@@ -260,7 +261,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
boolean found = searchFilterLowerCase.isEmpty();
|
||||
|
||||
// Search if the current inventory holds a pattern containing the search term.
|
||||
if ( !found && !searchFilterLowerCase.equals( "" ) )
|
||||
if ( !found && !searchFilterLowerCase.isEmpty() )
|
||||
{
|
||||
for (ItemStack itemStack : entry.inv)
|
||||
{
|
||||
|
||||
@@ -18,16 +18,17 @@
|
||||
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
@@ -186,7 +187,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
||||
|
||||
String str = Long.toString( refStack.getStackSize() );
|
||||
if ( refStack.getStackSize() >= 10000 )
|
||||
str = Long.toString( refStack.getStackSize() / 1000 ) + "k";
|
||||
str = Long.toString( refStack.getStackSize() / 1000 ) + 'k';
|
||||
|
||||
int w = fontRendererObj.getStringWidth( str );
|
||||
fontRendererObj.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * 18 + yo + 6) * 2,
|
||||
@@ -200,9 +201,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
||||
{
|
||||
ToolTip = Platform.getItemDisplayName( repo.getItem( z ) );
|
||||
|
||||
ToolTip = ToolTip + ("\n" + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
|
||||
ToolTip = ToolTip + ( '\n' + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
|
||||
if ( refStack.getCountRequestable() > 0 )
|
||||
ToolTip = ToolTip + ("\n" + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ));
|
||||
ToolTip = ToolTip + ( '\n' + GuiText.EnergyDrain.getLocal() + ": " + Platform.formatPowerLong( refStack.getCountRequestable(), true ));
|
||||
|
||||
toolPosX = x * sectionLength + xo + sectionLength - 8;
|
||||
toolPosY = y * 18 + yo;
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
@@ -52,7 +54,7 @@ public class GuiSecurity extends GuiMEMonitorable
|
||||
super.initGui();
|
||||
|
||||
int top = this.guiTop + this.ySize - 116;
|
||||
buttonList.add( inject = new GuiToggleButton( this.guiLeft + 56 + 0, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT
|
||||
buttonList.add( inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT
|
||||
.getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
|
||||
|
||||
buttonList.add( extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
@@ -80,7 +81,7 @@ public class GuiSpatialIOPort extends AEBaseGui
|
||||
fontRendererObj.drawString( GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong( container.currentPower, false ), 13, 21, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong( container.maxPower, false ), 13, 31, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.RequiredPower.getLocal() + ": " + Platform.formatPowerLong( container.reqPower, false ), 13, 78, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) container.eff) / 100) + "%", 13, 88, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.Efficiency.getLocal() + ": " + (((float) container.eff) / 100) + '%', 13, 88, 4210752 );
|
||||
|
||||
fontRendererObj.drawString( getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96, 4210752 );
|
||||
|
||||
@@ -18,15 +18,17 @@
|
||||
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.CondenserOutput;
|
||||
@@ -48,200 +50,154 @@ import appeng.api.config.YesNo;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
|
||||
|
||||
public class GuiImgButton extends GuiButton implements ITooltip
|
||||
{
|
||||
|
||||
static class EnumPair
|
||||
{
|
||||
|
||||
final Enum setting;
|
||||
final Enum value;
|
||||
|
||||
EnumPair(Enum a, Enum b) {
|
||||
setting = a;
|
||||
value = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return setting.hashCode() ^ value.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( getClass() != obj.getClass() )
|
||||
return false;
|
||||
EnumPair other = (EnumPair) obj;
|
||||
return other.setting.equals( setting ) && other.value.equals( value );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class BtnAppearance
|
||||
{
|
||||
|
||||
public int index;
|
||||
public String DisplayName;
|
||||
public String DisplayValue;
|
||||
}
|
||||
|
||||
public boolean halfSize = false;
|
||||
public String FillVar;
|
||||
|
||||
private static final Pattern COMPILE = Pattern.compile( "%s" );
|
||||
private static Map<EnumPair, ButtonAppearance> appearances;
|
||||
private final Enum buttonSetting;
|
||||
public boolean halfSize = false;
|
||||
public String fillVar;
|
||||
private Enum currentValue;
|
||||
|
||||
static private Map<EnumPair, BtnAppearance> Appearances;
|
||||
|
||||
private void registerApp(int IIcon, Settings setting, Enum val, ButtonToolTips title, Object hint)
|
||||
public GuiImgButton( int x, int y, Enum idx, Enum val )
|
||||
{
|
||||
BtnAppearance a = new BtnAppearance();
|
||||
a.DisplayName = title.getUnlocalized();
|
||||
a.DisplayValue = (String) (hint instanceof String ? hint : ((ButtonToolTips) hint).getUnlocalized());
|
||||
a.index = IIcon;
|
||||
Appearances.put( new EnumPair( setting, val ), a );
|
||||
}
|
||||
|
||||
public void setVisibility(boolean vis)
|
||||
{
|
||||
visible = vis;
|
||||
enabled = vis;
|
||||
}
|
||||
|
||||
public GuiImgButton(int x, int y, Enum idx, Enum val) {
|
||||
super( 0, 0, 16, "" );
|
||||
buttonSetting = idx;
|
||||
currentValue = val;
|
||||
xPosition = x;
|
||||
yPosition = y;
|
||||
width = 16;
|
||||
height = 16;
|
||||
|
||||
if ( Appearances == null )
|
||||
this.buttonSetting = idx;
|
||||
this.currentValue = val;
|
||||
this.xPosition = x;
|
||||
this.yPosition = y;
|
||||
this.width = 16;
|
||||
this.height = 16;
|
||||
|
||||
if ( appearances == null )
|
||||
{
|
||||
Appearances = new HashMap<EnumPair, BtnAppearance>();
|
||||
registerApp( 16 * 7, Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH, ButtonToolTips.CondenserOutput, ButtonToolTips.Trash );
|
||||
registerApp( 16 * 7 + 1, Settings.CONDENSER_OUTPUT, CondenserOutput.MATTER_BALLS, ButtonToolTips.CondenserOutput, ButtonToolTips.MatterBalls );
|
||||
registerApp( 16 * 7 + 2, Settings.CONDENSER_OUTPUT, CondenserOutput.SINGULARITY, ButtonToolTips.CondenserOutput, ButtonToolTips.Singularity );
|
||||
appearances = new HashMap<EnumPair, ButtonAppearance>();
|
||||
this.registerApp( 16 * 7, Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH, ButtonToolTips.CondenserOutput, ButtonToolTips.Trash );
|
||||
this.registerApp( 16 * 7 + 1, Settings.CONDENSER_OUTPUT, CondenserOutput.MATTER_BALLS, ButtonToolTips.CondenserOutput, ButtonToolTips.MatterBalls );
|
||||
this.registerApp( 16 * 7 + 2, Settings.CONDENSER_OUTPUT, CondenserOutput.SINGULARITY, ButtonToolTips.CondenserOutput, ButtonToolTips.Singularity );
|
||||
|
||||
registerApp( 16 * 9 + 1, Settings.ACCESS, AccessRestriction.READ, ButtonToolTips.IOMode, ButtonToolTips.Read );
|
||||
registerApp( 16 * 9, Settings.ACCESS, AccessRestriction.WRITE, ButtonToolTips.IOMode, ButtonToolTips.Write );
|
||||
registerApp( 16 * 9 + 2, Settings.ACCESS, AccessRestriction.READ_WRITE, ButtonToolTips.IOMode, ButtonToolTips.ReadWrite );
|
||||
this.registerApp( 16 * 9 + 1, Settings.ACCESS, AccessRestriction.READ, ButtonToolTips.IOMode, ButtonToolTips.Read );
|
||||
this.registerApp( 16 * 9, Settings.ACCESS, AccessRestriction.WRITE, ButtonToolTips.IOMode, ButtonToolTips.Write );
|
||||
this.registerApp( 16 * 9 + 2, Settings.ACCESS, AccessRestriction.READ_WRITE, ButtonToolTips.IOMode, ButtonToolTips.ReadWrite );
|
||||
|
||||
registerApp( 16 * 10, Settings.POWER_UNITS, PowerUnits.AE, ButtonToolTips.PowerUnits, PowerUnits.AE.unlocalizedName );
|
||||
registerApp( 16 * 10 + 1, Settings.POWER_UNITS, PowerUnits.EU, ButtonToolTips.PowerUnits, PowerUnits.EU.unlocalizedName );
|
||||
registerApp( 16 * 10 + 2, Settings.POWER_UNITS, PowerUnits.MJ, ButtonToolTips.PowerUnits, PowerUnits.MJ.unlocalizedName );
|
||||
registerApp( 16 * 10 + 3, Settings.POWER_UNITS, PowerUnits.MK, ButtonToolTips.PowerUnits, PowerUnits.MK.unlocalizedName );
|
||||
registerApp( 16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.WA, ButtonToolTips.PowerUnits, PowerUnits.WA.unlocalizedName );
|
||||
registerApp( 16 * 10 + 5, Settings.POWER_UNITS, PowerUnits.RF, ButtonToolTips.PowerUnits, PowerUnits.RF.unlocalizedName );
|
||||
this.registerApp( 16 * 10, Settings.POWER_UNITS, PowerUnits.AE, ButtonToolTips.PowerUnits, PowerUnits.AE.unlocalizedName );
|
||||
this.registerApp( 16 * 10 + 1, Settings.POWER_UNITS, PowerUnits.EU, ButtonToolTips.PowerUnits, PowerUnits.EU.unlocalizedName );
|
||||
this.registerApp( 16 * 10 + 2, Settings.POWER_UNITS, PowerUnits.MJ, ButtonToolTips.PowerUnits, PowerUnits.MJ.unlocalizedName );
|
||||
this.registerApp( 16 * 10 + 3, Settings.POWER_UNITS, PowerUnits.MK, ButtonToolTips.PowerUnits, PowerUnits.MK.unlocalizedName );
|
||||
this.registerApp( 16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.WA, ButtonToolTips.PowerUnits, PowerUnits.WA.unlocalizedName );
|
||||
this.registerApp( 16 * 10 + 5, Settings.POWER_UNITS, PowerUnits.RF, ButtonToolTips.PowerUnits, PowerUnits.RF.unlocalizedName );
|
||||
|
||||
registerApp( 3, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, ButtonToolTips.RedstoneMode, ButtonToolTips.AlwaysActive );
|
||||
registerApp( 0, Settings.REDSTONE_CONTROLLED, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithoutSignal );
|
||||
registerApp( 1, Settings.REDSTONE_CONTROLLED, RedstoneMode.HIGH_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithSignal );
|
||||
registerApp( 2, Settings.REDSTONE_CONTROLLED, RedstoneMode.SIGNAL_PULSE, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveOnPulse );
|
||||
this.registerApp( 3, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, ButtonToolTips.RedstoneMode, ButtonToolTips.AlwaysActive );
|
||||
this.registerApp( 0, Settings.REDSTONE_CONTROLLED, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithoutSignal );
|
||||
this.registerApp( 1, Settings.REDSTONE_CONTROLLED, RedstoneMode.HIGH_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithSignal );
|
||||
this.registerApp( 2, Settings.REDSTONE_CONTROLLED, RedstoneMode.SIGNAL_PULSE, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveOnPulse );
|
||||
|
||||
registerApp( 0, Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.EmitLevelsBelow );
|
||||
registerApp( 1, Settings.REDSTONE_EMITTER, RedstoneMode.HIGH_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.EmitLevelAbove );
|
||||
this.registerApp( 0, Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.EmitLevelsBelow );
|
||||
this.registerApp( 1, Settings.REDSTONE_EMITTER, RedstoneMode.HIGH_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.EmitLevelAbove );
|
||||
|
||||
registerApp( 51, Settings.OPERATION_MODE, OperationMode.FILL, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToStorageCell );
|
||||
registerApp( 50, Settings.OPERATION_MODE, OperationMode.EMPTY, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToNetwork );
|
||||
this.registerApp( 51, Settings.OPERATION_MODE, OperationMode.FILL, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToStorageCell );
|
||||
this.registerApp( 50, Settings.OPERATION_MODE, OperationMode.EMPTY, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToNetwork );
|
||||
|
||||
registerApp( 51, Settings.IO_DIRECTION, RelativeDirection.LEFT, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToStorageCell );
|
||||
registerApp( 50, Settings.IO_DIRECTION, RelativeDirection.RIGHT, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToNetwork );
|
||||
this.registerApp( 51, Settings.IO_DIRECTION, RelativeDirection.LEFT, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToStorageCell );
|
||||
this.registerApp( 50, Settings.IO_DIRECTION, RelativeDirection.RIGHT, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToNetwork );
|
||||
|
||||
registerApp( 48, Settings.SORT_DIRECTION, SortDir.ASCENDING, ButtonToolTips.SortOrder, ButtonToolTips.ToggleSortDirection );
|
||||
registerApp( 49, Settings.SORT_DIRECTION, SortDir.DESCENDING, ButtonToolTips.SortOrder, ButtonToolTips.ToggleSortDirection );
|
||||
this.registerApp( 48, Settings.SORT_DIRECTION, SortDir.ASCENDING, ButtonToolTips.SortOrder, ButtonToolTips.ToggleSortDirection );
|
||||
this.registerApp( 49, Settings.SORT_DIRECTION, SortDir.DESCENDING, ButtonToolTips.SortOrder, ButtonToolTips.ToggleSortDirection );
|
||||
|
||||
registerApp( 16 * 2 + 3, Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_Auto );
|
||||
registerApp( 16 * 2 + 4, Settings.SEARCH_MODE, SearchBoxMode.MANUAL_SEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_Standard );
|
||||
registerApp( 16 * 2 + 5, Settings.SEARCH_MODE, SearchBoxMode.NEI_AUTOSEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_NEIAuto );
|
||||
registerApp( 16 * 2 + 6, Settings.SEARCH_MODE, SearchBoxMode.NEI_MANUAL_SEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_NEIStandard );
|
||||
this.registerApp( 16 * 2 + 3, Settings.SEARCH_MODE, SearchBoxMode.AUTOSEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_Auto );
|
||||
this.registerApp( 16 * 2 + 4, Settings.SEARCH_MODE, SearchBoxMode.MANUAL_SEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_Standard );
|
||||
this.registerApp( 16 * 2 + 5, Settings.SEARCH_MODE, SearchBoxMode.NEI_AUTOSEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_NEIAuto );
|
||||
this.registerApp( 16 * 2 + 6, Settings.SEARCH_MODE, SearchBoxMode.NEI_MANUAL_SEARCH, ButtonToolTips.SearchMode, ButtonToolTips.SearchMode_NEIStandard );
|
||||
|
||||
registerApp( 16 * 5 + 3, Settings.LEVEL_TYPE, LevelType.ENERGY_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Energy );
|
||||
registerApp( 16 * 4 + 3, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Item );
|
||||
this.registerApp( 16 * 5 + 3, Settings.LEVEL_TYPE, LevelType.ENERGY_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Energy );
|
||||
this.registerApp( 16 * 4 + 3, Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL, ButtonToolTips.LevelType, ButtonToolTips.LevelType_Item );
|
||||
|
||||
registerApp( 16 * 13, Settings.TERMINAL_STYLE, TerminalStyle.TALL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Tall );
|
||||
registerApp( 16 * 13 + 1, Settings.TERMINAL_STYLE, TerminalStyle.SMALL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Small );
|
||||
registerApp( 16 * 13 + 2, Settings.TERMINAL_STYLE, TerminalStyle.FULL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Full );
|
||||
this.registerApp( 16 * 13, Settings.TERMINAL_STYLE, TerminalStyle.TALL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Tall );
|
||||
this.registerApp( 16 * 13 + 1, Settings.TERMINAL_STYLE, TerminalStyle.SMALL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Small );
|
||||
this.registerApp( 16 * 13 + 2, Settings.TERMINAL_STYLE, TerminalStyle.FULL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Full );
|
||||
|
||||
registerApp( 64, Settings.SORT_BY, SortOrder.NAME, ButtonToolTips.SortBy, ButtonToolTips.ItemName );
|
||||
registerApp( 65, Settings.SORT_BY, SortOrder.AMOUNT, ButtonToolTips.SortBy, ButtonToolTips.NumberOfItems );
|
||||
registerApp( 68, Settings.SORT_BY, SortOrder.INVTWEAKS, ButtonToolTips.SortBy, ButtonToolTips.InventoryTweaks );
|
||||
registerApp( 69, Settings.SORT_BY, SortOrder.MOD, ButtonToolTips.SortBy, ButtonToolTips.Mod );
|
||||
this.registerApp( 64, Settings.SORT_BY, SortOrder.NAME, ButtonToolTips.SortBy, ButtonToolTips.ItemName );
|
||||
this.registerApp( 65, Settings.SORT_BY, SortOrder.AMOUNT, ButtonToolTips.SortBy, ButtonToolTips.NumberOfItems );
|
||||
this.registerApp( 68, Settings.SORT_BY, SortOrder.INVTWEAKS, ButtonToolTips.SortBy, ButtonToolTips.InventoryTweaks );
|
||||
this.registerApp( 69, Settings.SORT_BY, SortOrder.MOD, ButtonToolTips.SortBy, ButtonToolTips.Mod );
|
||||
|
||||
registerApp( 66, Settings.ACTIONS, ActionItems.WRENCH, ButtonToolTips.PartitionStorage, ButtonToolTips.PartitionStorageHint );
|
||||
registerApp( 6, Settings.ACTIONS, ActionItems.CLOSE, ButtonToolTips.Clear, ButtonToolTips.ClearSettings );
|
||||
registerApp( 6, Settings.ACTIONS, ActionItems.STASH, ButtonToolTips.Stash, ButtonToolTips.StashDesc );
|
||||
this.registerApp( 66, Settings.ACTIONS, ActionItems.WRENCH, ButtonToolTips.PartitionStorage, ButtonToolTips.PartitionStorageHint );
|
||||
this.registerApp( 6, Settings.ACTIONS, ActionItems.CLOSE, ButtonToolTips.Clear, ButtonToolTips.ClearSettings );
|
||||
this.registerApp( 6, Settings.ACTIONS, ActionItems.STASH, ButtonToolTips.Stash, ButtonToolTips.StashDesc );
|
||||
|
||||
registerApp( 8, Settings.ACTIONS, ActionItems.ENCODE, ButtonToolTips.Encode, ButtonToolTips.EncodeDescription );
|
||||
registerApp( 4 + 3 * 16, Settings.ACTIONS, ActionItems.SUBSTITUTION, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDesc );
|
||||
this.registerApp( 8, Settings.ACTIONS, ActionItems.ENCODE, ButtonToolTips.Encode, ButtonToolTips.EncodeDescription );
|
||||
this.registerApp( 4 + 3 * 16, Settings.ACTIONS, ActionItems.SUBSTITUTION, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDesc );
|
||||
|
||||
registerApp( 16, Settings.VIEW_MODE, ViewItems.STORED, ButtonToolTips.View, ButtonToolTips.StoredItems );
|
||||
registerApp( 18, Settings.VIEW_MODE, ViewItems.ALL, ButtonToolTips.View, ButtonToolTips.StoredCraftable );
|
||||
registerApp( 19, Settings.VIEW_MODE, ViewItems.CRAFTABLE, ButtonToolTips.View, ButtonToolTips.Craftable );
|
||||
this.registerApp( 16, Settings.VIEW_MODE, ViewItems.STORED, ButtonToolTips.View, ButtonToolTips.StoredItems );
|
||||
this.registerApp( 18, Settings.VIEW_MODE, ViewItems.ALL, ButtonToolTips.View, ButtonToolTips.StoredCraftable );
|
||||
this.registerApp( 19, Settings.VIEW_MODE, ViewItems.CRAFTABLE, ButtonToolTips.View, ButtonToolTips.Craftable );
|
||||
|
||||
registerApp( 16 * 6, Settings.FUZZY_MODE, FuzzyMode.PERCENT_25, ButtonToolTips.FuzzyMode, ButtonToolTips.FZPercent_25 );
|
||||
registerApp( 16 * 6 + 1, Settings.FUZZY_MODE, FuzzyMode.PERCENT_50, ButtonToolTips.FuzzyMode, ButtonToolTips.FZPercent_50 );
|
||||
registerApp( 16 * 6 + 2, Settings.FUZZY_MODE, FuzzyMode.PERCENT_75, ButtonToolTips.FuzzyMode, ButtonToolTips.FZPercent_75 );
|
||||
registerApp( 16 * 6 + 3, Settings.FUZZY_MODE, FuzzyMode.PERCENT_99, ButtonToolTips.FuzzyMode, ButtonToolTips.FZPercent_99 );
|
||||
registerApp( 16 * 6 + 4, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, ButtonToolTips.FuzzyMode, ButtonToolTips.FZIgnoreAll );
|
||||
this.registerApp( 16 * 6, Settings.FUZZY_MODE, FuzzyMode.PERCENT_25, ButtonToolTips.FuzzyMode, ButtonToolTips.FZPercent_25 );
|
||||
this.registerApp( 16 * 6 + 1, Settings.FUZZY_MODE, FuzzyMode.PERCENT_50, ButtonToolTips.FuzzyMode, ButtonToolTips.FZPercent_50 );
|
||||
this.registerApp( 16 * 6 + 2, Settings.FUZZY_MODE, FuzzyMode.PERCENT_75, ButtonToolTips.FuzzyMode, ButtonToolTips.FZPercent_75 );
|
||||
this.registerApp( 16 * 6 + 3, Settings.FUZZY_MODE, FuzzyMode.PERCENT_99, ButtonToolTips.FuzzyMode, ButtonToolTips.FZPercent_99 );
|
||||
this.registerApp( 16 * 6 + 4, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, ButtonToolTips.FuzzyMode, ButtonToolTips.FZIgnoreAll );
|
||||
|
||||
registerApp( 80, Settings.FULLNESS_MODE, FullnessMode.EMPTY, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenEmpty );
|
||||
registerApp( 81, Settings.FULLNESS_MODE, FullnessMode.HALF, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenWorkIsDone );
|
||||
registerApp( 82, Settings.FULLNESS_MODE, FullnessMode.FULL, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenFull );
|
||||
this.registerApp( 80, Settings.FULLNESS_MODE, FullnessMode.EMPTY, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenEmpty );
|
||||
this.registerApp( 81, Settings.FULLNESS_MODE, FullnessMode.HALF, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenWorkIsDone );
|
||||
this.registerApp( 82, Settings.FULLNESS_MODE, FullnessMode.FULL, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenFull );
|
||||
|
||||
registerApp( 16 + 5, Settings.BLOCK, YesNo.YES, ButtonToolTips.InterfaceBlockingMode, ButtonToolTips.Blocking );
|
||||
registerApp( 16 + 4, Settings.BLOCK, YesNo.NO, ButtonToolTips.InterfaceBlockingMode, ButtonToolTips.NonBlocking );
|
||||
this.registerApp( 16 + 5, Settings.BLOCK, YesNo.YES, ButtonToolTips.InterfaceBlockingMode, ButtonToolTips.Blocking );
|
||||
this.registerApp( 16 + 4, Settings.BLOCK, YesNo.NO, ButtonToolTips.InterfaceBlockingMode, ButtonToolTips.NonBlocking );
|
||||
|
||||
registerApp( 16 + 3, Settings.CRAFT_ONLY, YesNo.YES, ButtonToolTips.Craft, ButtonToolTips.CraftOnly );
|
||||
registerApp( 16 + 2, Settings.CRAFT_ONLY, YesNo.NO, ButtonToolTips.Craft, ButtonToolTips.CraftEither );
|
||||
this.registerApp( 16 + 3, Settings.CRAFT_ONLY, YesNo.YES, ButtonToolTips.Craft, ButtonToolTips.CraftOnly );
|
||||
this.registerApp( 16 + 2, Settings.CRAFT_ONLY, YesNo.NO, ButtonToolTips.Craft, ButtonToolTips.CraftEither );
|
||||
|
||||
registerApp( 16 * 11 + 2, Settings.CRAFT_VIA_REDSTONE, YesNo.YES, ButtonToolTips.EmitterMode, ButtonToolTips.CraftViaRedstone );
|
||||
registerApp( 16 * 11 + 1, Settings.CRAFT_VIA_REDSTONE, YesNo.NO, ButtonToolTips.EmitterMode, ButtonToolTips.EmitWhenCrafting );
|
||||
this.registerApp( 16 * 11 + 2, Settings.CRAFT_VIA_REDSTONE, YesNo.YES, ButtonToolTips.EmitterMode, ButtonToolTips.CraftViaRedstone );
|
||||
this.registerApp( 16 * 11 + 1, Settings.CRAFT_VIA_REDSTONE, YesNo.NO, ButtonToolTips.EmitterMode, ButtonToolTips.EmitWhenCrafting );
|
||||
|
||||
registerApp( 16 * 3 + 5, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY, ButtonToolTips.ReportInaccessibleItems,
|
||||
ButtonToolTips.ReportInaccessibleItemsNo );
|
||||
registerApp( 16 * 3 + 6, Settings.STORAGE_FILTER, StorageFilter.NONE, ButtonToolTips.ReportInaccessibleItems,
|
||||
ButtonToolTips.ReportInaccessibleItemsYes );
|
||||
this.registerApp( 16 * 3 + 5, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY, ButtonToolTips.ReportInaccessibleItems, ButtonToolTips.ReportInaccessibleItemsNo );
|
||||
this.registerApp( 16 * 3 + 6, Settings.STORAGE_FILTER, StorageFilter.NONE, ButtonToolTips.ReportInaccessibleItems, ButtonToolTips.ReportInaccessibleItemsYes );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
private void registerApp( int iconIndex, Settings setting, Enum val, ButtonToolTips title, Object hint )
|
||||
{
|
||||
return visible;
|
||||
ButtonAppearance a = new ButtonAppearance();
|
||||
a.displayName = title.getUnlocalized();
|
||||
a.displayValue = ( String ) ( hint instanceof String ? hint : ( ( ButtonToolTips ) hint ).getUnlocalized() );
|
||||
a.index = iconIndex;
|
||||
appearances.put( new EnumPair( setting, val ), a );
|
||||
}
|
||||
|
||||
public void setVisibility( boolean vis )
|
||||
{
|
||||
this.visible = vis;
|
||||
this.enabled = vis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
|
||||
public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
|
||||
{
|
||||
if ( this.visible )
|
||||
{
|
||||
int iconIndex = getIconIndex();
|
||||
int iconIndex = this.getIconIndex();
|
||||
|
||||
if ( halfSize )
|
||||
if ( this.halfSize )
|
||||
{
|
||||
width = 8;
|
||||
height = 8;
|
||||
this.width = 8;
|
||||
this.height = 8;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F );
|
||||
GL11.glScalef( 0.5f, 0.5f, 0.5f );
|
||||
|
||||
if ( enabled )
|
||||
if ( this.enabled )
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
else
|
||||
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
|
||||
|
||||
int uv_y = (int) Math.floor( iconIndex / 16 );
|
||||
int uv_y = ( int ) Math.floor( iconIndex / 16 );
|
||||
int uv_x = iconIndex - uv_y * 16;
|
||||
|
||||
this.drawTexturedModalRect( 0, 0, 256 - 16, 256 - 16, 16, 16 );
|
||||
@@ -252,16 +208,15 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( enabled )
|
||||
if ( this.enabled )
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
else
|
||||
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
|
||||
|
||||
int uv_y = (int) Math.floor( iconIndex / 16 );
|
||||
int uv_y = ( int ) Math.floor( iconIndex / 16 );
|
||||
int uv_x = iconIndex - uv_y * 16;
|
||||
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16 );
|
||||
@@ -274,9 +229,9 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||
|
||||
private int getIconIndex()
|
||||
{
|
||||
if ( buttonSetting != null && currentValue != null )
|
||||
if ( this.buttonSetting != null && this.currentValue != null )
|
||||
{
|
||||
BtnAppearance app = Appearances.get( new EnumPair( buttonSetting, currentValue ) );
|
||||
ButtonAppearance app = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
|
||||
if ( app == null )
|
||||
return 256 - 1;
|
||||
return app.index;
|
||||
@@ -286,55 +241,55 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||
|
||||
public Settings getSetting()
|
||||
{
|
||||
return (Settings) buttonSetting;
|
||||
return ( Settings ) this.buttonSetting;
|
||||
}
|
||||
|
||||
public Enum getCurrentValue()
|
||||
{
|
||||
return currentValue;
|
||||
return this.currentValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg()
|
||||
public String getMessage()
|
||||
{
|
||||
String DisplayName = null;
|
||||
String DisplayValue = null;
|
||||
String displayName = null;
|
||||
String displayValue = null;
|
||||
|
||||
if ( buttonSetting != null && currentValue != null )
|
||||
if ( this.buttonSetting != null && this.currentValue != null )
|
||||
{
|
||||
BtnAppearance ba = Appearances.get( new EnumPair( buttonSetting, currentValue ) );
|
||||
if ( ba == null )
|
||||
ButtonAppearance buttonAppearance = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
|
||||
if ( buttonAppearance == null )
|
||||
return "No Such Message";
|
||||
|
||||
DisplayName = ba.DisplayName;
|
||||
DisplayValue = ba.DisplayValue;
|
||||
displayName = buttonAppearance.displayName;
|
||||
displayValue = buttonAppearance.displayValue;
|
||||
}
|
||||
|
||||
if ( DisplayName != null )
|
||||
if ( displayName != null )
|
||||
{
|
||||
String Name = StatCollector.translateToLocal( DisplayName );
|
||||
String Value = StatCollector.translateToLocal( DisplayValue );
|
||||
String name = StatCollector.translateToLocal( displayName );
|
||||
String value = StatCollector.translateToLocal( displayValue );
|
||||
|
||||
if ( Name == null || Name.equals( "" ) )
|
||||
Name = DisplayName;
|
||||
if ( Value == null || Value.equals( "" ) )
|
||||
Value = DisplayValue;
|
||||
if ( name == null || name.isEmpty() )
|
||||
name = displayName;
|
||||
if ( value == null || value.isEmpty() )
|
||||
value = displayValue;
|
||||
|
||||
if ( FillVar != null )
|
||||
Value = Value.replaceFirst( "%s", FillVar );
|
||||
if ( this.fillVar != null )
|
||||
value = COMPILE.matcher( value ).replaceFirst( this.fillVar );
|
||||
|
||||
Value = Value.replace( "\\n", "\n" );
|
||||
StringBuilder sb = new StringBuilder( Value );
|
||||
value = value.replace( "\\n", "\n" );
|
||||
StringBuilder sb = new StringBuilder( value );
|
||||
|
||||
int i = sb.lastIndexOf( "\n" );
|
||||
if ( i <= 0 )
|
||||
i = 0;
|
||||
while (i + 30 < sb.length() && (i = sb.lastIndexOf( " ", i + 30 )) != -1)
|
||||
while ( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
|
||||
{
|
||||
sb.replace( i, i + 1, "\n" );
|
||||
}
|
||||
|
||||
return Name + "\n" + sb.toString();
|
||||
return name + '\n' + sb;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -342,33 +297,76 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||
@Override
|
||||
public int xPos()
|
||||
{
|
||||
return xPosition;
|
||||
return this.xPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos()
|
||||
{
|
||||
return yPosition;
|
||||
return this.yPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth()
|
||||
{
|
||||
return halfSize ? 8 : 16;
|
||||
return this.halfSize ? 8 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight()
|
||||
{
|
||||
return halfSize ? 8 : 16;
|
||||
return this.halfSize ? 8 : 16;
|
||||
}
|
||||
|
||||
public void set(Enum e)
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
{
|
||||
if ( currentValue != e )
|
||||
return this.visible;
|
||||
}
|
||||
|
||||
public void set( Enum e )
|
||||
{
|
||||
if ( this.currentValue != e )
|
||||
{
|
||||
currentValue = e;
|
||||
this.currentValue = e;
|
||||
}
|
||||
}
|
||||
|
||||
static class EnumPair
|
||||
{
|
||||
|
||||
final Enum setting;
|
||||
final Enum value;
|
||||
|
||||
EnumPair( Enum a, Enum b )
|
||||
{
|
||||
this.setting = a;
|
||||
this.value = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return this.setting.hashCode() ^ this.value.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
if ( obj == null )
|
||||
return false;
|
||||
if ( this.getClass() != obj.getClass() )
|
||||
return false;
|
||||
EnumPair other = ( EnumPair ) obj;
|
||||
return other.setting == this.setting && other.value == this.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class ButtonAppearance
|
||||
{
|
||||
public int index;
|
||||
public String displayName;
|
||||
public String displayValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.container.interfaces.IProgressProvider;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
@@ -91,12 +93,12 @@ public class GuiProgressBar extends GuiButton implements ITooltip
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg()
|
||||
public String getMessage()
|
||||
{
|
||||
if ( fullMsg != null )
|
||||
return fullMsg;
|
||||
|
||||
return (titleName != null ? titleName : "") + "\n" + source.getCurrentProgress() + " " + GuiText.Of.getLocal() + " " + source.getMaxProgress();
|
||||
return (titleName != null ? titleName : "") + '\n' + source.getCurrentProgress() + ' ' + GuiText.Of.getLocal() + ' ' + source.getMaxProgress();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -25,117 +29,110 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
public class GuiTabButton extends GuiButton implements ITooltip
|
||||
{
|
||||
|
||||
final RenderItem itemRenderer;
|
||||
|
||||
int myIcon = -1;
|
||||
private final RenderItem itemRenderer;
|
||||
private final String message;
|
||||
public int hideEdge = 0;
|
||||
private int myIcon = -1;
|
||||
private ItemStack myItem;
|
||||
|
||||
ItemStack myItem;
|
||||
|
||||
final String Msg;
|
||||
|
||||
public void setVisibility(boolean vis)
|
||||
public GuiTabButton( int x, int y, int ico, String message, RenderItem ir )
|
||||
{
|
||||
visible = vis;
|
||||
enabled = vis;
|
||||
}
|
||||
|
||||
public GuiTabButton(int x, int y, int ico, String Msg, RenderItem ir) {
|
||||
super( 0, 0, 16, "" );
|
||||
xPosition = x;
|
||||
yPosition = y;
|
||||
width = 22;
|
||||
height = 22;
|
||||
myIcon = ico;
|
||||
this.Msg = Msg;
|
||||
|
||||
this.xPosition = x;
|
||||
this.yPosition = y;
|
||||
this.width = 22;
|
||||
this.height = 22;
|
||||
this.myIcon = ico;
|
||||
this.message = message;
|
||||
this.itemRenderer = ir;
|
||||
}
|
||||
|
||||
public GuiTabButton(int x, int y, ItemStack ico, String Msg, RenderItem ir) {
|
||||
/**
|
||||
* Using itemstack as an icon
|
||||
*
|
||||
* @param x x pos of button
|
||||
* @param y y pos of button
|
||||
* @param ico used icon
|
||||
* @param message mouse over message
|
||||
* @param ir renderer
|
||||
*/
|
||||
public GuiTabButton( int x, int y, ItemStack ico, String message, RenderItem ir )
|
||||
{
|
||||
super( 0, 0, 16, "" );
|
||||
xPosition = x;
|
||||
yPosition = y;
|
||||
width = 22;
|
||||
height = 22;
|
||||
myItem = ico;
|
||||
this.Msg = Msg;
|
||||
this.xPosition = x;
|
||||
this.yPosition = y;
|
||||
this.width = 22;
|
||||
this.height = 22;
|
||||
this.myItem = ico;
|
||||
this.message = message;
|
||||
this.itemRenderer = ir;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
|
||||
public void drawButton( Minecraft minecraft, int x, int y )
|
||||
{
|
||||
if ( this.visible )
|
||||
{
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
|
||||
minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
|
||||
this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition + this.width && y < this.yPosition + this.height;
|
||||
|
||||
int uv_y = (int) Math.floor( 13 / 16 );
|
||||
int uv_x = (hideEdge > 0 ? 11 : 13) - uv_y * 16;
|
||||
int uv_x = ( this.hideEdge > 0 ? 11 : 13 );
|
||||
|
||||
int offsetX = hideEdge > 0 ? 1 : 0;
|
||||
int offsetX = this.hideEdge > 0 ? 1 : 0;
|
||||
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, uv_y * 16, 25, 22 );
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, 0, 25, 22 );
|
||||
|
||||
if ( myIcon >= 0 )
|
||||
if ( this.myIcon >= 0 )
|
||||
{
|
||||
uv_y = (int) Math.floor( myIcon / 16 );
|
||||
uv_x = myIcon - uv_y * 16;
|
||||
int uv_y = ( int ) Math.floor( this.myIcon / 16 );
|
||||
uv_x = this.myIcon - uv_y * 16;
|
||||
|
||||
this.drawTexturedModalRect( offsetX + this.xPosition + 3, this.yPosition + 3, uv_x * 16, uv_y * 16, 16, 16 );
|
||||
}
|
||||
|
||||
this.mouseDragged( par1Minecraft, par2, par3 );
|
||||
this.mouseDragged( minecraft, x, y );
|
||||
|
||||
if ( myItem != null )
|
||||
if ( this.myItem != null )
|
||||
{
|
||||
this.zLevel = 100.0F;
|
||||
itemRenderer.zLevel = 100.0F;
|
||||
this.itemRenderer.zLevel = 100.0F;
|
||||
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
FontRenderer fontrenderer = par1Minecraft.fontRenderer;
|
||||
itemRenderer.renderItemAndEffectIntoGUI( fontrenderer, par1Minecraft.renderEngine, myItem, offsetX + this.xPosition + 3, this.yPosition + 3 );
|
||||
FontRenderer fontrenderer = minecraft.fontRenderer;
|
||||
this.itemRenderer.renderItemAndEffectIntoGUI( fontrenderer, minecraft.renderEngine, this.myItem, offsetX + this.xPosition + 3, this.yPosition + 3 );
|
||||
GL11.glDisable( GL11.GL_LIGHTING );
|
||||
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
this.itemRenderer.zLevel = 0.0F;
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg()
|
||||
public String getMessage()
|
||||
{
|
||||
return Msg;
|
||||
return this.message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos()
|
||||
{
|
||||
return xPosition;
|
||||
return this.xPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos()
|
||||
{
|
||||
return yPosition;
|
||||
return this.yPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,4 +147,9 @@ public class GuiTabButton extends GuiButton implements ITooltip
|
||||
return 22;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
{
|
||||
return this.visible;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,66 +18,56 @@
|
||||
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
|
||||
public class GuiToggleButton extends GuiButton implements ITooltip
|
||||
{
|
||||
private final int iconIdxOn;
|
||||
private final int iconIdxOff;
|
||||
|
||||
final int iconIdxOn;
|
||||
final int iconIdxOff;
|
||||
private final String displayName;
|
||||
private final String displayHint;
|
||||
|
||||
final String Name;
|
||||
final String Hint;
|
||||
private boolean isActive;
|
||||
|
||||
boolean on;
|
||||
|
||||
public void setState(boolean isOn)
|
||||
public GuiToggleButton( int x, int y, int on, int off, String displayName, String displayHint )
|
||||
{
|
||||
on = isOn;
|
||||
}
|
||||
|
||||
public void setVisibility(boolean vis)
|
||||
{
|
||||
visible = vis;
|
||||
enabled = vis;
|
||||
}
|
||||
|
||||
public GuiToggleButton(int x, int y, int on, int off, String Name, String Hint) {
|
||||
super( 0, 0, 16, "" );
|
||||
iconIdxOn = on;
|
||||
iconIdxOff = off;
|
||||
this.Name = Name;
|
||||
this.Hint = Hint;
|
||||
xPosition = x;
|
||||
yPosition = y;
|
||||
width = 16;
|
||||
height = 16;
|
||||
this.iconIdxOn = on;
|
||||
this.iconIdxOff = off;
|
||||
this.displayName = displayName;
|
||||
this.displayHint = displayHint;
|
||||
this.xPosition = x;
|
||||
this.yPosition = y;
|
||||
this.width = 16;
|
||||
this.height = 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
public void setState( boolean isOn )
|
||||
{
|
||||
return visible;
|
||||
this.isActive = isOn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
|
||||
public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
|
||||
{
|
||||
if ( this.visible )
|
||||
{
|
||||
int iconIndex = getIconIndex();
|
||||
int iconIndex = this.getIconIndex();
|
||||
|
||||
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
|
||||
|
||||
int uv_y = (int) Math.floor( iconIndex / 16 );
|
||||
int uv_y = ( int ) Math.floor( iconIndex / 16 );
|
||||
int uv_x = iconIndex - uv_y * 16;
|
||||
|
||||
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 16 );
|
||||
@@ -88,37 +78,34 @@ public class GuiToggleButton extends GuiButton implements ITooltip
|
||||
|
||||
private int getIconIndex()
|
||||
{
|
||||
return on ? iconIdxOn : iconIdxOff;
|
||||
return this.isActive ? this.iconIdxOn : this.iconIdxOff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMsg()
|
||||
public String getMessage()
|
||||
{
|
||||
String DisplayName = Name;
|
||||
String DisplayValue = Hint;
|
||||
|
||||
if ( DisplayName != null )
|
||||
if ( this.displayName != null )
|
||||
{
|
||||
String Name = StatCollector.translateToLocal( DisplayName );
|
||||
String Value = StatCollector.translateToLocal( DisplayValue );
|
||||
String name = StatCollector.translateToLocal( this.displayName );
|
||||
String value = StatCollector.translateToLocal( this.displayHint );
|
||||
|
||||
if ( Name == null || Name.equals( "" ) )
|
||||
Name = DisplayName;
|
||||
if ( Value == null || Value.equals( "" ) )
|
||||
Value = DisplayValue;
|
||||
if ( name == null || name.isEmpty() )
|
||||
name = this.displayName;
|
||||
if ( value == null || value.isEmpty() )
|
||||
value = this.displayHint;
|
||||
|
||||
Value = Value.replace( "\\n", "\n" );
|
||||
StringBuilder sb = new StringBuilder( Value );
|
||||
value = value.replace( "\\n", "\n" );
|
||||
StringBuilder sb = new StringBuilder( value );
|
||||
|
||||
int i = sb.lastIndexOf( "\n" );
|
||||
if ( i <= 0 )
|
||||
i = 0;
|
||||
while (i + 30 < sb.length() && (i = sb.lastIndexOf( " ", i + 30 )) != -1)
|
||||
while ( i + 30 < sb.length() && ( i = sb.lastIndexOf( " ", i + 30 ) ) != -1 )
|
||||
{
|
||||
sb.replace( i, i + 1, "\n" );
|
||||
}
|
||||
|
||||
return Name + "\n" + sb.toString();
|
||||
return name + '\n' + sb;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -126,13 +113,13 @@ public class GuiToggleButton extends GuiButton implements ITooltip
|
||||
@Override
|
||||
public int xPos()
|
||||
{
|
||||
return xPosition;
|
||||
return this.xPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos()
|
||||
{
|
||||
return yPosition;
|
||||
return this.yPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,4 +134,9 @@ public class GuiToggleButton extends GuiButton implements ITooltip
|
||||
return 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible()
|
||||
{
|
||||
return this.visible;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface ITooltip
|
||||
*
|
||||
* @return tooltip message
|
||||
*/
|
||||
String getMsg();
|
||||
String getMessage();
|
||||
|
||||
/**
|
||||
* x Location for the object that triggers the tooltip.
|
||||
|
||||
Reference in New Issue
Block a user