WolfyScript / CustomCrafting

Spigot based plugin to create your own custom Recipes & Items. Designed to be easy to use with in-game GUI and tons of configuration possibilities.
https://modrinth.com/plugin/customcrafting
GNU General Public License v3.0
115 stars 35 forks source link

ANVIL - Add option keep enchants of left #339

Open TheJoshue opened 10 months ago

TheJoshue commented 10 months ago

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

WolfyScript commented 9 months ago

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
TheJoshue commented 9 months ago

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!