Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
CleverNucleus committed Aug 28, 2022
1 parent 925f9de commit 5128ab1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {

this.textRenderer.draw(matrices, Text.translatable("playerex.gui.page.attributes.text.vitality").formatted(Formatting.DARK_GRAY), (this.x + 105) / scaleX.get(), (this.y + 26) / scaleY.get(), 4210752);
this.textRenderer.draw(matrices, Text.translatable("playerex.gui.page.attributes.text.resistances").formatted(Formatting.DARK_GRAY), (this.x + 105) / scaleX.get(), (this.y + 81) / scaleY.get(), 4210752);
this.textRenderer.draw(matrices, (Text.translatable("playerex.gui.page.attributes.text.vitality")).formatted(Formatting.DARK_GRAY), (this.x + 105) / scaleX.get(), (this.y + 26) / scaleY.get(), 4210752);
this.textRenderer.draw(matrices, (Text.translatable("playerex.gui.page.attributes.text.resistances")).formatted(Formatting.DARK_GRAY), (this.x + 105) / scaleX.get(), (this.y + 81) / scaleY.get(), 4210752);

matrices.pop();

Expand Down Expand Up @@ -175,10 +173,6 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.level", Math.round(value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.level[0]")).formatted(Formatting.GRAY));
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.level[1]")).formatted(Formatting.GRAY));
tooltip.add(Text.empty());
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.level[2]", ExAPI.getConfig().skillPointsPerLevelUp())).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.level[0]").formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.level[1]").formatted(Formatting.GRAY));
tooltip.add(Text.empty());
Expand All @@ -189,8 +183,6 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.skill_points", ExAPI.PLAYER_DATA.get(entity).skillPoints()).formatted(Formatting.DARK_GRAY);
}, entity -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.skill_points[0]")).formatted(Formatting.GRAY));
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.skill_points[1]")).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.skill_points[0]").formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.skill_points[1]").formatted(Formatting.GRAY));
return tooltip;
Expand All @@ -199,7 +191,6 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.constitution", Math.round(value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable(ExAPI.CONSTITUTION.get().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add(Text.translatable(ExAPI.CONSTITUTION.get().getTranslationKey()).formatted(Formatting.GRAY));
tooltip.add(Text.empty());

Expand All @@ -210,7 +201,6 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.strength", Math.round(value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable(ExAPI.STRENGTH.get().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add(Text.translatable(ExAPI.STRENGTH.get().getTranslationKey()).formatted(Formatting.GRAY));
tooltip.add(Text.empty());

Expand All @@ -221,7 +211,6 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.dexterity", Math.round(value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable(ExAPI.DEXTERITY.get().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add(Text.translatable(ExAPI.DEXTERITY.get().getTranslationKey()).formatted(Formatting.GRAY));
tooltip.add(Text.empty());

Expand All @@ -232,7 +221,6 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.intelligence", Math.round(value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable(ExAPI.INTELLIGENCE.get().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add(Text.translatable(ExAPI.INTELLIGENCE.get().getTranslationKey()).formatted(Formatting.GRAY));
tooltip.add(Text.empty());

Expand All @@ -243,7 +231,6 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.luckiness", Math.round(value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable(ExAPI.LUCKINESS.get().getTranslationKey())).formatted(Formatting.GRAY));
tooltip.add(Text.translatable(ExAPI.LUCKINESS.get().getTranslationKey()).formatted(Formatting.GRAY));
tooltip.add(Text.empty());

