aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorKevin <92656833+kevinthegreat1@users.noreply.github.com>2024-04-16 19:42:38 -0400
committerGitHub <noreply@github.com>2024-04-16 19:42:38 -0400
commita505ac7f096e6a669536452c918458cae5a8a224 (patch)
treee576c1a9d83da2f76dadef64f6c7960e268f991f /src/main
parentddd068b44d5f724bcbbe4a19a2902d44a7262e71 (diff)
downloadSkyblocker-a505ac7f096e6a669536452c918458cae5a8a224.tar.gz
Skyblocker-a505ac7f096e6a669536452c918458cae5a8a224.tar.bz2
Skyblocker-a505ac7f096e6a669536452c918458cae5a8a224.zip
Allow drop in dungeon option for locked slots (#624)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/hysky/skyblocker/mixin/ClientPlayerEntityMixin.java15
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/HotbarSlotLock.java5
-rw-r--r--src/main/resources/assets/skyblocker/lang/en_us.json4
3 files changed, 8 insertions, 16 deletions
diff --git a/src/main/java/de/hysky/skyblocker/mixin/ClientPlayerEntityMixin.java b/src/main/java/de/hysky/skyblocker/mixin/ClientPlayerEntityMixin.java
index 049443f7..8fb2fda4 100644
--- a/src/main/java/de/hysky/skyblocker/mixin/ClientPlayerEntityMixin.java
+++ b/src/main/java/de/hysky/skyblocker/mixin/ClientPlayerEntityMixin.java
@@ -27,7 +27,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ClientPlayerEntity.class)
public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {
- @Shadow @Final protected MinecraftClient client;
+ @Shadow
+ @Final
+ protected MinecraftClient client;
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
super(world, profile);
@@ -35,14 +37,9 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
@Inject(method = "dropSelectedItem", at = @At("HEAD"), cancellable = true)
public void skyblocker$dropSelectedItem(CallbackInfoReturnable<Boolean> cir) {
- if (Utils.isOnSkyblock()) {
- 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);
+ if (Utils.isOnSkyblock() && (ItemProtection.isItemProtected(this.getInventory().getMainHandStack()) || HotbarSlotLock.isLocked(this.getInventory().selectedSlot))
+ && (!SkyblockerConfigManager.get().locations.dungeons.allowDroppingProtectedItems || !Utils.isInDungeons())) {
+ cir.setReturnValue(false);
}
}
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/HotbarSlotLock.java b/src/main/java/de/hysky/skyblocker/skyblock/item/HotbarSlotLock.java
index 069a030d..0fda3ef4 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/HotbarSlotLock.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/HotbarSlotLock.java
@@ -5,7 +5,6 @@ import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.option.KeyBinding;
import org.lwjgl.glfw.GLFW;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
@@ -24,10 +23,6 @@ public class HotbarSlotLock {
return SkyblockerConfigManager.get().general.lockedSlots.contains(slot);
}
- public static void handleDropSelectedItem(int slot, CallbackInfoReturnable<Boolean> cir) {
- if (isLocked(slot)) cir.setReturnValue(false);
- }
-
public static void handleInputEvents(ClientPlayerEntity player) {
while (hotbarSlotLock.wasPressed()) {
List<Integer> lockedSlots = SkyblockerConfigManager.get().general.lockedSlots;
diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json
index bda6a909..3696ab67 100644
--- a/src/main/resources/assets/skyblocker/lang/en_us.json
+++ b/src/main/resources/assets/skyblocker/lang/en_us.json
@@ -326,8 +326,8 @@
"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.dungeons.allowDroppingProtectedItems": "Enabled Dropping Protected Items & on Locked Slots",
+ "text.autoconfig.skyblocker.option.locations.dungeons.allowDroppingProtectedItems.@Tooltip": "Allows the use of class abilities in Dungeons on a locked slot or 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",