From 3de6e2c3f1a409709745b2640032a8518db7ab21 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sun, 15 Jun 2014 17:43:24 +0200 Subject: [PATCH] Add full Repairable support in armor config files You can now fully configure armor to be repairable from the armor.yml config files. Adds Repair_MinimumLevel and Repair_XpMultiplier to armor.yml --- Changelog.txt | 2 +- .../config/mods/CustomArmorConfig.java | 5 +- src/main/resources/mods/armor.default.yml | 55 +++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 19da7fcd0..da4d3fef9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -15,8 +15,8 @@ Version 1.5.01-dev + Added support for `MATERIAL|data` format in treasures.yml + Added API to experience events to get XP gain reason + Added API to check if an entity is bleeding - + Added full support for repairables in tools.yml config files + Added option to tools.yml config files to set a pretty repair material name + + Added full support for repairables in tools.yml and armor.yml config files = Fixed bug where pistons would mess with the block tracking = Fixed bug where the Updater was running on the main thread. = Fixed bug when players would use /ptp without being in a party diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java index 1345e8b46..84adcc0e1 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java @@ -85,13 +85,16 @@ public class CustomArmorConfig extends ConfigLoader { repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Quantity", 2); } + int repairMinimumLevel = config.getInt(armorType + "." + armorName + ".Repair_MinimumLevel", 0); + double repairXpMultiplier = config.getDouble(armorType + "." + armorName + ".Repair_XpMultiplier", 1); + short durability = armorMaterial.getMaxDurability(); if (durability == 0) { durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 70); } - repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, 0, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, 1.0)); + repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairMinimumLevel, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, repairXpMultiplier)); } materialList.add(armorMaterial); diff --git a/src/main/resources/mods/armor.default.yml b/src/main/resources/mods/armor.default.yml index 1faac5c58..4f3176a3a 100644 --- a/src/main/resources/mods/armor.default.yml +++ b/src/main/resources/mods/armor.default.yml @@ -1,4 +1,43 @@ # +# Armor example configuration +# Last updated on ${project.version}-b${BUILD_NUMBER} +# +# Any file named armor.*.yml in the mod folder will be loaded as a armor config +# For every armor type there is a separate section. +# The names of each subitem should be the exact material name. +# The bare minimum of an Armor piece is that it has a Repair_Material +# +# +# Repairable: Whether or not the item is repairable +## This defaults to true +# +# Repair_Material: This is the material name of the item used to repair this armor. +## This is required to be set if you want to be able to repair the item. +# +# Repair_Material_Data_Value: This is the metadata of the item used to repair this armor. +## A value of -1 means to ignore all metadata when repairing. +## This defaults to -1 +# +# Repair_Material_Quantity: This is the minimum number of items needed to repair this item ignoring all other repair bonuses. +## This is typically the number of the repair material needed to create a new item, for example for a sword it is 2, for an axe it is 3 +## This defaults to 9 +# +# Repair_Material_Pretty_Name: The pretty name of the repair material. +## Used in the feedback message when not enough repair materials are found. +## This defaults to the Repair_Material converted to string. +# +# Repair_MinimumLevel: This is the minimum repair level needed to repair this item. +## Valid values are => 0 +## This defaults to 0 +# +# Repair_XpMultiplier: This is the amount to multiply the xp bonus by. +## This defaults to 1 +# +# Durability: This is the maximum durability of the armor. +## Valid values are >= 1 +# +### +# # Settings for Boots ### Boots: @@ -7,12 +46,16 @@ Boots: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 999 Boot_2: Repairable: true Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 999 # # Settings for Chestplates @@ -23,12 +66,16 @@ Chestplates: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 999 Chestplate_2: Repairable: true Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 999 # # Settings for Helmets @@ -39,12 +86,16 @@ Helmets: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 999 Helmet_2: Repairable: true Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 999 # # Settings for Leggings @@ -55,10 +106,14 @@ Leggings: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 999 Legging_2: Repairable: true Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 999 \ No newline at end of file