From f2b892b7d54b7b3af02034a2c94c973b4dfb42f9 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sun, 15 Jun 2014 17:28:54 +0200 Subject: [PATCH] Add full Repairable support in tools config files You can now fully configure a tool to be repairable from the tools.yml config files. Adds Repair_MinimumLevel and Repair_XpMultiplier to tools.yml --- Changelog.txt | 1 + .../nossr50/config/mods/CustomToolConfig.java | 5 +- src/main/resources/mods/tools.default.yml | 61 +++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 3ee3d31d7..b1990a45c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -15,6 +15,7 @@ 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 = 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/CustomToolConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomToolConfig.java index 0ccfa5404..a69158c33 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomToolConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomToolConfig.java @@ -93,13 +93,16 @@ public class CustomToolConfig extends ConfigLoader { repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Quantity", 2); } + int repairMinimumLevel = config.getInt(toolType + "." + toolName + ".Repair_MinimumLevel", 0); + double repairXpMultiplier = config.getDouble(toolType + "." + toolName + ".Repair_XpMultiplier", 1); + short durability = toolMaterial.getMaxDurability(); if (durability == 0) { durability = (short) config.getInt(toolType + "." + toolName + ".Durability", 60); } - repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, 0, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, 1.0)); + repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, repairMinimumLevel, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, repairXpMultiplier)); } double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0); diff --git a/src/main/resources/mods/tools.default.yml b/src/main/resources/mods/tools.default.yml index 8f09adf6d..ecc83bc60 100644 --- a/src/main/resources/mods/tools.default.yml +++ b/src/main/resources/mods/tools.default.yml @@ -1,4 +1,41 @@ # +# Tools example configuration +# Last updated on ${project.version}-b${BUILD_NUMBER} +# +# Any file named tools.*.yml in the mod folder will be loaded as a tools config +# For every tool type there is a separate section. +# The names of each subitem should be the exact material name. +# The bare minimum of a Tool is that it has a Repair_Material +# +# +# +# XP_Modifier: This is the xp modifier of the tool, xp is multiplied by this modifier. +## Valid values are > 0 +## This defaults to 1.0. +# +# Repair_Material: This is the material name of the item used to repair this repairable. +## 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 repairable. +## 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_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 tool. +## Valid values are >= 1 +# +### +# # Settings for Axes ### Axes: @@ -10,6 +47,8 @@ Axes: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 Axe_2: XP_Modifier: 1.0 @@ -19,6 +58,8 @@ Axes: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 # # Settings for Bows @@ -32,6 +73,8 @@ Bows: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 Bow_2: XP_Modifier: 1.0 @@ -41,6 +84,8 @@ Bows: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 # # Settings for Hoes @@ -54,6 +99,8 @@ Hoes: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 Hoe_2: XP_Modifier: 1.0 @@ -63,6 +110,8 @@ Hoes: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 # # Settings for Pickaxes @@ -76,6 +125,8 @@ Pickaxes: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 Pickaxe_2: XP_Modifier: 1.0 @@ -85,6 +136,8 @@ Pickaxes: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 # # Settings for Shovels @@ -98,6 +151,8 @@ Shovels: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 Shovel_2: XP_Modifier: 1.0 @@ -107,6 +162,8 @@ Shovels: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 # # Settings for Swords @@ -120,6 +177,8 @@ Swords: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 Sword_2: XP_Modifier: 1.0 @@ -129,4 +188,6 @@ Swords: Repair_Material: REPAIR_MATERIAL_NAME Repair_Material_Data_Value: 0 Repair_Material_Quantity: 9 + Repair_MinimumLevel: 0 + Repair_XpMultiplier: 1.0 Durability: 9999 \ No newline at end of file