Merge pull request #1482 from yueh/feature-1344

Closes #1344 Added a silk touch annihilation plane
This commit is contained in:
yueh 2015-06-01 19:51:28 +02:00
commit e2b870f1f1
12 changed files with 289 additions and 109 deletions

View file

@ -66,6 +66,8 @@ public interface IParts
IItemDefinition annihilationPlane();
IItemDefinition identityAnnihilationPlane();
IItemDefinition formationPlane();
IItemDefinition p2PTunnelME();

View file

@ -69,6 +69,8 @@ public enum CableBusTextures
BlockFormPlaneOn( "BlockFormPlaneOn" ),
BlockIdentityAnnihilationPlaneOn( "BlockIdentityAnnihilationPlaneOn" ),
ItemPartLevelEmitterOn( "ItemPart.LevelEmitterOn" ), PartTransitionPlaneBack( "PartTransitionPlaneBack" ),
PartTunnelSides( "PartTunnelSides" ), PartPlaneSides( "PartPlaneSides" ), PartExportSides( "PartExportSides" ), PartImportSides( "PartImportSides" ),

View file

@ -38,10 +38,10 @@ public final class ApiParts implements IParts
private final AEColoredItemDefinition cableCovered;
private final AEColoredItemDefinition cableGlass;
private final AEColoredItemDefinition cableDense;
// private final AEColoredItemDefinition lumenCableSmart;
// private final AEColoredItemDefinition lumenCableCovered;
// private final AEColoredItemDefinition lumenCableGlass;
// private final AEColoredItemDefinition lumenCableDense;
// private final AEColoredItemDefinition lumenCableSmart;
// private final AEColoredItemDefinition lumenCableCovered;
// private final AEColoredItemDefinition lumenCableGlass;
// private final AEColoredItemDefinition lumenCableDense;
private final IItemDefinition quartzFiber;
private final IItemDefinition toggleBus;
private final IItemDefinition invertedToggleBus;
@ -51,6 +51,7 @@ public final class ApiParts implements IParts
private final IItemDefinition iface;
private final IItemDefinition levelEmitter;
private final IItemDefinition annihilationPlane;
private final IItemDefinition identityAnnihilationPlane;
private final IItemDefinition formationPlane;
private final IItemDefinition p2PTunnelME;
private final IItemDefinition p2PTunnelRedstone;
@ -80,10 +81,10 @@ public final class ApiParts implements IParts
this.cableCovered = constructor.constructColoredDefinition( itemMultiPart, PartType.CableCovered );
this.cableGlass = constructor.constructColoredDefinition( itemMultiPart, PartType.CableGlass );
this.cableDense = constructor.constructColoredDefinition( itemMultiPart, PartType.CableDense );
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableDense = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableSmart = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableCovered = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableGlass = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
// this.lumenCableDense = Optional.absent(); // has yet to be implemented, no PartType defined for it yet
this.quartzFiber = new DamagedItemDefinition( itemMultiPart.createPart( PartType.QuartzFiber ) );
this.toggleBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.ToggleBus ) );
this.invertedToggleBus = new DamagedItemDefinition( itemMultiPart.createPart( PartType.InvertedToggleBus ) );
@ -93,6 +94,7 @@ public final class ApiParts implements IParts
this.iface = new DamagedItemDefinition( itemMultiPart.createPart( PartType.Interface ) );
this.levelEmitter = new DamagedItemDefinition( itemMultiPart.createPart( PartType.LevelEmitter ) );
this.annihilationPlane = new DamagedItemDefinition( itemMultiPart.createPart( PartType.AnnihilationPlane ) );
this.identityAnnihilationPlane = new DamagedItemDefinition( itemMultiPart.createPart( PartType.IdentityAnnihilationPlane ) );
this.formationPlane = new DamagedItemDefinition( itemMultiPart.createPart( PartType.FormationPlane ) );
this.p2PTunnelME = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelME ) );
this.p2PTunnelRedstone = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRedstone ) );
@ -142,28 +144,28 @@ public final class ApiParts implements IParts
public AEColoredItemDefinition lumenCableSmart()
{
throw new MissingDefinition( "Lumen Smart Cable has yet to be implemented." );
// return this.lumenCableSmart;
// return this.lumenCableSmart;
}
@Override
public AEColoredItemDefinition lumenCableCovered()
{
throw new MissingDefinition( "Lumen Covered Cable has yet to be implemented." );
// return this.lumenCableCovered;
// return this.lumenCableCovered;
}
@Override
public AEColoredItemDefinition lumenCableGlass()
{
throw new MissingDefinition( "Lumen Glass Cable has yet to be implemented." );
// return this.lumenCableGlass;
// return this.lumenCableGlass;
}
@Override
public AEColoredItemDefinition lumenCableDense()
{
throw new MissingDefinition( "Lumen Dense Cable has yet to be implemented." );
// return this.lumenCableDense;
// return this.lumenCableDense;
}
@Override
@ -220,6 +222,12 @@ public final class ApiParts implements IParts
return this.annihilationPlane;
}
@Override
public IItemDefinition identityAnnihilationPlane()
{
return this.identityAnnihilationPlane;
}
@Override
public IItemDefinition formationPlane()
{

View file

@ -49,7 +49,7 @@ public enum AEFeature
SpatialIO( "NetworkFeatures" ), QuantumNetworkBridge( "NetworkFeatures" ), Channels( "NetworkFeatures" ),
LevelEmitter( "NetworkBuses" ), CraftingTerminal( "NetworkBuses" ), StorageMonitor( "NetworkBuses" ), P2PTunnel( "NetworkBuses" ), FormationPlane( "NetworkBuses" ), AnnihilationPlane( "NetworkBuses" ), ImportBus( "NetworkBuses" ), ExportBus( "NetworkBuses" ), StorageBus( "NetworkBuses" ), PartConversionMonitor( "NetworkBuses" ),
LevelEmitter( "NetworkBuses" ), CraftingTerminal( "NetworkBuses" ), StorageMonitor( "NetworkBuses" ), P2PTunnel( "NetworkBuses" ), FormationPlane( "NetworkBuses" ), AnnihilationPlane( "NetworkBuses" ), IdentityAnnihilationPlane( "NetworkBuses" ), ImportBus( "NetworkBuses" ), ExportBus( "NetworkBuses" ), StorageBus( "NetworkBuses" ), PartConversionMonitor( "NetworkBuses" ),
StorageCells( "Storage" ), PortableCell( "PortableCell" ), MEChest( "Storage" ), MEDrive( "Storage" ), IOPort( "Storage" ),

View file

@ -33,6 +33,7 @@ import appeng.parts.automation.PartExportBus;
import appeng.parts.automation.PartFormationPlane;
import appeng.parts.automation.PartImportBus;
import appeng.parts.automation.PartLevelEmitter;
import appeng.parts.automation.PartIdentityAnnihilationPlane;
import appeng.parts.misc.PartCableAnchor;
import appeng.parts.misc.PartInterface;
import appeng.parts.misc.PartInvertedToggleBus;
@ -67,40 +68,40 @@ public enum PartType
InvalidType( -1, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), null ),
CableGlass( 0, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
{
@Override
public boolean isCable()
{
return true;
}
},
{
@Override
public boolean isCable()
{
return true;
}
},
CableCovered( 20, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
{
@Override
public boolean isCable()
{
return true;
}
},
{
@Override
public boolean isCable()
{
return true;
}
},
CableSmart( 40, EnumSet.of( AEFeature.Channels ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
{
@Override
public boolean isCable()
{
return true;
}
},
{
@Override
public boolean isCable()
{
return true;
}
},
CableDense( 60, EnumSet.of( AEFeature.Channels ), EnumSet.noneOf( IntegrationType.class ), PartDenseCable.class )
{
@Override
public boolean isCable()
{
return true;
}
},
{
@Override
public boolean isCable()
{
return true;
}
},
ToggleBus( 80, EnumSet.of( AEFeature.Core ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
@ -126,6 +127,8 @@ public enum PartType
AnnihilationPlane( 300, EnumSet.of( AEFeature.AnnihilationPlane ), EnumSet.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
IdentityAnnihilationPlane( 301, EnumSet.of( AEFeature.AnnihilationPlane, AEFeature.IdentityAnnihilationPlane ), EnumSet.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
FormationPlane( 320, EnumSet.of( AEFeature.FormationPlane ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
PatternTerminal( 340, EnumSet.of( AEFeature.Patterns ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
@ -154,7 +157,7 @@ public enum PartType
P2PTunnelLight( 467, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelLight ), EnumSet.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel ),
P2PTunnelOpenComputers(468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of( IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of( IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
InterfaceTerminal( 480, EnumSet.of( AEFeature.InterfaceTerminal ), EnumSet.noneOf( IntegrationType.class ), PartInterfaceTerminal.class );
@ -172,7 +175,7 @@ public enum PartType
PartType( int baseMetaValue, Set<AEFeature> features, Set<IntegrationType> integrations, Class<? extends IPart> c, GuiText en )
{
this.features = Collections.unmodifiableSet( features ) ;
this.features = Collections.unmodifiableSet( features );
this.integrations = Collections.unmodifiableSet( integrations );
this.myPart = c;
this.extraName = en;

View file

@ -19,6 +19,7 @@
package appeng.parts.automation;
import java.util.List;
import java.util.concurrent.Callable;
import com.google.common.collect.Lists;
@ -32,6 +33,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.ForgeDirection;
@ -69,6 +71,11 @@ import appeng.util.item.AEItemStack;
public class PartAnnihilationPlane extends PartBasicState implements IGridTickable, Callable<TickRateModulation>
{
private final static IIcon SIDE_ICON = CableBusTextures.PartPlaneSides.getIcon();
private final static IIcon BACK_ICON = CableBusTextures.PartTransitionPlaneBack.getIcon();
private final static IIcon STATUS_ICON = CableBusTextures.PartMonitorSidesStatus.getIcon();
private final static IIcon ACTIVE_ICON = CableBusTextures.BlockAnnihilationPlaneOn.getIcon();
private final BaseActionSource mySrc = new MachineSource( this );
private boolean isAccepting = true;
private boolean breaking = false;
@ -134,7 +141,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
{
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() );
rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, this.is.getIconIndex(), SIDE_ICON, SIDE_ICON );
rh.setBounds( 1, 1, 15, 15, 15, 16 );
rh.renderInventoryBox( renderer );
@ -146,6 +153,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
{
this.renderStaticWithIcon( x, y, z, rh, renderer, ACTIVE_ICON );
}
protected void renderStaticWithIcon( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer, IIcon activeIcon )
{
int minX = 1;
int minY = 1;
@ -177,15 +189,15 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
maxY = 16;
}
final boolean isActive = ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) == ( this.POWERED_FLAG | this.CHANNEL_FLAG );
final boolean isActive = ( this.clientFlags & ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG ) ) == ( PartBasicState.POWERED_FLAG | PartBasicState.CHANNEL_FLAG );
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : this.is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() );
rh.setTexture( SIDE_ICON, SIDE_ICON, BACK_ICON, isActive ? activeIcon : this.is.getIconIndex(), SIDE_ICON, SIDE_ICON );
rh.setBounds( minX, minY, 15, maxX, maxY, 16 );
rh.renderBlock( x, y, z, renderer );
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
rh.setTexture( STATUS_ICON, STATUS_ICON, BACK_ICON, isActive ? activeIcon : this.is.getIconIndex(), STATUS_ICON, STATUS_ICON );
rh.setBounds( 5, 5, 14, 11, 11, 15 );
rh.renderBlock( x, y, z, renderer );
@ -329,28 +341,16 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
Platform.spawnDrops( world, x, y, z, Lists.newArrayList( overflow.getItemStack() ) );
}
private boolean isAnnihilationPlane( TileEntity blockTileEntity, ForgeDirection side )
protected boolean isAnnihilationPlane( TileEntity blockTileEntity, ForgeDirection side )
{
if( blockTileEntity instanceof IPartHost )
{
final IPart p = ( (IPartHost) blockTileEntity ).getPart( side );
return p instanceof PartAnnihilationPlane;
return p != null && p.getClass() == this.getClass();
}
return false;
}
/**
* If the plane is accepting items.
*
* This might be improved if a performance problem shows up.
*
* @return true if planes accepts items.
*/
private boolean isAccepting()
{
return this.isAccepting;
}
@Override
@MENetworkEventSubscribe
public void chanRender( MENetworkChannelsChanged c )
@ -380,61 +380,30 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final int y = te.yCoord + this.side.offsetY;
final int z = te.zCoord + this.side.offsetZ;
final Block blk = w.getBlock( x, y, z );
final IEnergyGrid energy = this.proxy.getEnergy();
final Material mat = blk.getMaterial();
final boolean ignore = mat == Material.air || mat == Material.lava || mat == Material.water || mat.isLiquid() || blk == Blocks.bedrock || blk == Blocks.end_portal || blk == Blocks.end_portal_frame || blk == Blocks.command_block;
if( !ignore && !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) )
if( this.canHandleBlock( w, x, y, z ) )
{
final float hardness = blk.getBlockHardness( w, x, y, z );
final List<ItemStack> items = this.obtainBlockDrops( w, x, y, z );
final float requiredPower = this.calculateEnergyUsage( w, x, y, z, items );
if( hardness >= 0.0 )
final boolean hasPower = energy.extractAEPower( requiredPower, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > requiredPower - 0.1;
final boolean canStore = this.canStoreItemStacks( items );
if( hasPower && canStore )
{
final ItemStack[] out = Platform.getBlockDrops( w, x, y, z );
float total = 1 + hardness;
for( final ItemStack is : out )
if( modulate )
{
total += is.stackSize;
energy.extractAEPower( requiredPower, Actionable.MODULATE, PowerMultiplier.CONFIG );
this.breakBlockAndStoreItems( w, x, y, z, items );
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, this.side, true ) );
}
final boolean hasPower = energy.extractAEPower( total, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > total - 0.1;
final boolean canStore = this.canStoreItemStacks( out );
if( hasPower && canStore )
else
{
if( modulate )
{
w.setBlock( x, y, z, Platform.AIR_BLOCK, 0, 3 );
energy.extractAEPower( total, Actionable.MODULATE, PowerMultiplier.CONFIG );
final AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
{
if( ei instanceof EntityItem )
{
final EntityItem entityItem = (EntityItem) ei;
this.storeEntityItem( entityItem );
}
}
for( final ItemStack snaggedItem : out )
{
this.storeItemStack( snaggedItem );
}
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, this.side, true ) );
}
else
{
this.breaking = true;
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this );
}
return TickRateModulation.URGENT;
this.breaking = true;
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this );
}
return TickRateModulation.URGENT;
}
}
}
@ -466,6 +435,43 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
return this.breakBlock( false );
}
/**
* Checks if this plane can handle the block at the specific coordinates.
*/
protected boolean canHandleBlock( WorldServer w, int x, int y, int z )
{
final Block block = w.getBlock( x, y, z );
final Material material = block.getMaterial();
final float hardness = block.getBlockHardness( w, x, y, z );
final boolean ignoreMaterials = material == Material.air || material == Material.lava || material == Material.water || material.isLiquid();
final boolean ignoreBlocks = block == Blocks.bedrock || block == Blocks.end_portal || block == Blocks.end_portal_frame || block == Blocks.command_block;
return !ignoreMaterials && !ignoreBlocks && !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) && hardness >= 0f;
}
protected List<ItemStack> obtainBlockDrops( WorldServer w, int x, int y, int z )
{
final ItemStack[] out = Platform.getBlockDrops( w, x, y, z );
return Lists.newArrayList( out );
}
/**
* Checks if this plane can handle the block at the specific coordinates.
*/
protected float calculateEnergyUsage( WorldServer w, int x, int y, int z, List<ItemStack> items )
{
final Block block = w.getBlock( x, y, z );
final float hardness = block.getBlockHardness( w, x, y, z );
float requiredEnergy = 1 + hardness;
for( final ItemStack is : items )
{
requiredEnergy += is.stackSize;
}
return requiredEnergy;
}
/**
* Checks if the network can store the possible drops.
*
@ -475,9 +481,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
*
* @return true, if the network can store at least a single item of all drops or no drops are reported
*/
private boolean canStoreItemStacks( ItemStack[] itemStacks )
protected boolean canStoreItemStacks( List<ItemStack> itemStacks )
{
boolean canStore = itemStacks.length == 0;
boolean canStore = itemStacks.isEmpty();
try
{
@ -501,4 +507,24 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
this.isAccepting = canStore;
return canStore;
}
protected void breakBlockAndStoreItems( WorldServer w, int x, int y, int z, List<ItemStack> items )
{
w.setBlock( x, y, z, Platform.AIR_BLOCK, 0, 3 );
final AxisAlignedBB box = AxisAlignedBB.getBoundingBox( x - 0.2, y - 0.2, z - 0.2, x + 1.2, y + 1.2, z + 1.2 );
for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
{
if( ei instanceof EntityItem )
{
final EntityItem entityItem = (EntityItem) ei;
this.storeEntityItem( entityItem );
}
}
for( final ItemStack snaggedItem : items )
{
this.storeItemStack( snaggedItem );
}
}
}

View file

@ -0,0 +1,111 @@
/*
* 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.parts.automation;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.client.texture.CableBusTextures;
public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
{
private final static IIcon ACTIVE_ICON = CableBusTextures.BlockIdentityAnnihilationPlaneOn.getIcon();
private static final float SILK_TOUCH_FACTOR = 16;
public PartIdentityAnnihilationPlane( ItemStack is )
{
super( is );
}
@Override
@SideOnly( Side.CLIENT )
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
{
this.renderStaticWithIcon( x, y, z, rh, renderer, ACTIVE_ICON );
}
@Override
protected boolean isAnnihilationPlane( TileEntity blockTileEntity, ForgeDirection side )
{
if( blockTileEntity instanceof IPartHost )
{
final IPart p = ( (IPartHost) blockTileEntity ).getPart( side );
return p != null && p.getClass() == this.getClass();
}
return false;
}
@Override
protected float calculateEnergyUsage( WorldServer w, int x, int y, int z, List<ItemStack> items )
{
final float requiredEnergy = super.calculateEnergyUsage( w, x, y, z, items );
return requiredEnergy * SILK_TOUCH_FACTOR;
}
@Override
protected List<ItemStack> obtainBlockDrops( WorldServer w, int x, int y, int z )
{
final FakePlayer fakePlayer = FakePlayerFactory.getMinecraft( w );
final Block block = w.getBlock( x, y, z );
final int blockMeta = w.getBlockMetadata( x, y, z );
if( block.canSilkHarvest( w, fakePlayer, x, y, z, blockMeta ) )
{
final List<ItemStack> out = new ArrayList<ItemStack>( 1 );
final Item item = Item.getItemFromBlock( block );
if( item != null )
{
int meta = 0;
if( item.getHasSubtypes() )
{
meta = blockMeta;
}
ItemStack itemstack = new ItemStack( item, 1, meta );
out.add( itemstack );
}
return out;
}
else
{
return super.obtainBlockDrops( w, x, y, z );
}
}
}

View file

@ -423,6 +423,7 @@ item.appliedenergistics2.ItemMaterial.SkyDust.name=Sky Stone Dust
item.appliedenergistics2.ItemMaterial.CardCrafting.name=Crafting Card
item.appliedenergistics2.ItemPart.AnnihilationPlane.name=ME Annihilation Plane
item.appliedenergistics2.ItemPart.IdentityAnnihilationPlane.name=ME Identity Annihilation Plane
item.appliedenergistics2.ItemPart.CableAnchor.name=Cable Anchor
item.appliedenergistics2.ItemPart.CableCovered.name=ME Covered Cable
item.appliedenergistics2.ItemPart.CableGlass.name=ME Glass Cable

View file

@ -57,6 +57,10 @@ shaped=
mc:iron_ingot ae2:ItemMaterial.AnnihilationCore mc:iron_ingot
-> ae2:ItemPart.AnnihilationPlane
shapeless=
ae2:ItemPart.AnnihilationPlane ae2:ItemMaterial.FluixPearl
-> ae2:ItemPart.IdentityAnnihilationPlane
shaped=
glass ae2:ItemPart.Terminal glass,
cable _ cable,

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

View file

@ -0,0 +1,23 @@
{
"animation": {
"frametime": 2,
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B