Jump to content

El_Ludolf

Members
  • Posts

    3
  • Joined

  • Last visited

El_Ludolf's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Interesting way of handling it. Definitly gonna remember IRecipeFactory, as the mod may grow larger it may come in handy.
  2. Thanks a lot. I haven't found a way to meddle with the NBT values inside a JSON file. All the other recipes are JSONs.
  3. Good Morning People, maybe someone can help me with a Mod I'm triying to program right now. The mod also includes a grindstone which applies Sharpness every time used. The class looks like this till now: public class katanasharpening implements IRecipe { @Override public boolean matches(InventoryCrafting inv, World worldIn) { Boolean meitouexistend = false; Boolean grindstoneexistend = false; for(int slot = 0; slot < inv.getSizeInventory(); slot++) { if(inv.getStackInSlot(slot).getItem().getUnlocalizedName() == "meitoukokuhikari") { meitouexistend = true; } if(inv.getStackInSlot(slot).getItem().getUnlocalizedName() == "grindstone") { grindstoneexistend = true; } } if(grindstoneexistend && meitouexistend) { return true; } else { return false; } } @Override public ItemStack getCraftingResult(InventoryCrafting inv) { int meitouposition = 0; int currentlevel = 0; for(int slot = 0; slot < inv.getSizeInventory(); slot++) { if(inv.getStackInSlot(slot).getItem().getUnlocalizedName() == "meitoukokuhikari") { meitouposition = slot; } } NBTTagList tags = inv.getStackInSlot(meitouposition).getEnchantmentTagList(); if(tags != null) { for (int i = 0; i < tags.tagCount(); ++i) { int j = tags.getCompoundTagAt(i).getShort("id"); int k = tags.getCompoundTagAt(i).getShort("lvl"); if(j == 16) { currentlevel = k; } } } inv.removeStackFromSlot(meitouposition); ItemStack kokumeitou = new ItemStack(HikariTouMod.meitoukokuhikari); kokumeitou.addEnchantment(Enchantments.SHARPNESS, currentlevel +1); return kokumeitou; } Questions: Is inv.getStackInSlot(slot).getItem().getUnlocalizedName() == "something" a good way to check if the right items inside? Through debugging it seems 16 is the id for sharpness? How would I now register the recipe? GameRegistry.addShaplessRecipe(katanasharpening); ?? addShapelessRecipe has a optional ResourceLocation parameter, is that it? Happy for anyone who can give me some hints.
×
×
  • Create New...

Important Information

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