|
10 | 10 | import dev.ftb.mods.ftblibrary.util.client.ClientUtils; |
11 | 11 | import net.minecraft.client.Minecraft; |
12 | 12 | import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; |
13 | | -import net.minecraft.client.renderer.texture.SpriteContents; |
14 | 13 | import net.minecraft.client.renderer.texture.TextureAtlas; |
15 | 14 | import net.minecraft.client.renderer.texture.TextureAtlasSprite; |
16 | 15 | import net.minecraft.core.registries.BuiltInRegistries; |
| 16 | +import net.minecraft.data.AtlasIds; |
17 | 17 | import net.minecraft.network.chat.Component; |
18 | 18 | import net.minecraft.resources.Identifier; |
19 | 19 | import net.minecraft.server.packs.resources.Resource; |
@@ -125,12 +125,12 @@ public Collection<? extends SelectableResource<Identifier>> getAllResources() { |
125 | 125 | () -> FTBLibrary.LOGGER.warn("Image {} has invalid path! Report this to author of '{}'!", rl, rl.getNamespace()) |
126 | 126 | )); |
127 | 127 |
|
| 128 | + TextureAtlas blockAtlas = Minecraft.getInstance().getAtlasManager().getAtlasOrThrow(AtlasIds.BLOCKS); |
128 | 129 | cachedImages = images.stream().sorted().map(res -> { |
129 | 130 | // shorten <mod>:textures/A/B.png to <mod>:A/B |
130 | 131 | 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())) { |
134 | 134 | res1 = res; |
135 | 135 | } |
136 | 136 | return new ImageResource(res1); |
|
0 commit comments