Reworked cable connections (#3334)
* Reworked cable connections Added enums for cable variants and sizes. Rules for connections between a cable and another cable or grid member are much more simple without any exceptions for certain combinations. 1/ Connections are rendered as the lowest type between cores. 2/ Each type uses are core for clear separation. 3/ The core will always be on the cable with the higher order.
This commit is contained in:
@@ -132,7 +132,7 @@ class CableBuilder
|
||||
break;
|
||||
case DENSE_COVERED:
|
||||
case DENSE_SMART:
|
||||
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
|
||||
this.addCableCore( CableCoreType.DENSE, color, quadsOut );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class CableBuilder
|
||||
case COVERED:
|
||||
cubeBuilder.addCube( 5, 5, 5, 11, 11, 11 );
|
||||
break;
|
||||
case DENSE_SMART:
|
||||
case DENSE:
|
||||
cubeBuilder.addCube( 3, 3, 3, 13, 13, 13 );
|
||||
break;
|
||||
}
|
||||
@@ -329,7 +329,6 @@ class CableBuilder
|
||||
|
||||
public void addConstrainedCoveredConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, List<BakedQuad> quadsOut )
|
||||
{
|
||||
|
||||
// The core of a covered cable reaches up to 5 voxels from the block edge, so
|
||||
// drawing a connection can only occur from there onwards
|
||||
if( distanceFromEdge >= 5 )
|
||||
@@ -348,6 +347,11 @@ class CableBuilder
|
||||
|
||||
public void addSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
|
||||
{
|
||||
if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS )
|
||||
{
|
||||
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||
return;
|
||||
}
|
||||
|
||||
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
||||
|
||||
|
||||
@@ -169,20 +169,7 @@ public class CableBusBakedModel implements IBakedModel
|
||||
|
||||
final AECableType secondType = sides.get( firstSide.getOpposite() );
|
||||
|
||||
// Certain cable types have restrictions on when they're rendered as a straight connection
|
||||
switch( cableType )
|
||||
{
|
||||
case GLASS:
|
||||
return firstType == AECableType.GLASS && secondType == AECableType.GLASS;
|
||||
case DENSE_COVERED:
|
||||
return firstType == AECableType.DENSE_COVERED && secondType == AECableType.DENSE_COVERED;
|
||||
case DENSE_SMART:
|
||||
return firstType == AECableType.DENSE_SMART && secondType == AECableType.DENSE_SMART;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
return firstType == secondType;
|
||||
}
|
||||
|
||||
private void addCableQuads( CableBusRenderState renderState, List<BakedQuad> quadsOut )
|
||||
|
||||
@@ -40,7 +40,7 @@ import appeng.core.AppEng;
|
||||
*/
|
||||
public enum CableCoreType
|
||||
{
|
||||
GLASS( "parts/cable/core/glass" ), COVERED( "parts/cable/core/covered" ), DENSE_SMART( "parts/cable/core/dense_smart" );
|
||||
GLASS( "parts/cable/core/glass" ), COVERED( "parts/cable/core/covered" ), DENSE( "parts/cable/core/dense_smart" );
|
||||
|
||||
private static final Map<AECableType, CableCoreType> cableMapping = generateCableMapping();
|
||||
|
||||
@@ -55,8 +55,8 @@ public enum CableCoreType
|
||||
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
||||
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
||||
result.put( AECableType.SMART, CableCoreType.COVERED );
|
||||
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE_SMART );
|
||||
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE_SMART );
|
||||
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE );
|
||||
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE );
|
||||
|
||||
return ImmutableMap.copyOf( result );
|
||||
}
|
||||
|
||||
@@ -1157,9 +1157,6 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
|
||||
if( cable != null )
|
||||
{
|
||||
final boolean isSmart = cable.getCableConnectionType() == AECableType.SMART || cable.getCableConnectionType() == AECableType.DENSE_SMART;
|
||||
final boolean isDense = cable.getCableConnectionType() == AECableType.DENSE_COVERED || cable.getCableConnectionType() == AECableType.DENSE_SMART;
|
||||
|
||||
renderState.setCableColor( cable.getCableColor() );
|
||||
renderState.setCableType( cable.getCableConnectionType() );
|
||||
renderState.setCoreType( CableCoreType.fromCableType( cable.getCableConnectionType() ) );
|
||||
@@ -1184,11 +1181,10 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
|
||||
if( adjacentTe instanceof IGridHost )
|
||||
{
|
||||
if( !( adjacentTe instanceof IPartHost ) || isDense )
|
||||
{
|
||||
IGridHost gridHost = (IGridHost) adjacentTe;
|
||||
connectionType = gridHost.getCableConnectionType( AEPartLocation.fromFacing( facing.getOpposite() ) );
|
||||
}
|
||||
final IGridHost gridHost = (IGridHost) adjacentTe;
|
||||
final AECableType adjacentType = gridHost.getCableConnectionType( AEPartLocation.fromFacing( facing.getOpposite() ) );
|
||||
|
||||
connectionType = AECableType.min( connectionType, adjacentType );
|
||||
}
|
||||
|
||||
// Check if the adjacent TE is a cable bus or not
|
||||
@@ -1205,7 +1201,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
// adjacent tile requires it
|
||||
for( EnumFacing facing : EnumFacing.values() )
|
||||
{
|
||||
int channels = isSmart ? cable.getChannelsOnSide( facing ) : 0;
|
||||
int channels = cable.getCableConnectionType().isSmart() ? cable.getChannelsOnSide( facing ) : 0;
|
||||
renderState.getChannelsOnSide().put( facing, channels );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ public abstract class PartDenseCable extends PartCable
|
||||
if( te instanceof IGridHost )
|
||||
{
|
||||
final AECableType t = ( (IGridHost) te ).getCableConnectionType( of.getOpposite() );
|
||||
return t == AECableType.DENSE_COVERED || t == AECableType.DENSE_SMART;
|
||||
return t.isDense();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user