Jump to content

benjamin7006

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by benjamin7006

  1. Hi! I'm trying to create a shard for one of my items where you cut it and it gives you it's shard's, I want the texture to change based on the amount in the stack, for example, if the ItemStack limit was 2 then if you held there was only 1 in the stack then the texture would show 1 shard but if there was 2 in the texture would change to show 2 shards. What code do I have to use to make different variants for the same item and how do I get the item to change variants? Edit: Nevermind I figured out how! Here is how I did it In my common proxy, I added public void registerItemVariant(Item item, ItemMeshDefinition meshDefinition, ModelResourceLocation... names) {} and in my client proxy, I added @Override public void registerItemVariantRenderer(Item item, ItemMeshDefinition meshDefinition, ModelResourceLocation... names) { ModelBakery.registerItemVariants(item, names); ModelLoader.setCustomMeshDefinition(item, meshDefinition); } Next, I created a new class called ItemMeshDefinitionHandler and did this public class ItemMeshDefinitionHandler implements ItemMeshDefinition { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { if(stack.getItem() == ItemInit.DIAMOND_SHARD) { if(stack.getCount() == 1) { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_1", "inventory"); } else if (stack.getCount() == 2) { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_2", "inventory"); } else { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_2", "inventory"); } } else if(stack.getItem() == ItemInit.COAL_SHARD) { if(stack.getCount() == 1) { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_1", "inventory"); } else if (stack.getCount() == 2) { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_2", "inventory"); } else { return new ModelResourceLocation(stack.getItem().getRegistryName() + "_2", "inventory"); } } return null; } } Then in a new class named ItemShard and extended my ItemBase class (In my ItemBase class it implements IHasModel) and did this public class ItemShard extends ItemBase { public String name; public ItemShard(String name, CreativeTabs creativeTab) { super(name, creativeTab); this.name = name; setMaxStackSize(8); } @Override public void registerModels() { Main.proxy.registerItemVariantRenderer(this, new ItemMeshDefinitionHandler(), new ModelResourceLocation(Reference.MOD_ID + ":" + name + "_1", "inventory"), new ModelResourceLocation(Reference.MOD_ID + ":" + name + "_2", "inventory")); } } Then finally I added the item to my ItemInit public static final Item DIAMOND_SHARD = new ItemShard("diamond_shard", Main.CreativeTab);
  2. Sorry, i posted this on my laptop and forgot to send the crash report crash-2019-02-07_18.35.43-client.txt
  3. Hello! I'm Trying To Install JEI To The Modding Environment But It Crashes As Soon As It Tries To Register, This Happens With Every Mod! Am I Doing Something Wrong? I've Done This Before So I Don't Understand
  4. Ok Thank You, Is There Any Tutorial On This? Like On The Wiki Or The Forums
  5. So Basically I'm Trying To Create A Recipe, I Tried To Create A Recipe Using The Old Method GameRegistry.addRecipe(name, recipe); GameRegistry.addShapedRecipe(name, output, params) GameRegistry.addShapelessRecipe(name, output, params); I Knew That This Was Updated So, I Was Hoping That Forge Has Updated Their API So We Can Create Recipes
  6. Ok, Before You Complain Please Don't Say That The New Update Changed Recipes Because I Know That Of Course BUT I'm Just Wondering If There Has Been A Update Yet To Forge, I Have The Latest Version, But If There Has Been And Update Its Not Working
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.