mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-24 22:04:33 +00:00
Add a way to register multiple item variants.
This commit is contained in:
1 parent
ec3cc219f0
commit
30a05ebeae
1 file changed
+11
@@ -3,6 +3,7 @@ package mantle.client;
|
||||
import java.util.Collection;
|
||||
|
||||
import mantle.blocks.util.BlockVariant;
|
||||
import mantle.items.util.IItemWithVariants;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
@@ -55,6 +56,16 @@ public class ModelVariant
|
||||
this.mc.getRenderItem().getItemModelMesher().register(item, meta, this.getModelResource(name, "inventory"));
|
||||
}
|
||||
|
||||
public void registerItemModelVariants(Item item)
|
||||
{
|
||||
for (int i = 0; i < ((IItemWithVariants) item).getVariantNames().length; i++)
|
||||
{
|
||||
String NAME = item.getUnlocalizedName().substring(5) + "_" + ((IItemWithVariants) item).getVariantNames()[i];
|
||||
ModelBakery.addVariantName(item, (this.MOD_ID + ":") + NAME);
|
||||
this.registerItemModel(item, NAME, i);
|
||||
}
|
||||
}
|
||||
|
||||
private ModelResourceLocation getModelResource(String name, String type)
|
||||
{
|
||||
return new ModelResourceLocation((this.MOD_ID + ":") + name, type);
|
||||
|
||||
Reference in new issue
Block a user