clean up mapping classes

This commit is contained in:
Sen 2025-06-22 18:53:23 +02:00
parent 7c495f3d1c
commit 0ca276b561
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
7 changed files with 58 additions and 103 deletions

View file

@ -21,7 +21,6 @@ import common.item.Item;
import common.model.ModelRotation;
import common.util.Facing;
import common.util.Pair;
import common.util.BaseMapping;
import common.world.State;
public abstract class ModelBakery
@ -46,14 +45,14 @@ public abstract class ModelBakery
}
}
public static BaseMapping<String, IBakedModel> setupModelRegistry(TextureMap textureMap,
public static Map<String, IBakedModel> setupModelRegistry(TextureMap textureMap,
Map<State, String> map)
{
final Map<String, TextureAtlasSprite> sprites = Maps.<String, TextureAtlasSprite>newHashMap();
Map<String, ModelBlock> models = Maps.<String, ModelBlock>newLinkedHashMap();
List<String> variants = Lists.<String>newArrayList();
FaceBakery faceBakery = new FaceBakery();
BaseMapping<String, IBakedModel> bakedRegistry = new BaseMapping();
Map<String, IBakedModel> bakedRegistry = Maps.newHashMap();
List<String> itemLocations = Lists.<String>newArrayList();
models.put(MISSING, (ModelBlock)new ModelBlock(null).add().all());
variants.add(MISSING);
@ -172,7 +171,7 @@ public abstract class ModelBakery
if (modelblock != null)
{
bakedRegistry.putObject(modelresourcelocation, bakeModel(sprites, faceBakery, textureMap.getMissingSprite(),
bakedRegistry.put(modelresourcelocation, bakeModel(sprites, faceBakery, textureMap.getMissingSprite(),
modelblock, modelblock.getRotation(), modelblock.isUvLocked()));
}
else
@ -189,11 +188,11 @@ public abstract class ModelBakery
{
if (modelblock1.getParent() == MODEL_ENTITY)
{
bakedRegistry.putObject(entry, new BuiltInModel(modelblock1.getTransform()));
bakedRegistry.put(entry, new BuiltInModel(modelblock1.getTransform()));
}
else
{
bakedRegistry.putObject(entry, bakeModel(sprites, faceBakery, textureMap.getMissingSprite(),
bakedRegistry.put(entry, bakeModel(sprites, faceBakery, textureMap.getMissingSprite(),
modelblock1, ModelRotation.X0_Y0, false));
}
}

View file

@ -11,7 +11,6 @@ import common.block.Block;
import common.collect.Maps;
import common.init.BlockRegistry;
import common.properties.Property;
import common.util.BaseMapping;
import common.world.State;
public class ModelManager
@ -21,7 +20,7 @@ public class ModelManager
private final Map<Block, StateMap> mappers = Maps.<Block, StateMap>newIdentityHashMap();
private final Set<Block> builtin = Collections.newSetFromMap(Maps.<Block, Boolean>newIdentityHashMap());
private BaseMapping<String, IBakedModel> modelRegistry;
private Map<String, IBakedModel> modelRegistry;
private IBakedModel defaultModel;
public ModelManager(TextureMap textures)
@ -43,7 +42,7 @@ public class ModelManager
public void onReload()
{
this.modelRegistry = ModelBakery.setupModelRegistry(this.texMap, this.getMap());
this.defaultModel = this.modelRegistry.getObject(ModelBakery.MISSING);
this.defaultModel = this.modelRegistry.get(ModelBakery.MISSING);
this.reloadModels();
}
@ -55,7 +54,7 @@ public class ModelManager
}
else
{
IBakedModel ibakedmodel = this.modelRegistry.getObject(modelLocation);
IBakedModel ibakedmodel = this.modelRegistry.get(modelLocation);
return ibakedmodel == null ? this.defaultModel : ibakedmodel;
}
}