Skip to content

Commit 1f9cf3a

Browse files
fix: minor fix
1 parent c3efdcd commit 1f9cf3a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

common/src/main/java/dev/ftb/mods/ftblibrary/icon/AtlasSpriteIcon.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import net.minecraft.client.gui.GuiGraphics;
66
import net.minecraft.client.renderer.RenderPipelines;
77
import net.minecraft.client.renderer.texture.TextureAtlas;
8+
import net.minecraft.data.AtlasIds;
89
import net.minecraft.resources.Identifier;
910
import org.jetbrains.annotations.Nullable;
1011

@@ -27,12 +28,9 @@ public Identifier getId() {
2728

2829
@Override
2930
public void draw(GuiGraphics graphics, int x, int y, int w, int h) {
30-
var sprite = Minecraft.getInstance().getAtlasManager().getAtlasOrThrow(TextureAtlas.LOCATION_BLOCKS).getSprite(id);
31-
32-
if (sprite == null) {
33-
return;
34-
}
35-
31+
// TODO: @since 21.11: This isn't ideal. We should really be looking this up or something?
32+
var isItem = id.getPath().startsWith("item/");
33+
var sprite = Minecraft.getInstance().getAtlasManager().getAtlasOrThrow(isItem ? AtlasIds.ITEMS : AtlasIds.BLOCKS).getSprite(id);
3634
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, sprite, x, y, w, h, color.rgba());
3735
}
3836

0 commit comments

Comments
 (0)