Skip to content

Commit d6c368f

Browse files
committed
fix: make the image selector work again
1 parent 33f391b commit d6c368f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

common/src/main/java/dev/ftb/mods/ftblibrary/config/ui/resource/ResourceSearchMode.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import dev.ftb.mods.ftblibrary.util.client.ClientUtils;
1111
import net.minecraft.client.Minecraft;
1212
import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite;
13-
import net.minecraft.client.renderer.texture.SpriteContents;
1413
import net.minecraft.client.renderer.texture.TextureAtlas;
1514
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
1615
import net.minecraft.core.registries.BuiltInRegistries;
16+
import net.minecraft.data.AtlasIds;
1717
import net.minecraft.network.chat.Component;
1818
import net.minecraft.resources.Identifier;
1919
import net.minecraft.server.packs.resources.Resource;
@@ -125,12 +125,12 @@ public Collection<? extends SelectableResource<Identifier>> getAllResources() {
125125
() -> FTBLibrary.LOGGER.warn("Image {} has invalid path! Report this to author of '{}'!", rl, rl.getNamespace())
126126
));
127127

128+
TextureAtlas blockAtlas = Minecraft.getInstance().getAtlasManager().getAtlasOrThrow(AtlasIds.BLOCKS);
128129
cachedImages = images.stream().sorted().map(res -> {
129130
// shorten <mod>:textures/A/B.png to <mod>:A/B
130131
Identifier res1 = Identifier.fromNamespaceAndPath(res.getNamespace(), res.getPath().substring(9, res.getPath().length() - 4));
131-
TextureAtlasSprite sprite = Minecraft.getInstance().getAtlasManager().getAtlasOrThrow(TextureAtlas.LOCATION_BLOCKS).getSprite(res1);
132-
SpriteContents contents = sprite.contents();
133-
if (contents.name().equals(MissingTextureAtlasSprite.getLocation())) {
132+
TextureAtlasSprite sprite = blockAtlas.getSprite(res1);
133+
if (sprite.contents().name().equals(MissingTextureAtlasSprite.getLocation())) {
134134
res1 = res;
135135
}
136136
return new ImageResource(res1);

0 commit comments

Comments
 (0)