2222 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323 * THE SOFTWARE.
2424 */
25- package de .bluecolored .bluemap .core .map .hires .blockmodel ;
25+ package de .bluecolored .bluemap .core .map .hires .block ;
2626
2727import com .github .benmanes .caffeine .cache .Caffeine ;
2828import com .github .benmanes .caffeine .cache .LoadingCache ;
2929import de .bluecolored .bluemap .core .map .TextureGallery ;
30- import de .bluecolored .bluemap .core .map .hires .TileModelView ;
3130import de .bluecolored .bluemap .core .map .hires .RenderSettings ;
31+ import de .bluecolored .bluemap .core .map .hires .TileModelView ;
3232import de .bluecolored .bluemap .core .resources .pack .resourcepack .ResourcePack ;
33- import de .bluecolored .bluemap .core .resources .pack .resourcepack .blockmodel .BlockModel ;
3433import de .bluecolored .bluemap .core .resources .pack .resourcepack .blockstate .Variant ;
3534import de .bluecolored .bluemap .core .util .math .Color ;
36- import de .bluecolored .bluemap .core .world .block .BlockNeighborhood ;
3735import de .bluecolored .bluemap .core .world .BlockState ;
36+ import de .bluecolored .bluemap .core .world .block .BlockNeighborhood ;
3837
3938import java .util .ArrayList ;
4039import java .util .List ;
@@ -52,35 +51,35 @@ public BlockStateModelRenderer(ResourcePack resourcePack, TextureGallery texture
5251 .build (type -> type .create (resourcePack , textureGallery , renderSettings ));
5352 }
5453
55- public void render (BlockNeighborhood <?> block , TileModelView blockModel , Color blockColor ) {
54+ public void render (BlockNeighborhood block , TileModelView blockModel , Color blockColor ) {
5655 render (block , block .getBlockState (), blockModel , blockColor );
5756 }
5857
5958 private final Color waterloggedColor = new Color ();
60- public void render (BlockNeighborhood <?> block , BlockState blockState , TileModelView blockModel , Color blockColor ) {
59+ public void render (BlockNeighborhood block , BlockState blockState , TileModelView tileModel , Color blockColor ) {
6160 blockColor .set (0 , 0 , 0 , 0 , true );
6261
6362 //shortcut for air
6463 if (blockState .isAir ()) return ;
6564
66- int modelStart = blockModel .getStart ();
65+ int modelStart = tileModel .getStart ();
6766
6867 // render block
69- renderModel (block , blockState , blockModel .initialize (), blockColor );
68+ renderModel (block , blockState , tileModel .initialize (), blockColor );
7069
7170 // add water if block is waterlogged
7271 if (blockState .isWaterlogged () || block .getProperties ().isAlwaysWaterlogged ()) {
7372 waterloggedColor .set (0f , 0f , 0f , 0f , true );
74- renderModel (block , WATERLOGGED_BLOCKSTATE , blockModel .initialize (), waterloggedColor );
73+ renderModel (block , WATERLOGGED_BLOCKSTATE , tileModel .initialize (), waterloggedColor );
7574 blockColor .set (waterloggedColor .overlay (blockColor .premultiplied ()));
7675 }
7776
78- blockModel .initialize (modelStart );
77+ tileModel .initialize (modelStart );
7978 }
8079
8180 private final Color variantColor = new Color ();
82- private void renderModel (BlockNeighborhood <?> block , BlockState blockState , TileModelView blockModel , Color blockColor ) {
83- int modelStart = blockModel .getStart ();
81+ private void renderModel (BlockNeighborhood block , BlockState blockState , TileModelView tileModel , Color blockColor ) {
82+ int modelStart = tileModel .getStart ();
8483
8584 var stateResource = resourcePack .getBlockState (blockState );
8685 if (stateResource == null ) return ;
@@ -91,19 +90,14 @@ private void renderModel(BlockNeighborhood<?> block, BlockState blockState, Tile
9190
9291 //noinspection ForLoopReplaceableByForEach
9392 for (int i = 0 ; i < variants .size (); i ++) {
94- Variant variant = variants .get (i );
95-
96- BlockModel modelResource = variant .getModel ().getResource (resourcePack ::getBlockModel );
97- if (modelResource == null ) continue ;
98-
9993 variantColor .set (0f , 0f , 0f , 0f , true );
10094
101- blockRenderers .get (modelResource .getRenderer ())
102- .render (block , variant , blockModel .initialize (), variantColor );
95+ Variant variant = variants .get (i );
96+ blockRenderers .get (variant .getRenderer ())
97+ .render (block , variant , tileModel .initialize (), variantColor );
10398
10499 if (variantColor .a > blockColorOpacity )
105100 blockColorOpacity = variantColor .a ;
106-
107101 blockColor .add (variantColor .premultiplied ());
108102 }
109103
@@ -112,7 +106,7 @@ private void renderModel(BlockNeighborhood<?> block, BlockState blockState, Tile
112106 blockColor .a = blockColorOpacity ;
113107 }
114108
115- blockModel .initialize (modelStart );
109+ tileModel .initialize (modelStart );
116110 }
117111
118112 private final static BlockState WATERLOGGED_BLOCKSTATE = new BlockState ("minecraft:water" );
0 commit comments