mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
Added an ability to register custom item variants, not ending with "#inventory". Should allow grouping multiple item models into 1 blockstate json.
This commit is contained in:
1 parent
a54b939ea3
commit
097c0c6130
5 files changed
+68
-12
No files matched your search
@@ -55,17 +55,18 @@ public class DynBucketTest
|
||||
return ModelDynBucket.LOCATION;
|
||||
}
|
||||
});
|
||||
ModelBakery.addVariantName(dynBucket, "forge:dynbucket");
|
||||
ModelBakery.registerItemVariants(dynBucket, new ResourceLocation("forge", "dynbucket"));
|
||||
|
||||
final ModelResourceLocation bottle = new ModelResourceLocation(new ResourceLocation("forge", "dynbottle"), "inventory");
|
||||
ModelLoader.setCustomMeshDefinition(dynBottle, new ItemMeshDefinition()
|
||||
{
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
{
|
||||
return new ModelResourceLocation(new ResourceLocation("forge", "dynbottle"), "inventory");
|
||||
return bottle;
|
||||
}
|
||||
});
|
||||
ModelBakery.addVariantName(dynBottle, "forge:dynbottle");
|
||||
ModelBakery.registerItemVariants(dynBottle, bottle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,6 @@ public class ForgeBlockStatesLoaderDebug {
|
||||
Item customWallItem = Item.getItemFromBlock(blockCustomWall);
|
||||
ModelLoader.setCustomModelResourceLocation(customWallItem, 0, new ModelResourceLocation(ASSETS + "cobblestone_wall", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(customWallItem, 1, new ModelResourceLocation(ASSETS + "mossy_cobblestone_wall", "inventory"));
|
||||
ModelBakery.addVariantName(customWallItem, ASSETS + "cobblestone_wall", ASSETS + "mossy_cobblestone_wall");
|
||||
}
|
||||
|
||||
// this block is never actually used, it's only needed for the error message on load to see the variant it maps to
|
||||
|
||||
@@ -60,9 +60,10 @@ public class ModelFluidDebug
|
||||
Item fluid = Item.getItemFromBlock(TestFluidBlock.instance);
|
||||
Item gas = Item.getItemFromBlock(TestGasBlock.instance);
|
||||
Item milk = Item.getItemFromBlock(MilkFluidBlock.instance);
|
||||
ModelBakery.addVariantName(fluid);
|
||||
ModelBakery.addVariantName(gas);
|
||||
ModelBakery.addVariantName(milk);
|
||||
// no need to pass the locations here, since they'll be loaded by the block model logic.
|
||||
ModelBakery.registerItemVariants(fluid);
|
||||
ModelBakery.registerItemVariants(gas);
|
||||
ModelBakery.registerItemVariants(milk);
|
||||
ModelLoader.setCustomMeshDefinition(fluid, new ItemMeshDefinition()
|
||||
{
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
|
||||
Reference in new issue
Block a user