Refactoring

Type-safety

Minor performance improvements
This commit is contained in:
thatsIch 2014-11-28 04:36:46 +01:00
parent 9fae9d1ec0
commit 2243c5a188
87 changed files with 899 additions and 730 deletions

View file

@ -18,15 +18,18 @@
package appeng.block;
import java.text.MessageFormat;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.PowerUnits;
@ -56,7 +59,7 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
double percent = internalCurrentPower / internalMaxPower;
toolTip.add( GuiText.StoredEnergy.getLocal() + ":" + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
toolTip.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
+ Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
}

View file

@ -18,7 +18,8 @@
package appeng.block.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
@ -30,6 +31,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
@ -42,8 +47,6 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileCharger;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCharger extends AEBaseBlock implements ICustomCollision
{
@ -165,9 +168,9 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
break;
}
return Arrays.asList( bb );
return Collections.singletonList( bb );
}
return Arrays.asList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override

View file

@ -18,7 +18,8 @@
package appeng.block.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
@ -31,6 +32,10 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseBlock;
@ -42,8 +47,6 @@ import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, ICustomCollision
{
@ -114,7 +117,7 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
double xOff = -0.3 * up.offsetX;
double yOff = -0.3 * up.offsetY;
double zOff = -0.3 * up.offsetZ;
return Arrays.asList( AxisAlignedBB.getBoundingBox( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
}
@Override

View file

@ -18,7 +18,8 @@
package appeng.block.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
@ -31,14 +32,16 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderBlockSkyCompass;
import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.tile.misc.TileSkyCompass;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
{
@ -160,9 +163,9 @@ public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
break;
}
return Arrays.asList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
}
return Arrays.asList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override

View file

@ -18,7 +18,8 @@
package appeng.block.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
@ -37,6 +38,9 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.EntityRegistry;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderTinyTNT;
@ -47,7 +51,6 @@ import appeng.entity.EntityIds;
import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.ICustomCollision;
import appeng.hooks.DispenserBehaviorTinyTNT;
import cpw.mods.fml.common.registry.EntityRegistry;
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{
@ -172,7 +175,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{
return Arrays.asList( AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
}
@Override

View file

@ -18,7 +18,8 @@
package appeng.block.networking;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
@ -27,6 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderBlockWireless;
@ -112,9 +114,9 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
break;
}
return Arrays.asList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
}
return Arrays.asList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override

View file

@ -18,7 +18,8 @@
package appeng.block.qnb;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
@ -29,6 +30,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.block.AEBaseBlock;
import appeng.client.EffectType;
import appeng.client.render.BaseBlockRender;
@ -40,8 +45,6 @@ import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomCollision
{
@ -115,7 +118,7 @@ public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomColli
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{
double OnePx = 2.0 / 16.0;
return Arrays.asList( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
@Override

View file

@ -18,7 +18,8 @@
package appeng.block.qnb;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
@ -27,6 +28,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderQNB;
@ -84,7 +86,7 @@ public class BlockQuantumRing extends AEBaseBlock implements ICustomCollision
{
OnePx = 1.0 / 16.0;
}
return Arrays.asList( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
@Override

View file

@ -18,7 +18,8 @@
package appeng.block.storage;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
@ -34,6 +35,10 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender;
@ -43,8 +48,6 @@ import appeng.core.sync.GuiBridge;
import appeng.helpers.ICustomCollision;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
{
@ -129,9 +132,7 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
double Y = o.offsetY == 0 ? 0.06 : 0.0;
double Z = o.offsetZ == 0 ? 0.06 : 0.0;
return Arrays.asList( AxisAlignedBB.getBoundingBox( Math.max( 0.0, X - o.offsetX * sc ), Math.max( 0.0, Y - o.offsetY * sc ),
Math.max( 0.0, Z - o.offsetZ * sc ), Math.min( 1.0, (1.0 - X) - o.offsetX * sc ), Math.min( 1.0, (1.0 - Y) - o.offsetY * sc ),
Math.min( 1.0, (1.0 - Z) - o.offsetZ * sc ) ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( Math.max( 0.0, X - o.offsetX * sc ), Math.max( 0.0, Y - o.offsetY * sc ), Math.max( 0.0, Z - o.offsetZ * sc ), Math.min( 1.0, ( 1.0 - X ) - o.offsetX * sc ), Math.min( 1.0, ( 1.0 - Y ) - o.offsetY * sc ), Math.min( 1.0, ( 1.0 - Z ) - o.offsetZ * sc ) ) );
}
@Override

View file

@ -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;

View file

@ -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() ) );
}
}

View file

@ -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 );
}

View file

@ -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;

View file

@ -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;

View file

@ -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)
{

View file

@ -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;

View file

@ -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

View file

@ -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 );

View file

@ -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;
}
}

View file

