Puts everywhere brackets

This commit is contained in:
thatsIch
2015-04-29 02:30:53 +02:00
parent 23aa8fd72d
commit 64ed05a1b4
465 changed files with 6726 additions and 14 deletions
+176
View File
@@ -196,10 +196,14 @@ public class Platform
String unitName = displayUnits.name();
if( displayUnits == PowerUnits.WA )
{
unitName = "J";
}
if( displayUnits == PowerUnits.MK )
{
unitName = "J";
}
while( p > 1000 && offset < preFixes.length )
{
@@ -244,9 +248,13 @@ public class Platform
do
{
if( backwards )
{
ce = prevEnum( ce );
}
else
{
ce = nextEnum( ce );
}
}
while( !ValidOptions.contains( ce ) || isNotValidSetting( ce ) );
@@ -262,16 +270,22 @@ public class Platform
int pLoc = ce.ordinal() - 1;
if( pLoc < 0 )
{
pLoc = valList.size() - 1;
}
if( pLoc < 0 || pLoc >= valList.size() )
{
pLoc = 0;
}
int pos = 0;
for( Object g : valList )
{
if( pos == pLoc )
{
return (T) g;
}
pos++;
}
@@ -287,16 +301,22 @@ public class Platform
int pLoc = ce.ordinal() + 1;
if( pLoc >= valList.size() )
{
pLoc = 0;
}
if( pLoc < 0 || pLoc >= valList.size() )
{
pLoc = 0;
}
int pos = 0;
for( Object g : valList )
{
if( pos == pLoc )
{
return (T) g;
}
pos++;
}
@@ -306,13 +326,19 @@ public class Platform
private static boolean isNotValidSetting( Enum e )
{
if( e == SortOrder.INVTWEAKS && !AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks ) )
{
return true;
}
if( e == SearchBoxMode.NEI_AUTOSEARCH && !AppEng.instance.isIntegrationEnabled( IntegrationType.NEI ) )
{
return true;
}
if( e == SearchBoxMode.NEI_MANUAL_SEARCH && !AppEng.instance.isIntegrationEnabled( IntegrationType.NEI ) )
{
return true;
}
return false;
}
@@ -320,7 +346,9 @@ public class Platform
public static void openGUI( @Nonnull EntityPlayer p, @Nullable TileEntity tile, @Nullable ForgeDirection side, @Nonnull GuiBridge type )
{
if( isClient() )
{
return;
}
int x = (int) p.posX;
int y = (int) p.posY;
@@ -335,11 +363,17 @@ public class Platform
if( ( type.getType().isItem() && tile == null ) || type.hasPermissions( tile, x, y, z, side, p ) )
{
if( tile == null && type.getType() == GuiHostType.ITEM )
{
p.openGui( AppEng.instance, type.ordinal() << 4 | ( 0 << 3 ), p.getEntityWorld(), p.inventory.currentItem, 0, 0 );
}
else if( tile == null || type.getType() == GuiHostType.ITEM )
{
p.openGui( AppEng.instance, type.ordinal() << 4 | ( 1 << 3 ), p.getEntityWorld(), x, y, z );
}
else
{
p.openGui( AppEng.instance, type.ordinal() << 4 | ( side.ordinal() ), tile.getWorldObj(), x, y, z );
}
}
}
@@ -378,22 +412,34 @@ public class Platform
public static boolean sameStackStags( ItemStack a, ItemStack b )
{
if( a == null && b == null )
{
return true;
}
if( a == null || b == null )
{
return false;
}
if( a == b )
{
return true;
}
NBTTagCompound ta = a.getTagCompound();
NBTTagCompound tb = b.getTagCompound();
if( ta == tb )
{
return true;
}
if( ( ta == null && tb == null ) || ( ta != null && ta.hasNoTags() && tb == null ) || ( tb != null && tb.hasNoTags() && ta == null ) || ( ta != null && ta.hasNoTags() && tb != null && tb.hasNoTags() ) )
{
return true;
}
if( ( ta == null && tb != null ) || ( ta != null && tb == null ) )
{
return false;
}
// if both tags are shared this is easy...
if( AESharedNBT.isShared( ta ) && AESharedNBT.isShared( tb ) )
@@ -426,7 +472,9 @@ public class Platform
Set<String> cB = ctB.func_150296_c();
if( cA.size() != cB.size() )
{
return false;
}
for( String name : cA )
{
@@ -451,20 +499,28 @@ public class Platform
NBTTagList lA = (NBTTagList) A;
NBTTagList lB = (NBTTagList) B;
if( lA.tagCount() != lB.tagCount() )
{
return false;
}
List<NBTBase> tag = tagList( lA );
List<NBTBase> aTag = tagList( lB );
if( tag.size() != aTag.size() )
{
return false;
}
for( int x = 0; x < tag.size(); x++ )
{
if( aTag.get( x ) == null )
{
return false;
}
if( !NBTEqualityTest( tag.get( x ), aTag.get( x ) ) )
{
return false;
}
}
return true;
@@ -624,7 +680,9 @@ public class Platform
}
if( out == null )
{
return new ItemStack[0];
}
return out.toArray( new ItemStack[out.size()] );
}
@@ -739,7 +797,9 @@ public class Platform
{
teB = teA.getWorldObj().getTileEntity( teA.xCoord + 1, teA.yCoord, teA.zCoord );
if( !( teB instanceof TileEntityChest ) )
{
teB = null;
}
}
if( teB == null )
@@ -748,7 +808,9 @@ public class Platform
{
teB = teA.getWorldObj().getTileEntity( teA.xCoord - 1, teA.yCoord, teA.zCoord );
if( !( teB instanceof TileEntityChest ) )
{
teB = null;
}
else
{
TileEntityChest x = teA;
@@ -764,7 +826,9 @@ public class Platform
{
teB = teA.getWorldObj().getTileEntity( teA.xCoord, teA.yCoord, teA.zCoord + 1 );
if( !( teB instanceof TileEntityChest ) )
{
teB = null;
}
}
}
@@ -774,7 +838,9 @@ public class Platform
{
teB = teA.getWorldObj().getTileEntity( teA.xCoord, teA.yCoord, teA.zCoord - 1 );
if( !( teB instanceof TileEntityChest ) )
{
teB = null;
}
else
{
TileEntityChest x = teA;
@@ -785,7 +851,9 @@ public class Platform
}
if( teB == null )
{
return teA;
}
return new InventoryLargeChest( "", teA, (TileEntityChest) teB );
}
@@ -820,7 +888,9 @@ public class Platform
public static List getTooltip( Object o )
{
if( o == null )
{
return new ArrayList();
}
ItemStack itemStack = null;
if( o instanceof AEItemStack )
@@ -829,9 +899,13 @@ public class Platform
return ais.getToolTip();
}
else if( o instanceof ItemStack )
{
itemStack = (ItemStack) o;
}
else
{
return new ArrayList();
}
try
{
@@ -846,7 +920,9 @@ public class Platform
public static String getModId( IAEItemStack is )
{
if( is == null )
{
return "** Null";
}
String n = ( (AEItemStack) is ).getModID();
return n == null ? "** Null" : n;
@@ -855,7 +931,9 @@ public class Platform
public static String getItemDisplayName( Object o )
{
if( o == null )
{
return "** Null";
}
ItemStack itemStack = null;
if( o instanceof AEItemStack )
@@ -864,15 +942,21 @@ public class Platform
return n == null ? "** Null" : n;
}
else if( o instanceof ItemStack )
{
itemStack = (ItemStack) o;
}
else
{
return "**Invalid Object";
}
try
{
String name = itemStack.getDisplayName();
if( name == null || name.isEmpty() )
{
name = itemStack.getItem().getUnlocalizedName( itemStack );
}
return name == null ? "** Null" : name;
}
catch( Exception errA )
@@ -892,10 +976,14 @@ public class Platform
public static boolean hasSpecialComparison( IAEItemStack willAdd )
{
if( willAdd == null )
{
return false;
}
IAETagCompound tag = willAdd.getTagCompound();
if( tag != null && tag.getSpecialComparison() != null )
{
return true;
}
return false;
}
@@ -904,7 +992,9 @@ public class Platform
if( AESharedNBT.isShared( willAdd.getTagCompound() ) )
{
if( ( (AESharedNBT) willAdd.getTagCompound() ).getSpecialComparison() != null )
{
return true;
}
}
return false;
}
@@ -938,7 +1028,9 @@ public class Platform
public static boolean isChargeable( ItemStack i )
{
if( i == null )
{
return false;
}
Item it = i.getItem();
if( it instanceof IAEItemPowerStorage )
{
@@ -950,11 +1042,15 @@ public class Platform
public static EntityPlayer getPlayer( WorldServer w )
{
if( w == null )
{
throw new InvalidParameterException( "World is null." );
}
EntityPlayer wrp = FAKE_PLAYERS.get( w );
if( wrp != null )
{
return wrp;
}
EntityPlayer p = FakePlayerFactory.getMinecraft( w );
FAKE_PLAYERS.put( w, p );
@@ -998,7 +1094,9 @@ public class Platform
for( int x = 0; x < l.length; x++ )
{
if( l[x] == null )
{
return x;
}
}
return -1;
}
@@ -1014,14 +1112,18 @@ public class Platform
}
index--;
if( i.hasNext() )
{
return i.next();
}
return null; // wtf?
}
public static ForgeDirection rotateAround( ForgeDirection forward, ForgeDirection axis )
{
if( axis == ForgeDirection.UNKNOWN || forward == ForgeDirection.UNKNOWN )
{
return forward;
}
switch( forward )
{
@@ -1201,7 +1303,9 @@ public class Platform
OreReference bOR = OreHelper.INSTANCE.isOre( b );
if( OreHelper.INSTANCE.sameOre( aOR, bOR ) )
{
return true;
}
/*
* // test ore dictionary.. int OreID = getOreID( a ); if ( OreID != -1 ) return OreID == getOreID( b );
@@ -1286,7 +1390,9 @@ public class Platform
{
// prevent killing / flying of mounts.
if( entity1.riddenByEntity == p )
{
continue;
}
f1 = 0.3F;
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
@@ -1341,7 +1447,9 @@ public class Platform
long retrieved = 0;
if( possible != null )
{
retrieved = possible.getStackSize();
}
double availablePower = energy.extractAEPower( retrieved, Actionable.SIMULATE, PowerMultiplier.CONFIG );
@@ -1371,7 +1479,9 @@ public class Platform
long stored = input.getStackSize();
if( possible != null )
{
stored -= possible.getStackSize();
}
double availablePower = energy.extractAEPower( stored, Actionable.SIMULATE, PowerMultiplier.CONFIG );
@@ -1424,7 +1534,9 @@ public class Platform
if( myItems != null )
{
for( IAEItemStack is : myItems.getAvailableItems( itemChanges ) )
{
is.setStackSize( -is.getStackSize() );
}
}
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.FLUIDS );
@@ -1432,7 +1544,9 @@ public class Platform
if( myFluids != null )
{
for( IAEFluidStack is : myFluids.getAvailableItems( fluidChanges ) )
{
is.setStackSize( -is.getStackSize() );
}
}
}
@@ -1441,12 +1555,16 @@ public class Platform
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.ITEMS );
if( myItems != null )
{
myItems.getAvailableItems( itemChanges );
}
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.FLUIDS );
if( myFluids != null )
{
myFluids.getAvailableItems( fluidChanges );
}
}
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, itemChanges, src );
@@ -1457,10 +1575,14 @@ public class Platform
LinkedList<T> changes = new LinkedList<T>();
for( T is : before )
{
is.setStackSize( -is.getStackSize() );
}
for( T is : after )
{
before.add( is );
}
for( T is : before )
{
@@ -1471,30 +1593,44 @@ public class Platform
}
if( !changes.isEmpty() )
{
meMonitorPassthrough.postChange( null, changes, source );
}
}
public static int generateTileHash( TileEntity target )
{
if( target == null )
{
return 0;
}
int hash = target.hashCode();
if( target instanceof ITileStorageMonitorable )
{
return 0;
}
else if( target instanceof TileEntityChest )
{
TileEntityChest chest = (TileEntityChest) target;
chest.checkForAdjacentChests();
if( chest.adjacentChestZNeg != null )
{
hash ^= chest.adjacentChestZNeg.hashCode();
}
else if( chest.adjacentChestZPos != null )
{
hash ^= chest.adjacentChestZPos.hashCode();
}
else if( chest.adjacentChestXPos != null )
{
hash ^= chest.adjacentChestXPos.hashCode();
}
else if( chest.adjacentChestXNeg != null )
{
hash ^= chest.adjacentChestXNeg.hashCode();
}
}
else if( target instanceof IInventory )
{
@@ -1509,7 +1645,9 @@ public class Platform
int[] sides = ( (ISidedInventory) target ).getAccessibleSlotsFromSide( dir.ordinal() );
if( sides == null )
{
return 0;
}
for( Integer Side : sides )
{
@@ -1527,9 +1665,13 @@ public class Platform
public static boolean securityCheck( GridNode a, GridNode b )
{
if( a.lastSecurityKey == -1 && b.lastSecurityKey == -1 )
{
return false;
}
else if( a.lastSecurityKey == b.lastSecurityKey )
{
return false;
}
boolean a_isSecure = isPowered( a.getGrid() ) && a.lastSecurityKey != -1;
boolean b_isSecure = isPowered( b.getGrid() ) && b.lastSecurityKey != -1;
@@ -1541,13 +1683,19 @@ public class Platform
// can't do that son...
if( a_isSecure && b_isSecure )
{
return true;
}
if( !a_isSecure && b_isSecure )
{
return checkPlayerPermissions( b.getGrid(), a.playerID );
}
if( a_isSecure && !b_isSecure )
{
return checkPlayerPermissions( a.getGrid(), b.playerID );
}
return false;
}
@@ -1555,7 +1703,9 @@ public class Platform
private static boolean isPowered( IGrid grid )
{
if( grid == null )
{
return false;
}
IEnergyGrid eg = grid.getCache( IEnergyGrid.class );
return eg.isNetworkPowered();
@@ -1564,15 +1714,21 @@ public class Platform
private static boolean checkPlayerPermissions( IGrid grid, int playerID )
{
if( grid == null )
{
return false;
}
ISecurityGrid gs = grid.getCache( ISecurityGrid.class );
if( gs == null )
{
return false;
}
if( !gs.isAvailable() )
{
return false;
}
return !gs.hasPermission( playerID, SecurityPermissions.BUILD );
}
@@ -1629,13 +1785,17 @@ public class Platform
IActionHost te = ( (MachineSource) src ).via;
IGridNode n = te.getActionableNode();
if( n == null )
{
return false;
}
int playerID = n.getPlayerID();
return gridProxy.getSecurity().hasPermission( playerID, SecurityPermissions.BUILD );
}
else
{
return false;
}
}
catch( GridAccessException gae )
{
@@ -1648,7 +1808,9 @@ public class Platform
if( energySrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.9 )
{
if( providedTemplate == null )
{
return null;
}
AEItemStack ae_req = AEItemStack.create( providedTemplate );
ae_req.setStackSize( 1 );
@@ -1706,7 +1868,9 @@ public class Platform
if( ol != null && op != null && ol.getItem() == op.getItem() )
{
if( ol.isItemStackDamageable() )
{
return true;
}
return ol.getItemDamage() == ol.getItemDamage();
}
return false;
@@ -1725,7 +1889,9 @@ public class Platform
public static ItemStack getContainerItem( ItemStack stackInSlot )
{
if( stackInSlot == null )
{
return null;
}
Item i = stackInSlot.getItem();
if( i == null || !i.hasContainerItem( stackInSlot ) )
@@ -1740,7 +1906,9 @@ public class Platform
ItemStack ci = i.getContainerItem( stackInSlot.copy() );
if( ci != null && ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() )
{
ci = null;
}
return ci;
}
@@ -1748,13 +1916,17 @@ public class Platform
public static void notifyBlocksOfNeighbors( World worldObj, int xCoord, int yCoord, int zCoord )
{
if( !worldObj.isRemote )
{
TickHandler.INSTANCE.addCallable( worldObj, new BlockUpdate( worldObj, xCoord, yCoord, zCoord ) );
}
}
public static boolean canRepair( AEFeature type, ItemStack a, ItemStack b )
{
if( b == null || a == null )
{
return false;
}
if( type == AEFeature.CertusQuartzTools )
{
@@ -1764,7 +1936,9 @@ public class Platform
}
if( type == AEFeature.NetherQuartzTools )
{
return Items.quartz == b.getItem();
}
return false;
}
@@ -1824,7 +1998,9 @@ public class Platform
}
if( sendToAllPlayersWatchingChunk != null )
{
sendToAllPlayersWatchingChunk.invoke( playerInstance, new S21PacketChunkData( c, false, verticalBits ) );
}
}
}
}