CustomCrafting icon indicating copy to clipboard operation
CustomCrafting copied to clipboard

ANVIL - Add option keep enchants of left

Open MotikaCraft-TheJoshua opened this issue 2 years ago • 2 comments

The Problem

As you can see on the images below, this custom recipe makes diamond chestplate into netherite one using 1 netherite ingot just like smithing table in 1.16 does. It would be neat if we could keep the enchant of left item somehow just like smithing table does. We use this recipe because if we create this crafting recipe for smithing table, we get duplication bug which was reported on discord because of the amount of things we needed to explain to be more neat.

image image image

Solution

Add option in editing GUI to keep enchants of left too

Alternatives

/

Additional Context

/

Submit issue

  • [X] searched for and ensured there isn't already an open issue regarding this,
  • [X] are running the latest version of your server software (Spigot, Paper, etc.), and plugins (WolfyUtilities, CustomCrafting).

MotikaCraft-TheJoshua avatar Dec 10 '23 18:12 MotikaCraft-TheJoshua

I'll look into adding an option to the GUI to make it easier to enable such functionality.

However, using the advanced config features explained on the Wiki (Especially the Target feature) allow for even more functionality.

Here's are two simple example configs showing how such functionality can be achieved. Note that the recipe was created in 1.20.4 using the latest CC beta, so it is not compatible with older versions. You can simply copy the target section to your configs result section, though.

Copy only the enchants

Copies the enchants from the first anvil ingredient to the result.

"@type" : "customcrafting:anvil",
group : "",
hidden : false,
vanillaBook : true,
priority : NORMAL,
checkNBT : false,
conditions {
  values : [ ]
},
base {
  items : [ {
    parser : "wolfyutilities:bukkit",
    amount : 1,
    weight : 1.0,
    stack {
      "==" : "org.bukkit.inventory.ItemStack",
      v : 3700,
      type : "DIAMOND_CHESTPLATE"
    }
  } ],
  tags : [ ],
  replaceWithRemains : true,
  allowEmpty : false
},
addition {
  items : [ {
    parser : "wolfyutilities:bukkit",
    amount : 1,
    weight : 1.0,
    stack {
      "==" : "org.bukkit.inventory.ItemStack",
      v : 3700,
      type : "NETHERITE_INGOT"
    }
  } ],
  tags : [ ],
  replaceWithRemains : true,
  allowEmpty : false
},
autoDiscover : true,
blockRepair : false,
blockRename : false,
blockEnchant : false,
repairTask {
  key : "customcrafting:result",
  result {
    items : [ {
      parser : "wolfyutilities:bukkit",
      amount : 1,
      weight : 1.0,
      stack {
        "==" : "org.bukkit.inventory.ItemStack",
        v : 3700,
        type : "NETHERITE_CHESTPLATE"
      }
    } ],
    tags : [ ],
    extensions : [ ],
    // This is the important part, copy this to your configs result section
    target {
      mergeOptions: [
        {
          slots: [ 0 ]
          adapters: [
            {
               key: "customcrafting:enchant"
            }
          ]
        }
      ]
    }
  }
},
repairCost : 1,
applyRepairCost : false,
repairCostMode : NONE

Copy the full NBT Tag

Copies the full NBT Tag from the first Anvil ingredient to the result. Obviously, renaming function of the anvil will no longer work.

"@type" : "customcrafting:anvil",
group : "",
hidden : false,
vanillaBook : true,
priority : NORMAL,
checkNBT : false,
conditions {
  values : [ ]
},
base {
  items : [ {
    parser : "wolfyutilities:bukkit",
    amount : 1,
    weight : 1.0,
    stack {
      "==" : "org.bukkit.inventory.ItemStack",
      v : 3700,
      type : "DIAMOND_CHESTPLATE"
    }
  } ],
  tags : [ ],
  replaceWithRemains : true,
  allowEmpty : false
},
addition {
  items : [ {
    parser : "wolfyutilities:bukkit",
    amount : 1,
    weight : 1.0,
    stack {
      "==" : "org.bukkit.inventory.ItemStack",
      v : 3700,
      type : "NETHERITE_INGOT"
    }
  } ],
  tags : [ ],
  replaceWithRemains : true,
  allowEmpty : false
},
autoDiscover : true,
blockRepair : false,
blockRename : false,
blockEnchant : false,
repairTask {
  key : "customcrafting:result",
  result {
    items : [ {
      parser : "wolfyutilities:bukkit",
      amount : 1,
      weight : 1.0,
      stack {
        "==" : "org.bukkit.inventory.ItemStack",
        v : 3700,
        type : "NETHERITE_CHESTPLATE"
      }
    } ],
    tags : [ ],
    extensions : [ ],
    // This is the important part, copy this to your configs result section
    target {
      mergeOptions: [
        {
          slots: [ 0 ]
          adapters: [
            {
               key: "customcrafting:nbt/merge"
               query {
                includeAll: true
               }
            }
          ]
        }
      ]
    }
  }
},
repairCost : 1,
applyRepairCost : false,
repairCostMode : NONE

WolfyScript avatar Dec 13 '23 13:12 WolfyScript

Thank you so much for this legendary comment really, extremely helpful!

Hey, sorry that i write this here, i see you are not really too much active on your discord server

Please check out a bug i reported at https://discord.com/channels/477026331096514571/498358213842960394/1183474253018959872 That is link to my message in your discord server, regarding duplication glitch related to smithing table, i spread all the details there with GIF how it is done and provided config files of CustomCrafting plugin, also server details followed with list of plugins & version command output

I will edit my comment and remove everything unrelated to this post when you reply on my messages on discord, i did not want to post here because my internet is bad lately and only place i can send because i have nitro is discord.

Thanks for understanding and if you read all of my comment thank you so much!

MotikaCraft-TheJoshua avatar Dec 13 '23 15:12 MotikaCraft-TheJoshua