BC Facades work again.

This commit is contained in:
AlgorithmX2 2014-05-04 14:54:07 -05:00
parent e25014fd5b
commit 0ed7cd7bb4
2 changed files with 7 additions and 10 deletions

View file

@ -35,10 +35,10 @@ import appeng.api.util.AECableType;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord; import appeng.api.util.DimensionalCoord;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.facade.IFacadeItem;
import appeng.helpers.AEMultiTile; import appeng.helpers.AEMultiTile;
import appeng.parts.BusCollisionHelper; import appeng.parts.BusCollisionHelper;
import appeng.parts.CableBusContainer; import appeng.parts.CableBusContainer;
import appeng.parts.PartPlacement;
import appeng.tile.networking.TileCableBus; import appeng.tile.networking.TileCableBus;
import appeng.util.Platform; import appeng.util.Platform;
import codechicken.lib.data.MCDataInput; import codechicken.lib.data.MCDataInput;
@ -285,19 +285,14 @@ public class CableBusPart extends JCuboidPart implements JNormalOcclusion, IReds
@Override @Override
public boolean canAddPart(ItemStack is, ForgeDirection side) public boolean canAddPart(ItemStack is, ForgeDirection side)
{ {
if ( is.getItem() instanceof IFacadeItem ) IFacadePart fp = PartPlacement.isFacade( is, side );
if ( fp != null )
{ {
IFacadeItem bi = (IFacadeItem) is.getItem();
is = is.copy();
is.stackSize = 1;
IFacadePart bp = bi.createPartFromItemStack( is, side );
if ( !(side == null || side == ForgeDirection.UNKNOWN || tile() == null) ) if ( !(side == null || side == ForgeDirection.UNKNOWN || tile() == null) )
{ {
List<AxisAlignedBB> boxes = new ArrayList(); List<AxisAlignedBB> boxes = new ArrayList();
IPartCollsionHelper bch = new BusCollisionHelper( boxes, side, null, true ); IPartCollsionHelper bch = new BusCollisionHelper( boxes, side, null, true );
bp.getBoxes( bch ); fp.getBoxes( bch );
for (AxisAlignedBB bb : boxes) for (AxisAlignedBB bb : boxes)
{ {
disableFacadeOcclusion.set( true ); disableFacadeOcclusion.set( true );

View file

@ -377,16 +377,18 @@ public class PartPlacement
return true; return true;
} }
private static IFacadePart isFacade(ItemStack held, ForgeDirection side) public static IFacadePart isFacade(ItemStack held, ForgeDirection side)
{ {
if ( held.getItem() instanceof IFacadeItem ) if ( held.getItem() instanceof IFacadeItem )
return ((IFacadeItem) held.getItem()).createPartFromItemStack( held, side ); return ((IFacadeItem) held.getItem()).createPartFromItemStack( held, side );
if ( AppEng.instance.isIntegrationEnabled( "BC" ) ) if ( AppEng.instance.isIntegrationEnabled( "BC" ) )
{ {
IBC bc = (IBC) AppEng.instance.getIntegration( "BC" ); IBC bc = (IBC) AppEng.instance.getIntegration( "BC" );
if ( bc.isFacade( held ) ) if ( bc.isFacade( held ) )
return bc.createFacadePart( held, side ); return bc.createFacadePart( held, side );
} }
return null; return null;
} }