From bf4b471f18465c22e7671eb96923bb2282a0aa07 Mon Sep 17 00:00:00 2001 From: malte0811 Date: Sun, 15 Sep 2024 13:09:19 +0200 Subject: [PATCH] Use deterministic random for feedthrough model This should make the icon generation stable again. --- .../models/connection/FeedthroughModel.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/blusunrize/immersiveengineering/client/models/connection/FeedthroughModel.java b/src/main/java/blusunrize/immersiveengineering/client/models/connection/FeedthroughModel.java index ee0f66f2ed..6d7d7ad66b 100644 --- a/src/main/java/blusunrize/immersiveengineering/client/models/connection/FeedthroughModel.java +++ b/src/main/java/blusunrize/immersiveengineering/client/models/connection/FeedthroughModel.java @@ -331,6 +331,7 @@ public SpecificFeedthroughModel(FeedthroughCacheKey key, Int2IntFunction colorMu private void init(FeedthroughCacheKey k, Int2IntFunction colorMultiplierBasic) { + RandomSource random = RandomSource.create(0); BakedModel model = mc().getBlockRenderer().getBlockModelShaper() .getBlockModel(k.baseState); if(colorMultiplierBasic==null) @@ -345,7 +346,7 @@ private void init(FeedthroughCacheKey k, Int2IntFunction colorMultiplierBasic) k.specificColorMultipliers.put(i, ret); return ret; }; - boolean renderBlockInLayer = k.layer==null||model.getRenderTypes(k.baseState, RANDOM_SOURCE, ModelData.EMPTY).contains(k.layer); + boolean renderBlockInLayer = k.layer==null||model.getRenderTypes(k.baseState, random, ModelData.EMPTY).contains(k.layer); for(int j = 0; j < 7; j++) { Direction side = j < 6?DirectionUtils.VALUES[j]: null; @@ -356,7 +357,7 @@ private void init(FeedthroughCacheKey k, Int2IntFunction colorMultiplierBasic) if(renderBlockInLayer) { List modelQuads = model.getQuads( - k.baseState, side, RANDOM_SOURCE, ModelData.EMPTY, k.layer + k.baseState, side, random, ModelData.EMPTY, k.layer ); quads.add(QuadTransformer.color(colorMultiplier).process(modelQuads)); } @@ -365,20 +366,20 @@ private void init(FeedthroughCacheKey k, Int2IntFunction colorMultiplierBasic) facing = facing.getOpposite(); case -1: if(k.layer==RenderType.solid()) - quads.add(getConnQuads(facing, side, k.type, new Matrix4(), k.layer)); + quads.add(getConnQuads(facing, side, k.type, new Matrix4(), k.layer, random)); break; case Integer.MAX_VALUE: Matrix4 mat = new Matrix4(); mat.translate(0, 0, 1); - List all = new ArrayList<>(getConnQuads(facing, side, k.type, mat, k.layer)); + List all = new ArrayList<>(getConnQuads(facing, side, k.type, mat, k.layer, random)); mat = new Matrix4(); mat.translate(0, 0, -1); - all.addAll(getConnQuads(facing.getOpposite(), side, k.type, mat, k.layer)); + all.addAll(getConnQuads(facing.getOpposite(), side, k.type, mat, k.layer, random)); if(renderBlockInLayer) { var tintTransformer = QuadTransformer.color(colorMultiplier); all.addAll(tintTransformer.process( - model.getQuads(k.baseState, side, RANDOM_SOURCE, ModelData.EMPTY, k.layer) + model.getQuads(k.baseState, side, random, ModelData.EMPTY, k.layer) )); } quads.add(all); @@ -390,7 +391,7 @@ private void init(FeedthroughCacheKey k, Int2IntFunction colorMultiplierBasic) } private List getConnQuads( - Direction facing, Direction side, WireType type, Matrix4 mat, RenderType layer + Direction facing, Direction side, WireType type, Matrix4 mat, RenderType layer, RandomSource source ) { //connector model+feedthrough border @@ -410,7 +411,7 @@ private List getConnQuads( mat.translate(-.5, -.5, -.5); BakedModel model = mc().getBlockRenderer().getBlockModelShaper() .getBlockModel(info.connector().setValue(IEProperties.FACING_ALL, Direction.DOWN)); - List conn = new ArrayList<>(model.getQuads(null, side, RANDOM_SOURCE, ModelData.EMPTY, layer)); + List conn = new ArrayList<>(model.getQuads(null, side, source, ModelData.EMPTY, layer)); if(side==facing) conn.add(ModelUtils.createBakedQuad( vertices, Direction.UP, getTexture(info), info.uvs(), WHITE, false