Fixes #675 No disabled feature should log spam or crash anymore.

Deprecates the old usage of the AEItemDefinitions via the direct method access of

* blocks()
* parts()
* items()
* materials()

and thus use the new re-direct via definitions().

All definitions are now initialized, no matter what. But SubItems, Items and Blocks are not registered, if by chance are disabled.
This commit is contained in:
thatsIch
2015-01-03 02:53:14 +01:00
parent 3dd81433ac
commit 9986ffc458
385 changed files with 12477 additions and 8292 deletions
@@ -18,11 +18,10 @@
package appeng.items.tools;
import java.util.EnumSet;
import java.util.List;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -31,6 +30,8 @@ import net.minecraft.nbt.NBTUtil;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import com.mojang.authlib.GameProfile;
import appeng.api.config.SecurityPermissions;
import appeng.api.features.IPlayerRegistry;
import appeng.api.implementations.items.IBiometricCard;
@@ -41,26 +42,33 @@ import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
{
public ToolBiometricCard() {
super( ToolBiometricCard.class );
public ToolBiometricCard()
{
this.setFeature( EnumSet.of( AEFeature.Security ) );
this.setMaxStackSize( 1 );
if ( Platform.isClient() )
MinecraftForgeClient.registerItemRenderer( this, new ToolBiometricCardRender() );
}
@Override
public String getItemStackDisplayName(ItemStack is)
public ItemStack onItemRightClick( ItemStack is, World w, EntityPlayer p )
{
GameProfile username = this.getProfile( is );
return username != null ? super.getItemStackDisplayName( is ) + " - " + username.getName() : super.getItemStackDisplayName( is );
if ( p.isSneaking() )
{
this.encode( is, p );
p.swingItem();
return is;
}
return is;
}
@Override
public boolean itemInteractionForEntity(ItemStack is, EntityPlayer par2EntityPlayer, EntityLivingBase target)
public boolean itemInteractionForEntity( ItemStack is, EntityPlayer par2EntityPlayer, EntityLivingBase target )
{
if ( target instanceof EntityPlayer && !par2EntityPlayer.isSneaking() )
{
@@ -74,66 +82,53 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
}
@Override
public ItemStack onItemRightClick(ItemStack is, World w, EntityPlayer p)
public String getItemStackDisplayName( ItemStack is )
{
if ( p.isSneaking() )
{
this.encode( is, p );
p.swingItem();
return is;
}
return is;
GameProfile username = this.getProfile( is );
return username != null ? super.getItemStackDisplayName( is ) + " - " + username.getName() : super.getItemStackDisplayName( is );
}
private void encode(ItemStack is, EntityPlayer p)
private void encode( ItemStack is, EntityPlayer p )
{
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() );
}
@Override
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void setProfile( ItemStack itemStack, GameProfile profile )
{
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
if ( perms.isEmpty() )
lines.add( GuiText.NoPermissions.getLocal() );
else
NBTTagCompound tag = Platform.openNbtData( itemStack );
if ( profile != null )
{
String msg = null;
for (SecurityPermissions sp : perms)
{
if ( msg == null )
msg = Platform.gui_localize( sp.getUnlocalizedName() );
else
msg = msg + ", " + Platform.gui_localize( sp.getUnlocalizedName() );
}
lines.add( msg );
NBTTagCompound pNBT = new NBTTagCompound();
NBTUtil.func_152460_a( pNBT, profile );
tag.setTag( "profile", pNBT );
}
else
tag.removeTag( "profile" );
}
@Override
public GameProfile getProfile(ItemStack is)
public GameProfile getProfile( ItemStack is )
{
NBTTagCompound tag = Platform.openNbtData( is );
if ( tag.hasKey("profile") )
return NBTUtil.func_152459_a(tag.getCompoundTag("profile") );
if ( tag.hasKey( "profile" ) )
return NBTUtil.func_152459_a( tag.getCompoundTag( "profile" ) );
return null;
}
@Override
public EnumSet<SecurityPermissions> getPermissions(ItemStack is)
public EnumSet<SecurityPermissions> getPermissions( ItemStack is )
{
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() ) )
result.add( sp );
@@ -143,29 +138,14 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
}
@Override
public boolean hasPermission(ItemStack is, SecurityPermissions permission)
public boolean hasPermission( ItemStack is, SecurityPermissions permission )
{
NBTTagCompound tag = Platform.openNbtData( is );
return tag.getBoolean( permission.name() );
}
@Override
public void setProfile(ItemStack itemStack, GameProfile profile)
{
NBTTagCompound tag = Platform.openNbtData( itemStack );
if ( profile!= null )
{
NBTTagCompound pNBT = new NBTTagCompound();
NBTUtil.func_152460_a( pNBT, profile );
tag.setTag( "profile", pNBT );
}
else
tag.removeTag("profile");
}
@Override
public void removePermission(ItemStack itemStack, SecurityPermissions permission)
public void removePermission( ItemStack itemStack, SecurityPermissions permission )
{
NBTTagCompound tag = Platform.openNbtData( itemStack );
if ( tag.hasKey( permission.name() ) )
@@ -173,15 +153,36 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
}
@Override
public void addPermission(ItemStack itemStack, SecurityPermissions permission)
public void addPermission( ItemStack itemStack, SecurityPermissions permission )
{
NBTTagCompound tag = Platform.openNbtData( itemStack );
tag.setBoolean( permission.name(), true );
}
@Override
public void registerPermissions(ISecurityRegistry register, IPlayerRegistry pr, ItemStack is)
public void registerPermissions( ISecurityRegistry register, IPlayerRegistry pr, ItemStack is )
{
register.addPlayer( pr.getID( this.getProfile( is ) ), this.getPermissions( is ) );
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
if ( perms.isEmpty() )
lines.add( GuiText.NoPermissions.getLocal() );
else
{
String msg = null;
for ( SecurityPermissions sp : perms )
{
if ( msg == null )
msg = Platform.gui_localize( sp.getUnlocalizedName() );
else
msg = msg + ", " + Platform.gui_localize( sp.getUnlocalizedName() );
}
lines.add( msg );
}
}
}
@@ -36,38 +36,17 @@ import appeng.core.localization.PlayerMessages;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
{
public ToolMemoryCard() {
super( ToolMemoryCard.class );
public ToolMemoryCard()
{
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setMaxStackSize( 1 );
}
/**
* Find the localized string...
*
* @param name possible names for the localized string
* @return localized name
*/
private String getLocalizedName(String... name)
{
for (String n : name)
{
String l = StatCollector.translateToLocal( n );
if ( !l.equals( n ) )
return l;
}
for (String n : name)
return n;
return "";
}
@Override
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
{
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
@@ -76,22 +55,38 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
lines.add( StatCollector.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
}
@Override
public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player)
/**
* Find the localized string...
*
* @param name possible names for the localized string
*
* @return localized name
*/
private String getLocalizedName( String... name )
{
return true;
for ( String n : name )
{
String l = StatCollector.translateToLocal( n );
if ( !l.equals( n ) )
return l;
}
for ( String n : name )
return n;
return "";
}
@Override
public void setMemoryCardContents(ItemStack is, String SettingsName, NBTTagCompound data)
public void setMemoryCardContents( ItemStack is, String settingsName, NBTTagCompound data )
{
NBTTagCompound c = Platform.openNbtData( is );
c.setString( "Config", SettingsName );
c.setString( "Config", settingsName );
c.setTag( "Data", data );
}
@Override
public String getSettingsName(ItemStack is)
public String getSettingsName( ItemStack is )
{
NBTTagCompound c = Platform.openNbtData( is );
String name = c.getString( "Config" );
@@ -99,7 +94,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
}
@Override
public NBTTagCompound getData(ItemStack is)
public NBTTagCompound getData( ItemStack is )
{
NBTTagCompound c = Platform.openNbtData( is );
NBTTagCompound o = c.getCompoundTag( "Data" );
@@ -109,7 +104,31 @@ 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)
public void notifyUser( EntityPlayer player, MemoryCardMessages msg )
{
if ( Platform.isClient() )
return;
switch ( msg )
{
case SETTINGS_CLEARED:
player.addChatMessage( PlayerMessages.SettingCleared.get() );
break;
case INVALID_MACHINE:
player.addChatMessage( PlayerMessages.InvalidMachine.get() );
break;
case SETTINGS_LOADED:
player.addChatMessage( PlayerMessages.LoadedSettings.get() );
break;
case SETTINGS_SAVED:
player.addChatMessage( PlayerMessages.SavedSettings.get() );
break;
default:
}
}
@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 )
{
@@ -123,27 +142,8 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
}
@Override
public void notifyUser(EntityPlayer player, MemoryCardMessages msg)
public boolean doesSneakBypassUse( World world, int x, int y, int z, EntityPlayer player )
{
if ( Platform.isClient() )
return;
switch (msg)
{
case SETTINGS_CLEARED:
player.addChatMessage( PlayerMessages.SettingCleared.get() );
break;
case INVALID_MACHINE:
player.addChatMessage( PlayerMessages.InvalidMachine.get() );
break;
case SETTINGS_LOADED:
player.addChatMessage( PlayerMessages.LoadedSettings.get() );
break;
case SETTINGS_SAVED:
player.addChatMessage( PlayerMessages.SavedSettings.get() );
break;
default:
}
return true;
}
}
@@ -21,8 +21,6 @@ package appeng.items.tools;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -33,6 +31,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.tools.IToolWrench;
import com.google.common.base.Optional;
import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject;
@@ -60,7 +59,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
public ToolNetworkTool()
{
super( ToolNetworkTool.class, Optional.<String> absent() );
super( Optional.<String> absent() );
this.setFeature( EnumSet.of( AEFeature.NetworkTool ) );
this.setMaxStackSize( 1 );
@@ -21,12 +21,12 @@ package appeng.items.tools.powered;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import com.google.common.base.Optional;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.core.sync.packets.PacketLightning;
@@ -40,9 +40,8 @@ public class ToolChargedStaff extends AEBasePoweredItem
public ToolChargedStaff()
{
super( ToolChargedStaff.class, Optional.<String> absent() );
super( AEConfig.instance.chargedStaffBattery, Optional.<String> absent() );
this.setFeature( EnumSet.of( AEFeature.ChargedStaff, AEFeature.PoweredTools ) );
this.maxStoredPower = AEConfig.instance.chargedStaffBattery;
}
@Override
@@ -28,8 +28,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.player.EntityPlayer;
@@ -44,6 +42,8 @@ import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.oredict.OreDictionary;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@@ -99,9 +99,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
public ToolColorApplicator()
{
super( ToolColorApplicator.class, Optional.<String> absent() );
super( AEConfig.instance.colorApplicatorBattery, Optional.<String> absent() );
this.setFeature( EnumSet.of( AEFeature.ColorApplicator, AEFeature.PoweredTools ) );
this.maxStoredPower = AEConfig.instance.colorApplicatorBattery;
if ( Platform.isClient() )
MinecraftForgeClient.registerItemRenderer( this, new ToolColorApplicatorRender() );
}
@@ -62,15 +62,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
public ToolEntropyManipulator()
{
super( ToolEntropyManipulator.class, Optional.<String>absent() );
super( AEConfig.instance.entropyManipulatorBattery, Optional.<String>absent() );
this.setFeature( EnumSet.of( AEFeature.EntropyManipulator, AEFeature.PoweredTools ) );
this.heatUp = new HashMap<InWorldToolOperationIngredient, InWorldToolOperationResult>();
this.coolDown = new HashMap<InWorldToolOperationIngredient, InWorldToolOperationResult>();
this.maxStoredPower = AEConfig.instance.entropyManipulatorBattery;
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.stone, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.cobblestone ) ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.stonebrick, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.stonebrick, 1, 2 ) ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.lava, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.obsidian ) ) );
@@ -22,8 +22,6 @@ package appeng.items.tools.powered;
import java.util.EnumSet;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.Entity;
@@ -43,6 +41,8 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
@@ -83,9 +83,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
public ToolMassCannon()
{
super( ToolMassCannon.class, Optional.<String> absent() );
super( AEConfig.instance.matterCannonBattery, Optional.<String> absent() );
this.setFeature( EnumSet.of( AEFeature.MatterCannon, AEFeature.PoweredTools ) );
this.maxStoredPower = AEConfig.instance.matterCannonBattery;
}
@Override
@@ -297,7 +296,10 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
Block whatsThere = w.getBlock( x, y, z );
if ( whatsThere.isReplaceable( w, x, y, z ) && w.isAirBlock( x, y, z ) )
{
w.setBlock( x, y, z, AEApi.instance().blocks().blockPaint.block(), 0, 3 );
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 );
@@ -23,8 +23,6 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import com.google.common.base.Optional;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -34,6 +32,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.guiobjects.IGuiItem;
@@ -61,9 +61,8 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
{
public ToolPortableCell()
{
super( ToolPortableCell.class, Optional.<String> absent() );
super( AEConfig.instance.portableCellBattery, Optional.<String> absent() );
this.setFeature( EnumSet.of( AEFeature.PortableCell, AEFeature.StorageCells, AEFeature.PoweredTools ) );
this.maxStoredPower = AEConfig.instance.portableCellBattery;
}
@SideOnly(Side.CLIENT)
@@ -22,8 +22,6 @@ package appeng.items.tools.powered;
import java.util.EnumSet;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -33,6 +31,8 @@ import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import com.google.common.base.Optional;
import appeng.api.AEApi;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
@@ -54,9 +54,8 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
public ToolWirelessTerminal()
{
super( ToolWirelessTerminal.class, Optional.<String> absent() );
super( AEConfig.instance.wirelessTerminalBattery, Optional.<String> absent() );
this.setFeature( EnumSet.of( AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools ) );
this.maxStoredPower = AEConfig.instance.wirelessTerminalBattery;
}
@SideOnly(Side.CLIENT)
@@ -98,7 +97,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
@Override
public boolean canHandle( ItemStack is )
{
return AEApi.instance().items().itemWirelessTerminal.sameAsStack( is );
return AEApi.instance().definitions().items().wirelessTerminal().isSameAs( is );
}
@Override
@@ -22,12 +22,11 @@ package appeng.items.tools.powered.powersink;
import com.google.common.base.Optional;
public class AEBasePoweredItem extends RedstoneFlux
public abstract class AEBasePoweredItem extends RedstoneFlux
{
public AEBasePoweredItem( Class c, Optional<String> subName )
public AEBasePoweredItem( double powerCapacity, Optional<String> subName )
{
super( c, subName );
super( powerCapacity, subName );
this.setMaxStackSize( 1 );
}
@@ -22,14 +22,14 @@ package appeng.items.tools.powered.powersink;
import java.text.MessageFormat;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import com.google.common.base.Optional;
import appeng.api.config.AccessRestriction;
import appeng.api.config.PowerUnits;
import appeng.api.implementations.items.IAEItemPowerStorage;
@@ -38,18 +38,19 @@ import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
{
private static final String POWER_NBT_KEY = "internalCurrentPower";
private final double powerCapacity;
final String EnergyVar = "internalCurrentPower";
public double maxStoredPower = 200000;
public AERootPoweredItem( Class c, Optional<String> subName )
public AERootPoweredItem( double powerCapacity, Optional<String> subName )
{
super( c, subName );
super( subName );
this.setMaxDamage( 32 );
this.hasSubtypes = false;
this.setFull3D();
this.powerCapacity = powerCapacity;
}
@Override
@@ -148,7 +149,7 @@ public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
{
NBTTagCompound data = Platform.openNbtData( is );
double currentStorage = data.getDouble( this.EnergyVar );
double currentStorage = data.getDouble( this.POWER_NBT_KEY );
double maxStorage = this.getAEMaxPower( is );
switch ( op )
@@ -158,19 +159,19 @@ public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
if ( currentStorage > maxStorage )
{
double diff = currentStorage - maxStorage;
data.setDouble( this.EnergyVar, maxStorage );
data.setDouble( this.POWER_NBT_KEY, maxStorage );
return diff;
}
data.setDouble( this.EnergyVar, currentStorage );
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return 0;
case EXTRACT:
if ( currentStorage > adjustment )
{
currentStorage -= adjustment;
data.setDouble( this.EnergyVar, currentStorage );
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return adjustment;
}
data.setDouble( this.EnergyVar, 0 );
data.setDouble( this.POWER_NBT_KEY, 0 );
return currentStorage;
default:
break;
@@ -182,7 +183,7 @@ public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
@Override
public double getAEMaxPower( ItemStack is )
{
return this.maxStoredPower;
return this.powerCapacity;
}
@Override
@@ -19,12 +19,11 @@
package appeng.items.tools.powered.powersink;
import com.google.common.base.Optional;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import com.google.common.base.Optional;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
@@ -36,12 +35,11 @@ import appeng.transformer.annotations.Integration.Method;
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ),
@Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } )
public class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
{
public IC2( Class c, Optional<String> subName )
public IC2( double powerCapacity, Optional<String> subName )
{
super( c, subName );
super( powerCapacity, subName );
}
@Override
@@ -19,29 +19,27 @@
package appeng.items.tools.powered.powersink;
import com.google.common.base.Optional;
import net.minecraft.item.ItemStack;
import cofh.api.energy.IEnergyContainerItem;
import com.google.common.base.Optional;
import appeng.api.config.PowerUnits;
import appeng.transformer.annotations.Integration.Interface;
@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = "RFItem" )
public class RedstoneFlux extends IC2 implements IEnergyContainerItem
public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem
{
public RedstoneFlux( Class c, Optional<String> subName )
public RedstoneFlux( double powerCapacity, Optional<String> subName )
{
super( c, subName );
super( powerCapacity, subName );
}
@Override
public int receiveEnergy( ItemStack is, int maxReceive, boolean simulate )
{
return maxReceive - ( int ) this.injectExternalPower( PowerUnits.RF, is, maxReceive, simulate );
return maxReceive - (int) this.injectExternalPower( PowerUnits.RF, is, maxReceive, simulate );
}
@Override
@@ -53,13 +51,12 @@ public class RedstoneFlux extends IC2 implements IEnergyContainerItem
@Override
public int getEnergyStored( ItemStack is )
{
return ( int ) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) );
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) );
}
@Override
public int getMaxEnergyStored( ItemStack is )
{
return ( int ) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) );
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) );
}
}
@@ -21,13 +21,13 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.google.common.base.Optional;
import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject;
import appeng.core.features.AEFeature;
@@ -39,14 +39,14 @@ import appeng.util.Platform;
public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
{
private final AEFeature type;
final AEFeature type;
public ToolQuartzCuttingKnife( AEFeature Type )
public ToolQuartzCuttingKnife( AEFeature type )
{
super( ToolQuartzCuttingKnife.class, Optional.of( Type.name() ) );
super( Optional.of( type.name() ) );
this.setFeature( EnumSet.of( this.type = Type, AEFeature.QuartzKnife ) );
this.type = type;
this.setFeature( EnumSet.of( type, AEFeature.QuartzKnife ) );
this.setMaxDamage( 50 );
this.setMaxStackSize( 1 );
}
@@ -21,8 +21,6 @@ package appeng.items.tools.quartz;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -30,6 +28,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.tools.IToolWrench;
import com.google.common.base.Optional;
import appeng.api.implementations.items.IAEWrench;
import appeng.api.util.DimensionalCoord;
@@ -45,7 +44,7 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
public ToolQuartzWrench( AEFeature type )
{
super( ToolQuartzWrench.class, Optional.of( type.name() ) );
super( Optional.of( type.name() ) );
this.setFeature( EnumSet.of( type, AEFeature.QuartzWrench ) );
this.setMaxStackSize( 1 );