aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de
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/java/de
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/java/de')
-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
2 files changed, 6 insertions, 14 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;