Added Network Tool Facade Transparency Option.

This commit is contained in:
AlgorithmX2
2014-08-02 23:53:34 -05:00
parent 06856eb957
commit c45d7f1b71
15 changed files with 257 additions and 34 deletions
+21 -15
View File
@@ -447,11 +447,14 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
part.getBoxes( bch );
}
if ( includeFacades && s != null && s != ForgeDirection.UNKNOWN )
if ( AEApi.instance().partHelper().getCableRenderMode().opaqueFacades || !visual )
{
IFacadePart fp = fc.getFacade( s );
if ( fp != null )
fp.getBoxes( bch );
if ( includeFacades && s != null && s != ForgeDirection.UNKNOWN )
{
IFacadePart fp = fc.getFacade( s );
if ( fp != null )
fp.getBoxes( bch, e );
}
}
}
@@ -844,21 +847,24 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
}
}
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
if ( AEApi.instance().partHelper().getCableRenderMode().opaqueFacades )
{
IFacadePart p = fc.getFacade( side );
if ( p != null )
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
List<AxisAlignedBB> boxes = new LinkedList<AxisAlignedBB>();
IPartCollsionHelper bch = new BusCollisionHelper( boxes, side, null, true );
p.getBoxes( bch );
for (AxisAlignedBB bb : boxes)
IFacadePart p = fc.getFacade( side );
if ( p != null )
{
bb = bb.expand( 0.01, 0.01, 0.01 );
if ( bb.isVecInside( pos ) )
List<AxisAlignedBB> boxes = new LinkedList<AxisAlignedBB>();
IPartCollsionHelper bch = new BusCollisionHelper( boxes, side, null, true );
p.getBoxes( bch, null );
for (AxisAlignedBB bb : boxes)
{
return new SelectedPart( p, side );
bb = bb.expand( 0.01, 0.01, 0.01 );
if ( bb.isVecInside( pos ) )
{
return new SelectedPart( p, side );
}
}
}
}
+13 -3
View File
@@ -27,6 +27,7 @@ import appeng.api.parts.PartItemStack;
import appeng.api.parts.SelectedPart;
import appeng.core.AELog;
import appeng.core.AppEng;
import appeng.core.CommonHelper;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
import appeng.core.sync.packets.PacketPartPlacement;
@@ -137,7 +138,7 @@ public class PartPlacement
if ( mop != null )
{
List<ItemStack> is = new LinkedList();
SelectedPart sp = host.selectPart( mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ) );
SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ) );
if ( sp.part != null )
{
@@ -247,7 +248,7 @@ public class PartPlacement
if ( mop != null )
{
mop.hitVec = mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ );
SelectedPart sPart = host.selectPart( mop.hitVec );
SelectedPart sPart = selectPart( player, host, mop.hitVec );
if ( sPart != null && sPart.part != null )
if ( sPart.part.onShiftActivate( player, mop.hitVec ) )
{
@@ -364,7 +365,7 @@ public class PartPlacement
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
if ( mop != null )
{
SelectedPart sp = host.selectPart( mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ) );
SelectedPart sp = selectPart( player, host, mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ ) );
if ( sp.part != null )
{
@@ -407,6 +408,15 @@ public class PartPlacement
return true;
}
private static SelectedPart selectPart(EntityPlayer player, IPartHost host, Vec3 pos)
{
CommonHelper.proxy.updateRenderMode( player );
SelectedPart sp = host.selectPart( pos );
CommonHelper.proxy.updateRenderMode( null );
return sp;
}
public static IFacadePart isFacade(ItemStack held, ForgeDirection side)
{
if ( held.getItem() instanceof IFacadeItem )