Covered dense cables (#3030)

* Renamed all dense smart cable related things to include smart
* Added dense covered cables
* Added abstract PartDenseCable to reduce redundant code
* Added dense covered recipes

* Ensures ItemPart ordering to be consitent.

Now takes the metadata into account to preserve the ordering for colored
items instead of just the part type name and depend on the insertion
order of a hashmap.
This commit is contained in:
yueh
2017-08-17 18:41:39 +02:00
committed by GitHub
parent 4f9fd1b369
commit b61219ef88
77 changed files with 818 additions and 61 deletions
@@ -101,6 +101,9 @@ class CableBuilder
case SMART:
textureFolder = "parts/cable/smart/";
break;
case DENSE_COVERED:
textureFolder = "parts/cable/dense_covered/";
break;
case DENSE_SMART:
textureFolder = "parts/cable/dense_smart/";
break;
@@ -127,6 +130,7 @@ class CableBuilder
case SMART:
this.addCableCore( CableCoreType.COVERED, color, quadsOut );
break;
case DENSE_COVERED:
case DENSE_SMART:
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
break;
@@ -448,7 +452,31 @@ class CableBuilder
addCoveredCableSizedCube( facing, distanceFromEdge, cubeBuilder );
}
public void addDenseConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
public void addDenseCoveredConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List<BakedQuad> quadsOut )
{
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
if( connectionType == AECableType.COVERED || connectionType == AECableType.SMART || connectionType == AECableType.GLASS )
{
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
return;
}
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
// We render all faces except the one on the connection side
cubeBuilder.setDrawFaces( EnumSet.complementOf( EnumSet.of( facing ) ) );
TextureAtlasSprite texture = this.connectionTextures.get( AECableType.DENSE_COVERED ).get( cableColor );
cubeBuilder.setTexture( texture );
addDenseCableSizedCube( facing, cubeBuilder );
// Reset back to normal rendering for the rest
cubeBuilder.setRenderFullBright( false );
cubeBuilder.setTexture( texture );
}
public void addDenseSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
{
// Dense cables only render their connections as dense if the adjacent blocks actually wants that
if( connectionType == AECableType.SMART )
@@ -456,7 +484,7 @@ class CableBuilder
this.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
return;
}
else if( connectionType != AECableType.DENSE_SMART )
else if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS )
{
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
return;
@@ -495,7 +523,19 @@ class CableBuilder
}
public void addStraightDenseConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
public void addStraightDenseCoveredConnection( EnumFacing facing, AEColor cableColor, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
TextureAtlasSprite texture = this.connectionTextures.get( AECableType.DENSE_COVERED ).get( cableColor );
cubeBuilder.setTexture( texture );
setStraightCableUVs( cubeBuilder, facing, 5, 11 );
addStraightDenseCableSizedCube( facing, cubeBuilder );
}
public void addStraightDenseSmartConnection( EnumFacing facing, AEColor cableColor, int channels, List<BakedQuad> quadsOut )
{
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
@@ -164,6 +164,8 @@ public class CableBusBakedModel implements IBakedModel
{
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;
}
@@ -200,8 +202,11 @@ public class CableBusBakedModel implements IBakedModel
case SMART:
this.cableBuilder.addStraightSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
break;
case DENSE_COVERED:
this.cableBuilder.addStraightDenseCoveredConnection( facing, cableColor, quadsOut );
break;
case DENSE_SMART:
this.cableBuilder.addStraightDenseConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
this.cableBuilder.addStraightDenseSmartConnection( facing, cableColor, renderState.getChannelsOnSide().get( facing ), quadsOut );
break;
}
@@ -228,6 +233,7 @@ public class CableBusBakedModel implements IBakedModel
case SMART:
this.cableBuilder.addConstrainedSmartConnection( facing, cableColor, distance, channels, quadsOut );
break;
case DENSE_COVERED:
case DENSE_SMART:
// Dense cables do not render connections to parts since none can be attached
break;
@@ -253,8 +259,11 @@ public class CableBusBakedModel implements IBakedModel
case SMART:
this.cableBuilder.addSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
break;
case DENSE_COVERED:
this.cableBuilder.addDenseCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
break;
case DENSE_SMART:
this.cableBuilder.addDenseConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
this.cableBuilder.addDenseSmartConnection( facing, cableColor, connectionType, cableBusAdjacent, channels, quadsOut );
break;
}
}
@@ -55,6 +55,7 @@ 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 );
return ImmutableMap.copyOf( result );