Jump to content

Anon10W1z

Forge Modder
  • Posts

    311
  • Joined

  • Last visited

Everything posted by Anon10W1z

  1. I'd advise you to see how it's done in BlockFire.class and adapt it into your custom fire block class.
  2. Why? Can't you just go to the nether...?
  3. My two cents. It's better to teach a man to fish than to give him fish.
  4. I've added another tutorial: how to remove crafting recipes
  5. I think I should leave those features for the user to implement, instead of spoon-feeding them that much, but I'll leave those as ideas in the OP. Thanks!
  6. Hello, my name is Anon10W1z. I have been modding for just under a year and want to enlighten some of the modders here with the information I have gathered through my experience. 1. How to avoid enchantment ID conflicts In 1.7, Forge had dropped the need to specify the ID of your item or block in its constructor. That was great! However, enchantment IDs still need to be specified in the constructor. I have developed a simple algorithm to combat this. Behold! private static int findFreeEnchantID() { int i; for (i = 0; i < Enchantment.enchantmentsList.length; ++i) if (Enchantment.enchantmentsList[i] == null) break; return i; } 1.8 version: private static int findFreeEnchantID() { int i; for (i = 0; i < 256; ++i) if (Enchantment.getEnchantmentById(i) == null) break; return i; } It is a very simple yet effective algorithm that will only fail if there is no room for an enchantment at all, which is a problem that can only be solved by deleting the enchantment itself. It simply checks for an open space for an enchantment with the lowest enchantment ID it can find. All that is left to do is call findFreeEnchantID() in the enchantment's constructor. Some other ideas to think about: Give a reasonable crash report if no free enchantment ID is found. Allow the user to pick whether or not to have the enchantment ID automatically selected for them. If not, allow them to pick the ID. 2. Remove a crafting recipe from the game It is pretty simple to add a crafting recipe to Minecraft, but what if you want to remove a crafting recipe from Minecraft? Let me direct your attention to the following method: private static void removeRecipe(ItemStack result) { ItemStack recipeResult = null; List recipes = craftingmanager.getRecipeList(); for (int scan = 0; scan < recipes.size(); scan++) { IRecipe tmpRecipe = (IRecipe) recipes.get(scan); recipeResult = tmpRecipe.getRecipeOutput(); if (recipeResult != null) { if (recipeResult.getItem() == resultItem.getItem() && recipeResult.getItemDamage() == resultItem.getItemDamage()) { recipes.remove(scan); --scan; } } } } Call this method with whatever ItemStack you wish. It is another simple method that will search through all recipes for results that match the given ItemStack. If it finds the desired item to remove, then it checks for matching metadata values. If that also matches, then the recipe is removed from the list of recipes. More tutorials will come soon!
  7. Thanks, I just need a couple of things clarified. Does the item name in the model mesh registration refer to the name with metadata? And the subitems are in the format "stained_glass_shard_red" right? Thanks again.
  8. Nope, that didn't help. I'm presuming you mean use the register method in the item model mesher? In addition, no error messages are outputted to the client log. for (int i = 0; i < 16; ++i) modelMesher.register(CppItems.stained_glass_shard, i, new ModelResourceLocation(CppReferences.MODID + ":" + "stained_glass_shard_" + ItemStainedGlassShard.getColorFromMeta(i), "inventory"));
  9. Would you know by chance how to create .json files for metadata items?
  10. I have a metadata item called a stained glass shard. The problem is that all 16 metadata values rely on the same .json file, which means that all 16 metadata variations of the item must have the same texture. Is there a way around this? All of my other items and blocks and their models and textures work like a charm.
×
×
  • Create New...

Important Information

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