Fix and improve cable models (#335)

This commit is contained in:
Serenibyss
2023-12-24 20:23:01 -06:00
committed by GitHub
parent 29098372af
commit 28696bd531
82 changed files with 91 additions and 158 deletions
@@ -467,8 +467,8 @@ class CableBuilder {
// Dense cables show used channels in groups of 4, rounded up
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -493,7 +493,7 @@ class CableBuilder {
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_COVERED).get(cableColor);
cubeBuilder.setTexture(texture);
setStraightCableUVs(cubeBuilder, facing, 5, 11);
setStraightCableUVs(cubeBuilder, facing, 3, 13);
addStraightDenseCableSizedCube(facing, cubeBuilder);
}
@@ -504,15 +504,15 @@ class CableBuilder {
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor);
cubeBuilder.setTexture(texture);
setStraightCableUVs(cubeBuilder, facing, 5, 11);
setStraightCableUVs(cubeBuilder, facing, 3, 13);
addStraightDenseCableSizedCube(facing, cubeBuilder);
// Dense cables show used channels in groups of 4, rounded up
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
// Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true);
@@ -556,14 +556,14 @@ class CableBuilder {
case DOWN:
case UP:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.addCube(3, 0, 3, 13, 16, 13);
cubeBuilder.addCube(3, -0.01f, 3, 13, 16.01f, 13);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
break;
case EAST:
case WEST:
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 3);
cubeBuilder.addCube(0, 3, 3, 16, 13, 13);
cubeBuilder.addCube(-0.01f, 3, 3, 16.01f, 13, 13);
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
break;
@@ -571,7 +571,7 @@ class CableBuilder {
case SOUTH:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.setUvRotation(EnumFacing.WEST, 3);
cubeBuilder.addCube(3, 3, 0, 13, 13, 16);
cubeBuilder.addCube(3, 3, -0.01f, 13, 13, 16.01f);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
break;
@@ -611,14 +611,14 @@ class CableBuilder {
case DOWN:
case UP:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.addCube(5, 0, 5, 11, 16, 11);
cubeBuilder.addCube(5, -0.01f, 5, 11, 16.01f, 11);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
break;
case EAST:
case WEST:
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 3);
cubeBuilder.addCube(0, 5, 5, 16, 11, 11);
cubeBuilder.addCube(-0.01f, 5, 5, 16.01f, 11, 11);
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
break;
@@ -626,7 +626,7 @@ class CableBuilder {
case SOUTH:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.setUvRotation(EnumFacing.WEST, 3);
cubeBuilder.addCube(5, 5, 0, 11, 11, 16);
cubeBuilder.addCube(5, 5, -0.01f, 11, 11, 16.01f);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
break;
@@ -702,6 +702,7 @@ class CableBuilder {
}
Collections.addAll(locations, SmartCableTextures.SMART_CHANNELS_TEXTURES);
Collections.addAll(locations, SmartCableTextures.DENSE_SMART_CHANNELS_TEXTURES);
return locations;
}
@@ -32,20 +32,43 @@ import java.util.function.Function;
*/
public class SmartCableTextures {
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14")
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14"),
};
// Textures used to display channels on smart cables. There's two sets of 5 textures each, and
// one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] textures;
public static final ResourceLocation[] DENSE_SMART_CHANNELS_TEXTURES = {
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_00"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_01"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_02"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_03"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_04"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_10"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_11"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_12"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_13"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_14"),
};
// Textures used to display channels on dense smart cables. There's two sets of 5 textures each, and
// one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] denseTextures;
public SmartCableTextures(Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
this.textures = Arrays.stream(SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
this.denseTextures = Arrays.stream(DENSE_SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
}
/**
@@ -61,8 +84,18 @@ public class SmartCableTextures {
}
}
public TextureAtlasSprite getOddTextureForDenseChannels(int channels) {
if (channels < 0) {
return this.denseTextures[0];
} else if (channels <= 4) {
return this.denseTextures[channels];
} else {
return this.denseTextures[4];
}
}
/**
* The odd variant is used for displaying channels 5-8 as in use.
* The even variant is used for displaying channels 5-8 as in use.
*/
public TextureAtlasSprite getEvenTextureForChannels(int channels) {
if (channels < 5) {
@@ -73,4 +106,14 @@ public class SmartCableTextures {
return this.textures[9];
}
}
public TextureAtlasSprite getEvenTextureForDenseChannels(int channels) {
if (channels < 5) {
return this.denseTextures[5];
} else if (channels <= 8) {
return this.denseTextures[1 + channels];
} else {
return this.denseTextures[9];
}
}
}
@@ -976,7 +976,10 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
// Check if the adjacent TE is a cable bus or not
if (adjacentTe instanceof IPartHost) {
renderState.getCableBusAdjacent().add(facing);
IPartHost host = (IPartHost) adjacentTe;
if (host.getPart(facing) != null) {
renderState.getCableBusAdjacent().add(facing);
}
}
renderState.getConnectionTypes().put(facing, connectionType);
@@ -3,70 +3,32 @@
"elements": [
{
"name": "Base",
"from": [
4.0,
4.0,
2.0
],
"to": [
12.0,
12.0,
14.0
],
"from": [4.0, 4.0, 2.0],
"to": [12.0, 12.0, 14.0],
"faces": {
"north": {
"texture": "#base",
"uv": [
4.0,
4.0,
12.0,
11.0
]
"uv": [6.0, 6.0, 10.0, 10.0]
},
"east": {
"texture": "#base",
"uv": [
0.0,
4.0,
4.0,
12.0
]
"uv": [0.0, 4.0, 4.0, 12.0]
},
"south": {
"texture": "#base",
"uv": [
11.0,
4.0,
4.0,
12.0
]
"uv": [10.0, 6.0, 6.0, 10.0]
},
"west": {
"texture": "#base",
"uv": [
4.0,
4.0,
0.0,
12.0
]
"uv": [4.0, 4.0, 0.0, 12.0]
},
"up": {
"texture": "#base",
"uv": [
4.0,
0.0,
12.0,
5.0
]
"uv": [4.0, 0.0, 12.0, 5.0]
},
"down": {
"texture": "#base",
"uv": [
4.0,
12.0,
12.0,
16.0
]
"uv": [4.0, 12.0, 12.0, 16.0]
}
}
}
@@ -6,139 +6,63 @@
"elements": [
{
"name": "Base",
"from": [
4.0,
4.0,
2.0
],
"to": [
12.0,
12.0,
14.0
],
"from": [4.0, 4.0, 2.0],
"to": [12.0, 12.0, 14.0],
"faces": {
"north": {
"texture": "#base",
"uv": [
4.0,
4.0,
12.0,
11.0
]
"uv": [6.0, 6.0, 10.0, 10.0]
},
"east": {
"texture": "#base",
"uv": [
0.0,
4.0,
4.0,
12.0
]
"uv": [0.0, 4.0, 4.0, 12.0]
},
"south": {
"texture": "#base",
"uv": [
11.0,
4.0,
4.0,
12.0
]
"uv": [10.0, 6.0, 6.0, 10.0]
},
"west": {
"texture": "#base",
"uv": [
4.0,
4.0,
0.0,
12.0
]
"uv": [4.0, 4.0, 0.0, 12.0]
},
"up": {
"texture": "#base",
"uv": [
4.0,
0.0,
12.0,
5.0
]
"uv": [4.0, 0.0, 12.0, 5.0]
},
"down": {
"texture": "#base",
"uv": [
4.0,
12.0,
12.0,
16.0
]
"uv": [4.0, 12.0, 12.0, 16.0]
}
}
},
{
"name": "Channels",
"from": [
4.0,
4.0,
2.0
],
"to": [
12.0,
12.0,
14.0
],
"from": [4.0, 4.0, 2.0],
"to": [12.0, 12.0, 14.0],
"faces": {
"north": {
"texture": "#channels",
"uv": [
5.0,
5.0,
11.0,
11.0
]
"uv": [4.0, 4.0, 12.0, 12.0]
},
"east": {
"texture": "#channels",
"uv": [
0.0,
5.0,
5.0,
11.0
]
"uv": [0.0, 4.0, 4.0, 12.0]
},
"south": {
"texture": "#channels",
"uv": [
11.0,
5.0,
5.0,
11.0
]
"uv": [12.0, 4.0, 4.0, 12.0]
},
"west": {
"texture": "#channels",
"uv": [
5.0,
5.0,
0.0,
11.0
]
"uv": [4.0, 4.0, 0.0, 12.0]
},
"up": {
"texture": "#channels",
"uv": [
5.0,
0.0,
11.0,
5.0
]
"uv": [4.0, 0.0, 12.0, 4.0]
},
"down": {
"texture": "#channels",
"uv": [
5.0,
11.0,
11.0,
16.0
]
"uv": [4.0, 12.0, 12.0, 16.0]
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 330 B

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 6.0 KiB