Atherys / AtherysProfessions

A survival professions plugin for the A'therys Horizons server
GNU General Public License v3.0
0 stars 0 forks source link

Enchanting & Repairing Items (Anvil Interface) #1

Open cicetil opened 3 years ago

cicetil commented 3 years ago

Since the normal interface for applying enchantment books and repairing items (aka the anvil) won't work properly without major tweaking, it may be better to create a simplified custom UI for both repairing items and adding enchantments.

The anvil UI The custom interface opens up when right-clicking an anvil, and replaces the default anvil interface. It consists of a chest UI with all slots except 3 filled with gray glass panes. image The left-most slot is for the item which is to be repaired or enchanted. The middle slot is for the material or enchantment book. The right slot is the result of the two other slots.

Repairing Repairing an item requires a damaged item which can be repaired and the base material required to craft that item. When damaged item and materials are put in, the repaired item can be taken out and the damaged item and materials are removed. image The amount of durability which is repaired per material is based on the item and its configured percentage, Ex. If the configured percent for a specific item is 0.25, each material added will repair 25% of that item's total durability, rounding down. This allows items which cost more materials to craft to also cost more to repair, instead of the vanilla 25%/material regardless of item.

^^ (If the item's repairing data also includes the hardcoded 25% per material and it can't easily be overridden, disregard the above.)

Items can only be repaired a limited amount of times, defined in the config. Once an item has been repaired, it should show how many repairs it has left. image

Enchanting Like with repairing, an item (of any durability) is placed in the left slot and an enchantment book is placed in the middle. The enchantment is added to the item. Taking the enchanted item removes both items the left slots. image If normal enchantment data based on item type can't be used, we will need a configurable list of item types and which enchantments can be placed on them, or it may just be best to use vanilla anvils and remove costs and the ability to rename...

After being used, anvils have a chance to become damaged and eventually break like vanilla anvils.

Config

repair-limit = 3

repair-percent-per-material=[
{
item="minecraft:iron_chestplate"
percent=0.12     // the percent of the item's total durability which is repaired with 1 material, rounding down.
)
{
item="minecraft:diamond_axe"
percent=0.3
}
]