Dense/Cable can be defined more definitively by the Part Framework.
This commit is contained in:
parent
d1b67870e9
commit
6583ce8626
5 changed files with 64 additions and 41 deletions
|
@ -23,6 +23,7 @@ import appeng.api.config.Upgrades;
|
|||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.parts.BusSupport;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollsionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
@ -313,4 +314,10 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea
|
|||
return proxy.getNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePlacedOn(BusSupport what)
|
||||
{
|
||||
return what == BusSupport.CABLE;
|
||||
}
|
||||
|
||||
}
|
|
@ -135,12 +135,12 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
IPart bp = bi.createPartFromItemStack( is );
|
||||
if ( bp instanceof IPartCable )
|
||||
{
|
||||
boolean hasParts = false;
|
||||
boolean canPlace = true;
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
||||
if ( getPart( d ) != null )
|
||||
hasParts = true;
|
||||
if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) )
|
||||
canPlace = false;
|
||||
|
||||
if ( hasParts && !((IPartCable) bp).supportsBuses() )
|
||||
if ( !canPlace )
|
||||
return false;
|
||||
|
||||
return getPart( ForgeDirection.UNKNOWN ) == null;
|
||||
|
@ -148,7 +148,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN )
|
||||
{
|
||||
IPart cable = getPart( ForgeDirection.UNKNOWN );
|
||||
if ( cable != null && !((IPartCable) cable).supportsBuses() )
|
||||
if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) )
|
||||
return false;
|
||||
|
||||
return getPart( side ) == null;
|
||||
|
@ -172,12 +172,12 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
IPart bp = bi.createPartFromItemStack( is );
|
||||
if ( bp instanceof IPartCable )
|
||||
{
|
||||
boolean hasParts = false;
|
||||
boolean canPlace = true;
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
||||
if ( getPart( d ) != null )
|
||||
hasParts = true;
|
||||
if ( getPart( d ) != null && !getPart( d ).canBePlacedOn( ((IPartCable) bp).supportsBuses() ) )
|
||||
canPlace = false;
|
||||
|
||||
if ( hasParts && !((IPartCable) bp).supportsBuses() )
|
||||
if ( !canPlace )
|
||||
return null;
|
||||
|
||||
if ( getPart( ForgeDirection.UNKNOWN ) != null )
|
||||
|
@ -228,7 +228,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
else if ( !(bp instanceof IPartCable) && side != ForgeDirection.UNKNOWN )
|
||||
{
|
||||
IPart cable = getPart( ForgeDirection.UNKNOWN );
|
||||
if ( cable != null && !((IPartCable) cable).supportsBuses() )
|
||||
if ( cable != null && !bp.canBePlacedOn( ((IPartCable) cable).supportsBuses() ) )
|
||||
return null;
|
||||
|
||||
sides[side.ordinal()] = bp;
|
||||
|
@ -297,7 +297,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
IGridNode sn = part.getGridNode();
|
||||
if ( sn != null )
|
||||
{
|
||||
// this is a really stupid if statement, why was this here?
|
||||
// this is a really stupid if statement, why was this
|
||||
// here?
|
||||
// if ( !sn.getConnections().iterator().hasNext() )
|
||||
|
||||
IPart center = getPart( ForgeDirection.UNKNOWN );
|
||||
|
@ -542,8 +543,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||
if ( part != null )
|
||||
{
|
||||
setSide( s );
|
||||
BusCollisionHelper bch = new BusCollisionHelper( boxes, BusRenderHelper.instance.ax, BusRenderHelper.instance.ay,
|
||||
BusRenderHelper.instance.az );
|
||||
BusCollisionHelper bch = new BusCollisionHelper( boxes, BusRenderHelper.instance.ax, BusRenderHelper.instance.ay, BusRenderHelper.instance.az );
|
||||
part.getBoxes( bch );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.util.Vec3;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.BusSupport;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollsionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
@ -208,4 +209,10 @@ public class PartCableAnchor implements IPart
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePlacedOn(BusSupport what)
|
||||
{
|
||||
return what == BusSupport.CABLE || what == BusSupport.DENSE_CABLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import appeng.api.networking.GridFlags;
|
|||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.BusSupport;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollsionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
|
@ -52,9 +53,9 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsBuses()
|
||||
public BusSupport supportsBuses()
|
||||
{
|
||||
return true;
|
||||
return BusSupport.CABLE;
|
||||
}
|
||||
|
||||
public Icon getGlassTexture(AEColor c)
|
||||
|
@ -95,8 +96,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||
return CableBusTextures.MECable_Yellow.getIcon();
|
||||
default:
|
||||
}
|
||||
return AEApi.instance().parts().partCableGlass.item( AEColor.Transparent ).getIconIndex(
|
||||
AEApi.instance().parts().partCableGlass.stack( AEColor.Transparent, 1 ) );
|
||||
return AEApi.instance().parts().partCableGlass.item( AEColor.Transparent ).getIconIndex( AEApi.instance().parts().partCableGlass.stack( AEColor.Transparent, 1 ) );
|
||||
}
|
||||
|
||||
public Icon getTexture(AEColor c)
|
||||
|
@ -142,8 +142,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||
return CableBusTextures.MECovered_Yellow.getIcon();
|
||||
default:
|
||||
}
|
||||
return AEApi.instance().parts().partCableCovered.item( AEColor.Transparent ).getIconIndex(
|
||||
AEApi.instance().parts().partCableCovered.stack( AEColor.Transparent, 1 ) );
|
||||
return AEApi.instance().parts().partCableCovered.item( AEColor.Transparent ).getIconIndex( AEApi.instance().parts().partCableCovered.stack( AEColor.Transparent, 1 ) );
|
||||
}
|
||||
|
||||
public Icon getSmartTexture(AEColor c)
|
||||
|
|
|
@ -18,6 +18,7 @@ import appeng.api.networking.IGridNode;
|
|||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.parts.BusSupport;
|
||||
import appeng.api.parts.IPartCollsionHelper;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
|
@ -34,9 +35,9 @@ public class PartDenseCable extends PartCable
|
|||
{
|
||||
|
||||
@Override
|
||||
public boolean supportsBuses()
|
||||
public BusSupport supportsBuses()
|
||||
{
|
||||
return false;
|
||||
return BusSupport.DENSE_CABLE;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
|
@ -192,31 +193,40 @@ public class PartDenseCable extends PartCable
|
|||
boolean isGlass = false;
|
||||
AEColor myColor = getCableColor();
|
||||
/*
|
||||
* ( ghh != null && ccph != null && ghh.getCableConnectionType( of ) == AECableType.GLASS && ccph.getPart(
|
||||
* of.getOpposite() ) == null ) { isGlass = true; rh.setTexture( getGlassTexture( myColor = ccph.getColor() ) );
|
||||
* } else if ( ccph == null && ghh != null && ghh.getCableConnectionType( of ) != AECableType.GLASS ) {
|
||||
* rh.setTexture( getSmartTexture( myColor ) ); switch (of) { case DOWN: rh.setBounds( 3, 0, 3, 13, 4, 13 );
|
||||
* break; case EAST: rh.setBounds( 12, 3, 3, 16, 13, 13 ); break; case NORTH: rh.setBounds( 3, 3, 0, 13, 13, 4
|
||||
* ); break; case SOUTH: rh.setBounds( 3, 3, 12, 13, 13, 16 ); break; case UP: rh.setBounds( 3, 12, 3, 13, 16,
|
||||
* 13 ); break; case WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; } rh.renderBlock( x, y,
|
||||
* z, renderer );
|
||||
* ( ghh != null && ccph != null && ghh.getCableConnectionType( of ) ==
|
||||
* AECableType.GLASS && ccph.getPart( of.getOpposite() ) == null ) {
|
||||
* isGlass = true; rh.setTexture( getGlassTexture( myColor =
|
||||
* ccph.getColor() ) ); } else if ( ccph == null && ghh != null &&
|
||||
* ghh.getCableConnectionType( of ) != AECableType.GLASS ) {
|
||||
* rh.setTexture( getSmartTexture( myColor ) ); switch (of) { case DOWN:
|
||||
* rh.setBounds( 3, 0, 3, 13, 4, 13 ); break; case EAST: rh.setBounds(
|
||||
* 12, 3, 3, 16, 13, 13 ); break; case NORTH: rh.setBounds( 3, 3, 0, 13,
|
||||
* 13, 4 ); break; case SOUTH: rh.setBounds( 3, 3, 12, 13, 13, 16 );
|
||||
* break; case UP: rh.setBounds( 3, 12, 3, 13, 16, 13 ); break; case
|
||||
* WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; }
|
||||
* rh.renderBlock( x, y, z, renderer );
|
||||
*
|
||||
* if ( true ) { setSmartConnectionRotations( of, renderer ); Icon defa = new TaughtIcon( getChannelTex(
|
||||
* channels, false ).getIcon(), -0.2f ); Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(),
|
||||
* -0.2f );
|
||||
* if ( true ) { setSmartConnectionRotations( of, renderer ); Icon defa
|
||||
* = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f
|
||||
* ); Icon defb = new TaughtIcon( getChannelTex( channels, true
|
||||
* ).getIcon(), -0.2f );
|
||||
*
|
||||
* if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) { AEBaseBlock blk = (AEBaseBlock)
|
||||
* rh.getBlock(); FlipableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST ); ico.setFlip(
|
||||
* false, true ); }
|
||||
* if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) {
|
||||
* AEBaseBlock blk = (AEBaseBlock) rh.getBlock(); FlipableIcon ico =
|
||||
* blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
||||
* ico.setFlip( false, true ); }
|
||||
*
|
||||
* Tessellator.instance.setBrightness( 15 << 20 | 15 << 5 ); Tessellator.instance.setColorOpaque_I(
|
||||
* myColor.mediumVariant ); rh.setTexture( defa, defa, defa, defa, defa, defa ); renderAllFaces( (AEBaseBlock)
|
||||
* rh.getBlock(), x, y, z, renderer );
|
||||
* Tessellator.instance.setBrightness( 15 << 20 | 15 << 5 );
|
||||
* Tessellator.instance.setColorOpaque_I( myColor.mediumVariant );
|
||||
* rh.setTexture( defa, defa, defa, defa, defa, defa ); renderAllFaces(
|
||||
* (AEBaseBlock) rh.getBlock(), x, y, z, renderer );
|
||||
*
|
||||
* Tessellator.instance.setColorOpaque_I( myColor.whiteVariant ); rh.setTexture( defb, defb, defb, defb, defb,
|
||||
* defb ); renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, renderer );
|
||||
* Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
||||
* rh.setTexture( defb, defb, defb, defb, defb, defb ); renderAllFaces(
|
||||
* (AEBaseBlock) rh.getBlock(), x, y, z, renderer );
|
||||
*
|
||||
* renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth =
|
||||
* renderer.uvRotateBottom = renderer.uvRotateEast =
|
||||
* renderer.uvRotateNorth = renderer.uvRotateSouth =
|
||||
* renderer.uvRotateTop = renderer.uvRotateWest = 0; }
|
||||
*
|
||||
* rh.setTexture( getTexture( getCableColor() ) ); }
|
||||
|
|
Loading…
Reference in a new issue