Skip to content

Commit

Permalink
Implement improved modifier display name logic
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Apr 17, 2022
1 parent 0cf2a01 commit 7e9b450
Show file tree
Hide file tree
Showing 47 changed files with 317 additions and 229 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ forge_range=[40.0.41,)
parchment_version=2022.03.13

# Build Dependencies
mantle_version=1.9.14
mantle_range=1.9.14,)
mantle_version=1.9.17
mantle_range=1.9.17,)

# Optional compat
jei_version=9.5.3.153
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:single_level",
"rarity": "uncommon",
"stats": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:extra_slot",
"level_display": "tconstruct:single_level",
"always_show": false,
"slots": {
"abilities": 1
},
"single_level": true,
"always_show": false
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"stats": [
{
"stat": "tconstruct:durability",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:single_level",
"rarity": "uncommon",
"stats": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:extra_slot",
"level_display": "tconstruct:default",
"always_show": true,
"slots": {
"upgrades": 1
},
"single_level": false,
"always_show": true
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:loot",
"level_display": "tconstruct:default",
"enchantment": {
"name": "minecraft:fortune",
"level": 1
},
"single_level": false
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:extra_slot",
"level_display": "tconstruct:default",
"always_show": false,
"slots": {
"upgrades": 2
},
"single_level": false,
"always_show": false
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:no_levels",
"flags": [
"tconstruct:piglin_neutral"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:extra_slot",
"level_display": "tconstruct:single_level",
"always_show": false,
"slots": {
"upgrades": 1
},
"single_level": true,
"always_show": false
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"stats": [
{
"stat": "tconstruct:attack_damage",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"attributes": [
{
"unique": "tconstruct.modifier.armor_knockback",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"stats": [
{
"stat": "tconstruct:knockback_resistance",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"stats": [
{
"stat": "tconstruct:attack_speed",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "tconstruct:loot",
"looting": 1,
"single_level": false
"level_display": "tconstruct:default",
"looting": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "tconstruct:loot",
"level_display": {
"type": "tconstruct:unique",
"unique_until": 3
},
"enchantment": {
"name": "minecraft:fortune",
"level": 1
},
"looting": 1
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:single_level",
"rarity": "rare",
"stats": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"attributes": [
{
"unique": "tconstruct.modifier.reach",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:extra_slot",
"level_display": "tconstruct:single_level",
"always_show": false,
"slots": {
"upgrades": 1
},
"single_level": true,
"always_show": false
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:extra_slot",
"level_display": "tconstruct:single_level",
"always_show": false,
"slots": {
"upgrades": 1
},
"single_level": true,
"always_show": false
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"attributes": [
{
"unique": "tconstruct.modifier.revitalizing",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"type": "tconstruct:stat_boost",
"level_display": {
"type": "tconstruct:unique",
"unique_until": 5
},
"stats": [
{
"stat": "tconstruct:attack_damage",
"type": "add",
"value": 0.75
}
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"stats": [
{
"stat": "tconstruct:mining_speed",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:no_levels",
"rarity": "epic",
"flags": [
"tconstruct:shiny"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:loot",
"level_display": "tconstruct:no_levels",
"enchantment": {
"name": "minecraft:silk_touch",
"level": 1
},
"single_level": true
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"attributes": [
{
"unique": "tconstruct.modifier.speedy",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"attributes": [
{
"unique": "tconstruct.modifier.strength",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"stats": [
{
"stat": "tconstruct:durability",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"type": "tconstruct:stat_boost",
"level_display": {
"type": "tconstruct:unique",
"unique_until": 5
},
"stats": [
{
"stat": "tconstruct:attack_speed",
"type": "multiply_base",
"value": 0.05
}
]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:default",
"flags": [
"tconstruct:elyta"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"type": "tconstruct:stat_boost",
"level_display": "tconstruct:no_levels",
"rarity": "uncommon",
"flags": [
"tconstruct:indestructible"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"type": "tconstruct:extra_slot",
"level_display": "tconstruct:single_level",
"always_show": false,
"slots": {
"upgrades": 1
},
"single_level": true,
"always_show": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected void generate() {

// general
with.accept(ModifierIds.gilded);
withL.accept(TinkerModifiers.luck);
with.accept(ModifierIds.luck);
with.accept(ModifierIds.reach);
withL.accept(TinkerModifiers.unbreakable);
// armor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void run(HashCache cache) throws IOException {

/** Converts the given object to json */
private static JsonObject convert(Result result) {
JsonObject json = ModifierManager.MODIFIER_LOADERS.serialize(result.modifier());
JsonObject json = ModifierManager.MODIFIER_LOADERS.serialize(result.modifier()).getAsJsonObject();
if (result.condition != null) {
json.add("condition", CraftingHelper.serialize(result.condition));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import slimeknights.tconstruct.common.TinkerTags;
import slimeknights.tconstruct.library.client.ResourceColorManager;
import slimeknights.tconstruct.library.modifiers.ModifierManager.ModifierRegistrationEvent;
import slimeknights.tconstruct.library.modifiers.util.ModifierLevelDisplay;
import slimeknights.tconstruct.library.recipe.tinkerstation.ValidatedResult;
import slimeknights.tconstruct.library.tools.context.EquipmentChangeContext;
import slimeknights.tconstruct.library.tools.context.EquipmentContext;
Expand All @@ -53,7 +54,6 @@
import slimeknights.tconstruct.library.tools.stat.ModifierStatsBuilder;
import slimeknights.tconstruct.library.tools.stat.ToolStats;
import slimeknights.tconstruct.library.utils.RestrictedCompoundTag;
import slimeknights.tconstruct.library.utils.RomanNumeralHelper;
import slimeknights.tconstruct.library.utils.TooltipKey;
import slimeknights.tconstruct.library.utils.Util;

Expand Down Expand Up @@ -225,9 +225,7 @@ public final Component getDisplayName() {
* @return Display name
*/
public Component getDisplayName(int level) {
return applyStyle(new TranslatableComponent(getTranslationKey())
.append(" ")
.append(RomanNumeralHelper.getNumeral(level)));
return ModifierLevelDisplay.DEFAULT.nameForLevel(this, level);
}

/**
Expand Down

0 comments on commit 7e9b450

Please sign in to comment.