Skip to content

Commit

Permalink
Dungeons improvements (#493)
Browse files Browse the repository at this point in the history
* Add setting for dropping protected items in dungeons
* Fix Livid colour text
  • Loading branch information
Kaluub authored Jan 20, 2024
1 parent 2cf648b commit fa4063d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,9 @@ public static class Dungeons {
@SerialEntry
public boolean floor3GuardianHealthDisplay = true;

@SerialEntry
public boolean allowDroppingProtectedItems = false;

@SerialEntry
public LividColor lividColor = new LividColor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,16 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.locations.dungeons.floor3GuardianHealthDisplay = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.allowDroppingProtectedItems"))
.description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.allowDroppingProtectedItems.@Tooltip")))
.binding(defaults.locations.dungeons.allowDroppingProtectedItems,
() -> config.locations.dungeons.allowDroppingProtectedItems,
newValue -> config.locations.dungeons.allowDroppingProtectedItems = newValue)
.controller(ConfigUtils::createBooleanController)
.build())

//Livid Color
// Livid Color
.group(OptionGroup.createBuilder()
.name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.lividColor"))
.collapsed(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.authlib.GameProfile;

import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.dungeon.partyfinder.PartyFinderScreen;
import de.hysky.skyblocker.skyblock.item.HotbarSlotLock;
import de.hysky.skyblocker.skyblock.item.ItemProtection;
Expand Down Expand Up @@ -31,7 +32,12 @@ public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
@Inject(method = "dropSelectedItem", at = @At("HEAD"), cancellable = true)
public void skyblocker$dropSelectedItem(CallbackInfoReturnable<Boolean> cir) {
if (Utils.isOnSkyblock()) {
if (ItemProtection.isItemProtected(this.getInventory().getMainHandStack())) cir.setReturnValue(false);
if (ItemProtection.isItemProtected(this.getInventory().getMainHandStack())) {
if (!SkyblockerConfigManager.get().locations.dungeons.allowDroppingProtectedItems
|| (SkyblockerConfigManager.get().locations.dungeons.allowDroppingProtectedItems && !Utils.isInDungeons())) {
cir.setReturnValue(false);
}
}
HotbarSlotLock.handleDropSelectedItem(this.getInventory().selectedSlot, cir);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ private static void onLividColorFound(MinecraftClient client, Block color) {
LividColor.color = WOOL_TO_FORMATTING.get(color);
String colorString = Registries.BLOCK.getId(color).getPath();
colorString = colorString.substring(0, colorString.length() - 5).toUpperCase();
String[] messageParts = CONFIG.lividColorText.split("\\[color]");
MutableText message = Constants.PREFIX.get().append(messageParts[0]);
for (int i = 1; i < messageParts.length; i++) {
message = message.append(Text.literal(colorString).formatted(LividColor.color)).append(Text.of(messageParts[i]));
}
MutableText message = Constants.PREFIX.get()
.append(CONFIG.lividColorText.replaceAll("\\[color]", colorString))
.formatted(LividColor.color);
if (CONFIG.enableLividColorText) {
MessageScheduler.INSTANCE.sendMessageAfterCooldown(message.getString());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/hysky/skyblocker/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private static void updateLocRaw() {
/**
* Parses the /locraw reply from the server and updates the player's profile id
*
* @return not display the message in chat is the command is sent by the mod
* @return not display the message in chat if the command is sent by the mod
*/
public static boolean onChatMessage(Text text, boolean overlay) {
String message = text.getString();
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@
"text.autoconfig.skyblocker.option.locations.dungeons.fireFreezeStaffTimer.@Tooltip": "Display a timer when to use a Fire Freeze Staff in the F3/M3 boss fight.",
"text.autoconfig.skyblocker.option.locations.dungeons.floor3GuardianHealthDisplay": "Guardian Health Display (F3/M3)",
"text.autoconfig.skyblocker.option.locations.dungeons.floor3GuardianHealthDisplay.@Tooltip": "Displays guardian's health below them in the F3/M3 boss fight.",
"text.autoconfig.skyblocker.option.locations.dungeons.allowDroppingProtectedItems": "Enabled Dropping Protected Items",
"text.autoconfig.skyblocker.option.locations.dungeons.allowDroppingProtectedItems.@Tooltip": "Allows the use of class abilities in Dungeons while holding an item which has been protected using /skyblocker protectItem.",

"text.autoconfig.skyblocker.option.locations.dwarvenMines": "Dwarven Mines",
"text.autoconfig.skyblocker.option.locations.dwarvenMines.enableDrillFuel": "Enable Drill Fuel",
"text.autoconfig.skyblocker.option.locations.dwarvenMines.solveFetchur": "Solve Fetchur",
Expand Down

0 comments on commit fa4063d

Please sign in to comment.