Expand All @@ -255,23 +242,20 @@ protected void init() {
}, entity -> {
List<Text> tooltip = new ArrayList<Text>();
String formatted = ClientUtil.FORMATTING_3.format(20.0D * entity.getMovementSpeed());
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.movement_speed", formatted)).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.movement_speed", formatted).formatted(Formatting.GRAY));
return tooltip;
}, 21, 125));
COMPONENTS.add(RenderComponent.of(ExAPI.BREAKING_SPEED, value -> {
return Text.translatable("playerex.gui.page.attributes.text.breaking_speed", ClientUtil.FORMATTING_3.format(value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.breaking_speed")).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.breaking_speed").formatted(Formatting.GRAY));
return tooltip;
}, 21, 136));
COMPONENTS.add(RenderComponent.of(ExAPI.REACH_DISTANCE, value -> {
return Text.translatable("playerex.gui.page.attributes.text.reach_distance", ClientUtil.FORMATTING_2.format(4.5F + value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.reach_distance", ClientUtil.FORMATTING_2.format(4.5F + value))).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.reach_distance", ClientUtil.FORMATTING_2.format(4.5F + value)).formatted(Formatting.GRAY));
return tooltip;
}, 21, 147));
Expand All @@ -281,16 +265,13 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.health", current, maximum).formatted(Formatting.DARK_GRAY);
}, entity -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.health")).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.health").formatted(Formatting.GRAY));
return tooltip;
}, 93, 37));
COMPONENTS.add(RenderComponent.of(ExAPI.HEALTH_REGENERATION, value -> {
return Text.translatable("playerex.gui.page.attributes.text.health_regeneration", ClientUtil.FORMATTING_3.format(value)).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.health_regeneration[0]")).formatted(Formatting.GRAY));
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.health_regeneration[1]")).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.health_regeneration[0]").formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.health_regeneration[1]").formatted(Formatting.GRAY));
return tooltip;
Expand All @@ -300,8 +281,6 @@ protected void init() {
return Text.translatable("playerex.gui.page.attributes.text.heal_amplification", displ).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.heal_amplification[0]")).formatted(Formatting.GRAY));
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.heal_amplification[1]")).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.heal_amplification[0]").formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.heal_amplification[1]").formatted(Formatting.GRAY));
return tooltip;
Expand All @@ -312,7 +291,6 @@ protected void init() {
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
String displ = ClientUtil.FORMATTING_2.format(100.0F * value);
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.fire_resistance", displ)).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.fire_resistance", displ).formatted(Formatting.GRAY));
return tooltip;
}, 93, 92));
Expand All @@ -322,7 +300,6 @@ protected void init() {
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
String displ = ClientUtil.FORMATTING_2.format(100.0F * value);
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.freeze_resistance", displ)).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.freeze_resistance", displ).formatted(Formatting.GRAY));
return tooltip;
}, 93, 103));
Expand All @@ -332,7 +309,6 @@ protected void init() {
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
String displ = ClientUtil.FORMATTING_2.format(100.0F * value);
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.lightning_resistance", displ)).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.lightning_resistance", displ).formatted(Formatting.GRAY));
return tooltip;
}, 93, 114));
Expand All @@ -342,20 +318,12 @@ protected void init() {
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
String displ = ClientUtil.FORMATTING_2.format(100.0F * value);
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.poison_resistance", displ)).formatted(Formatting.GRAY));
tooltip.add(Text.translatable("playerex.gui.page.attributes.tooltip.poison_resistance", displ).formatted(Formatting.GRAY));
return tooltip;
}, 93, 125));
COMPONENTS.add(RenderComponent.of(ExAPI.WITHER_RESISTANCE, value -> {
String displ = ClientUtil.FORMATTING_2.format(ClientUtil.displayValue(ExAPI.WITHER_RESISTANCE, value)).formatted(Formatting.DARK_GRAY);
return Text.translatable("playerex.gui.page.attributes.text.wither_resistance", displ);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
String displ = ClientUtil.FORMATTING_2.format(100.0F * value);
tooltip.add((Text.translatable("playerex.gui.page.attributes.tooltip.wither_resistance", displ)).formatted(Formatting.GRAY));

String displ = ClientUtil.FORMATTING_2.format(ClientUtil.displayValue(ExAPI.WITHER_RESISTANCE, value));
return Text.translatable("playerex.gui.page.attributes.text.wither_resistance", displ).formatted(Formatting.DARK_GRAY);
}, value -> {
List<Text> tooltip = new ArrayList<Text>();
String displ = ClientUtil.FORMATTING_2.format(100.0F * value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.google.common.collect.Sets;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import com.mojang.brigadier.tree.ArgumentCommandNode;
import com.mojang.brigadier.tree.CommandNode;
Expand Down

0 comments on commit 5128ab1

Please sign in to comment.