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.
This commit is contained in:
thatsIch
2015-03-23 10:14:35 +01:00
parent 817163dbf6
commit 3783ae8619
76 changed files with 288 additions and 290 deletions
+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 );
}
}
@@ -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();
}
}
@@ -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 );
}
}
}
@@ -53,9 +53,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;
@@ -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
+3 -2
View File
@@ -119,8 +119,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 );
}
+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 )
+1 -1
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();
+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() ) );
}
}
@@ -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 );
@@ -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 );
}
}
@@ -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;
@@ -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;
+3 -2
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 )
@@ -80,7 +81,7 @@ public enum PartRegistry
}
catch( Throwable t )
{
throw new RuntimeException( t );
throw new IllegalStateException( t );
}
}
@@ -598,7 +598,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
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;
@@ -629,9 +629,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?
@@ -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++ )
{
@@ -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." );
}
}
@@ -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 );
}
}
@@ -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 );
}
}
@@ -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;
@@ -79,7 +79,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;
@@ -102,7 +102,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
}
else
{
throw new RuntimeException( "Meta Overlap detected." );
throw new IllegalStateException( "Meta Overlap detected." );
}
}
@@ -130,7 +130,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 +152,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 +275,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;
}
+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;
}
@@ -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;
}
@@ -229,8 +229,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;
@@ -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 );
}
}
}
@@ -785,7 +785,6 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
private static class ChestNoHandler extends Exception
{
private static final long serialVersionUID = 7995805326136526631L;
}
@@ -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 );
}
}
@@ -153,7 +153,7 @@ public class ASMIntegration implements IClassTransformer
private boolean stripInterface( ClassNode classNode, Class class1, AnnotationNode an )
{
if( an.values.size() != 4 )
throw new RuntimeException( "Unable to handle Interface annotation on " + classNode.name );
throw new IllegalArgumentException( "Unable to handle Interface annotation on " + classNode.name );
String iFace = null;
String iName = null;
@@ -182,7 +182,7 @@ public class ASMIntegration implements IClassTransformer
this.log( "Allowing Interface " + iFace + " from " + classNode.name + " because " + iName + " integration is enabled." );
}
else
throw new RuntimeException( "Unable to handle Method annotation on " + classNode.name );
throw new IllegalStateException( "Unable to handle Method annotation on " + classNode.name );
return false;
}
@@ -190,7 +190,7 @@ public class ASMIntegration implements IClassTransformer
private boolean stripMethod( ClassNode classNode, MethodNode mn, Iterator<MethodNode> i, Class class1, AnnotationNode an )
{
if( an.values.size() != 2 )
throw new RuntimeException( "Unable to handle Method annotation on " + classNode.name );
throw new IllegalArgumentException( "Unable to handle Method annotation on " + classNode.name );
String iName = null;
@@ -210,7 +210,7 @@ public class ASMIntegration implements IClassTransformer
this.log( "Allowing Method " + mn.name + " from " + classNode.name + " because " + iName + " integration is enabled." );
}
else
throw new RuntimeException( "Unable to handle Method annotation on " + classNode.name );
throw new IllegalStateException( "Unable to handle Method annotation on " + classNode.name );
return false;
}
+1 -1
View File
@@ -62,7 +62,7 @@ public final class ConfigManager implements IConfigManager
if( oldValue != null )
return oldValue;
throw new RuntimeException( "Invalid Config setting" );
throw new IllegalStateException( "Invalid Config setting. Expected a non-null value for " + settingName );
}
@Override
+3 -9
View File
@@ -21,6 +21,7 @@ package appeng.util;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.security.InvalidParameterException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -31,13 +32,11 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.WeakHashMap;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@@ -951,7 +950,7 @@ public class Platform
public static EntityPlayer getPlayer( WorldServer w )
{
if( w == null )
throw new NullPointerException();
throw new InvalidParameterException( "World is null." );
EntityPlayer wrp = FAKE_PLAYERS.get( w );
if( wrp != null )
@@ -1578,11 +1577,6 @@ public class Platform
return !gs.hasPermission( playerID, SecurityPermissions.BUILD );
}
public static boolean isDrawing( Tessellator tess )
{
return false;
}
public static void configurePlayer( EntityPlayer player, ForgeDirection side, TileEntity tile )
{
float pitch = 0.0f;
@@ -25,15 +25,15 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
public class IMEAdaptorIterator implements Iterator<ItemSlot>
public final class IMEAdaptorIterator implements Iterator<ItemSlot>
{
private final Iterator<IAEItemStack> stack;
private final ItemSlot slot = new ItemSlot();
private final IMEAdaptor parent;
private final int containerSize;
final Iterator<IAEItemStack> stack;
final ItemSlot slot = new ItemSlot();
final IMEAdaptor parent;
final int containerSize;
int offset = 0;
boolean hasNext;
private int offset = 0;
private boolean hasNext;
public IMEAdaptorIterator( IMEAdaptor parent, IItemList<IAEItemStack> availableItems )
{
@@ -73,6 +73,6 @@ public class IMEAdaptorIterator implements Iterator<ItemSlot>
@Override
public void remove()
{
throw new RuntimeException( "Not Implemented!" );
throw new UnsupportedOperationException();
}
}
@@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import javax.annotation.Nonnull;
import io.netty.buffer.ByteBuf;
@@ -60,15 +61,12 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
this.myHash = is.myHash;
}
private AEFluidStack( FluidStack is )
private AEFluidStack( @Nonnull FluidStack is )
{
if( is == null )
throw new RuntimeException( "Invalid Itemstack." );
this.fluid = is.getFluid();
if( this.fluid == null )
throw new RuntimeException( "Fluid is null." );
throw new IllegalArgumentException( "Fluid is null." );
this.stackSize = is.amount;
this.setCraftable( false );
+1 -1
View File
@@ -79,7 +79,7 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
return true;
if( !this.clz.isInstance( st ) )
throw new RuntimeException( "WRONG TYPE - got " + st.getClass().getName() + " expected " + this.clz.getName() );
throw new IllegalArgumentException( "WRONG TYPE - got " + st.getClass().getName() + " expected " + this.clz.getName() );
return false;
}
@@ -25,37 +25,38 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.tile.inventory.AppEngInternalAEInventory;
public class AEInvIterator implements Iterator<IAEItemStack>
public final class AEInvIterator implements Iterator<IAEItemStack>
{
private final AppEngInternalAEInventory inventory;
private final int size;
final AppEngInternalAEInventory inv;
final int size;
private int counter = 0;
int x = 0;
public AEInvIterator( AppEngInternalAEInventory i )
public AEInvIterator( AppEngInternalAEInventory inventory )
{
this.inv = i;
this.size = this.inv.getSizeInventory();
this.inventory = inventory;
this.size = this.inventory.getSizeInventory();
}
@Override
public boolean hasNext()
{
return this.x < this.size;
return this.counter < this.size;
}
@Override
public IAEItemStack next()
{
IAEItemStack result = this.inv.getAEStackInSlot( this.x );
this.x++;
final IAEItemStack result = this.inventory.getAEStackInSlot( this.counter );
this.counter++;
return result;
}
@Override
public void remove()
{
throw new RuntimeException( "no..." );
throw new UnsupportedOperationException();
}
}
@@ -22,11 +22,11 @@ package appeng.util.iterators;
import java.util.Iterator;
public class ChainedIterator<T> implements Iterator<T>
public final class ChainedIterator<T> implements Iterator<T>
{
private final T[] list;
final T[] list;
int offset = 0;
private int offset = 0;
public ChainedIterator( T... list )
{
@@ -50,6 +50,6 @@ public class ChainedIterator<T> implements Iterator<T>
@Override
public void remove()
{
throw new RuntimeException( "Not implemented." );
throw new UnsupportedOperationException();
}
}
@@ -25,37 +25,37 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class InvIterator implements Iterator<ItemStack>
public final class InvIterator implements Iterator<ItemStack>
{
private final IInventory inventory;
private final int size;
final IInventory inv;
final int size;
private int counter = 0;
int x = 0;
public InvIterator( IInventory i )
public InvIterator( IInventory inventory )
{
this.inv = i;
this.size = this.inv.getSizeInventory();
this.inventory = inventory;
this.size = this.inventory.getSizeInventory();
}
@Override
public boolean hasNext()
{
return this.x < this.size;
return this.counter < this.size;
}
@Override
public ItemStack next()
{
ItemStack result = this.inv.getStackInSlot( this.x );
this.x++;
ItemStack result = this.inventory.getStackInSlot( this.counter );
this.counter++;
return result;
}
@Override
public void remove()
{
throw new RuntimeException( "no..." );
throw new UnsupportedOperationException();
}
}
@@ -27,10 +27,9 @@ import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
public class ProxyNodeIterator implements Iterator<IGridNode>
public final class ProxyNodeIterator implements Iterator<IGridNode>
{
final Iterator<IGridHost> hosts;
private final Iterator<IGridHost> hosts;
public ProxyNodeIterator( Iterator<IGridHost> hosts )
{
@@ -53,6 +52,6 @@ public class ProxyNodeIterator implements Iterator<IGridNode>
@Override
public void remove()
{
throw new RuntimeException( "Not implemented." );
throw new UnsupportedOperationException();
}
}
@@ -24,7 +24,6 @@ import appeng.api.storage.data.IAEStack;
public interface IPartitionList<T extends IAEStack<T>>
{
boolean isListed( T input );
boolean isEmpty();
@@ -20,16 +20,16 @@ package appeng.util.prioitylist;
import java.util.ArrayList;
import java.util.List;
import java.util.Collection;
import appeng.api.storage.data.IAEStack;
public class MergedPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
public final class MergedPriorityList<T extends IAEStack<T>> implements IPartitionList<T>
{
final List<IPartitionList<T>> positive = new ArrayList<IPartitionList<T>>();
final List<IPartitionList<T>> negative = new ArrayList<IPartitionList<T>>();
private final Collection<IPartitionList<T>> positive = new ArrayList<IPartitionList<T>>();
private final Collection<IPartitionList<T>> negative = new ArrayList<IPartitionList<T>>();
public void addNewList( IPartitionList<T> list, boolean isWhitelist )
{
@@ -67,6 +67,6 @@ public class MergedPriorityList<T extends IAEStack<T>> implements IPartitionList
@Override
public Iterable<T> getItems()
{
throw new RuntimeException( "Not Implemented" );
throw new UnsupportedOperationException();
}
}