Begin enabling work for dynamic model groups
This commit is contained in:
parent
57544803b4
commit
523cf8a67c
|
|
@ -1,11 +1,14 @@
|
|||
package org.embeddedt.modernfix.common.mixin.perf.dynamic_resources;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.resources.model.BlockStateModelLoader;
|
||||
import net.minecraft.client.resources.model.ClientItemInfoLoader;
|
||||
import net.minecraft.client.resources.model.ModelManager;
|
||||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.server.packs.resources.Resource;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.embeddedt.modernfix.dynresources.DynamicModelSystem;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -41,4 +44,13 @@ public class MixinModelManager {
|
|||
) {
|
||||
return new DynamicModelSystem.DynamicResolver(inputModels, loadedModels, loadedClientInfos, standaloneModels).resolvedModels();
|
||||
}
|
||||
|
||||
/**
|
||||
* @author embeddedt
|
||||
* @reason Build the model groups dynamically
|
||||
*/
|
||||
@Overwrite
|
||||
private static Object2IntMap<BlockState> buildModelGroups(BlockColors blockColors, BlockStateModelLoader.LoadedModels loadedModels) {
|
||||
return new DynamicModelSystem.BlockGroupingMap(blockColors, loadedModels);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,13 @@ import com.google.common.cache.CacheBuilder;
|
|||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.Maps;
|
||||
import it.unimi.dsi.fastutil.objects.AbstractObject2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectSet;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectSets;
|
||||
import net.minecraft.client.color.block.BlockColors;
|
||||
import net.minecraft.client.renderer.block.model.ItemModelGenerator;
|
||||
import net.minecraft.client.renderer.item.ItemModel;
|
||||
import net.minecraft.client.resources.model.BlockStateModelLoader;
|
||||
import net.minecraft.client.resources.model.ClientItemInfoLoader;
|
||||
import net.minecraft.client.resources.model.MissingBlockModel;
|
||||
|
|
@ -112,4 +117,35 @@ public class DynamicModelSystem {
|
|||
return new ModelManager.ResolvedModels(resolvedMissingModel, Maps.asMap(inputModels.keySet(), resolvedModelCache::getUnchecked));
|
||||
}
|
||||
}
|
||||
|
||||
public static class BlockGroupingMap extends AbstractObject2IntMap<BlockState> {
|
||||
private final BlockColors blockColors;
|
||||
private final BlockStateModelLoader.LoadedModels loadedModels;
|
||||
|
||||
record GroupKey(Object equalityGroup, List<Object> coloringValues) {}
|
||||
|
||||
private final Object2IntMap<GroupKey> groupKeyToId;
|
||||
|
||||
public BlockGroupingMap(BlockColors blockColors, BlockStateModelLoader.LoadedModels loadedModels) {
|
||||
this.blockColors = blockColors;
|
||||
this.loadedModels = loadedModels;
|
||||
this.groupKeyToId = new Object2IntOpenHashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectSet<Entry<BlockState>> object2IntEntrySet() {
|
||||
return ObjectSets.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(Object key) {
|
||||
// TODO: Implement
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user