@ -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

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -30,7 +30,7 @@ public interface ITooltip
*
* @return tooltip message
*/
String getMsg();
String getMessage();
/**
* x Location for the object that triggers the tooltip.

View file

@ -18,14 +18,15 @@
package appeng.client.render;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AEConfig;
@ -107,48 +108,48 @@ public class AppEngRenderItem extends RenderItem
if ( amount != 0 )
{
String var6 = "" + Math.abs( amount );
String var6 = String.valueOf( Math.abs( amount ) );
if ( AEConfig.instance.useTerminalUseLargeFont() )
{
if ( amount > 999999999 )
{
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000000.0 ) ) + 'B';
}
else if ( amount > 99999999 )
{
var6 = "." + (int) Math.floor( amount / 100000000.0 ) + "B";
var6 = "." + (int) Math.floor( amount / 100000000.0 ) + 'B';
}
else if ( amount > 999999 )
{
var6 = "" + (int) Math.floor( amount / 1000000.0 ) + "M";
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000.0 ) ) + 'M';
}
else if ( amount > 99999 )
{
var6 = "." + (int) Math.floor( amount / 100000.0 ) + "M";
var6 = "." + (int) Math.floor( amount / 100000.0 ) + 'M';
}
else if ( amount > 999 )
{
var6 = "" + (int) Math.floor( amount / 1000.0 ) + "K";
var6 = String.valueOf( ( int ) Math.floor( amount / 1000.0 ) ) + 'K';
}
}
else
{
if ( amount > 999999999 )
{
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000000.0 ) ) + 'B';
}
else if ( amount > 999999999 )
{
var6 = "" + (int) Math.floor( amount / 1000000000.0 ) + "B";
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000000.0 ) ) + 'B';
}
else if ( amount > 999999 )
{
var6 = "" + (int) Math.floor( amount / 1000000.0 ) + "M";
var6 = String.valueOf( ( int ) Math.floor( amount / 1000000.0 ) ) + 'M';
}
else if ( amount > 9999 )
{
var6 = "" + (int) Math.floor( amount / 1000.0 ) + "K";
var6 = String.valueOf( ( int ) Math.floor( amount / 1000.0 ) ) + 'K';
}
}

View file

@ -18,9 +18,13 @@
package appeng.client.render;
import java.nio.FloatBuffer;
import java.util.EnumSet;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
@ -37,8 +41,8 @@ import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
@ -46,8 +50,6 @@ import appeng.block.AEBaseBlock;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class BaseBlockRender
@ -65,7 +67,7 @@ public class BaseBlockRender
{
int r = 0xff & (v >> 16);
int g = 0xff & (v >> 8);
int b = 0xff & (v >> 0);
int b = 0xff & ( v );
r *= d;
g *= d;
@ -124,8 +126,8 @@ public class BaseBlockRender
OrientationMap[5][4][1] = 0;
// upside down
OrientationMap[0][3][0] = 0 | FLIP_H_BIT;
OrientationMap[1][3][0] = 0 | FLIP_H_BIT;
OrientationMap[0][3][0] = FLIP_H_BIT;
OrientationMap[1][3][0] = FLIP_H_BIT;
OrientationMap[2][3][0] = 3;
OrientationMap[3][3][0] = 3;
OrientationMap[4][3][0] = 3;
@ -177,34 +179,34 @@ public class BaseBlockRender
OrientationMap[0][0][5] = 1 | FLIP_H_BIT;
OrientationMap[1][0][5] = 1;
OrientationMap[2][0][5] = 0;
OrientationMap[3][0][5] = 0 | FLIP_V_BIT;
OrientationMap[3][0][5] = FLIP_V_BIT;
OrientationMap[4][0][5] = 1;
OrientationMap[5][0][5] = 1 | FLIP_V_BIT;
// side 2
OrientationMap[0][1][2] = 0 | FLIP_H_BIT;
OrientationMap[0][1][2] = FLIP_H_BIT;
OrientationMap[1][1][2] = 0;
OrientationMap[2][1][2] = 2 | FLIP_H_BIT;
OrientationMap[3][1][2] = 1;
OrientationMap[4][1][2] = 3;
OrientationMap[5][1][2] = 3 | FLIP_H_BIT;
OrientationMap[0][4][2] = 0 | FLIP_H_BIT;
OrientationMap[1][4][2] = 0 | FLIP_H_BIT;
OrientationMap[0][4][2] = FLIP_H_BIT;
OrientationMap[1][4][2] = FLIP_H_BIT;
OrientationMap[2][4][2] = 2 | FLIP_H_BIT;
OrientationMap[3][4][2] = 1;
OrientationMap[4][4][2] = 1 | FLIP_H_BIT;
OrientationMap[5][4][2] = 2;
OrientationMap[0][0][2] = 0 | FLIP_V_BIT;
OrientationMap[0][0][2] = FLIP_V_BIT;
OrientationMap[1][0][2] = 0;
OrientationMap[2][0][2] = 2;
OrientationMap[3][0][2] = 1 | FLIP_H_BIT;
OrientationMap[4][0][2] = 3 | FLIP_H_BIT;
OrientationMap[5][0][2] = 0;
OrientationMap[0][5][2] = 0 | FLIP_H_BIT;
OrientationMap[1][5][2] = 0 | FLIP_H_BIT;
OrientationMap[0][5][2] = FLIP_H_BIT;
OrientationMap[1][5][2] = FLIP_H_BIT;
OrientationMap[2][5][2] = 2;
OrientationMap[3][5][2] = 1 | FLIP_H_BIT;
OrientationMap[4][5][2] = 2;
@ -216,7 +218,7 @@ public class BaseBlockRender
OrientationMap[2][0][3] = 1;
OrientationMap[3][0][3] = 2 | FLIP_H_BIT;
OrientationMap[4][0][3] = 0;
OrientationMap[5][0][3] = 0 | FLIP_H_BIT;
OrientationMap[5][0][3] = FLIP_H_BIT;
OrientationMap[0][4][3] = 3;
OrientationMap[1][4][3] = 3;
@ -250,7 +252,7 @@ public class BaseBlockRender
OrientationMap[0][0][4] = 1 | FLIP_H_BIT;
OrientationMap[1][0][4] = 2;
OrientationMap[2][0][4] = 0;
OrientationMap[3][0][4] = 0 | FLIP_H_BIT;
OrientationMap[3][0][4] = FLIP_H_BIT;
OrientationMap[4][0][4] = 2 | FLIP_H_BIT;
OrientationMap[5][0][4] = 1;

View file

@ -18,6 +18,10 @@
package appeng.client.render.blocks;
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.renderer.GLAllocation;
@ -27,9 +31,6 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import appeng.api.storage.data.IAEItemStack;
import appeng.block.AEBaseBlock;
import appeng.client.ClientHelper;
@ -176,11 +177,11 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
String msg = Long.toString( qty );
if ( qty > 1000000000 )
msg = Long.toString( qty / 1000000000 ) + "B";
msg = Long.toString( qty / 1000000000 ) + 'B';
else if ( qty > 1000000 )
msg = Long.toString( qty / 1000000 ) + "M";
msg = Long.toString( qty / 1000000 ) + 'M';
else if ( qty > 9999 )
msg = Long.toString( qty / 1000 ) + "K";
msg = Long.toString( qty / 1000 ) + 'K';
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( msg );

View file

@ -18,14 +18,15 @@
package appeng.client.render.items;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import appeng.api.util.AEColor;
import appeng.client.texture.ExtraItemTextures;
import appeng.items.misc.ItemPaintBall;
@ -69,7 +70,7 @@ public class PaintBallRender implements IItemRenderer
int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
int r = (colorValue >> 16) & 0xff;
int g = (colorValue >> 8) & 0xff;
int b = (colorValue >> 0) & 0xff;
int b = ( colorValue ) & 0xff;
int full = (int) (255 * 0.3);
float fail = 0.7f;

View file

@ -18,8 +18,10 @@
package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.config.FuzzyMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
@ -85,7 +87,7 @@ public class ContainerFormationPlane extends ContainerUpgradeable
}
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8 + 0, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );

View file

@ -18,8 +18,10 @@
package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.config.FullnessMode;
import appeng.api.config.OperationMode;
import appeng.api.config.RedstoneMode;
@ -83,7 +85,7 @@ public class ContainerIOPort extends ContainerUpgradeable
addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8 + 0, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
}

View file

@ -18,6 +18,7 @@
package appeng.container.implementations;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@ -29,6 +30,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.api.networking.IGrid;
@ -362,7 +364,7 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
private void addItems(NBTTagCompound data, InvTracker inv, int offset, int length)
{
String name = "=" + Long.toString( inv.which, Character.MAX_RADIX );
String name = '=' + Long.toString( inv.which, Character.MAX_RADIX );
NBTTagCompound tag = data.getCompoundTag( name );
if ( tag.hasNoTags() )

View file

@ -18,10 +18,15 @@
package appeng.container.implementations;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.config.FuzzyMode;
import appeng.api.config.LevelType;
import appeng.api.config.RedstoneMode;
@ -33,8 +38,6 @@ import appeng.container.slot.SlotFakeTypeOnly;
import appeng.container.slot.SlotRestrictedInput;
import appeng.parts.automation.PartLevelEmitter;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ContainerLevelEmitter extends ContainerUpgradeable
{
@ -48,7 +51,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
public void setTextField(GuiTextField level)
{
textField = level;
textField.setText( "" + EmitterValue );
textField.setText( String.valueOf( EmitterValue ) );
}
public ContainerLevelEmitter(InventoryPlayer ip, PartLevelEmitter te) {
@ -83,7 +86,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
if ( availableUpgrades() > 0 )
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8 + 0, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
if ( availableUpgrades() > 1 )
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
if ( availableUpgrades() > 2 )
@ -127,7 +130,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
if ( field.equals( "EmitterValue" ) )
{
if ( textField != null )
textField.setText( "" + EmitterValue );
textField.setText( String.valueOf( EmitterValue ) );
}
}

View file

@ -18,10 +18,12 @@
package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
@ -113,7 +115,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
offY = 17;
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8 + 0, invPlayer ))
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer ))
.setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer ))
.setNotDraggable() );

View file

@ -18,18 +18,21 @@
package appeng.container.implementations;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.config.SecurityPermissions;
import appeng.api.parts.IPart;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.helpers.IPriorityHost;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ContainerPriority extends AEBaseContainer
{
@ -43,7 +46,7 @@ public class ContainerPriority extends AEBaseContainer
public void setTextField(GuiTextField level)
{
textField = level;
textField.setText( "" + PriorityValue );
textField.setText( String.valueOf( PriorityValue ) );
}
public ContainerPriority(InventoryPlayer ip, IPriorityHost te) {
@ -78,7 +81,7 @@ public class ContainerPriority extends AEBaseContainer
if ( field.equals( "PriorityValue" ) )
{
if ( textField != null )
textField.setText( "" + PriorityValue );
textField.setText( String.valueOf( PriorityValue ) );
}
super.onUpdate( field, oldValue, newValue );

View file

@ -18,11 +18,13 @@
package appeng.container.implementations;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
import appeng.api.features.INetworkEncodable;
@ -145,7 +147,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
if ( networkEncodable != null )
{
networkEncodable.setEncryptionKey( term, "" + securityBox.securityKey, "" );
networkEncodable.setEncryptionKey( term, String.valueOf( securityBox.securityKey ), "" );
wirelessIn.putStack( null );
wirelessOut.putStack( term );

View file

@ -18,11 +18,13 @@
package appeng.container.implementations;
import java.util.Iterator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.FuzzyMode;
@ -102,7 +104,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
}
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8 + 0, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );

View file

@ -18,11 +18,13 @@
package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import appeng.api.config.FuzzyMode;
import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions;
@ -107,7 +109,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
{
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
if ( availableUpgrades() > 0 )
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8 + 0, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
if ( availableUpgrades() > 1 )
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
if ( availableUpgrades() > 2 )

View file

@ -18,6 +18,7 @@
package appeng.core;
import java.io.File;
import java.util.Arrays;
import java.util.EnumSet;
@ -25,6 +26,12 @@ import java.util.List;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import appeng.api.config.CondenserOutput;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.PowerUnits;
@ -40,10 +47,6 @@ import appeng.items.materials.MaterialType;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
{
@ -156,7 +159,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
{
if ( eventArgs.modID.equals( AppEng.modid ) )
if ( eventArgs.modID.equals( AppEng.MOD_ID ) )
{
clientSync();
}

View file

@ -50,24 +50,26 @@ import appeng.services.VersionChecker;
import appeng.util.Platform;
@Mod( modid = AppEng.modid, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.name, version = AEConfig.VERSION, dependencies = AppEng.dependencies, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
public class AppEng
{
public final static String modid = "appliedenergistics2";
public final static String name = "Applied Energistics 2";
public final static String dependencies =
public final static String MOD_ID = "appliedenergistics2";
public final static String MOD_NAME = "Applied Energistics 2";
public final static String MOD_DEPENDENCIES =
// a few mods, AE should load after, probably.
// required-after:AppliedEnergistics2API|all;
// "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
// depend on version of forge used for build.
"after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge.
+ net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion
+ net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion
public static AppEng instance;
private final IMCHandler imcHandler;
private String configPath;
public AppEng()
@ -81,21 +83,21 @@ public class AppEng
public String getConfigPath()
{
return configPath;
return this.configPath;
}
public boolean isIntegrationEnabled( IntegrationType Name )
public boolean isIntegrationEnabled( IntegrationType integrationName )
{
return IntegrationRegistry.INSTANCE.isEnabled( Name );
return IntegrationRegistry.INSTANCE.isEnabled( integrationName );
}
public Object getIntegration( IntegrationType Name )
public Object getIntegration( IntegrationType integrationName )
{
return IntegrationRegistry.INSTANCE.getInstance( Name );
return IntegrationRegistry.INSTANCE.getInstance( integrationName );
}
@EventHandler
void PreInit( FMLPreInitializationEvent event )
void preInit( FMLPreInitializationEvent event )
{
if ( !Loader.isModLoaded( "appliedenergistics2-core" ) )
{
@ -103,10 +105,10 @@ public class AppEng
}
Stopwatch star = Stopwatch.createStarted();
configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator;
this.configPath = event.getModConfigurationDirectory().getPath() + File.separator + "AppliedEnergistics2" + File.separator;
AEConfig.instance = new AEConfig( configPath );
FacadeConfig.instance = new FacadeConfig( configPath );
AEConfig.instance = new AEConfig( this.configPath );
FacadeConfig.instance = new FacadeConfig( this.configPath );
AELog.info( "Starting ( PreInit )" );
@ -122,7 +124,7 @@ public class AppEng
if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) )
{
AELog.info( "Starting VersionChecker" );
startService( "AE2 VersionChecker", new Thread( new VersionChecker() ) );
this.startService( "AE2 VersionChecker", new Thread( new VersionChecker() ) );
}
AELog.info( "PreInit ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
@ -136,7 +138,7 @@ public class AppEng
}
@EventHandler
void Init( FMLInitializationEvent event )
void init( FMLInitializationEvent event )
{
Stopwatch star = Stopwatch.createStarted();
AELog.info( "Init" );
@ -148,7 +150,7 @@ public class AppEng
}
@EventHandler
void PostInit( FMLPostInitializationEvent event )
void postInit( FMLPostInitializationEvent event )
{
Stopwatch star = Stopwatch.createStarted();
AELog.info( "PostInit" );

View file

@ -28,11 +28,11 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.WeakHashMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
@ -57,14 +57,14 @@ import appeng.services.CompassService;
public class WorldSettings extends Configuration
{
private static final String SPAWNDATA_FOLDER = "spawndata";
private static final String COMPASS_Folder = "compass";
private static final String COMPASS_FOLDER = "compass";
private static WorldSettings instance;
private final List<Integer> storageCellDims = new ArrayList<Integer>();
private final File aeFolder;
private final CompassService compass;
private final PlayerMappings mappings;
private final WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>>();
private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>>();
private long lastGridStorage;
private int lastPlayer;
@ -74,21 +74,21 @@ public class WorldSettings extends Configuration
this.aeFolder = aeFolder;
this.compass = new CompassService( aeFolder );
for ( int dimID : get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
for ( int dimID : this.get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
{
storageCellDims.add( dimID );
this.storageCellDims.add( dimID );
DimensionManager.registerDimension( dimID, AEConfig.instance.storageProviderID );
}
try
{
lastGridStorage = Long.parseLong( get( "Counters", "lastGridStorage", 0 ).getString() );
lastPlayer = get( "Counters", "lastPlayer", 0 ).getInt();
this.lastGridStorage = Long.parseLong( this.get( "Counters", "lastGridStorage", 0 ).getString() );
this.lastPlayer = this.get( "Counters", "lastPlayer", 0 ).getInt();
}
catch ( NumberFormatException err )
{
lastGridStorage = 0;
lastPlayer = 0;
this.lastGridStorage = 0;
this.lastPlayer = 0;
}
final ConfigCategory playerList = this.getCategory( "players" );
@ -108,7 +108,7 @@ public class WorldSettings extends Configuration
throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
}
File compass = new File( aeBaseFolder, COMPASS_Folder );
File compass = new File( aeBaseFolder, COMPASS_FOLDER );
if ( !compass.isDirectory() && !compass.mkdir() )
{
throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() );
@ -128,7 +128,7 @@ public class WorldSettings extends Configuration
public Collection<NBTTagCompound> getNearByMeteorites( int dim, int chunkX, int chunkZ )
{
LinkedList<NBTTagCompound> ll = new LinkedList<NBTTagCompound>();
Collection<NBTTagCompound> ll = new LinkedList<NBTTagCompound>();
synchronized ( WorldSettings.class )
{
@ -139,14 +139,14 @@ public class WorldSettings extends Configuration
int cx = x + ( chunkX >> 4 );
int cz = z + ( chunkZ >> 4 );
NBTTagCompound data = loadSpawnData( dim, cx << 4, cz << 4 );
NBTTagCompound data = this.loadSpawnData( dim, cx << 4, cz << 4 );
if ( data != null )
{
// edit.
int size = data.getInteger( "num" );
for ( int s = 0; s < size; s++ )
ll.add( data.getCompoundTag( "" + s ) );
ll.add( data.getCompoundTag( String.valueOf( s ) ) );
}
}
}
@ -161,7 +161,7 @@ public class WorldSettings extends Configuration
throw new RuntimeException( "Invalid Request" );
NBTTagCompound data = null;
File file = new File( aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + "_" + ( chunkX >> 4 ) + "_" + ( chunkZ >> 4 ) + ".dat" );
File file = new File( this.aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
if ( file.isFile() )
{
@ -204,7 +204,7 @@ public class WorldSettings extends Configuration
{
synchronized ( WorldSettings.class )
{
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ );
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
return data.getBoolean( chunkX + "," + chunkZ );
}
}
@ -213,12 +213,12 @@ public class WorldSettings extends Configuration
{
synchronized ( WorldSettings.class )
{
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ );
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
// edit.
data.setBoolean( chunkX + "," + chunkZ, true );
writeSpawnData( dim, chunkX, chunkZ, data );
this.writeSpawnData( dim, chunkX, chunkZ, data );
}
}
@ -227,7 +227,7 @@ public class WorldSettings extends Configuration
if ( !Thread.holdsLock( WorldSettings.class ) )
throw new RuntimeException( "Invalid Request" );
File file = new File( aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + "_" + ( chunkX >> 4 ) + "_" + ( chunkZ >> 4 ) + ".dat" );
File file = new File( this.aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
FileOutputStream fileOutputStream = null;
try
@ -259,14 +259,14 @@ public class WorldSettings extends Configuration
{
synchronized ( WorldSettings.class )
{
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ );
NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
// edit.
int size = data.getInteger( "num" );
data.setTag( "" + size, newData );
data.setTag( String.valueOf( size ), newData );
data.setInteger( "num", size + 1 );
writeSpawnData( dim, chunkX, chunkZ, data );
this.writeSpawnData( dim, chunkX, chunkZ, data );
return true;
}
@ -274,14 +274,14 @@ public class WorldSettings extends Configuration
public void shutdown()
{
save();
this.save();
for ( Integer dimID : storageCellDims )
for ( Integer dimID : this.storageCellDims )
DimensionManager.unregisterDimension( dimID );
storageCellDims.clear();
this.storageCellDims.clear();
compass.kill();
this.compass.kill();
instance = null;
}
@ -289,47 +289,47 @@ public class WorldSettings extends Configuration
public void save()
{
// populate new data
for ( GridStorageSearch gs : loadedStorage.keySet() )
for ( GridStorageSearch gs : this.loadedStorage.keySet() )
{
GridStorage thisStorage = gs.gridStorage.get();
if ( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
{
String value = thisStorage.getValue();
get( "gridstorage", "" + thisStorage.getID(), value ).set( value );
this.get( "gridstorage", String.valueOf( thisStorage.getID() ), value ).set( value );
}
}
// save to files
if ( hasChanged() )
if ( this.hasChanged() )
super.save();
}
public void addStorageCellDim( int newDim )
{
storageCellDims.add( newDim );
this.storageCellDims.add( newDim );
DimensionManager.registerDimension( newDim, AEConfig.instance.storageProviderID );
NetworkHandler.instance.sendToAll( new PacketNewStorageDimension( newDim ) );
String[] values = new String[storageCellDims.size()];
String[] values = new String[this.storageCellDims.size()];
for ( int x = 0; x < values.length; x++ )
values[x] = "" + storageCellDims.get( x );
values[x] = String.valueOf( this.storageCellDims.get( x ) );
get( "DimensionManager", "StorageCells", new int[0] ).set( values );
save();
this.get( "DimensionManager", "StorageCells", new int[0] ).set( values );
this.save();
}
public CompassService getCompass()
{
return compass;
return this.compass;
}
public void sendToPlayer( NetworkManager manager, EntityPlayerMP player )
public void sendToPlayer( NetworkManager manager )
{
if ( manager != null )
{
for ( int newDim : get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
for ( int newDim : this.get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
{
manager.scheduleOutboundPacket( ( new PacketNewStorageDimension( newDim ) ).getProxy() );
}
@ -343,23 +343,23 @@ public class WorldSettings extends Configuration
public void init()
{
save();
this.save();
}
public WorldCoord getStoredSize( int dim )
{
int x = get( "StorageCell" + dim, "scaleX", 0 ).getInt();
int y = get( "StorageCell" + dim, "scaleY", 0 ).getInt();
int z = get( "StorageCell" + dim, "scaleZ", 0 ).getInt();
int x = this.get( "StorageCell" + dim, "scaleX", 0 ).getInt();
int y = this.get( "StorageCell" + dim, "scaleY", 0 ).getInt();
int z = this.get( "StorageCell" + dim, "scaleZ", 0 ).getInt();
return new WorldCoord( x, y, z );
}
public void setStoredSize( int dim, int targetX, int targetY, int targetZ )
{
get( "StorageCell" + dim, "scaleX", 0 ).set( targetX );
get( "StorageCell" + dim, "scaleY", 0 ).set( targetY );
get( "StorageCell" + dim, "scaleZ", 0 ).set( targetZ );
save();
this.get( "StorageCell" + dim, "scaleX", 0 ).set( targetX );
this.get( "StorageCell" + dim, "scaleY", 0 ).set( targetY );
this.get( "StorageCell" + dim, "scaleZ", 0 ).set( targetZ );
this.save();
}
/**
@ -372,16 +372,18 @@ public class WorldSettings extends Configuration
public GridStorage getGridStorage( long storageID )
{
GridStorageSearch gss = new GridStorageSearch( storageID );
WeakReference<GridStorageSearch> result = loadedStorage.get( gss );
WeakReference<GridStorageSearch> result = this.loadedStorage.get( gss );
if ( result == null || result.get() == null )
{
String Data = get( "gridstorage", "" + storageID, "" ).getString();
String id = String.valueOf( storageID );
String Data = this.get( "gridstorage", id, "" ).getString();
GridStorage thisStorage = new GridStorage( Data, storageID, gss );
gss.gridStorage = new WeakReference<GridStorage>( thisStorage );
loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
return thisStorage;
}
return result.get().gridStorage.get();
}
@ -390,24 +392,25 @@ public class WorldSettings extends Configuration
*/
public GridStorage getNewGridStorage()
{
long storageID = nextGridStorage();
long storageID = this.nextGridStorage();
GridStorageSearch gss = new GridStorageSearch( storageID );
GridStorage newStorage = new GridStorage( storageID, gss );
gss.gridStorage = new WeakReference<GridStorage>( newStorage );
loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
return newStorage;
}
private long nextGridStorage()
{
long r = lastGridStorage++;
get( "Counters", "lastGridStorage", lastGridStorage ).set( Long.toString( lastGridStorage ) );
long r = this.lastGridStorage++;
this.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
return r;
}
public void destroyGridStorage( long id )
{
this.getCategory( "gridstorage" ).remove( "" + id );
String stringID = String.valueOf( id );
this.getCategory( "gridstorage" ).remove( stringID );
}
public int getNextOrderedValue( String name )
@ -432,17 +435,17 @@ public class WorldSettings extends Configuration
return prop.getInt();
else
{
playerList.put( uuid, prop = new Property( uuid, "" + nextPlayer(), Property.Type.INTEGER ) );
playerList.put( uuid, prop = new Property( uuid, String.valueOf( this.nextPlayer() ), Property.Type.INTEGER ) );
this.mappings.put( prop.getInt(), profile.getId() ); // add to reverse map
save();
this.save();
return prop.getInt();
}
}
private long nextPlayer()
{
long r = lastPlayer++;
get( "Counters", "lastPlayer", lastPlayer ).set( lastPlayer );
long r = this.lastPlayer++;
this.get( "Counters", "lastPlayer", this.lastPlayer ).set( this.lastPlayer );
return r;
}

