Applied-Energistics-2-tiler.../src/main/java/appeng/items/tools/powered/ToolMassCannon.java

530 lines
16 KiB
Java
Raw Normal View History

2014-11-14 12:02:52 +01:00
/*
* 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;
import java.util.EnumSet;
2014-01-20 17:41:37 +01:00
import java.util.List;
2015-06-17 23:25:16 +02:00
import com.google.common.base.Optional;
2014-01-20 17:41:37 +01:00
import net.minecraft.block.Block;
import net.minecraft.block.BlockDispenser;
2014-01-20 17:41:37 +01:00
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntitySheep;
2014-01-20 17:41:37 +01:00
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
2014-07-20 10:53:05 +02:00
import net.minecraft.tileentity.TileEntity;
2014-01-20 17:41:37 +01:00
import net.minecraft.util.AxisAlignedBB;
2015-06-16 02:44:59 +02:00
import net.minecraft.util.BlockPos;
2014-01-20 17:41:37 +01:00
import net.minecraft.util.DamageSource;
2015-06-16 02:44:59 +02:00
import net.minecraft.util.EnumFacing;
2014-01-20 17:41:37 +01:00
import net.minecraft.util.MovingObjectPosition;
2014-02-09 02:34:52 +01:00
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
2014-01-20 17:41:37 +01:00
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
2015-06-17 23:25:16 +02:00
2014-01-20 17:41:37 +01:00
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.FuzzyMode;
import appeng.api.config.Upgrades;
2014-01-23 20:02:48 +01:00
import appeng.api.implementations.items.IStorageCell;
2014-01-20 17:41:37 +01:00
import appeng.api.networking.security.PlayerSource;
2014-03-28 01:48:38 +01:00
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ICellInventoryHandler;
2014-01-20 17:41:37 +01:00
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
2014-02-16 05:35:19 +01:00
import appeng.core.AEConfig;
import appeng.core.AELog;
2014-01-20 17:41:37 +01:00
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
2014-01-20 17:41:37 +01:00
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.core.sync.network.NetworkHandler;
2014-01-20 17:41:37 +01:00
import appeng.core.sync.packets.PacketMatterCannon;
import appeng.hooks.DispenserMatterCannon;
import appeng.hooks.TickHandler;
import appeng.hooks.TickHandler.PlayerColor;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
2014-06-01 03:50:56 +02:00
import appeng.items.misc.ItemPaintBall;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
2014-01-20 17:41:37 +01:00
import appeng.me.storage.CellInventoryHandler;
2014-07-20 10:53:05 +02:00
import appeng.tile.misc.TilePaint;
2015-06-16 02:44:59 +02:00
import appeng.util.LookDirection;
2014-01-20 17:41:37 +01:00
import appeng.util.Platform;
2014-01-20 17:41:37 +01:00
public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
public ToolMassCannon()
{
super( AEConfig.instance.matterCannonBattery, Optional.<String>absent() );
2014-12-29 15:13:47 +01:00
this.setFeature( EnumSet.of( AEFeature.MatterCannon, AEFeature.PoweredTools ) );
}
@Override
public void postInit()
{
super.postInit();
BlockDispenser.dispenseBehaviorRegistry.putObject( this, new DispenserMatterCannon() );
}
2014-01-20 17:41:37 +01:00
@Override
2015-09-30 14:24:40 +02:00
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
2014-01-20 17:41:37 +01:00
{
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
2014-01-20 17:41:37 +01:00
2015-09-30 14:24:40 +02:00
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
2014-01-20 17:41:37 +01:00
if( cdi instanceof CellInventoryHandler )
2014-01-20 17:41:37 +01:00
{
2015-09-30 14:24:40 +02:00
final ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
if( cd != null )
2014-01-20 17:41:37 +01:00
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalItemTypes() + ' ' + GuiText.Types.getLocal() );
2014-01-20 17:41:37 +01:00
}
}
}
@Override
2015-09-30 14:24:40 +02:00
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer p )
2014-01-20 17:41:37 +01:00
{
if( this.getAECurrentPower( item ) > 1600 )
2014-01-20 17:41:37 +01:00
{
int shots = 1;
2015-09-30 14:24:40 +02:00
final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
if( cu != null )
2015-04-29 02:30:53 +02:00
{
2014-01-20 17:41:37 +01:00
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
2015-04-29 02:30:53 +02:00
}
2014-01-20 17:41:37 +01:00
2015-09-30 14:24:40 +02:00
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
if( inv != null )
2014-01-20 17:41:37 +01:00
{
2015-09-30 14:24:40 +02:00
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
IAEStack aeAmmo = itemList.getFirstItem();
if( aeAmmo instanceof IAEItemStack )
2014-01-20 17:41:37 +01:00
{
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
for( int sh = 0; sh < shots; sh++ )
2014-01-20 17:41:37 +01:00
{
2014-12-29 15:13:47 +01:00
this.extractAEPower( item, 1600 );
if( Platform.isClient() )
2015-04-29 02:30:53 +02:00
{
return item;
2015-04-29 02:30:53 +02:00
}
aeAmmo.setStackSize( 1 );
2015-09-30 14:24:40 +02:00
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
if( ammo == null )
2015-04-29 02:30:53 +02:00
{
2014-01-20 17:41:37 +01:00
return item;
2015-04-29 02:30:53 +02:00
}
2014-01-20 17:41:37 +01:00
ammo.stackSize = 1;
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
if( aeAmmo == null )
2015-04-29 02:30:53 +02:00
{
2014-01-20 17:41:37 +01:00
return item;
2015-04-29 02:30:53 +02:00
}
2015-09-30 14:24:40 +02:00
final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
2014-01-20 17:41:37 +01:00
final Vec3 vec3 = dir.getA();
final Vec3 vec31 = dir.getB();
2015-09-30 14:24:40 +02:00
final Vec3 direction = vec31.subtract( vec3 );
2014-07-20 10:53:05 +02:00
direction.normalize();
2014-06-01 03:50:56 +02:00
2015-09-30 14:24:40 +02:00
final double d0 = vec3.xCoord;
final double d1 = vec3.yCoord;
final double d2 = vec3.zCoord;
2015-09-30 14:24:40 +02:00
final float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
if( penetration <= 0 )
2014-01-20 17:41:37 +01:00
{
2015-09-30 14:24:40 +02:00
final ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
if( type.getItem() instanceof ItemPaintBall )
2014-01-20 17:41:37 +01:00
{
2014-12-29 15:13:47 +01:00
this.shootPaintBalls( type, w, p, vec3, vec31, direction, d0, d1, d2 );
2014-01-20 17:41:37 +01:00
}
2014-06-01 03:50:56 +02:00
return item;
}
else
{
2014-12-29 15:13:47 +01:00
this.standardAmmo( penetration, w, p, vec3, vec31, direction, d0, d1, d2 );
2014-01-20 17:41:37 +01:00
}
}
}
else
{
if( Platform.isServer() )
2015-04-29 02:30:53 +02:00
{
2014-02-09 02:34:52 +01:00
p.addChatMessage( PlayerMessages.AmmoDepleted.get() );
2015-04-29 02:30:53 +02:00
}
2014-01-20 17:41:37 +01:00
return item;
}
}
}
return item;
}
2015-09-30 14:24:40 +02:00
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3 vec3, final Vec3 vec31, final Vec3 direction, final double d0, final double d1, final double d2 )
{
2015-09-30 14:24:40 +02:00
final AxisAlignedBB bb = AxisAlignedBB.fromBounds( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
Entity entity = null;
2015-09-30 14:24:40 +02:00
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
2014-09-21 00:37:56 +02:00
double closest = 9999999.0D;
2015-09-30 14:22:21 +02:00
for( int l = 0; l < list.size(); ++l )
{
2015-09-30 14:24:40 +02:00
final Entity entity1 = (Entity) list.get( l );
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
{
if( entity1.isEntityAlive() )
{
// prevent killing / flying of mounts.
if( entity1.riddenByEntity == p )
2015-04-29 02:30:53 +02:00
{
continue;
2015-04-29 02:30:53 +02:00
}
2015-09-30 14:24:40 +02:00
final float f1 = 0.3F;
2015-09-30 14:24:40 +02:00
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().expand( f1, f1, f1 );
final MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
if( movingObjectPosition != null )
{
2015-09-30 14:24:40 +02:00
final double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
if( nd < closest )
{
entity = entity1;
2014-09-21 00:37:56 +02:00
closest = nd;
}
}
}
}
}
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, false );
2015-09-30 14:24:40 +02:00
final Vec3 vec = new Vec3( d0, d1, d2 );
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
{
pos = new MovingObjectPosition( entity );
}
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 ) ) );
}
2015-09-30 14:24:40 +02:00
catch( final Exception err )
{
AELog.debug( err );
}
if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
{
2015-09-30 14:24:40 +02:00
final ItemPaintBall ipb = (ItemPaintBall) type.getItem();
2015-09-30 14:24:40 +02:00
final AEColor col = ipb.getColor( type );
// boolean lit = ipb.isLumen( type );
if( pos.typeOfHit == MovingObjectType.ENTITY )
{
2015-09-30 14:24:40 +02:00
final int id = pos.entityHit.getEntityId();
final PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
2015-01-01 22:13:10 +01:00
TickHandler.INSTANCE.getPlayerColors().put( id, marker );
if( pos.entityHit instanceof EntitySheep )
{
2015-09-30 14:24:40 +02:00
final EntitySheep sh = (EntitySheep) pos.entityHit;
2015-06-16 02:44:59 +02:00
sh.setFleeceColor( col.dye );
}
2014-09-28 20:56:16 +02:00
pos.entityHit.attackEntityFrom( DamageSource.causePlayerDamage( p ), 0 );
NetworkHandler.instance.sendToAll( marker.getPacket() );
}
else if( pos.typeOfHit == MovingObjectType.BLOCK )
{
2015-09-30 14:24:40 +02:00
final EnumFacing side = pos.sideHit;
final BlockPos hitPos = pos.getBlockPos().offset( side );
2015-06-16 02:44:59 +02:00
if( !Platform.hasPermissions( new DimensionalCoord( w, hitPos ), p ) )
2015-04-29 02:30:53 +02:00
{
return;
2015-04-29 02:30:53 +02:00
}
2015-09-30 14:24:40 +02:00
final Block whatsThere = w.getBlockState( hitPos ).getBlock();
2015-06-16 02:44:59 +02:00
if( whatsThere.isReplaceable( w, hitPos ) && w.isAirBlock( hitPos ) )
{
2015-09-30 14:24:40 +02:00
for( final Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
{
2015-06-16 02:44:59 +02:00
w.setBlockState( hitPos, paintBlock.getDefaultState(), 3 );
}
}
2015-09-30 14:24:40 +02:00
final TileEntity te = w.getTileEntity( hitPos );
if( te instanceof TilePaint )
{
2015-12-24 02:03:16 +01:00
final Vec3 hp = pos.hitVec.subtract( hitPos.getX(), hitPos.getY(), hitPos.getZ() );
( (TilePaint) te ).addBlot( type, side.getOpposite(), hp );
}
}
}
}
2015-09-30 14:24:40 +02:00
private void standardAmmo( float penetration, final World w, final EntityPlayer p, final Vec3 vec3, final Vec3 vec31, final Vec3 direction, final double d0, final double d1, final double d2 )
2014-06-01 03:50:56 +02:00
{
boolean hasDestroyed = true;
while( penetration > 0 && hasDestroyed )
2014-06-01 03:50:56 +02:00
{
hasDestroyed = false;
2014-06-01 03:50:56 +02:00
2015-09-30 14:24:40 +02:00
final AxisAlignedBB bb = AxisAlignedBB.fromBounds( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
2014-06-01 03:50:56 +02:00
Entity entity = null;
2015-09-30 14:24:40 +02:00
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
2014-09-21 00:38:45 +02:00
double closest = 9999999.0D;
2014-06-01 03:50:56 +02:00
2015-09-30 14:22:21 +02:00
for( int l = 0; l < list.size(); ++l )
2014-06-01 03:50:56 +02:00
{
2015-09-30 14:24:40 +02:00
final Entity entity1 = (Entity) list.get( l );
2014-06-01 03:50:56 +02:00
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
2014-06-01 03:50:56 +02:00
{
if( entity1.isEntityAlive() )
2014-06-01 03:50:56 +02:00
{
// prevent killing / flying of mounts.
if( entity1.riddenByEntity == p )
2015-04-29 02:30:53 +02:00
{
2014-06-01 03:50:56 +02:00
continue;
2015-04-29 02:30:53 +02:00
}
2014-06-01 03:50:56 +02:00
2015-09-30 14:24:40 +02:00
final float f1 = 0.3F;
2014-06-01 03:50:56 +02:00
2015-09-30 14:24:40 +02:00
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().expand( f1, f1, f1 );
final MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
2014-06-01 03:50:56 +02:00
if( movingObjectPosition != null )
2014-06-01 03:50:56 +02:00
{
2015-09-30 14:24:40 +02:00
final double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
2014-06-01 03:50:56 +02:00
if( nd < closest )
2014-06-01 03:50:56 +02:00
{
entity = entity1;
2014-09-21 00:38:45 +02:00
closest = nd;
2014-06-01 03:50:56 +02:00
}
}
}
}
}
2015-09-30 14:24:40 +02:00
final Vec3 vec = new Vec3( d0, d1, d2 );
2014-06-01 03:50:56 +02:00
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, true );
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
2014-06-01 03:50:56 +02:00
{
pos = new MovingObjectPosition( entity );
}
else if( entity != null && pos == null )
2014-06-01 03:50:56 +02:00
{
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 ) ) );
2014-06-01 03:50:56 +02:00
}
2015-09-30 14:24:40 +02:00
catch( final Exception err )
2014-06-01 03:50:56 +02:00
{
AELog.debug( err );
2014-06-01 03:50:56 +02:00
}
if( pos != null )
2014-06-01 03:50:56 +02:00
{
2015-09-30 14:24:40 +02:00
final DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
2014-06-01 03:50:56 +02:00
dmgSrc.damageType = "masscannon";
if( pos.typeOfHit == MovingObjectType.ENTITY )
2014-06-01 03:50:56 +02:00
{
2015-09-30 14:24:40 +02:00
final int dmg = (int) Math.ceil( penetration / 20.0f );
if( pos.entityHit instanceof EntityLivingBase )
2014-06-01 03:50:56 +02:00
{
2015-09-30 14:24:40 +02:00
final EntityLivingBase el = (EntityLivingBase) pos.entityHit;
2014-09-21 00:38:22 +02:00
penetration -= dmg;
2014-09-28 20:56:16 +02:00
el.knockBack( p, 0, -direction.xCoord, -direction.zCoord );
2014-06-01 03:50:56 +02:00
// el.knockBack( p, 0, vec3.xCoord,
// vec3.zCoord );
el.attackEntityFrom( dmgSrc, dmg );
if( !el.isEntityAlive() )
2015-04-29 02:30:53 +02:00
{
hasDestroyed = true;
2015-04-29 02:30:53 +02:00
}
2014-06-01 03:50:56 +02:00
}
else if( pos.entityHit instanceof EntityItem )
2014-06-01 03:50:56 +02:00
{
hasDestroyed = true;
2014-06-01 03:50:56 +02:00
pos.entityHit.setDead();
}
else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
2014-06-01 03:50:56 +02:00
{
hasDestroyed = true;
2014-06-01 03:50:56 +02:00
}
}
else if( pos.typeOfHit == MovingObjectType.BLOCK )
2014-06-01 03:50:56 +02:00
{
if( !AEConfig.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) )
2015-04-29 02:30:53 +02:00
{
2014-09-21 00:38:22 +02:00
penetration = 0;
2015-04-29 02:30:53 +02:00
}
2014-06-01 03:50:56 +02:00
else
{
2015-09-30 14:24:40 +02:00
final Block b = w.getBlockState( pos.getBlockPos() ).getBlock();
2014-06-01 03:50:56 +02:00
// int meta = w.getBlockMetadata(
// pos.blockX, pos.blockY, pos.blockZ );
2015-09-30 14:24:40 +02:00
final float hardness = b.getBlockHardness( w, pos.getBlockPos() ) * 9.0f;
if( hardness >= 0.0 )
2014-06-01 03:50:56 +02:00
{
2015-06-16 02:44:59 +02:00
if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.getBlockPos() ), p ) )
2014-06-01 03:50:56 +02:00
{
hasDestroyed = true;
2014-09-21 00:38:22 +02:00
penetration -= hardness;
penetration *= 0.60;
2015-06-16 02:44:59 +02:00
w.destroyBlock( pos.getBlockPos(), true );
2014-06-01 03:50:56 +02:00
}
}
}
}
}
}
}
2014-01-20 17:41:37 +01:00
@Override
2015-09-30 14:24:40 +02:00
public boolean isEditable( final ItemStack is )
2014-01-20 17:41:37 +01:00
{
return true;
}
@Override
2015-09-30 14:24:40 +02:00
public IInventory getUpgradesInventory( final ItemStack is )
2014-01-20 17:41:37 +01:00
{
return new CellUpgrades( is, 4 );
}
@Override
2015-09-30 14:24:40 +02:00
public IInventory getConfigInventory( final ItemStack is )
2014-01-20 17:41:37 +01:00
{
return new CellConfig( is );
}
@Override
2015-09-30 14:24:40 +02:00
public FuzzyMode getFuzzyMode( final ItemStack is )
2014-01-20 17:41:37 +01:00
{
2015-09-30 14:24:40 +02:00
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
2014-01-20 17:41:37 +01:00
try
{
return FuzzyMode.valueOf( fz );
}
2015-09-30 14:24:40 +02:00
catch( final Throwable t )
2014-01-20 17:41:37 +01:00
{
return FuzzyMode.IGNORE_ALL;
}
}
@Override
2015-09-30 14:24:40 +02:00
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
2014-01-20 17:41:37 +01:00
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
}
@Override
2015-09-30 14:24:40 +02:00
public int getBytes( final ItemStack cellItem )
2014-01-20 17:41:37 +01:00
{
return 512;
}
@Override
2015-09-30 14:24:40 +02:00
public int getBytesPerType( final ItemStack cellItem )
{
return 8;
}
2014-01-20 17:41:37 +01:00
@Override
2015-09-30 14:24:40 +02:00
public int getTotalTypes( final ItemStack cellItem )
2014-01-20 17:41:37 +01:00
{
return 1;
}
@Override
2015-09-30 14:24:40 +02:00
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
2014-01-20 17:41:37 +01:00
{
2015-09-30 14:24:40 +02:00
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
if( pen > 0 )
2015-04-29 02:30:53 +02:00
{
2014-06-01 03:50:56 +02:00
return false;
2015-04-29 02:30:53 +02:00
}
2014-06-01 03:50:56 +02:00
if( requestedAddition.getItem() instanceof ItemPaintBall )
2015-04-29 02:30:53 +02:00
{
2014-07-20 10:53:05 +02:00
return false;
2015-04-29 02:30:53 +02:00
}
2014-06-01 03:50:56 +02:00
return true;
2014-01-20 17:41:37 +01:00
}
@Override
public boolean storableInStorageCell()
{
return true;
}
@Override
2015-09-30 14:24:40 +02:00
public boolean isStorageCell( final ItemStack i )
{
return true;
}
@Override
public double getIdleDrain()
{
return 0.5;
}
}