diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/mixin/ClientPlayerEntityMixin.java | 15 | ||||
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/item/HotbarSlotLock.java | 5 |
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; |