final variables and parameters
This commit is contained in:
@@ -54,7 +54,7 @@ public abstract class AEBaseItem extends Item implements IAEFeature
|
||||
this.setNoRepair();
|
||||
}
|
||||
|
||||
public AEBaseItem( Optional<String> subName )
|
||||
public AEBaseItem( final Optional<String> subName )
|
||||
{
|
||||
this.subName = subName;
|
||||
this.fullName = new FeatureNameExtractor( this.getClass(), subName ).get();
|
||||
@@ -78,32 +78,32 @@ public abstract class AEBaseItem extends Item implements IAEFeature
|
||||
// override!
|
||||
}
|
||||
|
||||
public void setFeature( EnumSet<AEFeature> f )
|
||||
public void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
this.feature = new ItemFeatureHandler( f, this, this, this.subName );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public final void addInformation( ItemStack stack, EntityPlayer player, List lines, boolean displayMoreInfo )
|
||||
public final void addInformation( final ItemStack stack, final EntityPlayer player, final List lines, final boolean displayMoreInfo )
|
||||
{
|
||||
this.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public final void getSubItems( Item sameItem, CreativeTabs creativeTab, List itemStacks )
|
||||
public final void getSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks )
|
||||
{
|
||||
this.getCheckedSubItems( sameItem, creativeTab, itemStacks );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable( ItemStack itemstack1, ItemStack itemstack2 )
|
||||
public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
protected void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
super.addInformation( stack, player, lines, displayMoreInfo );
|
||||
}
|
||||
@@ -113,25 +113,25 @@ public abstract class AEBaseItem extends Item implements IAEFeature
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(
|
||||
ClientHelper proxy, String name )
|
||||
final ClientHelper proxy, final String name )
|
||||
{
|
||||
proxy.setIcon( this, 0, name );
|
||||
}
|
||||
|
||||
public IAESprite getIcon(
|
||||
ItemStack is )
|
||||
final ItemStack is )
|
||||
{
|
||||
return myIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerCustomIcon(
|
||||
TextureMap map )
|
||||
final TextureMap map )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
|
||||
{
|
||||
super.getSubItems( sameItem, creativeTab, itemStacks );
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class CellConfig extends AppEngInternalInventory
|
||||
|
||||
final ItemStack is;
|
||||
|
||||
public CellConfig( ItemStack is )
|
||||
public CellConfig( final ItemStack is )
|
||||
{
|
||||
super( null, 63 );
|
||||
this.is = is;
|
||||
|
||||
@@ -28,7 +28,7 @@ public final class CellUpgrades extends StackUpgradeInventory
|
||||
{
|
||||
final ItemStack is;
|
||||
|
||||
public CellUpgrades( ItemStack is, int upgrades )
|
||||
public CellUpgrades( final ItemStack is, final int upgrades )
|
||||
{
|
||||
super( is, null, upgrades );
|
||||
this.is = is;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class NetworkToolViewer implements INetworkTool
|
||||
final ItemStack is;
|
||||
final IGridHost gh;
|
||||
|
||||
public NetworkToolViewer( ItemStack is, IGridHost gHost )
|
||||
public NetworkToolViewer( final ItemStack is, final IGridHost gHost )
|
||||
{
|
||||
this.is = is;
|
||||
this.gh = gHost;
|
||||
@@ -54,25 +54,25 @@ public class NetworkToolViewer implements INetworkTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot( int i )
|
||||
public ItemStack getStackInSlot( final int i )
|
||||
{
|
||||
return this.inv.getStackInSlot( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize( int i, int j )
|
||||
public ItemStack decrStackSize( final int i, final int j )
|
||||
{
|
||||
return this.inv.decrStackSize( i, j );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing( int i )
|
||||
public ItemStack getStackInSlotOnClosing( final int i )
|
||||
{
|
||||
return this.inv.getStackInSlotOnClosing( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents( int i, ItemStack itemstack )
|
||||
public void setInventorySlotContents( final int i, final ItemStack itemstack )
|
||||
{
|
||||
this.inv.setInventorySlotContents( i, itemstack );
|
||||
}
|
||||
@@ -103,25 +103,25 @@ public class NetworkToolViewer implements INetworkTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer( EntityPlayer entityplayer )
|
||||
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
|
||||
{
|
||||
return this.inv.isUseableByPlayer( entityplayer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(EntityPlayer player)
|
||||
public void openInventory( final EntityPlayer player)
|
||||
{
|
||||
this.inv.openInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory(EntityPlayer player)
|
||||
public void closeInventory( final EntityPlayer player)
|
||||
{
|
||||
this.inv.closeInventory(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
|
||||
{
|
||||
return this.inv.isItemValidForSlot( i, itemstack ) && itemstack.getItem() instanceof IUpgradeModule && ( (IUpgradeModule) itemstack.getItem() ).getType( itemstack ) != null;
|
||||
}
|
||||
@@ -140,15 +140,15 @@ public class NetworkToolViewer implements INetworkTool
|
||||
|
||||
@Override
|
||||
public int getField(
|
||||
int id )
|
||||
final int id )
|
||||
{
|
||||
return inv.getField( id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(
|
||||
int id,
|
||||
int value )
|
||||
final int id,
|
||||
final int value )
|
||||
{
|
||||
inv.setField( id, value );
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
private final IAEItemPowerStorage ips;
|
||||
private final int inventorySlot;
|
||||
|
||||
public PortableCellViewer( ItemStack is, int slot )
|
||||
public PortableCellViewer( final ItemStack is, final int slot )
|
||||
{
|
||||
super( CellInventory.getCell( is, null ) );
|
||||
this.ips = (IAEItemPowerStorage) is.getItem();
|
||||
@@ -69,7 +69,7 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier )
|
||||
public double extractAEPower( double amt, final Actionable mode, final PowerMultiplier usePowerMultiplier )
|
||||
{
|
||||
amt = usePowerMultiplier.multiply( amt );
|
||||
|
||||
@@ -100,9 +100,9 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
{
|
||||
|
||||
@Override
|
||||
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( PortableCellViewer.this.target );
|
||||
final NBTTagCompound data = Platform.openNbtData( PortableCellViewer.this.target );
|
||||
manager.writeToNBT( data );
|
||||
}
|
||||
} );
|
||||
|
||||
@@ -28,7 +28,7 @@ public class QuartzKnifeObj implements IGuiItemObject
|
||||
|
||||
final ItemStack is;
|
||||
|
||||
public QuartzKnifeObj( ItemStack o )
|
||||
public QuartzKnifeObj( final ItemStack o )
|
||||
{
|
||||
this.is = o;
|
||||
}
|
||||
|
||||
@@ -94,19 +94,19 @@ public enum MaterialType
|
||||
private Class<? extends Entity> droppedEntity;
|
||||
private boolean isRegistered = false;
|
||||
|
||||
MaterialType( int metaValue )
|
||||
MaterialType( final int metaValue )
|
||||
{
|
||||
this.damageValue = metaValue;
|
||||
this.features = EnumSet.of( AEFeature.Core );
|
||||
}
|
||||
|
||||
MaterialType( int metaValue, AEFeature part )
|
||||
MaterialType( final int metaValue, final AEFeature part )
|
||||
{
|
||||
this.damageValue = metaValue;
|
||||
this.features = EnumSet.of( part );
|
||||
}
|
||||
|
||||
MaterialType( int metaValue, AEFeature part, Class<? extends Entity> c )
|
||||
MaterialType( final int metaValue, final AEFeature part, final Class<? extends Entity> c )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.damageValue = metaValue;
|
||||
@@ -115,7 +115,7 @@ public enum MaterialType
|
||||
EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
MaterialType( int metaValue, AEFeature part, String oreDictionary, Class<? extends Entity> c )
|
||||
MaterialType( final int metaValue, final AEFeature part, final String oreDictionary, final Class<? extends Entity> c )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.damageValue = metaValue;
|
||||
@@ -124,14 +124,14 @@ public enum MaterialType
|
||||
EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
MaterialType( int metaValue, AEFeature part, String oreDictionary )
|
||||
MaterialType( final int metaValue, final AEFeature part, final String oreDictionary )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.damageValue = metaValue;
|
||||
this.oreName = oreDictionary;
|
||||
}
|
||||
|
||||
public ItemStack stack( int size )
|
||||
public ItemStack stack( final int size )
|
||||
{
|
||||
return new ItemStack( this.itemInstance, size, this.damageValue );
|
||||
}
|
||||
|
||||
@@ -84,11 +84,11 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||
|
||||
MaterialType mt = this.getTypeByStack( stack );
|
||||
final MaterialType mt = this.getTypeByStack( stack );
|
||||
if( mt == null )
|
||||
{
|
||||
return;
|
||||
@@ -96,24 +96,24 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
|
||||
if( mt == MaterialType.NamePress )
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( stack );
|
||||
final NBTTagCompound c = Platform.openNbtData( stack );
|
||||
lines.add( c.getString( "InscribeName" ) );
|
||||
}
|
||||
|
||||
Upgrades u = this.getType( stack );
|
||||
final Upgrades u = this.getType( stack );
|
||||
if( u != null )
|
||||
{
|
||||
List<String> textList = new LinkedList<String>();
|
||||
for( Entry<ItemStack, Integer> j : u.getSupported().entrySet() )
|
||||
final List<String> textList = new LinkedList<String>();
|
||||
for( final Entry<ItemStack, Integer> j : u.getSupported().entrySet() )
|
||||
{
|
||||
String name = null;
|
||||
|
||||
int limit = j.getValue();
|
||||
final int limit = j.getValue();
|
||||
|
||||
if( j.getKey().getItem() instanceof IItemGroup )
|
||||
{
|
||||
IItemGroup ig = (IItemGroup) j.getKey().getItem();
|
||||
String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
|
||||
final IItemGroup ig = (IItemGroup) j.getKey().getItem();
|
||||
final String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
|
||||
if( str != null )
|
||||
{
|
||||
name = Platform.gui_localize( str ) + ( limit > 1 ? " (" + limit + ')' : "" );
|
||||
@@ -131,8 +131,8 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
}
|
||||
|
||||
Pattern p = Pattern.compile( "(\\d+)[^\\d]" );
|
||||
SlightlyBetterSort s = new SlightlyBetterSort( p );
|
||||
final Pattern p = Pattern.compile( "(\\d+)[^\\d]" );
|
||||
final SlightlyBetterSort s = new SlightlyBetterSort( p );
|
||||
Collections.sort( textList, s );
|
||||
lines.addAll( textList );
|
||||
}
|
||||
@@ -140,9 +140,9 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void registerIcons( ClientHelper proxy, String name )
|
||||
public void registerIcons( final ClientHelper proxy, final String name )
|
||||
{
|
||||
for( MaterialType type : MaterialType.values() )
|
||||
for( final MaterialType type : MaterialType.values() )
|
||||
{
|
||||
if( type != MaterialType.InvalidType )
|
||||
{
|
||||
@@ -151,7 +151,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
}
|
||||
|
||||
public MaterialType getTypeByStack( ItemStack is )
|
||||
public MaterialType getTypeByStack( final ItemStack is )
|
||||
{
|
||||
if( this.dmgToMaterial.containsKey( is.getItemDamage() ) )
|
||||
{
|
||||
@@ -161,7 +161,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
|
||||
@Override
|
||||
public Upgrades getType( ItemStack itemstack )
|
||||
public Upgrades getType( final ItemStack itemstack )
|
||||
{
|
||||
switch( this.getTypeByStack( itemstack ) )
|
||||
{
|
||||
@@ -182,13 +182,13 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
}
|
||||
|
||||
public IStackSrc createMaterial( MaterialType mat )
|
||||
public IStackSrc createMaterial( final MaterialType mat )
|
||||
{
|
||||
Preconditions.checkState( !mat.isRegistered(), "Cannot create the same material twice." );
|
||||
|
||||
boolean enabled = true;
|
||||
|
||||
for( AEFeature f : mat.getFeature() )
|
||||
for( final AEFeature f : mat.getFeature() )
|
||||
{
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
{
|
||||
mat.itemInstance = this;
|
||||
mat.markReady();
|
||||
int newMaterialNum = mat.damageValue;
|
||||
final int newMaterialNum = mat.damageValue;
|
||||
|
||||
if( this.dmgToMaterial.get( newMaterialNum ) == null )
|
||||
{
|
||||
@@ -217,25 +217,25 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
|
||||
public void makeUnique()
|
||||
{
|
||||
for( MaterialType mt : ImmutableSet.copyOf( this.dmgToMaterial.values() ) )
|
||||
for( final MaterialType mt : ImmutableSet.copyOf( this.dmgToMaterial.values() ) )
|
||||
{
|
||||
if( mt.getOreName() != null )
|
||||
{
|
||||
ItemStack replacement = null;
|
||||
|
||||
String[] names = mt.getOreName().split( "," );
|
||||
final String[] names = mt.getOreName().split( "," );
|
||||
|
||||
for( String name : names )
|
||||
for( final String name : names )
|
||||
{
|
||||
if( replacement != null )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
List<ItemStack> options = OreDictionary.getOres( name );
|
||||
final List<ItemStack> options = OreDictionary.getOres( name );
|
||||
if( options != null && options.size() > 0 )
|
||||
{
|
||||
for( ItemStack is : options )
|
||||
for( final ItemStack is : options )
|
||||
{
|
||||
if( is != null && is.getItem() != null )
|
||||
{
|
||||
@@ -249,7 +249,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
if( replacement == null || AEConfig.instance.useAEVersion( mt ) )
|
||||
{
|
||||
// continue using the AE2 item.
|
||||
for( String name : names )
|
||||
for( final String name : names )
|
||||
{
|
||||
OreDictionary.registerOre( name, mt.stack( 1 ) );
|
||||
}
|
||||
@@ -269,26 +269,26 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName( ItemStack is )
|
||||
public String getUnlocalizedName( final ItemStack is )
|
||||
{
|
||||
return "item.appliedenergistics2." + this.nameOf( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
|
||||
{
|
||||
List<MaterialType> types = Arrays.asList( MaterialType.values() );
|
||||
final List<MaterialType> types = Arrays.asList( MaterialType.values() );
|
||||
Collections.sort( types, new Comparator<MaterialType>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare( MaterialType o1, MaterialType o2 )
|
||||
public int compare( final MaterialType o1, final MaterialType o2 )
|
||||
{
|
||||
return o1.name().compareTo( o2.name() );
|
||||
}
|
||||
} );
|
||||
|
||||
for( MaterialType mat : types )
|
||||
for( final MaterialType mat : types )
|
||||
{
|
||||
if( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this )
|
||||
{
|
||||
@@ -298,16 +298,16 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst( ItemStack is, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ )
|
||||
public boolean onItemUseFirst( final ItemStack is, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
TileEntity te = world.getTileEntity( pos );
|
||||
final TileEntity te = world.getTileEntity( pos );
|
||||
IInventory upgrades = null;
|
||||
|
||||
if( te instanceof IPartHost )
|
||||
{
|
||||
SelectedPart sp = ( (IPartHost) te ).selectPart( new Vec3( hitX, hitY, hitZ ) );
|
||||
final SelectedPart sp = ( (IPartHost) te ).selectPart( new Vec3( hitX, hitY, hitZ ) );
|
||||
if( sp.part instanceof IUpgradeableHost )
|
||||
{
|
||||
upgrades = ( (ISegmentedInventory) sp.part ).getInventoryByName( "upgrades" );
|
||||
@@ -320,12 +320,12 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
|
||||
if( upgrades != null && is != null && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
IUpgradeModule um = (IUpgradeModule) is.getItem();
|
||||
Upgrades u = um.getType( is );
|
||||
final IUpgradeModule um = (IUpgradeModule) is.getItem();
|
||||
final Upgrades u = um.getType( is );
|
||||
|
||||
if( u != null )
|
||||
{
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( upgrades, EnumFacing.UP );
|
||||
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( upgrades, EnumFacing.UP );
|
||||
if( ad != null )
|
||||
{
|
||||
if( player.worldObj.isRemote )
|
||||
@@ -344,22 +344,22 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity( ItemStack is )
|
||||
public boolean hasCustomEntity( final ItemStack is )
|
||||
{
|
||||
return this.getTypeByStack( is ).hasCustomEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity( World w, Entity location, ItemStack itemstack )
|
||||
public Entity createEntity( final World w, final Entity location, final ItemStack itemstack )
|
||||
{
|
||||
Class<? extends Entity> droppedEntity = this.getTypeByStack( itemstack ).getCustomEntityClass();
|
||||
Entity eqi;
|
||||
final Class<? extends Entity> droppedEntity = this.getTypeByStack( itemstack ).getCustomEntityClass();
|
||||
final Entity eqi;
|
||||
|
||||
try
|
||||
{
|
||||
eqi = droppedEntity.getConstructor( World.class, double.class, double.class, double.class, ItemStack.class ).newInstance( w, location.posX, location.posY, location.posZ, itemstack );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
throw new IllegalStateException( t );
|
||||
}
|
||||
@@ -378,14 +378,14 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
return eqi;
|
||||
}
|
||||
|
||||
private String nameOf( ItemStack is )
|
||||
private String nameOf( final ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
{
|
||||
return "null";
|
||||
}
|
||||
|
||||
MaterialType mt = this.getTypeByStack( is );
|
||||
final MaterialType mt = this.getTypeByStack( is );
|
||||
if( mt == null )
|
||||
{
|
||||
return "null";
|
||||
@@ -395,7 +395,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes( ItemStack is )
|
||||
public int getBytes( final ItemStack is )
|
||||
{
|
||||
switch( this.getTypeByStack( is ) )
|
||||
{
|
||||
@@ -413,7 +413,7 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageComponent( ItemStack is )
|
||||
public boolean isStorageComponent( final ItemStack is )
|
||||
{
|
||||
switch( this.getTypeByStack( is ) )
|
||||
{
|
||||
@@ -431,26 +431,26 @@ public final class MultiItem extends AEBaseItem implements IStorageComponent, IU
|
||||
{
|
||||
private final Pattern pattern;
|
||||
|
||||
public SlightlyBetterSort( Pattern pattern )
|
||||
public SlightlyBetterSort( final Pattern pattern )
|
||||
{
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare( String o1, String o2 )
|
||||
public int compare( final String o1, final String o2 )
|
||||
{
|
||||
try
|
||||
{
|
||||
Matcher a = this.pattern.matcher( o1 );
|
||||
Matcher b = this.pattern.matcher( o2 );
|
||||
final Matcher a = this.pattern.matcher( o1 );
|
||||
final Matcher b = this.pattern.matcher( o2 );
|
||||
if( a.find() && b.find() )
|
||||
{
|
||||
int ia = Integer.parseInt( a.group( 1 ) );
|
||||
int ib = Integer.parseInt( b.group( 1 ) );
|
||||
final int ia = Integer.parseInt( a.group( 1 ) );
|
||||
final int ib = Integer.parseInt( b.group( 1 ) );
|
||||
return Integer.compare( ia, ib );
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
// ek!
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons( ClientHelper ir, String name )
|
||||
public void registerIcons( final ClientHelper ir, final String name )
|
||||
{
|
||||
String preFix = name+".";
|
||||
final String preFix = name+".";
|
||||
|
||||
this.certus[0] = ir.setIcon( this, preFix + "Certus" );
|
||||
this.certus[1] = ir.setIcon( this, preFix + "Certus2" );
|
||||
@@ -99,7 +99,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(
|
||||
ItemStack stack )
|
||||
final ItemStack stack )
|
||||
{
|
||||
ModelResourceLocation[] list = null;
|
||||
|
||||
@@ -143,7 +143,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ResolverResult getResolver( int certus2 )
|
||||
public static ResolverResult getResolver( final int certus2 )
|
||||
{
|
||||
ResolverResult resolver = null;
|
||||
|
||||
@@ -157,13 +157,13 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
return resolver;
|
||||
}
|
||||
|
||||
private static ItemStack newStyle( ItemStack itemStack )
|
||||
private static ItemStack newStyle( final ItemStack itemStack )
|
||||
{
|
||||
( (ItemCrystalSeed) itemStack.getItem() ).getProgress( itemStack );
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private int getProgress( ItemStack is )
|
||||
private int getProgress( final ItemStack is )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
@@ -171,8 +171,8 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
}
|
||||
else
|
||||
{
|
||||
int progress;
|
||||
NBTTagCompound comp = Platform.openNbtData( is );
|
||||
final int progress;
|
||||
final NBTTagCompound comp = Platform.openNbtData( is );
|
||||
comp.setInteger( "progress", progress = is.getItemDamage() );
|
||||
is.setItemDamage( ( is.getItemDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET );
|
||||
return progress;
|
||||
@@ -181,29 +181,29 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack triggerGrowth( ItemStack is )
|
||||
public ItemStack triggerGrowth( final ItemStack is )
|
||||
{
|
||||
int newDamage = this.getProgress( is ) + 1;
|
||||
final int newDamage = this.getProgress( is ) + 1;
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
final int size = is.stackSize;
|
||||
|
||||
if( newDamage == CERTUS + SINGLE_OFFSET )
|
||||
{
|
||||
for( ItemStack quartzStack : materials.purifiedCertusQuartzCrystal().maybeStack( size ).asSet() )
|
||||
for( final ItemStack quartzStack : materials.purifiedCertusQuartzCrystal().maybeStack( size ).asSet() )
|
||||
{
|
||||
return quartzStack;
|
||||
}
|
||||
}
|
||||
if( newDamage == NETHER + SINGLE_OFFSET )
|
||||
{
|
||||
for( ItemStack quartzStack : materials.purifiedNetherQuartzCrystal().maybeStack( size ).asSet() )
|
||||
for( final ItemStack quartzStack : materials.purifiedNetherQuartzCrystal().maybeStack( size ).asSet() )
|
||||
{
|
||||
return quartzStack;
|
||||
}
|
||||
}
|
||||
if( newDamage == FLUIX + SINGLE_OFFSET )
|
||||
{
|
||||
for( ItemStack quartzStack : materials.purifiedFluixCrystal().maybeStack( size ).asSet() )
|
||||
for( final ItemStack quartzStack : materials.purifiedFluixCrystal().maybeStack( size ).asSet() )
|
||||
{
|
||||
return quartzStack;
|
||||
}
|
||||
@@ -217,39 +217,39 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
return is;
|
||||
}
|
||||
|
||||
private void setProgress( ItemStack is, int newDamage )
|
||||
private void setProgress( final ItemStack is, final int newDamage )
|
||||
{
|
||||
NBTTagCompound comp = Platform.openNbtData( is );
|
||||
final NBTTagCompound comp = Platform.openNbtData( is );
|
||||
comp.setInteger( "progress", newDamage );
|
||||
is.setItemDamage( is.getItemDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMultiplier( Block blk, Material mat )
|
||||
public float getMultiplier( final Block blk, final Material mat )
|
||||
{
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
lines.add( ButtonToolTips.DoesntDespawn.getLocal() );
|
||||
int progress = this.getProgress( stack ) % SINGLE_OFFSET;
|
||||
final int progress = this.getProgress( stack ) % SINGLE_OFFSET;
|
||||
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
|
||||
|
||||
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEntityLifespan( ItemStack itemStack, World world )
|
||||
public int getEntityLifespan( final ItemStack itemStack, final World world )
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName( ItemStack is )
|
||||
public String getUnlocalizedName( final ItemStack is )
|
||||
{
|
||||
int damage = this.getProgress( is );
|
||||
final int damage = this.getProgress( is );
|
||||
|
||||
if( damage < CERTUS + SINGLE_OFFSET )
|
||||
{
|
||||
@@ -276,27 +276,27 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamaged( ItemStack stack )
|
||||
public boolean isDamaged( final ItemStack stack )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDamage( ItemStack stack )
|
||||
public int getMaxDamage( final ItemStack stack )
|
||||
{
|
||||
return FINAL_STAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomEntity( ItemStack stack )
|
||||
public boolean hasCustomEntity( final ItemStack stack )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity( World world, Entity location, ItemStack itemstack )
|
||||
public Entity createEntity( final World world, final Entity location, final ItemStack itemstack )
|
||||
{
|
||||
EntityGrowingCrystal egc = new EntityGrowingCrystal( world, location.posX, location.posY, location.posZ, itemstack );
|
||||
final EntityGrowingCrystal egc = new EntityGrowingCrystal( world, location.posX, location.posY, location.posZ, itemstack );
|
||||
|
||||
egc.motionX = location.motionX;
|
||||
egc.motionY = location.motionY;
|
||||
@@ -313,7 +313,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
|
||||
{
|
||||
// lvl 0
|
||||
itemStacks.add( newStyle( new ItemStack( this, 1, CERTUS ) ) );
|
||||
|
||||
@@ -68,8 +68,8 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
@Override
|
||||
public void registerIcons(
|
||||
ClientHelper proxy,
|
||||
String name )
|
||||
final ClientHelper proxy,
|
||||
final String name )
|
||||
{
|
||||
encodedPatternModel = res = proxy.setIcon( this, name );
|
||||
|
||||
@@ -79,15 +79,15 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(
|
||||
ItemStack stack )
|
||||
final ItemStack stack )
|
||||
{
|
||||
if ( recursive == false )
|
||||
{
|
||||
this.recursive = true;
|
||||
|
||||
ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
||||
|
||||
ItemStack is = iep.getOutput( stack );
|
||||
final ItemStack is = iep.getOutput( stack );
|
||||
if ( Minecraft.getMinecraft().thePlayer.isSneaking() )
|
||||
{
|
||||
return encodedPatternModel;
|
||||
@@ -103,7 +103,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack stack, World w, EntityPlayer player )
|
||||
public ItemStack onItemRightClick( final ItemStack stack, final World w, final EntityPlayer player )
|
||||
{
|
||||
this.clearPattern( stack, player );
|
||||
|
||||
@@ -112,19 +112,19 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
final ItemStack stack,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
return this.clearPattern( stack, player );
|
||||
}
|
||||
|
||||
private boolean clearPattern( ItemStack stack, EntityPlayer player )
|
||||
private boolean clearPattern( final ItemStack stack, final EntityPlayer player )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
@@ -133,13 +133,13 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
return false;
|
||||
}
|
||||
|
||||
InventoryPlayer inv = player.inventory;
|
||||
final InventoryPlayer inv = player.inventory;
|
||||
|
||||
for( int s = 0; s < player.inventory.getSizeInventory(); s++ )
|
||||
{
|
||||
if( inv.getStackInSlot( s ) == stack )
|
||||
{
|
||||
for( ItemStack blankPattern : AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.stackSize ).asSet() )
|
||||
for( final ItemStack blankPattern : AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.stackSize ).asSet() )
|
||||
{
|
||||
inv.setInventorySlotContents( s, blankPattern );
|
||||
}
|
||||
@@ -153,9 +153,9 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj );
|
||||
final ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj );
|
||||
|
||||
if( details == null )
|
||||
{
|
||||
@@ -163,17 +163,17 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isCrafting = details.isCraftable();
|
||||
final boolean isCrafting = details.isCraftable();
|
||||
|
||||
IAEItemStack[] in = details.getCondensedInputs();
|
||||
IAEItemStack[] out = details.getCondensedOutputs();
|
||||
final IAEItemStack[] in = details.getCondensedInputs();
|
||||
final IAEItemStack[] out = details.getCondensedOutputs();
|
||||
|
||||
String label = ( isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal() ) + ": ";
|
||||
String and = ' ' + GuiText.And.getLocal() + ' ';
|
||||
String with = GuiText.With.getLocal() + ": ";
|
||||
final String label = ( isCrafting ? GuiText.Crafts.getLocal() : GuiText.Creates.getLocal() ) + ": ";
|
||||
final String and = ' ' + GuiText.And.getLocal() + ' ';
|
||||
final String with = GuiText.With.getLocal() + ": ";
|
||||
|
||||
boolean first = true;
|
||||
for( IAEItemStack anOut : out )
|
||||
for( final IAEItemStack anOut : out )
|
||||
{
|
||||
if( anOut == null )
|
||||
{
|
||||
@@ -185,7 +185,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
first = true;
|
||||
for( IAEItemStack anIn : in )
|
||||
for( final IAEItemStack anIn : in )
|
||||
{
|
||||
if( anIn == null )
|
||||
{
|
||||
@@ -198,19 +198,19 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingPatternDetails getPatternForItem( ItemStack is, World w )
|
||||
public ICraftingPatternDetails getPatternForItem( final ItemStack is, final World w )
|
||||
{
|
||||
try
|
||||
{
|
||||
return new PatternHelper( is, w );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getOutput( ItemStack item )
|
||||
public ItemStack getOutput( final ItemStack item )
|
||||
{
|
||||
ItemStack out = SIMPLE_CACHE.get( item );
|
||||
if( out != null )
|
||||
@@ -218,13 +218,13 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
return out;
|
||||
}
|
||||
|
||||
World w = CommonHelper.proxy.getWorld();
|
||||
final World w = CommonHelper.proxy.getWorld();
|
||||
if( w == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
ICraftingPatternDetails details = this.getPatternForItem( item, w );
|
||||
final ICraftingPatternDetails details = this.getPatternForItem( item, w );
|
||||
|
||||
if( details == null )
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons( ClientHelper ir, String name )
|
||||
public void registerIcons( final ClientHelper ir, final String name )
|
||||
{
|
||||
final ModelResourceLocation sloc = ir.setIcon( this, name + "Shimmer" );
|
||||
final ModelResourceLocation loc = ir.setIcon( this, name );
|
||||
@@ -60,7 +60,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(
|
||||
ItemStack stack )
|
||||
final ItemStack stack )
|
||||
{
|
||||
if ( isLumen(stack) )
|
||||
return sloc;
|
||||
@@ -71,32 +71,32 @@ public class ItemPaintBall extends AEBaseItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName( ItemStack is )
|
||||
public String getItemStackDisplayName( final ItemStack is )
|
||||
{
|
||||
return super.getItemStackDisplayName( is ) + " - " + this.getExtraName( is );
|
||||
}
|
||||
|
||||
public String getExtraName( ItemStack is )
|
||||
public String getExtraName( final ItemStack is )
|
||||
{
|
||||
return ( is.getItemDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(
|
||||
ItemStack stack,
|
||||
int renderPass )
|
||||
final ItemStack stack,
|
||||
final int renderPass )
|
||||
{
|
||||
AEColor col = getColor(stack);
|
||||
final AEColor col = getColor(stack);
|
||||
|
||||
int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
int r = ( colorValue >> 16 ) & 0xff;
|
||||
int g = ( colorValue >> 8 ) & 0xff;
|
||||
int b = ( colorValue ) & 0xff;
|
||||
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||
final int r = ( colorValue >> 16 ) & 0xff;
|
||||
final int g = ( colorValue >> 8 ) & 0xff;
|
||||
final int b = ( colorValue ) & 0xff;
|
||||
|
||||
if( stack.getItemDamage() >= 20 )
|
||||
{
|
||||
float fail = 0.7f;
|
||||
int full = (int) ( 255 * 0.3 );
|
||||
final float fail = 0.7f;
|
||||
final int full = (int) ( 255 * 0.3 );
|
||||
return (int)( full + r * fail ) << 16 | (int)( full + g * fail ) << 8 | (int)( full + b * fail ) | 0xff << 24;
|
||||
}
|
||||
else
|
||||
@@ -105,7 +105,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
}
|
||||
}
|
||||
|
||||
public AEColor getColor( ItemStack is )
|
||||
public AEColor getColor( final ItemStack is )
|
||||
{
|
||||
int dmg = is.getItemDamage();
|
||||
if( dmg >= DAMAGE_THRESHOLD )
|
||||
@@ -122,9 +122,9 @@ public class ItemPaintBall extends AEBaseItem
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
|
||||
{
|
||||
for( AEColor c : AEColor.values() )
|
||||
for( final AEColor c : AEColor.values() )
|
||||
{
|
||||
if( c != AEColor.Transparent )
|
||||
{
|
||||
@@ -132,7 +132,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
}
|
||||
}
|
||||
|
||||
for( AEColor c : AEColor.values() )
|
||||
for( final AEColor c : AEColor.values() )
|
||||
{
|
||||
if( c != AEColor.Transparent )
|
||||
{
|
||||
@@ -141,9 +141,9 @@ public class ItemPaintBall extends AEBaseItem
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLumen( ItemStack is )
|
||||
public boolean isLumen( final ItemStack is )
|
||||
{
|
||||
int dmg = is.getItemDamage();
|
||||
final int dmg = is.getItemDamage();
|
||||
return dmg >= DAMAGE_THRESHOLD;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,30 +68,30 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack is,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
final ItemStack is,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
return AEApi.instance().partHelper().placeBus( is, pos, side, player, world );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName( ItemStack is )
|
||||
public String getItemStackDisplayName( final ItemStack is )
|
||||
{
|
||||
try
|
||||
{
|
||||
ItemStack in = this.getTextureItem( is );
|
||||
final ItemStack in = this.getTextureItem( is );
|
||||
if( in != null )
|
||||
{
|
||||
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName();
|
||||
}
|
||||
}
|
||||
catch( Throwable ignored )
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
|
||||
{
|
||||
this.calculateSubTypes();
|
||||
itemStacks.addAll( this.subTypes );
|
||||
@@ -111,25 +111,25 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
if( this.subTypes == null )
|
||||
{
|
||||
this.subTypes = new ArrayList<ItemStack>( 1000 );
|
||||
for( Object blk : Block.blockRegistry )
|
||||
for( final Object blk : Block.blockRegistry )
|
||||
{
|
||||
Block b = (Block) blk;
|
||||
final Block b = (Block) blk;
|
||||
try
|
||||
{
|
||||
Item item = Item.getItemFromBlock( b );
|
||||
final Item item = Item.getItemFromBlock( b );
|
||||
|
||||
List<ItemStack> tmpList = new ArrayList<ItemStack>( 100 );
|
||||
final List<ItemStack> tmpList = new ArrayList<ItemStack>( 100 );
|
||||
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
|
||||
for( ItemStack l : tmpList )
|
||||
for( final ItemStack l : tmpList )
|
||||
{
|
||||
ItemStack facade = this.createFacadeForItem( l, false );
|
||||
final ItemStack facade = this.createFacadeForItem( l, false );
|
||||
if( facade != null )
|
||||
{
|
||||
this.subTypes.add( facade );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
// just absorb..
|
||||
}
|
||||
@@ -142,26 +142,26 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack createFacadeForItem( ItemStack l, boolean returnItem )
|
||||
public ItemStack createFacadeForItem( final ItemStack l, final boolean returnItem )
|
||||
{
|
||||
if( l == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Block b = Block.getBlockFromItem( l.getItem() );
|
||||
final Block b = Block.getBlockFromItem( l.getItem() );
|
||||
if( b == null || l.hasTagCompound() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int metadata = l.getItem().getMetadata( l.getItemDamage() );
|
||||
final int metadata = l.getItem().getMetadata( l.getItemDamage() );
|
||||
|
||||
boolean hasTile = b.hasTileEntity( b.getStateFromMeta( metadata ) );
|
||||
boolean enableGlass = b instanceof BlockGlass || b instanceof BlockStainedGlass;
|
||||
boolean disableOre = b instanceof QuartzOreBlock;
|
||||
final boolean hasTile = b.hasTileEntity( b.getStateFromMeta( metadata ) );
|
||||
final boolean enableGlass = b instanceof BlockGlass || b instanceof BlockStainedGlass;
|
||||
final boolean disableOre = b instanceof QuartzOreBlock;
|
||||
|
||||
boolean defaultValue = ( b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
|
||||
final boolean defaultValue = ( b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
|
||||
if( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
|
||||
{
|
||||
if( returnItem )
|
||||
@@ -169,13 +169,13 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
return l;
|
||||
}
|
||||
|
||||
ItemStack is = new ItemStack( this );
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
int[] ds = new int[2];
|
||||
final ItemStack is = new ItemStack( this );
|
||||
final NBTTagCompound data = new NBTTagCompound();
|
||||
final int[] ds = new int[2];
|
||||
ds[0] = Item.getIdFromItem( l.getItem() );
|
||||
ds[1] = metadata;
|
||||
data.setIntArray( "x", ds );
|
||||
UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() );
|
||||
final UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() );
|
||||
data.setString( "modid", ui.modId );
|
||||
data.setString( "itemname", ui.name );
|
||||
is.setTagCompound( data );
|
||||
@@ -185,9 +185,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public FacadePart createPartFromItemStack( ItemStack is, AEPartLocation side )
|
||||
public FacadePart createPartFromItemStack( final ItemStack is, final AEPartLocation side )
|
||||
{
|
||||
ItemStack in = this.getTextureItem( is );
|
||||
final ItemStack in = this.getTextureItem( is );
|
||||
if( in != null )
|
||||
{
|
||||
return new FacadePart( is, side );
|
||||
@@ -196,9 +196,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTextureItem( ItemStack is )
|
||||
public ItemStack getTextureItem( final ItemStack is )
|
||||
{
|
||||
Block blk = this.getBlock( is );
|
||||
final Block blk = this.getBlock( is );
|
||||
if( blk != null )
|
||||
{
|
||||
return new ItemStack( blk, 1, this.getMeta( is ) );
|
||||
@@ -207,12 +207,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta( ItemStack is )
|
||||
public int getMeta( final ItemStack is )
|
||||
{
|
||||
NBTTagCompound data = is.getTagCompound();
|
||||
final NBTTagCompound data = is.getTagCompound();
|
||||
if( data != null )
|
||||
{
|
||||
int[] blk = data.getIntArray( "x" );
|
||||
final int[] blk = data.getIntArray( "x" );
|
||||
if( blk != null && blk.length == 2 )
|
||||
{
|
||||
return blk[1];
|
||||
@@ -222,9 +222,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock( ItemStack is )
|
||||
public Block getBlock( final ItemStack is )
|
||||
{
|
||||
NBTTagCompound data = is.getTagCompound();
|
||||
final NBTTagCompound data = is.getTagCompound();
|
||||
if( data != null )
|
||||
{
|
||||
if( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
|
||||
@@ -236,7 +236,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
else
|
||||
{
|
||||
int[] blk = data.getIntArray( "x" );
|
||||
final int[] blk = data.getIntArray( "x" );
|
||||
if( blk != null && blk.length == 2 )
|
||||
{
|
||||
return Block.getBlockById( blk[0] );
|
||||
@@ -262,11 +262,11 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
return this.subTypes.get( 0 );
|
||||
}
|
||||
|
||||
public ItemStack createFromIDs( int[] ids )
|
||||
public ItemStack createFromIDs( final int[] ids )
|
||||
{
|
||||
for( ItemStack facadeStack : AEApi.instance().definitions().items().facade().maybeStack( 1 ).asSet() )
|
||||
for( final ItemStack facadeStack : AEApi.instance().definitions().items().facade().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
NBTTagCompound facadeTag = new NBTTagCompound();
|
||||
final NBTTagCompound facadeTag = new NBTTagCompound();
|
||||
facadeTag.setIntArray( "x", ids.clone() );
|
||||
facadeStack.setTagCompound( facadeTag );
|
||||
|
||||
@@ -277,16 +277,16 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useAlphaPass( ItemStack is )
|
||||
public boolean useAlphaPass( final ItemStack is )
|
||||
{
|
||||
ItemStack out = this.getTextureItem( is );
|
||||
final ItemStack out = this.getTextureItem( is );
|
||||
|
||||
if( out == null || out.getItem() == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Block blk = Block.getBlockFromItem( out.getItem() );
|
||||
final Block blk = Block.getBlockFromItem( out.getItem() );
|
||||
if( blk != null && blk.canRenderInLayer( EnumWorldBlockLayer.TRANSLUCENT ) )
|
||||
{
|
||||
return true;
|
||||
@@ -297,7 +297,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
@Override
|
||||
public void registerCustomIcon(
|
||||
TextureMap map )
|
||||
final TextureMap map )
|
||||
{
|
||||
myIcon = new BaseIcon( map.registerSprite( new ResourceLocation( AppEng.MOD_ID, "blocks/ItemFacade" ) ));
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
public static ItemMultiPart instance;
|
||||
private final Map<Integer, PartTypeWithVariant> registered;
|
||||
|
||||
public ItemMultiPart( IPartHelper partHelper )
|
||||
public ItemMultiPart( final IPartHelper partHelper )
|
||||
{
|
||||
Preconditions.checkNotNull( partHelper );
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final ItemStackSrc createPart( PartType mat )
|
||||
public final ItemStackSrc createPart( final PartType mat )
|
||||
{
|
||||
Preconditions.checkNotNull( mat );
|
||||
|
||||
@@ -96,7 +96,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStackSrc createPart( PartType mat, AEColor color )
|
||||
public ItemStackSrc createPart( final PartType mat, final AEColor color )
|
||||
{
|
||||
Preconditions.checkNotNull( mat );
|
||||
Preconditions.checkNotNull( color );
|
||||
@@ -107,13 +107,13 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private ItemStackSrc createPart( PartType mat, int varID )
|
||||
private ItemStackSrc createPart( final PartType mat, final int varID )
|
||||
{
|
||||
assert mat != null;
|
||||
assert varID >= 0;
|
||||
|
||||
// verify
|
||||
for( PartTypeWithVariant p : this.registered.values() )
|
||||
for( final PartTypeWithVariant p : this.registered.values() )
|
||||
{
|
||||
if( p.part == mat && p.variant == varID )
|
||||
{
|
||||
@@ -122,12 +122,12 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
boolean enabled = true;
|
||||
for( AEFeature f : mat.getFeature() )
|
||||
for( final AEFeature f : mat.getFeature() )
|
||||
{
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
}
|
||||
|
||||
for( IntegrationType integrationType : mat.getIntegrations() )
|
||||
for( final IntegrationType integrationType : mat.getIntegrations() )
|
||||
{
|
||||
enabled &= IntegrationRegistry.INSTANCE.isEnabled( integrationType );
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
return output;
|
||||
}
|
||||
|
||||
private void processMetaOverlap( boolean enabled, int partDamage, PartType mat, PartTypeWithVariant pti )
|
||||
private void processMetaOverlap( final boolean enabled, final int partDamage, final PartType mat, final PartTypeWithVariant pti )
|
||||
{
|
||||
assert partDamage >= 0;
|
||||
assert mat != null;
|
||||
@@ -161,11 +161,11 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
}
|
||||
|
||||
public int getDamageByType( PartType t )
|
||||
public int getDamageByType( final PartType t )
|
||||
{
|
||||
Preconditions.checkNotNull( t );
|
||||
|
||||
for( Entry<Integer, PartTypeWithVariant> pt : this.registered.entrySet() )
|
||||
for( final Entry<Integer, PartTypeWithVariant> pt : this.registered.entrySet() )
|
||||
{
|
||||
if( pt.getValue().part == t )
|
||||
{
|
||||
@@ -176,7 +176,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse( ItemStack is, EntityPlayer player, World w, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ )
|
||||
public boolean onItemUse( final ItemStack is, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( this.getTypeByStack( is ) == PartType.InvalidType )
|
||||
{
|
||||
@@ -187,7 +187,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName( ItemStack is )
|
||||
public String getUnlocalizedName( final ItemStack is )
|
||||
{
|
||||
return "item.appliedenergistics2." + this.getName( is );
|
||||
}
|
||||
@@ -196,16 +196,16 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerCustomIcon(
|
||||
TextureMap map )
|
||||
final TextureMap map )
|
||||
{
|
||||
for( Entry<Integer, PartTypeWithVariant> part : this.registered.entrySet() )
|
||||
for( final Entry<Integer, PartTypeWithVariant> part : this.registered.entrySet() )
|
||||
{
|
||||
part.getValue().texture= new BaseIcon( map.registerSprite( new ResourceLocation( AppEng.MOD_ID, "blocks/" + this.getName( new ItemStack( this, 1, part.getKey() ) ) )) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAESprite getIcon( ItemStack is )
|
||||
public IAESprite getIcon( final ItemStack is )
|
||||
{
|
||||
final int dmg = is.getMetadata();
|
||||
final PartTypeWithVariant registeredType = this.registered.get( dmg );
|
||||
@@ -218,7 +218,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName( ItemStack is )
|
||||
public String getItemStackDisplayName( final ItemStack is )
|
||||
{
|
||||
final PartType pt = this.getTypeByStack( is );
|
||||
|
||||
@@ -243,18 +243,18 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
|
||||
{
|
||||
List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() );
|
||||
final List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() );
|
||||
Collections.sort( types, REGISTERED_COMPARATOR );
|
||||
|
||||
for( Entry<Integer, PartTypeWithVariant> part : types )
|
||||
for( final Entry<Integer, PartTypeWithVariant> part : types )
|
||||
{
|
||||
itemStacks.add( new ItemStack( this, 1, part.getKey() ) );
|
||||
}
|
||||
}
|
||||
|
||||
public String getName( ItemStack is )
|
||||
public String getName( final ItemStack is )
|
||||
{
|
||||
Preconditions.checkNotNull( is );
|
||||
|
||||
@@ -265,7 +265,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public PartType getTypeByStack( ItemStack is )
|
||||
public PartType getTypeByStack( final ItemStack is )
|
||||
{
|
||||
Preconditions.checkNotNull( is );
|
||||
|
||||
@@ -280,7 +280,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IPart createPartFromItemStack( ItemStack is )
|
||||
public IPart createPartFromItemStack( final ItemStack is )
|
||||
{
|
||||
final PartType type = this.getTypeByStack( is );
|
||||
final Class<? extends IPart> part = type.getPart();
|
||||
@@ -298,25 +298,25 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
|
||||
return type.constructor.newInstance( is );
|
||||
}
|
||||
catch( InstantiationException e )
|
||||
catch( final InstantiationException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
catch( IllegalAccessException e )
|
||||
catch( final IllegalAccessException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
catch( InvocationTargetException e )
|
||||
catch( final InvocationTargetException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
catch( NoSuchMethodException e )
|
||||
catch( final NoSuchMethodException e )
|
||||
{
|
||||
throw new IllegalStateException( "Unable to construct IBusPart from IBusItem : " + part.getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
}
|
||||
|
||||
public int variantOf( int itemDamage )
|
||||
public int variantOf( final int itemDamage )
|
||||
{
|
||||
final PartTypeWithVariant registeredPartType = this.registered.get( itemDamage );
|
||||
if( registeredPartType != null )
|
||||
@@ -329,19 +329,19 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
{
|
||||
boolean importBus = false;
|
||||
boolean exportBus = false;
|
||||
boolean group = false;
|
||||
|
||||
PartType u = this.getTypeByStack( is );
|
||||
final PartType u = this.getTypeByStack( is );
|
||||
|
||||
for( ItemStack stack : others )
|
||||
for( final ItemStack stack : others )
|
||||
{
|
||||
if( stack.getItem() == this )
|
||||
{
|
||||
PartType pt = this.getTypeByStack( stack );
|
||||
final PartType pt = this.getTypeByStack( stack );
|
||||
switch( pt )
|
||||
{
|
||||
case ImportBus:
|
||||
@@ -379,7 +379,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IAESprite texture = null;
|
||||
|
||||
private PartTypeWithVariant( PartType part, int variant )
|
||||
private PartTypeWithVariant( final PartType part, final int variant )
|
||||
{
|
||||
assert part != null;
|
||||
assert variant >= 0;
|
||||
@@ -401,7 +401,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
private static final class RegisteredComparator implements Comparator<Entry<Integer, PartTypeWithVariant>>
|
||||
{
|
||||
@Override
|
||||
public int compare( Entry<Integer, PartTypeWithVariant> o1, Entry<Integer, PartTypeWithVariant> o2 )
|
||||
public int compare( final Entry<Integer, PartTypeWithVariant> o1, final Entry<Integer, PartTypeWithVariant> o2 )
|
||||
{
|
||||
return o1.getValue().part.name().compareTo( o2.getValue().part.name() );
|
||||
}
|
||||
|
||||
@@ -167,12 +167,12 @@ public enum PartType
|
||||
private final GuiText extraName;
|
||||
public Constructor<? extends IPart> constructor;
|
||||
|
||||
PartType( int baseMetaValue, Set<AEFeature> features, Set<IntegrationType> integrations, Class<? extends IPart> c )
|
||||
PartType( final int baseMetaValue, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c )
|
||||
{
|
||||
this( baseMetaValue, features, integrations, c, null );
|
||||
}
|
||||
|
||||
PartType( int baseMetaValue, Set<AEFeature> features, Set<IntegrationType> integrations, Class<? extends IPart> c, GuiText en )
|
||||
PartType( final int baseMetaValue, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en )
|
||||
{
|
||||
this.features = Collections.unmodifiableSet( features );
|
||||
this.integrations = Collections.unmodifiableSet( integrations );
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
private final int perType;
|
||||
private final double idleDrain;
|
||||
|
||||
public ItemBasicStorageCell( MaterialType whichCell, int kilobytes )
|
||||
public ItemBasicStorageCell( final MaterialType whichCell, final int kilobytes )
|
||||
{
|
||||
super( Optional.of( kilobytes + "k" ) );
|
||||
|
||||
@@ -98,14 +98,14 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
|
||||
if( inventory instanceof ICellInventoryHandler )
|
||||
{
|
||||
ICellInventoryHandler handler = (ICellInventoryHandler) inventory;
|
||||
ICellInventory cellInventory = handler.getCellInv();
|
||||
final ICellInventoryHandler handler = (ICellInventoryHandler) inventory;
|
||||
final ICellInventory cellInventory = handler.getCellInv();
|
||||
|
||||
if( cellInventory != null )
|
||||
{
|
||||
@@ -115,7 +115,7 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
|
||||
if( handler.isPreformatted() )
|
||||
{
|
||||
String list = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded ).getLocal();
|
||||
final String list = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded ).getLocal();
|
||||
|
||||
if( handler.isFuzzy() )
|
||||
{
|
||||
@@ -131,25 +131,25 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes( ItemStack cellItem )
|
||||
public int getBytes( final ItemStack cellItem )
|
||||
{
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType( ItemStack cellItem )
|
||||
public int getBytesPerType( final ItemStack cellItem )
|
||||
{
|
||||
return this.perType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes( ItemStack cellItem )
|
||||
public int getTotalTypes( final ItemStack cellItem )
|
||||
{
|
||||
return 63;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
|
||||
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell( ItemStack i )
|
||||
public boolean isStorageCell( final ItemStack i )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -173,57 +173,57 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
{
|
||||
return GuiText.StorageCells.getUnlocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable( ItemStack is )
|
||||
public boolean isEditable( final ItemStack is )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory( ItemStack is )
|
||||
public IInventory getUpgradesInventory( final ItemStack is )
|
||||
{
|
||||
return new CellUpgrades( is, 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory( ItemStack is )
|
||||
public IInventory getConfigInventory( final ItemStack is )
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( ItemStack is )
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack stack, World world, EntityPlayer player )
|
||||
public ItemStack onItemRightClick( final ItemStack stack, final World world, final EntityPlayer player )
|
||||
{
|
||||
this.disassembleDrive( stack, world, player );
|
||||
return stack;
|
||||
}
|
||||
|
||||
private boolean disassembleDrive( ItemStack stack, World world, EntityPlayer player )
|
||||
private boolean disassembleDrive( final ItemStack stack, final World world, final EntityPlayer player )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
@@ -232,18 +232,18 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
return false;
|
||||
}
|
||||
|
||||
InventoryPlayer playerInventory = player.inventory;
|
||||
IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final InventoryPlayer playerInventory = player.inventory;
|
||||
final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
if( inv != null && playerInventory.getCurrentItem() == stack )
|
||||
{
|
||||
InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, EnumFacing.UP );
|
||||
IItemList<IAEItemStack> list = inv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, EnumFacing.UP );
|
||||
final IItemList<IAEItemStack> list = inv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
if( list.isEmpty() && ia != null )
|
||||
{
|
||||
playerInventory.setInventorySlotContents( playerInventory.currentItem, null );
|
||||
|
||||
// drop core
|
||||
ItemStack extraB = ia.addItems( this.component.stack( 1 ) );
|
||||
final ItemStack extraB = ia.addItems( this.component.stack( 1 ) );
|
||||
if( extraB != null )
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice( extraB, false );
|
||||
@@ -262,7 +262,7 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
}
|
||||
|
||||
// drop empty storage cell case
|
||||
for( ItemStack storageCellStack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
for( final ItemStack storageCellStack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
final ItemStack extraA = ia.addItems( storageCellStack );
|
||||
if( extraA != null )
|
||||
@@ -285,22 +285,22 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
final ItemStack stack,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
return this.disassembleDrive( stack, world, player );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem( ItemStack itemStack )
|
||||
public ItemStack getContainerItem( final ItemStack itemStack )
|
||||
{
|
||||
for( ItemStack stack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
for( final ItemStack stack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem( ItemStack stack )
|
||||
public boolean hasContainerItem( final ItemStack stack )
|
||||
{
|
||||
return AEConfig.instance.isFeatureEnabled( AEFeature.enableDisassemblyCrafting );
|
||||
}
|
||||
|
||||
@@ -40,31 +40,31 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable( ItemStack is )
|
||||
public boolean isEditable( final ItemStack is )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory( ItemStack is )
|
||||
public IInventory getUpgradesInventory( final ItemStack is )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory( ItemStack is )
|
||||
public IInventory getConfigInventory( final ItemStack is )
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( ItemStack is )
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
{
|
||||
private final int maxRegion;
|
||||
|
||||
public ItemSpatialStorageCell( int spatialScale )
|
||||
public ItemSpatialStorageCell( final int spatialScale )
|
||||
{
|
||||
super( Optional.of( spatialScale + "Cubed" ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
@@ -54,9 +54,9 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
WorldCoord wc = this.getStoredSize( stack );
|
||||
final WorldCoord wc = this.getStoredSize( stack );
|
||||
if( wc.x > 0 )
|
||||
{
|
||||
lines.add( GuiText.StoredSize.getLocal() + ": " + wc.x + " x " + wc.y + " x " + wc.z );
|
||||
@@ -64,24 +64,24 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSpatialStorage( ItemStack is )
|
||||
public boolean isSpatialStorage( final ItemStack is )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxStoredDim( ItemStack is )
|
||||
public int getMaxStoredDim( final ItemStack is )
|
||||
{
|
||||
return this.maxRegion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld( ItemStack is )
|
||||
public World getWorld( final ItemStack is )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound c = is.getTagCompound();
|
||||
int dim = c.getInteger( "StorageDim" );
|
||||
final NBTTagCompound c = is.getTagCompound();
|
||||
final int dim = c.getInteger( "StorageDim" );
|
||||
World w = DimensionManager.getWorld( dim );
|
||||
if( w == null )
|
||||
{
|
||||
@@ -101,14 +101,14 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldCoord getStoredSize( ItemStack is )
|
||||
public WorldCoord getStoredSize( final ItemStack is )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound c = is.getTagCompound();
|
||||
final NBTTagCompound c = is.getTagCompound();
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
int dim = c.getInteger( "StorageDim" );
|
||||
final int dim = c.getInteger( "StorageDim" );
|
||||
return WorldData.instance().dimensionData().getStoredSize( dim );
|
||||
}
|
||||
else
|
||||
@@ -120,12 +120,12 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldCoord getMin( ItemStack is )
|
||||
public WorldCoord getMin( final ItemStack is )
|
||||
{
|
||||
World w = this.getWorld( is );
|
||||
final World w = this.getWorld( is );
|
||||
if( w != null )
|
||||
{
|
||||
NBTTagCompound info = (NBTTagCompound) w.getWorldInfo().getAdditionalProperty( "storageCell" );
|
||||
final NBTTagCompound info = (NBTTagCompound) w.getWorldInfo().getAdditionalProperty( "storageCell" );
|
||||
if( info != null )
|
||||
{
|
||||
return new WorldCoord( info.getInteger( "minX" ), info.getInteger( "minY" ), info.getInteger( "minZ" ) );
|
||||
@@ -135,12 +135,12 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldCoord getMax( ItemStack is )
|
||||
public WorldCoord getMax( final ItemStack is )
|
||||
{
|
||||
World w = this.getWorld( is );
|
||||
final World w = this.getWorld( is );
|
||||
if( w != null )
|
||||
{
|
||||
NBTTagCompound info = (NBTTagCompound) w.getWorldInfo().getAdditionalProperty( "storageCell" );
|
||||
final NBTTagCompound info = (NBTTagCompound) w.getWorldInfo().getAdditionalProperty( "storageCell" );
|
||||
if( info != null )
|
||||
{
|
||||
return new WorldCoord( info.getInteger( "maxX" ), info.getInteger( "maxY" ), info.getInteger( "maxZ" ) );
|
||||
@@ -150,14 +150,14 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransitionResult doSpatialTransition( ItemStack is, World w, WorldCoord min, WorldCoord max, boolean doTransition )
|
||||
public TransitionResult doSpatialTransition( final ItemStack is, final World w, final WorldCoord min, final WorldCoord max, final boolean doTransition )
|
||||
{
|
||||
WorldCoord scale = this.getStoredSize( is );
|
||||
final WorldCoord scale = this.getStoredSize( is );
|
||||
|
||||
int targetX = max.x - min.x - 1;
|
||||
int targetY = max.y - min.y - 1;
|
||||
int targetZ = max.z - min.z - 1;
|
||||
int maxSize = this.getMaxStoredDim( is );
|
||||
final int targetX = max.x - min.x - 1;
|
||||
final int targetY = max.y - min.y - 1;
|
||||
final int targetZ = max.z - min.z - 1;
|
||||
final int maxSize = this.getMaxStoredDim( is );
|
||||
|
||||
World destination = this.getWorld( is );
|
||||
|
||||
@@ -170,7 +170,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
destination = this.createNewWorld( is );
|
||||
}
|
||||
|
||||
int floorBuffer = 64;
|
||||
final int floorBuffer = 64;
|
||||
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 );
|
||||
|
||||
@@ -181,22 +181,22 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
return new TransitionResult( false, 0 );
|
||||
}
|
||||
|
||||
public World createNewWorld( ItemStack is )
|
||||
public World createNewWorld( final ItemStack is )
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
int newDim = DimensionManager.getNextFreeDimId();
|
||||
final NBTTagCompound c = Platform.openNbtData( is );
|
||||
final int newDim = DimensionManager.getNextFreeDimId();
|
||||
c.setInteger( "StorageDim", newDim );
|
||||
WorldData.instance().dimensionData().addStorageCell( newDim );
|
||||
DimensionManager.initDimension( newDim );
|
||||
return DimensionManager.getWorld( newDim );
|
||||
}
|
||||
|
||||
private void setStoredSize( ItemStack is, int targetX, int targetY, int targetZ )
|
||||
private void setStoredSize( final ItemStack is, final int targetX, final int targetY, final int targetZ )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound c = is.getTagCompound();
|
||||
int dim = c.getInteger( "StorageDim" );
|
||||
final NBTTagCompound c = is.getTagCompound();
|
||||
final int dim = c.getInteger( "StorageDim" );
|
||||
c.setInteger( "sizeX", targetX );
|
||||
c.setInteger( "sizeY", targetY );
|
||||
c.setInteger( "sizeZ", targetZ );
|
||||
|
||||
@@ -50,13 +50,13 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
this.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
public static IPartitionList<IAEItemStack> createFilter( ItemStack[] list )
|
||||
public static IPartitionList<IAEItemStack> createFilter( final ItemStack[] list )
|
||||
{
|
||||
IPartitionList<IAEItemStack> myPartitionList = null;
|
||||
|
||||
MergedPriorityList<IAEItemStack> myMergedList = new MergedPriorityList<IAEItemStack>();
|
||||
final MergedPriorityList<IAEItemStack> myMergedList = new MergedPriorityList<IAEItemStack>();
|
||||
|
||||
for( ItemStack currentViewCell : list )
|
||||
for( final ItemStack currentViewCell : list )
|
||||
{
|
||||
if( currentViewCell == null )
|
||||
{
|
||||
@@ -65,22 +65,22 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
|
||||
if( ( currentViewCell.getItem() instanceof ItemViewCell ) )
|
||||
{
|
||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
final IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
|
||||
ICellWorkbenchItem vc = (ICellWorkbenchItem) currentViewCell.getItem();
|
||||
IInventory upgrades = vc.getUpgradesInventory( currentViewCell );
|
||||
IInventory config = vc.getConfigInventory( currentViewCell );
|
||||
FuzzyMode fzMode = vc.getFuzzyMode( currentViewCell );
|
||||
final ICellWorkbenchItem vc = (ICellWorkbenchItem) currentViewCell.getItem();
|
||||
final IInventory upgrades = vc.getUpgradesInventory( currentViewCell );
|
||||
final IInventory config = vc.getConfigInventory( currentViewCell );
|
||||
final FuzzyMode fzMode = vc.getFuzzyMode( currentViewCell );
|
||||
|
||||
boolean hasInverter = false;
|
||||
boolean hasFuzzy = false;
|
||||
|
||||
for( int x = 0; x < upgrades.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack is = upgrades.getStackInSlot( x );
|
||||
final ItemStack is = upgrades.getStackInSlot( x );
|
||||
if( is != null && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
|
||||
final Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
|
||||
if( u != null )
|
||||
{
|
||||
switch( u )
|
||||
@@ -99,7 +99,7 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
|
||||
for( int x = 0; x < config.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack is = config.getStackInSlot( x );
|
||||
final ItemStack is = config.getStackInSlot( x );
|
||||
if( is != null )
|
||||
{
|
||||
priorityList.add( AEItemStack.create( is ) );
|
||||
@@ -126,39 +126,39 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable( ItemStack is )
|
||||
public boolean isEditable( final ItemStack is )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory( ItemStack is )
|
||||
public IInventory getUpgradesInventory( final ItemStack is )
|
||||
{
|
||||
return new CellUpgrades( is, 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory( ItemStack is )
|
||||
public IInventory getConfigInventory( final ItemStack is )
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( ItemStack is )
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack is, World w, EntityPlayer p )
|
||||
public ItemStack onItemRightClick( final ItemStack is, final World w, final EntityPlayer p )
|
||||
{
|
||||
if( p.isSneaking() )
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean itemInteractionForEntity( ItemStack is, EntityPlayer par2EntityPlayer, EntityLivingBase target )
|
||||
public boolean itemInteractionForEntity( ItemStack is, final EntityPlayer par2EntityPlayer, final EntityLivingBase target )
|
||||
{
|
||||
if( target instanceof EntityPlayer && !par2EntityPlayer.isSneaking() )
|
||||
{
|
||||
@@ -85,15 +85,15 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName( ItemStack is )
|
||||
public String getItemStackDisplayName( final ItemStack is )
|
||||
{
|
||||
GameProfile username = this.getProfile( is );
|
||||
final GameProfile username = this.getProfile( is );
|
||||
return username != null ? super.getItemStackDisplayName( is ) + " - " + username.getName() : super.getItemStackDisplayName( is );
|
||||
}
|
||||
|
||||
private void encode( ItemStack is, EntityPlayer p )
|
||||
private void encode( final ItemStack is, final EntityPlayer p )
|
||||
{
|
||||
GameProfile username = this.getProfile( is );
|
||||
final GameProfile username = this.getProfile( is );
|
||||
|
||||
if( username != null && username.equals( p.getGameProfile() ) )
|
||||
{
|
||||
@@ -106,13 +106,13 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile( ItemStack itemStack, GameProfile profile )
|
||||
public void setProfile( final ItemStack itemStack, final GameProfile profile )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
final NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
|
||||
if( profile != null )
|
||||
{
|
||||
NBTTagCompound pNBT = new NBTTagCompound();
|
||||
final NBTTagCompound pNBT = new NBTTagCompound();
|
||||
NBTUtil.writeGameProfile( pNBT, profile );
|
||||
tag.setTag( "profile", pNBT );
|
||||
}
|
||||
@@ -123,9 +123,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getProfile( ItemStack is )
|
||||
public GameProfile getProfile( final ItemStack is )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( is );
|
||||
final NBTTagCompound tag = Platform.openNbtData( is );
|
||||
if( tag.hasKey( "profile" ) )
|
||||
{
|
||||
return NBTUtil.readGameProfileFromNBT( tag.getCompoundTag( "profile" ) );
|
||||
@@ -134,12 +134,12 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<SecurityPermissions> getPermissions( ItemStack is )
|
||||
public EnumSet<SecurityPermissions> getPermissions( final ItemStack is )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( is );
|
||||
EnumSet<SecurityPermissions> result = EnumSet.noneOf( SecurityPermissions.class );
|
||||
final NBTTagCompound tag = Platform.openNbtData( is );
|
||||
final EnumSet<SecurityPermissions> result = EnumSet.noneOf( SecurityPermissions.class );
|
||||
|
||||
for( SecurityPermissions sp : SecurityPermissions.values() )
|
||||
for( final SecurityPermissions sp : SecurityPermissions.values() )
|
||||
{
|
||||
if( tag.getBoolean( sp.name() ) )
|
||||
{
|
||||
@@ -151,16 +151,16 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission( ItemStack is, SecurityPermissions permission )
|
||||
public boolean hasPermission( final ItemStack is, final SecurityPermissions permission )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( is );
|
||||
final NBTTagCompound tag = Platform.openNbtData( is );
|
||||
return tag.getBoolean( permission.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePermission( ItemStack itemStack, SecurityPermissions permission )
|
||||
public void removePermission( final ItemStack itemStack, final SecurityPermissions permission )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
final NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
if( tag.hasKey( permission.name() ) )
|
||||
{
|
||||
tag.removeTag( permission.name() );
|
||||
@@ -168,22 +168,22 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPermission( ItemStack itemStack, SecurityPermissions permission )
|
||||
public void addPermission( final ItemStack itemStack, final SecurityPermissions permission )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
final NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
tag.setBoolean( permission.name(), true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPermissions( ISecurityRegistry register, IPlayerRegistry pr, ItemStack is )
|
||||
public void registerPermissions( final ISecurityRegistry register, final IPlayerRegistry pr, final ItemStack is )
|
||||
{
|
||||
register.addPlayer( pr.getID( this.getProfile( is ) ), this.getPermissions( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
|
||||
final EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
|
||||
if( perms.isEmpty() )
|
||||
{
|
||||
lines.add( GuiText.NoPermissions.getLocal() );
|
||||
@@ -192,7 +192,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
{
|
||||
String msg = null;
|
||||
|
||||
for( SecurityPermissions sp : perms )
|
||||
for( final SecurityPermissions sp : perms )
|
||||
{
|
||||
if( msg == null )
|
||||
{
|
||||
|
||||
@@ -47,11 +47,11 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
|
||||
|
||||
NBTTagCompound data = this.getData( stack );
|
||||
final NBTTagCompound data = this.getData( stack );
|
||||
if( data.hasKey( "tooltip" ) )
|
||||
{
|
||||
lines.add( StatCollector.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
|
||||
@@ -65,18 +65,18 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
*
|
||||
* @return localized name
|
||||
*/
|
||||
private String getLocalizedName( String... name )
|
||||
private String getLocalizedName( final String... name )
|
||||
{
|
||||
for( String n : name )
|
||||
for( final String n : name )
|
||||
{
|
||||
String l = StatCollector.translateToLocal( n );
|
||||
final String l = StatCollector.translateToLocal( n );
|
||||
if( !l.equals( n ) )
|
||||
{
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
for( String n : name )
|
||||
for( final String n : name )
|
||||
{
|
||||
return n;
|
||||
}
|
||||
@@ -85,25 +85,25 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMemoryCardContents( ItemStack is, String settingsName, NBTTagCompound data )
|
||||
public void setMemoryCardContents( final ItemStack is, final String settingsName, final NBTTagCompound data )
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
final NBTTagCompound c = Platform.openNbtData( is );
|
||||
c.setString( "Config", settingsName );
|
||||
c.setTag( "Data", data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSettingsName( ItemStack is )
|
||||
public String getSettingsName( final ItemStack is )
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
String name = c.getString( "Config" );
|
||||
final NBTTagCompound c = Platform.openNbtData( is );
|
||||
final String name = c.getString( "Config" );
|
||||
return name == null || name.isEmpty() ? GuiText.Blank.getUnlocalized() : name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getData( ItemStack is )
|
||||
public NBTTagCompound getData( final ItemStack is )
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
final NBTTagCompound c = Platform.openNbtData( is );
|
||||
NBTTagCompound o = c.getCompoundTag( "Data" );
|
||||
if( o == null )
|
||||
{
|
||||
@@ -113,7 +113,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyUser( EntityPlayer player, MemoryCardMessages msg )
|
||||
public void notifyUser( final EntityPlayer player, final MemoryCardMessages msg )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -140,18 +140,18 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack is,
|
||||
EntityPlayer player,
|
||||
World w,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hx,
|
||||
float hy,
|
||||
float hz )
|
||||
final ItemStack is,
|
||||
final EntityPlayer player,
|
||||
final World w,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hx,
|
||||
final float hy,
|
||||
final float hz )
|
||||
{
|
||||
if( player.isSneaking() && !w.isRemote )
|
||||
{
|
||||
IMemoryCard mem = (IMemoryCard) is.getItem();
|
||||
final IMemoryCard mem = (IMemoryCard) is.getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
is.setTagCompound( null );
|
||||
return true;
|
||||
@@ -164,9 +164,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse(
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EntityPlayer player )
|
||||
final World world,
|
||||
final BlockPos pos,
|
||||
final EntityPlayer player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -68,18 +68,18 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject( ItemStack is, World world, BlockPos pos )
|
||||
public IGuiItemObject getGuiObject( final ItemStack is, final World world, final BlockPos pos )
|
||||
{
|
||||
TileEntity te = world.getTileEntity( pos );
|
||||
final TileEntity te = world.getTileEntity( pos );
|
||||
return new NetworkToolViewer( is, (IGridHost) ( te instanceof IGridHost ? te : null ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack it, World w, EntityPlayer p )
|
||||
public ItemStack onItemRightClick( final ItemStack it, final World w, final EntityPlayer p )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
MovingObjectPosition mop = ClientHelper.proxy.getMOP();
|
||||
final MovingObjectPosition mop = ClientHelper.proxy.getMOP();
|
||||
|
||||
if( mop == null )
|
||||
{
|
||||
@@ -99,20 +99,20 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
final ItemStack stack,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
MovingObjectPosition mop = new MovingObjectPosition( new Vec3( hitX, hitY, hitZ ), side, pos );
|
||||
TileEntity te = world.getTileEntity( pos );
|
||||
final MovingObjectPosition mop = new MovingObjectPosition( new Vec3( hitX, hitY, hitZ ), side, pos );
|
||||
final TileEntity te = world.getTileEntity( pos );
|
||||
if( te instanceof IPartHost )
|
||||
{
|
||||
SelectedPart part = ( (IPartHost) te ).selectPart( mop.hitVec );
|
||||
final SelectedPart part = ( (IPartHost) te ).selectPart( mop.hitVec );
|
||||
if( part.part != null )
|
||||
{
|
||||
if( part.part instanceof INetworkToolAgent && !( (INetworkToolAgent) part.part ).showNetworkInfo( mop ) )
|
||||
@@ -135,14 +135,14 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse(
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EntityPlayer player )
|
||||
final World world,
|
||||
final BlockPos pos,
|
||||
final EntityPlayer player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean serverSideToolLogic( ItemStack is, EntityPlayer p, World w, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ )
|
||||
public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( side != null )
|
||||
{
|
||||
@@ -151,10 +151,10 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
return false;
|
||||
}
|
||||
|
||||
Block b = w.getBlockState( pos ).getBlock();
|
||||
final Block b = w.getBlockState( pos ).getBlock();
|
||||
if( b != null && !p.isSneaking() )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( pos );
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
if( !( te instanceof IGridHost ) )
|
||||
{
|
||||
if( b.rotateBlock( w, pos, side ) )
|
||||
@@ -173,7 +173,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntity te = w.getTileEntity( pos );
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
|
||||
if( te instanceof IGridHost )
|
||||
{
|
||||
@@ -201,9 +201,9 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
|
||||
@Override
|
||||
public boolean canWrench(
|
||||
ItemStack wrench,
|
||||
EntityPlayer player,
|
||||
BlockPos pos )
|
||||
final ItemStack wrench,
|
||||
final EntityPlayer player,
|
||||
final BlockPos pos )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ToolChargedStaff extends AEBasePoweredItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity( ItemStack item, EntityLivingBase target, EntityLivingBase hitter )
|
||||
public boolean hitEntity( final ItemStack item, final EntityLivingBase target, final EntityLivingBase hitter )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 300 )
|
||||
{
|
||||
@@ -56,9 +56,9 @@ public class ToolChargedStaff extends AEBasePoweredItem
|
||||
for( int x = 0; x < 2; x++ )
|
||||
{
|
||||
final AxisAlignedBB entityBoundingBox = target.getEntityBoundingBox();
|
||||
float dx = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minX );
|
||||
float dy = (float) ( Platform.getRandomFloat() * target.height + entityBoundingBox.minY );
|
||||
float dz = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minZ );
|
||||
final float dx = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minX );
|
||||
final float dy = (float) ( Platform.getRandomFloat() * target.height + entityBoundingBox.minY );
|
||||
final float dz = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minZ );
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
static
|
||||
{
|
||||
|
||||
for( AEColor col : AEColor.values() )
|
||||
for( final AEColor col : AEColor.values() )
|
||||
{
|
||||
if( col == AEColor.Transparent )
|
||||
{
|
||||
@@ -123,23 +123,23 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack is,
|
||||
EntityPlayer p,
|
||||
World w,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
final ItemStack is,
|
||||
final EntityPlayer p,
|
||||
final World w,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
Block blk = w.getBlockState( pos ).getBlock();
|
||||
final Block blk = w.getBlockState( pos ).getBlock();
|
||||
|
||||
ItemStack paintBall = this.getColor( is );
|
||||
|
||||
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
if( inv != null )
|
||||
{
|
||||
IAEItemStack option = inv.extractItems( AEItemStack.create( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
|
||||
final IAEItemStack option = inv.extractItems( AEItemStack.create( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
|
||||
|
||||
if( option != null )
|
||||
{
|
||||
@@ -156,10 +156,10 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
return false;
|
||||
}
|
||||
|
||||
double powerPerUse = 100;
|
||||
final double powerPerUse = 100;
|
||||
if( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( pos );
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
// clean cables.
|
||||
if( te instanceof IColorableTile )
|
||||
{
|
||||
@@ -175,8 +175,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
// clean paint balls..
|
||||
Block testBlk = w.getBlockState( pos.offset( side ) ).getBlock();
|
||||
TileEntity painted = w.getTileEntity( pos.offset( side ) );
|
||||
final Block testBlk = w.getBlockState( pos.offset( side ) ).getBlock();
|
||||
final TileEntity painted = w.getTileEntity( pos.offset( side ) );
|
||||
if( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
|
||||
{
|
||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
@@ -187,7 +187,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
else if( paintBall != null )
|
||||
{
|
||||
AEColor color = this.getColorFromItem( paintBall );
|
||||
final AEColor color = this.getColorFromItem( paintBall );
|
||||
|
||||
if( color != null && this.getAECurrentPower( is ) > powerPerUse )
|
||||
{
|
||||
@@ -210,11 +210,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName( ItemStack par1ItemStack )
|
||||
public String getItemStackDisplayName( final ItemStack par1ItemStack )
|
||||
{
|
||||
String extra = GuiText.Empty.getLocal();
|
||||
|
||||
AEColor selected = this.getActiveColor( par1ItemStack );
|
||||
final AEColor selected = this.getActiveColor( par1ItemStack );
|
||||
|
||||
if( selected != null && Platform.isClient() )
|
||||
{
|
||||
@@ -224,12 +224,12 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
|
||||
}
|
||||
|
||||
public AEColor getActiveColor( ItemStack tol )
|
||||
public AEColor getActiveColor( final ItemStack tol )
|
||||
{
|
||||
return this.getColorFromItem( this.getColor( tol ) );
|
||||
}
|
||||
|
||||
public AEColor getColorFromItem( ItemStack paintBall )
|
||||
public AEColor getColorFromItem( final ItemStack paintBall )
|
||||
{
|
||||
if( paintBall == null )
|
||||
{
|
||||
@@ -243,14 +243,14 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
if( paintBall.getItem() instanceof ItemPaintBall )
|
||||
{
|
||||
ItemPaintBall ipb = (ItemPaintBall) paintBall.getItem();
|
||||
final ItemPaintBall ipb = (ItemPaintBall) paintBall.getItem();
|
||||
return ipb.getColor( paintBall );
|
||||
}
|
||||
else
|
||||
{
|
||||
int[] id = OreDictionary.getOreIDs( paintBall );
|
||||
final int[] id = OreDictionary.getOreIDs( paintBall );
|
||||
|
||||
for( int oreID : id )
|
||||
for( final int oreID : id )
|
||||
{
|
||||
if( ORE_TO_COLOR.containsKey( oreID ) )
|
||||
{
|
||||
@@ -262,13 +262,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getColor( ItemStack is )
|
||||
public ItemStack getColor( final ItemStack is )
|
||||
{
|
||||
NBTTagCompound c = is.getTagCompound();
|
||||
final NBTTagCompound c = is.getTagCompound();
|
||||
if( c != null && c.hasKey( "color" ) )
|
||||
{
|
||||
NBTTagCompound color = c.getCompoundTag( "color" );
|
||||
ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
|
||||
final NBTTagCompound color = c.getCompoundTag( "color" );
|
||||
final ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
|
||||
if( oldColor != null )
|
||||
{
|
||||
return oldColor;
|
||||
@@ -278,17 +278,17 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
return this.findNextColor( is, null, 0 );
|
||||
}
|
||||
|
||||
private ItemStack findNextColor( ItemStack is, ItemStack anchor, int scrollOffset )
|
||||
private ItemStack findNextColor( final ItemStack is, final ItemStack anchor, final int scrollOffset )
|
||||
{
|
||||
ItemStack newColor = null;
|
||||
|
||||
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
if( inv != null )
|
||||
{
|
||||
IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
final IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
if( anchor == null )
|
||||
{
|
||||
IAEItemStack firstItem = itemList.getFirstItem();
|
||||
final IAEItemStack firstItem = itemList.getFirstItem();
|
||||
if( firstItem != null )
|
||||
{
|
||||
newColor = firstItem.getItemStack();
|
||||
@@ -296,9 +296,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>();
|
||||
final LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>();
|
||||
|
||||
for( IAEItemStack i : itemList )
|
||||
for( final IAEItemStack i : itemList )
|
||||
{
|
||||
list.add( i );
|
||||
}
|
||||
@@ -307,7 +307,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare( IAEItemStack a, IAEItemStack b )
|
||||
public int compare( final IAEItemStack a, final IAEItemStack b )
|
||||
{
|
||||
return ItemSorters.compareInt( a.getItemDamage(), b.getItemDamage() );
|
||||
}
|
||||
@@ -350,28 +350,28 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
return newColor;
|
||||
}
|
||||
|
||||
public void setColor( ItemStack is, ItemStack newColor )
|
||||
public void setColor( final ItemStack is, final ItemStack newColor )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( is );
|
||||
final NBTTagCompound data = Platform.openNbtData( is );
|
||||
if( newColor == null )
|
||||
{
|
||||
data.removeTag( "color" );
|
||||
}
|
||||
else
|
||||
{
|
||||
NBTTagCompound color = new NBTTagCompound();
|
||||
final NBTTagCompound color = new NBTTagCompound();
|
||||
newColor.writeToNBT( color );
|
||||
data.setTag( "color", color );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean recolourBlock( Block blk, EnumFacing side, World w, BlockPos pos, EnumFacing orientation, AEColor newColor, EntityPlayer p )
|
||||
private boolean recolourBlock( final Block blk, final EnumFacing side, final World w, final BlockPos pos, final EnumFacing orientation, final AEColor newColor, final EntityPlayer p )
|
||||
{
|
||||
IBlockState state = w.getBlockState( pos );
|
||||
final IBlockState state = w.getBlockState( pos );
|
||||
|
||||
if( blk instanceof BlockColored )
|
||||
{
|
||||
EnumDyeColor color = ( EnumDyeColor ) state.getValue( BlockColored.COLOR );
|
||||
final EnumDyeColor color = ( EnumDyeColor ) state.getValue( BlockColored.COLOR );
|
||||
|
||||
if( newColor.dye == color )
|
||||
{
|
||||
@@ -388,7 +388,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
if( blk == Blocks.stained_glass )
|
||||
{
|
||||
EnumDyeColor color = ( EnumDyeColor ) state.getValue( BlockStainedGlass.COLOR );
|
||||
final EnumDyeColor color = ( EnumDyeColor ) state.getValue( BlockStainedGlass.COLOR );
|
||||
|
||||
if( newColor.dye == color )
|
||||
{
|
||||
@@ -405,7 +405,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
if( blk == Blocks.stained_glass_pane )
|
||||
{
|
||||
EnumDyeColor color = ( EnumDyeColor ) state.getValue( BlockStainedGlassPane.COLOR );
|
||||
final EnumDyeColor color = ( EnumDyeColor ) state.getValue( BlockStainedGlassPane.COLOR );
|
||||
|
||||
if( newColor.dye == color )
|
||||
{
|
||||
@@ -428,7 +428,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
return blk.recolorBlock( w, pos, side, newColor.dye );
|
||||
}
|
||||
|
||||
public void cycleColors( ItemStack is, ItemStack paintBall, int i )
|
||||
public void cycleColors( final ItemStack is, final ItemStack paintBall, final int i )
|
||||
{
|
||||
if( paintBall == null )
|
||||
{
|
||||
@@ -441,15 +441,15 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
final ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
if( cd != null )
|
||||
{
|
||||
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
|
||||
@@ -459,31 +459,31 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes( ItemStack cellItem )
|
||||
public int getBytes( final ItemStack cellItem )
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType( ItemStack cellItem )
|
||||
public int getBytesPerType( final ItemStack cellItem )
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes( ItemStack cellItem )
|
||||
public int getTotalTypes( final ItemStack cellItem )
|
||||
{
|
||||
return 27;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
|
||||
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
|
||||
{
|
||||
if( requestedAddition != null )
|
||||
{
|
||||
int[] id = OreDictionary.getOreIDs( requestedAddition.getItemStack() );
|
||||
final int[] id = OreDictionary.getOreIDs( requestedAddition.getItemStack() );
|
||||
|
||||
for( int x : id )
|
||||
for( final int x : id )
|
||||
{
|
||||
if( ORE_TO_COLOR.containsKey( x ) )
|
||||
{
|
||||
@@ -508,7 +508,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell( ItemStack i )
|
||||
public boolean isStorageCell( final ItemStack i )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -520,51 +520,51 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
{
|
||||
return GuiText.StorageCells.getUnlocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable( ItemStack is )
|
||||
public boolean isEditable( final ItemStack is )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory( ItemStack is )
|
||||
public IInventory getUpgradesInventory( final ItemStack is )
|
||||
{
|
||||
return new CellUpgrades( is, 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory( ItemStack is )
|
||||
public IInventory getConfigInventory( final ItemStack is )
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( ItemStack is )
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWheel( ItemStack is, boolean up )
|
||||
public void onWheel( final ItemStack is, final boolean up )
|
||||
{
|
||||
this.cycleColors( is, this.getColor( is ), up ? 1 : -1 );
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.flowing_lava, true ), new InWorldToolOperationResult( new ItemStack( Blocks.obsidian ) ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.grass, true ), new InWorldToolOperationResult( new ItemStack( Blocks.dirt ) ) );
|
||||
|
||||
List<ItemStack> snowBalls = new ArrayList<ItemStack>();
|
||||
final List<ItemStack> snowBalls = new ArrayList<ItemStack>();
|
||||
snowBalls.add( new ItemStack( Items.snowball ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.flowing_water, true ), new InWorldToolOperationResult( null, snowBalls ) );
|
||||
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.water, true ), new InWorldToolOperationResult( new ItemStack( Blocks.ice ) ) );
|
||||
@@ -98,15 +98,15 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
private final IBlockState state;
|
||||
private boolean blockOnly;
|
||||
|
||||
public InWorldToolOperationIngredient( IBlockState state )
|
||||
public InWorldToolOperationIngredient( final IBlockState state )
|
||||
{
|
||||
this.state = state;
|
||||
blockOnly = false;
|
||||
}
|
||||
|
||||
public InWorldToolOperationIngredient(
|
||||
Block blk,
|
||||
boolean b )
|
||||
final Block blk,
|
||||
final boolean b )
|
||||
{
|
||||
state = blk.getDefaultState();
|
||||
blockOnly = b;
|
||||
@@ -119,7 +119,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
public boolean equals( final Object obj )
|
||||
{
|
||||
if( obj == null )
|
||||
{
|
||||
@@ -129,12 +129,12 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
|
||||
final InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
|
||||
return state == other.state && ( blockOnly && state.getBlock() == other.state.getBlock() );
|
||||
}
|
||||
}
|
||||
|
||||
private void heat( IBlockState state, World w, BlockPos pos )
|
||||
private void heat( final IBlockState state, final World w, final BlockPos pos )
|
||||
{
|
||||
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( state ) );
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
if( r.BlockItem != null )
|
||||
{
|
||||
Block blk = Block.getBlockFromItem( r.BlockItem.getItem() );
|
||||
final Block blk = Block.getBlockFromItem( r.BlockItem.getItem() );
|
||||
w.setBlockState( pos, blk.getStateFromMeta( r.BlockItem.getItemDamage() ), 3 );
|
||||
}
|
||||
else
|
||||
@@ -159,7 +159,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canHeat( IBlockState state )
|
||||
private boolean canHeat( final IBlockState state )
|
||||
{
|
||||
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( state ) );
|
||||
|
||||
@@ -171,7 +171,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
return r != null;
|
||||
}
|
||||
|
||||
private void cool( IBlockState state, World w, BlockPos pos )
|
||||
private void cool( final IBlockState state, final World w, final BlockPos pos )
|
||||
{
|
||||
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( state ) );
|
||||
|
||||
@@ -182,7 +182,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
if( r.BlockItem != null )
|
||||
{
|
||||
Block blk = Block.getBlockFromItem( r.BlockItem.getItem() );
|
||||
final Block blk = Block.getBlockFromItem( r.BlockItem.getItem() );
|
||||
w.setBlockState( pos, blk.getStateFromMeta( r.BlockItem.getItemDamage() ), 3 );
|
||||
}
|
||||
else
|
||||
@@ -196,7 +196,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canCool( IBlockState state )
|
||||
private boolean canCool( final IBlockState state )
|
||||
{
|
||||
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( state ) );
|
||||
|
||||
@@ -209,7 +209,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity( ItemStack item, EntityLivingBase target, EntityLivingBase hitter )
|
||||
public boolean hitEntity( final ItemStack item, final EntityLivingBase target, final EntityLivingBase hitter )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
@@ -221,9 +221,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer p )
|
||||
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer p )
|
||||
{
|
||||
MovingObjectPosition target = this.getMovingObjectPositionFromPlayer( w, p, true );
|
||||
final MovingObjectPosition target = this.getMovingObjectPositionFromPlayer( w, p, true );
|
||||
|
||||
if( target == null )
|
||||
{
|
||||
@@ -248,14 +248,14 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack item,
|
||||
EntityPlayer p,
|
||||
World w,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
final ItemStack item,
|
||||
final EntityPlayer p,
|
||||
final World w,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
@@ -264,8 +264,8 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
return false;
|
||||
}
|
||||
|
||||
IBlockState state = w.getBlockState( pos );
|
||||
Block blockID = state.getBlock();
|
||||
final IBlockState state = w.getBlockState( pos );
|
||||
final Block blockID = state.getBlock();
|
||||
|
||||
if( p.isSneaking() )
|
||||
{
|
||||
@@ -299,14 +299,14 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack[] stack = Platform.getBlockDrops( w, pos );
|
||||
List<ItemStack> out = new ArrayList<ItemStack>();
|
||||
final ItemStack[] stack = Platform.getBlockDrops( w, pos );
|
||||
final List<ItemStack> out = new ArrayList<ItemStack>();
|
||||
boolean hasFurnaceable = false;
|
||||
boolean canFurnaceable = true;
|
||||
|
||||
for( ItemStack i : stack )
|
||||
for( final ItemStack i : stack )
|
||||
{
|
||||
ItemStack result = FurnaceRecipes.instance().getSmeltingResult( i );
|
||||
final ItemStack result = FurnaceRecipes.instance().getSmeltingResult( i );
|
||||
|
||||
if( result != null )
|
||||
{
|
||||
@@ -330,7 +330,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
if( hasFurnaceable && canFurnaceable )
|
||||
{
|
||||
this.extractAEPower( item, 1600 );
|
||||
InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
|
||||
final InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
|
||||
w.playSoundEffect( pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
|
||||
|
||||
if( or.BlockItem == null )
|
||||
@@ -339,7 +339,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
else
|
||||
{
|
||||
Block blk = Block.getBlockFromItem( or.BlockItem.getItem() );
|
||||
final Block blk = Block.getBlockFromItem( or.BlockItem.getItem() );
|
||||
w.setBlockState( pos, blk.getStateFromMeta( or.BlockItem.getItemDamage() ), 3 );
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockPos offsetPos = pos.offset( side );
|
||||
final BlockPos offsetPos = pos.offset( side );
|
||||
|
||||
if( !p.canPlayerEdit( offsetPos, side, item ) )
|
||||
{
|
||||
|
||||
@@ -96,15 +96,15 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
final ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
if( cd != null )
|
||||
{
|
||||
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
|
||||
@@ -114,22 +114,22 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer p )
|
||||
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer p )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
int shots = 1;
|
||||
|
||||
CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
|
||||
final 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 );
|
||||
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
|
||||
if( inv != null )
|
||||
{
|
||||
IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
IAEStack aeAmmo = itemList.getFirstItem();
|
||||
if( aeAmmo instanceof IAEItemStack )
|
||||
{
|
||||
@@ -144,7 +144,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
aeAmmo.setStackSize( 1 );
|
||||
ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
if( ammo == null )
|
||||
{
|
||||
return item;
|
||||
@@ -157,21 +157,21 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
return item;
|
||||
}
|
||||
|
||||
LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
|
||||
final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
|
||||
|
||||
Vec3 vec3 = dir.a;
|
||||
Vec3 vec31 = dir.b;
|
||||
Vec3 direction = vec31.subtract( vec3 );
|
||||
final Vec3 vec3 = dir.a;
|
||||
final Vec3 vec31 = dir.b;
|
||||
final Vec3 direction = vec31.subtract( vec3 );
|
||||
direction.normalize();
|
||||
|
||||
double d0 = vec3.xCoord;
|
||||
double d1 = vec3.yCoord;
|
||||
double d2 = vec3.zCoord;
|
||||
final double d0 = vec3.xCoord;
|
||||
final double d1 = vec3.yCoord;
|
||||
final double d2 = vec3.zCoord;
|
||||
|
||||
float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
|
||||
final float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
|
||||
if( penetration <= 0 )
|
||||
{
|
||||
ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
final ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
if( type.getItem() instanceof ItemPaintBall )
|
||||
{
|
||||
this.shootPaintBalls( type, w, p, vec3, vec31, direction, d0, d1, d2 );
|
||||
@@ -197,17 +197,17 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
return item;
|
||||
}
|
||||
|
||||
private void shootPaintBalls( ItemStack type, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
|
||||
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3 vec3, final Vec3 vec31, final Vec3 direction, final double d0, final double d1, final double d2 )
|
||||
{
|
||||
AxisAlignedBB bb = AxisAlignedBB.fromBounds( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
|
||||
final AxisAlignedBB bb = AxisAlignedBB.fromBounds( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
|
||||
|
||||
Entity entity = null;
|
||||
List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
|
||||
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
|
||||
double closest = 9999999.0D;
|
||||
|
||||
for( int l = 0; l < list.size(); ++l )
|
||||
{
|
||||
Entity entity1 = (Entity) list.get( l );
|
||||
final Entity entity1 = (Entity) list.get( l );
|
||||
|
||||
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
{
|
||||
@@ -219,14 +219,14 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
continue;
|
||||
}
|
||||
|
||||
float f1 = 0.3F;
|
||||
final float f1 = 0.3F;
|
||||
|
||||
AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().expand( f1, f1, f1 );
|
||||
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
|
||||
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().expand( f1, f1, f1 );
|
||||
final MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
|
||||
|
||||
if( movingObjectPosition != null )
|
||||
{
|
||||
double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
|
||||
final double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
|
||||
|
||||
if( nd < closest )
|
||||
{
|
||||
@@ -240,7 +240,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, false );
|
||||
|
||||
Vec3 vec = new Vec3( d0, d1, d2 );
|
||||
final Vec3 vec = new Vec3( d0, d1, d2 );
|
||||
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
|
||||
{
|
||||
pos = new MovingObjectPosition( entity );
|
||||
@@ -254,27 +254,27 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
{
|
||||
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
|
||||
}
|
||||
catch( Exception err )
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
}
|
||||
|
||||
if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
|
||||
{
|
||||
ItemPaintBall ipb = (ItemPaintBall) type.getItem();
|
||||
final ItemPaintBall ipb = (ItemPaintBall) type.getItem();
|
||||
|
||||
AEColor col = ipb.getColor( type );
|
||||
final AEColor col = ipb.getColor( type );
|
||||
// boolean lit = ipb.isLumen( type );
|
||||
|
||||
if( pos.typeOfHit == MovingObjectType.ENTITY )
|
||||
{
|
||||
int id = pos.entityHit.getEntityId();
|
||||
PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
|
||||
final int id = pos.entityHit.getEntityId();
|
||||
final PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
|
||||
TickHandler.INSTANCE.getPlayerColors().put( id, marker );
|
||||
|
||||
if( pos.entityHit instanceof EntitySheep )
|
||||
{
|
||||
EntitySheep sh = (EntitySheep) pos.entityHit;
|
||||
final EntitySheep sh = (EntitySheep) pos.entityHit;
|
||||
sh.setFleeceColor( col.dye );
|
||||
}
|
||||
|
||||
@@ -283,49 +283,49 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
else if( pos.typeOfHit == MovingObjectType.BLOCK )
|
||||
{
|
||||
EnumFacing side = pos.sideHit;
|
||||
BlockPos hitPos = pos.getBlockPos().offset( side );
|
||||
final EnumFacing side = pos.sideHit;
|
||||
final BlockPos hitPos = pos.getBlockPos().offset( side );
|
||||
|
||||
if( !Platform.hasPermissions( new DimensionalCoord( w, hitPos ), p ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Block whatsThere = w.getBlockState( hitPos ).getBlock();
|
||||
final Block whatsThere = w.getBlockState( hitPos ).getBlock();
|
||||
if( whatsThere.isReplaceable( w, hitPos ) && w.isAirBlock( hitPos ) )
|
||||
{
|
||||
for( Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
|
||||
for( final Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
|
||||
{
|
||||
w.setBlockState( hitPos, paintBlock.getDefaultState(), 3 );
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = w.getTileEntity( hitPos );
|
||||
final TileEntity te = w.getTileEntity( hitPos );
|
||||
if( te instanceof TilePaint )
|
||||
{
|
||||
Vec3 hp = pos.hitVec.subtract( hitPos.getX(), hitPos.getY(), hitPos.getZ() );
|
||||
final Vec3 hp = pos.hitVec.subtract( hitPos.getX(), hitPos.getY(), hitPos.getZ() );
|
||||
( (TilePaint) te ).addBlot( type, side.getOpposite(), hp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void standardAmmo( float penetration, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
|
||||
private void standardAmmo( float penetration, final World w, final EntityPlayer p, final Vec3 vec3, final Vec3 vec31, final Vec3 direction, final double d0, final double d1, final double d2 )
|
||||
{
|
||||
boolean hasDestroyed = true;
|
||||
while( penetration > 0 && hasDestroyed )
|
||||
{
|
||||
hasDestroyed = false;
|
||||
|
||||
AxisAlignedBB bb = AxisAlignedBB.fromBounds( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
|
||||
final AxisAlignedBB bb = AxisAlignedBB.fromBounds( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
|
||||
|
||||
Entity entity = null;
|
||||
List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
|
||||
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
|
||||
double closest = 9999999.0D;
|
||||
|
||||
for( int l = 0; l < list.size(); ++l )
|
||||
{
|
||||
Entity entity1 = (Entity) list.get( l );
|
||||
final Entity entity1 = (Entity) list.get( l );
|
||||
|
||||
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
{
|
||||
@@ -337,14 +337,14 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
continue;
|
||||
}
|
||||
|
||||
float f1 = 0.3F;
|
||||
final float f1 = 0.3F;
|
||||
|
||||
AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().expand( f1, f1, f1 );
|
||||
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
|
||||
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().expand( f1, f1, f1 );
|
||||
final MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
|
||||
|
||||
if( movingObjectPosition != null )
|
||||
{
|
||||
double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
|
||||
final double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
|
||||
|
||||
if( nd < closest )
|
||||
{
|
||||
@@ -356,7 +356,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
}
|
||||
|
||||
Vec3 vec = new Vec3( d0, d1, d2 );
|
||||
final Vec3 vec = new Vec3( d0, d1, d2 );
|
||||
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, true );
|
||||
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
|
||||
{
|
||||
@@ -371,22 +371,22 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
{
|
||||
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
|
||||
}
|
||||
catch( Exception err )
|
||||
catch( final Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
}
|
||||
|
||||
if( pos != null )
|
||||
{
|
||||
DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
|
||||
final DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
|
||||
dmgSrc.damageType = "masscannon";
|
||||
|
||||
if( pos.typeOfHit == MovingObjectType.ENTITY )
|
||||
{
|
||||
int dmg = (int) Math.ceil( penetration / 20.0f );
|
||||
final int dmg = (int) Math.ceil( penetration / 20.0f );
|
||||
if( pos.entityHit instanceof EntityLivingBase )
|
||||
{
|
||||
EntityLivingBase el = (EntityLivingBase) pos.entityHit;
|
||||
final EntityLivingBase el = (EntityLivingBase) pos.entityHit;
|
||||
penetration -= dmg;
|
||||
el.knockBack( p, 0, -direction.xCoord, -direction.zCoord );
|
||||
// el.knockBack( p, 0, vec3.xCoord,
|
||||
@@ -415,11 +415,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
else
|
||||
{
|
||||
Block b = w.getBlockState( pos.getBlockPos() ).getBlock();
|
||||
final Block b = w.getBlockState( pos.getBlockPos() ).getBlock();
|
||||
// int meta = w.getBlockMetadata(
|
||||
// pos.blockX, pos.blockY, pos.blockZ );
|
||||
|
||||
float hardness = b.getBlockHardness( w, pos.getBlockPos() ) * 9.0f;
|
||||
final float hardness = b.getBlockHardness( w, pos.getBlockPos() ) * 9.0f;
|
||||
if( hardness >= 0.0 )
|
||||
{
|
||||
if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.getBlockPos() ), p ) )
|
||||
@@ -437,65 +437,65 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable( ItemStack is )
|
||||
public boolean isEditable( final ItemStack is )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory( ItemStack is )
|
||||
public IInventory getUpgradesInventory( final ItemStack is )
|
||||
{
|
||||
return new CellUpgrades( is, 4 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory( ItemStack is )
|
||||
public IInventory getConfigInventory( final ItemStack is )
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( ItemStack is )
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes( ItemStack cellItem )
|
||||
public int getBytes( final ItemStack cellItem )
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType( ItemStack cellItem )
|
||||
public int getBytesPerType( final ItemStack cellItem )
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes( ItemStack cellItem )
|
||||
public int getTotalTypes( final ItemStack cellItem )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
|
||||
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
|
||||
{
|
||||
float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
|
||||
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
|
||||
if( pen > 0 )
|
||||
{
|
||||
return false;
|
||||
@@ -516,7 +516,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell( ItemStack i )
|
||||
public boolean isStorageCell( final ItemStack i )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer player )
|
||||
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer player )
|
||||
{
|
||||
Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
|
||||
return item;
|
||||
@@ -80,15 +80,15 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
final ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
if( cd != null )
|
||||
{
|
||||
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
|
||||
@@ -98,25 +98,25 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes( ItemStack cellItem )
|
||||
public int getBytes( final ItemStack cellItem )
|
||||
{
|
||||
return 512;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType( ItemStack cellItem )
|
||||
public int getBytesPerType( final ItemStack cellItem )
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes( ItemStack cellItem )
|
||||
public int getTotalTypes( final ItemStack cellItem )
|
||||
{
|
||||
return 27;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
|
||||
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell( ItemStack i )
|
||||
public boolean isStorageCell( final ItemStack i )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -140,51 +140,51 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
|
||||
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
|
||||
{
|
||||
return GuiText.StorageCells.getUnlocalized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable( ItemStack is )
|
||||
public boolean isEditable( final ItemStack is )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory( ItemStack is )
|
||||
public IInventory getUpgradesInventory( final ItemStack is )
|
||||
{
|
||||
return new CellUpgrades( is, 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory( ItemStack is )
|
||||
public IInventory getConfigInventory( final ItemStack is )
|
||||
{
|
||||
return new CellConfig( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode( ItemStack is )
|
||||
public FuzzyMode getFuzzyMode( final ItemStack is )
|
||||
{
|
||||
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||
try
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
|
||||
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
|
||||
{
|
||||
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject( ItemStack is, World w, BlockPos pos )
|
||||
public IGuiItemObject getGuiObject( final ItemStack is, final World w, final BlockPos pos )
|
||||
{
|
||||
return new PortableCellViewer( is, pos.getX() );
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer player )
|
||||
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer player )
|
||||
{
|
||||
AEApi.instance().registries().wireless().openWirelessTerminalGui( item, w, player );
|
||||
return item;
|
||||
@@ -71,16 +71,16 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||
|
||||
if( stack.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( stack );
|
||||
final NBTTagCompound tag = Platform.openNbtData( stack );
|
||||
if( tag != null )
|
||||
{
|
||||
String encKey = tag.getString( "encryptionKey" );
|
||||
final String encKey = tag.getString( "encryptionKey" );
|
||||
|
||||
if( encKey == null || encKey.isEmpty() )
|
||||
{
|
||||
@@ -99,19 +99,19 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle( ItemStack is )
|
||||
public boolean canHandle( final ItemStack is )
|
||||
{
|
||||
return AEApi.instance().definitions().items().wirelessTerminal().isSameAs( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usePower( EntityPlayer player, double amount, ItemStack is )
|
||||
public boolean usePower( final EntityPlayer player, final double amount, final ItemStack is )
|
||||
{
|
||||
return this.extractAEPower( is, amount ) >= amount - 0.5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPower( EntityPlayer player, double amt, ItemStack is )
|
||||
public boolean hasPower( final EntityPlayer player, final double amt, final ItemStack is )
|
||||
{
|
||||
return this.getAECurrentPower( is ) >= amt;
|
||||
}
|
||||
@@ -123,9 +123,9 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
{
|
||||
|
||||
@Override
|
||||
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( target );
|
||||
final NBTTagCompound data = Platform.openNbtData( target );
|
||||
manager.writeToNBT( data );
|
||||
}
|
||||
} );
|
||||
@@ -139,16 +139,16 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEncryptionKey( ItemStack item )
|
||||
public String getEncryptionKey( final ItemStack item )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( item );
|
||||
final NBTTagCompound tag = Platform.openNbtData( item );
|
||||
return tag.getString( "encryptionKey" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncryptionKey( ItemStack item, String encKey, String name )
|
||||
public void setEncryptionKey( final ItemStack item, final String encKey, final String name )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( item );
|
||||
final NBTTagCompound tag = Platform.openNbtData( item );
|
||||
tag.setString( "encryptionKey", encKey );
|
||||
tag.setString( "name", name );
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.google.common.base.Optional;
|
||||
|
||||
public abstract class AEBasePoweredItem extends AERootPoweredItem
|
||||
{
|
||||
public AEBasePoweredItem( double powerCapacity, Optional<String> subName )
|
||||
public AEBasePoweredItem( final double powerCapacity, final Optional<String> subName )
|
||||
{
|
||||
super( powerCapacity, subName );
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
private static final String POWER_NBT_KEY = "internalCurrentPower";
|
||||
private final double powerCapacity;
|
||||
|
||||
public AERootPoweredItem( double powerCapacity, Optional<String> subName )
|
||||
public AERootPoweredItem( final double powerCapacity, final Optional<String> subName )
|
||||
{
|
||||
super( subName );
|
||||
this.setMaxDamage( 32 );
|
||||
@@ -53,18 +53,18 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
|
||||
{
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
final NBTTagCompound tag = stack.getTagCompound();
|
||||
double internalCurrentPower = 0;
|
||||
double internalMaxPower = this.getAEMaxPower( stack );
|
||||
final double internalMaxPower = this.getAEMaxPower( stack );
|
||||
|
||||
if( tag != null )
|
||||
{
|
||||
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
|
||||
}
|
||||
|
||||
double percent = internalCurrentPower / internalMaxPower;
|
||||
final double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
|
||||
{
|
||||
super.getCheckedSubItems( sameItem, creativeTab, itemStacks );
|
||||
|
||||
@@ -95,29 +95,29 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDurabilityForDisplay( ItemStack is )
|
||||
public double getDurabilityForDisplay( final ItemStack is )
|
||||
{
|
||||
return 1 - this.getAECurrentPower( is ) / this.getAEMaxPower( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamaged( ItemStack stack )
|
||||
public boolean isDamaged( final ItemStack stack )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage( ItemStack stack, int damage )
|
||||
public void setDamage( final ItemStack stack, final int damage )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private double getInternalBattery( ItemStack is, batteryOperation op, double adjustment )
|
||||
private double getInternalBattery( final ItemStack is, final batteryOperation op, final double adjustment )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( is );
|
||||
final NBTTagCompound data = Platform.openNbtData( is );
|
||||
|
||||
double currentStorage = data.getDouble( POWER_NBT_KEY );
|
||||
double maxStorage = this.getAEMaxPower( is );
|
||||
final double maxStorage = this.getAEMaxPower( is );
|
||||
|
||||
switch( op )
|
||||
{
|
||||
@@ -125,7 +125,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
currentStorage += adjustment;
|
||||
if( currentStorage > maxStorage )
|
||||
{
|
||||
double diff = currentStorage - maxStorage;
|
||||
final double diff = currentStorage - maxStorage;
|
||||
data.setDouble( POWER_NBT_KEY, maxStorage );
|
||||
return diff;
|
||||
}
|
||||
@@ -150,11 +150,11 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
/**
|
||||
* inject external
|
||||
*/
|
||||
double injectExternalPower( PowerUnits input, ItemStack is, double amount, boolean simulate )
|
||||
double injectExternalPower( final PowerUnits input, final ItemStack is, final double amount, final boolean simulate )
|
||||
{
|
||||
if( simulate )
|
||||
{
|
||||
int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
|
||||
final int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
|
||||
if( amount < requiredEU )
|
||||
{
|
||||
return 0;
|
||||
@@ -163,37 +163,37 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
}
|
||||
else
|
||||
{
|
||||
double powerRemainder = this.injectAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
final double powerRemainder = this.injectAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
return PowerUnits.AE.convertTo( PowerUnits.EU, powerRemainder );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectAEPower( ItemStack is, double amt )
|
||||
public double injectAEPower( final ItemStack is, final double amt )
|
||||
{
|
||||
return this.getInternalBattery( is, batteryOperation.INJECT, amt );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower( ItemStack is, double amt )
|
||||
public double extractAEPower( final ItemStack is, final double amt )
|
||||
{
|
||||
return this.getInternalBattery( is, batteryOperation.EXTRACT, amt );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAEMaxPower( ItemStack is )
|
||||
public double getAEMaxPower( final ItemStack is )
|
||||
{
|
||||
return this.powerCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAECurrentPower( ItemStack is )
|
||||
public double getAECurrentPower( final ItemStack is )
|
||||
{
|
||||
return this.getInternalBattery( is, batteryOperation.STORAGE, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessRestriction getPowerFlow( ItemStack is )
|
||||
public AccessRestriction getPowerFlow( final ItemStack is )
|
||||
{
|
||||
return AccessRestriction.WRITE;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ToolQuartzAxe extends ItemAxe implements IAEFeature
|
||||
private final AEFeature type;
|
||||
private final IFeatureHandler feature;
|
||||
|
||||
public ToolQuartzAxe( AEFeature type )
|
||||
public ToolQuartzAxe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.feature = new ItemFeatureHandler( EnumSet.of( this.type = type, AEFeature.QuartzAxe ), this, this, Optional.of( type.name() ) );
|
||||
@@ -56,7 +56,7 @@ public class ToolQuartzAxe extends ItemAxe implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( ItemStack a, ItemStack b )
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
{
|
||||
private final AEFeature type;
|
||||
|
||||
public ToolQuartzCuttingKnife( AEFeature type )
|
||||
public ToolQuartzCuttingKnife( final AEFeature type )
|
||||
{
|
||||
super( Optional.of( type.name() ) );
|
||||
|
||||
@@ -54,14 +54,14 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer p,
|
||||
World worldIn,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
final ItemStack stack,
|
||||
final EntityPlayer p,
|
||||
final World worldIn,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack it, World w, EntityPlayer p )
|
||||
public ItemStack onItemRightClick( final ItemStack it, final World w, final EntityPlayer p )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
@@ -82,7 +82,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( ItemStack a, ItemStack b )
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
@@ -94,20 +94,20 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem( ItemStack itemStack )
|
||||
public ItemStack getContainerItem( final ItemStack itemStack )
|
||||
{
|
||||
itemStack.setItemDamage( itemStack.getItemDamage() + 1 );
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem( ItemStack stack )
|
||||
public boolean hasContainerItem( final ItemStack stack )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject( ItemStack is, World world, BlockPos pos )
|
||||
public IGuiItemObject getGuiObject( final ItemStack is, final World world, final BlockPos pos )
|
||||
{
|
||||
return new QuartzKnifeObj( is );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ToolQuartzHoe extends ItemHoe implements IAEFeature
|
||||
private final AEFeature feature;
|
||||
private final IFeatureHandler handler;
|
||||
|
||||
public ToolQuartzHoe( AEFeature feature )
|
||||
public ToolQuartzHoe( final AEFeature feature )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ToolQuartzHoe extends ItemHoe implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( ItemStack a, ItemStack b )
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.feature, a, b );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ToolQuartzPickaxe extends ItemPickaxe implements IAEFeature
|
||||
private final AEFeature type;
|
||||
private final IFeatureHandler feature;
|
||||
|
||||
public ToolQuartzPickaxe( AEFeature type )
|
||||
public ToolQuartzPickaxe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ToolQuartzPickaxe extends ItemPickaxe implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( ItemStack a, ItemStack b )
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ToolQuartzSpade extends ItemSpade implements IAEFeature
|
||||
private final AEFeature type;
|
||||
private final IFeatureHandler handler;
|
||||
|
||||
public ToolQuartzSpade( AEFeature type )
|
||||
public ToolQuartzSpade( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ToolQuartzSpade extends ItemSpade implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( ItemStack a, ItemStack b )
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ToolQuartzSword extends ItemSword implements IAEFeature
|
||||
private final AEFeature type;
|
||||
private final IFeatureHandler feature;
|
||||
|
||||
public ToolQuartzSword( AEFeature type )
|
||||
public ToolQuartzSword( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.feature = new ItemFeatureHandler( EnumSet.of( this.type = type, AEFeature.QuartzSword ), this, this, Optional.of( type.name() ) );
|
||||
@@ -56,7 +56,7 @@ public class ToolQuartzSword extends ItemSword implements IAEFeature
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( ItemStack a, ItemStack b )
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import com.google.common.base.Optional;
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /*, IToolWrench */
|
||||
{
|
||||
|
||||
public ToolQuartzWrench( AEFeature type )
|
||||
public ToolQuartzWrench( final AEFeature type )
|
||||
{
|
||||
super( Optional.of( type.name() ) );
|
||||
|
||||
@@ -52,16 +52,16 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /*, IToolW
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
final ItemStack stack,
|
||||
final EntityPlayer player,
|
||||
final World world,
|
||||
final BlockPos pos,
|
||||
final EnumFacing side,
|
||||
final float hitX,
|
||||
final float hitY,
|
||||
final float hitZ )
|
||||
{
|
||||
Block b = world.getBlockState( pos ).getBlock();
|
||||
final Block b = world.getBlockState( pos ).getBlock();
|
||||
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
@@ -81,18 +81,18 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /*, IToolW
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse(
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EntityPlayer player )
|
||||
final World world,
|
||||
final BlockPos pos,
|
||||
final EntityPlayer player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench(
|
||||
ItemStack wrench,
|
||||
EntityPlayer player,
|
||||
BlockPos pos )
|
||||
final ItemStack wrench,
|
||||
final EntityPlayer player,
|
||||
final BlockPos pos )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user