Skip to content

Commit

Permalink
Move away from deprecated methods to get colors
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Aug 3, 2021
1 parent 75d2fd9 commit ad00460
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/mezz/jei/color/ColorGetter.java
Expand Up @@ -25,6 +25,7 @@

import mezz.jei.api.helpers.IColorHelper;
import mezz.jei.util.ErrorUtil;
import net.minecraftforge.client.model.data.EmptyModelData;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -174,7 +175,8 @@ private static TextureAtlasSprite getTextureAtlasSprite(BlockState blockState) {
Minecraft minecraft = Minecraft.getInstance();
BlockRenderDispatcher blockRendererDispatcher = minecraft.getBlockRenderer();
BlockModelShaper blockModelShapes = blockRendererDispatcher.getBlockModelShaper();
TextureAtlasSprite textureAtlasSprite = blockModelShapes.getParticleIcon(blockState);
BakedModel blockModel = blockModelShapes.getBlockModel(blockState);
TextureAtlasSprite textureAtlasSprite = blockModel.getParticleIcon(EmptyModelData.INSTANCE);
if (textureAtlasSprite instanceof MissingTextureAtlasSprite) {
return null;
}
Expand All @@ -186,7 +188,7 @@ private static TextureAtlasSprite getTextureAtlasSprite(ItemStack itemStack) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
ItemModelShaper itemModelMesher = itemRenderer.getItemModelShaper();
BakedModel itemModel = itemModelMesher.getItemModel(itemStack);
TextureAtlasSprite particleTexture = itemModel.getParticleIcon();
TextureAtlasSprite particleTexture = itemModel.getParticleIcon(EmptyModelData.INSTANCE);
if (particleTexture instanceof MissingTextureAtlasSprite) {
return null;
}
Expand Down

0 comments on commit ad00460

Please sign in to comment.