Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
import net.minecraft.util.Hand;
import net.minecraft.world.GameMode;

import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_MIDDLE;

Expand Down Expand Up @@ -66,6 +67,13 @@ public class MiddleClickExtra extends Module {
.build()
);

private final Setting<Boolean> disableInCreative = sgGeneral.add(new BoolSetting.Builder()
.name("disable-in-creative")
.description("Middle click action is disabled in Creative mode.")
.defaultValue(true)
.build()
);

private final Setting<Boolean> notify = sgGeneral.add(new BoolSetting.Builder()
.name("notify")
.description("Notifies you when you do not have the specified item in your hotbar.")
Expand All @@ -92,6 +100,8 @@ public void onDeactivate() {
private void onMouseClick(MouseClickEvent event) {
if (event.action != KeyAction.Press || event.button() != GLFW_MOUSE_BUTTON_MIDDLE || mc.currentScreen != null) return;

if (disabledByCreative()) return;

if (mode.get() == Mode.AddFriend) {
if (mc.targetedEntity == null) return;
if (!(mc.targetedEntity instanceof PlayerEntity player)) return;
Expand Down Expand Up @@ -180,6 +190,12 @@ void swapBack(boolean wasCancelled) {
}
}

private boolean disabledByCreative() {
if (mc.player == null) return false;

return disableInCreative.get() && mc.player.getGameMode() == GameMode.CREATIVE;
}

public enum Mode {
Pearl(Items.ENDER_PEARL, true),
XP(Items.EXPERIENCE_BOTTLE, true),
Expand Down