Merge pull request #532 from thatsIch/e-nexttry

Refactoring, Type-safety, Minor performance improvements
This commit is contained in:
thatsIch
2014-12-02 23:00:44 +01:00
87 changed files with 899 additions and 730 deletions
@@ -18,15 +18,18 @@
package appeng.block; package appeng.block;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.List; import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.PowerUnits; import appeng.api.config.PowerUnits;
@@ -56,7 +59,7 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
double percent = internalCurrentPower / internalMaxPower; 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 ) ); + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
} }
@@ -18,7 +18,8 @@
package appeng.block.misc; package appeng.block.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -30,6 +31,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
@@ -42,8 +47,6 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileCharger; import appeng.tile.misc.TileCharger;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCharger extends AEBaseBlock implements ICustomCollision public class BlockCharger extends AEBaseBlock implements ICustomCollision
{ {
@@ -165,9 +168,9 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
break; 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 @Override
@@ -18,7 +18,8 @@
package appeng.block.misc; package appeng.block.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -31,6 +32,10 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; 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.IOrientable;
import appeng.api.util.IOrientableBlock; import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
@@ -42,8 +47,6 @@ import appeng.core.CommonHelper;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation; import appeng.helpers.MetaRotation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, ICustomCollision 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 xOff = -0.3 * up.offsetX;
double yOff = -0.3 * up.offsetY; double yOff = -0.3 * up.offsetY;
double zOff = -0.3 * up.offsetZ; 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 @Override
@@ -18,7 +18,8 @@
package appeng.block.misc; package appeng.block.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@@ -31,14 +32,16 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderBlockSkyCompass; import appeng.client.render.blocks.RenderBlockSkyCompass;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.tile.misc.TileSkyCompass; import appeng.tile.misc.TileSkyCompass;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
{ {
@@ -160,9 +163,9 @@ public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
break; 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 @Override
@@ -18,7 +18,8 @@
package appeng.block.misc; package appeng.block.misc;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@@ -37,6 +38,9 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.Explosion; import net.minecraft.world.Explosion;
import net.minecraft.world.World; import net.minecraft.world.World;
import cpw.mods.fml.common.registry.EntityRegistry;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderTinyTNT; import appeng.client.render.blocks.RenderTinyTNT;
@@ -47,7 +51,6 @@ import appeng.entity.EntityIds;
import appeng.entity.EntityTinyTNTPrimed; import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.hooks.DispenserBehaviorTinyTNT; import appeng.hooks.DispenserBehaviorTinyTNT;
import cpw.mods.fml.common.registry.EntityRegistry;
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{ {
@@ -172,7 +175,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
@Override @Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual) 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 @Override
@@ -18,7 +18,8 @@
package appeng.block.networking; package appeng.block.networking;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@@ -27,6 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderBlockWireless; import appeng.client.render.blocks.RenderBlockWireless;
@@ -112,9 +114,9 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
break; 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 @Override
@@ -18,7 +18,8 @@
package appeng.block.qnb; package appeng.block.qnb;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -29,6 +30,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.EffectType; import appeng.client.EffectType;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
@@ -40,8 +45,6 @@ import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.tile.qnb.TileQuantumBridge; import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomCollision 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) public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
{ {
double OnePx = 2.0 / 16.0; 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 @Override
@@ -18,7 +18,8 @@
package appeng.block.qnb; package appeng.block.qnb;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@@ -27,6 +28,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
import appeng.client.render.blocks.RenderQNB; import appeng.client.render.blocks.RenderQNB;
@@ -84,7 +86,7 @@ public class BlockQuantumRing extends AEBaseBlock implements ICustomCollision
{ {
OnePx = 1.0 / 16.0; 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 @Override
@@ -18,7 +18,8 @@
package appeng.block.storage; package appeng.block.storage;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@@ -34,6 +35,10 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.render.BaseBlockRender; import appeng.client.render.BaseBlockRender;
@@ -43,8 +48,6 @@ import appeng.core.sync.GuiBridge;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.tile.storage.TileSkyChest; import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSkyChest extends AEBaseBlock implements ICustomCollision 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 Y = o.offsetY == 0 ? 0.06 : 0.0;
double Z = o.offsetZ == 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 ), 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 ) ) );
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 @Override
+26 -24
View File
@@ -18,6 +18,7 @@
package appeng.client.gui; package appeng.client.gui;
import java.io.IOException; import java.io.IOException;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
@@ -29,7 +30,11 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; 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.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
@@ -42,10 +47,10 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard; import cpw.mods.fml.common.ObfuscationReflectionHelper;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11; import com.google.common.base.Joiner;
import org.lwjgl.opengl.GL12; import com.google.common.base.Stopwatch;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiScrollbar; import appeng.client.gui.widgets.GuiScrollbar;
@@ -55,7 +60,17 @@ import appeng.client.me.SlotDisconnected;
import appeng.client.me.SlotME; import appeng.client.me.SlotME;
import appeng.client.render.AppEngRenderItem; import appeng.client.render.AppEngRenderItem;
import appeng.container.AEBaseContainer; import appeng.container.AEBaseContainer;
import appeng.container.slot.AppEngCraftingSlot;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.AppEngSlot.hasCalculatedValidness; 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.AELog;
import appeng.core.AppEng; import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.network.NetworkHandler;
@@ -66,10 +81,6 @@ import appeng.integration.IntegrationType;
import appeng.integration.abstraction.INEI; import appeng.integration.abstraction.INEI;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.base.Stopwatch;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
public abstract class AEBaseGui extends GuiContainer public abstract class AEBaseGui extends GuiContainer
{ {
@@ -495,7 +506,7 @@ public abstract class AEBaseGui extends GuiContainer
if ( y < 15 ) if ( y < 15 )
y = 15; y = 15;
String msg = tooltip.getMsg(); String msg = tooltip.getMessage();
if ( msg != null ) if ( msg != null )
drawTooltip( x + 11, y + 4, 0, msg ); drawTooltip( x + 11, y + 4, 0, msg );
} }
@@ -567,7 +578,7 @@ public abstract class AEBaseGui extends GuiContainer
if ( var13 == 0 ) if ( var13 == 0 )
{ {
var14 = "\u00a7" + Integer.toHexString( 15 ) + var14; var14 = '\u00a7' + Integer.toHexString( 15 ) + var14;
} }
else else
{ {
@@ -702,20 +713,11 @@ public abstract class AEBaseGui extends GuiContainer
return null; return null;
} }
protected static String join(Collection<?> s, String delimiter) protected static String join(Collection<String> toolTip, String delimiter)
{ {
StringBuilder builder = new StringBuilder(); final Joiner joiner = Joiner.on( delimiter );
Iterator iterator = s.iterator();
while (iterator.hasNext()) return joiner.join( toolTip );
{
builder.append( iterator.next() );
if ( !iterator.hasNext() )
{
break;
}
builder.append( delimiter );
}
return builder.toString();
} }
boolean useNEI = false; boolean useNEI = false;
@@ -18,17 +18,20 @@
package appeng.client.gui.config; package appeng.client.gui.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement; 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.GuiConfig;
import cpw.mods.fml.client.config.IConfigElement; import cpw.mods.fml.client.config.IConfigElement;
import appeng.core.AEConfig;
import appeng.core.AppEng;
public class AEConfigGui extends GuiConfig public class AEConfigGui extends GuiConfig
{ {
@@ -57,7 +60,7 @@ public class AEConfigGui extends GuiConfig
} }
public AEConfigGui(GuiScreen parent) { public AEConfigGui(GuiScreen parent) {
super( parent, getConfigElements(), AppEng.modid, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) ); super( parent, getConfigElements(), AppEng.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath( AEConfig.instance.getFilePath() ) );
} }
} }
@@ -18,11 +18,12 @@
package appeng.client.gui.implementations; package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.Settings; import appeng.api.config.Settings;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton; 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 ); fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
mode.set( cvc.output ); mode.set( cvc.output );
mode.FillVar = "" + cvc.output.requiredPower; mode.fillVar = String.valueOf( cvc.output.requiredPower );
} }
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations; package appeng.client.gui.implementations;
import java.io.IOException; import java.io.IOException;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
@@ -25,12 +26,14 @@ import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.input.Mouse; import com.google.common.base.Joiner;
import org.lwjgl.opengl.GL11;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.storage.ITerminalHost; import appeng.api.storage.ITerminalHost;
@@ -51,8 +54,6 @@ import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal; import appeng.parts.reporting.PartTerminal;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.base.Joiner;
public class GuiCraftConfirm extends AEBaseGui public class GuiCraftConfirm extends AEBaseGui
{ {
@@ -369,7 +370,7 @@ public class GuiCraftConfirm extends AEBaseGui
{ {
long BytesUsed = ccc.bytesUsed; long BytesUsed = ccc.bytesUsed;
String byteUsed = NumberFormat.getInstance().format( 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 ); fontRendererObj.drawString( GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752 );
String dsp = null; String dsp = null;
@@ -428,9 +429,9 @@ public class GuiCraftConfirm extends AEBaseGui
{ {
String str = Long.toString( stored.getStackSize() ); String str = Long.toString( stored.getStackSize() );
if ( stored.getStackSize() >= 10000 ) if ( stored.getStackSize() >= 10000 )
str = Long.toString( stored.getStackSize() / 1000 ) + "k"; str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
if ( stored.getStackSize() >= 10000000 ) if ( stored.getStackSize() >= 10000000 )
str = Long.toString( stored.getStackSize() / 1000000 ) + "m"; str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
str = GuiText.FromStorage.getLocal() + ": " + str; str = GuiText.FromStorage.getLocal() + ": " + str;
int w = 4 + fontRendererObj.getStringWidth( str ); int w = 4 + fontRendererObj.getStringWidth( str );
@@ -447,9 +448,9 @@ public class GuiCraftConfirm extends AEBaseGui
{ {
String str = Long.toString( missingStack.getStackSize() ); String str = Long.toString( missingStack.getStackSize() );
if ( missingStack.getStackSize() >= 10000 ) if ( missingStack.getStackSize() >= 10000 )
str = Long.toString( missingStack.getStackSize() / 1000 ) + "k"; str = Long.toString( missingStack.getStackSize() / 1000 ) + 'k';
if ( missingStack.getStackSize() >= 10000000 ) if ( missingStack.getStackSize() >= 10000000 )
str = Long.toString( missingStack.getStackSize() / 1000000 ) + "m"; str = Long.toString( missingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Missing.getLocal() + ": " + str; str = GuiText.Missing.getLocal() + ": " + str;
int w = 4 + fontRendererObj.getStringWidth( str ); int w = 4 + fontRendererObj.getStringWidth( str );
@@ -467,9 +468,9 @@ public class GuiCraftConfirm extends AEBaseGui
{ {
String str = Long.toString( pendingStack.getStackSize() ); String str = Long.toString( pendingStack.getStackSize() );
if ( pendingStack.getStackSize() >= 10000 ) if ( pendingStack.getStackSize() >= 10000 )
str = Long.toString( pendingStack.getStackSize() / 1000 ) + "k"; str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
if ( pendingStack.getStackSize() >= 10000000 ) if ( pendingStack.getStackSize() >= 10000000 )
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + "m"; str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.ToCraft.getLocal() + ": " + str; str = GuiText.ToCraft.getLocal() + ": " + str;
int w = 4 + fontRendererObj.getStringWidth( str ); int w = 4 + fontRendererObj.getStringWidth( str );
@@ -492,7 +493,7 @@ public class GuiCraftConfirm extends AEBaseGui
dspToolTip = Platform.getItemDisplayName( is ); dspToolTip = Platform.getItemDisplayName( is );
if ( lineList.size() > 0 ) 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; toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
toolPosY = y * offY + yo; toolPosY = y * offY + yo;
@@ -18,17 +18,20 @@
package appeng.client.gui.implementations; package appeng.client.gui.implementations;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11; import com.google.common.base.Joiner;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.SortDir; import appeng.api.config.SortDir;
@@ -46,8 +49,6 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig; import appeng.core.sync.packets.PacketValueConfig;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.base.Joiner;
public class GuiCraftingCPU extends AEBaseGui implements ISortSource public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{ {
@@ -321,9 +322,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{ {
String str = Long.toString( stored.getStackSize() ); String str = Long.toString( stored.getStackSize() );
if ( stored.getStackSize() >= 10000 ) if ( stored.getStackSize() >= 10000 )
str = Long.toString( stored.getStackSize() / 1000 ) + "k"; str = Long.toString( stored.getStackSize() / 1000 ) + 'k';
if ( stored.getStackSize() >= 10000000 ) if ( stored.getStackSize() >= 10000000 )
str = Long.toString( stored.getStackSize() / 1000000 ) + "m"; str = Long.toString( stored.getStackSize() / 1000000 ) + 'm';
str = GuiText.Stored.getLocal() + ": " + str; str = GuiText.Stored.getLocal() + ": " + str;
int w = 4 + fontRendererObj.getStringWidth( str ); int w = 4 + fontRendererObj.getStringWidth( str );
@@ -340,9 +341,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{ {
String str = Long.toString( activeStack.getStackSize() ); String str = Long.toString( activeStack.getStackSize() );
if ( activeStack.getStackSize() >= 10000 ) if ( activeStack.getStackSize() >= 10000 )
str = Long.toString( activeStack.getStackSize() / 1000 ) + "k"; str = Long.toString( activeStack.getStackSize() / 1000 ) + 'k';
if ( activeStack.getStackSize() >= 10000000 ) if ( activeStack.getStackSize() >= 10000000 )
str = Long.toString( activeStack.getStackSize() / 1000000 ) + "m"; str = Long.toString( activeStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Crafting.getLocal() + ": " + str; str = GuiText.Crafting.getLocal() + ": " + str;
int w = 4 + fontRendererObj.getStringWidth( str ); int w = 4 + fontRendererObj.getStringWidth( str );
@@ -359,9 +360,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
{ {
String str = Long.toString( pendingStack.getStackSize() ); String str = Long.toString( pendingStack.getStackSize() );
if ( pendingStack.getStackSize() >= 10000 ) if ( pendingStack.getStackSize() >= 10000 )
str = Long.toString( pendingStack.getStackSize() / 1000 ) + "k"; str = Long.toString( pendingStack.getStackSize() / 1000 ) + 'k';
if ( pendingStack.getStackSize() >= 10000000 ) if ( pendingStack.getStackSize() >= 10000000 )
str = Long.toString( pendingStack.getStackSize() / 1000000 ) + "m"; str = Long.toString( pendingStack.getStackSize() / 1000000 ) + 'm';
str = GuiText.Scheduled.getLocal() + ": " + str; str = GuiText.Scheduled.getLocal() + ": " + str;
int w = 4 + fontRendererObj.getStringWidth( str ); int w = 4 + fontRendererObj.getStringWidth( str );
@@ -384,7 +385,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
dspToolTip = Platform.getItemDisplayName( is ); dspToolTip = Platform.getItemDisplayName( is );
if ( lineList.size() > 0 ) 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; toolPosX = x * (1 + sectionLength) + xo + sectionLength - 8;
toolPosY = y * offY + yo; toolPosY = y * offY + yo;
@@ -18,6 +18,7 @@
package appeng.client.gui.implementations; package appeng.client.gui.implementations;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@@ -27,12 +28,14 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import org.lwjgl.opengl.GL11;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import org.lwjgl.opengl.GL11; import com.google.common.collect.HashMultimap;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
@@ -45,8 +48,6 @@ import appeng.core.localization.GuiText;
import appeng.parts.reporting.PartMonitor; import appeng.parts.reporting.PartMonitor;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.collect.HashMultimap;
public class GuiInterfaceTerminal extends AEBaseGui public class GuiInterfaceTerminal extends AEBaseGui
{ {
@@ -182,7 +183,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
String name = (String) lineObj; String name = (String) lineObj;
int rows = byName.get( name ).size(); int rows = byName.get( name ).size();
if ( rows > 1 ) if ( rows > 1 )
name = name + " (" + rows + ")"; name = name + " (" + rows + ')';
while (name.length() > 2 && fontRendererObj.getStringWidth( name ) > 155) while (name.length() > 2 && fontRendererObj.getStringWidth( name ) > 155)
name = name.substring( 0, name.length() - 1 ); name = name.substring( 0, name.length() - 1 );
@@ -260,7 +261,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
boolean found = searchFilterLowerCase.isEmpty(); boolean found = searchFilterLowerCase.isEmpty();
// Search if the current inventory holds a pattern containing the search term. // 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) for (ItemStack itemStack : entry.inv)
{ {
@@ -18,16 +18,17 @@
package appeng.client.gui.implementations; package appeng.client.gui.implementations;
import java.util.List; import java.util.List;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import appeng.api.config.Settings; import appeng.api.config.Settings;
import appeng.api.config.SortDir; import appeng.api.config.SortDir;
import appeng.api.config.SortOrder; import appeng.api.config.SortOrder;
@@ -186,7 +187,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
String str = Long.toString( refStack.getStackSize() ); String str = Long.toString( refStack.getStackSize() );
if ( refStack.getStackSize() >= 10000 ) if ( refStack.getStackSize() >= 10000 )
str = Long.toString( refStack.getStackSize() / 1000 ) + "k"; str = Long.toString( refStack.getStackSize() / 1000 ) + 'k';
int w = fontRendererObj.getStringWidth( str ); int w = fontRendererObj.getStringWidth( str );
fontRendererObj.drawString( str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * 18 + yo + 6) * 2, 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 = 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 ) 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; toolPosX = x * sectionLength + xo + sectionLength - 8;
toolPosY = y * 18 + yo; toolPosY = y * 18 + yo;
@@ -18,9 +18,11 @@
package appeng.client.gui.implementations; package appeng.client.gui.implementations;
import java.io.IOException; import java.io.IOException;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
import appeng.api.config.SortOrder; import appeng.api.config.SortOrder;
import appeng.api.storage.ITerminalHost; import appeng.api.storage.ITerminalHost;
@@ -52,7 +54,7 @@ public class GuiSecurity extends GuiMEMonitorable
super.initGui(); super.initGui();
int top = this.guiTop + this.ySize - 116; 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() ) ); .getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
buttonList.add( extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT buttonList.add( extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT
@@ -18,11 +18,12 @@
package appeng.client.gui.implementations; package appeng.client.gui.implementations;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.Settings; import appeng.api.config.Settings;
import appeng.client.gui.AEBaseGui; import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton; 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.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.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.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( getGuiDisplayName( GuiText.SpatialIOPort.getLocal() ), 8, 6, 4210752 );
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96, 4210752 ); fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96, 4210752 );
@@ -18,15 +18,17 @@
package appeng.client.gui.widgets; package appeng.client.gui.widgets;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.ActionItems; import appeng.api.config.ActionItems;
import appeng.api.config.CondenserOutput; import appeng.api.config.CondenserOutput;
@@ -48,200 +50,154 @@ import appeng.api.config.YesNo;
import appeng.client.texture.ExtraBlockTextures; import appeng.client.texture.ExtraBlockTextures;
import appeng.core.localization.ButtonToolTips; import appeng.core.localization.ButtonToolTips;
public class GuiImgButton extends GuiButton implements ITooltip public class GuiImgButton extends GuiButton implements ITooltip
{ {
private static final Pattern COMPILE = Pattern.compile( "%s" );
static class EnumPair private static Map<EnumPair, ButtonAppearance> appearances;
{
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 final Enum buttonSetting; private final Enum buttonSetting;
public boolean halfSize = false;
public String fillVar;
private Enum currentValue; private Enum currentValue;
static private Map<EnumPair, BtnAppearance> Appearances; public GuiImgButton( int x, int y, Enum idx, Enum val )
private void registerApp(int IIcon, Settings setting, Enum val, ButtonToolTips title, Object hint)
{ {
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, "" ); 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>(); appearances = new HashMap<EnumPair, ButtonAppearance>();
registerApp( 16 * 7, Settings.CONDENSER_OUTPUT, CondenserOutput.TRASH, ButtonToolTips.CondenserOutput, ButtonToolTips.Trash ); this.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 ); this.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 ); 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 ); this.registerApp( 16 * 9 + 1, Settings.ACCESS, AccessRestriction.READ, ButtonToolTips.IOMode, ButtonToolTips.Read );
registerApp( 16 * 9, Settings.ACCESS, AccessRestriction.WRITE, ButtonToolTips.IOMode, ButtonToolTips.Write ); this.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 + 2, Settings.ACCESS, AccessRestriction.READ_WRITE, ButtonToolTips.IOMode, ButtonToolTips.ReadWrite );
registerApp( 16 * 10, Settings.POWER_UNITS, PowerUnits.AE, ButtonToolTips.PowerUnits, PowerUnits.AE.unlocalizedName ); this.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 ); this.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 ); this.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 ); this.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 ); this.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 + 5, Settings.POWER_UNITS, PowerUnits.RF, ButtonToolTips.PowerUnits, PowerUnits.RF.unlocalizedName );
registerApp( 3, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, ButtonToolTips.RedstoneMode, ButtonToolTips.AlwaysActive ); this.registerApp( 3, Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE, ButtonToolTips.RedstoneMode, ButtonToolTips.AlwaysActive );
registerApp( 0, Settings.REDSTONE_CONTROLLED, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithoutSignal ); this.registerApp( 0, Settings.REDSTONE_CONTROLLED, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithoutSignal );
registerApp( 1, Settings.REDSTONE_CONTROLLED, RedstoneMode.HIGH_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveWithSignal ); this.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( 2, Settings.REDSTONE_CONTROLLED, RedstoneMode.SIGNAL_PULSE, ButtonToolTips.RedstoneMode, ButtonToolTips.ActiveOnPulse );
registerApp( 0, Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.EmitLevelsBelow ); this.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( 1, Settings.REDSTONE_EMITTER, RedstoneMode.HIGH_SIGNAL, ButtonToolTips.RedstoneMode, ButtonToolTips.EmitLevelAbove );
registerApp( 51, Settings.OPERATION_MODE, OperationMode.FILL, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToStorageCell ); this.registerApp( 51, Settings.OPERATION_MODE, OperationMode.FILL, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToStorageCell );
registerApp( 50, Settings.OPERATION_MODE, OperationMode.EMPTY, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToNetwork ); this.registerApp( 50, Settings.OPERATION_MODE, OperationMode.EMPTY, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToNetwork );
registerApp( 51, Settings.IO_DIRECTION, RelativeDirection.LEFT, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToStorageCell ); this.registerApp( 51, Settings.IO_DIRECTION, RelativeDirection.LEFT, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToStorageCell );
registerApp( 50, Settings.IO_DIRECTION, RelativeDirection.RIGHT, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToNetwork ); this.registerApp( 50, Settings.IO_DIRECTION, RelativeDirection.RIGHT, ButtonToolTips.TransferDirection, ButtonToolTips.TransferToNetwork );
registerApp( 48, Settings.SORT_DIRECTION, SortDir.ASCENDING, ButtonToolTips.SortOrder, ButtonToolTips.ToggleSortDirection ); this.registerApp( 48, Settings.SORT_DIRECTION, SortDir.ASCENDING, ButtonToolTips.SortOrder, ButtonToolTips.ToggleSortDirection );
registerApp( 49, Settings.SORT_DIRECTION, SortDir.DESCENDING, 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 ); this.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 ); this.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 ); this.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 + 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 ); this.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 * 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 ); this.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 ); this.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 + 2, Settings.TERMINAL_STYLE, TerminalStyle.FULL, ButtonToolTips.TerminalStyle, ButtonToolTips.TerminalStyle_Full );
registerApp( 64, Settings.SORT_BY, SortOrder.NAME, ButtonToolTips.SortBy, ButtonToolTips.ItemName ); this.registerApp( 64, Settings.SORT_BY, SortOrder.NAME, ButtonToolTips.SortBy, ButtonToolTips.ItemName );
registerApp( 65, Settings.SORT_BY, SortOrder.AMOUNT, ButtonToolTips.SortBy, ButtonToolTips.NumberOfItems ); this.registerApp( 65, Settings.SORT_BY, SortOrder.AMOUNT, ButtonToolTips.SortBy, ButtonToolTips.NumberOfItems );
registerApp( 68, Settings.SORT_BY, SortOrder.INVTWEAKS, ButtonToolTips.SortBy, ButtonToolTips.InventoryTweaks ); this.registerApp( 68, Settings.SORT_BY, SortOrder.INVTWEAKS, ButtonToolTips.SortBy, ButtonToolTips.InventoryTweaks );
registerApp( 69, Settings.SORT_BY, SortOrder.MOD, ButtonToolTips.SortBy, ButtonToolTips.Mod ); this.registerApp( 69, Settings.SORT_BY, SortOrder.MOD, ButtonToolTips.SortBy, ButtonToolTips.Mod );
registerApp( 66, Settings.ACTIONS, ActionItems.WRENCH, ButtonToolTips.PartitionStorage, ButtonToolTips.PartitionStorageHint ); this.registerApp( 66, Settings.ACTIONS, ActionItems.WRENCH, ButtonToolTips.PartitionStorage, ButtonToolTips.PartitionStorageHint );
registerApp( 6, Settings.ACTIONS, ActionItems.CLOSE, ButtonToolTips.Clear, ButtonToolTips.ClearSettings ); this.registerApp( 6, Settings.ACTIONS, ActionItems.CLOSE, ButtonToolTips.Clear, ButtonToolTips.ClearSettings );
registerApp( 6, Settings.ACTIONS, ActionItems.STASH, ButtonToolTips.Stash, ButtonToolTips.StashDesc ); this.registerApp( 6, Settings.ACTIONS, ActionItems.STASH, ButtonToolTips.Stash, ButtonToolTips.StashDesc );
registerApp( 8, Settings.ACTIONS, ActionItems.ENCODE, ButtonToolTips.Encode, ButtonToolTips.EncodeDescription ); this.registerApp( 8, Settings.ACTIONS, ActionItems.ENCODE, ButtonToolTips.Encode, ButtonToolTips.EncodeDescription );
registerApp( 4 + 3 * 16, Settings.ACTIONS, ActionItems.SUBSTITUTION, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDesc ); this.registerApp( 4 + 3 * 16, Settings.ACTIONS, ActionItems.SUBSTITUTION, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDesc );
registerApp( 16, Settings.VIEW_MODE, ViewItems.STORED, ButtonToolTips.View, ButtonToolTips.StoredItems ); this.registerApp( 16, Settings.VIEW_MODE, ViewItems.STORED, ButtonToolTips.View, ButtonToolTips.StoredItems );
registerApp( 18, Settings.VIEW_MODE, ViewItems.ALL, ButtonToolTips.View, ButtonToolTips.StoredCraftable ); this.registerApp( 18, Settings.VIEW_MODE, ViewItems.ALL, ButtonToolTips.View, ButtonToolTips.StoredCraftable );
registerApp( 19, Settings.VIEW_MODE, ViewItems.CRAFTABLE, ButtonToolTips.View, ButtonToolTips.Craftable ); 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 ); this.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 ); this.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 ); this.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 ); this.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 + 4, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, ButtonToolTips.FuzzyMode, ButtonToolTips.FZIgnoreAll );
registerApp( 80, Settings.FULLNESS_MODE, FullnessMode.EMPTY, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenEmpty ); this.registerApp( 80, Settings.FULLNESS_MODE, FullnessMode.EMPTY, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenEmpty );
registerApp( 81, Settings.FULLNESS_MODE, FullnessMode.HALF, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenWorkIsDone ); this.registerApp( 81, Settings.FULLNESS_MODE, FullnessMode.HALF, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenWorkIsDone );
registerApp( 82, Settings.FULLNESS_MODE, FullnessMode.FULL, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenFull ); this.registerApp( 82, Settings.FULLNESS_MODE, FullnessMode.FULL, ButtonToolTips.OperationMode, ButtonToolTips.MoveWhenFull );
registerApp( 16 + 5, Settings.BLOCK, YesNo.YES, ButtonToolTips.InterfaceBlockingMode, ButtonToolTips.Blocking ); this.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 + 4, Settings.BLOCK, YesNo.NO, ButtonToolTips.InterfaceBlockingMode, ButtonToolTips.NonBlocking );
registerApp( 16 + 3, Settings.CRAFT_ONLY, YesNo.YES, ButtonToolTips.Craft, ButtonToolTips.CraftOnly ); this.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 + 2, Settings.CRAFT_ONLY, YesNo.NO, ButtonToolTips.Craft, ButtonToolTips.CraftEither );
registerApp( 16 * 11 + 2, Settings.CRAFT_VIA_REDSTONE, YesNo.YES, ButtonToolTips.EmitterMode, ButtonToolTips.CraftViaRedstone ); this.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 + 1, Settings.CRAFT_VIA_REDSTONE, YesNo.NO, ButtonToolTips.EmitterMode, ButtonToolTips.EmitWhenCrafting );
registerApp( 16 * 3 + 5, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY, ButtonToolTips.ReportInaccessibleItems, this.registerApp( 16 * 3 + 5, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY, ButtonToolTips.ReportInaccessibleItems, ButtonToolTips.ReportInaccessibleItemsNo );
ButtonToolTips.ReportInaccessibleItemsNo ); this.registerApp( 16 * 3 + 6, Settings.STORAGE_FILTER, StorageFilter.NONE, ButtonToolTips.ReportInaccessibleItems, ButtonToolTips.ReportInaccessibleItemsYes );
registerApp( 16 * 3 + 6, Settings.STORAGE_FILTER, StorageFilter.NONE, ButtonToolTips.ReportInaccessibleItems,
ButtonToolTips.ReportInaccessibleItemsYes );
} }
} }
@Override private void registerApp( int iconIndex, Settings setting, Enum val, ButtonToolTips title, Object hint )
public boolean isVisible()
{ {
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 @Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
{ {
if ( this.visible ) if ( this.visible )
{ {
int iconIndex = getIconIndex(); int iconIndex = this.getIconIndex();
if ( halfSize ) if ( this.halfSize )
{ {
width = 8; this.width = 8;
height = 8; this.height = 8;
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F ); GL11.glTranslatef( this.xPosition, this.yPosition, 0.0F );
GL11.glScalef( 0.5f, 0.5f, 0.5f ); GL11.glScalef( 0.5f, 0.5f, 0.5f );
if ( enabled ) if ( this.enabled )
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
else else
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f ); GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) ); par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
&& 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; int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( 0, 0, 256 - 16, 256 - 16, 16, 16 ); this.drawTexturedModalRect( 0, 0, 256 - 16, 256 - 16, 16, 16 );
@@ -252,16 +208,15 @@ public class GuiImgButton extends GuiButton implements ITooltip
} }
else else
{ {
if ( enabled ) if ( this.enabled )
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
else else
GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f ); GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f );
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) ); par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) );
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
&& 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; int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 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() 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 ) if ( app == null )
return 256 - 1; return 256 - 1;
return app.index; return app.index;
@@ -286,55 +241,55 @@ public class GuiImgButton extends GuiButton implements ITooltip
public Settings getSetting() public Settings getSetting()
{ {
return (Settings) buttonSetting; return ( Settings ) this.buttonSetting;
} }
public Enum getCurrentValue() public Enum getCurrentValue()
{ {
return currentValue; return this.currentValue;
} }
@Override @Override
public String getMsg() public String getMessage()
{ {
String DisplayName = null; String displayName = null;
String DisplayValue = null; String displayValue = null;
if ( buttonSetting != null && currentValue != null ) if ( this.buttonSetting != null && this.currentValue != null )
{ {
BtnAppearance ba = Appearances.get( new EnumPair( buttonSetting, currentValue ) ); ButtonAppearance buttonAppearance = appearances.get( new EnumPair( this.buttonSetting, this.currentValue ) );
if ( ba == null ) if ( buttonAppearance == null )
return "No Such Message"; return "No Such Message";
DisplayName = ba.DisplayName; displayName = buttonAppearance.displayName;
DisplayValue = ba.DisplayValue; displayValue = buttonAppearance.displayValue;
} }
if ( DisplayName != null ) if ( displayName != null )
{ {
String Name = StatCollector.translateToLocal( DisplayName ); String name = StatCollector.translateToLocal( displayName );
String Value = StatCollector.translateToLocal( DisplayValue ); String value = StatCollector.translateToLocal( displayValue );
if ( Name == null || Name.equals( "" ) ) if ( name == null || name.isEmpty() )
Name = DisplayName; name = displayName;
if ( Value == null || Value.equals( "" ) ) if ( value == null || value.isEmpty() )
Value = DisplayValue; value = displayValue;
if ( FillVar != null ) if ( this.fillVar != null )
Value = Value.replaceFirst( "%s", FillVar ); value = COMPILE.matcher( value ).replaceFirst( this.fillVar );
Value = Value.replace( "\\n", "\n" ); value = value.replace( "\\n", "\n" );
StringBuilder sb = new StringBuilder( Value ); StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" ); int i = sb.lastIndexOf( "\n" );
if ( i <= 0 ) if ( i <= 0 )
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" ); sb.replace( i, i + 1, "\n" );
} }
return Name + "\n" + sb.toString(); return name + '\n' + sb;
} }
return null; return null;
} }
@@ -342,33 +297,76 @@ public class GuiImgButton extends GuiButton implements ITooltip
@Override @Override
public int xPos() public int xPos()
{ {
return xPosition; return this.xPosition;
} }
@Override @Override
public int yPos() public int yPos()
{ {
return yPosition; return this.yPosition;
} }
@Override @Override
public int getWidth() public int getWidth()
{ {
return halfSize ? 8 : 16; return this.halfSize ? 8 : 16;
} }
@Override @Override
public int getHeight() public int getHeight()
{ {
return halfSize ? 8 : 16; return this.halfSize ? 8 : 16;
} }
public void set(Enum e) @Override
public boolean isVisible()
{ {
if ( currentValue != e ) return this.visible;
}
public void set( Enum e )
{
if ( this.currentValue != e )
{ {
currentValue = e; this.currentValue = e;
} }
} }
static class EnumPair
{
final Enum setting;
final Enum value;
EnumPair( Enum a, Enum b )
{
this.setting = a;
this.value = b;
}
@Override
public int hashCode()
{
return this.setting.hashCode() ^ this.value.hashCode();
}
@Override
public boolean equals( Object obj )
{
if ( obj == null )
return false;
if ( this.getClass() != obj.getClass() )
return false;
EnumPair other = ( EnumPair ) obj;
return other.setting == this.setting && other.value == this.value;
}
}
private static class ButtonAppearance
{
public int index;
public String displayName;
public String displayValue;
}
} }
@@ -18,9 +18,11 @@
package appeng.client.gui.widgets; package appeng.client.gui.widgets;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import appeng.container.interfaces.IProgressProvider; import appeng.container.interfaces.IProgressProvider;
import appeng.core.localization.GuiText; import appeng.core.localization.GuiText;
@@ -91,12 +93,12 @@ public class GuiProgressBar extends GuiButton implements ITooltip
} }
@Override @Override
public String getMsg() public String getMessage()
{ {
if ( fullMsg != null ) if ( fullMsg != null )
return fullMsg; 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 @Override
@@ -18,6 +18,10 @@
package appeng.client.gui.widgets; package appeng.client.gui.widgets;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton; 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.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import appeng.client.texture.ExtraBlockTextures; import appeng.client.texture.ExtraBlockTextures;
public class GuiTabButton extends GuiButton implements ITooltip public class GuiTabButton extends GuiButton implements ITooltip
{ {
private final RenderItem itemRenderer;
final RenderItem itemRenderer; private final String message;
int myIcon = -1;
public int hideEdge = 0; public int hideEdge = 0;
private int myIcon = -1;
private ItemStack myItem;
ItemStack myItem; public GuiTabButton( int x, int y, int ico, String message, RenderItem ir )
final String Msg;
public void setVisibility(boolean vis)
{ {
visible = vis;
enabled = vis;
}
public GuiTabButton(int x, int y, int ico, String Msg, RenderItem ir) {
super( 0, 0, 16, "" ); super( 0, 0, 16, "" );
xPosition = x;
yPosition = y; this.xPosition = x;
width = 22; this.yPosition = y;
height = 22; this.width = 22;
myIcon = ico; this.height = 22;
this.Msg = Msg; this.myIcon = ico;
this.message = message;
this.itemRenderer = ir; 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, "" ); super( 0, 0, 16, "" );
xPosition = x; this.xPosition = x;
yPosition = y; this.yPosition = y;
width = 22; this.width = 22;
height = 22; this.height = 22;
myItem = ico; this.myItem = ico;
this.Msg = Msg; this.message = message;
this.itemRenderer = ir; this.itemRenderer = ir;
} }
@Override @Override
public boolean isVisible() public void drawButton( Minecraft minecraft, int x, int y )
{
return visible;
}
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
{ {
if ( this.visible ) if ( this.visible )
{ {
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) ); minecraft.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 = 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 = ( this.hideEdge > 0 ? 11 : 13 );
int uv_x = (hideEdge > 0 ? 11 : 13) - uv_y * 16;
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 ); int uv_y = ( int ) Math.floor( this.myIcon / 16 );
uv_x = myIcon - uv_y * 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.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; this.zLevel = 100.0F;
itemRenderer.zLevel = 100.0F; this.itemRenderer.zLevel = 100.0F;
GL11.glEnable( GL11.GL_LIGHTING ); GL11.glEnable( GL11.GL_LIGHTING );
GL11.glEnable( GL12.GL_RESCALE_NORMAL ); GL11.glEnable( GL12.GL_RESCALE_NORMAL );
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
FontRenderer fontrenderer = par1Minecraft.fontRenderer; FontRenderer fontrenderer = minecraft.fontRenderer;
itemRenderer.renderItemAndEffectIntoGUI( fontrenderer, par1Minecraft.renderEngine, myItem, offsetX + this.xPosition + 3, this.yPosition + 3 ); this.itemRenderer.renderItemAndEffectIntoGUI( fontrenderer, minecraft.renderEngine, this.myItem, offsetX + this.xPosition + 3, this.yPosition + 3 );
GL11.glDisable( GL11.GL_LIGHTING ); GL11.glDisable( GL11.GL_LIGHTING );
itemRenderer.zLevel = 0.0F; this.itemRenderer.zLevel = 0.0F;
this.zLevel = 0.0F; this.zLevel = 0.0F;
} }
} }
} }
@Override @Override
public String getMsg() public String getMessage()
{ {
return Msg; return this.message;
} }
@Override @Override
public int xPos() public int xPos()
{ {
return xPosition; return this.xPosition;
} }
@Override @Override
public int yPos() public int yPos()
{ {
return yPosition; return this.yPosition;
} }
@Override @Override
@@ -150,4 +147,9 @@ public class GuiTabButton extends GuiButton implements ITooltip
return 22; return 22;
} }
@Override
public boolean isVisible()
{
return this.visible;
}
} }
@@ -18,66 +18,56 @@
package appeng.client.gui.widgets; package appeng.client.gui.widgets;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import appeng.client.texture.ExtraBlockTextures; import appeng.client.texture.ExtraBlockTextures;
public class GuiToggleButton extends GuiButton implements ITooltip public class GuiToggleButton extends GuiButton implements ITooltip
{ {
private final int iconIdxOn;
private final int iconIdxOff;
final int iconIdxOn; private final String displayName;
final int iconIdxOff; private final String displayHint;
final String Name; private boolean isActive;
final String Hint;
boolean on; public GuiToggleButton( int x, int y, int on, int off, String displayName, String displayHint )
public void setState(boolean isOn)
{ {
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, "" ); super( 0, 0, 16, "" );
iconIdxOn = on; this.iconIdxOn = on;
iconIdxOff = off; this.iconIdxOff = off;
this.Name = Name; this.displayName = displayName;
this.Hint = Hint; this.displayHint = displayHint;
xPosition = x; this.xPosition = x;
yPosition = y; this.yPosition = y;
width = 16; this.width = 16;
height = 16; this.height = 16;
} }
@Override public void setState( boolean isOn )
public boolean isVisible()
{ {
return visible; this.isActive = isOn;
} }
@Override @Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) public void drawButton( Minecraft par1Minecraft, int par2, int par3 )
{ {
if ( this.visible ) if ( this.visible )
{ {
int iconIndex = getIconIndex(); int iconIndex = this.getIconIndex();
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
par1Minecraft.renderEngine.bindTexture( ExtraBlockTextures.GuiTexture( "guis/states.png" ) ); 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; int uv_x = iconIndex - uv_y * 16;
this.drawTexturedModalRect( this.xPosition, this.yPosition, 256 - 16, 256 - 16, 16, 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() private int getIconIndex()
{ {
return on ? iconIdxOn : iconIdxOff; return this.isActive ? this.iconIdxOn : this.iconIdxOff;
} }
@Override @Override
public String getMsg() public String getMessage()
{ {
String DisplayName = Name; if ( this.displayName != null )
String DisplayValue = Hint;
if ( DisplayName != null )
{ {
String Name = StatCollector.translateToLocal( DisplayName ); String name = StatCollector.translateToLocal( this.displayName );
String Value = StatCollector.translateToLocal( DisplayValue ); String value = StatCollector.translateToLocal( this.displayHint );
if ( Name == null || Name.equals( "" ) ) if ( name == null || name.isEmpty() )
Name = DisplayName; name = this.displayName;
if ( Value == null || Value.equals( "" ) ) if ( value == null || value.isEmpty() )
Value = DisplayValue; value = this.displayHint;
Value = Value.replace( "\\n", "\n" ); value = value.replace( "\\n", "\n" );
StringBuilder sb = new StringBuilder( Value ); StringBuilder sb = new StringBuilder( value );
int i = sb.lastIndexOf( "\n" ); int i = sb.lastIndexOf( "\n" );
if ( i <= 0 ) if ( i <= 0 )
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" ); sb.replace( i, i + 1, "\n" );
} }
return Name + "\n" + sb.toString(); return name + '\n' + sb;
} }
return null; return null;
} }
@@ -126,13 +113,13 @@ public class GuiToggleButton extends GuiButton implements ITooltip
@Override @Override
public int xPos() public int xPos()
{ {
return xPosition; return this.xPosition;
} }
@Override @Override
public int yPos() public int yPos()
{ {
return yPosition; return this.yPosition;
} }
@Override @Override
@@ -147,4 +134,9 @@ public class GuiToggleButton extends GuiButton implements ITooltip
return 16; return 16;
} }
@Override
public boolean isVisible()
{
return this.visible;
}
} }
@@ -30,7 +30,7 @@ public interface ITooltip
* *
* @return tooltip message * @return tooltip message
*/ */
String getMsg(); String getMessage();
/** /**
* x Location for the object that triggers the tooltip. * x Location for the object that triggers the tooltip.
@@ -18,14 +18,15 @@
package appeng.client.render; package appeng.client.render;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.core.AEConfig; import appeng.core.AEConfig;
@@ -107,48 +108,48 @@ public class AppEngRenderItem extends RenderItem
if ( amount != 0 ) if ( amount != 0 )
{ {
String var6 = "" + Math.abs( amount ); String var6 = String.valueOf( Math.abs( amount ) );
if ( AEConfig.instance.useTerminalUseLargeFont() ) if ( AEConfig.instance.useTerminalUseLargeFont() )
{ {
if ( amount > 999999999 ) 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 ) else if ( amount > 99999999 )
{ {
var6 = "." + (int) Math.floor( amount / 100000000.0 ) + "B"; var6 = "." + (int) Math.floor( amount / 100000000.0 ) + 'B';
} }
else if ( amount > 999999 ) 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 ) else if ( amount > 99999 )
{ {
var6 = "." + (int) Math.floor( amount / 100000.0 ) + "M"; var6 = "." + (int) Math.floor( amount / 100000.0 ) + 'M';
} }
else if ( amount > 999 ) else if ( amount > 999 )
{ {
var6 = "" + (int) Math.floor( amount / 1000.0 ) + "K"; var6 = String.valueOf( ( int ) Math.floor( amount / 1000.0 ) ) + 'K';
} }
} }
else else
{ {
if ( amount > 999999999 ) 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 ) 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 ) 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 ) else if ( amount > 9999 )
{ {
var6 = "" + (int) Math.floor( amount / 1000.0 ) + "K"; var6 = String.valueOf( ( int ) Math.floor( amount / 1000.0 ) ) + 'K';
} }
} }
@@ -18,9 +18,13 @@
package appeng.client.render; package appeng.client.render;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.util.EnumSet; import java.util.EnumSet;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderBlocks;
@@ -37,8 +41,8 @@ import net.minecraft.world.IBlockAccess;
import net.minecraftforge.client.IItemRenderer.ItemRenderType; import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.BufferUtils; import cpw.mods.fml.relauncher.Side;
import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.util.IOrientable; import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock; import appeng.api.util.IOrientableBlock;
@@ -46,8 +50,6 @@ import appeng.block.AEBaseBlock;
import appeng.client.texture.ExtraBlockTextures; import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class BaseBlockRender public class BaseBlockRender
@@ -65,7 +67,7 @@ public class BaseBlockRender
{ {
int r = 0xff & (v >> 16); int r = 0xff & (v >> 16);
int g = 0xff & (v >> 8); int g = 0xff & (v >> 8);
int b = 0xff & (v >> 0); int b = 0xff & ( v );
r *= d; r *= d;
g *= d; g *= d;
@@ -124,8 +126,8 @@ public class BaseBlockRender
OrientationMap[5][4][1] = 0; OrientationMap[5][4][1] = 0;
// upside down // upside down
OrientationMap[0][3][0] = 0 | FLIP_H_BIT; OrientationMap[0][3][0] = FLIP_H_BIT;
OrientationMap[1][3][0] = 0 | FLIP_H_BIT; OrientationMap[1][3][0] = FLIP_H_BIT;
OrientationMap[2][3][0] = 3; OrientationMap[2][3][0] = 3;
OrientationMap[3][3][0] = 3; OrientationMap[3][3][0] = 3;
OrientationMap[4][3][0] = 3; OrientationMap[4][3][0] = 3;
@@ -177,34 +179,34 @@ public class BaseBlockRender
OrientationMap[0][0][5] = 1 | FLIP_H_BIT; OrientationMap[0][0][5] = 1 | FLIP_H_BIT;
OrientationMap[1][0][5] = 1; OrientationMap[1][0][5] = 1;
OrientationMap[2][0][5] = 0; 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[4][0][5] = 1;
OrientationMap[5][0][5] = 1 | FLIP_V_BIT; OrientationMap[5][0][5] = 1 | FLIP_V_BIT;
// side 2 // side 2
OrientationMap[0][1][2] = 0 | FLIP_H_BIT; OrientationMap[0][1][2] = FLIP_H_BIT;
OrientationMap[1][1][2] = 0; OrientationMap[1][1][2] = 0;
OrientationMap[2][1][2] = 2 | FLIP_H_BIT; OrientationMap[2][1][2] = 2 | FLIP_H_BIT;
OrientationMap[3][1][2] = 1; OrientationMap[3][1][2] = 1;
OrientationMap[4][1][2] = 3; OrientationMap[4][1][2] = 3;
OrientationMap[5][1][2] = 3 | FLIP_H_BIT; OrientationMap[5][1][2] = 3 | FLIP_H_BIT;
OrientationMap[0][4][2] = 0 | FLIP_H_BIT; OrientationMap[0][4][2] = FLIP_H_BIT;
OrientationMap[1][4][2] = 0 | FLIP_H_BIT; OrientationMap[1][4][2] = FLIP_H_BIT;
OrientationMap[2][4][2] = 2 | FLIP_H_BIT; OrientationMap[2][4][2] = 2 | FLIP_H_BIT;
OrientationMap[3][4][2] = 1; OrientationMap[3][4][2] = 1;
OrientationMap[4][4][2] = 1 | FLIP_H_BIT; OrientationMap[4][4][2] = 1 | FLIP_H_BIT;
OrientationMap[5][4][2] = 2; 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[1][0][2] = 0;
OrientationMap[2][0][2] = 2; OrientationMap[2][0][2] = 2;
OrientationMap[3][0][2] = 1 | FLIP_H_BIT; OrientationMap[3][0][2] = 1 | FLIP_H_BIT;
OrientationMap[4][0][2] = 3 | FLIP_H_BIT; OrientationMap[4][0][2] = 3 | FLIP_H_BIT;
OrientationMap[5][0][2] = 0; OrientationMap[5][0][2] = 0;
OrientationMap[0][5][2] = 0 | FLIP_H_BIT; OrientationMap[0][5][2] = FLIP_H_BIT;
OrientationMap[1][5][2] = 0 | FLIP_H_BIT; OrientationMap[1][5][2] = FLIP_H_BIT;
OrientationMap[2][5][2] = 2; OrientationMap[2][5][2] = 2;
OrientationMap[3][5][2] = 1 | FLIP_H_BIT; OrientationMap[3][5][2] = 1 | FLIP_H_BIT;
OrientationMap[4][5][2] = 2; OrientationMap[4][5][2] = 2;
@@ -216,7 +218,7 @@ public class BaseBlockRender
OrientationMap[2][0][3] = 1; OrientationMap[2][0][3] = 1;
OrientationMap[3][0][3] = 2 | FLIP_H_BIT; OrientationMap[3][0][3] = 2 | FLIP_H_BIT;
OrientationMap[4][0][3] = 0; 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[0][4][3] = 3;
OrientationMap[1][4][3] = 3; OrientationMap[1][4][3] = 3;
@@ -250,7 +252,7 @@ public class BaseBlockRender
OrientationMap[0][0][4] = 1 | FLIP_H_BIT; OrientationMap[0][0][4] = 1 | FLIP_H_BIT;
OrientationMap[1][0][4] = 2; OrientationMap[1][0][4] = 2;
OrientationMap[2][0][4] = 0; 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[4][0][4] = 2 | FLIP_H_BIT;
OrientationMap[5][0][4] = 1; OrientationMap[5][0][4] = 1;
@@ -18,6 +18,10 @@
package appeng.client.render.blocks; package appeng.client.render.blocks;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
@@ -27,9 +31,6 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
import appeng.block.AEBaseBlock; import appeng.block.AEBaseBlock;
import appeng.client.ClientHelper; import appeng.client.ClientHelper;
@@ -176,11 +177,11 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
String msg = Long.toString( qty ); String msg = Long.toString( qty );
if ( qty > 1000000000 ) if ( qty > 1000000000 )
msg = Long.toString( qty / 1000000000 ) + "B"; msg = Long.toString( qty / 1000000000 ) + 'B';
else if ( qty > 1000000 ) else if ( qty > 1000000 )
msg = Long.toString( qty / 1000000 ) + "M"; msg = Long.toString( qty / 1000000 ) + 'M';
else if ( qty > 9999 ) else if ( qty > 9999 )
msg = Long.toString( qty / 1000 ) + "K"; msg = Long.toString( qty / 1000 ) + 'K';
FontRenderer fr = Minecraft.getMinecraft().fontRenderer; FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( msg ); int width = fr.getStringWidth( msg );
@@ -18,14 +18,15 @@
package appeng.client.render.items; package appeng.client.render.items;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import appeng.client.texture.ExtraItemTextures; import appeng.client.texture.ExtraItemTextures;
import appeng.items.misc.ItemPaintBall; import appeng.items.misc.ItemPaintBall;
@@ -69,7 +70,7 @@ public class PaintBallRender implements IItemRenderer
int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant; int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
int r = (colorValue >> 16) & 0xff; int r = (colorValue >> 16) & 0xff;
int g = (colorValue >> 8) & 0xff; int g = (colorValue >> 8) & 0xff;
int b = (colorValue >> 0) & 0xff; int b = ( colorValue ) & 0xff;
int full = (int) (255 * 0.3); int full = (int) (255 * 0.3);
float fail = 0.7f; float fail = 0.7f;
@@ -18,8 +18,10 @@
package appeng.container.implementations; package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings; import appeng.api.config.Settings;
@@ -85,7 +87,7 @@ public class ContainerFormationPlane extends ContainerUpgradeable
} }
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" ); 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, 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, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() ); addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );
@@ -18,8 +18,10 @@
package appeng.container.implementations; package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import appeng.api.config.FullnessMode; import appeng.api.config.FullnessMode;
import appeng.api.config.OperationMode; import appeng.api.config.OperationMode;
import appeng.api.config.RedstoneMode; 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 ) ); addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" ); 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, 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, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
} }
@@ -18,6 +18,7 @@
package appeng.container.implementations; package appeng.container.implementations;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -29,6 +30,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.Settings; import appeng.api.config.Settings;
import appeng.api.config.YesNo; import appeng.api.config.YesNo;
import appeng.api.networking.IGrid; 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) 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 ); NBTTagCompound tag = data.getCompoundTag( name );
if ( tag.hasNoTags() ) if ( tag.hasNoTags() )
@@ -18,10 +18,15 @@
package appeng.container.implementations; package appeng.container.implementations;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory; 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.FuzzyMode;
import appeng.api.config.LevelType; import appeng.api.config.LevelType;
import appeng.api.config.RedstoneMode; import appeng.api.config.RedstoneMode;
@@ -33,8 +38,6 @@ import appeng.container.slot.SlotFakeTypeOnly;
import appeng.container.slot.SlotRestrictedInput; import appeng.container.slot.SlotRestrictedInput;
import appeng.parts.automation.PartLevelEmitter; import appeng.parts.automation.PartLevelEmitter;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ContainerLevelEmitter extends ContainerUpgradeable public class ContainerLevelEmitter extends ContainerUpgradeable
{ {
@@ -48,7 +51,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
public void setTextField(GuiTextField level) public void setTextField(GuiTextField level)
{ {
textField = level; textField = level;
textField.setText( "" + EmitterValue ); textField.setText( String.valueOf( EmitterValue ) );
} }
public ContainerLevelEmitter(InventoryPlayer ip, PartLevelEmitter te) { public ContainerLevelEmitter(InventoryPlayer ip, PartLevelEmitter te) {
@@ -83,7 +86,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" ); IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
if ( availableUpgrades() > 0 ) 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 ) if ( availableUpgrades() > 1 )
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() ); addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
if ( availableUpgrades() > 2 ) if ( availableUpgrades() > 2 )
@@ -127,7 +130,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
if ( field.equals( "EmitterValue" ) ) if ( field.equals( "EmitterValue" ) )
{ {
if ( textField != null ) if ( textField != null )
textField.setText( "" + EmitterValue ); textField.setText( String.valueOf( EmitterValue ) );
} }
} }
@@ -18,10 +18,12 @@
package appeng.container.implementations; package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.config.RedstoneMode; import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings; import appeng.api.config.Settings;
@@ -113,7 +115,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
offY = 17; offY = 17;
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" ); 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() ); .setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )) addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer ))
.setNotDraggable() ); .setNotDraggable() );
@@ -18,18 +18,21 @@
package appeng.container.implementations; package appeng.container.implementations;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.tileentity.TileEntity; 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.config.SecurityPermissions;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
import appeng.container.AEBaseContainer; import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync; import appeng.container.guisync.GuiSync;
import appeng.helpers.IPriorityHost; import appeng.helpers.IPriorityHost;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ContainerPriority extends AEBaseContainer public class ContainerPriority extends AEBaseContainer
{ {
@@ -43,7 +46,7 @@ public class ContainerPriority extends AEBaseContainer
public void setTextField(GuiTextField level) public void setTextField(GuiTextField level)
{ {
textField = level; textField = level;
textField.setText( "" + PriorityValue ); textField.setText( String.valueOf( PriorityValue ) );
} }
public ContainerPriority(InventoryPlayer ip, IPriorityHost te) { public ContainerPriority(InventoryPlayer ip, IPriorityHost te) {
@@ -78,7 +81,7 @@ public class ContainerPriority extends AEBaseContainer
if ( field.equals( "PriorityValue" ) ) if ( field.equals( "PriorityValue" ) )
{ {
if ( textField != null ) if ( textField != null )
textField.setText( "" + PriorityValue ); textField.setText( String.valueOf( PriorityValue ) );
} }
super.onUpdate( field, oldValue, newValue ); super.onUpdate( field, oldValue, newValue );
@@ -18,11 +18,13 @@
package appeng.container.implementations; package appeng.container.implementations;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
import appeng.api.features.INetworkEncodable; import appeng.api.features.INetworkEncodable;
@@ -145,7 +147,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
if ( networkEncodable != null ) if ( networkEncodable != null )
{ {
networkEncodable.setEncryptionKey( term, "" + securityBox.securityKey, "" ); networkEncodable.setEncryptionKey( term, String.valueOf( securityBox.securityKey ), "" );
wirelessIn.putStack( null ); wirelessIn.putStack( null );
wirelessOut.putStack( term ); wirelessOut.putStack( term );
@@ -18,11 +18,13 @@
package appeng.container.implementations; package appeng.container.implementations;
import java.util.Iterator; import java.util.Iterator;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
@@ -102,7 +104,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
} }
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" ); 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, 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, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() ); addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );
@@ -18,11 +18,13 @@
package appeng.container.implementations; package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.config.RedstoneMode; import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
@@ -107,7 +109,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
{ {
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" ); IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
if ( availableUpgrades() > 0 ) 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 ) if ( availableUpgrades() > 1 )
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() ); addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
if ( availableUpgrades() > 2 ) if ( availableUpgrades() > 2 )
+8 -5
View File
@@ -18,6 +18,7 @@
package appeng.core; package appeng.core;
import java.io.File; import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumSet; import java.util.EnumSet;
@@ -25,6 +26,12 @@ import java.util.List;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property; 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.CondenserOutput;
import appeng.api.config.PowerMultiplier; import appeng.api.config.PowerMultiplier;
import appeng.api.config.PowerUnits; import appeng.api.config.PowerUnits;
@@ -40,10 +47,6 @@ import appeng.items.materials.MaterialType;
import appeng.util.ConfigManager; import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost; import appeng.util.IConfigManagerHost;
import appeng.util.Platform; 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 public class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
{ {
@@ -156,7 +159,7 @@ public class AEConfig extends Configuration implements IConfigurableObject, ICon
@SubscribeEvent @SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
{ {
if ( eventArgs.modID.equals( AppEng.modid ) ) if ( eventArgs.modID.equals( AppEng.MOD_ID ) )
{ {
clientSync(); clientSync();
} }
+21 -19
View File
@@ -50,24 +50,26 @@ import appeng.services.VersionChecker;
import appeng.util.Platform; 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 class AppEng
{ {
public final static String modid = "appliedenergistics2"; public final static String MOD_ID = "appliedenergistics2";
public final static String name = "Applied Energistics 2"; public final static String MOD_NAME = "Applied Energistics 2";
public final static String dependencies = public final static String MOD_DEPENDENCIES =
// a few mods, AE should load after, probably. // a few mods, AE should load after, probably.
// required-after:AppliedEnergistics2API|all; // required-after:AppliedEnergistics2API|all;
// "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" + // "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
// depend on version of forge used for build. // depend on version of forge used for build.
"after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge. "after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge.
+ net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion + net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion + net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion + net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion + net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion
public static AppEng instance; public static AppEng instance;
private final IMCHandler imcHandler; private final IMCHandler imcHandler;
private String configPath; private String configPath;
public AppEng() public AppEng()
@@ -81,21 +83,21 @@ public class AppEng
public String getConfigPath() 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 @EventHandler
void PreInit( FMLPreInitializationEvent event ) void preInit( FMLPreInitializationEvent event )
{ {
if ( !Loader.isModLoaded( "appliedenergistics2-core" ) ) if ( !Loader.isModLoaded( "appliedenergistics2-core" ) )
{ {
@@ -103,10 +105,10 @@ public class AppEng
} }
Stopwatch star = Stopwatch.createStarted(); 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 ); AEConfig.instance = new AEConfig( this.configPath );
FacadeConfig.instance = new FacadeConfig( configPath ); FacadeConfig.instance = new FacadeConfig( this.configPath );
AELog.info( "Starting ( PreInit )" ); AELog.info( "Starting ( PreInit )" );
@@ -122,7 +124,7 @@ public class AppEng
if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) ) if ( AEConfig.instance.isFeatureEnabled( AEFeature.VersionChecker ) )
{ {
AELog.info( "Starting 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 )" ); AELog.info( "PreInit ( end " + star.elapsed( TimeUnit.MILLISECONDS ) + "ms )" );
@@ -136,7 +138,7 @@ public class AppEng
} }
@EventHandler @EventHandler
void Init( FMLInitializationEvent event ) void init( FMLInitializationEvent event )
{ {
Stopwatch star = Stopwatch.createStarted(); Stopwatch star = Stopwatch.createStarted();
AELog.info( "Init" ); AELog.info( "Init" );
@@ -148,7 +150,7 @@ public class AppEng
} }
@EventHandler @EventHandler
void PostInit( FMLPostInitializationEvent event ) void postInit( FMLPostInitializationEvent event )
{ {
Stopwatch star = Stopwatch.createStarted(); Stopwatch star = Stopwatch.createStarted();
AELog.info( "PostInit" ); AELog.info( "PostInit" );
+59 -56
View File
@@ -28,11 +28,11 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
@@ -57,14 +57,14 @@ import appeng.services.CompassService;
public class WorldSettings extends Configuration public class WorldSettings extends Configuration
{ {
private static final String SPAWNDATA_FOLDER = "spawndata"; 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 static WorldSettings instance;
private final List<Integer> storageCellDims = new ArrayList<Integer>(); private final List<Integer> storageCellDims = new ArrayList<Integer>();
private final File aeFolder; private final File aeFolder;
private final CompassService compass; private final CompassService compass;
private final PlayerMappings mappings; 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 long lastGridStorage;
private int lastPlayer; private int lastPlayer;
@@ -74,21 +74,21 @@ public class WorldSettings extends Configuration
this.aeFolder = aeFolder; this.aeFolder = aeFolder;
this.compass = new CompassService( 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 ); DimensionManager.registerDimension( dimID, AEConfig.instance.storageProviderID );
} }
try try
{ {
lastGridStorage = Long.parseLong( get( "Counters", "lastGridStorage", 0 ).getString() ); this.lastGridStorage = Long.parseLong( this.get( "Counters", "lastGridStorage", 0 ).getString() );
lastPlayer = get( "Counters", "lastPlayer", 0 ).getInt(); this.lastPlayer = this.get( "Counters", "lastPlayer", 0 ).getInt();
} }
catch ( NumberFormatException err ) catch ( NumberFormatException err )
{ {
lastGridStorage = 0; this.lastGridStorage = 0;
lastPlayer = 0; this.lastPlayer = 0;
} }
final ConfigCategory playerList = this.getCategory( "players" ); final ConfigCategory playerList = this.getCategory( "players" );
@@ -108,7 +108,7 @@ public class WorldSettings extends Configuration
throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() ); 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() ) if ( !compass.isDirectory() && !compass.mkdir() )
{ {
throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() ); 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 ) 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 ) synchronized ( WorldSettings.class )
{ {
@@ -139,14 +139,14 @@ public class WorldSettings extends Configuration
int cx = x + ( chunkX >> 4 ); int cx = x + ( chunkX >> 4 );
int cz = z + ( chunkZ >> 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 ) if ( data != null )
{ {
// edit. // edit.
int size = data.getInteger( "num" ); int size = data.getInteger( "num" );
for ( int s = 0; s < size; s++ ) 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" ); throw new RuntimeException( "Invalid Request" );
NBTTagCompound data = null; 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() ) if ( file.isFile() )
{ {
@@ -204,7 +204,7 @@ public class WorldSettings extends Configuration
{ {
synchronized ( WorldSettings.class ) synchronized ( WorldSettings.class )
{ {
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ ); NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
return data.getBoolean( chunkX + "," + chunkZ ); return data.getBoolean( chunkX + "," + chunkZ );
} }
} }
@@ -213,12 +213,12 @@ public class WorldSettings extends Configuration
{ {
synchronized ( WorldSettings.class ) synchronized ( WorldSettings.class )
{ {
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ ); NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
// edit. // edit.
data.setBoolean( chunkX + "," + chunkZ, true ); 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 ) ) if ( !Thread.holdsLock( WorldSettings.class ) )
throw new RuntimeException( "Invalid Request" ); 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; FileOutputStream fileOutputStream = null;
try try
@@ -259,14 +259,14 @@ public class WorldSettings extends Configuration
{ {
synchronized ( WorldSettings.class ) synchronized ( WorldSettings.class )
{ {
NBTTagCompound data = loadSpawnData( dim, chunkX, chunkZ ); NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ );
// edit. // edit.
int size = data.getInteger( "num" ); int size = data.getInteger( "num" );
data.setTag( "" + size, newData ); data.setTag( String.valueOf( size ), newData );
data.setInteger( "num", size + 1 ); data.setInteger( "num", size + 1 );
writeSpawnData( dim, chunkX, chunkZ, data ); this.writeSpawnData( dim, chunkX, chunkZ, data );
return true; return true;
} }
@@ -274,14 +274,14 @@ public class WorldSettings extends Configuration
public void shutdown() public void shutdown()
{ {
save(); this.save();
for ( Integer dimID : storageCellDims ) for ( Integer dimID : this.storageCellDims )
DimensionManager.unregisterDimension( dimID ); DimensionManager.unregisterDimension( dimID );
storageCellDims.clear(); this.storageCellDims.clear();
compass.kill(); this.compass.kill();
instance = null; instance = null;
} }
@@ -289,47 +289,47 @@ public class WorldSettings extends Configuration
public void save() public void save()
{ {
// populate new data // populate new data
for ( GridStorageSearch gs : loadedStorage.keySet() ) for ( GridStorageSearch gs : this.loadedStorage.keySet() )
{ {
GridStorage thisStorage = gs.gridStorage.get(); GridStorage thisStorage = gs.gridStorage.get();
if ( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() ) if ( thisStorage != null && thisStorage.getGrid() != null && !thisStorage.getGrid().isEmpty() )
{ {
String value = thisStorage.getValue(); String value = thisStorage.getValue();
get( "gridstorage", "" + thisStorage.getID(), value ).set( value ); this.get( "gridstorage", String.valueOf( thisStorage.getID() ), value ).set( value );
} }
} }
// save to files // save to files
if ( hasChanged() ) if ( this.hasChanged() )
super.save(); super.save();
} }
public void addStorageCellDim( int newDim ) public void addStorageCellDim( int newDim )
{ {
storageCellDims.add( newDim ); this.storageCellDims.add( newDim );
DimensionManager.registerDimension( newDim, AEConfig.instance.storageProviderID ); DimensionManager.registerDimension( newDim, AEConfig.instance.storageProviderID );
NetworkHandler.instance.sendToAll( new PacketNewStorageDimension( newDim ) ); 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++ ) 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 ); this.get( "DimensionManager", "StorageCells", new int[0] ).set( values );
save(); this.save();
} }
public CompassService getCompass() public CompassService getCompass()
{ {
return compass; return this.compass;
} }
public void sendToPlayer( NetworkManager manager, EntityPlayerMP player ) public void sendToPlayer( NetworkManager manager )
{ {
if ( manager != null ) 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() ); manager.scheduleOutboundPacket( ( new PacketNewStorageDimension( newDim ) ).getProxy() );
} }
@@ -343,23 +343,23 @@ public class WorldSettings extends Configuration
public void init() public void init()
{ {
save(); this.save();
} }
public WorldCoord getStoredSize( int dim ) public WorldCoord getStoredSize( int dim )
{ {
int x = get( "StorageCell" + dim, "scaleX", 0 ).getInt(); int x = this.get( "StorageCell" + dim, "scaleX", 0 ).getInt();
int y = get( "StorageCell" + dim, "scaleY", 0 ).getInt(); int y = this.get( "StorageCell" + dim, "scaleY", 0 ).getInt();
int z = get( "StorageCell" + dim, "scaleZ", 0 ).getInt(); int z = this.get( "StorageCell" + dim, "scaleZ", 0 ).getInt();
return new WorldCoord( x, y, z ); return new WorldCoord( x, y, z );
} }
public void setStoredSize( int dim, int targetX, int targetY, int targetZ ) public void setStoredSize( int dim, int targetX, int targetY, int targetZ )
{ {
get( "StorageCell" + dim, "scaleX", 0 ).set( targetX ); this.get( "StorageCell" + dim, "scaleX", 0 ).set( targetX );
get( "StorageCell" + dim, "scaleY", 0 ).set( targetY ); this.get( "StorageCell" + dim, "scaleY", 0 ).set( targetY );
get( "StorageCell" + dim, "scaleZ", 0 ).set( targetZ ); this.get( "StorageCell" + dim, "scaleZ", 0 ).set( targetZ );
save(); this.save();
} }
/** /**
@@ -372,16 +372,18 @@ public class WorldSettings extends Configuration
public GridStorage getGridStorage( long storageID ) public GridStorage getGridStorage( long storageID )
{ {
GridStorageSearch gss = new GridStorageSearch( 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 ) 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 ); GridStorage thisStorage = new GridStorage( Data, storageID, gss );
gss.gridStorage = new WeakReference<GridStorage>( thisStorage ); gss.gridStorage = new WeakReference<GridStorage>( thisStorage );
loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) ); this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
return thisStorage; return thisStorage;
} }
return result.get().gridStorage.get(); return result.get().gridStorage.get();
} }
@@ -390,24 +392,25 @@ public class WorldSettings extends Configuration
*/ */
public GridStorage getNewGridStorage() public GridStorage getNewGridStorage()
{ {
long storageID = nextGridStorage(); long storageID = this.nextGridStorage();
GridStorageSearch gss = new GridStorageSearch( storageID ); GridStorageSearch gss = new GridStorageSearch( storageID );
GridStorage newStorage = new GridStorage( storageID, gss ); GridStorage newStorage = new GridStorage( storageID, gss );
gss.gridStorage = new WeakReference<GridStorage>( newStorage ); gss.gridStorage = new WeakReference<GridStorage>( newStorage );
loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) ); this.loadedStorage.put( gss, new WeakReference<GridStorageSearch>( gss ) );
return newStorage; return newStorage;
} }
private long nextGridStorage() private long nextGridStorage()
{ {
long r = lastGridStorage++; long r = this.lastGridStorage++;
get( "Counters", "lastGridStorage", lastGridStorage ).set( Long.toString( lastGridStorage ) ); this.get( "Counters", "lastGridStorage", this.lastGridStorage ).set( Long.toString( this.lastGridStorage ) );
return r; return r;
} }
public void destroyGridStorage( long id ) 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 ) public int getNextOrderedValue( String name )
@@ -432,17 +435,17 @@ public class WorldSettings extends Configuration
return prop.getInt(); return prop.getInt();
else 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 this.mappings.put( prop.getInt(), profile.getId() ); // add to reverse map
save(); this.save();
return prop.getInt(); return prop.getInt();
} }
} }
private long nextPlayer() private long nextPlayer()
{ {
long r = lastPlayer++; long r = this.lastPlayer++;
get( "Counters", "lastPlayer", lastPlayer ).set( lastPlayer ); this.get( "Counters", "lastPlayer", this.lastPlayer ).set( this.lastPlayer );
return r; return r;
} }
+19 -14
View File
@@ -18,16 +18,14 @@
package appeng.core.api; package appeng.core.api;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.HashMap;
import java.util.Iterator;
import net.minecraft.entity.player.EntityPlayer; import java.util.LinkedList;
import net.minecraft.item.Item; import java.util.List;
import net.minecraft.item.ItemStack; import java.util.Map;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter; 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.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode; 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.CableRenderMode;
import appeng.api.parts.IPartHelper; import appeng.api.parts.IPartHelper;
import appeng.api.parts.IPartItem; import appeng.api.parts.IPartItem;
@@ -52,8 +59,6 @@ import appeng.parts.PartPlacement;
import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBus;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.base.Joiner;
public class ApiPart implements IPartHelper public class ApiPart implements IPartHelper
{ {
@@ -112,7 +117,7 @@ public class ApiPart implements IPartHelper
try try
{ {
ClassReader cr; ClassReader cr;
String path = "/" + name.replace( ".", "/" ) + ".class"; String path = '/' + name.replace( ".", "/" ) + ".class";
InputStream is = getClass().getResourceAsStream( path ); InputStream is = getClass().getResourceAsStream( path );
cr = new ClassReader( is ); cr = new ClassReader( is );
ClassNode cn = new ClassNode(); 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 ) if ( tileImplementations.get( description ) != null )
{ {
@@ -180,7 +185,7 @@ public class ApiPart implements IPartHelper
{ {
try try
{ {
String newPath = path + ";" + name; String newPath = path + ';' + name;
myCLass = getClassByDesc( Addendum, newPath, f, interfaces2Layer.get( Class.forName( name ) ) ); myCLass = getClassByDesc( Addendum, newPath, f, interfaces2Layer.get( Class.forName( name ) ) );
path = newPath; path = newPath;
} }
@@ -232,7 +237,7 @@ public class ApiPart implements IPartHelper
try try
{ {
n.name = n.name + "_" + Addendum; n.name = n.name + '_' + Addendum;
n.superName = Class.forName( root ).getName().replace( ".", "/" ); n.superName = Class.forName( root ).getName().replace( ".", "/" );
} }
catch (Throwable t) catch (Throwable t)
@@ -31,10 +31,10 @@ public class CrashEnhancement implements ICrashCallable
private final String name; private final String name;
private final String value; private final String value;
private final String ModVersion = AEConfig.CHANNEL + " " + AEConfig.VERSION + " for Forge " + // WHAT? private final String ModVersion = AEConfig.CHANNEL + ' ' + AEConfig.VERSION + " for Forge " + // WHAT?
net.minecraftforge.common.ForgeVersion.majorVersion + "." // majorVersion net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + "." // minorVersion + net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + "." // revisionVersion + net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion; + net.minecraftforge.common.ForgeVersion.buildVersion;
public CrashEnhancement( CrashInfo Output ) public CrashEnhancement( CrashInfo Output )
@@ -165,7 +165,7 @@ public class AEFeatureHandler implements AEItemDefinition
if ( subName.equals( "NetherQuartzTools" ) ) if ( subName.equals( "NetherQuartzTools" ) )
return name.replace( "Quartz", "NetherQuartz" ); return name.replace( "Quartz", "NetherQuartz" );
name += "." + subName; name += '.' + subName;
} }
return name; return name;
@@ -24,8 +24,8 @@ import com.google.common.base.Optional;
public class FeatureNameExtractor public class FeatureNameExtractor
{ {
private Class<?> clazz; private final Class<?> clazz;
private Optional<String> subName; private final Optional<String> subName;
public FeatureNameExtractor( Class<?> clazz, Optional<String> subName ) public FeatureNameExtractor( Class<?> clazz, Optional<String> subName )
{ {
@@ -64,7 +64,7 @@ public class FeatureNameExtractor
return name.replace( "Quartz", "NetherQuartz" ); return name.replace( "Quartz", "NetherQuartz" );
} }
name += "." + subName; name += '.' + subName;
} }
return name; return name;
@@ -26,7 +26,7 @@ import appeng.core.AEConfig;
public class FeaturedActiveChecker public class FeaturedActiveChecker
{ {
private EnumSet<AEFeature> features; private final EnumSet<AEFeature> features;
public FeaturedActiveChecker( EnumSet<AEFeature> features ) public FeaturedActiveChecker( EnumSet<AEFeature> features )
{ {
@@ -68,7 +68,7 @@ public enum ButtonToolTips
public String getUnlocalized() public String getUnlocalized()
{ {
return root + "." + toString(); return root + '.' + toString();
} }
public String getLocal() public String getLocal()
@@ -82,7 +82,7 @@ public enum GuiText
public String getUnlocalized() public String getUnlocalized()
{ {
return root + "." + toString(); return root + '.' + toString();
} }
public String getLocal() public String getLocal()
@@ -41,7 +41,7 @@ public enum WailaText
public String getUnlocalized() public String getUnlocalized()
{ {
return root + "." + toString(); return root + '.' + toString();
} }
public String getLocal() public String getLocal()
@@ -18,10 +18,10 @@
package appeng.core.sync.network; package appeng.core.sync.network;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer; 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.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; 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.FMLNetworkEvent.ServerCustomPacketEvent;
import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry;
import appeng.core.WorldSettings;
import appeng.core.sync.AppEngPacket;
public class NetworkHandler public class NetworkHandler
{ {
@@ -78,14 +81,14 @@ public class NetworkHandler
@SubscribeEvent @SubscribeEvent
public void newConnection(ServerConnectionFromClientEvent ev) public void newConnection(ServerConnectionFromClientEvent ev)
{ {
WorldSettings.getInstance().sendToPlayer( ev.manager, null ); WorldSettings.getInstance().sendToPlayer( ev.manager );
} }
@SubscribeEvent @SubscribeEvent
public void newConnection(PlayerLoggedInEvent loginEvent) public void newConnection(PlayerLoggedInEvent loginEvent)
{ {
if ( loginEvent.player instanceof EntityPlayerMP ) if ( loginEvent.player instanceof EntityPlayerMP )
WorldSettings.getInstance().sendToPlayer( null, (EntityPlayerMP) loginEvent.player ); WorldSettings.getInstance().sendToPlayer( null );
} }
@SubscribeEvent @SubscribeEvent
@@ -18,11 +18,13 @@
package appeng.crafting; package appeng.crafting;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
@@ -79,7 +81,7 @@ public class CraftingTreeNode
// order. // order.
{ {
if ( parent == null || parent.notRecursive( details ) ) 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 ) );
} }
} }
@@ -18,6 +18,7 @@
package appeng.crafting; package appeng.crafting;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -26,6 +27,9 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import cpw.mods.fml.common.FMLCommonHandler;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.networking.crafting.ICraftingGrid; import appeng.api.networking.crafting.ICraftingGrid;
@@ -36,7 +40,6 @@ import appeng.api.storage.data.IItemList;
import appeng.container.ContainerNull; import appeng.container.ContainerNull;
import appeng.me.cluster.implementations.CraftingCPUCluster; import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.common.FMLCommonHandler;
public class CraftingTreeProcess public class CraftingTreeProcess
{ {
@@ -57,12 +60,12 @@ public class CraftingTreeProcess
final Map<CraftingTreeNode, Long> nodes = new HashMap<CraftingTreeNode, Long>(); final Map<CraftingTreeNode, Long> nodes = new HashMap<CraftingTreeNode, Long>();
public boolean possible = true; 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; parent = craftingTreeNode;
this.details = details; this.details = details;
this.job = job; this.job = job;
this.depth = depth; this.depth = depth;
world = job.getWorld(); World world = job.getWorld();
if ( details.isCraftable() ) if ( details.isCraftable() )
{ {
@@ -18,6 +18,7 @@
package appeng.helpers; package appeng.helpers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@@ -31,6 +32,7 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.networking.crafting.ICraftingPatternDetails; import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IAEItemStack;
@@ -88,8 +90,19 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
TestLookup b = (TestLookup) obj; final boolean equality;
return b.slot == slot && b.ref == ref;
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; break;
} }
if ( !isCrafting )
return false;
for (int x = 0; x < crafting.getSizeInventory(); x++) for (int x = 0; x < crafting.getSizeInventory(); x++)
testFrame.setInventorySlotContents( x, crafting.getStackInSlot( x ) ); testFrame.setInventorySlotContents( x, crafting.getStackInSlot( x ) );
@@ -304,7 +314,6 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
@Override @Override
public boolean canSubstitute() public boolean canSubstitute()
{ {
// TODO Auto-generated method stub
return false; return false;
} }
@@ -18,12 +18,14 @@
package appeng.integration; package appeng.integration;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import cpw.mods.fml.common.Loader;
import appeng.api.exceptions.ModNotInstalled; import appeng.api.exceptions.ModNotInstalled;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.AELog; import appeng.core.AELog;
import cpw.mods.fml.common.Loader;
public class IntegrationNode public class IntegrationNode
{ {
@@ -51,7 +53,7 @@ public class IntegrationNode
@Override @Override
public String toString() public String toString()
{ {
return shortName.name() + ":" + state.name(); return shortName.name() + ':' + state.name();
} }
void Call(IntegrationStage stage) void Call(IntegrationStage stage)
@@ -18,9 +18,9 @@
package appeng.integration.modules; package appeng.integration.modules;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@@ -28,6 +28,20 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection; 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.AEApi;
import appeng.api.config.TunnelType; import appeng.api.config.TunnelType;
import appeng.api.definitions.Blocks; import appeng.api.definitions.Blocks;
@@ -41,18 +55,8 @@ import appeng.integration.BaseModule;
import appeng.integration.abstraction.IBC; import appeng.integration.abstraction.IBC;
import appeng.integration.modules.BCHelpers.AECableSchematicTile; import appeng.integration.modules.BCHelpers.AECableSchematicTile;
import appeng.integration.modules.BCHelpers.AEGenericSchematicTile; import appeng.integration.modules.BCHelpers.AEGenericSchematicTile;
import appeng.integration.modules.BCHelpers.AERotatableBlockSchematic;
import appeng.integration.modules.BCHelpers.BCPipeHandler; 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 public class BC extends BaseModule implements IBC
{ {
@@ -253,7 +257,7 @@ public class BC extends BaseModule implements IBC
private void initBuilderSupport() private void initBuilderSupport()
{ {
SchematicRegistry.declareBlueprintSupport( AppEng.modid ); SchematicRegistry.declareBlueprintSupport( AppEng.MOD_ID );
Blocks blocks = AEApi.instance().blocks(); Blocks blocks = AEApi.instance().blocks();
Block cable = blocks.blockMultiPart.block(); Block cable = blocks.blockMultiPart.block();
@@ -46,7 +46,7 @@ public class CLApi extends BaseModule implements ICLApi
float r = (mv >> 16) & 0xff; float r = (mv >> 16) & 0xff;
float g = (mv >> 8) & 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 ); return coloredlightscore.src.api.CLApi.makeRGBLightValue( r / 255.0f, g / 255.0f, b / 255.0f, light / 15.0f );
} }
@@ -18,6 +18,7 @@
package appeng.integration.modules; package appeng.integration.modules;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; 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.client.renderer.entity.RenderItem;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; 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.AEBaseMEGui;
import appeng.client.gui.implementations.GuiCraftingTerm; import appeng.client.gui.implementations.GuiCraftingTerm;
import appeng.client.gui.implementations.GuiPatternTerm; 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.NEIInscriberRecipeHandler;
import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler; import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler;
import appeng.integration.modules.NEIHelpers.TerminalCraftingSlotFinder; 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 public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
{ {
@@ -127,7 +130,7 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
int y = s.yDisplayPosition; int y = s.yDisplayPosition;
GuiContainerManager.drawItems.renderItemAndEffectIntoGUI( fontRenderer, mc.getTextureManager(), stack, x, y ); 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 @Override
@@ -18,14 +18,9 @@
package appeng.integration.modules; package appeng.integration.modules;
import java.util.List; 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.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -33,6 +28,16 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; 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.IPowerChannelState;
import appeng.api.implementations.parts.IPartStorageMonitor; import appeng.api.implementations.parts.IPartStorageMonitor;
import appeng.api.parts.IPartHost; import appeng.api.parts.IPartHost;
@@ -52,7 +57,6 @@ import appeng.tile.misc.TileCharger;
import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileEnergyCell; import appeng.tile.networking.TileEnergyCell;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.common.event.FMLInterModComms;
public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPProvider 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" ) ) if ( ic != null && ic.hasKey( "usedChannels" ) )
{ {
int channels = ic.getByte( "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() ); + WailaText.Channels.getLocal() );
} }
} }
@@ -18,6 +18,7 @@
package appeng.items.materials; package appeng.items.materials;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@@ -45,6 +46,9 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import com.google.common.collect.ImmutableSet;
import appeng.api.config.Upgrades; import appeng.api.config.Upgrades;
import appeng.api.implementations.IUpgradeableHost; import appeng.api.implementations.IUpgradeableHost;
import appeng.api.implementations.items.IItemGroup; import appeng.api.implementations.items.IItemGroup;
@@ -62,8 +66,6 @@ import appeng.items.AEBaseItem;
import appeng.util.InventoryAdaptor; import appeng.util.InventoryAdaptor;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.collect.ImmutableSet;
public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent, IUpgradeModule 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(); IItemGroup ig = (IItemGroup) j.getKey().getItem();
String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() ); String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
if ( str != null ) if ( str != null )
name = Platform.gui_localize( str ) + (limit > 1 ? " (" + limit + ")" : ""); name = Platform.gui_localize( str ) + (limit > 1 ? " (" + limit + ')' : "");
} }
if ( name == null ) if ( name == null )
name = j.getKey().getDisplayName() + (limit > 1 ? " (" + limit + ")" : ""); name = j.getKey().getDisplayName() + (limit > 1 ? " (" + limit + ')' : "");
if ( !textList.contains( name ) ) if ( !textList.contains( name ) )
textList.add( name ); textList.add( name );
@@ -18,6 +18,7 @@
package appeng.items.misc; package appeng.items.misc;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.WeakHashMap; import java.util.WeakHashMap;
@@ -28,6 +29,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.implementations.ICraftingPatternItem; import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.networking.crafting.ICraftingPatternDetails; import appeng.api.networking.crafting.ICraftingPatternDetails;
@@ -103,7 +105,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
IAEItemStack[] out = details.getCondensedOutputs(); IAEItemStack[] out = details.getCondensedOutputs();
String label = (isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal()) + ": "; String label = (isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal()) + ": ";
String and = " " + GuiText.And.getLocal() + " "; String and = ' ' + GuiText.And.getLocal() + ' ';
String with = GuiText.With.getLocal() + ": "; String with = GuiText.With.getLocal() + ": ";
boolean first = true; boolean first = true;
@@ -114,7 +116,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
continue; continue;
} }
lines.add( (first ? label : and) + anOut.getStackSize() + " " + Platform.getItemDisplayName( anOut ) ); lines.add( (first ? label : and) + anOut.getStackSize() + ' ' + Platform.getItemDisplayName( anOut ) );
first = false; first = false;
} }
@@ -126,7 +128,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
continue; continue;
} }
lines.add( (first ? with : and) + anIn.getStackSize() + " " + Platform.getItemDisplayName( anIn ) ); lines.add( (first ? with : and) + anIn.getStackSize() + ' ' + Platform.getItemDisplayName( anIn ) );
first = false; first = false;
} }
} }
@@ -18,6 +18,7 @@
package appeng.items.misc; package appeng.items.misc;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@@ -25,6 +26,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import appeng.client.render.items.PaintBallRender; import appeng.client.render.items.PaintBallRender;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
@@ -51,7 +53,7 @@ public class ItemPaintBall extends AEBaseItem
public String getExtraName(ItemStack is) 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) public AEColor getColor(ItemStack is)
@@ -23,8 +23,6 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.google.common.base.Optional;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@@ -32,6 +30,8 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.google.common.base.Optional;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.config.IncludeExclude; import appeng.api.config.IncludeExclude;
@@ -106,12 +106,12 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
if ( cellInventory != null ) if ( cellInventory != null )
{ {
lines.add( cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + " " lines.add( cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + ' '
+ cellInventory.getTotalBytes() + " " + cellInventory.getTotalBytes() + ' '
+ GuiText.BytesUsed.getLocal() ); + GuiText.BytesUsed.getLocal() );
lines.add( cellInventory.getStoredItemTypes() + " " + GuiText.Of.getLocal() lines.add( cellInventory.getStoredItemTypes() + " " + GuiText.Of.getLocal()
+ " " + cellInventory.getTotalItemTypes() + " " + ' ' + cellInventory.getTotalItemTypes() + ' '
+ GuiText.Types.getLocal() ); + GuiText.Types.getLocal() );
if ( handler.isPreformatted() ) if ( handler.isPreformatted() )
@@ -120,9 +120,9 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
: GuiText.Excluded ).getLocal(); : GuiText.Excluded ).getLocal();
if ( handler.isFuzzy() ) if ( handler.isFuzzy() )
lines.add( GuiText.Partitioned.getLocal() + " - " + List + " " + GuiText.Fuzzy.getLocal() ); lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Fuzzy.getLocal() );
else else
lines.add( GuiText.Partitioned.getLocal() + " - " + List + " " + GuiText.Precise.getLocal() ); lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Precise.getLocal() );
} }
} }
@@ -18,6 +18,7 @@
package appeng.items.tools; package appeng.items.tools;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
@@ -26,6 +27,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import appeng.api.implementations.items.IMemoryCard; import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages; import appeng.api.implementations.items.MemoryCardMessages;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
@@ -93,7 +95,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{ {
NBTTagCompound c = Platform.openNbtData( is ); NBTTagCompound c = Platform.openNbtData( is );
String name = c.getString( "Config" ); String name = c.getString( "Config" );
return name == null || name.equals( "" ) ? GuiText.Blank.getUnlocalized() : name; return name == null || name.isEmpty() ? GuiText.Blank.getUnlocalized() : name;
} }
@Override @Override
@@ -28,8 +28,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import com.google.common.base.Optional;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser; import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -44,6 +42,8 @@ import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import com.google.common.base.Optional;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
@@ -403,8 +403,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv(); ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null ) if ( cd != null )
{ {
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.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() ); lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
} }
} }
} }
@@ -22,8 +22,6 @@ package appeng.items.tools.powered;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser; import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@@ -43,6 +41,8 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import com.google.common.base.Optional;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
@@ -107,8 +107,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv(); ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null ) if ( cd != null )
{ {
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.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() ); lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
} }
} }
} }
@@ -23,15 +23,17 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Set; 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.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; 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.AEApi;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.implementations.guiobjects.IGuiItem; import appeng.api.implementations.guiobjects.IGuiItem;
@@ -90,8 +92,8 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv(); ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
if ( cd != null ) if ( cd != null )
{ {
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.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() ); lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
} }
} }
} }
@@ -22,15 +22,17 @@ package appeng.items.tools.powered;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; 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.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; 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.AEApi;
import appeng.api.config.Settings; import appeng.api.config.Settings;
import appeng.api.config.SortDir; import appeng.api.config.SortDir;
@@ -83,7 +85,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
{ {
String encKey = tag.getString( "encryptionKey" ); String encKey = tag.getString( "encryptionKey" );
if ( encKey == null || encKey.equals( "" ) ) if ( encKey == null || encKey.isEmpty() )
lines.add( GuiText.Unlinked.getLocal() ); lines.add( GuiText.Unlinked.getLocal() );
else else
lines.add( GuiText.Linked.getLocal() ); lines.add( GuiText.Linked.getLocal() );
@@ -22,14 +22,14 @@ package appeng.items.tools.powered.powersink;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.List; import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import com.google.common.base.Optional;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.PowerUnits; import appeng.api.config.PowerUnits;
import appeng.api.implementations.items.IAEItemPowerStorage; import appeng.api.implementations.items.IAEItemPowerStorage;
@@ -66,7 +66,7 @@ public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
double percent = internalCurrentPower / internalMaxPower; 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 ) ); + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
} }
@@ -18,7 +18,12 @@
package appeng.me.cluster.implementations; 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 java.util.Map.Entry;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
@@ -27,6 +32,12 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; 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.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
@@ -68,11 +79,6 @@ import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.item.AEItemStack; 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 public class CraftingCPUCluster implements IAECluster, ICraftingCPU
{ {
@@ -864,7 +870,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
int hash = System.identityHashCode( this ); int hash = System.identityHashCode( this );
int hmm = finalOutput == null ? 0 : finalOutput.hashCode(); 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 ); + Integer.toString( hmm, Character.MAX_RADIX );
} }
@@ -1102,7 +1108,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
if ( te.hasCustomName() ) if ( te.hasCustomName() )
{ {
if ( myName.length() > 0 ) if ( myName.length() > 0 )
myName += " " + te.getCustomName(); myName += ' ' + te.getCustomName();
else else
myName = te.getCustomName(); myName = te.getCustomName();
} }
@@ -20,6 +20,7 @@ package appeng.parts.misc;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderBlocks;
@@ -485,7 +486,7 @@ public class PartStorageBus
{ {
IMEInventoryHandler out = proxy.isActive() ? getInternalHandler() : null; IMEInventoryHandler out = proxy.isActive() ? getInternalHandler() : null;
if ( out != null ) if ( out != null )
return Arrays.asList( out ); return Collections.singletonList( out );
} }
return Arrays.asList( new IMEInventoryHandler[] {} ); return Arrays.asList( new IMEInventoryHandler[] {} );
} }
@@ -18,7 +18,7 @@
package appeng.parts.p2p; package appeng.parts.p2p;
import appeng.integration.abstraction.helpers.BaseMJPerdition;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@@ -26,6 +26,18 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; 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.PowerUnits;
import appeng.api.config.TunnelType; import appeng.api.config.TunnelType;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
@@ -37,20 +49,12 @@ import appeng.core.settings.TickRates;
import appeng.integration.IntegrationType; import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IMJ5; import appeng.integration.abstraction.IMJ5;
import appeng.integration.abstraction.IMJ6; import appeng.integration.abstraction.IMJ6;
import appeng.integration.abstraction.helpers.BaseMJPerdition;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection; import appeng.me.cache.helpers.TunnelCollection;
import appeng.transformer.annotations.integration.Interface; import appeng.transformer.annotations.integration.Interface;
import appeng.transformer.annotations.integration.InterfaceList; import appeng.transformer.annotations.integration.InterfaceList;
import appeng.transformer.annotations.integration.Method; 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"), @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"), @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") @Method(iname = "MJ5")
public PowerReceiver getPowerReceiver(ForgeDirection side) public PowerReceiver getPowerReceiver(ForgeDirection side)
{ {
if ( side.equals( side ) ) return pp.getPowerReceiver();
return pp.getPowerReceiver();
return null;
} }
@Override @Override
@@ -18,7 +18,8 @@
package appeng.parts.reporting; package appeng.parts.reporting;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -26,6 +27,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.networking.energy.IEnergySource; import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.PlayerSource; import appeng.api.networking.security.PlayerSource;
import appeng.api.storage.IMEMonitor; import appeng.api.storage.IMEMonitor;
@@ -133,7 +135,7 @@ public class PartConversionMonitor extends PartStorageMonitor
if ( newItems != null ) if ( newItems != null )
{ {
TileEntity te = tile; 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 ); Platform.spawnDrops( player.worldObj, te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ, list );
} }
@@ -18,10 +18,14 @@
package appeng.parts.reporting; package appeng.parts.reporting;
import io.netty.buffer.ByteBuf;
import java.io.IOException; 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.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
@@ -36,8 +40,8 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11; import cpw.mods.fml.relauncher.Side;
import org.lwjgl.opengl.GL12; import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.implementations.parts.IPartStorageMonitor; import appeng.api.implementations.parts.IPartStorageMonitor;
import appeng.api.networking.security.BaseActionSource; import appeng.api.networking.security.BaseActionSource;
@@ -56,8 +60,6 @@ import appeng.core.localization.PlayerMessages;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.util.Platform; import appeng.util.Platform;
import appeng.util.item.AEItemStack; 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 public class PartStorageMonitor extends PartMonitor implements IPartStorageMonitor, IStackWatcherHost
{ {
@@ -304,11 +306,11 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
String msg = Long.toString( qty ); String msg = Long.toString( qty );
if ( qty > 1000000000 ) if ( qty > 1000000000 )
msg = Long.toString( qty / 1000000000 ) + "B"; msg = Long.toString( qty / 1000000000 ) + 'B';
else if ( qty > 1000000 ) else if ( qty > 1000000 )
msg = Long.toString( qty / 1000000 ) + "M"; msg = Long.toString( qty / 1000000 ) + 'M';
else if ( qty > 9999 ) else if ( qty > 9999 )
msg = Long.toString( qty / 1000 ) + "K"; msg = Long.toString( qty / 1000 ) + 'K';
FontRenderer fr = Minecraft.getMinecraft().fontRenderer; FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( msg ); int width = fr.getStringWidth( msg );
@@ -18,7 +18,9 @@
package appeng.recipes; package appeng.recipes;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.recipes.ISubItemResolver; import appeng.api.recipes.ISubItemResolver;
import appeng.api.recipes.ResolverResult; import appeng.api.recipes.ResolverResult;
@@ -39,7 +41,7 @@ public class AEItemResolver implements ISubItemResolver
public Object resolveItemByName(String nameSpace, String itemName) public Object resolveItemByName(String nameSpace, String itemName)
{ {
if ( nameSpace.equals( AppEng.modid ) ) if ( nameSpace.equals( AppEng.MOD_ID ) )
{ {
if ( itemName.startsWith( "PaintBall." ) ) if ( itemName.startsWith( "PaintBall." ) )
{ {
+5 -2
View File
@@ -18,6 +18,7 @@
package appeng.recipes; package appeng.recipes;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -25,6 +26,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError; import appeng.api.exceptions.RecipeError;
@@ -32,7 +36,6 @@ import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.IIngredient; import appeng.api.recipes.IIngredient;
import appeng.api.recipes.ResolverResult; import appeng.api.recipes.ResolverResult;
import appeng.api.recipes.ResolverResultSet; import appeng.api.recipes.ResolverResultSet;
import cpw.mods.fml.common.registry.GameRegistry;
public class Ingredient implements IIngredient public class Ingredient implements IIngredient
{ {
@@ -183,7 +186,7 @@ public class Ingredient implements IIngredient
@Override @Override
public String toString() public String toString()
{ {
return nameSpace + ":" + itemName + ":" + meta; return nameSpace + ':' + itemName + ':' + meta;
} }
@Override @Override
+15 -13
View File
@@ -18,6 +18,7 @@
package appeng.recipes; package appeng.recipes;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@@ -29,8 +30,14 @@ import java.util.Map.Entry;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import appeng.recipes.handlers.IWebsiteSerializer;
import net.minecraft.item.ItemStack; 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.AEApi;
import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError; import appeng.api.exceptions.RecipeError;
@@ -47,14 +54,9 @@ import appeng.core.features.AEFeature;
import appeng.items.materials.ItemMultiMaterial; import appeng.items.materials.ItemMultiMaterial;
import appeng.items.misc.ItemCrystalSeed; import appeng.items.misc.ItemCrystalSeed;
import appeng.items.parts.ItemMultiPart; import appeng.items.parts.ItemMultiPart;
import appeng.recipes.handlers.IWebsiteSerializer;
import appeng.recipes.handlers.OreRegistration; 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 public class RecipeHandler implements IRecipeHandler
{ {
@@ -203,7 +205,7 @@ public class RecipeHandler implements IRecipeHandler
String rew = ws.getPattern( this ); String rew = ws.getPattern( this );
if ( rew != null && rew.length() > 0 ) if ( rew != null && rew.length() > 0 )
{ {
out.putNextEntry( new ZipEntry( realName + "_" + offset + ".txt" ) ); out.putNextEntry( new ZipEntry( realName + '_' + offset + ".txt" ) );
offset++; offset++;
out.write( rew.getBytes() ); out.write( rew.getBytes() );
} }
@@ -245,15 +247,15 @@ public class RecipeHandler implements IRecipeHandler
// :P // :P
} }
return i.getNameSpace() + ":" + i.getItemName(); return i.getNameSpace() + ':' + i.getItemName();
} }
public String getName(ItemStack is) throws RecipeError public String getName(ItemStack is) throws RecipeError
{ {
UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor( is.getItem() ); 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" ); throw new RecipeError( "Not applicable for website" );
if ( is.getItem() == AEApi.instance().items().itemCrystalSeed.item() ) if ( is.getItem() == AEApi.instance().items().itemCrystalSeed.item() )
@@ -321,12 +323,12 @@ public class RecipeHandler implements IRecipeHandler
else if ( is.getItem() instanceof ItemMultiMaterial ) else if ( is.getItem() instanceof ItemMultiMaterial )
{ {
realName = realName.replace( "ItemMultiMaterial", "ItemMaterial" ); 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 ) else if ( is.getItem() instanceof ItemMultiPart )
{ {
realName = realName.replace( "ItemMultiPart", "ItemPart" ); realName = realName.replace( "ItemMultiPart", "ItemPart" );
realName += "." + ((ItemMultiPart) is.getItem()).getTypeByStack( is ).name(); realName += '.' + ((ItemMultiPart) is.getItem()).getTypeByStack( is ).name();
} }
else if ( is.getItemDamage() > 0 ) else if ( is.getItemDamage() > 0 )
realName += "." + is.getItemDamage(); realName += "." + is.getItemDamage();
@@ -18,9 +18,11 @@
package appeng.recipes.handlers; package appeng.recipes.handlers;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError; import appeng.api.exceptions.RecipeError;
@@ -67,7 +69,7 @@ public class Grind implements ICraftHandler, IWebsiteSerializer
@Override @Override
public String getPattern( RecipeHandler h ) { public String getPattern( RecipeHandler h ) {
return "grind\n"+ return "grind\n"+
h.getName(pro_input)+"\n"+ h.getName(pro_input)+ '\n' +
h.getName(pro_output[0]); h.getName(pro_output[0]);
} }
@@ -18,12 +18,14 @@
package appeng.recipes.handlers; package appeng.recipes.handlers;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError; import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError; import appeng.api.exceptions.RegistrationError;
@@ -117,17 +119,17 @@ public class Inscribe implements ICraftHandler, IWebsiteSerializer
@Override @Override
public String getPattern(RecipeHandler h) 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 ) if ( plateA != null )
o += h.getName( plateA )+"\n"; o += h.getName( plateA )+ '\n';
o += h.getName(imprintable); o += h.getName(imprintable);
if ( plateB != null ) if ( plateB != null )
o += "\n"+h.getName( plateB ); o += '\n' +h.getName( plateB );
return o; return o;
} }
@@ -18,10 +18,14 @@
package appeng.recipes.handlers; package appeng.recipes.handlers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError; import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError; import appeng.api.exceptions.RegistrationError;
@@ -31,7 +35,6 @@ import appeng.core.AELog;
import appeng.recipes.RecipeHandler; import appeng.recipes.RecipeHandler;
import appeng.recipes.game.ShapedRecipe; import appeng.recipes.game.ShapedRecipe;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class Shaped implements ICraftHandler, IWebsiteSerializer public class Shaped implements ICraftHandler, IWebsiteSerializer
{ {
@@ -86,7 +89,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
for (int x = 0; x < cols; x++) for (int x = 0; x < cols; x++)
{ {
if ( inputs.get( y ).get( x ).isAir() ) if ( inputs.get( y ).get( x ).isAir() )
row.append( " " ); row.append( ' ' );
else else
{ {
row.append( first ); row.append( first );
@@ -136,9 +139,9 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
@Override @Override
public String getPattern(RecipeHandler h) 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 y = 0; y < rows; y++)
for (int x = 0; x < cols; x++) for (int x = 0; x < cols; x++)
@@ -18,10 +18,14 @@
package appeng.recipes.handlers; package appeng.recipes.handlers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError; import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError; import appeng.api.exceptions.RegistrationError;
@@ -31,7 +35,6 @@ import appeng.core.AELog;
import appeng.recipes.RecipeHandler; import appeng.recipes.RecipeHandler;
import appeng.recipes.game.ShapelessRecipe; import appeng.recipes.game.ShapelessRecipe;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class Shapeless implements ICraftHandler, IWebsiteSerializer public class Shapeless implements ICraftHandler, IWebsiteSerializer
{ {
@@ -100,9 +103,9 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
@Override @Override
public String getPattern(RecipeHandler h) 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++) for (int y = 0; y < inputs.size(); y++)
{ {
@@ -119,11 +122,11 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
if ( y + 1 == this.inputs.size() ) if ( y + 1 == this.inputs.size() )
{ {
o.append( "\n" ); o.append( '\n' );
} }
else else
{ {
o.append( " " ); o.append( ' ' );
} }
} }
@@ -18,9 +18,13 @@
package appeng.recipes.handlers; package appeng.recipes.handlers;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import appeng.api.exceptions.MissingIngredientError; import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RecipeError; import appeng.api.exceptions.RecipeError;
import appeng.api.exceptions.RegistrationError; import appeng.api.exceptions.RegistrationError;
@@ -28,7 +32,6 @@ import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient; import appeng.api.recipes.IIngredient;
import appeng.recipes.RecipeHandler; import appeng.recipes.RecipeHandler;
import appeng.util.Platform; import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class Smelt implements ICraftHandler, IWebsiteSerializer public class Smelt implements ICraftHandler, IWebsiteSerializer
{ {
@@ -72,8 +75,8 @@ public class Smelt implements ICraftHandler, IWebsiteSerializer
@Override @Override
public String getPattern( RecipeHandler h ) { public String getPattern( RecipeHandler h ) {
return "smelt "+out.getQty()+"\n"+ return "smelt "+out.getQty()+ '\n' +
h.getName(out)+"\n"+ h.getName(out)+ '\n' +
h.getName(in); h.getName(in);
} }
} }
@@ -18,16 +18,19 @@
package appeng.server.subcommands; package appeng.server.subcommands;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.ChatComponentTranslation;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.ChunkEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.server.ISubCommand; import appeng.server.ISubCommand;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ChunkLogger implements ISubCommand public class ChunkLogger implements ISubCommand
{ {
@@ -52,7 +55,7 @@ public class ChunkLogger implements ISubCommand
for (StackTraceElement e : Thread.currentThread().getStackTrace()) for (StackTraceElement e : Thread.currentThread().getStackTrace())
{ {
if ( output ) if ( output )
AELog.info( " " + e.getClassName() + "." + e.getMethodName() + " (" + e.getLineNumber() + ")" ); AELog.info( " " + e.getClassName() + '.' + e.getMethodName() + " (" + e.getLineNumber() + ')' );
else else
{ {
output = e.getClassName().contains( "EventBus" ) && e.getMethodName().contains( "post" ); output = e.getClassName().contains( "EventBus" ) && e.getMethodName().contains( "post" );
@@ -18,6 +18,7 @@
package appeng.services; package appeng.services;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
@@ -25,16 +26,17 @@ import java.net.URLConnection;
import java.util.Date; import java.util.Date;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import appeng.core.AEConfig;
import appeng.core.AELog; import cpw.mods.fml.common.event.FMLInterModComms;
import appeng.core.AppEng;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; 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 public class VersionChecker implements Runnable
{ {
@@ -73,7 +75,7 @@ public class VersionChecker implements Runnable
+ AEConfig.VERSION ); + AEConfig.VERSION );
URLConnection yc = url.openConnection(); 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() ) ); BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream() ) );
StringBuilder Version = new StringBuilder(); StringBuilder Version = new StringBuilder();
@@ -185,6 +185,6 @@ public class CompassRegion
AELog.info( "Failed to create AE2/compass/" ); 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" );
} }
} }
@@ -18,7 +18,7 @@
package appeng.tile.crafting; package appeng.tile.crafting;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Iterator; import java.util.Iterator;
@@ -28,6 +28,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
import appeng.api.implementations.IPowerChannelState; import appeng.api.implementations.IPowerChannelState;
@@ -295,7 +296,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
WorldCoord wc = places.poll(); WorldCoord wc = places.poll();
places.add( wc ); 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() ) );
} }
} }
@@ -18,16 +18,18 @@
package appeng.tile.grindstone; package appeng.tile.grindstone;
import io.netty.buffer.ByteBuf;
import java.util.Arrays; import java.util.Collections;
import java.util.List; import java.util.List;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.implementations.tiles.ICrankable; import appeng.api.implementations.tiles.ICrankable;
import appeng.helpers.ICustomCollision; import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
@@ -139,8 +141,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
double xOff = -0.15 * getUp().offsetX; double xOff = -0.15 * getUp().offsetX;
double yOff = -0.15 * getUp().offsetY; double yOff = -0.15 * getUp().offsetY;
double zOff = -0.15 * getUp().offsetZ; double zOff = -0.15 * getUp().offsetZ;
return Arrays return Collections.singletonList( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
.asList( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
} }
@Override @Override
@@ -18,13 +18,13 @@
package appeng.tile.misc; package appeng.tile.misc;
import appeng.helpers.PlayerSecurityWrapper;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@@ -34,6 +34,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi; import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions; import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings; import appeng.api.config.Settings;
@@ -62,6 +63,7 @@ import appeng.api.util.AECableType;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord; import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager; import appeng.api.util.IConfigManager;
import appeng.helpers.PlayerSecurityWrapper;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.me.storage.SecurityInventory; import appeng.me.storage.SecurityInventory;
import appeng.tile.TileEvent; import appeng.tile.TileEvent;
@@ -174,7 +176,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
{ {
NBTTagCompound it = new NBTTagCompound(); NBTTagCompound it = new NBTTagCompound();
ais.getItemStack().writeToNBT( it ); ais.getItemStack().writeToNBT( it );
storedItems.setTag( "" + (offset++), it ); storedItems.setTag( String.valueOf( offset++ ), it );
} }
data.setTag( "storedItems", storedItems ); data.setTag( "storedItems", storedItems );
@@ -18,16 +18,13 @@
package appeng.tile.storage; 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.ArrayList;
import java.util.Arrays; import java.util.Collections;
import java.util.List; import java.util.List;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@@ -38,10 +35,21 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
import appeng.api.AEApi; 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.IColorableTile;
import appeng.api.implementations.tiles.IMEChest; import appeng.api.implementations.tiles.IMEChest;
import appeng.api.networking.GridFlags; 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.energy.IEnergyGrid;
import appeng.api.networking.events.MENetworkCellArrayUpdate; import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.events.MENetworkChannelsChanged; 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.MENetworkPowerStatusChange;
import appeng.api.networking.events.MENetworkPowerStorage; import appeng.api.networking.events.MENetworkPowerStorage;
import appeng.api.networking.events.MENetworkPowerStorage.PowerEventType; 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.IBaseMonitor;
import appeng.api.networking.storage.IStorageGrid; import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.ICellHandler; import appeng.api.storage.ICellHandler;
@@ -593,7 +606,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{ {
try try
{ {
return Arrays.asList( getHandler( channel ) ); return Collections.singletonList( getHandler( channel ) );
} }
catch (ChestNoHandler e) catch (ChestNoHandler e)
{ {
+14 -10
View File
@@ -18,6 +18,7 @@
package appeng.util; package appeng.util;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@@ -31,7 +32,6 @@ import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import appeng.util.item.OreReference;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator; 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.FakePlayerFactory;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary; 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.AEApi;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable; import appeng.api.config.Actionable;
@@ -125,14 +135,8 @@ import appeng.me.helpers.AENetworkProxy;
import appeng.util.item.AEItemStack; import appeng.util.item.AEItemStack;
import appeng.util.item.AESharedNBT; import appeng.util.item.AESharedNBT;
import appeng.util.item.OreHelper; import appeng.util.item.OreHelper;
import appeng.util.item.OreReference;
import appeng.util.prioitylist.IPartitionList; 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 public class Platform
{ {
@@ -194,7 +198,7 @@ public class Platform
} }
DecimalFormat df = new DecimalFormat( "#.##" ); 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) public static ForgeDirection crossProduct(ForgeDirection forward, ForgeDirection up)
@@ -849,7 +853,7 @@ public class Platform
try try
{ {
String name = itemStack.getDisplayName(); String name = itemStack.getDisplayName();
if ( name == null || name.equals( "" ) ) if ( name == null || name.isEmpty() )
name = itemStack.getItem().getUnlocalizedName( itemStack ); name = itemStack.getItem().getUnlocalizedName( itemStack );
return name == null ? "** Null" : name; return name == null ? "** Null" : name;
} }