Skip to content

Commit

Permalink
feat: config for moving slider message (The-Aether-Team#2174)
Browse files Browse the repository at this point in the history
  • Loading branch information
bconlon1 authored Jun 18, 2024
1 parent b876323 commit 1592c59
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.4 2024-03-19T10:40:11.0986426 Languages: en_us for mod: aether
e7e94e6fd59dfba72560405db1ea7169ba8d771e assets/aether/lang/en_us.json
// 1.20.4 2024-05-29T15:20:59.4553229 Languages: en_us for mod: aether
b3b70053fb75b9e4470ab7a5ae90365eab49644e assets/aether/lang/en_us.json
1 change: 1 addition & 0 deletions src/generated/resources/assets/aether/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
"config.aether.common.data_pack.add_temporary_freezing_automatically": "Sets the Aether Temporary Freezing data pack to be added to new worlds automatically",
"config.aether.common.gameplay.enable_startup_loot": "When the player enters the Aether, they are given a Book of Lore and Golden Parachutes as starting loot",
"config.aether.common.gameplay.repeat_sun_spirit_dialogue": "Determines whether the Sun Spirit's dialogue when meeting him should play through every time you meet him",
"config.aether.common.gameplay.reposition_slider_message": "Moves the message for when a player attacks the Slider with an incorrect item to be above the hotbar instead of in chat",
"config.aether.common.gameplay.show_patreon_message": "Determines if a message that links The Aether mod's Patreon should show",
"config.aether.common.gameplay.start_with_portal": "On world creation, the player is given an Aether Portal Frame item to automatically go to the Aether with",
"config.aether.common.gameplay.use_curios_menu": "Use the default Curios menu instead of the Aether's Accessories Menu. WARNING: Do not enable this without emptying your equipped accessories",
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/aetherteam/aether/AetherConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public static class Common {
public final ConfigValue<Boolean> use_curios_menu;
public final ConfigValue<Boolean> start_with_portal;
public final ConfigValue<Boolean> enable_startup_loot;
public final ConfigValue<Boolean> reposition_slider_message;
public final ConfigValue<Boolean> repeat_sun_spirit_dialogue;
public final ConfigValue<Boolean> show_patreon_message;

Expand All @@ -176,6 +177,10 @@ public Common(ModConfigSpec.Builder builder) {
.comment("When the player enters the Aether, they are given a Book of Lore and Golden Parachutes as starting loot")
.translation("config.aether.common.gameplay.enable_startup_loot")
.define("Gives starting loot on entry", true);
reposition_slider_message = builder
.comment("Moves the message for when a player attacks the Slider with an incorrect item to be above the hotbar instead of in chat")
.translation("config.aether.common.gameplay.reposition_slider_message")
.define("Reposition attack message above hotbar", false);
repeat_sun_spirit_dialogue = builder
.comment("Determines whether the Sun Spirit's dialogue when meeting him should play through every time you meet him")
.translation("config.aether.common.gameplay.repeat_sun_spirit_dialogue")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,7 @@ protected void addTranslations() {
this.addCommonConfig("gameplay", "use_curios_menu", "Use the default Curios menu instead of the Aether's Accessories Menu. WARNING: Do not enable this without emptying your equipped accessories");
this.addCommonConfig("gameplay", "start_with_portal", "On world creation, the player is given an Aether Portal Frame item to automatically go to the Aether with");
this.addCommonConfig("gameplay", "enable_startup_loot", "When the player enters the Aether, they are given a Book of Lore and Golden Parachutes as starting loot");
this.addCommonConfig("gameplay", "reposition_slider_message", "Moves the message for when a player attacks the Slider with an incorrect item to be above the hotbar instead of in chat");
this.addCommonConfig("gameplay", "repeat_sun_spirit_dialogue", "Determines whether the Sun Spirit's dialogue when meeting him should play through every time you meet him");
this.addCommonConfig("gameplay", "show_patreon_message", "Determines if a message that links The Aether mod's Patreon should show");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.aetherteam.aether.entity.monster.dungeon.boss;

import com.aetherteam.aether.Aether;
import com.aetherteam.aether.AetherConfig;
import com.aetherteam.aether.AetherTags;
import com.aetherteam.aether.block.AetherBlocks;
import com.aetherteam.aether.client.AetherSoundEvents;
Expand Down Expand Up @@ -279,7 +280,11 @@ private Optional<LivingEntity> canDamageSlider(DamageSource source) {
private Optional<LivingEntity> sendInvalidToolMessage(LivingEntity attacker) {
if (!this.level().isClientSide() && attacker instanceof Player player) {
if (this.getChatCooldown() <= 0) {
player.sendSystemMessage(Component.translatable("gui.aether.slider.message.attack.invalid")); // Invalid tool.
if (AetherConfig.COMMON.reposition_slider_message.get()) {
player.displayClientMessage(Component.translatable("gui.aether.slider.message.attack.invalid"), true); // Invalid tool.
} else {
player.sendSystemMessage(Component.translatable("gui.aether.slider.message.attack.invalid")); // Invalid tool.
}
this.setChatCooldown(15);
}
}
Expand Down

0 comments on commit 1592c59

Please sign in to comment.