This commit is contained in:
AlgorithmX2
2014-05-27 12:07:20 -05:00
24 changed files with 240 additions and 99 deletions
+19 -16
View File
@@ -170,25 +170,28 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
is.stackSize = 1;
IPart bp = bi.createPartFromItemStack( is );
if ( bp instanceof IPartCable )
if ( bp != null )
{
boolean canPlace = true;
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) )
canPlace = false;
if ( bp instanceof IPartCable )
{
boolean canPlace = true;
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) )
canPlace = false;
if ( !canPlace )
return false;
if ( !canPlace )
return false;
return getPart( ForgeDirection.UNKNOWN ) == null;
}
else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN )
{
IPart cable = getPart( ForgeDirection.UNKNOWN );
if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) )
return false;
return getPart( ForgeDirection.UNKNOWN ) == null;
}
else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN )
{
IPart cable = getPart( ForgeDirection.UNKNOWN );
if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) )
return false;
return getPart( side ) == null;
return getPart( side ) == null;
}
}
}
return false;
@@ -701,7 +704,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
p.readFromNBT( extra );
}
else
throw new RuntimeException( "Invalid NBT For CableBus Container." );
throw new RuntimeException( "Invalid NBT For CableBus Container: " + iss.getItem().getClass().getName() + " is not a valid part." );
}
}
else
+16
View File
@@ -28,6 +28,7 @@ import appeng.api.parts.SelectedPart;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
import appeng.core.sync.packets.PacketPartPlacement;
import appeng.facade.IFacadeItem;
import appeng.integration.abstraction.IBC;
@@ -61,6 +62,21 @@ public class PartPlacement
if ( te instanceof IPartHost )
event.setCanceled( true );
}
else if ( event.entityPlayer != null )
{
ItemStack held = event.entityPlayer.getHeldItem();
if ( event.entityPlayer.isSneaking() && held != null && AEApi.instance().items().itemMemoryCard.sameAs( held ) )
{
try
{
NetworkHandler.instance.sendToServer( new PacketClick( event.x, event.y, event.z, event.face, 0, 0, 0 ) );
}
catch (IOException e)
{
// :P
}
}
}
}
else if ( event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote )
{
+22 -2
View File
@@ -388,8 +388,28 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
worked = true;
if ( type == Actionable.MODULATE )
{
i.onItemUse( is, player, w, x, y, z, side.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
maxStorage = maxStorage - is.stackSize;
if ( i instanceof IPlantable )
{
boolean Worked = false;
if ( Worked == false && side.offsetX == 0 && side.offsetZ == 0 )
Worked = i.onItemUse( is, player, w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite().ordinal(),
side.offsetX, side.offsetY, side.offsetZ );
if ( Worked == false && side.offsetY == 0 )
Worked = i.onItemUse( is, player, w, x, y - 1, z, ForgeDirection.UP.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
if ( Worked == false )
Worked = i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
if ( Worked )
maxStorage = maxStorage - is.stackSize;
}
else
{
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
maxStorage = maxStorage - is.stackSize;
}
}
else
maxStorage = 1;
+1 -1
View File
@@ -241,7 +241,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
monitor = null;
if ( target != null )
{
IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, side.getOpposite(), StorageChannel.ITEMS );
IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, side.getOpposite(), StorageChannel.ITEMS, mySrc );
if ( esh != null )
{
IMEInventory inv = esh.getInventory( target, side.getOpposite(), StorageChannel.ITEMS, mySrc );