Skip to content

Commit a14f0d7

Browse files
committed
Fix small issue with the new CTM Model.
1 parent cd7b09f commit a14f0d7

File tree

2 files changed

+90
-30
lines changed

2 files changed

+90
-30
lines changed

gradle.properties

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ org.gradle.daemon=false
55

66
#version info
77
minecraft_version=1.18.2
8-
mod_version=1.1.6.0
9-
ctm_version=1.18.2-1.1.4+4
10-
top_version=1.16-3.1.4-22
8+
mod_version=1.1.6.1

src/main/java/platinpython/rgbblocks/client/model/AntiblockBakedModel.java

+89-27
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ private static List<BakedQuad> genCtmQuads(BakedQuad frameQuad, List<BakedQuad>
148148
TextureAtlasSprite sprite = frameQuad.getSprite();
149149
TextureAtlasSprite ctmSprite = Minecraft.getInstance()
150150
.getTextureAtlas(InventoryMenu.BLOCK_ATLAS)
151-
.apply(new ResourceLocation(RGBBlocks.MOD_ID,
152-
"block/antiblock_ctm"
153-
));
151+
.apply(new ResourceLocation(RGBBlocks.MOD_ID, "block/antiblock_ctm"));
154152

155153
List<BakedQuad> quads = new ArrayList<>(bgQuads);
156154

@@ -303,6 +301,30 @@ public IModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull Block
303301
boolean west = false;
304302
boolean up = false;
305303
boolean down = false;
304+
boolean upNorth = false;
305+
boolean upNorthColor = false;
306+
boolean upEast = false;
307+
boolean upEastColor = false;
308+
boolean upSouth = false;
309+
boolean upSouthColor = false;
310+
boolean upWest = false;
311+
boolean upWestColor = false;
312+
boolean northEast = false;
313+
boolean northEastColor = false;
314+
boolean southEast = false;
315+
boolean southEastColor = false;
316+
boolean southWest = false;
317+
boolean southWestColor = false;
318+
boolean northWest = false;
319+
boolean northWestColor = false;
320+
boolean downNorth = false;
321+
boolean downNorthColor = false;
322+
boolean downEast = false;
323+
boolean downEastColor = false;
324+
boolean downSouth = false;
325+
boolean downSouthColor = false;
326+
boolean downWest = false;
327+
boolean downWestColor = false;
306328

307329
if (getAntiblockAt(level, pos.north()) instanceof RGBTileEntity otherBlockEntity)
308330
north = otherBlockEntity.getColor() == blockEntity.getColor();
@@ -316,18 +338,54 @@ public IModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull Block
316338
up = otherBlockEntity.getColor() == blockEntity.getColor();
317339
if (getAntiblockAt(level, pos.below()) instanceof RGBTileEntity otherBlockEntity)
318340
down = otherBlockEntity.getColor() == blockEntity.getColor();
319-
boolean upNorth = getAntiblockAt(level, pos.above().north()) instanceof RGBTileEntity;
320-
boolean upEast = getAntiblockAt(level, pos.above().east()) instanceof RGBTileEntity;
321-
boolean upSouth = getAntiblockAt(level, pos.above().south()) instanceof RGBTileEntity;
322-
boolean upWest = getAntiblockAt(level, pos.above().west()) instanceof RGBTileEntity;
323-
boolean northEast = getAntiblockAt(level, pos.north().east()) instanceof RGBTileEntity;
324-
boolean southEast = getAntiblockAt(level, pos.south().east()) instanceof RGBTileEntity;
325-
boolean southWest = getAntiblockAt(level, pos.south().west()) instanceof RGBTileEntity;
326-
boolean northWest = getAntiblockAt(level, pos.north().west()) instanceof RGBTileEntity;
327-
boolean downNorth = getAntiblockAt(level, pos.below().north()) instanceof RGBTileEntity;
328-
boolean downEast = getAntiblockAt(level, pos.below().east()) instanceof RGBTileEntity;
329-
boolean downSouth = getAntiblockAt(level, pos.below().south()) instanceof RGBTileEntity;
330-
boolean downWest = getAntiblockAt(level, pos.below().west()) instanceof RGBTileEntity;
341+
if (getAntiblockAt(level, pos.above().north()) instanceof RGBTileEntity otherBlockEntity) {
342+
upNorth = true;
343+
upNorthColor = otherBlockEntity.getColor() == blockEntity.getColor();
344+
}
345+
if (getAntiblockAt(level, pos.above().east()) instanceof RGBTileEntity otherBlockEntity) {
346+
upEast = true;
347+
upEastColor = otherBlockEntity.getColor() == blockEntity.getColor();
348+
}
349+
if (getAntiblockAt(level, pos.above().south()) instanceof RGBTileEntity otherBlockEntity) {
350+
upSouth = true;
351+
upSouthColor = otherBlockEntity.getColor() == blockEntity.getColor();
352+
}
353+
if (getAntiblockAt(level, pos.above().west()) instanceof RGBTileEntity otherBlockEntity) {
354+
upWest = true;
355+
upWestColor = otherBlockEntity.getColor() == blockEntity.getColor();
356+
}
357+
if (getAntiblockAt(level, pos.north().east()) instanceof RGBTileEntity otherBlockEntity) {
358+
northEast = true;
359+
northEastColor = otherBlockEntity.getColor() == blockEntity.getColor();
360+
}
361+
if (getAntiblockAt(level, pos.south().east()) instanceof RGBTileEntity otherBlockEntity) {
362+
southEast = true;
363+
southEastColor = otherBlockEntity.getColor() == blockEntity.getColor();
364+
}
365+
if (getAntiblockAt(level, pos.south().west()) instanceof RGBTileEntity otherBlockEntity) {
366+
southWest = true;
367+
southWestColor = otherBlockEntity.getColor() == blockEntity.getColor();
368+
}
369+
if (getAntiblockAt(level, pos.north().west()) instanceof RGBTileEntity otherBlockEntity) {
370+
northWest = true;
371+
northWestColor = otherBlockEntity.getColor() == blockEntity.getColor();
372+
}
373+
if (getAntiblockAt(level, pos.below().north()) instanceof RGBTileEntity otherBlockEntity) {
374+
downNorth = true;
375+
downNorthColor = otherBlockEntity.getColor() == blockEntity.getColor();
376+
}
377+
if (getAntiblockAt(level, pos.below().east()) instanceof RGBTileEntity otherBlockEntity) {
378+
downEast = true;
379+
downEastColor = otherBlockEntity.getColor() == blockEntity.getColor();
380+
}
381+
if (getAntiblockAt(level, pos.below().south()) instanceof RGBTileEntity otherBlockEntity) {
382+
downSouth = true;
383+
downSouthColor = otherBlockEntity.getColor() == blockEntity.getColor();
384+
}
385+
if (getAntiblockAt(level, pos.below().west()) instanceof RGBTileEntity otherBlockEntity) {
386+
downWest = true;
387+
downWestColor = otherBlockEntity.getColor() == blockEntity.getColor();
388+
}
331389
boolean upNorthEast = getAntiblockAt(level, pos.above().north().east()) instanceof RGBTileEntity;
332390
boolean upSouthEast = getAntiblockAt(level, pos.above().south().east()) instanceof RGBTileEntity;
333391
boolean upSouthWest = getAntiblockAt(level, pos.above().south().west()) instanceof RGBTileEntity;
@@ -339,23 +397,27 @@ public IModelData getModelData(@NotNull BlockAndTintGetter level, @NotNull Block
339397

340398
modelData.setData(AntiblockModelData.ANTIBLOCK_MODEL_DATA, new AntiblockModelData(
341399
new Connections(Direction.NORTH, up && !upNorth, down && !downNorth, east && !northEast,
342-
west && !northWest, upEast && !upNorthEast, upWest && !upNorthWest,
343-
downEast && !downNorthEast, downWest && !downNorthWest
400+
west && !northWest, upEast && upEastColor && !upNorthEast,
401+
upWest && upWestColor && !upNorthWest, downEast && downEastColor && !downNorthEast,
402+
downWest && downWestColor && !downNorthWest
344403
), new Connections(Direction.EAST, up && !upEast, down && !downEast, south && !southEast,
345-
north && !northEast, upSouth && !upSouthEast, upNorth && !upNorthEast,
346-
downSouth && !downSouthEast, downNorth && !downNorthEast
404+
north && !northEast, upSouth && upSouthColor && !upSouthEast,
405+
upNorth && upNorthColor && !upNorthEast,
406+
downSouth && downSouthColor && !downSouthEast,
407+
downNorth && downNorthColor && !downNorthEast
347408
), new Connections(Direction.SOUTH, up && !upSouth, down && !downSouth, west && !southWest, east && !southEast,
348-
upWest && !upSouthWest, upEast && !upSouthEast, downWest && !downSouthWest,
349-
downEast && !downSouthEast
409+
upWest && upWestColor && !upSouthWest, upEast && upEastColor && !upSouthEast,
410+
downWest && downWestColor && !downSouthWest, downEast && downEastColor && !downSouthEast
350411
), new Connections(Direction.WEST, up && !upWest, down && !downWest, north && !northWest, south && !southWest,
351-
upNorth && !upNorthWest, upSouth && !upSouthWest, downNorth && !downNorthWest,
352-
downSouth && !downSouthWest
412+
upNorth && upNorthColor && !upNorthWest, upSouth && upSouthColor && !upSouthWest,
413+
downNorth && downNorthColor && !downNorthWest, downSouth && downSouthColor && !downSouthWest
353414
), new Connections(Direction.UP, north && !upNorth, south && !upSouth, west && !upWest, east && !upEast,
354-
northWest && !upNorthWest, northEast && !upNorthEast, southWest & !upSouthWest,
355-
southEast && !upSouthEast
415+
northWest && northWestColor && !upNorthWest, northEast && northEastColor && !upNorthEast,
416+
southWest && southWestColor && !upSouthWest, southEast && southEastColor && !upSouthEast
356417
), new Connections(Direction.DOWN, south && !downSouth, north && !downNorth, west && !downWest,
357-
east && !downEast, southWest && !downSouthWest, southEast && !downSouthEast,
358-
northWest && !downNorthWest, northEast && !downNorthEast
418+
east && !downEast, southWest && southWestColor && !downSouthWest,
419+
southEast && southEastColor && !downSouthEast, northWest && northWestColor && !downNorthWest,
420+
northEast && northEastColor && !downNorthEast
359421
)));
360422
return modelData;
361423
}

0 commit comments

Comments
 (0)