View file

@ -18,16 +18,14 @@
package appeng.core.api;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
@ -38,6 +36,15 @@ import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import com.google.common.base.Joiner;
import appeng.api.parts.CableRenderMode;
import appeng.api.parts.IPartHelper;
import appeng.api.parts.IPartItem;
@ -52,8 +59,6 @@ import appeng.parts.PartPlacement;
import appeng.tile.networking.TileCableBus;
import appeng.util.Platform;
import com.google.common.base.Joiner;
public class ApiPart implements IPartHelper
{
@ -112,7 +117,7 @@ public class ApiPart implements IPartHelper
try
{
ClassReader cr;
String path = "/" + name.replace( ".", "/" ) + ".class";
String path = '/' + name.replace( ".", "/" ) + ".class";
InputStream is = getClass().getResourceAsStream( path );
cr = new ClassReader( is );
ClassNode cn = new ClassNode();
@ -139,7 +144,7 @@ public class ApiPart implements IPartHelper
}
}
String description = base + ":" + Joiner.on( ";" ).skipNulls().join( desc.iterator() );
String description = base + ':' + Joiner.on( ";" ).skipNulls().join( desc.iterator() );
if ( tileImplementations.get( description ) != null )
{
@ -180,7 +185,7 @@ public class ApiPart implements IPartHelper
{
try
{
String newPath = path + ";" + name;
String newPath = path + ';' + name;
myCLass = getClassByDesc( Addendum, newPath, f, interfaces2Layer.get( Class.forName( name ) ) );
path = newPath;
}
@ -232,7 +237,7 @@ public class ApiPart implements IPartHelper
try
{
n.name = n.name + "_" + Addendum;
n.name = n.name + '_' + Addendum;
n.superName = Class.forName( root ).getName().replace( ".", "/" );
}
catch (Throwable t)

View file

@ -31,10 +31,10 @@ public class CrashEnhancement implements ICrashCallable
private final String name;
private final String value;
private final String ModVersion = AEConfig.CHANNEL + " " + AEConfig.VERSION + " for Forge " + // WHAT?
net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion
private final String ModVersion = AEConfig.CHANNEL + ' ' + AEConfig.VERSION + " for Forge " + // WHAT?
net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion;
public CrashEnhancement( CrashInfo Output )

View file

@ -165,7 +165,7 @@ public class AEFeatureHandler implements AEItemDefinition
if ( subName.equals( "NetherQuartzTools" ) )
return name.replace( "Quartz", "NetherQuartz" );
name += "." + subName;
name += '.' + subName;
}
return name;

View file

@ -24,8 +24,8 @@ import com.google.common.base.Optional;
public class FeatureNameExtractor
{
private Class<?> clazz;
private Optional<String> subName;
private final Class<?> clazz;
private final Optional<String> subName;
public FeatureNameExtractor( Class<?> clazz, Optional<String> subName )
{
@ -64,7 +64,7 @@ public class FeatureNameExtractor
return name.replace( "Quartz", "NetherQuartz" );
}
name += "." + subName;
name += '.' + subName;
}
return name;

View file

@ -26,7 +26,7 @@ import appeng.core.AEConfig;
public class FeaturedActiveChecker
{
private EnumSet<AEFeature> features;
private final EnumSet<AEFeature> features;
public FeaturedActiveChecker( EnumSet<AEFeature> features )
{

View file

@ -68,7 +68,7 @@ public enum ButtonToolTips
public String getUnlocalized()
{
return root + "." + toString();
return root + '.' + toString();
}
public String getLocal()

View file

@ -82,7 +82,7 @@ public enum GuiText
public String getUnlocalized()
{
return root + "." + toString();
return root + '.' + toString();
}
public String getLocal()

View file

@ -41,7 +41,7 @@ public enum WailaText
public String getUnlocalized()
{
return root + "." + toString();
return root + '.' + toString();
}
public String getLocal()

View file

@ -18,10 +18,10 @@
package appeng.core.sync.network;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer;
import appeng.core.WorldSettings;
import appeng.core.sync.AppEngPacket;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
@ -31,6 +31,9 @@ import cpw.mods.fml.common.network.FMLNetworkEvent.ServerConnectionFromClientEve
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import appeng.core.WorldSettings;
import appeng.core.sync.AppEngPacket;
public class NetworkHandler
{
@ -78,14 +81,14 @@ public class NetworkHandler
@SubscribeEvent
public void newConnection(ServerConnectionFromClientEvent ev)
{
WorldSettings.getInstance().sendToPlayer( ev.manager, null );
WorldSettings.getInstance().sendToPlayer( ev.manager );
}
@SubscribeEvent
public void newConnection(PlayerLoggedInEvent loginEvent)
{
if ( loginEvent.player instanceof EntityPlayerMP )
WorldSettings.getInstance().sendToPlayer( null, (EntityPlayerMP) loginEvent.player );
WorldSettings.getInstance().sendToPlayer( null );
}
@SubscribeEvent

View file

@ -18,11 +18,13 @@
package appeng.crafting;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@ -79,7 +81,7 @@ public class CraftingTreeNode
// order.
{
if ( parent == null || parent.notRecursive( details ) )
nodes.add( new CraftingTreeProcess( cc, job, details, this, depth + 1, world ) );
nodes.add( new CraftingTreeProcess( cc, job, details, this, depth + 1 ) );
}
}

View file

@ -18,6 +18,7 @@
package appeng.crafting;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@ -26,6 +27,9 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import cpw.mods.fml.common.FMLCommonHandler;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.networking.crafting.ICraftingGrid;
@ -36,7 +40,6 @@ import appeng.api.storage.data.IItemList;
import appeng.container.ContainerNull;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.util.Platform;
import cpw.mods.fml.common.FMLCommonHandler;
public class CraftingTreeProcess
{
@ -57,12 +60,12 @@ public class CraftingTreeProcess
final Map<CraftingTreeNode, Long> nodes = new HashMap<CraftingTreeNode, Long>();
public boolean possible = true;
public CraftingTreeProcess(ICraftingGrid cc, CraftingJob job, ICraftingPatternDetails details, CraftingTreeNode craftingTreeNode, int depth, World world) {
public CraftingTreeProcess( ICraftingGrid cc, CraftingJob job, ICraftingPatternDetails details, CraftingTreeNode craftingTreeNode, int depth ) {
parent = craftingTreeNode;
this.details = details;
this.job = job;
this.depth = depth;
world = job.getWorld();
World world = job.getWorld();
if ( details.isCraftable() )
{

View file

@ -18,6 +18,7 @@
package appeng.helpers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@ -31,6 +32,7 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.data.IAEItemStack;
@ -88,8 +90,19 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
@Override
public boolean equals(Object obj)
{
TestLookup b = (TestLookup) obj;
return b.slot == slot && b.ref == ref;
final boolean equality;
if ( obj instanceof TestLookup )
{
TestLookup b = (TestLookup) obj;
equality = b.slot == slot && b.ref == ref;
}
else
{
equality = false;
}
return equality;
}
}
@ -248,9 +261,6 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
break;
}
if ( !isCrafting )
return false;
for (int x = 0; x < crafting.getSizeInventory(); x++)
testFrame.setInventorySlotContents( x, crafting.getStackInSlot( x ) );
@ -304,7 +314,6 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
@Override
public boolean canSubstitute()
{
// TODO Auto-generated method stub
return false;
}

View file

@ -18,12 +18,14 @@
package appeng.integration;
import java.lang.reflect.Field;
import cpw.mods.fml.common.Loader;
import appeng.api.exceptions.ModNotInstalled;
import appeng.core.AEConfig;
import appeng.core.AELog;
import cpw.mods.fml.common.Loader;
public class IntegrationNode
{
@ -51,7 +53,7 @@ public class IntegrationNode
@Override
public String toString()
{
return shortName.name() + ":" + state.name();
return shortName.name() + ':' + state.name();
}
void Call(IntegrationStage stage)

View file

@ -18,9 +18,9 @@
package appeng.integration.modules;
import java.lang.reflect.Field;
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -28,6 +28,20 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.event.FMLInterModComms;
import buildcraft.BuildCraftEnergy;
import buildcraft.BuildCraftTransport;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.tools.IToolWrench;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile;
import buildcraft.api.transport.IPipeTile.PipeType;
import buildcraft.transport.ItemFacade;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.TileGenericPipe;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import appeng.api.definitions.Blocks;
@ -41,18 +55,8 @@ import appeng.integration.BaseModule;
import appeng.integration.abstraction.IBC;
import appeng.integration.modules.BCHelpers.AECableSchematicTile;
import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
import appeng.integration.modules.BCHelpers.BCPipeHandler;
import buildcraft.BuildCraftEnergy;
import buildcraft.BuildCraftTransport;
import buildcraft.api.blueprints.SchematicRegistry;
import buildcraft.api.tools.IToolWrench;
import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeTile;
import buildcraft.api.transport.IPipeTile.PipeType;
import buildcraft.transport.ItemFacade;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.TileGenericPipe;
import cpw.mods.fml.common.event.FMLInterModComms;
public class BC extends BaseModule implements IBC
{
@ -253,7 +257,7 @@ public class BC extends BaseModule implements IBC
private void initBuilderSupport()
{
SchematicRegistry.declareBlueprintSupport( AppEng.modid );
SchematicRegistry.declareBlueprintSupport( AppEng.MOD_ID );
Blocks blocks = AEApi.instance().blocks();
Block cable = blocks.blockMultiPart.block();

View file

@ -46,7 +46,7 @@ public class CLApi extends BaseModule implements ICLApi
float r = (mv >> 16) & 0xff;
float g = (mv >> 8) & 0xff;
float b = (mv >> 0) & 0xff;
float b = ( mv ) & 0xff;
return coloredlightscore.src.api.CLApi.makeRGBLightValue( r / 255.0f, g / 255.0f, b / 255.0f, light / 15.0f );
}

View file

@ -18,6 +18,7 @@
package appeng.integration.modules;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -29,6 +30,11 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerTooltipHandler;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.implementations.GuiCraftingTerm;
import appeng.client.gui.implementations.GuiPatternTerm;
@ -44,9 +50,6 @@ import appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler;
import appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler;
import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler;
import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder;
import codechicken.nei.api.IStackPositioner;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerTooltipHandler;
public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
{
@ -127,7 +130,7 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
int y = s.yDisplayPosition;
GuiContainerManager.drawItems.renderItemAndEffectIntoGUI( fontRenderer, mc.getTextureManager(), stack, x, y );
GuiContainerManager.drawItems.renderItemOverlayIntoGUI( fontRenderer, mc.getTextureManager(), stack, x, y, "" + stack.stackSize );
GuiContainerManager.drawItems.renderItemOverlayIntoGUI( fontRenderer, mc.getTextureManager(), stack, x, y, String.valueOf( stack.stackSize ) );
}
@Override

View file

@ -18,14 +18,9 @@
package appeng.integration.modules;
import java.util.List;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaFMPAccessor;
import mcp.mobius.waila.api.IWailaFMPProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -33,6 +28,16 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import cpw.mods.fml.common.event.FMLInterModComms;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaFMPAccessor;
import mcp.mobius.waila.api.IWailaFMPProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import appeng.api.implementations.IPowerChannelState;
import appeng.api.implementations.parts.IPartStorageMonitor;
import appeng.api.parts.IPartHost;
@ -52,7 +57,6 @@ import appeng.tile.misc.TileCharger;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileEnergyCell;
import appeng.util.Platform;
import cpw.mods.fml.common.event.FMLInterModComms;
public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPProvider
{
@ -156,7 +160,7 @@ public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPPr
if ( ic != null && ic.hasKey( "usedChannels" ) )
{
int channels = ic.getByte( "usedChannels" );
currentToolTip.add( channels + " " + GuiText.Of.getLocal() + " " + (ThingOfInterest instanceof PartDenseCable ? 32 : 8) + " "
currentToolTip.add( channels + " " + GuiText.Of.getLocal() + ' ' + (ThingOfInterest instanceof PartDenseCable ? 32 : 8) + ' '
+ WailaText.Channels.getLocal() );
}
}

View file

@ -18,6 +18,7 @@
package appeng.items.materials;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -45,6 +46,9 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import com.google.common.collect.ImmutableSet;
import appeng.api.config.Upgrades;
import appeng.api.implementations.IUpgradeableHost;
import appeng.api.implementations.items.IItemGroup;
@ -62,8 +66,6 @@ import appeng.items.AEBaseItem;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import com.google.common.collect.ImmutableSet;
public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent, IUpgradeModule
{
@ -139,11 +141,11 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
IItemGroup ig = (IItemGroup) j.getKey().getItem();
String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
if ( str != null )
name = Platform.gui_localize( str ) + (limit > 1 ? " (" + limit + ")" : "");
name = Platform.gui_localize( str ) + (limit > 1 ? " (" + limit + ')' : "");
}
if ( name == null )
name = j.getKey().getDisplayName() + (limit > 1 ? " (" + limit + ")" : "");
name = j.getKey().getDisplayName() + (limit > 1 ? " (" + limit + ')' : "");
if ( !textList.contains( name ) )
textList.add( name );

View file

@ -18,6 +18,7 @@
package appeng.items.misc;
import java.util.EnumSet;
import java.util.List;
import java.util.WeakHashMap;
@ -28,6 +29,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import appeng.api.AEApi;
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.networking.crafting.ICraftingPatternDetails;
@ -103,7 +105,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
IAEItemStack[] out = details.getCondensedOutputs();
String label = (isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal()) + ": ";
String and = " " + GuiText.And.getLocal() + " ";
String and = ' ' + GuiText.And.getLocal() + ' ';
String with = GuiText.With.getLocal() + ": ";
boolean first = true;
@ -114,7 +116,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
continue;
}
lines.add( (first ? label : and) + anOut.getStackSize() + " " + Platform.getItemDisplayName( anOut ) );
lines.add( (first ? label : and) + anOut.getStackSize() + ' ' + Platform.getItemDisplayName( anOut ) );
first = false;
}
@ -126,7 +128,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
continue;
}
lines.add( (first ? with : and) + anIn.getStackSize() + " " + Platform.getItemDisplayName( anIn ) );
lines.add( (first ? with : and) + anIn.getStackSize() + ' ' + Platform.getItemDisplayName( anIn ) );
first = false;
}
}

View file

@ -18,6 +18,7 @@
package appeng.items.misc;
import java.util.EnumSet;
import java.util.List;
@ -25,6 +26,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import appeng.api.util.AEColor;
import appeng.client.render.items.PaintBallRender;
import appeng.core.features.AEFeature;
@ -51,7 +53,7 @@ public class ItemPaintBall extends AEBaseItem
public String getExtraName(ItemStack is)
{
return (is.getItemDamage() >= 20 ? GuiText.Lumen.getLocal() + " " : "") + getColor( is );
return (is.getItemDamage() >= 20 ? GuiText.Lumen.getLocal() + ' ' : "") + getColor( is );
}
public AEColor getColor(ItemStack is)

View file

@ -23,8 +23,6 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import com.google.common.base.Optional;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
@ -32,6 +30,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.config.IncludeExclude;
@ -106,12 +106,12 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
if ( cellInventory != null )
{
lines.add( cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + " "
+ cellInventory.getTotalBytes() + " "
lines.add( cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + ' '
+ cellInventory.getTotalBytes() + ' '
+ GuiText.BytesUsed.getLocal() );
lines.add( cellInventory.getStoredItemTypes() + " " + GuiText.Of.getLocal()
+ " " + cellInventory.getTotalItemTypes() + " "
+ ' ' + cellInventory.getTotalItemTypes() + ' '
+ GuiText.Types.getLocal() );
if ( handler.isPreformatted() )
@ -120,9 +120,9 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
: GuiText.Excluded ).getLocal();
if ( handler.isFuzzy() )
lines.add( GuiText.Partitioned.getLocal() + " - " + List + " " + GuiText.Fuzzy.getLocal() );
lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Fuzzy.getLocal() );
else
lines.add( GuiText.Partitioned.getLocal() + " - " + List + " " + GuiText.Precise.getLocal() );
lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Precise.getLocal() );
}
}

