Merge pull request #1299 from thatsIch/e-qol-exception-messages

Improved exceptions
This commit is contained in:
thatsIch
2015-04-23 23:41:44 +02:00
76 changed files with 288 additions and 290 deletions
@@ -601,7 +601,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;
@@ -632,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?
@@ -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++ )
{