From f11c100f33244f802fa1df865b67713819e14d7d Mon Sep 17 00:00:00 2001 From: SilentChaos512 Date: Sat, 28 Nov 2020 16:58:48 -0600 Subject: [PATCH] Add material categories (unused) (#267) --- CHANGELOG.md | 1 + .../silentgear_materials/aluminum.json | 3 + .../silentgear_materials/aluminum_steel.json | 3 + .../silentgear_materials/azure_electrum.json | 3 + .../silentgear_materials/azure_silver.json | 3 + .../silentgear_materials/barrier.json | 3 + .../silentgear_materials/basalt.json | 3 + .../silentgear_materials/bismuth.json | 3 + .../silentgear_materials/bismuth_brass.json | 3 + .../silentgear_materials/bismuth_steel.json | 3 + .../silentgear_materials/blackstone.json | 3 + .../silentgear_materials/blaze_gold.json | 3 + .../silentgear/silentgear_materials/bone.json | 3 + .../silentgear_materials/brass.json | 3 + .../silentgear_materials/bronze.json | 3 + .../silentgear_materials/compressed_iron.json | 3 + .../silentgear_materials/copper.json | 3 + .../silentgear_materials/crimson_iron.json | 3 + .../silentgear_materials/crimson_steel.json | 3 + .../silentgear_materials/diamond.json | 3 + .../silentgear_materials/electrum.json | 3 + .../silentgear_materials/emerald.json | 3 + .../silentgear_materials/end_stone.json | 3 + .../silentgear_materials/enderium.json | 3 + .../silentgear_materials/example.json | 3 + .../silentgear_materials/feather.json | 3 + .../silentgear/silentgear_materials/flax.json | 3 + .../silentgear_materials/flint.json | 3 + .../silentgear_materials/glowstone.json | 4 ++ .../silentgear/silentgear_materials/gold.json | 3 + .../silentgear_materials/invar.json | 3 + .../silentgear/silentgear_materials/iron.json | 3 + .../silentgear_materials/lapis_lazuli.json | 3 + .../silentgear/silentgear_materials/lead.json | 3 + .../silentgear_materials/leather.json | 3 + .../silentgear_materials/leaves.json | 3 + .../silentgear_materials/lumium.json | 3 + .../silentgear_materials/netherite.json | 3 + .../silentgear_materials/netherrack.json | 4 ++ .../silentgear_materials/netherwood.json | 3 + .../silentgear_materials/nickel.json | 3 + .../silentgear_materials/obsidian.json | 3 + .../silentgear_materials/osmium.json | 3 + .../silentgear_materials/platinum.json | 3 + .../silentgear_materials/prismarine.json | 4 ++ .../silentgear_materials/quartz.json | 3 + .../silentgear_materials/redstone.json | 3 + .../silentgear_materials/redstone_alloy.json | 3 + .../refined_glowstone.json | 3 + .../silentgear_materials/refined_iron.json | 3 + .../refined_obsidian.json | 3 + .../silentgear_materials/sandstone.json | 3 + .../silentgear_materials/signalum.json | 3 + .../silentgear_materials/silver.json | 3 + .../silentgear_materials/sinew.json | 3 + .../silentgear_materials/steel.json | 3 + .../silentgear_materials/stone.json | 3 + .../silentgear_materials/string.json | 3 + .../silentgear_materials/terracotta.json | 3 + .../silentgear/silentgear_materials/tin.json | 3 + .../silentgear_materials/titanium.json | 3 + .../silentgear_materials/uranium.json | 3 + .../silentgear/silentgear_materials/wood.json | 3 + .../silentgear_materials/wood/rough.json | 3 + .../silentgear/silentgear_materials/wool.json | 3 + .../silentgear/silentgear_materials/zinc.json | 3 + .../gear/api/material/IMaterial.java | 15 +++-- .../gear/api/material/IMaterialCategory.java | 6 ++ .../gear/client/event/TooltipHandler.java | 14 ++++ .../gear/data/material/MaterialBuilder.java | 20 +++++- .../gear/data/material/MaterialsProvider.java | 66 +++++++++++++++++++ .../gear/material/MaterialCategories.java | 38 +++++++++++ .../gear/gear/material/MaterialInstance.java | 9 +-- .../gear/gear/material/PartMaterial.java | 39 +++++++++-- .../gear/util/SynergyUtils.java | 3 + .../assets/silentgear/lang/en_us.json | 1 + 76 files changed, 397 insertions(+), 13 deletions(-) create mode 100644 src/main/java/net/silentchaos512/gear/api/material/IMaterialCategory.java create mode 100644 src/main/java/net/silentchaos512/gear/gear/material/MaterialCategories.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e9f30723..9c6ae7a94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Material categories. These are unused currently, but will be used for synergy calculations in the future. Categories can be any string and may be defined by mods or data packs. [#267] - Individual traits can now supply extra wiki lines in their JSON. _This is not synced with the client on dedicated servers._ Useful for adding more information to frequently confused traits, like Lucky. ### Changed - Materials will no longer inherit stats and traits from their parent of they provide any of their own [related to #266] diff --git a/src/generated/resources/data/silentgear/silentgear_materials/aluminum.json b/src/generated/resources/data/silentgear/silentgear_materials/aluminum.json index 3c8c985c8..0ac548b0e 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/aluminum.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/aluminum.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/aluminum_steel.json b/src/generated/resources/data/silentgear/silentgear_materials/aluminum_steel.json index 3cbbda237..b8cd75bc3 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/aluminum_steel.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/aluminum_steel.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/azure_electrum.json b/src/generated/resources/data/silentgear/silentgear_materials/azure_electrum.json index bb0c869d8..4381becd7 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/azure_electrum.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/azure_electrum.json @@ -1,6 +1,9 @@ { "availability": { "tier": 4, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/azure_silver.json b/src/generated/resources/data/silentgear/silentgear_materials/azure_silver.json index 06421abc5..31410f4ca 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/azure_silver.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/azure_silver.json @@ -1,6 +1,9 @@ { "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/barrier.json b/src/generated/resources/data/silentgear/silentgear_materials/barrier.json index 9eadb9786..e969adf37 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/barrier.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/barrier.json @@ -1,6 +1,9 @@ { "availability": { "tier": 5, + "categories": [ + "intangible" + ], "visible": false, "gear_blacklist": [], "can_salvage": false diff --git a/src/generated/resources/data/silentgear/silentgear_materials/basalt.json b/src/generated/resources/data/silentgear/silentgear_materials/basalt.json index 43dbbe4c7..10ae058da 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/basalt.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/basalt.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/bismuth.json b/src/generated/resources/data/silentgear/silentgear_materials/bismuth.json index ceeeb3849..aeedb38cb 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/bismuth.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/bismuth.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/bismuth_brass.json b/src/generated/resources/data/silentgear/silentgear_materials/bismuth_brass.json index a6fd82caf..43ea295fd 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/bismuth_brass.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/bismuth_brass.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/bismuth_steel.json b/src/generated/resources/data/silentgear/silentgear_materials/bismuth_steel.json index 3a82eeeec..30587bb08 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/bismuth_steel.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/bismuth_steel.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/blackstone.json b/src/generated/resources/data/silentgear/silentgear_materials/blackstone.json index 62a4117ef..c7728886d 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/blackstone.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/blackstone.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/blaze_gold.json b/src/generated/resources/data/silentgear/silentgear_materials/blaze_gold.json index d733c4198..67f2ae5bd 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/blaze_gold.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/blaze_gold.json @@ -1,6 +1,9 @@ { "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/bone.json b/src/generated/resources/data/silentgear/silentgear_materials/bone.json index 4beeb3ba8..f1c132ca4 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/bone.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/bone.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/brass.json b/src/generated/resources/data/silentgear/silentgear_materials/brass.json index efc4d7053..bb6a5a04e 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/brass.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/brass.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/bronze.json b/src/generated/resources/data/silentgear/silentgear_materials/bronze.json index 5b5e24ea0..fcdc7c2b3 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/bronze.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/bronze.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/compressed_iron.json b/src/generated/resources/data/silentgear/silentgear_materials/compressed_iron.json index 57c99f2bd..0ea01a6ac 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/compressed_iron.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/compressed_iron.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/copper.json b/src/generated/resources/data/silentgear/silentgear_materials/copper.json index 38b695680..1ec95f7f3 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/copper.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/copper.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 1, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/crimson_iron.json b/src/generated/resources/data/silentgear/silentgear_materials/crimson_iron.json index cec5fd5ad..32a4d4b52 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/crimson_iron.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/crimson_iron.json @@ -1,6 +1,9 @@ { "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/crimson_steel.json b/src/generated/resources/data/silentgear/silentgear_materials/crimson_steel.json index 106f37a2f..409bcd4bd 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/crimson_steel.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/crimson_steel.json @@ -1,6 +1,9 @@ { "availability": { "tier": 4, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/diamond.json b/src/generated/resources/data/silentgear/silentgear_materials/diamond.json index 9de20e5a4..106477838 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/diamond.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/diamond.json @@ -1,6 +1,9 @@ { "availability": { "tier": 3, + "categories": [ + "gem" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/electrum.json b/src/generated/resources/data/silentgear/silentgear_materials/electrum.json index 0eaf4d46b..e47c0adac 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/electrum.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/electrum.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/emerald.json b/src/generated/resources/data/silentgear/silentgear_materials/emerald.json index ef252c693..eb0dc34dd 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/emerald.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/emerald.json @@ -1,6 +1,9 @@ { "availability": { "tier": 3, + "categories": [ + "gem" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/end_stone.json b/src/generated/resources/data/silentgear/silentgear_materials/end_stone.json index 02591a00a..250cf1c04 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/end_stone.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/end_stone.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/enderium.json b/src/generated/resources/data/silentgear/silentgear_materials/enderium.json index e9206aeb4..3d8e56e27 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/enderium.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/enderium.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 4, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/example.json b/src/generated/resources/data/silentgear/silentgear_materials/example.json index d564cbe44..d17f7dc7a 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/example.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/example.json @@ -1,6 +1,9 @@ { "availability": { "tier": 0, + "categories": [ + "intangible" + ], "visible": false, "gear_blacklist": [ "all" diff --git a/src/generated/resources/data/silentgear/silentgear_materials/feather.json b/src/generated/resources/data/silentgear/silentgear_materials/feather.json index dfe4b8fa3..6bde8ad62 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/feather.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/feather.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/flax.json b/src/generated/resources/data/silentgear/silentgear_materials/flax.json index 85d79bdc5..7b2fd3cd6 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/flax.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/flax.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/flint.json b/src/generated/resources/data/silentgear/silentgear_materials/flint.json index 3fb2e264c..e2f373775 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/flint.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/flint.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/glowstone.json b/src/generated/resources/data/silentgear/silentgear_materials/glowstone.json index a3fb2a6c5..0306ba69b 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/glowstone.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/glowstone.json @@ -1,6 +1,10 @@ { "availability": { "tier": 2, + "categories": [ + "rock", + "gem" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/gold.json b/src/generated/resources/data/silentgear/silentgear_materials/gold.json index 416cdea1d..edb62aa27 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/gold.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/gold.json @@ -1,6 +1,9 @@ { "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/invar.json b/src/generated/resources/data/silentgear/silentgear_materials/invar.json index c39d013f7..d77031dbe 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/invar.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/invar.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/iron.json b/src/generated/resources/data/silentgear/silentgear_materials/iron.json index 250eacdfc..06a35f5eb 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/iron.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/iron.json @@ -1,6 +1,9 @@ { "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/lapis_lazuli.json b/src/generated/resources/data/silentgear/silentgear_materials/lapis_lazuli.json index 993aa1e46..d9db950d0 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/lapis_lazuli.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/lapis_lazuli.json @@ -1,6 +1,9 @@ { "availability": { "tier": 2, + "categories": [ + "gem" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/lead.json b/src/generated/resources/data/silentgear/silentgear_materials/lead.json index 8001faae1..713f4b7f2 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/lead.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/lead.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/leather.json b/src/generated/resources/data/silentgear/silentgear_materials/leather.json index 354de92c6..f84eff2d5 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/leather.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/leather.json @@ -1,6 +1,9 @@ { "availability": { "tier": 0, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/leaves.json b/src/generated/resources/data/silentgear/silentgear_materials/leaves.json index fe765e53c..c51612628 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/leaves.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/leaves.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/lumium.json b/src/generated/resources/data/silentgear/silentgear_materials/lumium.json index 84d11203f..c321fbdbb 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/lumium.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/lumium.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/netherite.json b/src/generated/resources/data/silentgear/silentgear_materials/netherite.json index c8b48fb8b..5c990c065 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/netherite.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/netherite.json @@ -1,6 +1,9 @@ { "availability": { "tier": 4, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/netherrack.json b/src/generated/resources/data/silentgear/silentgear_materials/netherrack.json index e8d8ce536..2bfe47b8d 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/netherrack.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/netherrack.json @@ -1,6 +1,10 @@ { "availability": { "tier": 1, + "categories": [ + "rock", + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/netherwood.json b/src/generated/resources/data/silentgear/silentgear_materials/netherwood.json index ffdb8cdcf..37a8b5afe 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/netherwood.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/netherwood.json @@ -1,6 +1,9 @@ { "availability": { "tier": 0, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/nickel.json b/src/generated/resources/data/silentgear/silentgear_materials/nickel.json index 357b5e274..acdb90b0e 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/nickel.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/nickel.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/obsidian.json b/src/generated/resources/data/silentgear/silentgear_materials/obsidian.json index ef960429c..e47c7d3c9 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/obsidian.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/obsidian.json @@ -1,6 +1,9 @@ { "availability": { "tier": 3, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/osmium.json b/src/generated/resources/data/silentgear/silentgear_materials/osmium.json index 6c77f07f5..878e2a8cd 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/osmium.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/osmium.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/platinum.json b/src/generated/resources/data/silentgear/silentgear_materials/platinum.json index 153140bc6..1632130e1 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/platinum.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/platinum.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/prismarine.json b/src/generated/resources/data/silentgear/silentgear_materials/prismarine.json index 16f2128e1..00cc54eab 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/prismarine.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/prismarine.json @@ -1,6 +1,10 @@ { "availability": { "tier": 3, + "categories": [ + "gem", + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/quartz.json b/src/generated/resources/data/silentgear/silentgear_materials/quartz.json index b8f9e1363..fe6cdf3ac 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/quartz.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/quartz.json @@ -1,6 +1,9 @@ { "availability": { "tier": 2, + "categories": [ + "gem" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/redstone.json b/src/generated/resources/data/silentgear/silentgear_materials/redstone.json index ea78847d6..a79041bdd 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/redstone.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/redstone.json @@ -1,6 +1,9 @@ { "availability": { "tier": 2, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/redstone_alloy.json b/src/generated/resources/data/silentgear/silentgear_materials/redstone_alloy.json index aec8738a9..e6bfd4524 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/redstone_alloy.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/redstone_alloy.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/refined_glowstone.json b/src/generated/resources/data/silentgear/silentgear_materials/refined_glowstone.json index 9904b153b..5d8749dea 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/refined_glowstone.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/refined_glowstone.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/refined_iron.json b/src/generated/resources/data/silentgear/silentgear_materials/refined_iron.json index 82ae59122..3bf7978d6 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/refined_iron.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/refined_iron.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/refined_obsidian.json b/src/generated/resources/data/silentgear/silentgear_materials/refined_obsidian.json index d912a9072..3fe36983c 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/refined_obsidian.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/refined_obsidian.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 4, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/sandstone.json b/src/generated/resources/data/silentgear/silentgear_materials/sandstone.json index 598129131..dbf198802 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/sandstone.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/sandstone.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/signalum.json b/src/generated/resources/data/silentgear/silentgear_materials/signalum.json index c378a286e..4548739ce 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/signalum.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/signalum.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 4, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/silver.json b/src/generated/resources/data/silentgear/silentgear_materials/silver.json index 225927da9..59fc4715d 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/silver.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/silver.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/sinew.json b/src/generated/resources/data/silentgear/silentgear_materials/sinew.json index 4b522093b..6ba9a0867 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/sinew.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/sinew.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/steel.json b/src/generated/resources/data/silentgear/silentgear_materials/steel.json index 9f5c5dd58..61c27c11c 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/steel.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/steel.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 2, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/stone.json b/src/generated/resources/data/silentgear/silentgear_materials/stone.json index a5862ae4b..0a170fd12 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/stone.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/stone.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/string.json b/src/generated/resources/data/silentgear/silentgear_materials/string.json index 326fb9068..c181c5600 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/string.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/string.json @@ -1,6 +1,9 @@ { "availability": { "tier": 0, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/terracotta.json b/src/generated/resources/data/silentgear/silentgear_materials/terracotta.json index 63fdb4de7..772fd3be6 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/terracotta.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/terracotta.json @@ -1,6 +1,9 @@ { "availability": { "tier": 1, + "categories": [ + "rock" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/tin.json b/src/generated/resources/data/silentgear/silentgear_materials/tin.json index ed36a7948..28ca38568 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/tin.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/tin.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 1, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/titanium.json b/src/generated/resources/data/silentgear/silentgear_materials/titanium.json index 6bc75377a..7d664bc74 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/titanium.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/titanium.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 4, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/uranium.json b/src/generated/resources/data/silentgear/silentgear_materials/uranium.json index feab23328..444903c4e 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/uranium.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/uranium.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 3, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/wood.json b/src/generated/resources/data/silentgear/silentgear_materials/wood.json index 0e4727a06..41e58b910 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/wood.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/wood.json @@ -1,6 +1,9 @@ { "availability": { "tier": 0, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/wood/rough.json b/src/generated/resources/data/silentgear/silentgear_materials/wood/rough.json index c0bb3e97c..fce23c0a1 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/wood/rough.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/wood/rough.json @@ -1,6 +1,9 @@ { "availability": { "tier": 0, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/wool.json b/src/generated/resources/data/silentgear/silentgear_materials/wool.json index da0e2c9ef..378fe10a2 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/wool.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/wool.json @@ -1,6 +1,9 @@ { "availability": { "tier": 0, + "categories": [ + "organic" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/generated/resources/data/silentgear/silentgear_materials/zinc.json b/src/generated/resources/data/silentgear/silentgear_materials/zinc.json index cedf1b095..88ee204a9 100644 --- a/src/generated/resources/data/silentgear/silentgear_materials/zinc.json +++ b/src/generated/resources/data/silentgear/silentgear_materials/zinc.json @@ -10,6 +10,9 @@ ], "availability": { "tier": 1, + "categories": [ + "metal" + ], "visible": true, "gear_blacklist": [], "can_salvage": true diff --git a/src/main/java/net/silentchaos512/gear/api/material/IMaterial.java b/src/main/java/net/silentchaos512/gear/api/material/IMaterial.java index 33fd18ed2..96878bc33 100644 --- a/src/main/java/net/silentchaos512/gear/api/material/IMaterial.java +++ b/src/main/java/net/silentchaos512/gear/api/material/IMaterial.java @@ -66,6 +66,13 @@ default Optional getParentOptional() { return Optional.ofNullable(getParent()); } + /** + * Gets the categories this material belongs to. + * + * @return Collection of categories + */ + Collection getCategories(); + /** * Gets the tier of the material. Currently, the tier never depends on the part type. * @@ -161,7 +168,8 @@ default Collection getTraits(PartType partType) { /** * Calculate a stat value for the material. This has limited usefulness, {@link - * #getStatModifiers(IMaterialInstance, ItemStat, PartType, ItemStack)} should be used in most cases. + * #getStatModifiers(IMaterialInstance, ItemStat, PartType, ItemStack)} should be used in most + * cases. * * @param material The material * @param stat The stat @@ -174,8 +182,8 @@ default float getStat(IMaterialInstance material, ItemStat stat, PartType partTy /** * Calculate a stat value for the material. The stat value is not clamped. This has limited - * usefulness, {@link #getStatModifiers(IMaterialInstance, ItemStat, PartType, ItemStack)} should be used in most - * cases. + * usefulness, {@link #getStatModifiers(IMaterialInstance, ItemStat, PartType, ItemStack)} + * should be used in most cases. * * @param material The material * @param stat The stat @@ -190,7 +198,6 @@ default float getStatUnclamped(IMaterialInstance material, ItemStat stat, PartTy * Determine if the material can be used to craft parts of a given type and for a given gear * type. * - * * @param material The material * @param partType The part type * @param gearType The gear type diff --git a/src/main/java/net/silentchaos512/gear/api/material/IMaterialCategory.java b/src/main/java/net/silentchaos512/gear/api/material/IMaterialCategory.java new file mode 100644 index 000000000..9b7ca58d8 --- /dev/null +++ b/src/main/java/net/silentchaos512/gear/api/material/IMaterialCategory.java @@ -0,0 +1,6 @@ +package net.silentchaos512.gear.api.material; + +@FunctionalInterface +public interface IMaterialCategory { + String getName(); +} diff --git a/src/main/java/net/silentchaos512/gear/client/event/TooltipHandler.java b/src/main/java/net/silentchaos512/gear/client/event/TooltipHandler.java index 946ea6281..9c6e48531 100644 --- a/src/main/java/net/silentchaos512/gear/client/event/TooltipHandler.java +++ b/src/main/java/net/silentchaos512/gear/client/event/TooltipHandler.java @@ -7,6 +7,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.silentchaos512.gear.api.item.GearType; +import net.silentchaos512.gear.api.material.IMaterialCategory; import net.silentchaos512.gear.api.part.MaterialGrade; import net.silentchaos512.gear.api.part.PartType; import net.silentchaos512.gear.api.stats.ItemStat; @@ -30,6 +31,7 @@ import java.util.Collection; import java.util.List; import java.util.Optional; +import java.util.stream.Collectors; public final class TooltipHandler { public static final TooltipHandler INSTANCE = new TooltipHandler(); @@ -117,6 +119,8 @@ private static void onMaterialTooltip(ItemTooltipEvent event, ItemStack stack, M if (keyHeld) { getGradeLine(event, material.getGrade()); + getMaterialCategoriesLine(material).ifPresent(t -> event.getToolTip().add(t)); + List partTypes = new ArrayList<>(material.getPartTypes()); if (!partTypes.isEmpty()) { int index = KeyTracker.getMaterialCycleIndex(partTypes.size()); @@ -136,6 +140,16 @@ private static void onMaterialTooltip(ItemTooltipEvent event, ItemStack stack, M } } + private static Optional getMaterialCategoriesLine(MaterialInstance material) { + Collection categories = material.getCategories(); + if (!categories.isEmpty()) { + ITextComponent text = new StringTextComponent(categories.stream().map(IMaterialCategory::getName).collect(Collectors.joining(", "))) + .mergeStyle(TextFormatting.ITALIC); + return Optional.of(TextUtil.misc("materialCategories", text)); + } + return Optional.empty(); + } + private static ITextComponent buildPartTypeHeader(Collection types, PartType selectedType) { IFormattableTextComponent ret = new StringTextComponent("| ").mergeStyle(TextFormatting.GRAY); for (PartType type : types) { diff --git a/src/main/java/net/silentchaos512/gear/data/material/MaterialBuilder.java b/src/main/java/net/silentchaos512/gear/data/material/MaterialBuilder.java index fcc8aacd2..7a6b2e2ce 100644 --- a/src/main/java/net/silentchaos512/gear/data/material/MaterialBuilder.java +++ b/src/main/java/net/silentchaos512/gear/data/material/MaterialBuilder.java @@ -16,6 +16,7 @@ import net.minecraftforge.common.crafting.conditions.TagEmptyCondition; import net.silentchaos512.gear.SilentGear; import net.silentchaos512.gear.api.item.GearType; +import net.silentchaos512.gear.api.material.IMaterialCategory; import net.silentchaos512.gear.api.material.MaterialLayer; import net.silentchaos512.gear.api.material.MaterialLayerList; import net.silentchaos512.gear.api.part.PartType; @@ -48,6 +49,7 @@ public class MaterialBuilder { private Collection gearBlacklist = new ArrayList<>(); private final Collection loadConditions = new ArrayList<>(); @Nullable private ResourceLocation parent; + private final Collection categories = new ArrayList<>(); private ITextComponent name; @Nullable private ITextComponent namePrefix; @@ -91,6 +93,11 @@ public MaterialBuilder parent(ResourceLocation parent) { return this; } + public MaterialBuilder categories(IMaterialCategory... categories) { + this.categories.addAll(Arrays.asList(categories)); + return this; + } + public MaterialBuilder canSalvage(boolean value) { this.canSalvage = value; return this; @@ -276,7 +283,7 @@ public JsonObject serializeModel() { return model.serialize(); } - @SuppressWarnings("OverlyComplexMethod") + @SuppressWarnings({"OverlyComplexMethod", "OverlyLongMethod"}) public JsonObject serialize() { JsonObject json = new JsonObject(); @@ -295,12 +302,23 @@ public JsonObject serialize() { JsonObject availability = new JsonObject(); if (this.tier >= 0) { availability.addProperty("tier", this.tier); + + if (!this.categories.isEmpty()) { + JsonArray array = new JsonArray(); + for (IMaterialCategory category : this.categories) { + array.add(category.getName()); + } + availability.add("categories", array); + } + availability.addProperty("visible", this.visible); + JsonArray array = new JsonArray(); for (String gearType : this.gearBlacklist) { array.add(gearType); } availability.add("gear_blacklist", array); + availability.addProperty("can_salvage", this.canSalvage); } if (!availability.entrySet().isEmpty()) { diff --git a/src/main/java/net/silentchaos512/gear/data/material/MaterialsProvider.java b/src/main/java/net/silentchaos512/gear/data/material/MaterialsProvider.java index 644c13528..8298f0e53 100644 --- a/src/main/java/net/silentchaos512/gear/data/material/MaterialsProvider.java +++ b/src/main/java/net/silentchaos512/gear/data/material/MaterialsProvider.java @@ -21,6 +21,7 @@ import net.silentchaos512.gear.api.traits.ITraitCondition; import net.silentchaos512.gear.client.model.PartTextures; import net.silentchaos512.gear.crafting.ingredient.ExclusionIngredient; +import net.silentchaos512.gear.gear.material.MaterialCategories; import net.silentchaos512.gear.init.ModBlocks; import net.silentchaos512.gear.init.ModTags; import net.silentchaos512.gear.item.CraftingItems; @@ -64,6 +65,7 @@ protected Collection getMaterials() { // Azure Electrum ret.add(new MaterialBuilder(SilentGear.getId("azure_electrum"), 4, ModTags.Items.INGOTS_AZURE_ELECTRUM) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 1259) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 61) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.5f) @@ -110,6 +112,7 @@ protected Collection getMaterials() { ); // Azure Silver ret.add(new MaterialBuilder(SilentGear.getId("azure_silver"), 3, ModTags.Items.INGOTS_AZURE_SILVER) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 197) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 17) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.5f) @@ -150,6 +153,7 @@ protected Collection getMaterials() { ); // Barrier ret.add(new MaterialBuilder(SilentGear.getId("barrier"), 5, Items.BARRIER) + .categories(MaterialCategories.INTANGIBLE) .visible(false) .canSalvage(false) .stat(PartType.MAIN, ItemStats.DURABILITY, 1337) @@ -175,6 +179,7 @@ protected Collection getMaterials() { ); // Basalt ret.add(new MaterialBuilder(SilentGear.getId("basalt"), 1, Items.BASALT) + .categories(MaterialCategories.ROCK) .stat(PartType.MAIN, ItemStats.DURABILITY, 137) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 4) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 6) @@ -207,6 +212,7 @@ protected Collection getMaterials() { ); // Blackstone ret.add(new MaterialBuilder(SilentGear.getId("blackstone"), 1, Items.BLACKSTONE) + .categories(MaterialCategories.ROCK) .stat(PartType.MAIN, ItemStats.DURABILITY, 151) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 5) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 4) @@ -243,6 +249,7 @@ protected Collection getMaterials() { ); // Blaze Gold ret.add(new MaterialBuilder(SilentGear.getId("blaze_gold"), 3, ModTags.Items.INGOTS_BLAZE_GOLD) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 69) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 9) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 24) @@ -288,6 +295,7 @@ protected Collection getMaterials() { ); // Bone ret.add(new MaterialBuilder(SilentGear.getId("bone"), 1, Items.BONE_BLOCK) + .categories(MaterialCategories.ORGANIC) .partSubstitute(PartType.ROD, Items.BONE) .stat(PartType.MAIN, ItemStats.DURABILITY, 108) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 4) @@ -315,6 +323,7 @@ protected Collection getMaterials() { ); // Crimson Iron ret.add(new MaterialBuilder(SilentGear.getId("crimson_iron"), 3, ModTags.Items.INGOTS_CRIMSON_IRON) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 420) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 27) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.5f) @@ -354,6 +363,7 @@ protected Collection getMaterials() { ); // Crimson Steel ret.add(new MaterialBuilder(SilentGear.getId("crimson_steel"), 4, ModTags.Items.INGOTS_CRIMSON_STEEL) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 2400) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 42) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.5f) @@ -394,6 +404,7 @@ protected Collection getMaterials() { ); // Diamond ret.add(new MaterialBuilder(SilentGear.getId("diamond"), 3, Tags.Items.GEMS_DIAMOND) + .categories(MaterialCategories.GEM) .stat(PartType.MAIN, ItemStats.DURABILITY, 1561) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 33) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 10) @@ -440,6 +451,7 @@ protected Collection getMaterials() { ); // Emerald ret.add(new MaterialBuilder(SilentGear.getId("emerald"), 3, Tags.Items.GEMS_EMERALD) + .categories(MaterialCategories.GEM) .stat(PartType.MAIN, ItemStats.DURABILITY, 1080) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 24) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.25f) @@ -481,6 +493,7 @@ protected Collection getMaterials() { ); // End Stone ret.add(new MaterialBuilder(SilentGear.getId("end_stone"), 1, Tags.Items.END_STONES) + .categories(MaterialCategories.ROCK) .stat(PartType.MAIN, ItemStats.DURABILITY, 1164) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 15) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.2f) @@ -511,6 +524,7 @@ protected Collection getMaterials() { ); // Example ret.add(new MaterialBuilder(SilentGear.getId("example"), 0, Ingredient.EMPTY) + .categories(MaterialCategories.INTANGIBLE) .visible(false) .canSalvage(false) .blacklistGearType("all") @@ -541,12 +555,14 @@ protected Collection getMaterials() { ); // Feather ret.add(new MaterialBuilder(SilentGear.getId("feather"), 1, Tags.Items.FEATHERS) + .categories(MaterialCategories.ORGANIC) .noStats(PartType.FLETCHING) .displayAll(PartTextureSet.LOW_CONTRAST, Color.VALUE_WHITE) .displayFragment(PartTextures.CLOTH, Color.VALUE_WHITE) ); // Flax ret.add(new MaterialBuilder(SilentGear.getId("flax"), 1, CraftingItems.FLAX_STRING) + .categories(MaterialCategories.ORGANIC) .stat(PartType.BINDING, ItemStats.DURABILITY, -0.05f, StatInstance.Operation.MUL1) .stat(PartType.BINDING, ItemStats.DURABILITY, 10, StatInstance.Operation.ADD) .stat(PartType.BINDING, ItemStats.HARVEST_SPEED, 0.05f, StatInstance.Operation.MUL1) @@ -562,6 +578,7 @@ protected Collection getMaterials() { ); // Flint ret.add(new MaterialBuilder(SilentGear.getId("flint"), 1, Items.FLINT) + .categories(MaterialCategories.ROCK) .stat(PartType.MAIN, ItemStats.DURABILITY, 124) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 4) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 3) @@ -589,6 +606,7 @@ protected Collection getMaterials() { ); // Glowstone ret.add(new MaterialBuilder(SilentGear.getId("glowstone"), 2, Tags.Items.DUSTS_GLOWSTONE) + .categories(MaterialCategories.ROCK, MaterialCategories.GEM) .stat(PartType.TIP, ItemStats.HARVEST_SPEED, 0.4f, StatInstance.Operation.MUL2) .stat(PartType.TIP, ItemStats.MELEE_DAMAGE, 2, StatInstance.Operation.ADD) .stat(PartType.TIP, ItemStats.MAGIC_DAMAGE, 2, StatInstance.Operation.ADD) @@ -603,6 +621,7 @@ protected Collection getMaterials() { ); // Gold ret.add(new MaterialBuilder(SilentGear.getId("gold"), 2, Tags.Items.INGOTS_GOLD) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 32) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 7) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 22) @@ -641,6 +660,7 @@ protected Collection getMaterials() { ); // Iron ret.add(new MaterialBuilder(SilentGear.getId("iron"), 2, Tags.Items.INGOTS_IRON) + .categories(MaterialCategories.METAL) .partSubstitute(PartType.ROD, ModTags.Items.RODS_IRON) .stat(PartType.MAIN, ItemStats.DURABILITY, 250) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 15) @@ -681,6 +701,7 @@ protected Collection getMaterials() { ); // Lapis Lazuli ret.add(new MaterialBuilder(SilentGear.getId("lapis_lazuli"), 2, Tags.Items.GEMS_LAPIS) + .categories(MaterialCategories.GEM) .stat(PartType.MAIN, ItemStats.DURABILITY, 200) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 13) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 17) @@ -717,6 +738,7 @@ protected Collection getMaterials() { ); // Leather ret.add(new MaterialBuilder(SilentGear.getId("leather"), 0, Tags.Items.LEATHER) + .categories(MaterialCategories.ORGANIC) .stat(PartType.MAIN, ItemStats.DURABILITY, 0) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 5) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 15) @@ -736,12 +758,14 @@ protected Collection getMaterials() { ); // Leaves ret.add(new MaterialBuilder(SilentGear.getId("leaves"), 1, ItemTags.LEAVES) + .categories(MaterialCategories.ORGANIC) .noStats(PartType.FLETCHING) .displayAll(PartTextureSet.LOW_CONTRAST, 0x4A8F28) .displayFragment(PartTextures.CLOTH, 0x4A8F28) ); // Netherrack ret.add(new MaterialBuilder(SilentGear.getId("netherrack"), 1, Tags.Items.NETHERRACK) + .categories(MaterialCategories.ROCK, MaterialCategories.ORGANIC) .stat(PartType.MAIN, ItemStats.DURABILITY, 142) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 5) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.2f) @@ -771,6 +795,7 @@ protected Collection getMaterials() { ); // Netherite ret.add(new MaterialBuilder(SilentGear.getId("netherite"), 4, Items.NETHERITE_INGOT) + .categories(MaterialCategories.METAL) .namePrefix(TextUtil.translate("material", "netherite")) .stat(PartType.COATING, ItemStats.DURABILITY, 0.3f, StatInstance.Operation.MUL2) .stat(PartType.COATING, ItemStats.DURABILITY, 2, StatInstance.Operation.ADD) @@ -788,6 +813,7 @@ protected Collection getMaterials() { ); // Netherwood ret.add(new MaterialBuilder(SilentGear.getId("netherwood"), 0, ModBlocks.NETHERWOOD_PLANKS) + .categories(MaterialCategories.ORGANIC) .partSubstitute(PartType.ROD, ModTags.Items.RODS_NETHERWOOD) .stat(PartType.MAIN, ItemStats.DURABILITY, 72) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 12) @@ -822,6 +848,7 @@ protected Collection getMaterials() { ); // Obsidian ret.add(new MaterialBuilder(SilentGear.getId("obsidian"), 3, Tags.Items.OBSIDIAN) + .categories(MaterialCategories.ROCK) .stat(PartType.MAIN, ItemStats.DURABILITY, 3072) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 37) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.5f) @@ -851,6 +878,7 @@ protected Collection getMaterials() { ); // Prismarine ret.add(new MaterialBuilder(SilentGear.getId("prismarine"), 3, Tags.Items.GEMS_PRISMARINE) + .categories(MaterialCategories.GEM, MaterialCategories.ORGANIC) .namePrefix(TextUtil.translate("material", "prismarine")) .stat(PartType.COATING, ItemStats.DURABILITY, 0.075f, StatInstance.Operation.MUL2) .stat(PartType.COATING, ItemStats.ARMOR_DURABILITY, 0.125f, StatInstance.Operation.MUL2) @@ -863,6 +891,7 @@ protected Collection getMaterials() { ); // Quartz ret.add(new MaterialBuilder(SilentGear.getId("quartz"), 2, Tags.Items.GEMS_QUARTZ) + .categories(MaterialCategories.GEM) .stat(PartType.MAIN, ItemStats.DURABILITY, 330) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 13) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 10) @@ -902,6 +931,7 @@ protected Collection getMaterials() { ); // Redstone ret.add(new MaterialBuilder(SilentGear.getId("redstone"), 2, Tags.Items.DUSTS_REDSTONE) + .categories(MaterialCategories.ROCK) .stat(PartType.TIP, ItemStats.HARVEST_SPEED, 0.2f, StatInstance.Operation.MUL2) .stat(PartType.TIP, ItemStats.MELEE_DAMAGE, 2, StatInstance.Operation.ADD) .stat(PartType.TIP, ItemStats.ATTACK_SPEED, 0.5f, StatInstance.Operation.ADD) @@ -915,6 +945,7 @@ protected Collection getMaterials() { ret.add(new MaterialBuilder(sgSandstone, 1, ExclusionIngredient.of(Tags.Items.SANDSTONE, Items.RED_SANDSTONE, Items.CHISELED_RED_SANDSTONE, Items.CUT_RED_SANDSTONE, Items.SMOOTH_RED_SANDSTONE)) + .categories(MaterialCategories.ROCK) .stat(PartType.MAIN, ItemStats.DURABILITY, 117) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 6) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.1f) @@ -947,6 +978,7 @@ protected Collection getMaterials() { ); // Sinew ret.add(new MaterialBuilder(SilentGear.getId("sinew"), 1, CraftingItems.SINEW_FIBER) + .categories(MaterialCategories.ORGANIC) .stat(PartType.BINDING, ItemStats.DURABILITY, 0.05f, StatInstance.Operation.MUL1) .stat(PartType.BINDING, ItemStats.REPAIR_EFFICIENCY, -0.05f, StatInstance.Operation.MUL1) .trait(PartType.BINDING, Const.Traits.FLEXIBLE, 2) @@ -963,6 +995,7 @@ protected Collection getMaterials() { // Stone ResourceLocation stone = SilentGear.getId("stone"); ret.add(new MaterialBuilder(stone, 1, Tags.Items.COBBLESTONE) + .categories(MaterialCategories.ROCK) .partSubstitute(PartType.ROD, ModTags.Items.RODS_STONE) .stat(PartType.MAIN, ItemStats.DURABILITY, 131) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 5) @@ -1010,6 +1043,7 @@ protected Collection getMaterials() { ret.add(new MaterialBuilder(SilentGear.getId("string"), 0, ExclusionIngredient.of(Tags.Items.STRING, CraftingItems.FLAX_STRING, CraftingItems.SINEW_FIBER)) + .categories(MaterialCategories.ORGANIC) .stat(PartType.BINDING, ItemStats.DURABILITY, -0.05f, StatInstance.Operation.MUL1) .stat(PartType.BINDING, ItemStats.REPAIR_EFFICIENCY, 0.05f, StatInstance.Operation.MUL1) .trait(PartType.BINDING, Const.Traits.FLEXIBLE, 2) @@ -1023,6 +1057,7 @@ protected Collection getMaterials() { // Terracotta ResourceLocation sgTerracotta = SilentGear.getId("terracotta"); ret.add(new MaterialBuilder(sgTerracotta, 1, Items.TERRACOTTA) + .categories(MaterialCategories.ROCK) .stat(PartType.MAIN, ItemStats.DURABILITY, 165) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 11) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.1f) @@ -1074,6 +1109,7 @@ protected Collection getMaterials() { ret.add(new MaterialBuilder(sgWood, 0, ExclusionIngredient.of(ItemTags.PLANKS, Items.ACACIA_PLANKS, Items.BIRCH_PLANKS, Items.DARK_OAK_PLANKS, Items.JUNGLE_PLANKS, Items.OAK_PLANKS, Items.SPRUCE_PLANKS, ModBlocks.NETHERWOOD_PLANKS, Items.CRIMSON_PLANKS, Items.WARPED_PLANKS)) + .categories(MaterialCategories.ORGANIC) .partSubstitute(PartType.ROD, ExclusionIngredient.of(Tags.Items.RODS_WOODEN, CraftingItems.NETHERWOOD_STICK)) @@ -1123,6 +1159,7 @@ protected Collection getMaterials() { // Rough wood ret.add(new MaterialBuilder(SilentGear.getId("wood/rough"), 0, Ingredient.EMPTY) + .categories(MaterialCategories.ORGANIC) .namePrefix(TextUtil.misc("crude")) .partSubstitute(PartType.ROD, ModTags.Items.RODS_ROUGH) .stat(PartType.ROD, ItemStats.DURABILITY, -0.25f, StatInstance.Operation.MUL1) @@ -1136,6 +1173,7 @@ protected Collection getMaterials() { ResourceLocation sgWool = SilentGear.getId("wool"); ret.add(new MaterialBuilder(sgWool, 0, ExclusionIngredient.of(ItemTags.WOOL, Items.BLACK_WOOL, Items.BLUE_WOOL, Items.BROWN_WOOL, Items.CYAN_WOOL, Items.GRAY_WOOL, Items.GREEN_WOOL, Items.LIGHT_BLUE_WOOL, Items.LIGHT_GRAY_WOOL, Items.LIME_WOOL, Items.MAGENTA_WOOL, Items.ORANGE_WOOL, Items.PINK_WOOL, Items.PURPLE_WOOL, Items.RED_WOOL, Items.WHITE_WOOL, Items.YELLOW_WOOL)) + .categories(MaterialCategories.ORGANIC) .stat(PartType.GRIP, ItemStats.REPAIR_EFFICIENCY, 0.2f, StatInstance.Operation.MUL1) .stat(PartType.GRIP, ItemStats.HARVEST_SPEED, 0.1f, StatInstance.Operation.MUL1) .stat(PartType.GRIP, ItemStats.ATTACK_SPEED, 0.2f, StatInstance.Operation.ADD) @@ -1166,6 +1204,7 @@ protected Collection getMaterials() { //region Extra Mod Metals // Aluminum ret.add(extraMetal("aluminum", 2, forgeId("ingots/aluminum")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 365) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 15) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 14) @@ -1193,6 +1232,7 @@ protected Collection getMaterials() { ); // Aluminum Steel ret.add(extraMetal("aluminum_steel", 3, forgeId("ingots/aluminum_steel")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 660) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 18) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.15f) @@ -1220,6 +1260,7 @@ protected Collection getMaterials() { ); // Bismuth ret.add(extraMetal("bismuth", 2, forgeId("ingots/bismuth")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 330) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 10) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 12) @@ -1245,6 +1286,7 @@ protected Collection getMaterials() { ); // Bismuth Brass ret.add(extraMetal("bismuth_brass", 2, forgeId("ingots/bismuth_brass")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 580) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 15) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1271,6 +1313,7 @@ protected Collection getMaterials() { ); // Bismuth Brass ret.add(extraMetal("bismuth_steel", 3, forgeId("ingots/bismuth_steel")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 1050) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 25) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.15f) @@ -1297,6 +1340,7 @@ protected Collection getMaterials() { ); // Brass ret.add(extraMetal("brass", 2, forgeId("ingots/brass")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 240) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 8) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1323,6 +1367,7 @@ protected Collection getMaterials() { ); // Bronze ret.add(extraMetal("bronze", 2, forgeId("ingots/bronze")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 480) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 18) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1351,6 +1396,7 @@ protected Collection getMaterials() { ); // Compressed Iron ret.add(extraMetal("compressed_iron", 3, forgeId("ingots/compressed_iron")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 1024) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 24) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.15f) @@ -1379,6 +1425,7 @@ protected Collection getMaterials() { ); // Copper ret.add(extraMetal("copper", 1, forgeId("ingots/copper")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 128) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 8) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 15) @@ -1404,6 +1451,7 @@ protected Collection getMaterials() { ); // Electrum ret.add(extraMetal("electrum", 2, forgeId("ingots/electrum")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 96) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 10) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 25) @@ -1429,6 +1477,7 @@ protected Collection getMaterials() { ); // Enderium ret.add(extraMetal("enderium", 4, forgeId("ingots/enderium")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 1200) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 34) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1454,6 +1503,7 @@ protected Collection getMaterials() { ); // Invar ret.add(extraMetal("invar", 2, forgeId("ingots/invar")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 640) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 20) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1482,6 +1532,7 @@ protected Collection getMaterials() { ); // Lead ret.add(extraMetal("lead", 2, forgeId("ingots/lead")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 260) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 14) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 15) @@ -1509,6 +1560,7 @@ protected Collection getMaterials() { ); // Lumium ret.add(extraMetal("lumium", 3, forgeId("ingots/lumium")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 920) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 20) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1540,6 +1592,7 @@ protected Collection getMaterials() { ); // Nickel ret.add(extraMetal("nickel", 2, forgeId("ingots/nickel")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 380) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 17) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 12) @@ -1567,6 +1620,7 @@ protected Collection getMaterials() { ); // Osmium ret.add(extraMetal("osmium", 2, forgeId("ingots/osmium")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 500) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 30) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 12) @@ -1591,6 +1645,7 @@ protected Collection getMaterials() { ); // Platinum ret.add(extraMetal("platinum", 3, forgeId("ingots/platinum")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 900) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 21) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 14) @@ -1617,6 +1672,7 @@ protected Collection getMaterials() { ); // Redstone Alloy ret.add(extraMetal("redstone_alloy", 2, forgeId("ingots/redstone_alloy")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 840) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 20) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.15f) @@ -1642,6 +1698,7 @@ protected Collection getMaterials() { ); // Refined glowstone ret.add(extraMetal("refined_glowstone", 3, forgeId("ingots/refined_glowstone")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 300) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 18) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1673,6 +1730,7 @@ protected Collection getMaterials() { ); // Refined Iron ret.add(extraMetal("refined_iron", 2, forgeId("ingots/refined_iron")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 512) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 20) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.15f) @@ -1702,6 +1760,7 @@ protected Collection getMaterials() { ); // Refined obsidian ret.add(extraMetal("refined_obsidian", 4, forgeId("ingots/refined_obsidian")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 2500) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 50) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.3f) @@ -1730,6 +1789,7 @@ protected Collection getMaterials() { ); // Signalum ret.add(extraMetal("signalum", 4, forgeId("ingots/signalum")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 800) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 25) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1757,6 +1817,7 @@ protected Collection getMaterials() { ); // Silver ret.add(extraMetal("silver", 2, forgeId("ingots/silver")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 64) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 8) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 20) @@ -1783,6 +1844,7 @@ protected Collection getMaterials() { ); // Steel ret.add(extraMetal("steel", 2, forgeId("ingots/steel")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 500) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 20) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, 0.15f) @@ -1807,6 +1869,7 @@ protected Collection getMaterials() { ); // Tin ret.add(extraMetal("tin", 1, forgeId("ingots/tin")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 192) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 13) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 12) @@ -1832,6 +1895,7 @@ protected Collection getMaterials() { ); // Titanium ret.add(extraMetal("titanium", 4, forgeId("ingots/titanium")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 1600) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 37) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 12) @@ -1859,6 +1923,7 @@ protected Collection getMaterials() { ); // Uranium ret.add(extraMetal("uranium", 3, forgeId("ingots/uranium")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 800) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 20) .stat(PartType.MAIN, ItemStats.REPAIR_VALUE, -0.15f) @@ -1884,6 +1949,7 @@ protected Collection getMaterials() { ); // Zinc ret.add(extraMetal("zinc", 1, forgeId("ingots/zinc")) + .categories(MaterialCategories.METAL) .stat(PartType.MAIN, ItemStats.DURABILITY, 192) .stat(PartType.MAIN, ItemStats.ARMOR_DURABILITY, 10) .stat(PartType.MAIN, ItemStats.ENCHANTABILITY, 15) diff --git a/src/main/java/net/silentchaos512/gear/gear/material/MaterialCategories.java b/src/main/java/net/silentchaos512/gear/gear/material/MaterialCategories.java new file mode 100644 index 000000000..0e25e7448 --- /dev/null +++ b/src/main/java/net/silentchaos512/gear/gear/material/MaterialCategories.java @@ -0,0 +1,38 @@ +package net.silentchaos512.gear.gear.material; + +import net.silentchaos512.gear.api.material.IMaterialCategory; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +public enum MaterialCategories implements IMaterialCategory { + METAL, GEM, ROCK, ORGANIC, INTANGIBLE; + + private static final Map CACHE = new HashMap<>(); + + @Override + public String getName() { + return name().toLowerCase(Locale.ROOT); + } + + /** + * Gets a material category given the key. This could be one of the enum values, or an entirely + * new object if none of those match. Return values are cached. + * + * @param key The category key + * @return Material category + */ + public static IMaterialCategory get(String key) { + //noinspection OverlyLongLambda + return CACHE.computeIfAbsent(key, key1 -> { + for (MaterialCategories cat : values()) { + if (cat.getName().equalsIgnoreCase(key1)) { + return cat; + } + } + String key2 = key1.toLowerCase(Locale.ROOT); + return () -> key2; + }); + } +} diff --git a/src/main/java/net/silentchaos512/gear/gear/material/MaterialInstance.java b/src/main/java/net/silentchaos512/gear/gear/material/MaterialInstance.java index a6b93ffb2..4988165ce 100644 --- a/src/main/java/net/silentchaos512/gear/gear/material/MaterialInstance.java +++ b/src/main/java/net/silentchaos512/gear/gear/material/MaterialInstance.java @@ -10,10 +10,7 @@ import net.silentchaos512.gear.SilentGear; import net.silentchaos512.gear.api.event.GetMaterialStatsEvent; import net.silentchaos512.gear.api.item.GearType; -import net.silentchaos512.gear.api.material.IMaterial; -import net.silentchaos512.gear.api.material.IMaterialDisplay; -import net.silentchaos512.gear.api.material.IMaterialInstance; -import net.silentchaos512.gear.api.material.MaterialLayer; +import net.silentchaos512.gear.api.material.*; import net.silentchaos512.gear.api.part.MaterialGrade; import net.silentchaos512.gear.api.part.PartType; import net.silentchaos512.gear.api.stats.ItemStat; @@ -113,6 +110,10 @@ public ItemStack getItem() { return item; } + public Collection getCategories() { + return material.getCategories(); + } + @Override public int getTier(PartType partType) { return material.getTier(partType); diff --git a/src/main/java/net/silentchaos512/gear/gear/material/PartMaterial.java b/src/main/java/net/silentchaos512/gear/gear/material/PartMaterial.java index 6b0730eb6..c55416700 100644 --- a/src/main/java/net/silentchaos512/gear/gear/material/PartMaterial.java +++ b/src/main/java/net/silentchaos512/gear/gear/material/PartMaterial.java @@ -1,10 +1,7 @@ package net.silentchaos512.gear.gear.material; import com.google.common.collect.Sets; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonSyntaxException; +import com.google.gson.*; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.network.PacketBuffer; @@ -37,6 +34,7 @@ public final class PartMaterial implements IMaterial { private final ResourceLocation materialId; @Nullable private ResourceLocation parent; private final String packName; + private final Collection categories = new ArrayList<>(); private Ingredient ingredient = Ingredient.EMPTY; private final Map partSubstitutes = new HashMap<>(); private boolean visible = true; @@ -81,6 +79,14 @@ public IMaterial getParent() { return null; } + @Override + public Collection getCategories() { + if (this.categories.isEmpty() && getParent() != null) { + return getParent().getCategories(); + } + return Collections.unmodifiableCollection(this.categories); + } + @Override public int getTier(PartType partType) { if (tier < 0 && getParent() != null) { @@ -351,6 +357,8 @@ private static void deserializeAvailability(JsonObject json, PartMaterial ret) { JsonElement elementAvailability = json.get("availability"); if (elementAvailability != null && elementAvailability.isJsonObject()) { JsonObject obj = elementAvailability.getAsJsonObject(); + + deserializeCategories(obj.get("categories"), ret); ret.tier = JSONUtils.getInt(obj, "tier", ret.tier); ret.visible = JSONUtils.getBoolean(obj, "visible", ret.visible); ret.canSalvage = JSONUtils.getBoolean(obj, "can_salvage", ret.canSalvage); @@ -365,6 +373,21 @@ private static void deserializeAvailability(JsonObject json, PartMaterial ret) { } } + private static void deserializeCategories(@Nullable JsonElement json, PartMaterial material) { + if (json != null) { + if (json.isJsonArray()) { + JsonArray array = json.getAsJsonArray(); + for (JsonElement elem : array) { + material.categories.add(MaterialCategories.get(elem.getAsString())); + } + } else if (json.isJsonPrimitive()) { + material.categories.add(MaterialCategories.get(json.getAsString())); + } else { + throw new JsonParseException("Expected 'categories' to be array or string"); + } + } + } + private static ITextComponent deserializeText(JsonElement json) { return Objects.requireNonNull(ITextComponent.Serializer.getComponentFromJson(json)); } @@ -380,6 +403,11 @@ public PartMaterial read(ResourceLocation id, PacketBuffer buffer) { if (buffer.readBoolean()) material.parent = buffer.readResourceLocation(); + int categoryCount = buffer.readByte(); + for (int i = 0; i < categoryCount; ++i) { + material.categories.add(MaterialCategories.get(buffer.readString())); + } + material.displayName = buffer.readTextComponent(); if (buffer.readBoolean()) material.namePrefix = buffer.readTextComponent(); @@ -425,6 +453,9 @@ public void write(PacketBuffer buffer, PartMaterial material) { if (material.parent != null) buffer.writeResourceLocation(material.parent); + buffer.writeByte(material.categories.size()); + material.categories.forEach(cat -> buffer.writeString(cat.getName())); + buffer.writeTextComponent(material.displayName); buffer.writeBoolean(material.namePrefix != null); if (material.namePrefix != null) diff --git a/src/main/java/net/silentchaos512/gear/util/SynergyUtils.java b/src/main/java/net/silentchaos512/gear/util/SynergyUtils.java index 6d76d56ec..2372d7271 100644 --- a/src/main/java/net/silentchaos512/gear/util/SynergyUtils.java +++ b/src/main/java/net/silentchaos512/gear/util/SynergyUtils.java @@ -29,6 +29,9 @@ public final class SynergyUtils { private SynergyUtils() {} public static float getSynergy(PartType partType, List materials, List traits) { + // TODO: Factor material categories into calculation, decrease weight of rarity and maybe tier + // https://github.com/SilentChaos512/Silent-Gear/issues/267 + if (materials.isEmpty()) { return 1; } diff --git a/src/main/resources/assets/silentgear/lang/en_us.json b/src/main/resources/assets/silentgear/lang/en_us.json index 68102690b..c92f61cc9 100644 --- a/src/main/resources/assets/silentgear/lang/en_us.json +++ b/src/main/resources/assets/silentgear/lang/en_us.json @@ -555,6 +555,7 @@ "misc.silentgear.invalidParts": "Seems to contain invalid parts", "misc.silentgear.key": "[%s]", "misc.silentgear.lockedStats": "Stats are locked", + "misc.silentgear.materialCategories": "Categories: %s", "misc.silentgear.missingBowstring": "Missing required bowstring, cannot be fired", "misc.silentgear.missingRod": "Missing a required rod, some stats reduced", "misc.silentgear.missingRod.attack": "Your tool is missing a rod!",