2025-11-24 22:52:51 +03:00

41 lines
1.2 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.client.renderer.block;
import java.util.Map;
import net.minecraft.client.renderer.block.model.BlockStateModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.world.level.block.state.BlockState;
public class BlockModelShaper {
private Map<BlockState, BlockStateModel> modelByStateCache = Map.of();
private final ModelManager modelManager;
public BlockModelShaper(ModelManager modelManager) {
this.modelManager = modelManager;
}
public TextureAtlasSprite getParticleIcon(BlockState blockState) {
return this.getBlockModel(blockState).particleIcon();
}
public BlockStateModel getBlockModel(BlockState state) {
BlockStateModel model = this.modelByStateCache.get(state);
if (model == null) {
model = this.modelManager.getMissingBlockStateModel();
}
return model;
}
public ModelManager getModelManager() {
return this.modelManager;
}
public void replaceCache(Map<BlockState, BlockStateModel> modelByStateCache) {
this.modelByStateCache = modelByStateCache;
}
}