Allow repairing wioth multiple items
- Allow repairing AEs using more than 1 repair item at a time. Though it currently doesn't update the anvil GUI properly for whatever reason. However, when you take it out, it will have the correct durability.
This commit is contained in:
parent
ebb6a9ce82
commit
94a06dccba
@ -164,27 +164,24 @@ public class AnvilHandler extends ArmoredElytraHandler implements Listener
|
||||
|
||||
result = ArmoredElytra.getInstance().getNbtEditor()
|
||||
.addArmorNBTTags(result, newTier, plugin.getConfigLoader().unbreakable());
|
||||
|
||||
event.setResult(result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If one of the input items is null and the other an armored elytra, remove the result.
|
||||
// This prevent some naming issues.
|
||||
// TODO: Allow renaming armored elytras.
|
||||
if ((itemA == null ^ itemB == null) &&
|
||||
ArmoredElytra.getInstance().getNbtEditor().getArmorTier(itemA == null ? itemB : itemA) != ArmorTier.NONE)
|
||||
event.setResult(null);
|
||||
player.updateInventory();
|
||||
}
|
||||
|
||||
// Let the player take items out of the anvil.
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e)
|
||||
{
|
||||
if (e.getRawSlot() != 2)
|
||||
return;
|
||||
|
||||
if (!(e.getWhoClicked() instanceof Player))
|
||||
if (e.getRawSlot() != 2 || !(e.getWhoClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
// Check if the event was a player who interacted with an anvil.
|
||||
|
@ -44,7 +44,7 @@ abstract class ArmoredElytraHandler
|
||||
mult *= (100.0f / plugin.getConfigLoader().NETHERITE_TO_FULL());
|
||||
|
||||
int maxDurability = Material.ELYTRA.getMaxDurability();
|
||||
int newDurability = (int) (curDur - (maxDurability * mult));
|
||||
int newDurability = (int) (curDur - repairItem.getAmount() * (maxDurability * mult));
|
||||
return (short) (Math.max(newDurability, 0));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user