View file

@ -18,6 +18,7 @@
package appeng.items.tools;
import java.util.EnumSet;
import java.util.List;
@ -26,6 +27,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.core.features.AEFeature;
@ -93,7 +95,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
NBTTagCompound c = Platform.openNbtData( is );
String name = c.getString( "Config" );
return name == null || name.equals( "" ) ? GuiText.Blank.getUnlocalized() : name;
return name == null || name.isEmpty() ? GuiText.Blank.getUnlocalized() : name;
}
@Override

View file

@ -28,8 +28,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.player.EntityPlayer;
@ -44,6 +42,8 @@ import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@ -403,8 +403,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() );
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
}
}
}

View file

@ -22,8 +22,6 @@ package appeng.items.tools.powered;
import java.util.EnumSet;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.Entity;
@ -43,6 +41,8 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@ -107,8 +107,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() );
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
}
}
}

View file

@ -23,15 +23,17 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import com.google.common.base.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.guiobjects.IGuiItem;
@ -90,8 +92,8 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() );
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
}
}
}

View file

@ -22,15 +22,17 @@ package appeng.items.tools.powered;
import java.util.EnumSet;
import java.util.List;
import com.google.common.base.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
@ -83,7 +85,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
{
String encKey = tag.getString( "encryptionKey" );
if ( encKey == null || encKey.equals( "" ) )
if ( encKey == null || encKey.isEmpty() )
lines.add( GuiText.Unlinked.getLocal() );
else
lines.add( GuiText.Linked.getLocal() );

View file

@ -22,14 +22,14 @@ package appeng.items.tools.powered.powersink;
import java.text.MessageFormat;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import com.google.common.base.Optional;
import appeng.api.config.AccessRestriction;
import appeng.api.config.PowerUnits;
import appeng.api.implementations.items.IAEItemPowerStorage;
@ -66,7 +66,7 @@ public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
double percent = internalCurrentPower / internalMaxPower;
lines.add( GuiText.StoredEnergy.getLocal() + ":" + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
+ Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
}

View file

@ -18,7 +18,12 @@
package appeng.me.cluster.implementations;
import java.util.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.inventory.InventoryCrafting;
@ -27,6 +32,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import cpw.mods.fml.common.FMLCommonHandler;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@ -68,11 +79,6 @@ import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import cpw.mods.fml.common.FMLCommonHandler;
public class CraftingCPUCluster implements IAECluster, ICraftingCPU
{
@ -864,7 +870,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
int hash = System.identityHashCode( this );
int hmm = finalOutput == null ? 0 : finalOutput.hashCode();
return Long.toString( now, Character.MAX_RADIX ) + "-" + Integer.toString( hash, Character.MAX_RADIX ) + "-"
return Long.toString( now, Character.MAX_RADIX ) + '-' + Integer.toString( hash, Character.MAX_RADIX ) + '-'
+ Integer.toString( hmm, Character.MAX_RADIX );
}
@ -1102,7 +1108,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
if ( te.hasCustomName() )
{
if ( myName.length() > 0 )
myName += " " + te.getCustomName();
myName += ' ' + te.getCustomName();
else
myName = te.getCustomName();
}

View file

@ -20,6 +20,7 @@ package appeng.parts.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.renderer.RenderBlocks;
@ -485,7 +486,7 @@ public class PartStorageBus
{
IMEInventoryHandler out = proxy.isActive() ? getInternalHandler() : null;
if ( out != null )
return Arrays.asList( out );
return Collections.singletonList( out );
}
return Arrays.asList( new IMEInventoryHandler[] {} );
}

