Compare commits

..

46 Commits

Author SHA1 Message Date
thatsIch bbde2443e1 Merge pull request #1335 from TheVikingWarrior/patch-3
Update it_IT.lang
2015-04-26 16:54:21 +02:00
thatsIch ad2f63ba0d Merge pull request #1328 from thatsIch/b-1327-wrong-container
Fixes #1327: Prevents crash when configuring a GUI
2015-04-26 16:46:06 +02:00
TheVikingWarrior ee977720ca Update it_IT.lang 2015-04-26 15:48:53 +02:00
thatsIch ca953f4596 Fixes #1327: Prevents crash when configuring a GUI 2015-04-25 20:09:53 +02:00
thatsIch 2adc055536 Merge pull request #1276 from thatsIch/b-1186-disassembling-storage-missing-upgrades
Fixes #1186: Storage Cells drop upgrades upon disassembling
2015-04-24 19:12:17 +02:00
thatsIch 399934ac2b Merge pull request #1319 from Adaptivity/patch-1
Update ru_RU.lang
2015-04-24 19:11:51 +02:00
Anton 9451106c81 Update ru_RU.lang 2015-04-24 07:51:44 +03:00
thatsIch 8e75de8fb9 Merge pull request #1278 from thatsIch/b-1277-no-mj-config
Fixes #1277: Removed config option for MJ-P2P Tunnel
2015-04-23 23:48:55 +02:00
thatsIch eca598516e Fixes #1277: Removed config option for MJ-P2P Tunnel 2015-04-23 23:45:32 +02:00
thatsIch 2c5a54c210 Merge pull request #1269 from thatsIch/b-1256-number-converter
Fixes #1256: Using new size logic to determine the abbreviation for a stack size
2015-04-23 23:43:31 +02:00
thatsIch 1ac2ab0c10 Merge pull request #1272 from thatsIch/b-1271-missing-pack-mcmeta
Fixes #1271: Added missing pack.mcmeta
2015-04-23 23:42:58 +02:00
thatsIch 199b17b9c6 Merge pull request #1274 from thatsIch/e-1273-deprecated
Closes #1273: Replaced deprecated method call
2015-04-23 23:42:42 +02:00
thatsIch f582c8081b Merge pull request #1275 from thatsIch/e-1270-nei-grinder-localization
Closes #1270: Improves NEI grinder overlay localization
2015-04-23 23:42:26 +02:00
thatsIch 77d66b1817 Merge pull request #1279 from thatsIch/b-1264-render-crash-missing-rf-api
Fixes #1264: Does not crash on missing RF API
2015-04-23 23:42:01 +02:00
thatsIch df370396b1 Merge pull request #1299 from thatsIch/e-qol-exception-messages
Improved exceptions
2015-04-23 23:41:44 +02:00
thatsIch ceeb84a439 Merge pull request #1302 from thatsIch/e-qol-parthelper
Removes unrequired part helper getter, since it already existed
2015-04-23 23:41:24 +02:00
yueh 9af6b50347 Merge pull request #1308 from yueh/fix-329
Replaced static field with with a unique BaseActionSource
2015-04-23 23:32:41 +02:00
yueh d151313253 Replaced static field with with a unique BaseActionSource
Fixes #329
2015-04-23 23:22:55 +02:00
yueh 6d935cc8ae Merge pull request #1311 from yueh/fix-1310
Refactored the NEI handling to use an InventoryAdaptor
2015-04-23 23:17:11 +02:00
yueh 1396dbf600 Merge pull request #1312 from yueh/fix-456
Fixed interface dropping items into itself
2015-04-23 23:17:05 +02:00
thatsIch 8087a43df5 Fixes #1186: Storage Cells drop upgrades upon disassembling 2015-04-23 22:54:10 +02:00
yueh c2cd395ca1 Fixed interface dropping items into itself
Fixes #456
2015-04-23 15:57:12 +02:00
yueh a6e2975677 Refactored the NEI handling to use an InventoryAdaptor
Fixes #1310
2015-04-23 15:00:34 +02:00
thatsIch 3783ae8619 Improved exceptions
Many exceptions got an improvement due to changed class or description or details it is providing.
Is not complete, needs to be done in patches in the regions, where it is needed, since some are just
swallowed.

Removed total usage of pure RuntimeExceptions to 0.
2015-04-21 17:43:24 +02:00
thatsIch be17616836 Removes unrequired part helper getter, since it already existed 2015-04-20 21:12:03 +02:00
thatsIch 36c72d641f Merge pull request #1282 from theelixzammuto/rv2
Update it_IT.lang
2015-04-14 18:38:06 +02:00
theelixzammuto f878a7598d Update it_IT.lang 2015-04-14 18:07:07 +02:00
thatsIch 071ae6d680 Fixes #1264: Does not crash on missing RF API 2015-04-13 22:15:39 +02:00
thatsIch cc29230ce5 Fixes #1256: Using new size logic to determine the abbreviation for a stack size
Removes the usage of the old methods, since they were pretty, but not applicable for our use case. The displayed strings are determined by the size of the to be rendered string. Now the algorithm tries to use as much width as possible before trying to trim it down.

