Basic reformat, hit once, hope never again
This commit is contained in:
@@ -43,7 +43,7 @@ public abstract class AEBaseItem extends Item implements IAEFeature
|
||||
|
||||
public AEBaseItem()
|
||||
{
|
||||
this( Optional.<String> absent() );
|
||||
this( Optional.<String>absent() );
|
||||
this.setNoRepair();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,17 +18,20 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class CellConfig extends AppEngInternalInventory
|
||||
{
|
||||
|
||||
final ItemStack is;
|
||||
|
||||
public CellConfig(ItemStack is) {
|
||||
public CellConfig( ItemStack is )
|
||||
{
|
||||
super( null, 63 );
|
||||
this.is = is;
|
||||
this.readFromNBT( Platform.openNbtData( is ), "list" );
|
||||
@@ -39,5 +42,4 @@ public class CellConfig extends AppEngInternalInventory
|
||||
{
|
||||
this.writeToNBT( Platform.openNbtData( this.is ), "list" );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -27,6 +28,7 @@ import appeng.api.networking.IGridHost;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class NetworkToolViewer implements INetworkTool
|
||||
{
|
||||
|
||||
@@ -34,11 +36,12 @@ public class NetworkToolViewer implements INetworkTool
|
||||
final ItemStack is;
|
||||
final IGridHost gh;
|
||||
|
||||
public NetworkToolViewer(ItemStack is, IGridHost gHost) {
|
||||
public NetworkToolViewer( ItemStack is, IGridHost gHost )
|
||||
{
|
||||
this.is = is;
|
||||
this.gh = gHost;
|
||||
this.inv = new AppEngInternalInventory( null, 9 );
|
||||
if ( is.hasTagCompound() ) // prevent crash when opening network status screen.
|
||||
if( is.hasTagCompound() ) // prevent crash when opening network status screen.
|
||||
this.inv.readFromNBT( Platform.openNbtData( is ), "inv" );
|
||||
}
|
||||
|
||||
@@ -49,25 +52,25 @@ public class NetworkToolViewer implements INetworkTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i)
|
||||
public ItemStack getStackInSlot( int i )
|
||||
{
|
||||
return this.inv.getStackInSlot( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j)
|
||||
public ItemStack decrStackSize( int i, int j )
|
||||
{
|
||||
return this.inv.decrStackSize( i, j );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i)
|
||||
public ItemStack getStackInSlotOnClosing( int i )
|
||||
{
|
||||
return this.inv.getStackInSlotOnClosing( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack)
|
||||
public void setInventorySlotContents( int i, ItemStack itemstack )
|
||||
{
|
||||
this.inv.setInventorySlotContents( i, itemstack );
|
||||
}
|
||||
@@ -98,7 +101,7 @@ public class NetworkToolViewer implements INetworkTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer)
|
||||
public boolean isUseableByPlayer( EntityPlayer entityplayer )
|
||||
{
|
||||
return this.inv.isUseableByPlayer( entityplayer );
|
||||
}
|
||||
@@ -116,10 +119,9 @@ public class NetworkToolViewer implements INetworkTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
{
|
||||
return this.inv.isItemValidForSlot( i, itemstack ) && itemstack.getItem() instanceof IUpgradeModule
|
||||
&& ((IUpgradeModule) itemstack.getItem()).getType( itemstack ) != null;
|
||||
return this.inv.isItemValidForSlot( i, itemstack ) && itemstack.getItem() instanceof IUpgradeModule && ( (IUpgradeModule) itemstack.getItem() ).getType( itemstack ) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,5 +135,4 @@ public class NetworkToolViewer implements INetworkTool
|
||||
{
|
||||
return this.gh;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -39,13 +40,15 @@ import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell
|
||||
{
|
||||
|
||||
private final ItemStack target;
|
||||
private final IAEItemPowerStorage ips;
|
||||
|
||||
public PortableCellViewer(ItemStack is) {
|
||||
public PortableCellViewer( ItemStack is )
|
||||
{
|
||||
super( CellInventory.getCell( is, null ) );
|
||||
this.ips = (IAEItemPowerStorage) is.getItem();
|
||||
this.target = is;
|
||||
@@ -58,11 +61,11 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier)
|
||||
public double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier )
|
||||
{
|
||||
amt = usePowerMultiplier.multiply( amt );
|
||||
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
if( mode == Actionable.SIMULATE )
|
||||
{
|
||||
return usePowerMultiplier.divide( Math.min( amt, this.ips.getAECurrentPower( this.target ) ) );
|
||||
}
|
||||
@@ -85,10 +88,11 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
final ConfigManager out = new ConfigManager( new IConfigManagerHost() {
|
||||
final ConfigManager out = new ConfigManager( new IConfigManagerHost()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( PortableCellViewer.this.target );
|
||||
manager.writeToNBT( data );
|
||||
@@ -102,5 +106,4 @@ public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implement
|
||||
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( this.target ).copy() );
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,16 +18,19 @@
|
||||
|
||||
package appeng.items.contents;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
|
||||
|
||||
public class QuartzKnifeObj implements IGuiItemObject
|
||||
{
|
||||
|
||||
final ItemStack is;
|
||||
|
||||
public QuartzKnifeObj(ItemStack o) {
|
||||
public QuartzKnifeObj( ItemStack o )
|
||||
{
|
||||
this.is = o;
|
||||
}
|
||||
|
||||
@@ -36,5 +39,4 @@ public class QuartzKnifeObj implements IGuiItemObject
|
||||
{
|
||||
return this.is;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,37 +90,37 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
||||
|
||||
MaterialType mt = this.getTypeByStack( stack );
|
||||
if ( mt == null )
|
||||
if( mt == null )
|
||||
return;
|
||||
|
||||
if ( mt == MaterialType.NamePress )
|
||||
if( mt == MaterialType.NamePress )
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( stack );
|
||||
lines.add( c.getString( "InscribeName" ) );
|
||||
}
|
||||
|
||||
Upgrades u = this.getType( stack );
|
||||
if ( u != null )
|
||||
if( u != null )
|
||||
{
|
||||
List<String> textList = new LinkedList<String>();
|
||||
for ( Entry<ItemStack, Integer> j : u.getSupported().entrySet() )
|
||||
for( Entry<ItemStack, Integer> j : u.getSupported().entrySet() )
|
||||
{
|
||||
String name = null;
|
||||
|
||||
int limit = j.getValue();
|
||||
|
||||
if ( j.getKey().getItem() instanceof IItemGroup )
|
||||
if( j.getKey().getItem() instanceof IItemGroup )
|
||||
{
|
||||
IItemGroup ig = (IItemGroup) j.getKey().getItem();
|
||||
String str = ig.getUnlocalizedGroupName( u.getSupported().keySet(), j.getKey() );
|
||||
if ( str != null )
|
||||
if( str != null )
|
||||
name = Platform.gui_localize( str ) + ( limit > 1 ? " (" + limit + ')' : "" );
|
||||
}
|
||||
|
||||
if ( name == null )
|
||||
if( name == null )
|
||||
name = j.getKey().getDisplayName() + ( limit > 1 ? " (" + limit + ')' : "" );
|
||||
|
||||
if ( !textList.contains( name ) )
|
||||
if( !textList.contains( name ) )
|
||||
textList.add( name );
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
public MaterialType getTypeByStack( ItemStack is )
|
||||
{
|
||||
if ( this.dmgToMaterial.containsKey( is.getItemDamage() ) )
|
||||
if( this.dmgToMaterial.containsKey( is.getItemDamage() ) )
|
||||
return this.dmgToMaterial.get( is.getItemDamage() );
|
||||
return MaterialType.InvalidType;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
@Override
|
||||
public Upgrades getType( ItemStack itemstack )
|
||||
{
|
||||
switch ( this.getTypeByStack( itemstack ) )
|
||||
switch( this.getTypeByStack( itemstack ) )
|
||||
{
|
||||
case CardCapacity:
|
||||
return Upgrades.CAPACITY;
|
||||
@@ -162,13 +162,13 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
public IStackSrc createMaterial( MaterialType mat )
|
||||
{
|
||||
if ( !mat.isRegistered() )
|
||||
if( !mat.isRegistered() )
|
||||
{
|
||||
boolean enabled = true;
|
||||
for ( AEFeature f : mat.getFeature() )
|
||||
for( AEFeature f : mat.getFeature() )
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
|
||||
if ( enabled )
|
||||
if( enabled )
|
||||
{
|
||||
mat.itemInstance = this;
|
||||
int newMaterialNum = mat.damageValue;
|
||||
@@ -176,7 +176,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
mat.stackSrc = new MaterialStackSrc( mat );
|
||||
|
||||
if ( this.dmgToMaterial.get( newMaterialNum ) == null )
|
||||
if( this.dmgToMaterial.get( newMaterialNum ) == null )
|
||||
this.dmgToMaterial.put( newMaterialNum, mat );
|
||||
else
|
||||
throw new RuntimeException( "Meta Overlap detected." );
|
||||
@@ -192,25 +192,25 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
public void makeUnique()
|
||||
{
|
||||
for ( MaterialType mt : ImmutableSet.copyOf( this.dmgToMaterial.values() ) )
|
||||
for( MaterialType mt : ImmutableSet.copyOf( this.dmgToMaterial.values() ) )
|
||||
{
|
||||
if ( mt.getOreName() != null )
|
||||
if( mt.getOreName() != null )
|
||||
{
|
||||
ItemStack replacement = null;
|
||||
|
||||
String[] names = mt.getOreName().split( "," );
|
||||
|
||||
for ( String name : names )
|
||||
for( String name : names )
|
||||
{
|
||||
if ( replacement != null )
|
||||
if( replacement != null )
|
||||
break;
|
||||
|
||||
List<ItemStack> options = OreDictionary.getOres( name );
|
||||
if ( options != null && options.size() > 0 )
|
||||
if( options != null && options.size() > 0 )
|
||||
{
|
||||
for ( ItemStack is : options )
|
||||
for( ItemStack is : options )
|
||||
{
|
||||
if ( is != null && is.getItem() != null )
|
||||
if( is != null && is.getItem() != null )
|
||||
{
|
||||
replacement = is.copy();
|
||||
break;
|
||||
@@ -219,15 +219,15 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
}
|
||||
}
|
||||
|
||||
if ( replacement == null || AEConfig.instance.useAEVersion( mt ) )
|
||||
if( replacement == null || AEConfig.instance.useAEVersion( mt ) )
|
||||
{
|
||||
// continue using the AE2 item.
|
||||
for ( String name : names )
|
||||
for( String name : names )
|
||||
OreDictionary.registerOre( name, mt.stack( 1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mt.itemInstance == this )
|
||||
if( mt.itemInstance == this )
|
||||
this.dmgToMaterial.remove( mt.damageValue );
|
||||
|
||||
mt.itemInstance = replacement.getItem();
|
||||
@@ -240,7 +240,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
@Override
|
||||
public IIcon getIconFromDamage( int dmg )
|
||||
{
|
||||
if ( this.dmgToMaterial.containsKey( dmg ) )
|
||||
if( this.dmgToMaterial.containsKey( dmg ) )
|
||||
return this.dmgToMaterial.get( dmg ).IIcon;
|
||||
return new MissingIcon( this );
|
||||
}
|
||||
@@ -253,11 +253,11 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
private String nameOf( ItemStack is )
|
||||
{
|
||||
if ( is == null )
|
||||
if( is == null )
|
||||
return "null";
|
||||
|
||||
MaterialType mt = this.getTypeByStack( is );
|
||||
if ( mt == null )
|
||||
if( mt == null )
|
||||
return "null";
|
||||
|
||||
return this.nameResolver.getName( mt.name() );
|
||||
@@ -277,9 +277,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
}
|
||||
} );
|
||||
|
||||
for ( MaterialType mat : types )
|
||||
for( MaterialType mat : types )
|
||||
{
|
||||
if ( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this )
|
||||
if( mat.damageValue >= 0 && mat.isRegistered() && mat.itemInstance == this )
|
||||
cList.add( new ItemStack( this, 1, mat.damageValue ) );
|
||||
}
|
||||
}
|
||||
@@ -287,12 +287,12 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
@Override
|
||||
public void registerIcons( IIconRegister icoRegister )
|
||||
{
|
||||
for ( MaterialType mat : MaterialType.values() )
|
||||
for( MaterialType mat : MaterialType.values() )
|
||||
{
|
||||
if ( mat.damageValue != -1 )
|
||||
if( mat.damageValue != -1 )
|
||||
{
|
||||
ItemStack what = new ItemStack( this, 1, mat.damageValue );
|
||||
if ( this.getTypeByStack( what ) != MaterialType.InvalidType )
|
||||
if( this.getTypeByStack( what ) != MaterialType.InvalidType )
|
||||
{
|
||||
String tex = "appliedenergistics2:" + this.nameOf( what );
|
||||
mat.IIcon = icoRegister.registerIcon( tex );
|
||||
@@ -304,31 +304,31 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
@Override
|
||||
public boolean onItemUseFirst( ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
IInventory upgrades = null;
|
||||
|
||||
if ( te instanceof IPartHost )
|
||||
if( te instanceof IPartHost )
|
||||
{
|
||||
SelectedPart sp = ( (IPartHost) te ).selectPart( Vec3.createVectorHelper( hitX, hitY, hitZ ) );
|
||||
if ( sp.part instanceof IUpgradeableHost )
|
||||
if( sp.part instanceof IUpgradeableHost )
|
||||
upgrades = ( (ISegmentedInventory) sp.part ).getInventoryByName( "upgrades" );
|
||||
}
|
||||
else if ( te instanceof IUpgradeableHost )
|
||||
else if( te instanceof IUpgradeableHost )
|
||||
upgrades = ( (ISegmentedInventory) te ).getInventoryByName( "upgrades" );
|
||||
|
||||
if ( upgrades != null && is != null && is.getItem() instanceof IUpgradeModule )
|
||||
if( upgrades != null && is != null && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
IUpgradeModule um = (IUpgradeModule) is.getItem();
|
||||
Upgrades u = um.getType( is );
|
||||
|
||||
if ( u != null )
|
||||
if( u != null )
|
||||
{
|
||||
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( upgrades, ForgeDirection.UNKNOWN );
|
||||
if ( ad != null )
|
||||
if( ad != null )
|
||||
{
|
||||
if ( player.worldObj.isRemote )
|
||||
if( player.worldObj.isRemote )
|
||||
return false;
|
||||
|
||||
player.inventory.setInventorySlotContents( player.inventory.currentItem, ad.addItems( is ) );
|
||||
@@ -357,7 +357,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
{
|
||||
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( Throwable t )
|
||||
{
|
||||
throw new RuntimeException( t );
|
||||
}
|
||||
@@ -366,7 +366,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
eqi.motionY = location.motionY;
|
||||
eqi.motionZ = location.motionZ;
|
||||
|
||||
if ( location instanceof EntityItem && eqi instanceof EntityItem )
|
||||
if( location instanceof EntityItem && eqi instanceof EntityItem )
|
||||
( (EntityItem) eqi ).delayBeforeCanPickup = ( (EntityItem) location ).delayBeforeCanPickup;
|
||||
|
||||
return eqi;
|
||||
@@ -375,7 +375,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
@Override
|
||||
public int getBytes( ItemStack is )
|
||||
{
|
||||
switch ( this.getTypeByStack( is ) )
|
||||
switch( this.getTypeByStack( is ) )
|
||||
{
|
||||
case Cell1kPart:
|
||||
return KILO;
|
||||
@@ -393,7 +393,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
@Override
|
||||
public boolean isStorageComponent( ItemStack is )
|
||||
{
|
||||
switch ( this.getTypeByStack( is ) )
|
||||
switch( this.getTypeByStack( is ) )
|
||||
{
|
||||
case Cell1kPart:
|
||||
case Cell4kPart:
|
||||
@@ -421,14 +421,14 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
||||
{
|
||||
Matcher a = this.pattern.matcher( o1 );
|
||||
Matcher b = this.pattern.matcher( o2 );
|
||||
if ( a.find() && b.find() )
|
||||
if( a.find() && b.find() )
|
||||
{
|
||||
int ia = Integer.parseInt( a.group( 1 ) );
|
||||
int ib = Integer.parseInt( b.group( 1 ) );
|
||||
return Integer.compare( ia, ib );
|
||||
}
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
// ek!
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.items.materials;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -36,82 +37,79 @@ import appeng.entity.EntityChargedQuartz;
|
||||
import appeng.entity.EntityIds;
|
||||
import appeng.entity.EntitySingularity;
|
||||
|
||||
|
||||
public enum MaterialType
|
||||
{
|
||||
InvalidType(-1, AEFeature.Core),
|
||||
InvalidType( -1, AEFeature.Core ),
|
||||
|
||||
CertusQuartzCrystal(0, AEFeature.Core, "crystalCertusQuartz"), CertusQuartzCrystalCharged(1, AEFeature.Core, EntityChargedQuartz.class),
|
||||
CertusQuartzCrystal( 0, AEFeature.Core, "crystalCertusQuartz" ), CertusQuartzCrystalCharged( 1, AEFeature.Core, EntityChargedQuartz.class ),
|
||||
|
||||
CertusQuartzDust(2, AEFeature.Core, "dustCertusQuartz"), NetherQuartzDust(3, AEFeature.Core, "dustNetherQuartz"), Flour(4, AEFeature.Flour, "dustWheat"), GoldDust(
|
||||
51, AEFeature.Core, "dustGold"), IronDust(49, AEFeature.Core, "dustIron"), IronNugget(50, AEFeature.Core, "nuggetIron"),
|
||||
CertusQuartzDust( 2, AEFeature.Core, "dustCertusQuartz" ), NetherQuartzDust( 3, AEFeature.Core, "dustNetherQuartz" ), Flour( 4, AEFeature.Flour, "dustWheat" ), GoldDust( 51, AEFeature.Core, "dustGold" ), IronDust( 49, AEFeature.Core, "dustIron" ), IronNugget( 50, AEFeature.Core, "nuggetIron" ),
|
||||
|
||||
Silicon(5, AEFeature.Core, "itemSilicon"), MatterBall(6),
|
||||
Silicon( 5, AEFeature.Core, "itemSilicon" ), MatterBall( 6 ),
|
||||
|
||||
FluixCrystal(7, AEFeature.Core, "crystalFluix"), FluixDust(8, AEFeature.Core, "dustFluix"), FluixPearl(9, AEFeature.Core, "pearlFluix"),
|
||||
FluixCrystal( 7, AEFeature.Core, "crystalFluix" ), FluixDust( 8, AEFeature.Core, "dustFluix" ), FluixPearl( 9, AEFeature.Core, "pearlFluix" ),
|
||||
|
||||
PurifiedCertusQuartzCrystal(10), PurifiedNetherQuartzCrystal(11), PurifiedFluixCrystal(12),
|
||||
PurifiedCertusQuartzCrystal( 10 ), PurifiedNetherQuartzCrystal( 11 ), PurifiedFluixCrystal( 12 ),
|
||||
|
||||
CalcProcessorPress(13), EngProcessorPress(14), LogicProcessorPress(15),
|
||||
CalcProcessorPress( 13 ), EngProcessorPress( 14 ), LogicProcessorPress( 15 ),
|
||||
|
||||
CalcProcessorPrint(16), EngProcessorPrint(17), LogicProcessorPrint(18),
|
||||
CalcProcessorPrint( 16 ), EngProcessorPrint( 17 ), LogicProcessorPrint( 18 ),
|
||||
|
||||
SiliconPress(19), SiliconPrint(20),
|
||||
SiliconPress( 19 ), SiliconPrint( 20 ),
|
||||
|
||||
NamePress(21),
|
||||
NamePress( 21 ),
|
||||
|
||||
LogicProcessor(22), CalcProcessor(23), EngProcessor(24),
|
||||
LogicProcessor( 22 ), CalcProcessor( 23 ), EngProcessor( 24 ),
|
||||
|
||||
// Basic Cards
|
||||
BasicCard(25), CardRedstone(26), CardCapacity(27),
|
||||
BasicCard( 25 ), CardRedstone( 26 ), CardCapacity( 27 ),
|
||||
|
||||
// Adv Cards
|
||||
AdvCard(28), CardFuzzy(29), CardSpeed(30), CardInverter(31),
|
||||
AdvCard( 28 ), CardFuzzy( 29 ), CardSpeed( 30 ), CardInverter( 31 ),
|
||||
|
||||
Cell2SpatialPart(32, AEFeature.SpatialIO), Cell16SpatialPart(33, AEFeature.SpatialIO), Cell128SpatialPart(34, AEFeature.SpatialIO),
|
||||
Cell2SpatialPart( 32, AEFeature.SpatialIO ), Cell16SpatialPart( 33, AEFeature.SpatialIO ), Cell128SpatialPart( 34, AEFeature.SpatialIO ),
|
||||
|
||||
Cell1kPart(35, AEFeature.StorageCells), Cell4kPart(36, AEFeature.StorageCells), Cell16kPart(37, AEFeature.StorageCells), Cell64kPart(38,
|
||||
AEFeature.StorageCells), EmptyStorageCell(39, AEFeature.StorageCells),
|
||||
Cell1kPart( 35, AEFeature.StorageCells ), Cell4kPart( 36, AEFeature.StorageCells ), Cell16kPart( 37, AEFeature.StorageCells ), Cell64kPart( 38, AEFeature.StorageCells ), EmptyStorageCell( 39, AEFeature.StorageCells ),
|
||||
|
||||
WoodenGear(40, AEFeature.GrindStone, "gearWood"),
|
||||
WoodenGear( 40, AEFeature.GrindStone, "gearWood" ),
|
||||
|
||||
Wireless(41, AEFeature.WirelessAccessTerminal), WirelessBooster(42, AEFeature.WirelessAccessTerminal),
|
||||
Wireless( 41, AEFeature.WirelessAccessTerminal ), WirelessBooster( 42, AEFeature.WirelessAccessTerminal ),
|
||||
|
||||
FormationCore(43), AnnihilationCore(44),
|
||||
FormationCore( 43 ), AnnihilationCore( 44 ),
|
||||
|
||||
SkyDust(45, AEFeature.Core),
|
||||
SkyDust( 45, AEFeature.Core ),
|
||||
|
||||
EnderDust(46, AEFeature.QuantumNetworkBridge, "dustEnder,dustEnderPearl", EntitySingularity.class), Singularity(47, AEFeature.QuantumNetworkBridge,
|
||||
EntitySingularity.class), QESingularity(48, AEFeature.QuantumNetworkBridge, EntitySingularity.class),
|
||||
EnderDust( 46, AEFeature.QuantumNetworkBridge, "dustEnder,dustEnderPearl", EntitySingularity.class ), Singularity( 47, AEFeature.QuantumNetworkBridge, EntitySingularity.class ), QESingularity( 48, AEFeature.QuantumNetworkBridge, EntitySingularity.class ),
|
||||
|
||||
BlankPattern(52), CardCrafting(53);
|
||||
BlankPattern( 52 ), CardCrafting( 53 );
|
||||
|
||||
private String oreName;
|
||||
private final EnumSet<AEFeature> features;
|
||||
private Class<? extends Entity> droppedEntity;
|
||||
|
||||
// IIcon for the material.
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon IIcon;
|
||||
|
||||
public Item itemInstance;
|
||||
public int damageValue;
|
||||
|
||||
private boolean isRegistered = false;
|
||||
|
||||
// stack!
|
||||
public MaterialStackSrc stackSrc;
|
||||
private String oreName;
|
||||
private Class<? extends Entity> droppedEntity;
|
||||
private boolean isRegistered = false;
|
||||
|
||||
MaterialType(int metaValue) {
|
||||
MaterialType( int metaValue )
|
||||
{
|
||||
this.damageValue = metaValue;
|
||||
this.features = EnumSet.of( AEFeature.Core );
|
||||
}
|
||||
|
||||
MaterialType(int metaValue, AEFeature part) {
|
||||
MaterialType( int metaValue, AEFeature part )
|
||||
{
|
||||
this.damageValue = metaValue;
|
||||
this.features = EnumSet.of( part );
|
||||
}
|
||||
|
||||
MaterialType(int metaValue, AEFeature part, Class<? extends Entity> c) {
|
||||
MaterialType( int metaValue, AEFeature part, Class<? extends Entity> c )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.damageValue = metaValue;
|
||||
this.droppedEntity = c;
|
||||
@@ -119,7 +117,8 @@ 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( int metaValue, AEFeature part, String oreDictionary, Class<? extends Entity> c )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.damageValue = metaValue;
|
||||
this.oreName = oreDictionary;
|
||||
@@ -127,13 +126,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( int metaValue, AEFeature part, String oreDictionary )
|
||||
{
|
||||
this.features = EnumSet.of( part );
|
||||
this.damageValue = metaValue;
|
||||
this.oreName = oreDictionary;
|
||||
}
|
||||
|
||||
public ItemStack stack(int size)
|
||||
public ItemStack stack( int size )
|
||||
{
|
||||
return new ItemStack( this.itemInstance, size, this.damageValue );
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
{
|
||||
ResolverResult resolver = null;
|
||||
|
||||
for ( ItemStack crystalSeedStack : AEApi.instance().definitions().items().crystalSeed().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack crystalSeedStack : AEApi.instance().definitions().items().crystalSeed().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
crystalSeedStack.setItemDamage( certus2 );
|
||||
crystalSeedStack = newStyle( crystalSeedStack );
|
||||
@@ -98,7 +98,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
|
||||
private int getProgress( ItemStack is )
|
||||
{
|
||||
if ( is.hasTagCompound() )
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
return is.getTagCompound().getInteger( "progress" );
|
||||
}
|
||||
@@ -120,28 +120,28 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
final int size = is.stackSize;
|
||||
|
||||
if ( newDamage == Certus + SINGLE_OFFSET )
|
||||
if( newDamage == Certus + SINGLE_OFFSET )
|
||||
{
|
||||
for ( ItemStack quartzStack : materials.purifiedCertusQuartzCrystal().maybeStack( size ).asSet() )
|
||||
for( ItemStack quartzStack : materials.purifiedCertusQuartzCrystal().maybeStack( size ).asSet() )
|
||||
{
|
||||
return quartzStack;
|
||||
}
|
||||
}
|
||||
if ( newDamage == Nether + SINGLE_OFFSET )
|
||||
if( newDamage == Nether + SINGLE_OFFSET )
|
||||
{
|
||||
for ( ItemStack quartzStack : materials.purifiedNetherQuartzCrystal().maybeStack( size ).asSet() )
|
||||
for( ItemStack quartzStack : materials.purifiedNetherQuartzCrystal().maybeStack( size ).asSet() )
|
||||
{
|
||||
return quartzStack;
|
||||
}
|
||||
}
|
||||
if ( newDamage == Fluix + SINGLE_OFFSET )
|
||||
if( newDamage == Fluix + SINGLE_OFFSET )
|
||||
{
|
||||
for ( ItemStack quartzStack : materials.purifiedFluixCrystal().maybeStack( size ).asSet() )
|
||||
for( ItemStack quartzStack : materials.purifiedFluixCrystal().maybeStack( size ).asSet() )
|
||||
{
|
||||
return quartzStack;
|
||||
}
|
||||
}
|
||||
if ( newDamage > END )
|
||||
if( newDamage > END )
|
||||
return null;
|
||||
|
||||
this.setProgress( is, newDamage );
|
||||
@@ -153,10 +153,6 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
NBTTagCompound comp = Platform.openNbtData( is );
|
||||
comp.setInteger( "progress", newDamage );
|
||||
is.setItemDamage( is.getItemDamage() / LEVEL_OFFSET * LEVEL_OFFSET );
|
||||
} @Override
|
||||
public int getEntityLifespan( ItemStack itemStack, World world )
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,25 +169,31 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
|
||||
|
||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
||||
} @Override
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEntityLifespan( ItemStack itemStack, World world )
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName( ItemStack is )
|
||||
{
|
||||
int damage = this.getProgress( is );
|
||||
|
||||
if ( damage < Certus + SINGLE_OFFSET )
|
||||
if( damage < Certus + SINGLE_OFFSET )
|
||||
return this.getUnlocalizedName() + ".Certus";
|
||||
|
||||
if ( damage < Nether + SINGLE_OFFSET )
|
||||
if( damage < Nether + SINGLE_OFFSET )
|
||||
return this.getUnlocalizedName() + ".Nether";
|
||||
|
||||
if ( damage < Fluix + SINGLE_OFFSET )
|
||||
if( damage < Fluix + SINGLE_OFFSET )
|
||||
return this.getUnlocalizedName() + ".Fluix";
|
||||
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDamageable()
|
||||
{
|
||||
@@ -223,27 +225,27 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
|
||||
int damage = this.getProgress( stack );
|
||||
|
||||
if ( damage < Certus + SINGLE_OFFSET )
|
||||
if( damage < Certus + SINGLE_OFFSET )
|
||||
list = this.certus;
|
||||
|
||||
else if ( damage < Nether + SINGLE_OFFSET )
|
||||
else if( damage < Nether + SINGLE_OFFSET )
|
||||
{
|
||||
damage -= Nether;
|
||||
list = this.nether;
|
||||
}
|
||||
|
||||
else if ( damage < Fluix + SINGLE_OFFSET )
|
||||
else if( damage < Fluix + SINGLE_OFFSET )
|
||||
{
|
||||
damage -= Fluix;
|
||||
list = this.fluix;
|
||||
}
|
||||
|
||||
if ( list == null )
|
||||
if( list == null )
|
||||
return Items.diamond.getIconFromDamage( 0 );
|
||||
|
||||
if ( damage < LEVEL_OFFSET )
|
||||
if( damage < LEVEL_OFFSET )
|
||||
return list[0];
|
||||
else if ( damage < LEVEL_OFFSET * 2 )
|
||||
else if( damage < LEVEL_OFFSET * 2 )
|
||||
return list[1];
|
||||
else
|
||||
return list[2];
|
||||
@@ -282,7 +284,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
egc.motionY = location.motionY;
|
||||
egc.motionZ = location.motionZ;
|
||||
|
||||
if ( location instanceof EntityItem )
|
||||
if( location instanceof EntityItem )
|
||||
egc.delayBeforeCanPickup = ( (EntityItem) location ).delayBeforeCanPickup;
|
||||
|
||||
return egc;
|
||||
@@ -306,6 +308,4 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + Nether ) ) );
|
||||
l.add( newStyle( new ItemStack( this, 1, LEVEL_OFFSET * 2 + Fluix ) ) );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.Patterns ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( this, new ItemEncodedPatternRenderer() );
|
||||
}
|
||||
|
||||
@@ -73,18 +73,18 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
private boolean clearPattern( ItemStack stack, EntityPlayer player )
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return false;
|
||||
|
||||
InventoryPlayer inv = player.inventory;
|
||||
|
||||
for ( int s = 0; s < player.inventory.getSizeInventory(); s++ )
|
||||
for( int s = 0; s < player.inventory.getSizeInventory(); s++ )
|
||||
{
|
||||
if ( inv.getStackInSlot( s ) == stack )
|
||||
if( inv.getStackInSlot( s ) == stack )
|
||||
{
|
||||
for ( ItemStack blankPattern : AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.stackSize ).asSet() )
|
||||
for( ItemStack blankPattern : AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.stackSize ).asSet() )
|
||||
{
|
||||
inv.setInventorySlotContents( s, blankPattern );
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
{
|
||||
ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj );
|
||||
|
||||
if ( details == null )
|
||||
if( details == null )
|
||||
{
|
||||
lines.add( EnumChatFormatting.RED + GuiText.InvalidPattern.getLocal() );
|
||||
return;
|
||||
@@ -118,9 +118,9 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
String with = GuiText.With.getLocal() + ": ";
|
||||
|
||||
boolean first = true;
|
||||
for ( IAEItemStack anOut : out )
|
||||
for( IAEItemStack anOut : out )
|
||||
{
|
||||
if ( anOut == null )
|
||||
if( anOut == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -130,9 +130,9 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
}
|
||||
|
||||
first = true;
|
||||
for ( IAEItemStack anIn : in )
|
||||
for( IAEItemStack anIn : in )
|
||||
{
|
||||
if ( anIn == null )
|
||||
if( anIn == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
{
|
||||
return new PatternHelper( is, w );
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -158,16 +158,16 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
public ItemStack getOutput( ItemStack item )
|
||||
{
|
||||
ItemStack out = SIMPLE_CACHE.get( item );
|
||||
if ( out != null )
|
||||
if( out != null )
|
||||
return out;
|
||||
|
||||
World w = CommonHelper.proxy.getWorld();
|
||||
if ( w == null )
|
||||
if( w == null )
|
||||
return null;
|
||||
|
||||
ICraftingPatternDetails details = this.getPatternForItem( item, w );
|
||||
|
||||
if ( details == null )
|
||||
if( details == null )
|
||||
return null;
|
||||
|
||||
SIMPLE_CACHE.put( item, out = details.getCondensedOutputs()[0].getItemStack() );
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ItemPaintBall extends AEBaseItem
|
||||
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
|
||||
this.setHasSubtypes( true );
|
||||
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( this, new PaintBallRender() );
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ public class ItemPaintBall extends AEBaseItem
|
||||
public AEColor getColor( ItemStack is )
|
||||
{
|
||||
int dmg = is.getItemDamage();
|
||||
if ( dmg >= DAMAGE_THRESHOLD )
|
||||
if( dmg >= DAMAGE_THRESHOLD )
|
||||
dmg -= DAMAGE_THRESHOLD;
|
||||
|
||||
if ( dmg >= AEColor.values().length )
|
||||
if( dmg >= AEColor.values().length )
|
||||
return AEColor.Transparent;
|
||||
|
||||
return AEColor.values()[dmg];
|
||||
@@ -75,12 +75,12 @@ public class ItemPaintBall extends AEBaseItem
|
||||
@Override
|
||||
public void getSubItems( Item i, CreativeTabs ct, List l )
|
||||
{
|
||||
for ( AEColor c : AEColor.values() )
|
||||
if ( c != AEColor.Transparent )
|
||||
for( AEColor c : AEColor.values() )
|
||||
if( c != AEColor.Transparent )
|
||||
l.add( new ItemStack( this, 1, c.ordinal() ) );
|
||||
|
||||
for ( AEColor c : AEColor.values() )
|
||||
if ( c != AEColor.Transparent )
|
||||
for( AEColor c : AEColor.values() )
|
||||
if( c != AEColor.Transparent )
|
||||
l.add( new ItemStack( this, 1, DAMAGE_THRESHOLD + c.ordinal() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.Facades ) );
|
||||
this.setHasSubtypes( true );
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( this, BusRenderer.INSTANCE );
|
||||
}
|
||||
|
||||
@@ -87,12 +87,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
try
|
||||
{
|
||||
ItemStack in = this.getTextureItem( is );
|
||||
if ( in != null )
|
||||
if( in != null )
|
||||
{
|
||||
return super.getItemStackDisplayName( is ) + " - " + in.getDisplayName();
|
||||
}
|
||||
}
|
||||
catch ( Throwable ignored )
|
||||
catch( Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -107,69 +107,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
list.addAll( this.subTypes );
|
||||
}
|
||||
|
||||
@Override
|
||||
public FacadePart createPartFromItemStack( ItemStack is, ForgeDirection side )
|
||||
{
|
||||
ItemStack in = this.getTextureItem( is );
|
||||
if ( in != null )
|
||||
return new FacadePart( is, side );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTextureItem( ItemStack is )
|
||||
{
|
||||
Block blk = this.getBlock( is );
|
||||
if ( blk != null )
|
||||
return new ItemStack( blk, 1, this.getMeta( is ) );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta( ItemStack is )
|
||||
{
|
||||
NBTTagCompound data = is.getTagCompound();
|
||||
if ( data != null )
|
||||
{
|
||||
int[] blk = data.getIntArray( "x" );
|
||||
if ( blk != null && blk.length == 2 )
|
||||
return blk[1];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock( ItemStack is )
|
||||
{
|
||||
NBTTagCompound data = is.getTagCompound();
|
||||
if ( data != null )
|
||||
{
|
||||
if ( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
|
||||
{
|
||||
return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
int[] blk = data.getIntArray( "x" );
|
||||
if ( blk != null && blk.length == 2 )
|
||||
return Block.getBlockById( blk[0] );
|
||||
}
|
||||
}
|
||||
return Blocks.glass;
|
||||
}
|
||||
|
||||
public List<ItemStack> getFacades()
|
||||
{
|
||||
this.calculateSubTypes();
|
||||
return this.subTypes;
|
||||
}
|
||||
|
||||
private void calculateSubTypes()
|
||||
{
|
||||
if ( this.subTypes == null )
|
||||
if( this.subTypes == null )
|
||||
{
|
||||
this.subTypes = new ArrayList<ItemStack>();
|
||||
for ( Object blk : Block.blockRegistry )
|
||||
for( Object blk : Block.blockRegistry )
|
||||
{
|
||||
Block b = (Block) blk;
|
||||
try
|
||||
@@ -178,31 +121,31 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
|
||||
List<ItemStack> tmpList = new ArrayList<ItemStack>();
|
||||
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
|
||||
for ( ItemStack l : tmpList )
|
||||
for( ItemStack l : tmpList )
|
||||
{
|
||||
ItemStack facade = this.createFacadeForItem( l, false );
|
||||
if ( facade != null )
|
||||
if( facade != null )
|
||||
this.subTypes.add( facade );
|
||||
}
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
// just absorb..
|
||||
}
|
||||
}
|
||||
|
||||
if ( FacadeConfig.instance.hasChanged() )
|
||||
if( FacadeConfig.instance.hasChanged() )
|
||||
FacadeConfig.instance.save();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack createFacadeForItem( ItemStack l, boolean returnItem )
|
||||
{
|
||||
if ( l == null )
|
||||
if( l == null )
|
||||
return null;
|
||||
|
||||
Block b = Block.getBlockFromItem( l.getItem() );
|
||||
if ( b == null || l.hasTagCompound() )
|
||||
if( b == null || l.hasTagCompound() )
|
||||
return null;
|
||||
|
||||
int metadata = l.getItem().getMetadata( l.getItemDamage() );
|
||||
@@ -212,9 +155,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
boolean disableOre = b instanceof OreQuartz;
|
||||
|
||||
boolean defaultValue = ( b.isOpaqueCube() && !b.getTickRandomly() && !hasTile && !disableOre ) || enableGlass;
|
||||
if ( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
|
||||
if( FacadeConfig.instance.checkEnabled( b, metadata, defaultValue ) )
|
||||
{
|
||||
if ( returnItem )
|
||||
if( returnItem )
|
||||
return l;
|
||||
|
||||
ItemStack is = new ItemStack( this );
|
||||
@@ -232,17 +175,74 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FacadePart createPartFromItemStack( ItemStack is, ForgeDirection side )
|
||||
{
|
||||
ItemStack in = this.getTextureItem( is );
|
||||
if( in != null )
|
||||
return new FacadePart( is, side );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getTextureItem( ItemStack is )
|
||||
{
|
||||
Block blk = this.getBlock( is );
|
||||
if( blk != null )
|
||||
return new ItemStack( blk, 1, this.getMeta( is ) );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta( ItemStack is )
|
||||
{
|
||||
NBTTagCompound data = is.getTagCompound();
|
||||
if( data != null )
|
||||
{
|
||||
int[] blk = data.getIntArray( "x" );
|
||||
if( blk != null && blk.length == 2 )
|
||||
return blk[1];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock( ItemStack is )
|
||||
{
|
||||
NBTTagCompound data = is.getTagCompound();
|
||||
if( data != null )
|
||||
{
|
||||
if( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
|
||||
{
|
||||
return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
int[] blk = data.getIntArray( "x" );
|
||||
if( blk != null && blk.length == 2 )
|
||||
return Block.getBlockById( blk[0] );
|
||||
}
|
||||
}
|
||||
return Blocks.glass;
|
||||
}
|
||||
|
||||
public List<ItemStack> getFacades()
|
||||
{
|
||||
this.calculateSubTypes();
|
||||
return this.subTypes;
|
||||
}
|
||||
|
||||
public ItemStack getCreativeTabIcon()
|
||||
{
|
||||
this.calculateSubTypes();
|
||||
if ( this.subTypes.isEmpty() )
|
||||
if( this.subTypes.isEmpty() )
|
||||
return new ItemStack( Items.cake );
|
||||
return this.subTypes.get( 0 );
|
||||
}
|
||||
|
||||
public ItemStack createFromIDs( int[] ids )
|
||||
{
|
||||
for ( ItemStack facadeStack : AEApi.instance().definitions().items().facade().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack facadeStack : AEApi.instance().definitions().items().facade().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
NBTTagCompound facadeTag = new NBTTagCompound();
|
||||
facadeTag.setIntArray( "x", ids.clone() );
|
||||
@@ -259,11 +259,11 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
{
|
||||
ItemStack out = this.getTextureItem( is );
|
||||
|
||||
if ( out == null || out.getItem() == null )
|
||||
if( out == null || out.getItem() == null )
|
||||
return false;
|
||||
|
||||
Block blk = Block.getBlockFromItem( out.getItem() );
|
||||
if ( blk != null && blk.canRenderInPass( 1 ) )
|
||||
if( blk != null && blk.canRenderInPass( 1 ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@@ -27,7 +28,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -50,29 +50,20 @@ import appeng.api.util.AEColor;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.NameResolver;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.features.NameResolver;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
|
||||
|
||||
public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
{
|
||||
public static ItemMultiPart instance;
|
||||
private final NameResolver nameResolver;
|
||||
|
||||
private static class PartTypeIst
|
||||
{
|
||||
private PartType part;
|
||||
private int variant;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon ico;
|
||||
}
|
||||
|
||||
private final Map<Integer, PartTypeIst> dmgToPart = new HashMap<Integer, PartTypeIst>();
|
||||
|
||||
public static ItemMultiPart instance;
|
||||
|
||||
public ItemMultiPart( IPartHelper partHelper ) {
|
||||
public ItemMultiPart( IPartHelper partHelper )
|
||||
{
|
||||
this.nameResolver = new NameResolver( this.getClass() );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
partHelper.setItemBusRenderer( this );
|
||||
@@ -85,26 +76,26 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
int varID = 0;
|
||||
|
||||
// verify
|
||||
for (PartTypeIst p : this.dmgToPart.values())
|
||||
for( PartTypeIst p : this.dmgToPart.values() )
|
||||
{
|
||||
if ( p.part == mat && p.variant == varID )
|
||||
if( p.part == mat && p.variant == varID )
|
||||
throw new RuntimeException( "Cannot create the same material twice..." );
|
||||
}
|
||||
|
||||
boolean enabled = true;
|
||||
for (AEFeature f : mat.getFeature())
|
||||
for( AEFeature f : mat.getFeature() )
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
|
||||
int newPartNum = mat.baseDamage + varID;
|
||||
ItemStackSrc output = new ItemStackSrc( this, newPartNum );
|
||||
|
||||
if ( enabled )
|
||||
if( enabled )
|
||||
{
|
||||
PartTypeIst pti = new PartTypeIst();
|
||||
pti.part = mat;
|
||||
pti.variant = varID;
|
||||
|
||||
if ( this.dmgToPart.get( newPartNum ) == null )
|
||||
if( this.dmgToPart.get( newPartNum ) == null )
|
||||
{
|
||||
this.dmgToPart.put( newPartNum, pti );
|
||||
return output;
|
||||
@@ -118,7 +109,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
return output;
|
||||
}
|
||||
|
||||
public ItemStackSrc createPart(PartType mat, Enum variant)
|
||||
public ItemStackSrc createPart( PartType mat, Enum variant )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -126,7 +117,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
ItemStack is = new ItemStack( this );
|
||||
mat.getPart().getConstructor( ItemStack.class ).newInstance( is );
|
||||
}
|
||||
catch (Throwable e)
|
||||
catch( Throwable e )
|
||||
{
|
||||
AELog.integration( e );
|
||||
e.printStackTrace();
|
||||
@@ -136,17 +127,17 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
int varID = variant == null ? 0 : variant.ordinal();
|
||||
|
||||
// verify
|
||||
for (PartTypeIst p : this.dmgToPart.values())
|
||||
for( PartTypeIst p : this.dmgToPart.values() )
|
||||
{
|
||||
if ( p.part == mat && p.variant == varID )
|
||||
if( p.part == mat && p.variant == varID )
|
||||
throw new RuntimeException( "Cannot create the same material twice..." );
|
||||
}
|
||||
|
||||
boolean enabled = true;
|
||||
for (AEFeature f : mat.getFeature())
|
||||
for( AEFeature f : mat.getFeature() )
|
||||
enabled = enabled && AEConfig.instance.isFeatureEnabled( f );
|
||||
|
||||
if ( enabled )
|
||||
if( enabled )
|
||||
{
|
||||
int newPartNum = mat.baseDamage + varID;
|
||||
ItemStackSrc output = new ItemStackSrc( this, newPartNum );
|
||||
@@ -155,7 +146,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
pti.part = mat;
|
||||
pti.variant = varID;
|
||||
|
||||
if ( this.dmgToPart.get( newPartNum ) == null )
|
||||
if( this.dmgToPart.get( newPartNum ) == null )
|
||||
{
|
||||
this.dmgToPart.put( newPartNum, pti );
|
||||
return output;
|
||||
@@ -167,77 +158,101 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getDamageByType(PartType t)
|
||||
public int getDamageByType( PartType t )
|
||||
{
|
||||
for (Entry<Integer, PartTypeIst> pt : this.dmgToPart.entrySet())
|
||||
for( Entry<Integer, PartTypeIst> pt : this.dmgToPart.entrySet() )
|
||||
{
|
||||
if ( pt.getValue().part == t )
|
||||
if( pt.getValue().part == t )
|
||||
return pt.getKey();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PartType getTypeByStack(ItemStack is)
|
||||
{
|
||||
if ( is == null )
|
||||
return null;
|
||||
|
||||
PartTypeIst pt = this.dmgToPart.get( is.getItemDamage() );
|
||||
if ( pt != null )
|
||||
return pt.part;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SideOnly( Side.CLIENT )
|
||||
public int getSpriteNumber()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int dmg)
|
||||
public IIcon getIconFromDamage( int dmg )
|
||||
{
|
||||
return this.dmgToPart.get( dmg ).ico;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack is)
|
||||
public boolean onItemUse( ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
return AEApi.instance().partHelper().placeBus( is, x, y, z, side, player, w );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName( ItemStack is )
|
||||
{
|
||||
return "item.appliedenergistics2." + this.getName( is );
|
||||
}
|
||||
|
||||
public String getName(ItemStack is)
|
||||
public String getName( ItemStack is )
|
||||
{
|
||||
return this.nameResolver.getName( this.getTypeByStack( is ).name() );
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PartType getTypeByStack( ItemStack is )
|
||||
{
|
||||
if( is == null )
|
||||
return null;
|
||||
|
||||
PartTypeIst pt = this.dmgToPart.get( is.getItemDamage() );
|
||||
if( pt != null )
|
||||
return pt.part;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack is)
|
||||
public String getItemStackDisplayName( ItemStack is )
|
||||
{
|
||||
PartType pt = this.getTypeByStack( is );
|
||||
if ( pt == null )
|
||||
if( pt == null )
|
||||
return "Unnamed";
|
||||
|
||||
if ( pt.isCable() )
|
||||
if( pt.isCable() )
|
||||
{
|
||||
final AEColor[] variants = AEColor.values();
|
||||
|
||||
return super.getItemStackDisplayName( is ) + " - " + variants[this.dmgToPart.get( is.getItemDamage() ).variant].toString();
|
||||
}
|
||||
|
||||
if ( pt.getExtraName() != null )
|
||||
if( pt.getExtraName() != null )
|
||||
return super.getItemStackDisplayName( is ) + " - " + pt.getExtraName().getLocal();
|
||||
|
||||
return super.getItemStackDisplayName( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
public void getSubItems( Item number, CreativeTabs tab, List cList )
|
||||
{
|
||||
for (Entry<Integer, PartTypeIst> part : this.dmgToPart.entrySet())
|
||||
List<Entry<Integer, PartTypeIst>> types = new ArrayList<Entry<Integer, PartTypeIst>>( this.dmgToPart.entrySet() );
|
||||
Collections.sort( types, new Comparator<Entry<Integer, PartTypeIst>>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare( Entry<Integer, PartTypeIst> o1, Entry<Integer, PartTypeIst> o2 )
|
||||
{
|
||||
return o1.getValue().part.name().compareTo( o2.getValue().part.name() );
|
||||
}
|
||||
} );
|
||||
|
||||
for( Entry<Integer, PartTypeIst> part : types )
|
||||
cList.add( new ItemStack( this, 1, part.getKey() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons( IIconRegister par1IconRegister )
|
||||
{
|
||||
for( Entry<Integer, PartTypeIst> part : this.dmgToPart.entrySet() )
|
||||
{
|
||||
String tex = "appliedenergistics2:" + this.getName( new ItemStack( this, 1, part.getKey() ) );
|
||||
part.getValue().ico = par1IconRegister.registerIcon( tex );
|
||||
@@ -245,60 +260,35 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return AEApi.instance().partHelper().placeBus( is, x, y, z, side, player, w );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPart createPartFromItemStack(ItemStack is)
|
||||
public IPart createPartFromItemStack( ItemStack is )
|
||||
{
|
||||
try
|
||||
{
|
||||
PartType t = this.getTypeByStack( is );
|
||||
if ( t != null )
|
||||
if( t != null )
|
||||
{
|
||||
if ( t.constructor == null )
|
||||
if( t.constructor == null )
|
||||
t.constructor = t.getPart().getConstructor( ItemStack.class );
|
||||
|
||||
return t.constructor.newInstance( is );
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
catch( Throwable e )
|
||||
{
|
||||
throw new RuntimeException( "Unable to construct IBusPart from IBusItem : " + this.getTypeByStack( is ).getPart().getName()
|
||||
+ " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
throw new RuntimeException( "Unable to construct IBusPart from IBusItem : " + this.getTypeByStack( is ).getPart().getName() + " ; Possibly didn't have correct constructor( ItemStack )", e );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item number, CreativeTabs tab, List cList)
|
||||
public int variantOf( int itemDamage )
|
||||
{
|
||||
List<Entry<Integer, PartTypeIst>> types = new ArrayList<Entry<Integer, PartTypeIst>>( this.dmgToPart.entrySet() );
|
||||
Collections.sort( types, new Comparator<Entry<Integer, PartTypeIst>>() {
|
||||
|
||||
@Override
|
||||
public int compare(Entry<Integer, PartTypeIst> o1, Entry<Integer, PartTypeIst> o2)
|
||||
{
|
||||
return o1.getValue().part.name().compareTo( o2.getValue().part.name() );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
for (Entry<Integer, PartTypeIst> part : types)
|
||||
cList.add( new ItemStack( this, 1, part.getKey() ) );
|
||||
}
|
||||
|
||||
public int variantOf(int itemDamage)
|
||||
{
|
||||
if ( this.dmgToPart.containsKey( itemDamage ) )
|
||||
if( this.dmgToPart.containsKey( itemDamage ) )
|
||||
return this.dmgToPart.get( itemDamage ).variant;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedGroupName(Set<ItemStack> others, ItemStack is)
|
||||
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
|
||||
{
|
||||
boolean importBus = false;
|
||||
boolean exportBus = false;
|
||||
@@ -306,36 +296,45 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
|
||||
|
||||
PartType u = this.getTypeByStack( is );
|
||||
|
||||
for (ItemStack stack : others)
|
||||
for( ItemStack stack : others )
|
||||
{
|
||||
if ( stack.getItem() == this )
|
||||
if( stack.getItem() == this )
|
||||
{
|
||||
PartType pt = this.getTypeByStack( stack );
|
||||
switch (pt)
|
||||
switch( pt )
|
||||
{
|
||||
case ImportBus:
|
||||
importBus = true;
|
||||
if ( u == pt )
|
||||
group = true;
|
||||
break;
|
||||
case ExportBus:
|
||||
exportBus = true;
|
||||
if ( u == pt )
|
||||
group = true;
|
||||
break;
|
||||
default:
|
||||
case ImportBus:
|
||||
importBus = true;
|
||||
if( u == pt )
|
||||
group = true;
|
||||
break;
|
||||
case ExportBus:
|
||||
exportBus = true;
|
||||
if( u == pt )
|
||||
group = true;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( group && importBus && exportBus )
|
||||
if( group && importBus && exportBus )
|
||||
return GuiText.IOBuses.getUnlocalized();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getStackFromTypeAndVariant(PartType mt, int variant)
|
||||
public ItemStack getStackFromTypeAndVariant( PartType mt, int variant )
|
||||
{
|
||||
return new ItemStack( this, 1, mt.baseDamage + variant );
|
||||
}
|
||||
|
||||
private static class PartTypeIst
|
||||
{
|
||||
private PartType part;
|
||||
private int variant;
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
private IIcon ico;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,11 +152,10 @@ public enum PartType
|
||||
|
||||
InterfaceTerminal( 480, EnumSet.of( AEFeature.InterfaceTerminal ), PartInterfaceTerminal.class );
|
||||
|
||||
public final int baseDamage;
|
||||
private final EnumSet<AEFeature> features;
|
||||
private final Class<? extends IPart> myPart;
|
||||
private final GuiText extraName;
|
||||
public final int baseDamage;
|
||||
|
||||
public Constructor<? extends IPart> constructor;
|
||||
|
||||
PartType( int baseMetaValue, EnumSet<AEFeature> features, Class<? extends IPart> c )
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
||||
this.totalBytes = kilobytes * 1024;
|
||||
this.component = whichCell;
|
||||
|
||||
switch ( this.component )
|
||||
switch( this.component )
|
||||
{
|
||||
case Cell1kPart:
|
||||
this.idleDrain = 0.5;
|
||||
@@ -100,31 +100,25 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
||||
{
|
||||
IMEInventoryHandler inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
|
||||
if ( inventory instanceof ICellInventoryHandler )
|
||||
if( inventory instanceof ICellInventoryHandler )
|
||||
{
|
||||
ICellInventoryHandler handler = ( ICellInventoryHandler ) inventory;
|
||||
ICellInventoryHandler handler = (ICellInventoryHandler) inventory;
|
||||
ICellInventory cellInventory = handler.getCellInv();
|
||||
|
||||
if ( cellInventory != null )
|
||||
if( cellInventory != null )
|
||||
{
|
||||
lines.add( cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + ' '
|
||||
+ cellInventory.getTotalBytes() + ' '
|
||||
+ GuiText.BytesUsed.getLocal() );
|
||||
lines.add( cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cellInventory.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
|
||||
|
||||
lines.add( cellInventory.getStoredItemTypes() + " " + GuiText.Of.getLocal()
|
||||
+ ' ' + cellInventory.getTotalItemTypes() + ' '
|
||||
+ GuiText.Types.getLocal() );
|
||||
lines.add( cellInventory.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cellInventory.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
|
||||
|
||||
if ( handler.isPreformatted() )
|
||||
if( handler.isPreformatted() )
|
||||
{
|
||||
String List = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included
|
||||
: GuiText.Excluded ).getLocal();
|
||||
String List = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded ).getLocal();
|
||||
|
||||
if ( handler.isFuzzy() )
|
||||
if( handler.isFuzzy() )
|
||||
lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Fuzzy.getLocal() );
|
||||
else
|
||||
lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Precise.getLocal() );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,7 +198,7 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
@@ -225,35 +219,35 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
||||
|
||||
private boolean disassembleDrive( ItemStack stack, World world, EntityPlayer player )
|
||||
{
|
||||
if ( player.isSneaking() )
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return false;
|
||||
|
||||
InventoryPlayer playerInventory = player.inventory;
|
||||
IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
if ( inv != null && playerInventory.getCurrentItem() == stack )
|
||||
if( inv != null && playerInventory.getCurrentItem() == stack )
|
||||
{
|
||||
InventoryAdaptor ia = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
|
||||
IItemList<IAEItemStack> list = inv.getAvailableItems( StorageChannel.ITEMS.createList() );
|
||||
if ( list.isEmpty() && ia != null )
|
||||
if( list.isEmpty() && ia != null )
|
||||
{
|
||||
playerInventory.setInventorySlotContents( playerInventory.currentItem, null );
|
||||
|
||||
ItemStack extraB = ia.addItems( this.component.stack( 1 ) );
|
||||
if ( extraB != null )
|
||||
if( extraB != null )
|
||||
player.dropPlayerItemWithRandomChoice( extraB, false );
|
||||
|
||||
for ( ItemStack storageCellStack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack storageCellStack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
final ItemStack extraA = ia.addItems( storageCellStack );
|
||||
if ( extraA != null )
|
||||
if( extraA != null )
|
||||
{
|
||||
player.dropPlayerItemWithRandomChoice( extraA, false );
|
||||
}
|
||||
}
|
||||
|
||||
if ( player.inventoryContainer != null )
|
||||
if( player.inventoryContainer != null )
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
|
||||
return true;
|
||||
@@ -272,7 +266,7 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
||||
@Override
|
||||
public ItemStack getContainerItem( ItemStack itemStack )
|
||||
{
|
||||
for ( ItemStack stack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
for( ItemStack stack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
||||
{
|
||||
WorldCoord wc = this.getStoredSize( stack );
|
||||
if ( wc.x > 0 )
|
||||
if( wc.x > 0 )
|
||||
lines.add( GuiText.StoredSize.getLocal() + ": " + wc.x + " x " + wc.y + " x " + wc.z );
|
||||
}
|
||||
|
||||
@@ -77,20 +77,20 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
@Override
|
||||
public World getWorld( ItemStack is )
|
||||
{
|
||||
if ( is.hasTagCompound() )
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound c = is.getTagCompound();
|
||||
int dim = c.getInteger( "StorageDim" );
|
||||
World w = DimensionManager.getWorld( dim );
|
||||
if ( w == null )
|
||||
if( w == null )
|
||||
{
|
||||
DimensionManager.initDimension( dim );
|
||||
w = DimensionManager.getWorld( dim );
|
||||
}
|
||||
|
||||
if ( w != null )
|
||||
if( w != null )
|
||||
{
|
||||
if ( w.provider instanceof StorageWorldProvider )
|
||||
if( w.provider instanceof StorageWorldProvider )
|
||||
{
|
||||
return w;
|
||||
}
|
||||
@@ -102,10 +102,10 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
@Override
|
||||
public WorldCoord getStoredSize( ItemStack is )
|
||||
{
|
||||
if ( is.hasTagCompound() )
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound c = is.getTagCompound();
|
||||
if ( Platform.isServer() )
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
int dim = c.getInteger( "StorageDim" );
|
||||
return WorldSettings.getInstance().getStoredSize( dim );
|
||||
@@ -120,10 +120,10 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
public WorldCoord getMin( ItemStack is )
|
||||
{
|
||||
World w = this.getWorld( is );
|
||||
if ( w != null )
|
||||
if( w != null )
|
||||
{
|
||||
NBTTagCompound info = ( NBTTagCompound ) w.getWorldInfo().getAdditionalProperty( "storageCell" );
|
||||
if ( info != null )
|
||||
NBTTagCompound info = (NBTTagCompound) w.getWorldInfo().getAdditionalProperty( "storageCell" );
|
||||
if( info != null )
|
||||
{
|
||||
return new WorldCoord( info.getInteger( "minX" ), info.getInteger( "minY" ), info.getInteger( "minZ" ) );
|
||||
}
|
||||
@@ -135,10 +135,10 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
public WorldCoord getMax( ItemStack is )
|
||||
{
|
||||
World w = this.getWorld( is );
|
||||
if ( w != null )
|
||||
if( w != null )
|
||||
{
|
||||
NBTTagCompound info = ( NBTTagCompound ) w.getWorldInfo().getAdditionalProperty( "storageCell" );
|
||||
if ( info != null )
|
||||
NBTTagCompound info = (NBTTagCompound) w.getWorldInfo().getAdditionalProperty( "storageCell" );
|
||||
if( info != null )
|
||||
{
|
||||
return new WorldCoord( info.getInteger( "maxX" ), info.getInteger( "maxY" ), info.getInteger( "maxZ" ) );
|
||||
}
|
||||
@@ -159,15 +159,14 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
int floorBuffer = 64;
|
||||
World destination = this.getWorld( is );
|
||||
|
||||
if ( ( scale.x == 0 && scale.y == 0 && scale.z == 0 ) || ( scale.x == targetX && scale.y == targetY && scale.z == targetZ ) )
|
||||
if( ( scale.x == 0 && scale.y == 0 && scale.z == 0 ) || ( scale.x == targetX && scale.y == targetY && scale.z == targetZ ) )
|
||||
{
|
||||
if ( targetX <= maxSize && targetY <= maxSize && targetZ <= maxSize )
|
||||
if( targetX <= maxSize && targetY <= maxSize && targetZ <= maxSize )
|
||||
{
|
||||
if ( destination == null )
|
||||
if( destination == null )
|
||||
destination = this.createNewWorld( is );
|
||||
|
||||
StorageHelper.getInstance()
|
||||
.swapRegions( w, destination, min.x + 1, min.y + 1, min.z + 1, 1, floorBuffer + 1, 1, targetX - 1, targetY - 1, targetZ - 1 );
|
||||
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 );
|
||||
|
||||
return new TransitionResult( true, 0 );
|
||||
@@ -189,7 +188,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
|
||||
private void setStoredSize( ItemStack is, int targetX, int targetY, int targetZ )
|
||||
{
|
||||
if ( is.hasTagCompound() )
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound c = is.getTagCompound();
|
||||
int dim = c.getInteger( "StorageDim" );
|
||||
@@ -199,5 +198,4 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
WorldSettings.getInstance().setStoredSize( dim, targetX, targetY, targetZ );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -57,12 +57,12 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
|
||||
MergedPriorityList<IAEItemStack> myMergedList = new MergedPriorityList<IAEItemStack>();
|
||||
|
||||
for ( ItemStack currentViewCell : list )
|
||||
for( ItemStack currentViewCell : list )
|
||||
{
|
||||
if ( currentViewCell == null )
|
||||
if( currentViewCell == null )
|
||||
continue;
|
||||
|
||||
if ( ( currentViewCell.getItem() instanceof ItemViewCell ) )
|
||||
if( ( currentViewCell.getItem() instanceof ItemViewCell ) )
|
||||
{
|
||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
|
||||
@@ -74,15 +74,15 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
boolean hasInverter = false;
|
||||
boolean hasFuzzy = false;
|
||||
|
||||
for ( int x = 0; x < upgrades.getSizeInventory(); x++ )
|
||||
for( int x = 0; x < upgrades.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack is = upgrades.getStackInSlot( x );
|
||||
if ( is != null && is.getItem() instanceof IUpgradeModule )
|
||||
if( is != null && is.getItem() instanceof IUpgradeModule )
|
||||
{
|
||||
Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
|
||||
if ( u != null )
|
||||
if( u != null )
|
||||
{
|
||||
switch ( u )
|
||||
switch( u )
|
||||
{
|
||||
case FUZZY:
|
||||
hasFuzzy = true;
|
||||
@@ -96,16 +96,16 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
}
|
||||
}
|
||||
|
||||
for ( int x = 0; x < config.getSizeInventory(); x++ )
|
||||
for( int x = 0; x < config.getSizeInventory(); x++ )
|
||||
{
|
||||
ItemStack is = config.getStackInSlot( x );
|
||||
if ( is != null )
|
||||
if( is != null )
|
||||
priorityList.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
if ( !priorityList.isEmpty() )
|
||||
if( !priorityList.isEmpty() )
|
||||
{
|
||||
if ( hasFuzzy )
|
||||
if( hasFuzzy )
|
||||
myMergedList.addNewList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ), !hasInverter );
|
||||
else
|
||||
myMergedList.addNewList( new PrecisePriorityList<IAEItemStack>( priorityList ), !hasInverter );
|
||||
@@ -144,7 +144,7 @@ public class ItemViewCell extends AEBaseItem implements ICellWorkbenchItem
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
|
||||
@@ -50,14 +50,14 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
this.setFeature( EnumSet.of( AEFeature.Security ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( this, new ToolBiometricCardRender() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack is, World w, EntityPlayer p )
|
||||
{
|
||||
if ( p.isSneaking() )
|
||||
if( p.isSneaking() )
|
||||
{
|
||||
this.encode( is, p );
|
||||
p.swingItem();
|
||||
@@ -70,9 +70,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
@Override
|
||||
public boolean itemInteractionForEntity( ItemStack is, EntityPlayer par2EntityPlayer, EntityLivingBase target )
|
||||
{
|
||||
if ( target instanceof EntityPlayer && !par2EntityPlayer.isSneaking() )
|
||||
if( target instanceof EntityPlayer && !par2EntityPlayer.isSneaking() )
|
||||
{
|
||||
if ( par2EntityPlayer.capabilities.isCreativeMode )
|
||||
if( par2EntityPlayer.capabilities.isCreativeMode )
|
||||
is = par2EntityPlayer.getCurrentEquippedItem();
|
||||
this.encode( is, (EntityPlayer) target );
|
||||
par2EntityPlayer.swingItem();
|
||||
@@ -92,7 +92,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
{
|
||||
GameProfile username = this.getProfile( is );
|
||||
|
||||
if ( username != null && username.equals( p.getGameProfile() ) )
|
||||
if( username != null && username.equals( p.getGameProfile() ) )
|
||||
this.setProfile( is, null );
|
||||
else
|
||||
this.setProfile( is, p.getGameProfile() );
|
||||
@@ -103,7 +103,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
|
||||
if ( profile != null )
|
||||
if( profile != null )
|
||||
{
|
||||
NBTTagCompound pNBT = new NBTTagCompound();
|
||||
NBTUtil.func_152460_a( pNBT, profile );
|
||||
@@ -117,7 +117,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
public GameProfile getProfile( ItemStack is )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( is );
|
||||
if ( tag.hasKey( "profile" ) )
|
||||
if( tag.hasKey( "profile" ) )
|
||||
return NBTUtil.func_152459_a( tag.getCompoundTag( "profile" ) );
|
||||
return null;
|
||||
}
|
||||
@@ -128,9 +128,9 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
NBTTagCompound tag = Platform.openNbtData( is );
|
||||
EnumSet<SecurityPermissions> result = EnumSet.noneOf( SecurityPermissions.class );
|
||||
|
||||
for ( SecurityPermissions sp : SecurityPermissions.values() )
|
||||
for( SecurityPermissions sp : SecurityPermissions.values() )
|
||||
{
|
||||
if ( tag.getBoolean( sp.name() ) )
|
||||
if( tag.getBoolean( sp.name() ) )
|
||||
result.add( sp );
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
public void removePermission( ItemStack itemStack, SecurityPermissions permission )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
if ( tag.hasKey( permission.name() ) )
|
||||
if( tag.hasKey( permission.name() ) )
|
||||
tag.removeTag( permission.name() );
|
||||
}
|
||||
|
||||
@@ -169,15 +169,15 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
||||
{
|
||||
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
|
||||
if ( perms.isEmpty() )
|
||||
if( perms.isEmpty() )
|
||||
lines.add( GuiText.NoPermissions.getLocal() );
|
||||
else
|
||||
{
|
||||
String msg = null;
|
||||
|
||||
for ( SecurityPermissions sp : perms )
|
||||
for( SecurityPermissions sp : perms )
|
||||
{
|
||||
if ( msg == null )
|
||||
if( msg == null )
|
||||
msg = Platform.gui_localize( sp.getUnlocalizedName() );
|
||||
else
|
||||
msg = msg + ", " + Platform.gui_localize( sp.getUnlocalizedName() );
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
|
||||
|
||||
NBTTagCompound data = this.getData( stack );
|
||||
if ( data.hasKey( "tooltip" ) )
|
||||
if( data.hasKey( "tooltip" ) )
|
||||
lines.add( StatCollector.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
*/
|
||||
private String getLocalizedName( String... name )
|
||||
{
|
||||
for ( String n : name )
|
||||
for( String n : name )
|
||||
{
|
||||
String l = StatCollector.translateToLocal( n );
|
||||
if ( !l.equals( n ) )
|
||||
if( !l.equals( n ) )
|
||||
return l;
|
||||
}
|
||||
|
||||
for ( String n : name )
|
||||
for( String n : name )
|
||||
return n;
|
||||
|
||||
return "";
|
||||
@@ -98,7 +98,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
NBTTagCompound o = c.getCompoundTag( "Data" );
|
||||
if ( o == null )
|
||||
if( o == null )
|
||||
o = new NBTTagCompound();
|
||||
return (NBTTagCompound) o.copy();
|
||||
}
|
||||
@@ -106,10 +106,10 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
@Override
|
||||
public void notifyUser( EntityPlayer player, MemoryCardMessages msg )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return;
|
||||
|
||||
switch ( msg )
|
||||
switch( msg )
|
||||
{
|
||||
case SETTINGS_CLEARED:
|
||||
player.addChatMessage( PlayerMessages.SettingCleared.get() );
|
||||
@@ -130,7 +130,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
@Override
|
||||
public boolean onItemUse( ItemStack is, EntityPlayer player, World w, int x, int y, int z, int side, float hx, float hy, float hz )
|
||||
{
|
||||
if ( player.isSneaking() && !w.isRemote )
|
||||
if( player.isSneaking() && !w.isRemote )
|
||||
{
|
||||
IMemoryCard mem = (IMemoryCard) is.getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
|
||||
public ToolNetworkTool()
|
||||
{
|
||||
super( Optional.<String> absent() );
|
||||
super( Optional.<String>absent() );
|
||||
|
||||
this.setFeature( EnumSet.of( AEFeature.NetworkTool ) );
|
||||
this.setMaxStackSize( 1 );
|
||||
@@ -70,17 +70,17 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
public IGuiItemObject getGuiObject( ItemStack is, World world, int x, int y, int z )
|
||||
{
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
return new NetworkToolViewer( is, ( IGridHost ) ( te instanceof IGridHost ? te : null ) );
|
||||
return new NetworkToolViewer( is, (IGridHost) ( te instanceof IGridHost ? te : null ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack it, World w, EntityPlayer p )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
MovingObjectPosition mop = ClientHelper.proxy.getMOP();
|
||||
|
||||
if ( mop == null )
|
||||
if( mop == null )
|
||||
{
|
||||
this.onItemUseFirst( it, p, w, 0, 0, 0, -1, 0, 0, 0 );
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
int j = mop.blockY;
|
||||
int k = mop.blockZ;
|
||||
|
||||
if ( w.getBlock( i, j, k ).isAir( w, i, j, k ) )
|
||||
if( w.getBlock( i, j, k ).isAir( w, i, j, k ) )
|
||||
this.onItemUseFirst( it, p, w, 0, 0, 0, -1, 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
@@ -103,21 +103,21 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
{
|
||||
MovingObjectPosition mop = new MovingObjectPosition( x, y, z, side, Vec3.createVectorHelper( hitX, hitY, hitZ ) );
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
if ( te instanceof IPartHost )
|
||||
if( te instanceof IPartHost )
|
||||
{
|
||||
SelectedPart part = ( ( IPartHost ) te ).selectPart( mop.hitVec );
|
||||
if ( part.part != null )
|
||||
SelectedPart part = ( (IPartHost) te ).selectPart( mop.hitVec );
|
||||
if( part.part != null )
|
||||
{
|
||||
if ( part.part instanceof INetworkToolAgent && !( ( INetworkToolAgent ) part.part ).showNetworkInfo( mop ) )
|
||||
if( part.part instanceof INetworkToolAgent && !( (INetworkToolAgent) part.part ).showNetworkInfo( mop ) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ( te instanceof INetworkToolAgent && !( ( INetworkToolAgent ) te ).showNetworkInfo( mop ) )
|
||||
else if( te instanceof INetworkToolAgent && !( (INetworkToolAgent) te ).showNetworkInfo( mop ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketClick( x, y, z, side, hitX, hitY, hitZ ) );
|
||||
}
|
||||
@@ -132,18 +132,18 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
|
||||
public boolean serverSideToolLogic( ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
if ( side >= 0 )
|
||||
if( side >= 0 )
|
||||
{
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
return false;
|
||||
|
||||
Block b = w.getBlock( x, y, z );
|
||||
if ( b != null && !p.isSneaking() )
|
||||
if( b != null && !p.isSneaking() )
|
||||
{
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
if ( !( te instanceof IGridHost ) )
|
||||
if( !( te instanceof IGridHost ) )
|
||||
{
|
||||
if ( b.rotateBlock( w, x, y, z, ForgeDirection.getOrientation( side ) ) )
|
||||
if( b.rotateBlock( w, x, y, z, ForgeDirection.getOrientation( side ) ) )
|
||||
{
|
||||
b.onNeighborBlockChange( w, x, y, z, Platform.AIR );
|
||||
p.swingItem();
|
||||
@@ -152,14 +152,14 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
}
|
||||
}
|
||||
|
||||
if ( !p.isSneaking() )
|
||||
if( !p.isSneaking() )
|
||||
{
|
||||
if ( p.openContainer instanceof AEBaseContainer )
|
||||
if( p.openContainer instanceof AEBaseContainer )
|
||||
return true;
|
||||
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
|
||||
if ( te instanceof IGridHost )
|
||||
if( te instanceof IGridHost )
|
||||
Platform.openGUI( p, te, ForgeDirection.getOrientation( side ), GuiBridge.GUI_NETWORK_STATUS );
|
||||
else
|
||||
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_NETWORK_TOOL );
|
||||
@@ -192,5 +192,4 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
{
|
||||
player.swingItem();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,23 +40,23 @@ public class ToolChargedStaff extends AEBasePoweredItem
|
||||
|
||||
public ToolChargedStaff()
|
||||
{
|
||||
super( AEConfig.instance.chargedStaffBattery, Optional.<String> absent() );
|
||||
super( AEConfig.instance.chargedStaffBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.ChargedStaff, AEFeature.PoweredTools ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity( ItemStack item, EntityLivingBase target, EntityLivingBase hitter )
|
||||
{
|
||||
if ( this.getAECurrentPower( item ) > 300 )
|
||||
if( this.getAECurrentPower( item ) > 300 )
|
||||
{
|
||||
this.extractAEPower( item, 300 );
|
||||
if ( Platform.isServer() )
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
for ( int x = 0; x < 2; x++ )
|
||||
for( int x = 0; x < 2; x++ )
|
||||
{
|
||||
float dx = ( float ) ( Platform.getRandomFloat() * target.width + target.boundingBox.minX );
|
||||
float dy = ( float ) ( Platform.getRandomFloat() * target.height + target.boundingBox.minY );
|
||||
float dz = ( float ) ( Platform.getRandomFloat() * target.width + target.boundingBox.minZ );
|
||||
float dx = (float) ( Platform.getRandomFloat() * target.width + target.boundingBox.minX );
|
||||
float dy = (float) ( Platform.getRandomFloat() * target.height + target.boundingBox.minY );
|
||||
float dz = (float) ( Platform.getRandomFloat() * target.width + target.boundingBox.minZ );
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,21 +87,20 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
static
|
||||
{
|
||||
|
||||
for ( AEColor col : AEColor.values() )
|
||||
for( AEColor col : AEColor.values() )
|
||||
{
|
||||
if ( col == AEColor.Transparent )
|
||||
if( col == AEColor.Transparent )
|
||||
continue;
|
||||
|
||||
ORE_TO_COLOR.put( OreDictionary.getOreID( "dye" + col.name() ), col );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ToolColorApplicator()
|
||||
{
|
||||
super( AEConfig.instance.colorApplicatorBattery, Optional.<String> absent() );
|
||||
super( AEConfig.instance.colorApplicatorBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.ColorApplicator, AEFeature.PoweredTools ) );
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( this, new ToolColorApplicatorRender() );
|
||||
}
|
||||
|
||||
@@ -121,11 +120,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
ItemStack paintBall = this.getColor( is );
|
||||
|
||||
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
if ( inv != null )
|
||||
if( inv != null )
|
||||
{
|
||||
IAEItemStack option = inv.extractItems( AEItemStack.create( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
|
||||
|
||||
if ( option != null )
|
||||
if( option != null )
|
||||
{
|
||||
paintBall = option.getItemStack();
|
||||
paintBall.stackSize = 1;
|
||||
@@ -133,19 +132,19 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
else
|
||||
paintBall = null;
|
||||
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
return false;
|
||||
|
||||
if ( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
|
||||
if( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
|
||||
{
|
||||
ForgeDirection orientation = ForgeDirection.getOrientation( side );
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
// clean cables.
|
||||
if ( te instanceof IColorableTile )
|
||||
if( te instanceof IColorableTile )
|
||||
{
|
||||
if ( this.getAECurrentPower( is ) > powerPerUse && ( ( IColorableTile ) te ).getColor() != AEColor.Transparent )
|
||||
if( this.getAECurrentPower( is ) > powerPerUse && ( (IColorableTile) te ).getColor() != AEColor.Transparent )
|
||||
{
|
||||
if ( ( ( IColorableTile ) te ).recolourBlock( orientation, AEColor.Transparent, p ) )
|
||||
if( ( (IColorableTile) te ).recolourBlock( orientation, AEColor.Transparent, p ) )
|
||||
{
|
||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
this.extractAEPower( is, powerPerUse );
|
||||
@@ -157,33 +156,31 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
// clean paint balls..
|
||||
Block testBlk = w.getBlock( x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ );
|
||||
TileEntity painted = w.getTileEntity( x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ );
|
||||
if ( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
|
||||
if( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
|
||||
{
|
||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
this.extractAEPower( is, powerPerUse );
|
||||
( ( TilePaint ) painted ).cleanSide( orientation.getOpposite() );
|
||||
( (TilePaint) painted ).cleanSide( orientation.getOpposite() );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if ( paintBall != null )
|
||||
else if( paintBall != null )
|
||||
{
|
||||
AEColor color = this.getColorFromItem( paintBall );
|
||||
|
||||
if ( color != null && this.getAECurrentPower( is ) > powerPerUse )
|
||||
if( color != null && this.getAECurrentPower( is ) > powerPerUse )
|
||||
{
|
||||
if ( color != AEColor.Transparent
|
||||
&& this.recolourBlock( blk, ForgeDirection.getOrientation( side ), w, x, y, z, ForgeDirection.getOrientation( side ), color, p ) )
|
||||
if( color != AEColor.Transparent && this.recolourBlock( blk, ForgeDirection.getOrientation( side ), w, x, y, z, ForgeDirection.getOrientation( side ), color, p ) )
|
||||
{
|
||||
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||
this.extractAEPower( is, powerPerUse );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( p.isSneaking() )
|
||||
if( p.isSneaking() )
|
||||
{
|
||||
this.cycleColors( is, paintBall, 1 );
|
||||
}
|
||||
@@ -198,7 +195,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
AEColor selected = this.getActiveColor( par1ItemStack );
|
||||
|
||||
if ( selected != null && Platform.isClient() )
|
||||
if( selected != null && Platform.isClient() )
|
||||
extra = Platform.gui_localize( selected.unlocalizedName );
|
||||
|
||||
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
|
||||
@@ -211,24 +208,24 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
public AEColor getColorFromItem( ItemStack paintBall )
|
||||
{
|
||||
if ( paintBall == null )
|
||||
if( paintBall == null )
|
||||
return null;
|
||||
|
||||
if ( paintBall.getItem() instanceof ItemSnowball )
|
||||
if( paintBall.getItem() instanceof ItemSnowball )
|
||||
return AEColor.Transparent;
|
||||
|
||||
if ( paintBall.getItem() instanceof ItemPaintBall )
|
||||
if( paintBall.getItem() instanceof ItemPaintBall )
|
||||
{
|
||||
ItemPaintBall ipb = ( ItemPaintBall ) paintBall.getItem();
|
||||
ItemPaintBall ipb = (ItemPaintBall) paintBall.getItem();
|
||||
return ipb.getColor( paintBall );
|
||||
}
|
||||
else
|
||||
{
|
||||
int[] id = OreDictionary.getOreIDs( paintBall );
|
||||
|
||||
for ( int oreID : id )
|
||||
for( int oreID : id )
|
||||
{
|
||||
if ( ORE_TO_COLOR.containsKey( oreID ) )
|
||||
if( ORE_TO_COLOR.containsKey( oreID ) )
|
||||
return ORE_TO_COLOR.get( oreID );
|
||||
}
|
||||
}
|
||||
@@ -239,11 +236,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
public ItemStack getColor( ItemStack is )
|
||||
{
|
||||
NBTTagCompound c = is.getTagCompound();
|
||||
if ( c != null && c.hasKey( "color" ) )
|
||||
if( c != null && c.hasKey( "color" ) )
|
||||
{
|
||||
NBTTagCompound color = c.getCompoundTag( "color" );
|
||||
ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
|
||||
if ( oldColor != null )
|
||||
if( oldColor != null )
|
||||
return oldColor;
|
||||
}
|
||||
|
||||
@@ -255,56 +252,56 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
ItemStack newColor = null;
|
||||
|
||||
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
|
||||
if ( inv != null )
|
||||
if( inv != null )
|
||||
{
|
||||
IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
if ( anchor == null )
|
||||
if( anchor == null )
|
||||
{
|
||||
IAEItemStack firstItem = itemList.getFirstItem();
|
||||
if ( firstItem != null )
|
||||
if( firstItem != null )
|
||||
newColor = firstItem.getItemStack();
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>();
|
||||
|
||||
for ( IAEItemStack i : itemList )
|
||||
for( IAEItemStack i : itemList )
|
||||
list.add( i );
|
||||
|
||||
Collections.sort( list, new Comparator<IAEItemStack>(){
|
||||
Collections.sort( list, new Comparator<IAEItemStack>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare( IAEItemStack a, IAEItemStack b )
|
||||
{
|
||||
return ItemSorters.compareInt( a.getItemDamage(), b.getItemDamage() );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
if ( list.size() <= 0 )
|
||||
if( list.size() <= 0 )
|
||||
return null;
|
||||
|
||||
IAEItemStack where = list.getFirst();
|
||||
int cycles = 1 + list.size();
|
||||
|
||||
while ( cycles > 0 && !where.equals( anchor ) )
|
||||
while( cycles > 0 && !where.equals( anchor ) )
|
||||
{
|
||||
list.addLast( list.removeFirst() );
|
||||
cycles--;
|
||||
where = list.getFirst();
|
||||
}
|
||||
|
||||
if ( scrollOffset > 0 )
|
||||
if( scrollOffset > 0 )
|
||||
list.addLast( list.removeFirst() );
|
||||
|
||||
if ( scrollOffset < 0 )
|
||||
if( scrollOffset < 0 )
|
||||
list.addFirst( list.removeLast() );
|
||||
|
||||
return list.get( 0 ).getItemStack();
|
||||
}
|
||||
}
|
||||
|
||||
if ( newColor != null )
|
||||
if( newColor != null )
|
||||
this.setColor( is, newColor );
|
||||
|
||||
return newColor;
|
||||
@@ -313,7 +310,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
public void setColor( ItemStack is, ItemStack newColor )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( is );
|
||||
if ( newColor == null )
|
||||
if( newColor == null )
|
||||
data.removeTag( "color" );
|
||||
else
|
||||
{
|
||||
@@ -325,62 +322,62 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
private boolean recolourBlock( Block blk, ForgeDirection side, World w, int x, int y, int z, ForgeDirection orientation, AEColor newColor, EntityPlayer p )
|
||||
{
|
||||
if ( blk == Blocks.carpet )
|
||||
if( blk == Blocks.carpet )
|
||||
{
|
||||
int meta = w.getBlockMetadata( x, y, z );
|
||||
if ( newColor.ordinal() == meta )
|
||||
if( newColor.ordinal() == meta )
|
||||
return false;
|
||||
return w.setBlock( x, y, z, Blocks.carpet, newColor.ordinal(), 3 );
|
||||
}
|
||||
|
||||
if ( blk == Blocks.glass )
|
||||
if( blk == Blocks.glass )
|
||||
{
|
||||
return w.setBlock( x, y, z, Blocks.stained_glass, newColor.ordinal(), 3 );
|
||||
}
|
||||
|
||||
if ( blk == Blocks.stained_glass )
|
||||
if( blk == Blocks.stained_glass )
|
||||
{
|
||||
int meta = w.getBlockMetadata( x, y, z );
|
||||
if ( newColor.ordinal() == meta )
|
||||
if( newColor.ordinal() == meta )
|
||||
return false;
|
||||
return w.setBlock( x, y, z, Blocks.stained_glass, newColor.ordinal(), 3 );
|
||||
}
|
||||
|
||||
if ( blk == Blocks.glass_pane )
|
||||
if( blk == Blocks.glass_pane )
|
||||
{
|
||||
return w.setBlock( x, y, z, Blocks.stained_glass_pane, newColor.ordinal(), 3 );
|
||||
}
|
||||
|
||||
if ( blk == Blocks.stained_glass_pane )
|
||||
if( blk == Blocks.stained_glass_pane )
|
||||
{
|
||||
int meta = w.getBlockMetadata( x, y, z );
|
||||
if ( newColor.ordinal() == meta )
|
||||
if( newColor.ordinal() == meta )
|
||||
return false;
|
||||
return w.setBlock( x, y, z, Blocks.stained_glass_pane, newColor.ordinal(), 3 );
|
||||
}
|
||||
|
||||
if ( blk == Blocks.hardened_clay )
|
||||
if( blk == Blocks.hardened_clay )
|
||||
{
|
||||
return w.setBlock( x, y, z, Blocks.stained_hardened_clay, newColor.ordinal(), 3 );
|
||||
}
|
||||
|
||||
if ( blk == Blocks.stained_hardened_clay )
|
||||
if( blk == Blocks.stained_hardened_clay )
|
||||
{
|
||||
int meta = w.getBlockMetadata( x, y, z );
|
||||
if ( newColor.ordinal() == meta )
|
||||
if( newColor.ordinal() == meta )
|
||||
return false;
|
||||
return w.setBlock( x, y, z, Blocks.stained_hardened_clay, newColor.ordinal(), 3 );
|
||||
}
|
||||
|
||||
if ( blk instanceof BlockCableBus )
|
||||
return ( ( BlockCableBus ) blk ).recolourBlock( w, x, y, z, side, newColor.ordinal(), p );
|
||||
if( blk instanceof BlockCableBus )
|
||||
return ( (BlockCableBus) blk ).recolourBlock( w, x, y, z, side, newColor.ordinal(), p );
|
||||
|
||||
return blk.recolourBlock( w, x, y, z, side, newColor.ordinal() );
|
||||
}
|
||||
|
||||
public void cycleColors( ItemStack is, ItemStack paintBall, int i )
|
||||
{
|
||||
if ( paintBall == null )
|
||||
if( paintBall == null )
|
||||
{
|
||||
this.setColor( is, this.getColor( is ) );
|
||||
}
|
||||
@@ -397,10 +394,10 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
|
||||
if ( cdi instanceof CellInventoryHandler )
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
|
||||
if ( cd != null )
|
||||
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
if( cd != null )
|
||||
{
|
||||
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
|
||||
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
|
||||
@@ -429,17 +426,17 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
@Override
|
||||
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
|
||||
{
|
||||
if ( requestedAddition != null )
|
||||
if( requestedAddition != null )
|
||||
{
|
||||
int[] id = OreDictionary.getOreIDs( requestedAddition.getItemStack() );
|
||||
|
||||
for ( int x : id )
|
||||
for( int x : id )
|
||||
{
|
||||
if ( ORE_TO_COLOR.containsKey( x ) )
|
||||
if( ORE_TO_COLOR.containsKey( x ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( requestedAddition.getItem() instanceof ItemSnowball )
|
||||
if( requestedAddition.getItem() instanceof ItemSnowball )
|
||||
return false;
|
||||
|
||||
return !( requestedAddition.getItem() instanceof ItemPaintBall && requestedAddition.getItemDamage() < 20 );
|
||||
@@ -497,7 +494,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
@@ -514,5 +511,4 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
this.cycleColors( is, this.getColor( is ), up ? 1 : -1 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -113,9 +113,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
@Override
|
||||
public boolean equals( Object obj )
|
||||
{
|
||||
if ( obj == null )
|
||||
if( obj == null )
|
||||
return false;
|
||||
if ( this.getClass() != obj.getClass() )
|
||||
if( this.getClass() != obj.getClass() )
|
||||
return false;
|
||||
InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
|
||||
return this.blockID == other.blockID && this.metadata == other.metadata;
|
||||
@@ -126,12 +126,12 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, metadata ) );
|
||||
|
||||
if ( r == null )
|
||||
if( r == null )
|
||||
{
|
||||
r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
|
||||
if ( r.BlockItem != null )
|
||||
if( r.BlockItem != null )
|
||||
{
|
||||
w.setBlock( x, y, z, Block.getBlockFromItem( r.BlockItem.getItem() ), r.BlockItem.getItemDamage(), 3 );
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
|
||||
}
|
||||
|
||||
if ( r.Drops != null )
|
||||
if( r.Drops != null )
|
||||
{
|
||||
Platform.spawnDrops( w, x, y, z, r.Drops );
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, metadata ) );
|
||||
|
||||
if ( r == null )
|
||||
if( r == null )
|
||||
{
|
||||
r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
@@ -162,12 +162,12 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, metadata ) );
|
||||
|
||||
if ( r == null )
|
||||
if( r == null )
|
||||
{
|
||||
r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
|
||||
if ( r.BlockItem != null )
|
||||
if( r.BlockItem != null )
|
||||
{
|
||||
w.setBlock( x, y, z, Block.getBlockFromItem( r.BlockItem.getItem() ), r.BlockItem.getItemDamage(), 3 );
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
|
||||
}
|
||||
|
||||
if ( r.Drops != null )
|
||||
if( r.Drops != null )
|
||||
{
|
||||
Platform.spawnDrops( w, x, y, z, r.Drops );
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, metadata ) );
|
||||
|
||||
if ( r == null )
|
||||
if( r == null )
|
||||
{
|
||||
r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
@@ -197,7 +197,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
@Override
|
||||
public boolean hitEntity( ItemStack item, EntityLivingBase target, EntityLivingBase hitter )
|
||||
{
|
||||
if ( this.getAECurrentPower( item ) > 1600 )
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
this.extractAEPower( item, 1600 );
|
||||
target.setFire( 8 );
|
||||
@@ -211,19 +211,19 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
MovingObjectPosition target = this.getMovingObjectPositionFromPlayer( w, p, true );
|
||||
|
||||
if ( target == null )
|
||||
if( target == null )
|
||||
return item;
|
||||
else
|
||||
{
|
||||
if ( target.typeOfHit == MovingObjectType.BLOCK )
|
||||
if( target.typeOfHit == MovingObjectType.BLOCK )
|
||||
{
|
||||
int x = target.blockX;
|
||||
int y = target.blockY;
|
||||
int z = target.blockZ;
|
||||
|
||||
if ( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water )
|
||||
if( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water )
|
||||
{
|
||||
if ( Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
if( Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
{
|
||||
this.onItemUse( item, p, w, x, y, z, 0, 0.0F, 0.0F, 0.0F );
|
||||
}
|
||||
@@ -237,17 +237,17 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
@Override
|
||||
public boolean onItemUse( ItemStack item, EntityPlayer p, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
if ( this.getAECurrentPower( item ) > 1600 )
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
if ( !p.canPlayerEdit( x, y, z, side, item ) )
|
||||
if( !p.canPlayerEdit( x, y, z, side, item ) )
|
||||
return false;
|
||||
|
||||
Block blockID = w.getBlock( x, y, z );
|
||||
int metadata = w.getBlockMetadata( x, y, z );
|
||||
|
||||
if ( p.isSneaking() )
|
||||
if( p.isSneaking() )
|
||||
{
|
||||
if ( this.canCool( blockID, metadata ) )
|
||||
if( this.canCool( blockID, metadata ) )
|
||||
{
|
||||
this.extractAEPower( item, 1600 );
|
||||
this.cool( blockID, metadata, w, x, y, z );
|
||||
@@ -256,21 +256,21 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( blockID instanceof BlockTNT )
|
||||
if( blockID instanceof BlockTNT )
|
||||
{
|
||||
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
|
||||
( (BlockTNT) blockID ).func_150114_a( w, x, y, z, 1, p );
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( blockID instanceof BlockTinyTNT )
|
||||
if( blockID instanceof BlockTinyTNT )
|
||||
{
|
||||
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
|
||||
( (BlockTinyTNT) blockID ).startFuse( w, x, y, z, p );
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( this.canHeat( blockID, metadata ) )
|
||||
if( this.canHeat( blockID, metadata ) )
|
||||
{
|
||||
this.extractAEPower( item, 1600 );
|
||||
this.heat( blockID, metadata, w, x, y, z );
|
||||
@@ -282,15 +282,15 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
boolean hasFurnaceable = false;
|
||||
boolean canFurnaceable = true;
|
||||
|
||||
for ( ItemStack i : stack )
|
||||
for( ItemStack i : stack )
|
||||
{
|
||||
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult( i );
|
||||
|
||||
if ( result != null )
|
||||
if( result != null )
|
||||
{
|
||||
if ( result.getItem() instanceof ItemBlock )
|
||||
if( result.getItem() instanceof ItemBlock )
|
||||
{
|
||||
if ( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == metadata )
|
||||
if( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == metadata )
|
||||
{
|
||||
canFurnaceable = false;
|
||||
}
|
||||
@@ -305,13 +305,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
}
|
||||
|
||||
if ( hasFurnaceable && canFurnaceable )
|
||||
if( hasFurnaceable && canFurnaceable )
|
||||
{
|
||||
this.extractAEPower( item, 1600 );
|
||||
InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
|
||||
w.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
|
||||
|
||||
if ( or.BlockItem == null )
|
||||
if( or.BlockItem == null )
|
||||
{
|
||||
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
|
||||
}
|
||||
@@ -320,7 +320,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
w.setBlock( x, y, z, Block.getBlockFromItem( or.BlockItem.getItem() ), or.BlockItem.getItemDamage(), 3 );
|
||||
}
|
||||
|
||||
if ( or.Drops != null )
|
||||
if( or.Drops != null )
|
||||
{
|
||||
Platform.spawnDrops( w, x, y, z, or.Drops );
|
||||
}
|
||||
@@ -334,10 +334,10 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
y += dir.offsetY;
|
||||
z += dir.offsetZ;
|
||||
|
||||
if ( !p.canPlayerEdit( x, y, z, side, item ) )
|
||||
if( !p.canPlayerEdit( x, y, z, side, item ) )
|
||||
return false;
|
||||
|
||||
if ( w.isAirBlock( x, y, z ) )
|
||||
if( w.isAirBlock( x, y, z ) )
|
||||
{
|
||||
this.extractAEPower( item, 1600 );
|
||||
w.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
public ToolMassCannon()
|
||||
{
|
||||
super( AEConfig.instance.matterCannonBattery, Optional.<String> absent() );
|
||||
super( AEConfig.instance.matterCannonBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.MatterCannon, AEFeature.PoweredTools ) );
|
||||
}
|
||||
|
||||
@@ -101,10 +101,10 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
|
||||
if ( cdi instanceof CellInventoryHandler )
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
|
||||
if ( cd != null )
|
||||
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
if( cd != null )
|
||||
{
|
||||
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
|
||||
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
|
||||
@@ -115,37 +115,37 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer p )
|
||||
{
|
||||
if ( this.getAECurrentPower( item ) > 1600 )
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
int shots = 1;
|
||||
|
||||
CellUpgrades cu = ( CellUpgrades ) this.getUpgradesInventory( item );
|
||||
if ( cu != null )
|
||||
CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
|
||||
if( cu != null )
|
||||
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
|
||||
|
||||
IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
|
||||
if ( inv != null )
|
||||
if( inv != null )
|
||||
{
|
||||
IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
IAEStack aeAmmo = itemList.getFirstItem();
|
||||
if ( aeAmmo instanceof IAEItemStack )
|
||||
if( aeAmmo instanceof IAEItemStack )
|
||||
{
|
||||
shots = Math.min( shots, ( int ) aeAmmo.getStackSize() );
|
||||
for ( int sh = 0; sh < shots; sh++ )
|
||||
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
|
||||
for( int sh = 0; sh < shots; sh++ )
|
||||
{
|
||||
this.extractAEPower( item, 1600 );
|
||||
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return item;
|
||||
|
||||
aeAmmo.setStackSize( 1 );
|
||||
ItemStack ammo = ( ( IAEItemStack ) aeAmmo ).getItemStack();
|
||||
if ( ammo == null )
|
||||
ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
if( ammo == null )
|
||||
return item;
|
||||
|
||||
ammo.stackSize = 1;
|
||||
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
|
||||
if ( aeAmmo == null )
|
||||
if( aeAmmo == null )
|
||||
return item;
|
||||
|
||||
float f = 1.0F;
|
||||
@@ -155,8 +155,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
double d1 = p.prevPosY + ( p.posY - p.prevPosY ) * f + 1.62D - p.yOffset;
|
||||
double d2 = p.prevPosZ + ( p.posZ - p.prevPosZ ) * f;
|
||||
Vec3 vec3 = Vec3.createVectorHelper( d0, d1, d2 );
|
||||
float f3 = MathHelper.cos( -f2 * 0.017453292F - ( float ) Math.PI );
|
||||
float f4 = MathHelper.sin( -f2 * 0.017453292F - ( float ) Math.PI );
|
||||
float f3 = MathHelper.cos( -f2 * 0.017453292F - (float) Math.PI );
|
||||
float f4 = MathHelper.sin( -f2 * 0.017453292F - (float) Math.PI );
|
||||
float f5 = -MathHelper.cos( -f1 * 0.017453292F );
|
||||
float f6 = MathHelper.sin( -f1 * 0.017453292F );
|
||||
float f7 = f4 * f5;
|
||||
@@ -168,10 +168,10 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
direction.normalize();
|
||||
|
||||
float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
|
||||
if ( penetration <= 0 )
|
||||
if( penetration <= 0 )
|
||||
{
|
||||
ItemStack type = ( ( IAEItemStack ) aeAmmo ).getItemStack();
|
||||
if ( type.getItem() instanceof ItemPaintBall )
|
||||
ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
if( type.getItem() instanceof ItemPaintBall )
|
||||
{
|
||||
this.shootPaintBalls( type, w, p, vec3, vec31, direction, d0, d1, d2 );
|
||||
}
|
||||
@@ -181,12 +181,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
{
|
||||
this.standardAmmo( penetration, w, p, vec3, vec31, direction, d0, d1, d2 );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
if( Platform.isServer() )
|
||||
p.addChatMessage( PlayerMessages.AmmoDepleted.get() );
|
||||
return item;
|
||||
}
|
||||
@@ -197,25 +196,23 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
private void shootPaintBalls( ItemStack type, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
|
||||
{
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( 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 );
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( 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 );
|
||||
double closest = 9999999.0D;
|
||||
int l;
|
||||
|
||||
for ( l = 0; l < list.size(); ++l )
|
||||
for( l = 0; l < list.size(); ++l )
|
||||
{
|
||||
Entity entity1 = ( Entity ) list.get( l );
|
||||
Entity entity1 = (Entity) list.get( l );
|
||||
|
||||
if ( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
{
|
||||
if ( entity1.isEntityAlive() )
|
||||
if( entity1.isEntityAlive() )
|
||||
{
|
||||
// prevent killing / flying of mounts.
|
||||
if ( entity1.riddenByEntity == p )
|
||||
if( entity1.riddenByEntity == p )
|
||||
continue;
|
||||
|
||||
float f1 = 0.3F;
|
||||
@@ -223,11 +220,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
|
||||
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
|
||||
|
||||
if ( movingObjectPosition != null )
|
||||
if( movingObjectPosition != null )
|
||||
{
|
||||
double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
|
||||
|
||||
if ( nd < closest )
|
||||
if( nd < closest )
|
||||
{
|
||||
entity = entity1;
|
||||
closest = nd;
|
||||
@@ -240,49 +237,47 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, false );
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper( d0, d1, d2 );
|
||||
if ( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
|
||||
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
|
||||
{
|
||||
pos = new MovingObjectPosition( entity );
|
||||
}
|
||||
else if ( entity != null && pos == null )
|
||||
else if( entity != null && pos == null )
|
||||
{
|
||||
pos = new MovingObjectPosition( entity );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
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 ) ) );
|
||||
|
||||
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( Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
}
|
||||
|
||||
if ( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
|
||||
if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
|
||||
{
|
||||
ItemPaintBall ipb = ( ItemPaintBall ) type.getItem();
|
||||
ItemPaintBall ipb = (ItemPaintBall) type.getItem();
|
||||
|
||||
AEColor col = ipb.getColor( type );
|
||||
// boolean lit = ipb.isLumen( type );
|
||||
|
||||
if ( pos.typeOfHit == MovingObjectType.ENTITY )
|
||||
if( pos.typeOfHit == MovingObjectType.ENTITY )
|
||||
{
|
||||
int id = pos.entityHit.getEntityId();
|
||||
PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
|
||||
TickHandler.INSTANCE.getPlayerColors().put( id, marker );
|
||||
|
||||
if ( pos.entityHit instanceof EntitySheep )
|
||||
if( pos.entityHit instanceof EntitySheep )
|
||||
{
|
||||
EntitySheep sh = ( EntitySheep ) pos.entityHit;
|
||||
EntitySheep sh = (EntitySheep) pos.entityHit;
|
||||
sh.setFleeceColor( col.ordinal() );
|
||||
}
|
||||
|
||||
pos.entityHit.attackEntityFrom( DamageSource.causePlayerDamage( p ), 0 );
|
||||
NetworkHandler.instance.sendToAll( marker.getPacket() );
|
||||
}
|
||||
else if ( pos.typeOfHit == MovingObjectType.BLOCK )
|
||||
else if( pos.typeOfHit == MovingObjectType.BLOCK )
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation( pos.sideHit );
|
||||
|
||||
@@ -290,57 +285,54 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
int y = pos.blockY + side.offsetY;
|
||||
int z = pos.blockZ + side.offsetZ;
|
||||
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
return;
|
||||
|
||||
Block whatsThere = w.getBlock( x, y, z );
|
||||
if ( whatsThere.isReplaceable( w, x, y, z ) && w.isAirBlock( x, y, z ) )
|
||||
if( whatsThere.isReplaceable( w, x, y, z ) && w.isAirBlock( x, y, z ) )
|
||||
{
|
||||
for ( Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
|
||||
for( Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
|
||||
{
|
||||
w.setBlock( x, y, z, paintBlock, 0, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
if ( te instanceof TilePaint )
|
||||
if( te instanceof TilePaint )
|
||||
{
|
||||
pos.hitVec.xCoord -= x;
|
||||
pos.hitVec.yCoord -= y;
|
||||
pos.hitVec.zCoord -= z;
|
||||
( ( TilePaint ) te ).addBlot( type, side.getOpposite(), pos.hitVec );
|
||||
( (TilePaint) te ).addBlot( type, side.getOpposite(), pos.hitVec );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void standardAmmo( float penetration, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
|
||||
{
|
||||
boolean hasDestroyedSomething = true;
|
||||
while ( penetration > 0 && hasDestroyedSomething )
|
||||
while( penetration > 0 && hasDestroyedSomething )
|
||||
{
|
||||
hasDestroyedSomething = false;
|
||||
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( 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 );
|
||||
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( 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 );
|
||||
double closest = 9999999.0D;
|
||||
int l;
|
||||
|
||||
for ( l = 0; l < list.size(); ++l )
|
||||
for( l = 0; l < list.size(); ++l )
|
||||
{
|
||||
Entity entity1 = ( Entity ) list.get( l );
|
||||
Entity entity1 = (Entity) list.get( l );
|
||||
|
||||
if ( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
{
|
||||
if ( entity1.isEntityAlive() )
|
||||
if( entity1.isEntityAlive() )
|
||||
{
|
||||
// prevent killing / flying of mounts.
|
||||
if ( entity1.riddenByEntity == p )
|
||||
if( entity1.riddenByEntity == p )
|
||||
continue;
|
||||
|
||||
float f1 = 0.3F;
|
||||
@@ -348,11 +340,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
|
||||
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
|
||||
|
||||
if ( movingObjectPosition != null )
|
||||
if( movingObjectPosition != null )
|
||||
{
|
||||
double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
|
||||
|
||||
if ( nd < closest )
|
||||
if( nd < closest )
|
||||
{
|
||||
entity = entity1;
|
||||
closest = nd;
|
||||
@@ -364,58 +356,56 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
Vec3 vec = Vec3.createVectorHelper( d0, d1, d2 );
|
||||
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, true );
|
||||
if ( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
|
||||
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
|
||||
{
|
||||
pos = new MovingObjectPosition( entity );
|
||||
}
|
||||
else if ( entity != null && pos == null )
|
||||
else if( entity != null && pos == null )
|
||||
{
|
||||
pos = new MovingObjectPosition( entity );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
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 ) ) );
|
||||
|
||||
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( Exception err )
|
||||
{
|
||||
AELog.error( err );
|
||||
}
|
||||
|
||||
if ( pos != null )
|
||||
if( pos != null )
|
||||
{
|
||||
DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
|
||||
dmgSrc.damageType = "masscannon";
|
||||
|
||||
if ( pos.typeOfHit == MovingObjectType.ENTITY )
|
||||
if( pos.typeOfHit == MovingObjectType.ENTITY )
|
||||
{
|
||||
int dmg = ( int ) Math.ceil( penetration / 20.0f );
|
||||
if ( pos.entityHit instanceof EntityLivingBase )
|
||||
int dmg = (int) Math.ceil( penetration / 20.0f );
|
||||
if( pos.entityHit instanceof EntityLivingBase )
|
||||
{
|
||||
EntityLivingBase el = ( EntityLivingBase ) pos.entityHit;
|
||||
EntityLivingBase el = (EntityLivingBase) pos.entityHit;
|
||||
penetration -= dmg;
|
||||
el.knockBack( p, 0, -direction.xCoord, -direction.zCoord );
|
||||
// el.knockBack( p, 0, vec3.xCoord,
|
||||
// vec3.zCoord );
|
||||
el.attackEntityFrom( dmgSrc, dmg );
|
||||
if ( !el.isEntityAlive() )
|
||||
if( !el.isEntityAlive() )
|
||||
hasDestroyedSomething = true;
|
||||
}
|
||||
else if ( pos.entityHit instanceof EntityItem )
|
||||
else if( pos.entityHit instanceof EntityItem )
|
||||
{
|
||||
hasDestroyedSomething = true;
|
||||
pos.entityHit.setDead();
|
||||
}
|
||||
else if ( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
|
||||
else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
|
||||
{
|
||||
hasDestroyedSomething = true;
|
||||
}
|
||||
}
|
||||
else if ( pos.typeOfHit == MovingObjectType.BLOCK )
|
||||
else if( pos.typeOfHit == MovingObjectType.BLOCK )
|
||||
{
|
||||
if ( !AEConfig.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) )
|
||||
if( !AEConfig.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) )
|
||||
penetration = 0;
|
||||
else
|
||||
{
|
||||
@@ -424,9 +414,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
// pos.blockX, pos.blockY, pos.blockZ );
|
||||
|
||||
float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
|
||||
if ( hardness >= 0.0 )
|
||||
if( hardness >= 0.0 )
|
||||
{
|
||||
if ( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.blockX, pos.blockY, pos.blockZ ), p ) )
|
||||
if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.blockX, pos.blockY, pos.blockZ ), p ) )
|
||||
{
|
||||
hasDestroyedSomething = true;
|
||||
penetration -= hardness;
|
||||
@@ -467,7 +457,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
@@ -501,10 +491,10 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
|
||||
{
|
||||
float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
|
||||
if ( pen > 0 )
|
||||
if( pen > 0 )
|
||||
return false;
|
||||
|
||||
if ( requestedAddition.getItem() instanceof ItemPaintBall )
|
||||
if( requestedAddition.getItem() instanceof ItemPaintBall )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -61,17 +61,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
{
|
||||
public ToolPortableCell()
|
||||
{
|
||||
super( AEConfig.instance.portableCellBattery, Optional.<String> absent() );
|
||||
super( AEConfig.instance.portableCellBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.PortableCell, AEFeature.StorageCells, AEFeature.PoweredTools ) );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer player )
|
||||
{
|
||||
@@ -79,6 +72,13 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
return item;
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
||||
{
|
||||
@@ -86,10 +86,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
|
||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||
|
||||
if ( cdi instanceof CellInventoryHandler )
|
||||
if( cdi instanceof CellInventoryHandler )
|
||||
{
|
||||
ICellInventory cd = ( ( ICellInventoryHandler ) cdi ).getCellInv();
|
||||
if ( cd != null )
|
||||
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
|
||||
if( cd != null )
|
||||
{
|
||||
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
|
||||
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
|
||||
@@ -171,7 +171,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
{
|
||||
return FuzzyMode.valueOf( fz );
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
|
||||
@@ -54,17 +54,10 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
|
||||
public ToolWirelessTerminal()
|
||||
{
|
||||
super( AEConfig.instance.wirelessTerminalBattery, Optional.<String> absent() );
|
||||
super( AEConfig.instance.wirelessTerminalBattery, Optional.<String>absent() );
|
||||
this.setFeature( EnumSet.of( AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools ) );
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer player )
|
||||
{
|
||||
@@ -72,19 +65,26 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
return item;
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
||||
{
|
||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
||||
|
||||
if ( stack.hasTagCompound() )
|
||||
if( stack.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound tag = Platform.openNbtData( stack );
|
||||
if ( tag != null )
|
||||
if( tag != null )
|
||||
{
|
||||
String encKey = tag.getString( "encryptionKey" );
|
||||
|
||||
if ( encKey == null || encKey.isEmpty() )
|
||||
if( encKey == null || encKey.isEmpty() )
|
||||
lines.add( GuiText.Unlinked.getLocal() );
|
||||
else
|
||||
lines.add( GuiText.Linked.getLocal() );
|
||||
@@ -115,7 +115,8 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
@Override
|
||||
public IConfigManager getConfigManager( final ItemStack target )
|
||||
{
|
||||
final ConfigManager out = new ConfigManager( new IConfigManagerHost(){
|
||||
final ConfigManager out = new ConfigManager( new IConfigManagerHost()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||
@@ -123,14 +124,13 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
NBTTagCompound data = Platform.openNbtData( target );
|
||||
manager.writeToNBT( data );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
out.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||
out.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||
out.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||
|
||||
out.readFromNBT( ( NBTTagCompound ) Platform.openNbtData( target ).copy() );
|
||||
out.readFromNBT( (NBTTagCompound) Platform.openNbtData( target ).copy() );
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -148,5 +148,4 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
tag.setString( "encryptionKey", encKey );
|
||||
tag.setString( "name", name );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,16 +60,14 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
double internalCurrentPower = 0;
|
||||
double internalMaxPower = this.getAEMaxPower( stack );
|
||||
|
||||
if ( tag != null )
|
||||
if( tag != null )
|
||||
{
|
||||
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
|
||||
}
|
||||
|
||||
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 ) );
|
||||
|
||||
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,15 +112,50 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
}
|
||||
|
||||
private double getInternalBattery( ItemStack is, batteryOperation op, double adjustment )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( is );
|
||||
|
||||
double currentStorage = data.getDouble( this.POWER_NBT_KEY );
|
||||
double maxStorage = this.getAEMaxPower( is );
|
||||
|
||||
switch( op )
|
||||
{
|
||||
case INJECT:
|
||||
currentStorage += adjustment;
|
||||
if( currentStorage > maxStorage )
|
||||
{
|
||||
double diff = currentStorage - maxStorage;
|
||||
data.setDouble( this.POWER_NBT_KEY, maxStorage );
|
||||
return diff;
|
||||
}
|
||||
data.setDouble( this.POWER_NBT_KEY, currentStorage );
|
||||
return 0;
|
||||
case EXTRACT:
|
||||
if( currentStorage > adjustment )
|
||||
{
|
||||
currentStorage -= adjustment;
|
||||
data.setDouble( this.POWER_NBT_KEY, currentStorage );
|
||||
return adjustment;
|
||||
}
|
||||
data.setDouble( this.POWER_NBT_KEY, 0 );
|
||||
return currentStorage;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return currentStorage;
|
||||
}
|
||||
|
||||
/**
|
||||
* inject external
|
||||
*/
|
||||
double injectExternalPower( PowerUnits input, ItemStack is, double amount, boolean simulate )
|
||||
{
|
||||
if ( simulate )
|
||||
if( simulate )
|
||||
{
|
||||
int requiredEU = ( int ) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
|
||||
if ( amount < requiredEU )
|
||||
int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
|
||||
if( amount < requiredEU )
|
||||
return 0;
|
||||
return amount - requiredEU;
|
||||
}
|
||||
@@ -145,41 +178,6 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
return this.getInternalBattery( is, batteryOperation.EXTRACT, amt );
|
||||
}
|
||||
|
||||
private double getInternalBattery( ItemStack is, batteryOperation op, double adjustment )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( is );
|
||||
|
||||
double currentStorage = data.getDouble( this.POWER_NBT_KEY );
|
||||
double maxStorage = this.getAEMaxPower( is );
|
||||
|
||||
switch ( op )
|
||||
{
|
||||
case INJECT:
|
||||
currentStorage += adjustment;
|
||||
if ( currentStorage > maxStorage )
|
||||
{
|
||||
double diff = currentStorage - maxStorage;
|
||||
data.setDouble( this.POWER_NBT_KEY, maxStorage );
|
||||
return diff;
|
||||
}
|
||||
data.setDouble( this.POWER_NBT_KEY, currentStorage );
|
||||
return 0;
|
||||
case EXTRACT:
|
||||
if ( currentStorage > adjustment )
|
||||
{
|
||||
currentStorage -= adjustment;
|
||||
data.setDouble( this.POWER_NBT_KEY, currentStorage );
|
||||
return adjustment;
|
||||
}
|
||||
data.setDouble( this.POWER_NBT_KEY, 0 );
|
||||
return currentStorage;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return currentStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAEMaxPower( ItemStack is )
|
||||
{
|
||||
@@ -202,5 +200,4 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
{
|
||||
STORAGE, INJECT, EXTRACT
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,8 +33,7 @@ import appeng.transformer.annotations.Integration.InterfaceList;
|
||||
import appeng.transformer.annotations.Integration.Method;
|
||||
|
||||
|
||||
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ),
|
||||
@Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } )
|
||||
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ), @Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } )
|
||||
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
|
||||
{
|
||||
public IC2( double powerCapacity, Optional<String> subName )
|
||||
@@ -48,10 +47,10 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
|
||||
double addedAmt = amount;
|
||||
double limit = this.getTransferLimit( is );
|
||||
|
||||
if ( !ignoreTransferLimit && amount > limit )
|
||||
if( !ignoreTransferLimit && amount > limit )
|
||||
addedAmt = limit;
|
||||
|
||||
return addedAmt - ( ( int ) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
||||
return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +62,7 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
|
||||
@Override
|
||||
public double getCharge( ItemStack is )
|
||||
{
|
||||
return ( int ) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +74,7 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
|
||||
@Override
|
||||
public boolean use( ItemStack is, double amount, EntityLivingBase entity )
|
||||
{
|
||||
if ( this.canUse( is, amount ) )
|
||||
if( this.canUse( is, amount ) )
|
||||
{
|
||||
// use the power..
|
||||
this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
@@ -138,5 +137,4 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
@Override
|
||||
public boolean onItemUse( ItemStack is, EntityPlayer p, World w, int x, int y, int z, int s, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
if( Platform.isServer() )
|
||||
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
|
||||
return true;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
@Override
|
||||
public ItemStack onItemRightClick( ItemStack it, World w, EntityPlayer p )
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
if( Platform.isServer() )
|
||||
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
|
||||
p.swingItem();
|
||||
return it;
|
||||
@@ -104,5 +104,4 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
{
|
||||
return new QuartzKnifeObj( is );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
@@ -21,11 +21,11 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
@@ -55,13 +55,13 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
|
||||
public boolean onItemUseFirst( ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
Block b = world.getBlock( x, y, z );
|
||||
if ( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
|
||||
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
if( Platform.isClient() )
|
||||
return !world.isRemote;
|
||||
|
||||
ForgeDirection mySide = ForgeDirection.getOrientation( side );
|
||||
if ( b.rotateBlock( world, x, y, z, mySide ) )
|
||||
if( b.rotateBlock( world, x, y, z, mySide ) )
|
||||
{
|
||||
b.onNeighborBlockChange( world, x, y, z, Platform.AIR );
|
||||
player.swingItem();
|
||||
@@ -95,5 +95,4 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
|
||||
{
|
||||
player.swingItem();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user