View file

@ -18,7 +18,7 @@
package appeng.parts.p2p;
import appeng.integration.abstraction.helpers.BaseMJPerdition;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -26,6 +26,18 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.ISidedBatteryProvider;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.power.PowerHandler.Type;
import appeng.api.config.PowerUnits;
import appeng.api.config.TunnelType;
import appeng.api.networking.IGridNode;
@ -37,20 +49,12 @@ import appeng.core.settings.TickRates;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IMJ5;
import appeng.integration.abstraction.IMJ6;
import appeng.integration.abstraction.helpers.BaseMJPerdition;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.InterfaceList;
import appeng.transformer.annotations.integration.Method;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.ISidedBatteryProvider;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.power.PowerHandler.Type;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@InterfaceList(value = { @Interface(iface = "buildcraft.api.mj.ISidedBatteryProvider", iname = "MJ6"),
@Interface(iface = "buildcraft.api.mj.IBatteryObject", iname = "MJ6"), @Interface(iface = "buildcraft.api.power.IPowerReceptor", iname = "MJ5"),
@ -223,9 +227,7 @@ public class PartP2PBCPower extends PartP2PTunnel<PartP2PBCPower> implements IPo
@Method(iname = "MJ5")
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
if ( side.equals( side ) )
return pp.getPowerReceiver();
return null;
return pp.getPowerReceiver();
}
@Override

View file

@ -18,7 +18,8 @@
package appeng.parts.reporting;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
@ -26,6 +27,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.PlayerSource;
import appeng.api.storage.IMEMonitor;
@ -133,7 +135,7 @@ public class PartConversionMonitor extends PartStorageMonitor
if ( newItems != null )
{
TileEntity te = tile;
List<ItemStack> list = Arrays.asList( newItems );
List<ItemStack> list = Collections.singletonList( newItems );
Platform.spawnDrops( player.worldObj, te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ, list );
}

View file

@ -18,10 +18,14 @@
package appeng.parts.reporting;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GLAllocation;
@ -36,8 +40,8 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.implementations.parts.IPartStorageMonitor;
import appeng.api.networking.security.BaseActionSource;
@ -56,8 +60,6 @@ import appeng.core.localization.PlayerMessages;
import appeng.me.GridAccessException;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PartStorageMonitor extends PartMonitor implements IPartStorageMonitor, IStackWatcherHost
{
@ -304,11 +306,11 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
String msg = Long.toString( qty );
if ( qty > 1000000000 )
msg = Long.toString( qty / 1000000000 ) + "B";
msg = Long.toString( qty / 1000000000 ) + 'B';
else if ( qty > 1000000 )
msg = Long.toString( qty / 1000000 ) + "M";
msg = Long.toString( qty / 1000000 ) + 'M';
else if ( qty > 9999 )
msg = Long.toString( qty / 1000 ) + "K";
msg = Long.toString( qty / 1000 ) + 'K';
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( msg );

View file

@ -18,7 +18,9 @@
package appeng.recipes;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.recipes.ISubItemResolver;
import appeng.api.recipes.ResolverResult;
@ -39,7 +41,7 @@ public class AEItemResolver implements ISubItemResolver
public Object resolveItemByName(String nameSpace, String itemName)
{
if ( nameSpace.equals( AppEng.modid ) )
if ( nameSpace.equals( AppEng.MOD_ID ) )
{
if ( itemName.startsWith( "PaintBall." ) )
{

View file

@ -18,6 +18,7 @@
package appeng.recipes;
import java.util.List;
import net.minecraft.block.Block;
@ -25,6 +26,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
@ -32,7 +36,6 @@ import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.IIngredient;
import appeng.api.recipes.ResolverResult;
import appeng.api.recipes.ResolverResultSet;
import cpw.mods.fml.common.registry.GameRegistry;
public class Ingredient implements IIngredient
{
@ -183,7 +186,7 @@ public class Ingredient implements IIngredient
@Override
public String toString()
{
return nameSpace + ":" + itemName + ":" + meta;
return nameSpace + ':' + itemName + ':' + meta;
}
@Override

View file

@ -18,6 +18,7 @@
package appeng.recipes;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@ -29,8 +30,14 @@ import java.util.Map.Entry;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import appeng.recipes.handlers.IWebsiteSerializer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.LoaderState;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
import com.google.common.collect.HashMultimap;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
@ -47,14 +54,9 @@ import appeng.core.features.AEFeature;
import appeng.items.materials.ItemMultiMaterial;
import appeng.items.misc.ItemCrystalSeed;
import appeng.items.parts.ItemMultiPart;
import appeng.recipes.handlers.IWebsiteSerializer;
import appeng.recipes.handlers.OreRegistration;
import com.google.common.collect.HashMultimap;
import cpw.mods.fml.common.LoaderState;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
public class RecipeHandler implements IRecipeHandler
{
@ -203,7 +205,7 @@ public class RecipeHandler implements IRecipeHandler
String rew = ws.getPattern( this );
if ( rew != null && rew.length() > 0 )
{
out.putNextEntry( new ZipEntry( realName + "_" + offset + ".txt" ) );
out.putNextEntry( new ZipEntry( realName + '_' + offset + ".txt" ) );
offset++;
out.write( rew.getBytes() );
}
@ -245,15 +247,15 @@ public class RecipeHandler implements IRecipeHandler
// :P
}
return i.getNameSpace() + ":" + i.getItemName();
return i.getNameSpace() + ':' + i.getItemName();
}
public String getName(ItemStack is) throws RecipeError
{
UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor( is.getItem() );
String realName = id.modId + ":" + id.name;
String realName = id.modId + ':' + id.name;
if ( !id.modId.equals( AppEng.modid ) && !id.modId.equals( "minecraft" ) )
if ( !id.modId.equals( AppEng.MOD_ID ) && !id.modId.equals( "minecraft" ) )
throw new RecipeError( "Not applicable for website" );
if ( is.getItem() == AEApi.instance().items().itemCrystalSeed.item() )
@ -321,12 +323,12 @@ public class RecipeHandler implements IRecipeHandler
else if ( is.getItem() instanceof ItemMultiMaterial )
{
realName = realName.replace( "ItemMultiMaterial", "ItemMaterial" );
realName += "." + ((ItemMultiMaterial) is.getItem()).getTypeByStack( is ).name();
realName += '.' + ((ItemMultiMaterial) is.getItem()).getTypeByStack( is ).name();
}
else if ( is.getItem() instanceof ItemMultiPart )
{
realName = realName.replace( "ItemMultiPart", "ItemPart" );
realName += "." + ((ItemMultiPart) is.getItem()).getTypeByStack( is ).name();
realName += '.' + ((ItemMultiPart) is.getItem()).getTypeByStack( is ).name();
}
else if ( is.getItemDamage() > 0 )
realName += "." + is.getItemDamage();

View file

@ -18,9 +18,11 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
@ -67,7 +69,7 @@ public class Grind implements ICraftHandler, IWebsiteSerializer
@Override
public String getPattern( RecipeHandler h ) {
return "grind\n"+
h.getName(pro_input)+"\n"+
h.getName(pro_input)+ '\n' +
h.getName(pro_output[0]);
}

View file

@ -18,12 +18,14 @@
package appeng.recipes.handlers;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
@ -117,17 +119,17 @@ public class Inscribe implements ICraftHandler, IWebsiteSerializer
@Override
public String getPattern(RecipeHandler h)
{
String o = "inscriber " + output.getQty() + "\n";
String o = "inscriber " + output.getQty() + '\n';
o += h.getName( output ) + "\n";
o += h.getName( output ) + '\n';
if ( plateA != null )
o += h.getName( plateA )+"\n";
o += h.getName( plateA )+ '\n';
o += h.getName(imprintable);
if ( plateB != null )
o += "\n"+h.getName( plateB );
o += '\n' +h.getName( plateB );
return o;
}

View file

@ -18,10 +18,14 @@
package appeng.recipes.handlers;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
@ -31,7 +35,6 @@ import appeng.core.AELog;
import appeng.recipes.RecipeHandler;
import appeng.recipes.game.ShapedRecipe;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class Shaped implements ICraftHandler, IWebsiteSerializer
{
@ -86,7 +89,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
for (int x = 0; x < cols; x++)
{
if ( inputs.get( y ).get( x ).isAir() )
row.append( " " );
row.append( ' ' );
else
{
row.append( first );
@ -136,9 +139,9 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
@Override
public String getPattern(RecipeHandler h)
{
String o = "shaped " + output.getQty() + " " + cols + "x" + rows + "\n";
String o = "shaped " + output.getQty() + ' ' + cols + 'x' + rows + '\n';
o += h.getName( output ) + "\n";
o += h.getName( output ) + '\n';
for (int y = 0; y < rows; y++)
for (int x = 0; x < cols; x++)

View file

@ -18,10 +18,14 @@
package appeng.recipes.handlers;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
@ -31,7 +35,6 @@ import appeng.core.AELog;
import appeng.recipes.RecipeHandler;
import appeng.recipes.game.ShapelessRecipe;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class Shapeless implements ICraftHandler, IWebsiteSerializer
{
@ -100,9 +103,9 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
@Override
public String getPattern(RecipeHandler h)
{
StringBuilder o = new StringBuilder( "shapeless " + output.getQty() + "\n" );
StringBuilder o = new StringBuilder( "shapeless " + output.getQty() + '\n' );
o.append( h.getName( output ) ).append( "\n" );
o.append( h.getName( output ) ).append( '\n' );
for (int y = 0; y < inputs.size(); y++)
{
@ -119,11 +122,11 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
if ( y + 1 == this.inputs.size() )
{
o.append( "\n" );
o.append( '\n' );
}
else
{
o.append( " " );
o.append( ' ' );
}
}

View file

@ -18,9 +18,13 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError;
@ -28,7 +32,6 @@ import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class Smelt implements ICraftHandler, IWebsiteSerializer
{
@ -72,8 +75,8 @@ public class Smelt implements ICraftHandler, IWebsiteSerializer
@Override
public String getPattern( RecipeHandler h ) {
return "smelt "+out.getQty()+"\n"+
h.getName(out)+"\n"+
return "smelt "+out.getQty()+ '\n' +
h.getName(out)+ '\n' +
h.getName(in);
}
}

View file

@ -18,16 +18,19 @@
package appeng.server.subcommands;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ChunkEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.AEFeature;
import appeng.server.ISubCommand;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ChunkLogger implements ISubCommand
{
@ -52,7 +55,7 @@ public class ChunkLogger implements ISubCommand
for (StackTraceElement e : Thread.currentThread().getStackTrace())
{
if ( output )
AELog.info( " " + e.getClassName() + "." + e.getMethodName() + " (" + e.getLineNumber() + ")" );
AELog.info( " " + e.getClassName() + '.' + e.getMethodName() + " (" + e.getLineNumber() + ')' );
else
{
output = e.getClassName().contains( "EventBus" ) && e.getMethodName().contains( "post" );

View file

@ -18,6 +18,7 @@
package appeng.services;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
@ -25,16 +26,17 @@ import java.net.URLConnection;
import java.util.Date;
import net.minecraft.nbt.NBTTagCompound;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.AppEng;
import cpw.mods.fml.common.event.FMLInterModComms;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import cpw.mods.fml.common.event.FMLInterModComms;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.AppEng;
public class VersionChecker implements Runnable
{
@ -73,7 +75,7 @@ public class VersionChecker implements Runnable
+ AEConfig.VERSION );
URLConnection yc = url.openConnection();
yc.setRequestProperty( "User-Agent", "AE2/" + AEConfig.VERSION + " (Channel:" + AEConfig.CHANNEL + "," + MCVersion.replace( " ", ":" ) + ")" );
yc.setRequestProperty( "User-Agent", "AE2/" + AEConfig.VERSION + " (Channel:" + AEConfig.CHANNEL + ',' + MCVersion.replace( " ", ":" ) + ')' );
BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream() ) );
StringBuilder Version = new StringBuilder();

View file

@ -185,6 +185,6 @@ public class CompassRegion
AELog.info( "Failed to create AE2/compass/" );
}
return new File( folder + File.separatorChar + world + "_" + low_x + "_" + low_z + ".dat" );
return new File( folder + File.separatorChar + world + '_' + low_x + '_' + low_z + ".dat" );
}
}

View file

@ -18,7 +18,7 @@
package appeng.tile.crafting;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Iterator;
@ -28,6 +28,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.implementations.IPowerChannelState;
@ -295,7 +296,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
WorldCoord wc = places.poll();
places.add( wc );
Platform.spawnDrops( worldObj, wc.x, wc.y, wc.z, Arrays.asList( g.getItemStack() ) );
Platform.spawnDrops( worldObj, wc.x, wc.y, wc.z, Collections.singletonList( g.getItemStack() ) );
}
}

View file

@ -18,16 +18,18 @@
package appeng.tile.grindstone;
import io.netty.buffer.ByteBuf;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.implementations.tiles.ICrankable;
import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile;
@ -139,8 +141,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
double xOff = -0.15 * getUp().offsetX;
double yOff = -0.15 * getUp().offsetY;
double zOff = -0.15 * getUp().offsetZ;
return Arrays
.asList( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
return Collections.singletonList( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
}
@Override

View file

@ -18,13 +18,13 @@
package appeng.tile.misc;
import appeng.helpers.PlayerSecurityWrapper;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@ -34,6 +34,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
@ -62,6 +63,7 @@ import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.helpers.PlayerSecurityWrapper;
import appeng.me.GridAccessException;
import appeng.me.storage.SecurityInventory;
import appeng.tile.TileEvent;
@ -174,7 +176,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
{
NBTTagCompound it = new NBTTagCompound();
ais.getItemStack().writeToNBT( it );
storedItems.setTag( "" + (offset++), it );
storedItems.setTag( String.valueOf( offset++ ), it );
}
data.setTag( "storedItems", storedItems );

View file

@ -18,16 +18,13 @@
package appeng.tile.storage;
import appeng.api.config.*;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.*;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@ -38,10 +35,21 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.implementations.tiles.IMEChest;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.events.MENetworkChannelsChanged;
@ -49,6 +57,11 @@ import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.events.MENetworkPowerStorage;
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.ISecurityGrid;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.security.PlayerSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.ICellHandler;
@ -593,7 +606,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
return Arrays.asList( getHandler( channel ) );
return Collections.singletonList( getHandler( channel ) );
}
catch (ChestNoHandler e)
{

View file

@ -18,6 +18,7 @@
package appeng.util;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.DecimalFormat;
@ -31,7 +32,6 @@ import java.util.Random;
import java.util.Set;
import java.util.WeakHashMap;
import appeng.util.item.OreReference;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
@ -76,6 +76,16 @@ import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.api.tools.IToolWrench;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@ -125,14 +135,8 @@ import appeng.me.helpers.AENetworkProxy;
import appeng.util.item.AEItemStack;
import appeng.util.item.AESharedNBT;
import appeng.util.item.OreHelper;
import appeng.util.item.OreReference;
import appeng.util.prioitylist.IPartitionList;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Platform
{
@ -194,7 +198,7 @@ public class Platform
}
DecimalFormat df = new DecimalFormat( "#.##" );
return df.format( p ) + " " + Lvl + unitName + (isRate ? "/t" : "");
return df.format( p ) + ' ' + Lvl + unitName + (isRate ? "/t" : "");
}
public static ForgeDirection crossProduct(ForgeDirection forward, ForgeDirection up)
@ -849,7 +853,7 @@ public class Platform
try
{
String name = itemStack.getDisplayName();
if ( name == null || name.equals( "" ) )
if ( name == null || name.isEmpty() )
name = itemStack.getItem().getUnlocalizedName( itemStack );
return name == null ? "** Null" : name;
}