PriorWorkPenalty

Discussion in 'Plugin Requests' started by madtomic, Mar 21, 2020.

  1. Offline

    madtomic

    Plugin category: Mechanical

    Minecraft version: 1.12.2

    Suggested name:
    PriorWorkPenalty

    What I want: I would like a plugin that would remove the Prior Work Penalty in an anvil. Since, I am using Legacy 1.12.2 I don't have access to grindstone.

    Here is the how Anvil Mechanic works explains here.
    https://minecraft.gamepedia.com/Anvil/Mechanics

    Ideal is to remove the penalty each time a repair/combine is done in an anvil.

    Edit:
    I did some digging and found that this data is stored in the itemmeta, itemflag repair-cost=
    Maybe this formula would work. lastCost = nextCost - currentCost and update the itemflag

    Commands:
    No commands

    Permissions
    :
    No permissions

    Thank you for reading.
     
    Last edited: Mar 21, 2020
  2. Offline

    Stellrow

  3. Offline

    madtomic

    I came across this in regards to this request. I don't know if anyone would like to take a crack at this request.

    https://www.spigotmc.org/threads/setting-result-in-anvil-locks-the-item.408419/

    Perhaps, using InventoryClickEvent would make sense here to set the setRepairCost.

    Code:
    @EventHandler
    public void onPrepareAnvil(PrepareAnvilEvent event) {
        ItemStack result = // Calculate resulting item
        int cost = // Calculate anvil operation cost
        event.setResult(result);
        plugin.getServer().getScheduler().runTask(plugin, () -> event.getInventory().setRepairCost(cost));
    }
     

Share This Page