|
13 | 13 | import it.unimi.dsi.fastutil.objects.ReferenceSets; |
14 | 14 | import net.fabricmc.fabric.impl.client.model.loading.UnbakedModelDeserializerRegistry; |
15 | 15 | import net.minecraft.client.color.block.BlockColors; |
16 | | -import net.minecraft.client.renderer.item.ClientItem; |
17 | 16 | import net.minecraft.client.renderer.block.dispatch.BlockStateModel; |
18 | 17 | import net.minecraft.client.resources.model.cuboid.ItemModelGenerator; |
19 | 18 | import net.minecraft.client.resources.model.BlockStateModelLoader; |
|
33 | 32 | import org.embeddedt.modernfix.common.mixin.perf.dynamic_resources.BlockStateDefinitionsAccessor; |
34 | 33 | import org.embeddedt.modernfix.common.mixin.perf.dynamic_resources.IdMapperAccessor; |
35 | 34 | import org.embeddedt.modernfix.common.mixin.perf.dynamic_resources.ModelDiscoveryAccessor; |
36 | | -import org.jetbrains.annotations.Nullable; |
37 | 35 |
|
38 | 36 | import java.io.Reader; |
39 | 37 | import java.util.AbstractSet; |
|
48 | 46 | public class DynamicModelSystem { |
49 | 47 | private static final FileToIdConverter MODEL_LISTER = FileToIdConverter.json("models"); |
50 | 48 | private static final FileToIdConverter BLOCKSTATE_LISTER = FileToIdConverter.json("blockstates"); |
51 | | - private static final FileToIdConverter ITEM_LISTER = FileToIdConverter.json("items"); |
52 | 49 |
|
53 | 50 | public static final boolean DEBUG_DYNAMIC_MODEL_LOADING = Boolean.getBoolean("modernfix.debugDynamicModelLoading"); |
54 | 51 |
|
@@ -107,35 +104,6 @@ public BlockStateModelLoader.LoadedModels load(Identifier key) throws Exception |
107 | 104 | })); |
108 | 105 | } |
109 | 106 |
|
110 | | - public interface SingleClientItemEntryLoader { |
111 | | - @Nullable ClientItem loadEntry(Identifier resourceFileId, Resource resource); |
112 | | - } |
113 | | - |
114 | | - public static ClientItemInfoLoader.LoadedClientInfos createDynamicClientInfos(Map<Identifier, Resource> resourceMap, SingleClientItemEntryLoader entryLoader) { |
115 | | - Set<Identifier> itemIdSet = resourceMap.keySet().stream().map(ITEM_LISTER::fileToId).collect(Collectors.toUnmodifiableSet()); |
116 | | - return new ClientItemInfoLoader.LoadedClientInfos(Maps.asMap(itemIdSet, key -> { |
117 | | - if (key == null) { |
118 | | - return null; |
119 | | - } |
120 | | - |
121 | | - Identifier fileId = ITEM_LISTER.idToFile(key); |
122 | | - Resource resource = resourceMap.get(fileId); |
123 | | - if (resource == null) { |
124 | | - return null; |
125 | | - } |
126 | | - |
127 | | - try { |
128 | | - if (DEBUG_DYNAMIC_MODEL_LOADING) { |
129 | | - ModernFix.LOGGER.info("Loading client item info {}", key); |
130 | | - } |
131 | | - return entryLoader.loadEntry(fileId, resource); |
132 | | - } catch (RuntimeException e) { |
133 | | - ModernFix.LOGGER.warn("Failed to build dynamic client item info for {}", key, e); |
134 | | - return null; |
135 | | - } |
136 | | - })); |
137 | | - } |
138 | | - |
139 | 107 | public record DynamicResolver(Map<Identifier, UnbakedModel> inputModels, |
140 | 108 | BlockStateModelLoader.LoadedModels loadedModels, |
141 | 109 | ClientItemInfoLoader.LoadedClientInfos loadedClientInfos) { |
|
0 commit comments