Added tests to reflect the changes and expected behaviour. Also using specific interfaces for the corresponding behaviour to shield from potential calls to the underlying enum singleton implementation.
2015-04-13 14:59:44 +02:00
thatsIch b282e5d968 Closes #1270: Improves NEI grinder overlay localization 2015-04-13 12:53:55 +02:00
thatsIch 3410db7b45 Closes #1273: Replaced deprecated method call 2015-04-13 12:32:53 +02:00
thatsIch 800c30e91c Fixes #1271: Added missing pack.mcmeta
Was missing in the resource management of the build script to be handled
2015-04-13 12:25:54 +02:00
thatsIch 817163dbf6 Merge pull request #1240 from bakaxyf/rv2
Update zh_CN.lang
2015-04-08 21:03:31 +02:00
thatsIch d164e279ef Merge pull request #1238 from thatsIch/b-1202-item-count
Fixes #1202: Now 10000x is the limit before being converted to next bigger unit
2015-04-08 15:35:07 +02:00
bakaxyf 4f9b8db6fc Update zh_CN.lang 2015-04-08 12:16:13 +08:00
thatsIch b58c92ebb6 Fixes #1202: Now 10000x items is the limit before being converted to next bigger unit
Added a new method to display a number in a long fashion.
Added respective unit tests for them
2015-04-07 23:46:52 +02:00
yueh 2667b8eac6 Merge pull request #1233 from yueh/fix-1230
Changed to LinkedHashSet to maintain insertion order
2015-04-07 12:50:27 +02:00
yueh 235fad439d Merge pull request #1228 from yueh/fix-1222
Changed the order as WATs are special and needing a position
2015-04-07 12:50:21 +02:00
yueh fcea444041 Changed to LinkedHashSet to maintain insertion order
Fixes #1230
2015-04-07 12:28:45 +02:00
yueh 80f56d4359 Changed the order as WATs are special and needing a position
Fixes #1222
2015-04-07 00:17:55 +02:00
thatsIch f14bfa7d53 Merge pull request #1227 from bakaxyf/rv2
Update zh_CN.lang
2015-04-06 22:42:57 +02:00
bakaxyf a7d55ee520 Update zh_CN.lang 2015-04-07 04:39:19 +08:00
thatsIch 7382897e8e Merge pull request #1225 from thatsIch/b-dev-jar-duplicates
Deobfuscated version for Developers contains no dupes anymore
2015-04-06 20:31:48 +02:00
thatsIch aac2b598ea Merge pull request #1221 from Adaptivity/rv2
Update ru_RU.lang
2015-04-06 20:30:44 +02:00
thatsIch 0f31cd43d2 Deobfuscated version for Developers contains no dupes anymore 2015-04-06 19:42:20 +02:00
Anton fbc44f47c8 Update ru_RU.lang 2015-04-06 16:32:05 +03:00
132 changed files with 1168 additions and 841 deletions
+2 -3
View File
@@ -22,6 +22,7 @@ apply from: 'gradle/scripts/propertyloader.gradle'
apply from: 'gradle/scripts/dependencies.gradle'
apply from: 'gradle/scripts/artifacts.gradle'
apply from: 'gradle/scripts/autoinstallruntime.gradle'
apply from: 'gradle/scripts/integration.gradle'
buildscript {
repositories {
@@ -103,9 +104,6 @@ sourceSets {
"assets/appliedenergistics2/textures/models/*",
"assets/appliedenergistics2/textures/items/*"
}
// IntelliJ and Gradle interaction bug
output.resourcesDir = output.classesDir
}
}
@@ -114,5 +112,6 @@ processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': config.minecraft_version
include 'pack.mcmeta'
}
}
+7
View File
@@ -0,0 +1,7 @@
apply plugin: 'idea'
idea {
module {
inheritOutputDirs = true
}
}
+10 -6
View File
@@ -25,6 +25,7 @@ package appeng.api.config;
import java.util.EnumSet;
import javax.annotation.Nonnull;
public enum Settings
@@ -55,16 +56,19 @@ public enum Settings
STORAGE_FILTER( EnumSet.allOf( StorageFilter.class ) ), PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) );
private final EnumSet values;
private final EnumSet<? extends Enum<?>> values;
Settings( EnumSet set )
Settings( @Nonnull EnumSet<? extends Enum<?>> possibleOptions )
{
if( set == null || set.isEmpty() )
throw new RuntimeException( "Invalid configuration." );
this.values = set;
if ( possibleOptions.isEmpty() )
{
throw new IllegalArgumentException( "Tried to instantiate an empty setting." );
}
this.values = possibleOptions;
}
public EnumSet getPossibleValues()
public EnumSet<? extends Enum<?>> getPossibleValues()
{
return this.values;
}
@@ -59,9 +59,21 @@ public interface IStorageCell extends ICellWorkbenchItem
* @param cellItem item
*
* @return number of bytes
*
* @deprecated use {@link IStorageCell#getBytesPerType(ItemStack)}
*/
@Deprecated
int BytePerType( ItemStack cellItem );
/**
* Determines the number of bytes used for any type included on the cell.
*
* @param cellItem item
*
* @return number of bytes
*/
int getBytesPerType( ItemStack cellItem );
/**
* Must be between 1 and 63, indicates how many types you want to store on
* the item.
@@ -94,4 +94,4 @@ public interface IGrid
* @return the node considered the pivot point of the grid.
*/
IGridNode getPivot();
}
}
+12 -7
View File
@@ -156,11 +156,18 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
try
{
return this.renderInfo = new BlockRenderInfo( this.getRenderer().newInstance() );
final BaseBlockRender renderer = this.getRenderer().newInstance();
this.renderInfo = new BlockRenderInfo( renderer );
return this.renderInfo;
}
catch( Throwable t )
catch ( InstantiationException e )
{
throw new RuntimeException( t );
throw new IllegalStateException( "Failed to create a new instance of an illegal class " + this.getRenderer(), e );
}
catch( IllegalAccessException e )
{
throw new IllegalStateException( "Failed to create a new instance of " + this.getRenderer() + " because of permissions.", e );
}
}
@@ -797,13 +804,11 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
}
catch( InstantiationException e )
{
e.printStackTrace();
throw new RuntimeException( e );
throw new IllegalStateException( "Failed to create a new instance of an illegal class " + this.tileEntityType , e );
}
catch( IllegalAccessException e )
{
e.printStackTrace();
throw new RuntimeException( e );
throw new IllegalStateException( "Failed to create a new instance of " + this.tileEntityType + ", because lack of permissions", e );
}
}
@@ -230,7 +230,7 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
}
@Override
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z )
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player )
{
Vec3 v3 = target.hitVec.addVector( -x, -y, -z );
SelectedPart sp = this.cb( world, x, y, z ).selectPart( v3 );
@@ -450,10 +450,10 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
public void setupTile()
{
this.setTileEntity( noTesrTile = Api.INSTANCE.getPartHelper().getCombinedInstance( TileCableBus.class.getName() ) );
this.setTileEntity( noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class.getName() ) );
if( Platform.isClient() )
{
tesrTile = Api.INSTANCE.getPartHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" );
CommonHelper.proxy.bindTileEntitySpecialRenderer( tesrTile, this );
}
@@ -364,9 +364,6 @@ public class ClientHelper extends ServerHelper
EntityPlayer player = mc.thePlayer;
if( player == null )
return;
int x = (int) player.posX;
int y = (int) player.posY;
int z = (int) player.posZ;
@@ -79,7 +79,6 @@ import appeng.core.sync.packets.PacketSwapSlots;
import appeng.helpers.InventoryAction;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.INEI;
import appeng.util.Platform;
public abstract class AEBaseGui extends GuiContainer
@@ -744,8 +743,6 @@ public abstract class AEBaseGui extends GuiContainer
catch( Exception err )
{
AELog.warning( "[AppEng] AE prevented crash while drawing slot: " + err.toString() );
if( Platform.isDrawing( Tessellator.instance ) )
Tessellator.instance.draw();
}
this.setItemRender( pIR );
return;
@@ -794,8 +791,6 @@ public abstract class AEBaseGui extends GuiContainer
}
catch( Exception err )
{
if( Platform.isDrawing( tessellator ) )
tessellator.draw();
}
GL11.glPopAttrib();
}
@@ -876,15 +871,10 @@ public abstract class AEBaseGui extends GuiContainer
{
try
{
// drawSlotInventory
// super.func_146977_a( s );r
GuiContainer.class.getDeclaredMethod( "func_146977_a_original", Slot.class ).invoke( this, s );
}
catch( Exception err )
{
Tessellator tessellator = Tessellator.instance;
if( Platform.isDrawing( tessellator ) )
tessellator.draw();
}
}
@@ -30,12 +30,21 @@ import net.minecraft.item.ItemStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.ISlimReadableNumberConverter;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter;
/**
* @author AlgorithmX2
* @author thatsIch
* @version rv2
* @since rv0
*/
public class AppEngRenderItem extends RenderItem
{
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final ISlimReadableNumberConverter SLIM_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final IWideReadableNumberConverter WIDE_CONVERTER = ReadableNumberConverter.INSTANCE;
public IAEItemStack aeStack;
@@ -125,11 +134,11 @@ public class AppEngRenderItem extends RenderItem
{
if( AEConfig.instance.useTerminalUseLargeFont() )
{
return NUMBER_CONVERTER.toShortHumanReadableForm( originalSize );
return SLIM_CONVERTER.toSlimReadableForm( originalSize );
}
else
{
return NUMBER_CONVERTER.toHumanReadableForm( originalSize );
return WIDE_CONVERTER.toWideReadableForm( originalSize );
}
}
}
@@ -325,9 +325,6 @@ public class BaseBlockRender
public void renderInvBlock( EnumSet<ForgeDirection> sides, AEBaseBlock block, ItemStack item, Tessellator tess, int color, RenderBlocks renderer )
{
if( Platform.isDrawing( tess ) )
tess.draw();
int meta = 0;
if( block != null && block.hasSubtypes() && item != null )
meta = item.getItemDamage();
@@ -472,7 +472,7 @@ public final class BusRenderHelper implements IPartRenderHelper
return block;
}
throw new MissingDefinition( "Tried to access the multi part block." );
throw new MissingDefinition( "Tried to access the multi part block without it being defined." );
}
public void prepareBounds( RenderBlocks renderer )
@@ -33,7 +33,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import appeng.block.AEBaseBlock;
import appeng.core.AELog;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
@SideOnly( Side.CLIENT )
@@ -65,9 +64,6 @@ public class TESRWrapper extends TileEntitySpecialRenderer
Tessellator tess = Tessellator.instance;
if( Platform.isDrawing( tess ) )
return;
try
{
GL11.glPushMatrix();
@@ -76,9 +72,6 @@ public class TESRWrapper extends TileEntitySpecialRenderer
this.renderBlocksInstance.blockAccess = te.getWorldObj();
this.blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, this.renderBlocksInstance );
if( Platform.isDrawing( tess ) )
throw new RuntimeException( "Error during rendering." );
GL11.glPopAttrib();
GL11.glPopMatrix();
}
@@ -87,7 +80,7 @@ public class TESRWrapper extends TileEntitySpecialRenderer
AELog.severe( "Hi, Looks like there was a crash while rendering something..." );
t.printStackTrace();
AELog.severe( "MC will now crash ( probably )!" );
throw new RuntimeException( t );
throw new IllegalStateException( t );
}
}
}
@@ -37,13 +37,20 @@ import appeng.client.ClientHelper;
import appeng.core.AELog;
import appeng.tile.AEBaseTile;
import appeng.tile.crafting.TileCraftingMonitorTile;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
/**
* @author AlgorithmX2
* @author thatsIch
* @version rv2
* @since rv1
*/
public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
{
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final IWideReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
public RenderBlockCraftingCPUMonitor()
{
@@ -53,9 +60,6 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
@Override
public void renderTile( AEBaseBlock block, AEBaseTile tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
if( Platform.isDrawing( tess ) )
return;
if( tile instanceof TileCraftingMonitorTile )
{
TileCraftingMonitorTile cmt = (TileCraftingMonitorTile) tile;
@@ -177,7 +181,7 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
final long stackSize = ais.getStackSize();
final String renderedStackSize = NUMBER_CONVERTER.toHumanReadableForm( stackSize );
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( renderedStackSize );
@@ -31,9 +31,8 @@ public class FlippableIcon implements IIcon
public FlippableIcon( IIcon o )
{
if( o == null )
throw new RuntimeException( "Cannot create a wrapper icon with a null icon." );
throw new IllegalArgumentException( "Cannot create a wrapper icon with a null icon." );
this.original = o;
this.flip_u = false;
@@ -32,9 +32,8 @@ public class FullIcon implements IIcon
public FullIcon( IIcon o )
{
if( o == null )
throw new RuntimeException( "Cannot create a wrapper icon with a null icon." );
throw new IllegalArgumentException( "Cannot create a wrapper icon with a null icon." );
this.p = o;
}
@@ -35,9 +35,8 @@ public class OffsetIcon implements IIcon
public OffsetIcon( IIcon o, float x, float y )
{
if( o == null )
throw new RuntimeException( "Cannot create a wrapper icon with a null icon." );
throw new IllegalArgumentException( "Cannot create a wrapper icon with a null icon." );
this.p = o;
this.offsetX = x;
@@ -30,28 +30,27 @@ public class TaughtIcon implements IIcon
final float tightness;
private final IIcon p;
private final IIcon icon;
public TaughtIcon( IIcon o, float tightness )
public TaughtIcon( IIcon icon, float tightness )
{
if( icon == null )
throw new IllegalArgumentException( "Cannot create a wrapper icon with a null icon." );
if( o == null )
throw new RuntimeException( "Cannot create a wrapper icon with a null icon." );
this.p = o;
this.icon = icon;
this.tightness = tightness * 0.4f;
}
@Override
public int getIconWidth()
{
return this.p.getIconWidth();
return this.icon.getIconWidth();
}
@Override
public int getIconHeight()
{
return this.p.getIconHeight();
return this.icon.getIconHeight();
}
@Override
@@ -100,7 +99,7 @@ public class TaughtIcon implements IIcon
@SideOnly( Side.CLIENT )
public String getIconName()
{
return this.p.getIconName();
return this.icon.getIconName();
}
private float v( double d )
@@ -109,7 +108,7 @@ public class TaughtIcon implements IIcon
d -= this.tightness;
if( d > 8 )
d += this.tightness;
return this.p.getInterpolatedV( Math.min( 16.0, Math.max( 0.0, d ) ) );
return this.icon.getInterpolatedV( Math.min( 16.0, Math.max( 0.0, d ) ) );
}
private float u( double d )
@@ -118,6 +117,6 @@ public class TaughtIcon implements IIcon
d -= this.tightness;
if( d > 8 )
d += this.tightness;
return this.p.getInterpolatedU( Math.min( 16.0, Math.max( 0.0, d ) ) );
return this.icon.getInterpolatedU( Math.min( 16.0, Math.max( 0.0, d ) ) );
}
}
@@ -154,7 +154,7 @@ public abstract class AEBaseContainer extends Container
this.obj = anchor instanceof IGuiItemObject ? (IGuiItemObject) anchor : null;
if( this.tileEntity == null && this.part == null && this.obj == null )
throw new RuntimeException( "Must have a valid anchor" );
throw new IllegalArgumentException( "Must have a valid anchor, instead " + anchor + " in " + ip );
this.mySrc = new PlayerSource( ip.player, this.getActionHost() );
@@ -380,7 +380,7 @@ public abstract class AEBaseContainer extends Container
return super.addSlotToContainer( newSlot );
}
else
throw new RuntimeException( "Invalid Slot for AE Container." );
throw new IllegalArgumentException( "Invalid Slot [" + newSlot + "]for AE Container instead of AppEngSlot." );
}
@Override
@@ -49,15 +49,13 @@ import appeng.util.iterators.NullIterator;
public class ContainerCellWorkbench extends ContainerUpgradeable
{
final TileCellWorkbench workBench;
final AppEngNullInventory ni = new AppEngNullInventory();
private final TileCellWorkbench workBench;
private final AppEngNullInventory nullInventory = new AppEngNullInventory();
@GuiSync( 2 )
public CopyMode copyMode = CopyMode.CLEAR_ON_REMOVE;
IInventory UpgradeInventoryWrapper;
ItemStack prevStack = null;
int lastUpgrades = 0;
ItemStack LastCell;
private ItemStack prevStack = null;
private int lastUpgrades = 0;
private ItemStack LastCell;
public ContainerCellWorkbench( InventoryPlayer ip, TileCellWorkbench te )
{
@@ -99,7 +97,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.invPlayer ) );
IInventory inv = this.upgradeable.getInventoryByName( "config" );
this.UpgradeInventoryWrapper = new Upgrades();// Platform.isServer() ? new Upgrades() : new AppEngInternalInventory(
IInventory upgradeInventory = new Upgrades();
// null, 3 * 8 );
for( int w = 0; w < 7; w++ )
@@ -113,7 +111,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
for( int z = 0; z < 8; z++ )
{
int iSLot = zz * 8 + z;
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.UpgradeInventoryWrapper, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.invPlayer ) );
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.invPlayer ) );
}
/*
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new
@@ -134,7 +132,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
if( this.prevStack != is )
{
this.prevStack = is;
return this.lastUpgrades = this.getCellUpgradeInventory().getSizeInventory();
this.lastUpgrades = this.getCellUpgradeInventory().getSizeInventory();
}
return this.lastUpgrades;
}
@@ -180,8 +178,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
public IInventory getCellUpgradeInventory()
{
IInventory ri = this.workBench.getCellUpgradeInventory();
return ri == null ? this.ni : ri;
final IInventory upgradeInventory = this.workBench.getCellUpgradeInventory();
return upgradeInventory == null ? this.nullInventory : upgradeInventory;
}
@Override
@@ -237,7 +236,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
this.detectAndSendChanges();
}
class Upgrades implements IInventory
private class Upgrades implements IInventory
{
@Override
+1 -1
View File
@@ -49,7 +49,7 @@ import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
public class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
public final class AEConfig extends Configuration implements IConfigurableObject, IConfigManagerHost
{
public static final double TUNNEL_POWER_LOSS = 0.05;
+4 -9
View File
@@ -31,7 +31,6 @@ import appeng.api.features.IRegistryContainer;
import appeng.api.networking.IGridBlock;
import appeng.api.networking.IGridConnection;
import appeng.api.networking.IGridNode;
import appeng.api.parts.IPartHelper;
import appeng.api.storage.IStorageHelper;
import appeng.core.api.ApiPart;
import appeng.core.api.ApiStorage;
@@ -81,7 +80,7 @@ public final class Api implements IAppEngApi
}
@Override
public IPartHelper partHelper()
public ApiPart partHelper()
{
return this.partHelper;
}
@@ -119,8 +118,9 @@ public final class Api implements IAppEngApi
@Override
public IGridNode createGridNode( IGridBlock blk )
{
if( Platform.isClient() )
throw new RuntimeException( "Grid Features are Server Side Only." );
if ( Platform.isClient() )
throw new IllegalStateException( "Grid features for " + blk + " are server side only." );
return new GridNode( blk );
}
@@ -129,9 +129,4 @@ public final class Api implements IAppEngApi
{
return new GridConnection( a, b, ForgeDirection.UNKNOWN );
}
public ApiPart getPartHelper()
{
return this.partHelper;
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ import appeng.util.Platform;
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.7.10]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
public class AppEng
public final class AppEng
{
public static final String MOD_ID = "appliedenergistics2";
public static final String MOD_NAME = "Applied Energistics 2";
@@ -19,7 +19,7 @@
package appeng.core;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import appeng.core.features.IFeatureHandler;
@@ -27,7 +27,7 @@ import appeng.core.features.IFeatureHandler;
public final class FeatureHandlerRegistry
{
private final Set<IFeatureHandler> registry = new HashSet<IFeatureHandler>();
private final Set<IFeatureHandler> registry = new LinkedHashSet<IFeatureHandler>();
public void addFeatureHandler( IFeatureHandler feature )
{
@@ -19,7 +19,7 @@
package appeng.core;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import appeng.core.features.IAEFeature;
@@ -27,7 +27,7 @@ import appeng.core.features.IAEFeature;
public final class FeatureRegistry
{
private final Set<IAEFeature> registry = new HashSet<IAEFeature>();
private final Set<IAEFeature> registry = new LinkedHashSet<IAEFeature>();
public void addFeature( IAEFeature feature )
{
+1 -1
View File
@@ -85,7 +85,7 @@ public class IMCHandler
}
else
{
throw new RuntimeException( "Invalid IMC Called: " + key );
throw new IllegalStateException( "Invalid IMC Called: " + key );
}
}
catch( Throwable t )
+2 -2
View File
@@ -189,7 +189,7 @@ public final class Registration
{
config.storageBiomeID = Platform.findEmpty( BiomeGenBase.getBiomeGenArray() );
if( config.storageBiomeID == -1 )
throw new RuntimeException( "Biome Array is full, please free up some Biome ID's or disable spatial." );
throw new IllegalStateException( "Biome Array is full, please free up some Biome ID's or disable spatial." );
this.storageBiome = new BiomeGenStorage( config.storageBiomeID );
config.save();
@@ -586,7 +586,7 @@ public final class Registration
PlayerMessages.values();
GuiText.values();
Api.INSTANCE.getPartHelper().initFMPSupport();
Api.INSTANCE.partHelper().initFMPSupport();
for( Block block : blocks.multiPart().maybeBlock().asSet() )
{
( (BlockCableBus) block ).setupTile();
+5 -5
View File
@@ -105,19 +105,19 @@ public class WorldSettings extends Configuration
if( !aeBaseFolder.isDirectory() && !aeBaseFolder.mkdir() )
{
throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
throw new IllegalStateException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
}
File compass = new File( aeBaseFolder, COMPASS_FOLDER );
if( !compass.isDirectory() && !compass.mkdir() )
{
throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() );
throw new IllegalStateException( "Failed to create " + compass.getAbsolutePath() );
}
File spawnData = new File( aeBaseFolder, SPAWNDATA_FOLDER );
if( !spawnData.isDirectory() && !spawnData.mkdir() )
{
throw new RuntimeException( "Failed to create " + spawnData.getAbsolutePath() );
throw new IllegalStateException( "Failed to create " + spawnData.getAbsolutePath() );
}
instance = new WorldSettings( aeBaseFolder );
@@ -158,7 +158,7 @@ public class WorldSettings extends Configuration
NBTTagCompound loadSpawnData( int dim, int chunkX, int chunkZ )
{
if( !Thread.holdsLock( WorldSettings.class ) )
throw new RuntimeException( "Invalid Request" );
throw new IllegalStateException( "Invalid Request" );
NBTTagCompound data = null;
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
@@ -225,7 +225,7 @@ public class WorldSettings extends Configuration
void writeSpawnData( int dim, int chunkX, int chunkZ, NBTTagCompound data )
{
if( !Thread.holdsLock( WorldSettings.class ) )
throw new RuntimeException( "Invalid Request" );
throw new IllegalStateException( "Invalid Request" );
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
FileOutputStream fileOutputStream = null;
+15 -26
View File
@@ -19,6 +19,7 @@
package appeng.core.api;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.HashMap;
@@ -85,9 +86,9 @@ public class ApiPart implements IPartHelper
{
return Class.forName( base );
}
catch( Throwable t )
catch( ClassNotFoundException e )
{
throw new RuntimeException( t );
throw new IllegalStateException( e );
}
}
@@ -95,14 +96,7 @@ public class ApiPart implements IPartHelper
if( this.tileImplementations.get( description ) != null )
{
try
{
return this.tileImplementations.get( description );
}
catch( Throwable t )
{
throw new RuntimeException( t );
}
return this.tileImplementations.get( description );
}
String f = base;// TileCableBus.class.getName();
@@ -121,9 +115,9 @@ public class ApiPart implements IPartHelper
{
myCLass = Class.forName( f );
}
catch( Throwable t )
catch( ClassNotFoundException e )
{
throw new RuntimeException( t );
throw new IllegalStateException( e );
}
String path = f;
@@ -147,14 +141,7 @@ public class ApiPart implements IPartHelper
this.tileImplementations.put( description, myCLass );
try
{
return myCLass;
}
catch( Throwable t )
{
throw new RuntimeException( t );
}
return myCLass;
}
public Class getClassByDesc( String Addendum, String fullPath, String root, String next )
@@ -247,19 +234,21 @@ public class ApiPart implements IPartHelper
public ClassNode getReader( String name )
{
ClassReader cr;
String path = '/' + name.replace( ".", "/" ) + ".class";
InputStream is = this.getClass().getResourceAsStream( path );
try
{
ClassReader cr;
String path = '/' + name.replace( ".", "/" ) + ".class";
InputStream is = this.getClass().getResourceAsStream( path );
cr = new ClassReader( is );
ClassNode cn = new ClassNode();
cr.accept( cn, ClassReader.EXPAND_FRAMES );
return cn;
}
catch( Throwable t )
catch( IOException e )
{
throw new RuntimeException( "Error loading " + name, t );
throw new IllegalStateException( "Error loading " + name, e );
}
}
@@ -306,7 +295,7 @@ public class ApiPart implements IPartHelper
catch( Exception e )
{
AELog.error( e );
throw new RuntimeException( "Unable to manage part API.", e );
throw new IllegalStateException( "Unable to manage part API.", e );
}
return clazz;
}
@@ -40,7 +40,7 @@ public class DefinitionConstructor
return ( (ITileDefinition) definition );
}
throw new RuntimeException( "No tile definition" );
throw new IllegalStateException( "No tile definition for " + feature );
}
public final IBlockDefinition registerBlockDefinition( IAEFeature feature )
@@ -52,7 +52,7 @@ public class DefinitionConstructor
return ( (IBlockDefinition) definition );
}
throw new RuntimeException( "No block definition" );
throw new IllegalStateException( "No block definition for " + feature );
}
public final IItemDefinition registerItemDefinition( IAEFeature feature )
@@ -77,10 +77,10 @@ public class IMCGrinder implements IIMCProcessor
int turns = msg.getInteger( "turns" );
if( in == null )
throw new RuntimeException( "invalid input" );
throw new IllegalStateException( "invalid input" );
if( out == null )
throw new RuntimeException( "invalid output" );
throw new IllegalStateException( "invalid output" );
if( msg.hasKey( "optional" ) )
{
@@ -88,7 +88,7 @@ public class IMCGrinder implements IIMCProcessor
ItemStack optional = ItemStack.loadItemStackFromNBT( optionalTag );
if( optional == null )
throw new RuntimeException( "invalid optional" );
throw new IllegalStateException( "invalid optional" );
float chance = msg.getFloat( "chance" );
@@ -54,7 +54,7 @@ public class IMCMatterCannon implements IIMCProcessor
double weight = msg.getDouble( "weight" );
if( ammo == null )
throw new RuntimeException( "invalid item" );
throw new IllegalStateException( "invalid item in message " + m );
AEApi.instance().registries().matterCannon().registerAmmo( ammo, weight );
}
@@ -30,6 +30,8 @@ FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-item",
package appeng.core.api.imc;
import java.util.Arrays;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
@@ -55,9 +57,9 @@ public class IMCP2PAttunement implements IIMCProcessor
if( is != null )
AEApi.instance().registries().p2pTunnel().addNewAttunement( is, type );
else
throw new RuntimeException( "invalid item" );
throw new IllegalStateException( "invalid item in message " + m );
}
else
throw new RuntimeException( "invalid type" );
throw new IllegalStateException( "invalid type in message " + m + " is not contained in " + Arrays.toString( TunnelType.values() ) );
}
}
@@ -57,7 +57,7 @@ public enum AEFeature
DenseEnergyCells( "HigherCapacity" ), DenseCables( "HigherCapacity" ),
P2PTunnelRF( "P2PTunnels" ), P2PTunnelME( "P2PTunnels" ), P2PTunnelItems( "P2PTunnels" ), P2PTunnelRedstone( "P2PTunnels" ), P2PTunnelEU( "P2PTunnels" ), P2PTunnelMJ( "P2PTunnels" ), P2PTunnelLiquids( "P2PTunnels" ), P2PTunnelLight( "P2PTunnels" ),
P2PTunnelRF( "P2PTunnels" ), P2PTunnelME( "P2PTunnels" ), P2PTunnelItems( "P2PTunnels" ), P2PTunnelRedstone( "P2PTunnels" ), P2PTunnelEU( "P2PTunnels" ), P2PTunnelLiquids( "P2PTunnels" ), P2PTunnelLight( "P2PTunnels" ),
MassCannonBlockDamage( "BlockFeatures" ), TinyTNTBlockDamage( "BlockFeatures" ), Facades( "Facades" ),
@@ -24,7 +24,7 @@ import java.util.Set;
import appeng.core.AEConfig;
public class FeaturedActiveChecker
public final class FeaturedActiveChecker
{
private final Set<AEFeature> features;
@@ -20,7 +20,9 @@ package appeng.core.features.registries;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridCache;
@@ -28,10 +30,9 @@ import appeng.api.networking.IGridCacheRegistry;
import appeng.core.AELog;
public class GridCacheRegistry implements IGridCacheRegistry
public final class GridCacheRegistry implements IGridCacheRegistry
{
private final HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>> caches = new HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>>();
private final Map<Class<? extends IGridCache>, Class<? extends IGridCache>> caches = new HashMap<Class<? extends IGridCache>, Class<? extends IGridCache>>();
@Override
public void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation )
@@ -39,7 +40,7 @@ public class GridCacheRegistry implements IGridCacheRegistry
if( iface.isAssignableFrom( implementation ) )
this.caches.put( iface, implementation );
else
throw new RuntimeException( "Invalid setup, grid cache must either be the same class, or an interface that the implementation implements" );
throw new IllegalArgumentException( "Invalid setup, grid cache must either be the same class, or an interface that the implementation implements. Gotten: " + iface + " and " + implementation );
}
@Override
@@ -49,15 +50,31 @@ public class GridCacheRegistry implements IGridCacheRegistry
for( Class<? extends IGridCache> iface : this.caches.keySet() )
{
Constructor<? extends IGridCache> c;
try
{
Constructor<? extends IGridCache> c = this.caches.get( iface ).getConstructor( IGrid.class );
c = this.caches.get( iface ).getConstructor( IGrid.class );
map.put( iface, c.newInstance( g ) );
}
catch( Throwable e )
catch( NoSuchMethodException e )
{
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
throw new RuntimeException( e );
throw new IllegalArgumentException( e );
}
catch( InvocationTargetException e )
{
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
throw new IllegalStateException( e );
}
catch( InstantiationException e )
{
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
throw new IllegalStateException( e );
}
catch( IllegalAccessException e )
{
AELog.severe( "Grid Caches must have a constructor with IGrid as the single param." );
throw new IllegalStateException( e );
}
}
@@ -54,10 +54,9 @@ public class MovableTileRegistry implements IMovableRegistry
@Override
public void whiteListTileEntity( Class<? extends TileEntity> c )
{
if( c.getName().equals( TileEntity.class.getName() ) )
{
throw new RuntimeException( new AppEngException( "Someone tried to make all tiles movable, this is a clear violation of the purpose of the white list." ) );
throw new IllegalArgumentException( new AppEngException( "Someone tried to make all tiles movable with " + c + ", this is a clear violation of the purpose of the white list." ) );
}
this.test.add( c );
@@ -44,7 +44,7 @@ public enum GuiText
CraftingTerminal, FormationPlane, Inscriber, QuartzCuttingKnife,
METunnel, ItemTunnel, RedstoneTunnel, MJTunnel, EUTunnel, FluidTunnel,
METunnel, ItemTunnel, RedstoneTunnel, EUTunnel, FluidTunnel,
StoredSize, CopyMode, CopyModeDesc, PatternTerminal, CraftingPattern,
@@ -33,8 +33,6 @@ public enum TickRates
AnnihilationPlane( 2, 120 ),
MJTunnel( 1, 20 ),
METunnel( 5, 20 ),
Inscriber( 1, 1 ),
@@ -40,7 +40,7 @@ public abstract class AppEngPacket
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
{
throw new RuntimeException( "This packet ( " + this.getPacketID() + " does not implement a server side handler." );
throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a server side handler." );
}
public final int getPacketID()
@@ -50,7 +50,7 @@ public abstract class AppEngPacket
public void clientPacketData( INetworkInfo network, AppEngPacket packet, EntityPlayer player )
{
throw new RuntimeException( "This packet ( " + this.getPacketID() + " does not implement a client side handler." );
throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a client side handler." );
}
protected void configureWrite( ByteBuf data )
@@ -130,7 +130,7 @@ public class AppEngPacketHandlerBase
REVERSE_LOOKUP.put( this.packetClass, this );
if( this.packetConstructor == null )
throw new RuntimeException( "Invalid Packet Class, must be constructable on DataInputStream" );
throw new IllegalStateException( "Invalid Packet Class " + c + ", must be constructable on DataInputStream" );
}
public static PacketTypes getPacket( int id )
@@ -228,10 +228,10 @@ public enum GuiBridge implements IGuiHandler
String guiClass = start.replaceFirst( "container.", "client.gui." ).replace( ".Container", ".Gui" );
if( start.equals( guiClass ) )
throw new RuntimeException( "Unable to find gui class" );
throw new IllegalStateException( "Unable to find gui class" );
this.Gui = ReflectionHelper.getClass( this.getClass().getClassLoader(), guiClass );
if( this.Gui == null )
throw new RuntimeException( "Cannot Load class: " + guiClass );
throw new IllegalStateException( "Cannot Load class: " + guiClass );
}
}
@@ -304,7 +304,7 @@ public enum GuiBridge implements IGuiHandler
public boolean CorrectTileOrPart( Object tE )
{
if( this.Tile == null )
throw new RuntimeException( "This Gui Cannot use the standard Handler." );
throw new IllegalArgumentException( "This Gui Cannot use the standard Handler." );
return this.Tile.isInstance( tE );
}
@@ -337,7 +337,7 @@ public enum GuiBridge implements IGuiHandler
if( target == null )
{
throw new RuntimeException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
throw new IllegalStateException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
}
Object o = target.newInstance( inventory, tE );
@@ -364,7 +364,7 @@ public enum GuiBridge implements IGuiHandler
}
catch( Throwable t )
{
throw new RuntimeException( t );
throw new IllegalStateException( t );
}
}
@@ -462,14 +462,14 @@ public enum GuiBridge implements IGuiHandler
if( target == null )
{
throw new RuntimeException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
throw new IllegalStateException( "Cannot find " + this.Container.getName() + "( " + this.typeName( inventory ) + ", " + this.typeName( tE ) + " )" );
}
return target.newInstance( inventory, tE );
}
catch( Throwable t )
{
throw new RuntimeException( t );
throw new IllegalStateException( t );
}
}
@@ -31,16 +31,17 @@ import appeng.api.util.IConfigurableObject;
import appeng.container.AEBaseContainer;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.helpers.Reflected;
import appeng.util.Platform;
public class PacketConfigButton extends AppEngPacket
public final class PacketConfigButton extends AppEngPacket
{
public final Settings option;
public final boolean rotationDirection;
private final Settings option;
private final boolean rotationDirection;
// automatic.
@Reflected
public PacketConfigButton( ByteBuf stream )
{
this.option = Settings.values()[stream.readInt()];
@@ -66,12 +67,15 @@ public class PacketConfigButton extends AppEngPacket
public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player )
{
EntityPlayerMP sender = (EntityPlayerMP) player;
AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
if( baseContainer.getTarget() instanceof IConfigurableObject )
if ( sender.openContainer instanceof AEBaseContainer )
{
IConfigManager cm = ( (IConfigurableObject) baseContainer.getTarget() ).getConfigManager();
Enum newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
cm.putSetting( this.option, newState );
final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer;
if( baseContainer.getTarget() instanceof IConfigurableObject )
{
IConfigManager cm = ( (IConfigurableObject) baseContainer.getTarget() ).getConfigManager();
Enum<?> newState = Platform.rotateEnum( cm.getSetting( this.option ), this.rotationDirection, this.option.getPossibleValues() );
cm.putSetting( this.option, newState );
}
}
}
}
@@ -67,7 +67,7 @@ public class PacketInventoryAction extends AppEngPacket
{
if( Platform.isClient() )
throw new RuntimeException( "invalid packet, client cannot post inv actions with stacks." );
throw new IllegalStateException( "invalid packet, client cannot post inv actions with stacks." );
this.action = action;
this.slot = slot;
@@ -37,8 +37,11 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
@@ -53,6 +56,7 @@ import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.helpers.IContainerCraftingPacket;
import appeng.items.storage.ItemViewCell;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import appeng.util.prioitylist.IPartitionList;
@@ -152,14 +156,14 @@ public class PacketNEIRecipe extends AppEngPacket
for( int x = 0; x < craftMatrix.getSizeInventory(); x++ )
{
ItemStack PatternItem = testInv.getStackInSlot( x );
ItemStack patternItem = testInv.getStackInSlot( x );
ItemStack currentItem = craftMatrix.getStackInSlot( x );
if( currentItem != null )
{
testInv.setInventorySlotContents( x, currentItem );
ItemStack newItemStack = r.matches( testInv, pmp.worldObj ) ? r.getCraftingResult( testInv ) : null;
testInv.setInventorySlotContents( x, PatternItem );
testInv.setInventorySlotContents( x, patternItem );
if( newItemStack == null || !Platform.isSameItemPrecise( newItemStack, is ) )
{
@@ -178,10 +182,10 @@ public class PacketNEIRecipe extends AppEngPacket
}
// True if we need to fetch an item for the recipe
if( PatternItem != null && currentItem == null )
if( patternItem != null && currentItem == null )
{
// Grab from network by recipe
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getSource(), storage, player.worldObj, r, is, testInv, PatternItem, x, all, realForFake, filter );
ItemStack whichItem = Platform.extractItemsByRecipe( energy, cct.getSource(), storage, player.worldObj, r, is, testInv, patternItem, x, all, realForFake, filter );
// If that doesn't get it, grab exact items from network (?)
// TODO see if this code is necessary
@@ -209,28 +213,7 @@ public class PacketNEIRecipe extends AppEngPacket
// If that doesn't work, grab from the player's inventory
if( whichItem == null && playerInventory != null )
{
for( int y = 0; y < this.recipe[x].length; y++ )
{
ItemStack playerItemStack = null;
for( int i = 0; i < playerInventory.getSizeInventory(); i++ )
{
// check if the item in slot y matches the required item.
playerItemStack = playerInventory.getStackInSlot( i );
if( playerItemStack != null && this.recipe[x][y] != null && playerItemStack.getItem() == this.recipe[x][y].getItem() )
{
if( realForFake == Actionable.SIMULATE )
{
whichItem = playerInventory.getStackInSlot( i ).copy();
whichItem.stackSize = 1;
}
else
{
whichItem = playerInventory.decrStackSize( i, 1 );
}
break;
}
}
}
whichItem = extractItemFromPlayerInventory( player, realForFake, patternItem );
}
craftMatrix.setInventorySlotContents( x, whichItem );
@@ -243,4 +226,43 @@ public class PacketNEIRecipe extends AppEngPacket
}
}
}
/**
* Tries to extract an item from the player inventory. Does account for fuzzy items.
*
* @param player the {@link EntityPlayer} to extract from
* @param mode the {@link Actionable} to simulate or modulate the operation
* @param patternItem which {@link ItemStack} to extract
* @return null or a found {@link ItemStack}
*/
private ItemStack extractItemFromPlayerInventory( EntityPlayer player, Actionable mode, ItemStack patternItem )
{
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
final AEItemStack request = AEItemStack.create( patternItem );
final boolean isSimulated = mode == Actionable.SIMULATE;
final boolean checkFuzzy = request.isOre() || patternItem.getItemDamage() == OreDictionary.WILDCARD_VALUE || patternItem.hasTagCompound() || patternItem.isItemStackDamageable();
if( !checkFuzzy )
{
if( isSimulated )
{
return ia.simulateRemove( 1, patternItem, null );
}
else
{
return ia.removeItems( 1, patternItem, null );
}
}
else
{
if( isSimulated )
{
return ia.simulateSimilarRemove( 1, patternItem, FuzzyMode.IGNORE_ALL, null );
}
else
{
return ia.removeSimilarItems( 1, patternItem, FuzzyMode.IGNORE_ALL, null );
}
}
}
}
@@ -218,7 +218,7 @@ public class CraftingJob implements Runnable, ICraftingJob
catch( Throwable t )
{
this.finish();
throw new RuntimeException( t );
throw new IllegalStateException( t );
}
this.finish();
@@ -47,7 +47,7 @@ public class CraftingLink implements ICraftingLink
this.standalone = data.getBoolean( "standalone" );
if( !data.hasKey( "req" ) || !data.getBoolean( "req" ) )
throw new RuntimeException( "Invalid Crafting Link for Object" );
throw new IllegalStateException( "Invalid Crafting Link for Object" );
this.req = req;
this.cpu = null;
@@ -61,7 +61,7 @@ public class CraftingLink implements ICraftingLink
this.standalone = data.getBoolean( "standalone" );
if( !data.hasKey( "req" ) || data.getBoolean( "req" ) )
throw new RuntimeException( "Invalid Crafting Link for Object" );
throw new IllegalStateException( "Invalid Crafting Link for Object" );
this.cpu = cpu;
this.req = null;
@@ -264,7 +264,7 @@ public class CraftingTreeProcess
}
}
throw new RuntimeException( "Crafting Tree construction failed." );
throw new IllegalStateException( "Crafting Tree construction failed." );
}
public void setSimulate()
+1 -1
View File
@@ -44,6 +44,6 @@ public final class EntityIds
if( droppedEntity == EntityGrowingCrystal.class )
return GROWING_CRYSTAL;
throw new RuntimeException( "Missing entity id: " + droppedEntity.getName() );
throw new IllegalStateException( "Missing entity id: " + droppedEntity.getName() );
}
}
+1 -1
View File
@@ -70,7 +70,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
public FacadePart( ItemStack facade, ForgeDirection side )
{
if( facade == null )
throw new RuntimeException( "Facade Part constructed on null item." );
throw new IllegalArgumentException( "Facade Part constructed on null item." );
this.facade = facade.copy();
this.facade.stackSize = 1;
this.side = side;
+4 -3
View File
@@ -54,7 +54,8 @@ public enum PartRegistry
return pr.name;
}
}
throw new RuntimeException( "Invalid PartName" );
throw new IllegalStateException( "Invalid PartName" );
}
public static TMultiPart getPartByBlock( Block block, int meta )
@@ -74,13 +75,13 @@ public enum PartRegistry
try
{
if( this == CableBusPart )
return (TMultiPart) Api.INSTANCE.getPartHelper().getCombinedInstance( this.part.getName() ).newInstance();
return (TMultiPart) Api.INSTANCE.partHelper().getCombinedInstance( this.part.getName() ).newInstance();
else
return this.part.getConstructor( int.class ).newInstance( meta );
}
catch( Throwable t )
{
throw new RuntimeException( t );
throw new IllegalStateException( t );
}
}
@@ -60,6 +60,7 @@ import appeng.api.networking.crafting.ICraftingProviderHelper;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.events.MENetworkCraftingPatternChange;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
@@ -100,13 +101,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
static final Set<Block> badBlocks = new HashSet<Block>();
private static boolean interfaceRequest = false;
final int[] sides = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };
final IAEItemStack[] requireWork = new IAEItemStack[] { null, null, null, null, null, null, null, null };
final MultiCraftingTracker craftingTracker;
final AENetworkProxy gridProxy;
final IInterfaceHost iHost;
final BaseActionSource mySrc;
final BaseActionSource mySource;
final BaseActionSource interfaceRequestSource;
final ConfigManager cm = new ConfigManager( this );
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 8 );
final AppEngInternalInventory storage = new AppEngInternalInventory( this, 8 );
@@ -133,7 +134,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
this.iHost = ih;
this.craftingTracker = new MultiCraftingTracker( this.iHost, 9 );
this.mySrc = this.fluids.changeSource = this.items.changeSource = new MachineSource( this.iHost );
this.mySource = this.fluids.changeSource = this.items.changeSource = new MachineSource( this.iHost );
this.interfaceRequestSource = new InterfaceRequestSource( this.iHost );
}
@Override
@@ -371,7 +373,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
return;
}
}
else // Stored != null; dispose!
else
// Stored != null; dispose!
{
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
this.requireWork[slot] = work.setStackSize( -work.getStackSize() );
@@ -507,7 +510,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
return TickRateModulation.SLEEP;
if( this.hasItemsToSend() )
this.pushItemsOut( EnumSet.allOf( ForgeDirection.class ) );
this.pushItemsOut( this.iHost.getTargets() );
boolean couldDoWork = this.updateStorage();
return this.hasWorkToDo() ? ( couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER ) : TickRateModulation.SLEEP;
@@ -574,7 +577,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
boolean changed = false;
InventoryAdaptor adaptor = this.getAdaptor( x );
interfaceRequest = this.isWorking = true;
this.isWorking = true;
try
{
@@ -592,13 +595,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
throw new GridAccessException();
}
IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.mySrc );
IAEItemStack acquired = Platform.poweredExtraction( src, this.destination, itemStack, this.interfaceRequestSource );
if( acquired != null )
{
changed = true;
ItemStack issue = adaptor.addItems( acquired.getItemStack() );
if( issue != null )
throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
throw new IllegalStateException( "bad attempt at managing inventory. ( addItems )" );
}
else
changed = this.handleCrafting( x, adaptor, itemStack ) || changed;
@@ -618,7 +621,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
throw new GridAccessException();
}
toStore = Platform.poweredInsert( src, this.destination, toStore, this.mySrc );
toStore = Platform.poweredInsert( src, this.destination, toStore, this.interfaceRequestSource );
if( toStore != null )
diff -= toStore.getStackSize();
@@ -629,9 +632,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
changed = true;
ItemStack removed = adaptor.removeItems( (int) diff, null, null );
if( removed == null )
throw new RuntimeException( "bad attempt at managing inventory. ( removeItems )" );
throw new IllegalStateException( "bad attempt at managing inventory. ( removeItems )" );
else if( removed.stackSize != diff )
throw new RuntimeException( "bad attempt at managing inventory. ( removeItems )" );
throw new IllegalStateException( "bad attempt at managing inventory. ( removeItems )" );
}
}
// else wtf?
@@ -644,7 +647,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
if( changed )
this.updatePlan( x );
interfaceRequest = this.isWorking = false;
this.isWorking = false;
return changed;
}
@@ -659,7 +662,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
if( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 && itemStack != null )
{
return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorldObj(), this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySrc );
return this.craftingTracker.handleCrafting( x, itemStack.getStackSize(), itemStack, d, this.iHost.getTileEntity().getWorldObj(), this.gridProxy.getGrid(), this.gridProxy.getCrafting(), this.mySource );
}
}
catch( GridAccessException e )
@@ -734,7 +737,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
this.cancelCrafting();
this.markDirty();
} @Override
}
@Override
public IMEMonitor<IAEFluidStack> getFluidInventory()
{
if( this.hasConfig() )
@@ -825,7 +830,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
ItemStack is = table.getStackInSlot( x );
if( is != null )
{
this.addToSendList( ad.addItems( is ) );
final ItemStack added = ad.addItems( is );
this.addToSendList( added );
}
}
this.pushItemsOut( possibleDirections );
@@ -1095,8 +1101,17 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
}
}
private class InterfaceRequestSource extends MachineSource
{
class InterfaceInventory extends MEMonitorIInventory
public InterfaceRequestSource( IActionHost v )
{
super( v );
}
}
private class InterfaceInventory extends MEMonitorIInventory
{
public InterfaceInventory( DualityInterface tileInterface )
@@ -1108,7 +1123,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
@Override
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
{
if( interfaceRequest )
if( src instanceof InterfaceRequestSource )
return input;
return super.injectItems( input, type, src );
@@ -1117,12 +1132,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
@Override
public IAEItemStack extractItems( IAEItemStack request, Actionable type, BaseActionSource src )
{
if( interfaceRequest )
if( src instanceof InterfaceRequestSource )
return null;
return super.extractItems( request, type, src );
}
}
}
@@ -68,6 +68,6 @@ public class MetaRotation implements IOrientable
if( this.w instanceof World )
( (World) this.w ).setBlockMetadataWithNotify( this.x, this.y, this.z, Up.ordinal(), 1 + 2 );
else
throw new RuntimeException( this.w.getClass().getName() + " received, expected World" );
throw new IllegalStateException( this.w.getClass().getName() + " received, expected World" );
}
}
@@ -65,7 +65,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
NBTTagCompound encodedValue = is.getTagCompound();
if( encodedValue == null )
throw new RuntimeException( "No pattern here!" );
throw new IllegalArgumentException( "No pattern here!" );
NBTTagList inTag = encodedValue.getTagList( "in", 10 );
NBTTagList outTag = encodedValue.getTagList( "out", 10 );
@@ -99,7 +99,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
out.add( AEApi.instance().storage().createItemStack( this.correctOutput ) );
}
else
throw new RuntimeException( "No pattern here!" );
throw new IllegalStateException( "No pattern here!" );
}
else
{
@@ -144,7 +144,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
}
if( tmpOutputs.isEmpty() || tmpInputs.isEmpty() )
throw new RuntimeException( "No pattern here!" );
throw new IllegalStateException( "No pattern here!" );
int offset = 0;
this.condensedInputs = new IAEItemStack[tmpInputs.size()];
@@ -182,7 +182,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
{
if( !this.isCrafting )
{
throw new RuntimeException( "Only crafting recipes supported." );
throw new IllegalStateException( "Only crafting recipes supported." );
}
TestStatus result = this.getStatus( slotIndex, i );
@@ -270,7 +270,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
public ItemStack getOutput( InventoryCrafting craftingInv, World w )
{
if( !this.isCrafting )
throw new RuntimeException( "Only crafting recipes supported." );
throw new IllegalStateException( "Only crafting recipes supported." );
for( int x = 0; x < craftingInv.getSizeInventory(); x++ )
{
+1 -1
View File
@@ -11,7 +11,7 @@ import java.lang.annotation.Target;
* Marker interface to help identify invocation of reflection
*/
@Retention( RetentionPolicy.SOURCE )
@Target( { ElementType.CONSTRUCTOR, ElementType.FIELD } )
@Target( { ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE } )
public @interface Reflected
{
@@ -22,13 +22,14 @@ package appeng.integration;
import java.lang.reflect.Field;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModAPIManager;
import appeng.api.exceptions.ModNotInstalled;
import appeng.core.AEConfig;
import appeng.core.AELog;
public class IntegrationNode
public final class IntegrationNode
{
final String displayName;
@@ -59,12 +60,12 @@ public class IntegrationNode
public boolean isActive()
{
if( this.state == IntegrationStage.PRE_INIT )
this.Call( IntegrationStage.PRE_INIT );
this.call( IntegrationStage.PRE_INIT );
return this.state != IntegrationStage.FAILED;
}
void Call( IntegrationStage stage )
void call( IntegrationStage stage )
{
if( this.state != IntegrationStage.FAILED )
{
@@ -76,15 +77,15 @@ public class IntegrationNode
switch( stage )
{
case PRE_INIT:
boolean enabled = this.modID == null || Loader.isModLoaded( this.modID );
final ModAPIManager apiManager = ModAPIManager.INSTANCE;
boolean enabled = this.modID == null || Loader.isModLoaded( this.modID ) || apiManager.hasAPI( this.modID );
AEConfig.instance.addCustomCategoryComment( "ModIntegration", "Valid Values are 'AUTO', 'ON', or 'OFF' - defaults to 'AUTO' ; Suggested that you leave this alone unless your experiencing an issue, or wish to disable the integration for a reason." );
String Mode = AEConfig.instance.get( "ModIntegration", this.displayName.replace( " ", "" ), "AUTO" ).getString();
String mode = AEConfig.instance.get( "ModIntegration", this.displayName.replace( " ", "" ), "AUTO" ).getString();
if( Mode.toUpperCase().equals( "ON" ) )
if( mode.toUpperCase().equals( "ON" ) )
enabled = true;
if( Mode.toUpperCase().equals( "OFF" ) )
if( mode.toUpperCase().equals( "OFF" ) )
enabled = false;
if( enabled )
@@ -46,16 +46,16 @@ public enum IntegrationRegistry
public void init()
{
for( IntegrationNode node : this.modules )
node.Call( IntegrationStage.PRE_INIT );
node.call( IntegrationStage.PRE_INIT );
for( IntegrationNode node : this.modules )
node.Call( IntegrationStage.INIT );
node.call( IntegrationStage.INIT );
}
public void postInit()
{
for( IntegrationNode node : this.modules )
node.Call( IntegrationStage.POST_INIT );
node.call( IntegrationStage.POST_INIT );
}
public String getStatus()
@@ -95,7 +95,8 @@ public enum IntegrationRegistry
return node.instance;
}
}
throw new RuntimeException( "integration with " + name.name() + " is disabled." );
throw new IllegalStateException( "integration with " + name.name() + " is disabled." );
}
}
@@ -29,13 +29,9 @@ public enum IntegrationType
BC( IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon" ),
MJ6( IntegrationSide.BOTH, "BuildCraft6 Power", null ),
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", "CoFHAPI" ),
MJ5( IntegrationSide.BOTH, "BuildCraft5 Power", null ),
RF( IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", null ),
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", null ),
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", "CoFHAPI" ),
MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded" ),
@@ -46,7 +46,7 @@ public class InvTweaks extends BaseModule implements IInvTweaks
public void postInit()
{
if( api == null )
throw new RuntimeException( "InvTweaks API Instance Failed." );
throw new IllegalStateException( "InvTweaks API Instance Failed." );
}
@Override
@@ -146,7 +146,7 @@ public class NEI extends BaseModule implements INEI, IContainerTooltipHandler
}
catch( Throwable t )
{
throw new RuntimeException( "Invalid version of NEI, please update", t );
throw new IllegalStateException( "Invalid version of NEI, please update", t );
}
}
@@ -147,8 +147,8 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
if( cachedRecipe.hasOptional )
{
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( cachedRecipe.Chance );
fr.drawString( cachedRecipe.Chance, ( 168 - width ) / 2, 5, 0 );
int width = fr.getStringWidth( cachedRecipe.displayChance );
fr.drawString( cachedRecipe.displayChance, ( 168 - width ) / 2, 5, 0 );
}
else
{
@@ -186,10 +186,9 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
public class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe
{
public final ArrayList<PositionedStack> ingredients;
public final List<PositionedStack> ingredients;
public final PositionedStack result;
public String Chance;
public String displayChance;
boolean hasOptional = false;
public CachedGrindStoneRecipe( IGrinderEntry recipe )
@@ -199,8 +198,10 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
if( recipe.getOptionalOutput() != null )
{
final int chancePercent = (int) (recipe.getOptionalChance() * 100);
this.hasOptional = true;
this.Chance = ( (int) ( recipe.getOptionalChance() * 100 ) ) + GuiText.OfSecondOutput.getLocal();
this.displayChance = String.format( GuiText.OfSecondOutput.getLocal(), chancePercent );
this.ingredients.add( new PositionedStack( recipe.getOptionalOutput(), -30 + 107 + 18, 47 ) );
}
@@ -187,9 +187,13 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
{
return this.getClass().newInstance();
}
catch( Exception e )
catch( InstantiationException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( IllegalAccessException e )
{
throw new IllegalStateException( e );
}
}
+4 -4
View File
@@ -78,9 +78,9 @@ public abstract class AEBaseItem extends Item implements IAEFeature
@Override
@SuppressWarnings( "unchecked" )
public final void addInformation( ItemStack stack, EntityPlayer player, List lines, boolean displayAdditionalInformation )
public final void addInformation( ItemStack stack, EntityPlayer player, List lines, boolean displayMoreInfo )
{
this.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
this.addCheckedInformation( stack, player, lines, displayMoreInfo );
}
@Override
@@ -89,8 +89,8 @@ public abstract class AEBaseItem extends Item implements IAEFeature
return false;
}
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
super.addInformation( stack, player, lines, displayAdditionalInformation );
super.addInformation( stack, player, lines, displayMoreInfo );
}
}
@@ -85,9 +85,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
MaterialType mt = this.getTypeByStack( stack );
if( mt == null )
@@ -179,7 +179,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
if( this.dmgToMaterial.get( newMaterialNum ) == null )
this.dmgToMaterial.put( newMaterialNum, mat );
else
throw new RuntimeException( "Meta Overlap detected." );
throw new IllegalStateException( "Meta Overlap detected." );
return mat.stackSrc;
}
@@ -187,7 +187,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
return mat.stackSrc;
}
else
throw new RuntimeException( "Cannot create the same material twice..." );
throw new IllegalStateException( "Cannot create the same material twice..." );
}
public void makeUnique()
@@ -359,7 +359,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
}
catch( Throwable t )
{
throw new RuntimeException( t );
throw new IllegalStateException( t );
}
eqi.motionX = location.motionX;
@@ -162,13 +162,13 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
lines.add( ButtonToolTips.DoesntDespawn.getLocal() );
int progress = this.getProgress( stack ) % SINGLE_OFFSET;
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
}
@Override
@@ -98,7 +98,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj );
@@ -53,6 +53,8 @@ import appeng.core.features.AEFeature;
import appeng.core.features.ItemStackSrc;
import appeng.core.features.NameResolver;
import appeng.core.localization.GuiText;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.items.AEBaseItem;
@@ -79,13 +81,16 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
for( PartTypeIst p : this.dmgToPart.values() )
{
if( p.part == mat && p.variant == varID )
throw new RuntimeException( "Cannot create the same material twice..." );
throw new IllegalStateException( "Cannot create the same material twice..." );
}
boolean enabled = true;
for( AEFeature f : mat.getFeature() )
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
for( IntegrationType integrationType : mat.getIntegrations() )
enabled &= IntegrationRegistry.INSTANCE.isEnabled( integrationType );
int newPartNum = mat.baseDamage + varID;
ItemStackSrc output = new ItemStackSrc( this, newPartNum );
@@ -102,7 +107,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
}
else
{
throw new RuntimeException( "Meta Overlap detected." );
throw new IllegalStateException( "Meta Overlap detected." );
}
}
@@ -130,7 +135,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
for( PartTypeIst p : this.dmgToPart.values() )
{
if( p.part == mat && p.variant == varID )
throw new RuntimeException( "Cannot create the same material twice..." );
throw new IllegalStateException( "Cannot create the same material twice..." );
}
boolean enabled = true;
@@ -152,7 +157,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
return output;
}
else
throw new RuntimeException( "Meta Overlap detected." );
throw new IllegalStateException( "Meta Overlap detected." );
}
return null;
@@ -275,8 +280,9 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
}
catch( Throwable e )
{
throw new RuntimeException( "Unable to construct IBusPart from IBusItem : " + this.getTypeByStack( is ).getPart().getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + this.getTypeByStack( is ).getPart().getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
}
return null;
}
+48 -38
View File
@@ -20,11 +20,14 @@ package appeng.items.parts;
import java.lang.reflect.Constructor;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
import appeng.api.parts.IPart;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.integration.IntegrationType;
import appeng.parts.automation.PartAnnihilationPlane;
import appeng.parts.automation.PartExportBus;
import appeng.parts.automation.PartFormationPlane;
@@ -60,9 +63,9 @@ import appeng.parts.reporting.PartTerminal;
public enum PartType
{
InvalidType( -1, EnumSet.of( AEFeature.Core ), null ),
InvalidType( -1, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), null ),
CableGlass( 0, EnumSet.of( AEFeature.Core ), PartCableGlass.class )
CableGlass( 0, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
{
@Override
public boolean isCable()
@@ -71,7 +74,7 @@ public enum PartType
}
},
CableCovered( 20, EnumSet.of( AEFeature.Core ), PartCableCovered.class )
CableCovered( 20, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
{
@Override
public boolean isCable()
@@ -80,7 +83,7 @@ public enum PartType
}
},
CableSmart( 40, EnumSet.of( AEFeature.Channels ), PartCableSmart.class )
CableSmart( 40, EnumSet.of( AEFeature.Channels ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
{
@Override
public boolean isCable()
@@ -89,7 +92,7 @@ public enum PartType
}
},
CableDense( 60, EnumSet.of( AEFeature.Channels ), PartDenseCable.class )
CableDense( 60, EnumSet.of( AEFeature.Channels ), EnumSet.noneOf( IntegrationType.class ), PartDenseCable.class )
{
@Override
public boolean isCable()
@@ -98,74 +101,76 @@ public enum PartType
}
},
ToggleBus( 80, EnumSet.of( AEFeature.Core ), PartToggleBus.class ),
ToggleBus( 80, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
InvertedToggleBus( 100, EnumSet.of( AEFeature.Core ), PartInvertedToggleBus.class ),
InvertedToggleBus( 100, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartInvertedToggleBus.class ),
CableAnchor( 120, EnumSet.of( AEFeature.Core ), PartCableAnchor.class ),
CableAnchor( 120, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableAnchor.class ),
QuartzFiber( 140, EnumSet.of( AEFeature.Core ), PartQuartzFiber.class ),
QuartzFiber( 140, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
Monitor( 160, EnumSet.of( AEFeature.Core ), PartMonitor.class ),
Monitor( 160, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartMonitor.class ),
SemiDarkMonitor( 180, EnumSet.of( AEFeature.Core ), PartSemiDarkMonitor.class ),
SemiDarkMonitor( 180, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartSemiDarkMonitor.class ),
DarkMonitor( 200, EnumSet.of( AEFeature.Core ), PartDarkMonitor.class ),
DarkMonitor( 200, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartDarkMonitor.class ),
StorageBus( 220, EnumSet.of( AEFeature.StorageBus ), PartStorageBus.class ),
StorageBus( 220, EnumSet.of( AEFeature.StorageBus ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
ImportBus( 240, EnumSet.of( AEFeature.ImportBus ), PartImportBus.class ),
ImportBus( 240, EnumSet.of( AEFeature.ImportBus ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
ExportBus( 260, EnumSet.of( AEFeature.ExportBus ), PartExportBus.class ),
ExportBus( 260, EnumSet.of( AEFeature.ExportBus ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
LevelEmitter( 280, EnumSet.of( AEFeature.LevelEmitter ), PartLevelEmitter.class ),
LevelEmitter( 280, EnumSet.of( AEFeature.LevelEmitter ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
AnnihilationPlane( 300, EnumSet.of( AEFeature.AnnihilationPlane ), PartAnnihilationPlane.class ),
AnnihilationPlane( 300, EnumSet.of( AEFeature.AnnihilationPlane ), EnumSet.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
FormationPlane( 320, EnumSet.of( AEFeature.FormationPlane ), PartFormationPlane.class ),
FormationPlane( 320, EnumSet.of( AEFeature.FormationPlane ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
PatternTerminal( 340, EnumSet.of( AEFeature.Patterns ), PartPatternTerminal.class ),
PatternTerminal( 340, EnumSet.of( AEFeature.Patterns ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
CraftingTerminal( 360, EnumSet.of( AEFeature.CraftingTerminal ), PartCraftingTerminal.class ),
CraftingTerminal( 360, EnumSet.of( AEFeature.CraftingTerminal ), EnumSet.noneOf( IntegrationType.class ), PartCraftingTerminal.class ),
Terminal( 380, EnumSet.of( AEFeature.Core ), PartTerminal.class ),
Terminal( 380, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartTerminal.class ),
StorageMonitor( 400, EnumSet.of( AEFeature.StorageMonitor ), PartStorageMonitor.class ),
StorageMonitor( 400, EnumSet.of( AEFeature.StorageMonitor ), EnumSet.noneOf( IntegrationType.class ), PartStorageMonitor.class ),
ConversionMonitor( 420, EnumSet.of( AEFeature.PartConversionMonitor ), PartConversionMonitor.class ),
ConversionMonitor( 420, EnumSet.of( AEFeature.PartConversionMonitor ), EnumSet.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
Interface( 440, EnumSet.of( AEFeature.Core ), PartInterface.class ),
Interface( 440, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
P2PTunnelME( 460, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelME ), PartP2PTunnelME.class, GuiText.METunnel ),
P2PTunnelME( 460, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelME ), EnumSet.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel ),
P2PTunnelRedstone( 461, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRedstone ), PartP2PRedstone.class, GuiText.RedstoneTunnel ),
P2PTunnelRedstone( 461, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRedstone ), EnumSet.noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel ),
P2PTunnelItems( 462, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelItems ), PartP2PItems.class, GuiText.ItemTunnel ),
P2PTunnelItems( 462, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelItems ), EnumSet.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel ),
P2PTunnelLiquids( 463, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLiquids ), PartP2PLiquids.class, GuiText.FluidTunnel ),
P2PTunnelLiquids( 463, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLiquids ), EnumSet.noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel ),
P2PTunnelEU( 465, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelEU ), PartP2PIC2Power.class, GuiText.EUTunnel ),
P2PTunnelEU( 465, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelEU ), EnumSet.of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel ),
P2PTunnelRF( 466, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRF ), PartP2PRFPower.class, GuiText.RFTunnel ),
P2PTunnelRF( 466, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRF ), EnumSet.of( IntegrationType.RF ), PartP2PRFPower.class, GuiText.RFTunnel ),
P2PTunnelLight( 467, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLight ), PartP2PLight.class, GuiText.LightTunnel ),
P2PTunnelLight( 467, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLight ), EnumSet.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel ),
InterfaceTerminal( 480, EnumSet.of( AEFeature.InterfaceTerminal ), PartInterfaceTerminal.class );
InterfaceTerminal( 480, EnumSet.of( AEFeature.InterfaceTerminal ), EnumSet.noneOf( IntegrationType.class ), PartInterfaceTerminal.class );
public final int baseDamage;
private final EnumSet<AEFeature> features;
private final Set<AEFeature> features;
private final Set<IntegrationType> integrations;
private final Class<? extends IPart> myPart;
private final GuiText extraName;
public Constructor<? extends IPart> constructor;
PartType( int baseMetaValue, EnumSet<AEFeature> features, Class<? extends IPart> c )
PartType( int baseMetaValue, Set<AEFeature> features, Set<IntegrationType> integrations, Class<? extends IPart> c )
{
this( baseMetaValue, features, c, null );
this( baseMetaValue, features, integrations, c, null );
}
PartType( int baseMetaValue, EnumSet<AEFeature> features, Class<? extends IPart> c, GuiText en )
PartType( int baseMetaValue, Set<AEFeature> features, Set<IntegrationType> integrations, Class<? extends IPart> c, GuiText en )
{
this.features = features;
this.features = Collections.unmodifiableSet( features ) ;
this.integrations = Collections.unmodifiableSet( integrations );
this.myPart = c;
this.extraName = en;
this.baseDamage = baseMetaValue;
@@ -176,11 +181,16 @@ public enum PartType
return false;
}
public EnumSet<AEFeature> getFeature()
public Set<AEFeature> getFeature()
{
return this.features;
}
public Set<IntegrationType> getIntegrations()
{
return this.integrations;
}
public Class<? extends IPart> getPart()
{
return this.myPart;
@@ -38,6 +38,7 @@ import appeng.api.config.IncludeExclude;
import appeng.api.exceptions.MissingDefinition;
import appeng.api.implementations.items.IItemGroup;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IMEInventoryHandler;
@@ -55,12 +56,12 @@ import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, IItemGroup
public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, IItemGroup
{
final MaterialType component;
final int totalBytes;
final int perType;
final double idleDrain;
private final MaterialType component;
private final int totalBytes;
private final int perType;
private final double idleDrain;
public ItemBasicStorageCell( MaterialType whichCell, int kilobytes )
{
@@ -96,9 +97,9 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
IMEInventoryHandler inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
if( inventory instanceof ICellInventoryHandler )
{
@@ -113,12 +114,12 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
if( handler.isPreformatted() )
{
String List = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded ).getLocal();
String list = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded ).getLocal();
if( handler.isFuzzy() )
lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Fuzzy.getLocal() );
lines.add( GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Fuzzy.getLocal() );
else
lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Precise.getLocal() );
lines.add( GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal() );
}
}
}
@@ -136,6 +137,12 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
return this.perType;
}
@Override
public int getBytesPerType( ItemStack cellItem )
{
return this.perType;
}
@Override
public int getTotalTypes( ItemStack cellItem )
{
@@ -234,10 +241,24 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
{
playerInventory.setInventorySlotContents( playerInventory.currentItem, null );
// drop core
ItemStack extraB = ia.addItems( this.component.stack( 1 ) );
if( extraB != null )
player.dropPlayerItemWithRandomChoice( extraB, false );
// drop upgrades
final IInventory upgradesInventory = this.getUpgradesInventory( stack );
for( int upgradeIndex = 0; upgradeIndex < upgradesInventory.getSizeInventory(); upgradeIndex++ )
{
final ItemStack upgradeStack = upgradesInventory.getStackInSlot( upgradeIndex );
final ItemStack leftStack = ia.addItems( upgradeStack );
if( leftStack != null && upgradeStack.getItem() instanceof IUpgradeModule )
{
player.dropPlayerItemWithRandomChoice( upgradeStack, false );
}
}
// drop empty storage cell case
for( ItemStack storageCellStack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
{
final ItemStack extraA = ia.addItems( storageCellStack );
@@ -55,7 +55,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
WorldCoord wc = this.getStoredSize( stack );
if( wc.x > 0 )
@@ -166,7 +166,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
if( perms.isEmpty() )
@@ -46,7 +46,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
@@ -388,9 +388,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
@@ -417,6 +417,12 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return 8;
}
@Override
public int getBytesPerType( ItemStack cellItem )
{
return 8;
}
@Override
public int getTotalTypes( ItemStack cellItem )
{
@@ -95,9 +95,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
@@ -481,6 +481,12 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
return 8;
}
@Override
public int getBytesPerType( ItemStack cellItem )
{
return 8;
}
@Override
public int getTotalTypes( ItemStack cellItem )
{
@@ -80,9 +80,9 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
@@ -109,6 +109,12 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
return 8;
}
@Override
public int getBytesPerType( ItemStack cellItem )
{
return 8;
}
@Override
public int getTotalTypes( ItemStack cellItem )
{
@@ -73,9 +73,9 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
if( stack.hasTagCompound() )
{
@@ -54,7 +54,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
{
NBTTagCompound tag = stack.getTagCompound();
double internalCurrentPower = 0;
+1 -1
View File
@@ -305,7 +305,7 @@ public class GridNode implements IGridNode, IPathItem
this.setGridStorage( WorldSettings.getInstance().getGridStorage( node.getLong( "g" ) ) );
}
else
throw new RuntimeException( "Loading data after part of a grid, this is invalid." );
throw new IllegalStateException( "Loading data after part of a grid, this is invalid." );
}
@Override
+4 -4
View File
@@ -71,16 +71,16 @@ public class NetworkEventBus
classEvents.put( listAs, thisEvent );
}
else
throw new RuntimeException( "Invalid ME Network Event Subscriber, " + m.getName() + "s Parameter must extend MENetworkEvent." );
throw new IllegalStateException( "Invalid ME Network Event Subscriber, " + m.getName() + "s Parameter must extend MENetworkEvent." );
}
else
throw new RuntimeException( "Invalid ME Network Event Subscriber, " + m.getName() + " must have exactly 1 parameter." );
throw new IllegalStateException( "Invalid ME Network Event Subscriber, " + m.getName() + " must have exactly 1 parameter." );
}
}
}
catch( Throwable t )
{
throw new RuntimeException( "Error while adding " + c.getName() + " to event bus", t );
throw new IllegalStateException( "Error while adding " + c.getName() + " to event bus", t );
}
}
@@ -179,7 +179,7 @@ public class NetworkEventBus
AELog.severe( "Offending Class: " + obj.getClass().getName() );
AELog.severe( "Offending Object: " + obj.toString() );
AELog.error( e1 );
throw new RuntimeException( e1 );
throw new IllegalStateException( e1 );
}
if( e.isCanceled() )
+1 -1
View File
@@ -501,7 +501,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
{
if( world == null || grid == null || actionSrc == null || slotItem == null )
{
throw new RuntimeException( "Invalid Crafting Job Request" );
throw new IllegalArgumentException( "Invalid Crafting Job Request" );
}
CraftingJob job = new CraftingJob( world, grid, actionSrc, slotItem, cb );
+1 -1
View File
@@ -140,6 +140,6 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
final NetworkMonitor<?> last = DEPTH.pop();
if( last != this )
throw new RuntimeException( "Invalid Access to Networked Storage API detected." );
throw new IllegalStateException( "Invalid Access to Networked Storage API detected." );
}
}
@@ -934,7 +934,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
public IAEItemStack getItemStack( IAEItemStack what, CraftingItemList storage2 )
{
IAEItemStack is = null;
IAEItemStack is;
switch( storage2 )
{
case STORAGE:
@@ -960,7 +960,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
break;
default:
case ALL:
throw new RuntimeException( "Invalid Operation" );
throw new IllegalStateException( "Invalid Operation" );
}
if( is != null )
@@ -168,7 +168,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
private void surface( NetworkInventoryHandler<T> networkInventoryHandler, Actionable type )
{
if( this.getDepth( type ).pop() != this )
throw new RuntimeException( "Invalid Access to Networked Storage API detected." );
throw new IllegalStateException( "Invalid Access to Networked Storage API detected." );
}
private LinkedList getDepth( Actionable type )
@@ -348,7 +348,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
@Override
public void clearContainer()
{
throw new RuntimeException( "Now that is silly!" );
throw new UnsupportedOperationException( "Now that is silly!" );
}
@Override
@@ -887,7 +887,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
p.readFromStream( data );
}
else
throw new RuntimeException( "Invalid Stream For CableBus Container." );
throw new IllegalStateException( "Invalid Stream For CableBus Container." );
}
}
else if( this.getPart( side ) != null )
@@ -936,7 +936,8 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
return side;
}
}
throw new RuntimeException( "Uhh Bad Part on Side." );
throw new IllegalStateException( "Uhh Bad Part (" + part + ") on Side." );
}
public void readFromNBT( NBTTagCompound data )
@@ -117,7 +117,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
if( requestTotal <= 0 )
{
if( stack.pop() != this )
throw new RuntimeException( "Invalid Recursion detected." );
throw new IllegalStateException( "Invalid Recursion detected." );
return 0;
}
@@ -125,7 +125,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
if( !doFill )
{
if( stack.pop() != this )
throw new RuntimeException( "Invalid Recursion detected." );
throw new IllegalStateException( "Invalid Recursion detected." );
return Math.min( resource.amount, requestTotal );
}
@@ -154,7 +154,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
}
if( stack.pop() != this )
throw new RuntimeException( "Invalid Recursion detected." );
throw new IllegalStateException( "Invalid Recursion detected." );
return used;
}
@@ -41,7 +41,7 @@ import appeng.util.Platform;
@InterfaceList( value = { @Interface( iface = "cofh.api.energy.IEnergyReceiver", iname = "RF" ) } )
public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEnergyReceiver
public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEnergyReceiver
{
private static final ThreadLocal<Stack<PartP2PRFPower>> THREAD_STACK = new ThreadLocal<Stack<PartP2PRFPower>>();
/**
@@ -130,7 +130,7 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
}
if( stack.pop() != this )
throw new RuntimeException( "Invalid Recursion detected." );
throw new IllegalStateException( "Invalid Recursion detected." );
return total;
}
@@ -197,7 +197,7 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
}
if( stack.pop() != this )
throw new RuntimeException( "Invalid Recursion detected." );
throw new IllegalStateException( "Invalid Recursion detected." );
return total;
}
@@ -231,7 +231,7 @@ public class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implements IEn
}
if( stack.pop() != this )
throw new RuntimeException( "Invalid Recursion detected." );
throw new IllegalStateException( "Invalid Recursion detected." );
return total;
}
@@ -59,14 +59,21 @@ import appeng.core.AELog;
import appeng.core.localization.PlayerMessages;
import appeng.helpers.Reflected;
import appeng.me.GridAccessException;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
import appeng.util.item.AEItemStack;
/**
* @author AlgorithmX2
* @author thatsIch
* @version rv2
* @since rv0
*/
public class PartStorageMonitor extends PartMonitor implements IPartStorageMonitor, IStackWatcherHost
{
private static final ReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
private static final IWideReadableNumberConverter NUMBER_CONVERTER = ReadableNumberConverter.INSTANCE;
IAEItemStack configuredItem;
boolean isLocked;
IStackWatcher myWatcher;
@@ -229,8 +236,6 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
this.dspList = GLAllocation.generateDisplayLists( 1 );
Tessellator tess = Tessellator.instance;
if( Platform.isDrawing( tess ) )
return;
if( ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) != ( this.POWERED_FLAG | this.CHANNEL_FLAG ) )
return;
@@ -341,7 +346,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
GL11.glScalef( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f );
final long stackSize = ais.getStackSize();
final String renderedStackSize = NUMBER_CONVERTER.toHumanReadableForm( stackSize );
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize );
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
int width = fr.getStringWidth( renderedStackSize );
@@ -29,7 +29,6 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.annotation.Nonnull;
import net.minecraft.item.Item;
@@ -324,7 +323,7 @@ public class RecipeHandler implements IRecipeHandler
{
AELog.error( e );
if( this.data.crash )
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
}
@@ -332,7 +331,7 @@ public class RecipeHandler implements IRecipeHandler
public void injectRecipes()
{
if( cpw.mods.fml.common.Loader.instance().hasReachedState( LoaderState.POSTINITIALIZATION ) )
throw new RuntimeException( "Recipes must now be loaded in Init." );
throw new IllegalStateException( "Recipes must now be loaded in Init." );
HashMap<Class, Integer> processed = new HashMap<Class, Integer>();
try
@@ -376,7 +375,7 @@ public class RecipeHandler implements IRecipeHandler
if( this.data.exceptions )
AELog.error( e );
if( this.data.crash )
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
for( Entry<Class, Integer> e : processed.entrySet() )
@@ -100,7 +100,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
ret.append( tmp ).append( ", " );
}
ret.append( this.output );
throw new RuntimeException( ret.toString() );
throw new IllegalStateException( ret.toString() );
}
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
@@ -122,7 +122,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
ret.append( tmp ).append( ", " );
}
ret.append( this.output );
throw new RuntimeException( ret.toString() );
throw new IllegalStateException( ret.toString() );
}
}
@@ -56,7 +56,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
ret.append( tmp ).append( ", " );
}
ret.append( this.output );
throw new RuntimeException( ret.toString() );
throw new IllegalArgumentException( ret.toString() );
}
}
}
@@ -55,6 +55,7 @@ public class MekCrusher implements ICraftHandler, IWebsiteSerializer
return;
}
}
throw new RecipeError( "MekCrusher must have a single input, and single output." );
}
+2 -3
View File
@@ -27,10 +27,9 @@ import net.minecraft.server.MinecraftServer;
import com.google.common.base.Joiner;
public class AECommand extends CommandBase
public final class AECommand extends CommandBase
{
final MinecraftServer srv;
private final MinecraftServer srv;
public AECommand( MinecraftServer server )
{
@@ -58,13 +58,13 @@ public class ServerHelper extends CommonHelper
@Override
public World getWorld()
{
throw new RuntimeException( "This is a server..." );
throw new UnsupportedOperationException( "This is a server..." );
}
@Override
public void bindTileEntitySpecialRenderer( Class tile, AEBaseBlock blk )
{
throw new RuntimeException( "This is a server..." );
throw new UnsupportedOperationException( "This is a server..." );
}
@Override
@@ -179,6 +179,6 @@ public class ServerHelper extends CommonHelper
@Override
public void missingCoreMod()
{
throw new RuntimeException( "Unable to Load Core Mod, please verify that AE2 is properly install in the mods folder, with a .jar extension." );
throw new IllegalStateException( "Unable to Load Core Mod, please verify that AE2 is properly install in the mods folder, with a .jar extension." );
}
}
@@ -1,7 +1,6 @@
package appeng.services.version;
import java.security.InvalidParameterException;
import java.util.Scanner;
import java.util.regex.Pattern;
@@ -111,7 +110,7 @@ public final class VersionParser
}
}
throw new InvalidParameterException( "Raw channel did not contain any of the pre-programmed types." );
throw new IllegalArgumentException( "Raw channel " + rawChannel + " did not contain any of the pre-programmed types." );
}
/**
@@ -269,7 +269,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
Collections.shuffle( places );
if( places.isEmpty() )
throw new RuntimeException( "No air or even the tile hat was destroyed?!?!" );
throw new IllegalStateException( this.cluster + " does not contain any kind of blocks, which were destroyed." );
for( IAEItemStack ais : inv.getAvailableItems( AEApi.instance().storage().createItemList() ) )
{
@@ -51,15 +51,15 @@ public class AETileEventHandler
}
catch( IllegalAccessException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
}
@@ -72,15 +72,15 @@ public class AETileEventHandler
}
catch( IllegalAccessException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
}
@@ -93,15 +93,15 @@ public class AETileEventHandler
}
catch( IllegalAccessException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
}
@@ -114,15 +114,15 @@ public class AETileEventHandler
}
catch( IllegalAccessException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
}
@@ -144,15 +144,15 @@ public class AETileEventHandler
}
catch( IllegalAccessException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( IllegalArgumentException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
catch( InvocationTargetException e )
{
throw new RuntimeException( e );
throw new IllegalStateException( e );
}
}
}
@@ -48,7 +48,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
final ConfigManager cm = new ConfigManager( this );
final ConfigManager manager = new ConfigManager( this );
IInventory cacheUpgrades = null;
IInventory cacheConfig = null;
@@ -56,7 +56,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
public TileCellWorkbench()
{
this.cm.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
this.manager.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
this.cell.enableClientEvents = true;
}
@@ -97,7 +97,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
{
this.cell.writeToNBT( data, "cell" );
this.config.writeToNBT( data, "config" );
this.cm.writeToNBT( data );
this.manager.writeToNBT( data );
}
@TileEvent( TileEventType.WORLD_NBT_READ )
@@ -105,7 +105,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
{
this.cell.readFromNBT( data, "cell" );
this.config.readFromNBT( data, "config" );
this.cm.readFromNBT( data );
this.manager.readFromNBT( data );
}
@Override
@@ -136,13 +136,13 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
this.cacheUpgrades = null;
this.cacheConfig = null;
IInventory c = this.getCellConfigInventory();
if( c != null )
IInventory configInventory = this.getCellConfigInventory();
if( configInventory != null )
{
boolean cellHasConfig = false;
for( int x = 0; x < c.getSizeInventory(); x++ )
for( int x = 0; x < configInventory.getSizeInventory(); x++ )
{
if( c.getStackInSlot( x ) != null )
if( configInventory.getStackInSlot( x ) != null )
{
cellHasConfig = true;
break;
@@ -152,17 +152,17 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
if( cellHasConfig )
{
for( int x = 0; x < this.config.getSizeInventory(); x++ )
this.config.setInventorySlotContents( x, c.getStackInSlot( x ) );
this.config.setInventorySlotContents( x, configInventory.getStackInSlot( x ) );
}
else
{
for( int x = 0; x < this.config.getSizeInventory(); x++ )
c.setInventorySlotContents( x, this.config.getStackInSlot( x ) );
configInventory.setInventorySlotContents( x, this.config.getStackInSlot( x ) );
c.markDirty();
configInventory.markDirty();
}
}
else if( this.cm.getSetting( Settings.COPY_MODE ) == CopyMode.CLEAR_ON_REMOVE )
else if( this.manager.getSetting( Settings.COPY_MODE ) == CopyMode.CLEAR_ON_REMOVE )
{
for( int x = 0; x < this.config.getSizeInventory(); x++ )
this.config.setInventorySlotContents( x, null );
@@ -185,7 +185,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
}
}
public IInventory getCellConfigInventory()
private IInventory getCellConfigInventory()
{
if( this.cacheConfig == null )
{
@@ -201,7 +201,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
if( inv == null )
return null;
return this.cacheConfig = inv;
this.cacheConfig = inv;
}
return this.cacheConfig;
}
@@ -218,7 +218,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
@Override
public IConfigManager getConfigManager()
{
return this.cm;
return this.manager;
}
@Override
@@ -785,7 +785,6 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
private static class ChestNoHandler extends Exception
{
private static final long serialVersionUID = 7995805326136526631L;
}
@@ -20,6 +20,7 @@ package appeng.transformer;
import java.util.Map;
import javax.annotation.Nullable;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.LoadController;
@@ -36,25 +37,21 @@ import appeng.core.AEConfig;
@MCVersion( "1.7.10" )
public class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin
public final class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin
{
public final AppEngCore instance;
protected final ModMetadata md = new ModMetadata();
private final ModMetadata metadata = new ModMetadata();
public AppEngCore()
{
this.instance = this;
FMLRelaunchLog.info( "[AppEng] Core Init" );
this.md.autogenerated = false;
this.md.authorList.add( "AlgorithmX2" );
this.md.credits = "AlgorithmX2";
this.md.modId = this.getModId();
this.md.version = this.getVersion();
this.md.name = this.getName();
this.md.url = "http://ae2.ae-mod.info";
this.md.description = "Embedded Coremod for Applied Energistics 2";
this.metadata.autogenerated = false;
this.metadata.authorList.add( "AlgorithmX2" );
this.metadata.credits = "AlgorithmX2";
this.metadata.modId = this.getModId();
this.metadata.version = this.getVersion();
this.metadata.name = this.getName();
this.metadata.url = "http://ae2.ae-mod.info";
this.metadata.description = "Embedded Coremod for Applied Energistics 2";
}
@EventHandler
@@ -74,6 +71,7 @@ public class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin
return "appeng.transformer.AppEngCore";
}
@Nullable
@Override
public String getSetupClass()
{
@@ -95,7 +93,7 @@ public class AppEngCore extends DummyModContainer implements IFMLLoadingPlugin
@Override
public ModMetadata getMetadata()
{
return this.md;
return this.metadata;
}
@Override
@@ -23,18 +23,24 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiErrorScreen;
import cpw.mods.fml.client.CustomModLoadingErrorDisplayException;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MissingCoreMod extends CustomModLoadingErrorDisplayException
@SideOnly( Side.CLIENT )
public final class MissingCoreMod extends CustomModLoadingErrorDisplayException
{
private static final int SHADOW_WHITE = 0xeeeeee;
private static final int COLOR_WHITE = 0xffffff;
private static final long serialVersionUID = -966774766922821652L;
private static final int SCREEN_OFFSET = 15;
private boolean deobf = false;
@Override
public void initGui( GuiErrorScreen errorScreen, FontRenderer fontRenderer )
{
Class clz = errorScreen.getClass();
Class<?> clz = errorScreen.getClass();
try
{
clz.getField( "mc" );
@@ -50,35 +56,46 @@ public class MissingCoreMod extends CustomModLoadingErrorDisplayException
public void drawScreen( GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime )
{
int offset = 10;
this.drawCenteredString( fontRenderer, "Sorry, couldn't load AE2 Properly.", errorScreen.width / 2, offset += 15, 0xffffff );
this.drawCenteredString( fontRenderer, "Please make sure that AE2 is installed into your mods folder.", errorScreen.width / 2, offset += 15, 0xeeeeee );
this.drawCenteredString( fontRenderer, "Sorry, couldn't load AE2 properly.", errorScreen.width / 2, offset, COLOR_WHITE );
offset += 15;
offset += SCREEN_OFFSET;
this.drawCenteredString( fontRenderer, "Please make sure that AE2 is installed into your mods folder.", errorScreen.width / 2, offset, SHADOW_WHITE );
offset += 2 * SCREEN_OFFSET;
if( this.deobf )
{
offset += 15;
this.drawCenteredString( fontRenderer, "In a developer environment add the following too your args,", errorScreen.width / 2, offset += 15, 0xffffff );
this.drawCenteredString( fontRenderer, "-Dfml.coreMods.load=appeng.transformer.AppEngCore", errorScreen.width / 2, offset += 15, 0xeeeeee );
offset += SCREEN_OFFSET;
this.drawCenteredString( fontRenderer, "In a developer environment add the following too your args,", errorScreen.width / 2, offset, COLOR_WHITE );
offset += SCREEN_OFFSET;
this.drawCenteredString( fontRenderer, "-Dfml.coreMods.load=appeng.transformer.AppEngCore", errorScreen.width / 2, offset, SHADOW_WHITE );
}
else
{
this.drawCenteredString( fontRenderer, "You're launcher may refer to this by different names,", errorScreen.width / 2, offset += 15, 0xffffff );
this.drawCenteredString( fontRenderer, "You're launcher may refer to this by different names,", errorScreen.width / 2, offset, COLOR_WHITE );
offset += 5;
offset += SCREEN_OFFSET + 5;
this.drawCenteredString( fontRenderer, "MultiMC calls this tab \"Loader Mods\"", errorScreen.width / 2, offset += 15, 0xeeeeee );
this.drawCenteredString( fontRenderer, "Magic Launcher calls this tab \"External Mods\"", errorScreen.width / 2, offset += 15, 0xeeeeee );
this.drawCenteredString( fontRenderer, "Most other launchers refer to this tab as just \"Mods\"", errorScreen.width / 2, offset += 15, 0xeeeeee );
this.drawCenteredString( fontRenderer, "MultiMC calls this tab \"Loader Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE );
offset += 15;
offset += SCREEN_OFFSET;
this.drawCenteredString( fontRenderer, "Magic Launcher calls this tab \"External Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE );
this.drawCenteredString( fontRenderer, "Also make sure that the AE2 file is a .jar, and not a .zip", errorScreen.width / 2, offset += 15, 0xffffff );
offset += SCREEN_OFFSET;
this.drawCenteredString( fontRenderer, "Most other launchers refer to this tab as just \"Mods\"", errorScreen.width / 2, offset, SHADOW_WHITE );
offset += 2 * SCREEN_OFFSET;
this.drawCenteredString( fontRenderer, "Also make sure that the AE2 file is a .jar, and not a .zip", errorScreen.width / 2, offset, COLOR_WHITE );
}
}
public void drawCenteredString( FontRenderer fontRenderer, String string, int x, int y, int colour )
private void drawCenteredString( FontRenderer fontRenderer, String string, int x, int y, int colour )
{
fontRenderer.drawStringWithShadow( string, x - fontRenderer.getStringWidth( string.replaceAll( "\\P{InBasic_Latin}", "" ) ) / 2, y, colour );
final String reEncoded = string.replaceAll( "\\P{InBasic_Latin}", "" );
final int reEndcodedWidth = fontRenderer.getStringWidth( reEncoded );
final int centeredX = x - reEndcodedWidth / 2;
fontRenderer.drawStringWithShadow( string, centeredX, y, colour );
}
}

Some files were not shown because too many files have changed in this diff Show More