Port to 1.11
This commit is contained in:
@@ -51,16 +51,16 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack is, final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
{
|
||||
if( p.isSneaking() )
|
||||
{
|
||||
this.encode( is, p );
|
||||
this.encode( p.getHeldItemMainhand(), p );
|
||||
p.swingArm( hand );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, is );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
return new ActionResult<ItemStack>( EnumActionResult.PASS, is );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.PASS, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -124,34 +124,34 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
switch( msg )
|
||||
{
|
||||
case SETTINGS_CLEARED:
|
||||
player.addChatMessage( PlayerMessages.SettingCleared.get() );
|
||||
player.sendMessage( PlayerMessages.SettingCleared.get() );
|
||||
break;
|
||||
case INVALID_MACHINE:
|
||||
player.addChatMessage( PlayerMessages.InvalidMachine.get() );
|
||||
player.sendMessage( PlayerMessages.InvalidMachine.get() );
|
||||
break;
|
||||
case SETTINGS_LOADED:
|
||||
player.addChatMessage( PlayerMessages.LoadedSettings.get() );
|
||||
player.sendMessage( PlayerMessages.LoadedSettings.get() );
|
||||
break;
|
||||
case SETTINGS_SAVED:
|
||||
player.addChatMessage( PlayerMessages.SavedSettings.get() );
|
||||
player.sendMessage( PlayerMessages.SavedSettings.get() );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( final ItemStack is, final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz )
|
||||
public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz )
|
||||
{
|
||||
if( player.isSneaking() && !w.isRemote )
|
||||
{
|
||||
final IMemoryCard mem = (IMemoryCard) is.getItem();
|
||||
final IMemoryCard mem = (IMemoryCard) player.getHeldItemMainhand().getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
is.setTagCompound( null );
|
||||
player.getHeldItemMainhand().setTagCompound( null );
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.onItemUse( is, player, w, pos, hand, side, hx, hy, hz );
|
||||
return super.onItemUse( player, w, pos, hand, side, hx, hy, hz );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.INetworkToolAgent;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
@@ -71,30 +71,30 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack it, final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
final RayTraceResult mop = ClientHelper.proxy.getRTR();
|
||||
final RayTraceResult mop = AppEng.proxy.getRTR();
|
||||
|
||||
if( mop == null )
|
||||
{
|
||||
this.onItemUseFirst( it, p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh?
|
||||
this.onItemUseFirst( p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh?
|
||||
}
|
||||
else
|
||||
{
|
||||
if( w.getBlockState( mop.getBlockPos() ).getBlock().isAir( w.getBlockState( mop.getBlockPos() ), w, mop.getBlockPos() ) )
|
||||
{
|
||||
this.onItemUseFirst( it, p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh?
|
||||
this.onItemUseFirst( p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, it );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
{
|
||||
final RayTraceResult mop = new RayTraceResult( new Vec3d( hitX, hitY, hitZ ), side, pos );
|
||||
final TileEntity te = world.getTileEntity( pos );
|
||||
@@ -151,7 +151,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
{
|
||||
if( b.rotateBlock( w, pos, side ) )
|
||||
{
|
||||
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK );
|
||||
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK, null );
|
||||
p.swingArm( hand );
|
||||
return !w.isRemote;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
}
|
||||
else
|
||||
{
|
||||
b.onBlockActivated( w, pos, w.getBlockState( pos ), p, hand, is, side, hitX, hitY, hitZ );
|
||||
b.onBlockActivated( w, pos, w.getBlockState( pos ), p, hand, side, hitX, hitY, hitZ );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -25,9 +25,9 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.packets.PacketLightning;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
import appeng.server.ServerHelper;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ public class ToolChargedStaff extends AEBasePoweredItem
|
||||
final float dx = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minX );
|
||||
final float dy = (float) ( Platform.getRandomFloat() * target.height + entityBoundingBox.minY );
|
||||
final float dz = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minZ );
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) );
|
||||
AppEng.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.world, new PacketLightning( dx, dy, dz ) );
|
||||
}
|
||||
}
|
||||
target.attackEntityFrom( DamageSource.magic, 6 );
|
||||
target.attackEntityFrom( DamageSource.MAGIC, 6 );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
if( option != null )
|
||||
{
|
||||
paintBall = option.getItemStack();
|
||||
paintBall.stackSize = 1;
|
||||
paintBall.setCount( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -242,7 +242,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
if( c != null && c.hasKey( "color" ) )
|
||||
{
|
||||
final NBTTagCompound color = c.getCompoundTag( "color" );
|
||||
final ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
|
||||
final ItemStack oldColor = new ItemStack( color );
|
||||
if( oldColor != null )
|
||||
{
|
||||
return oldColor;
|
||||
|
||||
@@ -209,13 +209,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
{
|
||||
final RayTraceResult target = this.rayTrace( w, p, true );
|
||||
|
||||
if( target == null )
|
||||
{
|
||||
return new ActionResult<ItemStack>( EnumActionResult.FAIL, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItemMainhand() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -226,13 +226,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
if( Platform.hasPermissions( new DimensionalCoord( w, target.getBlockPos() ), p ) )
|
||||
{
|
||||
this.onItemUse( item, p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F );
|
||||
this.onItemUse( p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,7 +61,7 @@ import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
@@ -106,19 +106,19 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final @Nullable EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final @Nullable EnumHand hand )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
if( this.getAECurrentPower( p.getHeldItemMainhand() ) > 1600 )
|
||||
{
|
||||
int shots = 1;
|
||||
|
||||
final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
|
||||
final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( p.getHeldItemMainhand() );
|
||||
if( cu != null )
|
||||
{
|
||||
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
|
||||
}
|
||||
|
||||
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
|
||||
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( p.getHeldItemMainhand(), null, StorageChannel.ITEMS );
|
||||
if( inv != null )
|
||||
{
|
||||
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||
@@ -128,25 +128,25 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
|
||||
for( int sh = 0; sh < shots; sh++ )
|
||||
{
|
||||
this.extractAEPower( item, 1600 );
|
||||
this.extractAEPower( p.getHeldItemMainhand(), 1600 );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
aeAmmo.setStackSize( 1 );
|
||||
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
|
||||
if( ammo == null )
|
||||
{
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
ammo.stackSize = 1;
|
||||
ammo.setCount( 1 );
|
||||
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
|
||||
if( aeAmmo == null )
|
||||
{
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
|
||||
@@ -168,7 +168,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
{
|
||||
this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 );
|
||||
}
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -180,13 +180,13 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
p.addChatMessage( PlayerMessages.AmmoDepleted.get() );
|
||||
p.sendMessage( PlayerMessages.AmmoDepleted.get() );
|
||||
}
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
}
|
||||
}
|
||||
return new ActionResult<ItemStack>( EnumActionResult.FAIL, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
|
||||
@@ -244,7 +244,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
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 ) ) );
|
||||
AppEng.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( final Exception err )
|
||||
{
|
||||
@@ -361,7 +361,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
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 ) ) );
|
||||
AppEng.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( final Exception err )
|
||||
{
|
||||
|
||||
@@ -64,10 +64,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer player, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
|
||||
{
|
||||
Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
|
||||
@@ -56,10 +56,10 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer player, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
|
||||
{
|
||||
AEApi.instance().registries().wireless().openWirelessTerminalGui( item, w, player );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
|
||||
AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItemMainhand(), w, player );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
@@ -75,7 +76,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
|
||||
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
||||
{
|
||||
super.getCheckedSubItems( sameItem, creativeTab, itemStacks );
|
||||
|
||||
|
||||
@@ -1,125 +1,125 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.items.tools.powered.powersink;
|
||||
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import ic2.api.item.IElectricItemManager;
|
||||
import ic2.api.item.ISpecialElectricItem;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.coremod.annotations.Integration.Interface;
|
||||
import appeng.coremod.annotations.Integration.InterfaceList;
|
||||
import appeng.coremod.annotations.Integration.Method;
|
||||
import appeng.integration.IntegrationType;
|
||||
|
||||
|
||||
@InterfaceList( value = {
|
||||
@Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ),
|
||||
@Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 )
|
||||
} )
|
||||
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
|
||||
{
|
||||
public IC2( double powerCapacity )
|
||||
{
|
||||
super( powerCapacity );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
|
||||
{
|
||||
double addedAmt = amount;
|
||||
double limit = this.getTransferLimit( is );
|
||||
|
||||
if( !ignoreTransferLimit && amount > limit )
|
||||
{
|
||||
addedAmt = limit;
|
||||
}
|
||||
|
||||
return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCharge( ItemStack is )
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse( ItemStack is, double amount )
|
||||
{
|
||||
return this.getCharge( is ) > amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean use( ItemStack is, double amount, EntityLivingBase entity )
|
||||
{
|
||||
if( this.canUse( is, amount ) )
|
||||
{
|
||||
// use the power..
|
||||
this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
|
||||
{
|
||||
// wtf?
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolTip( ItemStack itemStack )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge( ItemStack itemStack )
|
||||
{
|
||||
return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier( ItemStack itemStack )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
private double getTransferLimit( ItemStack itemStack )
|
||||
{
|
||||
return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Method( iname = IntegrationType.IC2 )
|
||||
public IElectricItemManager getManager( ItemStack itemStack )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * This file is part of Applied Energistics 2.
|
||||
// * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
// *
|
||||
// * Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
// * it under the terms of the GNU Lesser General Public License as published by
|
||||
// * the Free Software Foundation, either version 3 of the License, or
|
||||
// * (at your option) any later version.
|
||||
// *
|
||||
// * Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// * GNU Lesser General Public License for more details.
|
||||
// *
|
||||
// * You should have received a copy of the GNU Lesser General Public License
|
||||
// * along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
// */
|
||||
//
|
||||
//package appeng.items.tools.powered.powersink;
|
||||
//
|
||||
//
|
||||
//import net.minecraft.entity.EntityLivingBase;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//
|
||||
//import ic2.api.item.IElectricItemManager;
|
||||
//import ic2.api.item.ISpecialElectricItem;
|
||||
//
|
||||
//import appeng.api.config.PowerUnits;
|
||||
//import appeng.coremod.annotations.Integration.Interface;
|
||||
//import appeng.coremod.annotations.Integration.InterfaceList;
|
||||
//import appeng.coremod.annotations.Integration.Method;
|
||||
//import appeng.integration.IntegrationType;
|
||||
//
|
||||
//
|
||||
//@InterfaceList( value = {
|
||||
// @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ),
|
||||
// @Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 )
|
||||
//} )
|
||||
//public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
|
||||
//{
|
||||
// public IC2( double powerCapacity )
|
||||
// {
|
||||
// super( powerCapacity );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
|
||||
// {
|
||||
// double addedAmt = amount;
|
||||
// double limit = this.getTransferLimit( is );
|
||||
//
|
||||
// if( !ignoreTransferLimit && amount > limit )
|
||||
// {
|
||||
// addedAmt = limit;
|
||||
// }
|
||||
//
|
||||
// return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
|
||||
// {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getCharge( ItemStack is )
|
||||
// {
|
||||
// return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canUse( ItemStack is, double amount )
|
||||
// {
|
||||
// return this.getCharge( is ) > amount;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean use( ItemStack is, double amount, EntityLivingBase entity )
|
||||
// {
|
||||
// if( this.canUse( is, amount ) )
|
||||
// {
|
||||
// // use the power..
|
||||
// this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
|
||||
// {
|
||||
// // wtf?
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getToolTip( ItemStack itemStack )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getMaxCharge( ItemStack itemStack )
|
||||
// {
|
||||
// return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getTier( ItemStack itemStack )
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// private double getTransferLimit( ItemStack itemStack )
|
||||
// {
|
||||
// return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @Method( iname = IntegrationType.IC2 )
|
||||
// public IElectricItemManager getManager( ItemStack itemStack )
|
||||
// {
|
||||
// return this;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -29,7 +29,7 @@ import appeng.integration.IntegrationType;
|
||||
|
||||
|
||||
@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = IntegrationType.RFItem )
|
||||
public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem
|
||||
public abstract class RedstoneFlux extends AERootPoweredItem implements IEnergyContainerItem
|
||||
{
|
||||
public RedstoneFlux( final double powerCapacity )
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( final ItemStack stack, final EntityPlayer p, final World worldIn, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
public EnumActionResult onItemUse( final EntityPlayer p, final World worldIn, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
@@ -60,14 +60,14 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack it, final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
|
||||
}
|
||||
p.swingArm( hand );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, it );
|
||||
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
{
|
||||
final Block b = world.getBlockState( pos ).getBlock();
|
||||
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
|
||||
@@ -60,7 +60,7 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool
|
||||
|
||||
if( b.rotateBlock( world, pos, side ) )
|
||||
{
|
||||
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), world, pos, Platform.AIR_BLOCK );
|
||||
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), world, pos, Platform.AIR_BLOCK, pos );
|
||||
player.swingArm( hand );
|
||||
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user