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
@@ -42,7 +42,9 @@ public class NetworkToolViewer implements INetworkTool
this.gh = gHost;
this.inv = new AppEngInternalInventory( null, 9 );
if( is.hasTagCompound() ) // prevent crash when opening network status screen.
{
this.inv.readFromNBT( Platform.openNbtData( is ), "inv" );
}
}
@Override
@@ -91,7 +91,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
MaterialType mt = this.getTypeByStack( stack );
if( mt == null )
{
return;
}
if( mt == MaterialType.NamePress )
{
@@ -114,14 +116,20 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
IItemGroup ig = (IItemGroup) j.getKey().getItem();
String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
if( str != null )
{
name = Platform.gui_localize( str ) + ( limit > 1 ? " (" + limit + ')' : "" );
}
}
if( name == null )
{
name = j.getKey().getDisplayName() + ( limit > 1 ? " (" + limit + ')' : "" );
}
if( !textList.contains( name ) )
{
textList.add( name );
}
}
Pattern p = Pattern.compile( "(\\d+)[^\\d]" );
@@ -134,7 +142,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
public MaterialType getTypeByStack( ItemStack is )
{
if( this.dmgToMaterial.containsKey( is.getItemDamage() ) )
{
return this.dmgToMaterial.get( is.getItemDamage() );
}
return MaterialType.InvalidType;
}
@@ -166,7 +176,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
{
boolean enabled = true;
for( AEFeature f : mat.getFeature() )
{
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
}
if( enabled )
{
@@ -177,9 +189,13 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
mat.stackSrc = new MaterialStackSrc( mat );
if( this.dmgToMaterial.get( newMaterialNum ) == null )
{
this.dmgToMaterial.put( newMaterialNum, mat );
}
else
{
throw new IllegalStateException( "Meta Overlap detected." );
}
return mat.stackSrc;
}
@@ -187,7 +203,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
return mat.stackSrc;
}
else
{
throw new IllegalStateException( "Cannot create the same material twice..." );
}
}
public void makeUnique()
@@ -203,7 +221,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
for( String name : names )
{
if( replacement != null )
{
break;
}
List<ItemStack> options = OreDictionary.getOres( name );
if( options != null && options.size() > 0 )
@@ -223,12 +243,16 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
{
// continue using the AE2 item.
for( String name : names )
{
OreDictionary.registerOre( name, mt.stack( 1 ) );
}
}
else
{
if( mt.itemInstance == this )
{
this.dmgToMaterial.remove( mt.damageValue );
}
mt.itemInstance = replacement.getItem();
mt.damageValue = replacement.getItemDamage();
@@ -241,7 +265,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
public IIcon getIconFromDamage( int dmg )
{
if( this.dmgToMaterial.containsKey( dmg ) )
{
return this.dmgToMaterial.get( dmg ).IIcon;
}
return new MissingIcon( this );
}
@@ -254,11 +280,15 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
private String nameOf( ItemStack is )
{
if( is == null )
{
return "null";
}
MaterialType mt = this.getTypeByStack( is );
if( mt == null )
{
return "null";
}
return this.nameResolver.getName( mt.name() );
}
@@ -280,7 +310,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
for( MaterialType mat : types )
{
if( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this )
{
cList.add( new ItemStack( this, 1, mat.damageValue ) );
}
}
}
@@ -313,10 +345,14 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
{
SelectedPart sp = ( (IPartHost) te ).selectPart( Vec3.createVectorHelper( hitX, hitY, hitZ ) );
if( sp.part instanceof IUpgradeableHost )
{
upgrades = ( (ISegmentedInventory) sp.part ).getInventoryByName( "upgrades" );
}
}
else if( te instanceof IUpgradeableHost )
{
upgrades = ( (ISegmentedInventory) te ).getInventoryByName( "upgrades" );
}
if( upgrades != null && is != null && is.getItem() instanceof IUpgradeModule )
{
@@ -329,7 +365,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
if( ad != null )
{
if( player.worldObj.isRemote )
{
return false;
}
player.inventory.setInventorySlotContents( player.inventory.currentItem, ad.addItems( is ) );
return true;
@@ -367,7 +405,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
eqi.motionZ = location.motionZ;
if( location instanceof EntityItem && eqi instanceof EntityItem )
{
( (EntityItem) eqi ).delayBeforeCanPickup = ( (EntityItem) location ).delayBeforeCanPickup;
}
return eqi;
}
@@ -142,7 +142,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
}
if( newDamage > END )
{
return null;
}
this.setProgress( is, newDamage );
return is;
@@ -183,13 +185,19 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
int damage = this.getProgress( is );
if( damage < Certus + SINGLE_OFFSET )
{
return this.getUnlocalizedName() + ".Certus";
}
if( damage < Nether + SINGLE_OFFSET )
{
return this.getUnlocalizedName() + ".Nether";
}
if( damage < Fluix + SINGLE_OFFSET )
{
return this.getUnlocalizedName() + ".Fluix";
}
return this.getUnlocalizedName();
}
@@ -226,8 +234,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
int damage = this.getProgress( stack );
if( damage < Certus + SINGLE_OFFSET )
{
list = this.certus;
}
else if( damage < Nether + SINGLE_OFFSET )
{
damage -= Nether;
@@ -241,14 +250,22 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
if( list == null )
{
return Items.diamond.getIconFromDamage( 0 );
}
if( damage < LEVEL_OFFSET )
{
return list[0];
}
else if( damage < LEVEL_OFFSET * 2 )
{
return list[1];
}
else
{
return list[2];
}
}
@Override
@@ -285,7 +302,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
egc.motionZ = location.motionZ;
if( location instanceof EntityItem )
{
egc.delayBeforeCanPickup = ( (EntityItem) location ).delayBeforeCanPickup;
}
return egc;
}
@@ -54,7 +54,9 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
this.setFeature( EnumSet.of( AEFeature.Patterns ) );
this.setMaxStackSize( 1 );
if( Platform.isClient() )
{
MinecraftForgeClient.registerItemRenderer( this, new ItemEncodedPatternRenderer() );
}
}
@Override
@@ -76,7 +78,9 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
if( player.isSneaking() )
{
if( Platform.isClient() )
{
return false;
}
InventoryPlayer inv = player.inventory;
@@ -159,16 +163,22 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
{
ItemStack out = SIMPLE_CACHE.get( item );
if( out != null )
{
return out;
}
World w = CommonHelper.proxy.getWorld();
if( w == null )
{
return null;
}
ICraftingPatternDetails details = this.getPatternForItem( item, w );
if( details == null )
{
return null;
}
SIMPLE_CACHE.put( item, out = details.getCondensedOutputs()[0].getItemStack() );
return out;
@@ -46,7 +46,9 @@ public class ItemPaintBall extends AEBaseItem
this.setHasSubtypes( true );
if( Platform.isClient() )
{
MinecraftForgeClient.registerItemRenderer( this, new PaintBallRender() );
}
}
@Override
@@ -64,10 +66,14 @@ public class ItemPaintBall extends AEBaseItem
{
int dmg = is.getItemDamage();
if( dmg >= DAMAGE_THRESHOLD )
{
dmg -= DAMAGE_THRESHOLD;
}
if( dmg >= AEColor.values().length )
{
return AEColor.Transparent;
}
return AEColor.values()[dmg];
}
@@ -76,12 +82,20 @@ public class ItemPaintBall extends AEBaseItem
public void getSubItems( Item i, CreativeTabs ct, List l )
{
for( AEColor c : AEColor.values() )
{
if( c != AEColor.Transparent )
{
l.add( new ItemStack( this, 1, c.ordinal() ) );
}
}
for( AEColor c : AEColor.values() )
{
if( c != AEColor.Transparent )
{
l.add( new ItemStack( this, 1, DAMAGE_THRESHOLD + c.ordinal() ) );
}
}
}
public boolean isLumen( ItemStack is )
@@ -65,7 +65,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
this.setFeature( EnumSet.of( AEFeature.Facades ) );
this.setHasSubtypes( true );
if( Platform.isClient() )
{
MinecraftForgeClient.registerItemRenderer( this, BusRenderer.INSTANCE );
}
}
@Override
@@ -125,7 +127,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
{
ItemStack facade = this.createFacadeForItem( l, false );
if( facade != null )
{
this.subTypes.add( facade );
}
}
}
catch( Throwable t )
@@ -135,18 +139,24 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
if( FacadeConfig.instance.hasChanged() )
{
FacadeConfig.instance.save();
}
}
}
public ItemStack createFacadeForItem( ItemStack l, boolean returnItem )
{
if( l == null )
{
return null;
}
Block b = Block.getBlockFromItem( l.getItem() );
if( b == null || l.hasTagCompound() )
{
return null;
}
int metadata = l.getItem().getMetadata( l.getItemDamage() );
@@ -158,7 +168,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
if( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
{
if( returnItem )
{
return l;
}
ItemStack is = new ItemStack( this );
NBTTagCompound data = new NBTTagCompound();
@@ -180,7 +192,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
{
ItemStack in = this.getTextureItem( is );
if( in != null )
{
return new FacadePart( is, side );
}
return null;
}
@@ -189,7 +203,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
{
Block blk = this.getBlock( is );
if( blk != null )
{
return new ItemStack( blk, 1, this.getMeta( is ) );
}
return null;
}
@@ -201,7 +217,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
{
int[] blk = data.getIntArray( "x" );
if( blk != null && blk.length == 2 )
{
return blk[1];
}
}
return 0;
}
@@ -220,7 +238,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
{
int[] blk = data.getIntArray( "x" );
if( blk != null && blk.length == 2 )
{
return Block.getBlockById( blk[0] );
}
}
}
return Blocks.glass;
@@ -236,7 +256,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
{
this.calculateSubTypes();
if( this.subTypes.isEmpty() )
{
return new ItemStack( Items.cake );
}
return this.subTypes.get( 0 );
}
@@ -260,11 +282,15 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
ItemStack out = this.getTextureItem( is );
if( out == null || out.getItem() == null )
{
return false;
}
Block blk = Block.getBlockFromItem( out.getItem() );
if( blk != null && blk.canRenderInPass( 1 ) )
{
return true;
}
return false;
}
@@ -112,15 +112,21 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
for( PartTypeWithVariant p : this.registered.values() )
{
if( p.part == mat && p.variant == varID )
{
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 );
}
final int partDamage = mat.baseDamage + varID;
final ItemStackSrc output = new ItemStackSrc( this, partDamage );
@@ -140,7 +146,9 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
final Map<Integer, PartTypeWithVariant> reference = ( enabled ) ? this.registered : this.unregistered;
if( reference.containsKey( partDamage ) )
{
throw new IllegalStateException( "Meta Overlap detected with type " + mat + " and damage " + partDamage + ". Found " + reference.get( partDamage ) + " there already." );
}
reference.put( partDamage, pti );
}
@@ -152,7 +160,9 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
for( Entry<Integer, PartTypeWithVariant> pt : this.registered.entrySet() )
{
if( pt.getValue().part == t )
{
return pt.getKey();
}
}
return -1;
}
@@ -195,7 +205,9 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
if( pt.getExtraName() != null )
{
return super.getItemStackDisplayName( is ) + " - " + pt.getExtraName().getLocal();
}
return super.getItemStackDisplayName( is );
}
@@ -215,7 +227,9 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
} );
for( Entry<Integer, PartTypeWithVariant> part : types )
{
cList.add( new ItemStack( this, 1, part.getKey() ) );
}
}
@Override
@@ -245,10 +259,14 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
final PartTypeWithVariant pt = this.registered.get( is.getItemDamage() );
if( pt != null )
{
return pt.part;
}
final PartTypeWithVariant unregisteredPartType = this.unregistered.get( is.getItemDamage() );
if( unregisteredPartType != null )
{
return unregisteredPartType.part;
}
throw new IllegalStateException( "ItemStack " + is + " has to be either registered or unregistered, but was not found in either." );
}
@@ -263,7 +281,9 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
try
{
if( type.constructor == null )
{
type.constructor = part.getConstructor( ItemStack.class );
}
return type.constructor.newInstance( is );
}
@@ -288,7 +308,9 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
public int variantOf( int itemDamage )
{
if( this.registered.containsKey( itemDamage ) )
{
return this.registered.get( itemDamage ).variant;
}
return 0;
}
@@ -312,12 +334,16 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
case ImportBus:
importBus = true;
if( u == pt )
{
group = true;
}
break;
case ExportBus:
exportBus = true;
if( u == pt )
{
group = true;
}
break;
default:
}
@@ -325,7 +351,9 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
}
if( group && importBus && exportBus )
{
return GuiText.IOBuses.getUnlocalized();
}
return null;
}
@@ -117,9 +117,13 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
String list = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded ).getLocal();
if( handler.isFuzzy() )
{
lines.add( GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Fuzzy.getLocal() );
}
else
{
lines.add( GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal() );
}
}
}
}
@@ -229,7 +233,9 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
if( player.isSneaking() )
{
if( Platform.isClient() )
{
return false;
}
InventoryPlayer playerInventory = player.inventory;
IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
@@ -244,7 +250,9 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
// 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 );
@@ -269,7 +277,9 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
}
if( player.inventoryContainer != null )
{
player.inventoryContainer.detectAndSendChanges();
}
return true;
}
@@ -59,7 +59,9 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
{
WorldCoord wc = this.getStoredSize( stack );
if( wc.x > 0 )
{
lines.add( GuiText.StoredSize.getLocal() + ": " + wc.x + " x " + wc.y + " x " + wc.z );
}
}
@Override
@@ -111,7 +113,9 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
return WorldSettings.getInstance().getStoredSize( dim );
}
else
{
return new WorldCoord( c.getInteger( "sizeX" ), c.getInteger( "sizeY" ), c.getInteger( "sizeZ" ) );
}
}
return new WorldCoord( 0, 0, 0 );
}
@@ -164,7 +168,9 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
if( targetX <= maxSize && targetY <= maxSize && targetZ <= maxSize )
{
if( destination == null )
{
destination = this.createNewWorld( is );
}
StorageHelper.getInstance().swapRegions( w, destination, min.x + 1, min.y + 1, min.z + 1, 1, floorBuffer + 1, 1, targetX - 1, targetY - 1, targetZ - 1 );
this.setStoredSize( is, targetX, targetY, targetZ );
@@ -60,7 +60,9 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
for( ItemStack currentViewCell : list )
{
if( currentViewCell == null )
{
continue;
}
if( ( currentViewCell.getItem() instanceof ItemViewCell ) )
{
@@ -100,15 +102,21 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
{
ItemStack is = config.getStackInSlot( x );
if( is != null )
{
priorityList.add( AEItemStack.create( is ) );
}
}
if( !priorityList.isEmpty() )
{
if( hasFuzzy )
{
myMergedList.addNewList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ), !hasInverter );
}
else
{
myMergedList.addNewList( new PrecisePriorityList<IAEItemStack>( priorityList ), !hasInverter );
}
myPartitionList = myMergedList;
}
@@ -51,7 +51,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
this.setMaxStackSize( 1 );
if( Platform.isClient() )
{
MinecraftForgeClient.registerItemRenderer( this, new ToolBiometricCardRender() );
}
}
@Override
@@ -73,7 +75,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
if( target instanceof EntityPlayer && !par2EntityPlayer.isSneaking() )
{
if( par2EntityPlayer.capabilities.isCreativeMode )
{
is = par2EntityPlayer.getCurrentEquippedItem();
}
this.encode( is, (EntityPlayer) target );
par2EntityPlayer.swingItem();
return true;
@@ -93,9 +97,13 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
GameProfile username = this.getProfile( is );
if( username != null && username.equals( p.getGameProfile() ) )
{
this.setProfile( is, null );
}
else
{
this.setProfile( is, p.getGameProfile() );
}
}
@Override
@@ -110,7 +118,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
tag.setTag( "profile", pNBT );
}
else
{
tag.removeTag( "profile" );
}
}
@Override
@@ -118,7 +128,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
{
NBTTagCompound tag = Platform.openNbtData( is );
if( tag.hasKey( "profile" ) )
{
return NBTUtil.func_152459_a( tag.getCompoundTag( "profile" ) );
}
return null;
}
@@ -131,7 +143,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
for( SecurityPermissions sp : SecurityPermissions.values() )
{
if( tag.getBoolean( sp.name() ) )
{
result.add( sp );
}
}
return result;
@@ -149,7 +163,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
{
NBTTagCompound tag = Platform.openNbtData( itemStack );
if( tag.hasKey( permission.name() ) )
{
tag.removeTag( permission.name() );
}
}
@Override
@@ -170,7 +186,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
{
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
if( perms.isEmpty() )
{
lines.add( GuiText.NoPermissions.getLocal() );
}
else
{
String msg = null;
@@ -178,9 +196,13 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
for( SecurityPermissions sp : perms )
{
if( msg == null )
{
msg = Platform.gui_localize( sp.getUnlocalizedName() );
}
else
{
msg = msg + ", " + Platform.gui_localize( sp.getUnlocalizedName() );
}
}
lines.add( msg );
}
@@ -52,7 +52,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
NBTTagCompound data = this.getData( stack );
if( data.hasKey( "tooltip" ) )
{
lines.add( StatCollector.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
}
}
/**
@@ -68,11 +70,15 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
String l = StatCollector.translateToLocal( n );
if( !l.equals( n ) )
{
return l;
}
}
for( String n : name )
{
return n;
}
return "";
}
@@ -99,7 +105,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
NBTTagCompound c = Platform.openNbtData( is );
NBTTagCompound o = c.getCompoundTag( "Data" );
if( o == null )
{
o = new NBTTagCompound();
}
return (NBTTagCompound) o.copy();
}
@@ -107,7 +115,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
public void notifyUser( EntityPlayer player, MemoryCardMessages msg )
{
if( Platform.isClient() )
{
return;
}
switch( msg )
{
@@ -138,7 +148,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
return true;
}
else
{
return super.onItemUse( is, player, w, x, y, z, side, hx, hy, hz );
}
}
@Override
@@ -91,7 +91,9 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
int k = mop.blockZ;
if( w.getBlock( i, j, k ).isAir( w, i, j, k ) )
{
this.onItemUseFirst( it, p, w, 0, 0, 0, -1, 0, 0, 0 );
}
}
}
@@ -109,7 +111,9 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
if( part.part != null )
{
if( part.part instanceof INetworkToolAgent && !( (INetworkToolAgent) part.part ).showNetworkInfo( mop ) )
{
return false;
}
}
}
else if( te instanceof INetworkToolAgent && !( (INetworkToolAgent) te ).showNetworkInfo( mop ) )
@@ -135,7 +139,9 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
if( side >= 0 )
{
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
{
return false;
}
Block b = w.getBlock( x, y, z );
if( b != null && !p.isSneaking() )
@@ -155,22 +161,32 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
if( !p.isSneaking() )
{
if( p.openContainer instanceof AEBaseContainer )
{
return true;
}
TileEntity te = w.getTileEntity( x, y, z );
if( te instanceof IGridHost )
{
Platform.openGUI( p, te, ForgeDirection.getOrientation( side ), GuiBridge.GUI_NETWORK_STATUS );
}
else
{
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_NETWORK_TOOL );
}
return true;
}
else
{
b.onBlockActivated( w, x, y, z, p, side, hitX, hitY, hitZ );
}
}
else
{
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_NETWORK_TOOL );
}
return false;
}
@@ -90,7 +90,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
for( AEColor col : AEColor.values() )
{
if( col == AEColor.Transparent )
{
continue;
}
ORE_TO_COLOR.put( OreDictionary.getOreID( "dye" + col.name() ), col );
}
@@ -101,7 +103,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
super( AEConfig.instance.colorApplicatorBattery, Optional.<String>absent() );
this.setFeature( EnumSet.of( AEFeature.ColorApplicator, AEFeature.PoweredTools ) );
if( Platform.isClient() )
{
MinecraftForgeClient.registerItemRenderer( this, new ToolColorApplicatorRender() );
}
}
@Override
@@ -130,10 +134,14 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
paintBall.stackSize = 1;
}
else
{
paintBall = null;
}
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
{
return false;
}
if( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
{
@@ -196,7 +204,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
AEColor selected = this.getActiveColor( par1ItemStack );
if( selected != null && Platform.isClient() )
{
extra = Platform.gui_localize( selected.unlocalizedName );
}
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
}
@@ -209,10 +219,14 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
public AEColor getColorFromItem( ItemStack paintBall )
{
if( paintBall == null )
{
return null;
}
if( paintBall.getItem() instanceof ItemSnowball )
{
return AEColor.Transparent;
}
if( paintBall.getItem() instanceof ItemPaintBall )
{
@@ -226,7 +240,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
for( int oreID : id )
{
if( ORE_TO_COLOR.containsKey( oreID ) )
{
return ORE_TO_COLOR.get( oreID );
}
}
}
@@ -241,7 +257,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
NBTTagCompound color = c.getCompoundTag( "color" );
ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
if( oldColor != null )
{
return oldColor;
}
}
return this.findNextColor( is, null, 0 );
@@ -259,14 +277,18 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
IAEItemStack firstItem = itemList.getFirstItem();
if( firstItem != null )
{
newColor = firstItem.getItemStack();
}
}
else
{
LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>();
for( IAEItemStack i : itemList )
{
list.add( i );
}
Collections.sort( list, new Comparator<IAEItemStack>()
{
@@ -279,7 +301,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
} );
if( list.size() <= 0 )
{
return null;
}
IAEItemStack where = list.getFirst();
int cycles = 1 + list.size();
@@ -292,17 +316,23 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
if( scrollOffset > 0 )
{
list.addLast( list.removeFirst() );
}
if( scrollOffset < 0 )
{
list.addFirst( list.removeLast() );
}
return list.get( 0 ).getItemStack();
}
}
if( newColor != null )
{
this.setColor( is, newColor );
}
return newColor;
}
@@ -311,7 +341,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
NBTTagCompound data = Platform.openNbtData( is );
if( newColor == null )
{
data.removeTag( "color" );
}
else
{
NBTTagCompound color = new NBTTagCompound();
@@ -326,7 +358,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
int meta = w.getBlockMetadata( x, y, z );
if( newColor.ordinal() == meta )
{
return false;
}
return w.setBlock( x, y, z, Blocks.carpet, newColor.ordinal(), 3 );
}
@@ -339,7 +373,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
int meta = w.getBlockMetadata( x, y, z );
if( newColor.ordinal() == meta )
{
return false;
}
return w.setBlock( x, y, z, Blocks.stained_glass, newColor.ordinal(), 3 );
}
@@ -352,7 +388,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
int meta = w.getBlockMetadata( x, y, z );
if( newColor.ordinal() == meta )
{
return false;
}
return w.setBlock( x, y, z, Blocks.stained_glass_pane, newColor.ordinal(), 3 );
}
@@ -365,12 +403,16 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
int meta = w.getBlockMetadata( x, y, z );
if( newColor.ordinal() == meta )
{
return false;
}
return w.setBlock( x, y, z, Blocks.stained_hardened_clay, newColor.ordinal(), 3 );
}
if( blk instanceof BlockCableBus )
{
return ( (BlockCableBus) blk ).recolourBlock( w, x, y, z, side, newColor.ordinal(), p );
}
return blk.recolourBlock( w, x, y, z, side, newColor.ordinal() );
}
@@ -439,11 +481,15 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
for( int x : id )
{
if( ORE_TO_COLOR.containsKey( x ) )
{
return false;
}
}
if( requestedAddition.getItem() instanceof ItemSnowball )
{
return false;
}
return !( requestedAddition.getItem() instanceof ItemPaintBall && requestedAddition.getItemDamage() < 20 );
}
@@ -114,9 +114,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
public boolean equals( Object obj )
{
if( obj == null )
{
return false;
}
if( this.getClass() != obj.getClass() )
{
return false;
}
InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
return this.blockID == other.blockID && this.metadata == other.metadata;
}
@@ -212,7 +216,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
MovingObjectPosition target = this.getMovingObjectPositionFromPlayer( w, p, true );
if( target == null )
{
return item;
}
else
{
if( target.typeOfHit == MovingObjectType.BLOCK )
@@ -240,7 +246,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
if( this.getAECurrentPower( item ) > 1600 )
{
if( !p.canPlayerEdit( x, y, z, side, item ) )
{
return false;
}
Block blockID = w.getBlock( x, y, z );
int metadata = w.getBlockMetadata( x, y, z );
@@ -335,7 +343,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
z += dir.offsetZ;
if( !p.canPlayerEdit( x, y, z, side, item ) )
{
return false;
}
if( w.isAirBlock( x, y, z ) )
{
@@ -121,7 +121,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
if( cu != null )
{
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
}
IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
if( inv != null )
@@ -136,17 +138,23 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
this.extractAEPower( item, 1600 );
if( Platform.isClient() )
{
return item;
}
aeAmmo.setStackSize( 1 );
ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
if( ammo == null )
{
return item;
}
ammo.stackSize = 1;
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
if( aeAmmo == null )
{
return item;
}
float f = 1.0F;
float f1 = p.prevRotationPitch + ( p.rotationPitch - p.prevRotationPitch ) * f;
@@ -186,7 +194,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
else
{
if( Platform.isServer() )
{
p.addChatMessage( PlayerMessages.AmmoDepleted.get() );
}
return item;
}
}
@@ -213,7 +223,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
// prevent killing / flying of mounts.
if( entity1.riddenByEntity == p )
{
continue;
}
float f1 = 0.3F;
@@ -286,7 +298,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
int z = pos.blockZ + side.offsetZ;
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
{
return;
}
Block whatsThere = w.getBlock( x, y, z );
if( whatsThere.isReplaceable( w, x, y, z ) && w.isAirBlock( x, y, z ) )
@@ -333,7 +347,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
// prevent killing / flying of mounts.
if( entity1.riddenByEntity == p )
{
continue;
}
float f1 = 0.3F;
@@ -391,7 +407,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
// vec3.zCoord );
el.attackEntityFrom( dmgSrc, dmg );
if( !el.isEntityAlive() )
{
hasDestroyedSomething = true;
}
}
else if( pos.entityHit instanceof EntityItem )
{
@@ -406,7 +424,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
else if( pos.typeOfHit == MovingObjectType.BLOCK )
{
if( !AEConfig.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) )
{
penetration = 0;
}
else
{
Block b = w.getBlock( pos.blockX, pos.blockY, pos.blockZ );
@@ -498,10 +518,14 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
if( pen > 0 )
{
return false;
}
if( requestedAddition.getItem() instanceof ItemPaintBall )
{
return false;
}
return true;
}
@@ -85,13 +85,19 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
String encKey = tag.getString( "encryptionKey" );
if( encKey == null || encKey.isEmpty() )
{
lines.add( GuiText.Unlinked.getLocal() );
}
else
{
lines.add( GuiText.Linked.getLocal() );
}
}
}
else
{
lines.add( StatCollector.translateToLocal( "AppEng.GuiITooltip.Unlinked" ) );
}
}
@Override
@@ -156,7 +156,9 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
{
int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
if( amount < requiredEU )
{
return 0;
}
return amount - requiredEU;
}
else
@@ -48,7 +48,9 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
double limit = this.getTransferLimit( is );
if( !ignoreTransferLimit && amount > limit )
{
addedAmt = limit;
}
return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
}
@@ -55,7 +55,9 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
public boolean onItemUse( ItemStack is, EntityPlayer p, World w, int x, int y, int z, int s, float hitX, float hitY, float hitZ )
{
if( Platform.isServer() )
{
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
}
return true;
}
@@ -63,7 +65,9 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
public ItemStack onItemRightClick( ItemStack it, World w, EntityPlayer p )
{
if( Platform.isServer() )
{
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
}
p.swingItem();
return it;
}
@@ -58,7 +58,9 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
{
if( Platform.isClient() )
{
return !world.isRemote;
}
ForgeDirection mySide = ForgeDirection.getOrientation( side );
if( b.rotateBlock( world, x, y, z, mySide ) )