mirror of
https://github.com/darksaid98/draggable_lists.git
synced 2026-12-03 14:38:46 +00:00
Add config option to disable, enable and require shift to be pressed to enable dragging entries
Resolves #46
This commit is contained in:
5 files changed
+31
-3
No files matched your search
@@ -2,10 +2,16 @@ package com.mrmelon54.DraggableLists.config;
|
|||||||
|
|
||||||
import me.shedaniel.autoconfig.ConfigData;
|
import me.shedaniel.autoconfig.ConfigData;
|
||||||
import me.shedaniel.autoconfig.annotation.Config;
|
import me.shedaniel.autoconfig.annotation.Config;
|
||||||
|
import me.shedaniel.autoconfig.annotation.ConfigEntry;
|
||||||
|
|
||||||
@Config(name = "draggable_lists")
|
@Config(name = "draggable_lists")
|
||||||
@Config.Gui.Background("minecraft:textures/block/brain_coral_block.png")
|
@Config.Gui.Background("minecraft:textures/block/brain_coral_block.png")
|
||||||
public class ConfigStructure implements ConfigData {
|
public class ConfigStructure implements ConfigData {
|
||||||
public boolean disableResourcePackArrows = true;
|
public boolean disableResourcePackArrows = true;
|
||||||
public boolean disableServerArrows = true;
|
public boolean disableServerArrows = true;
|
||||||
|
|
||||||
|
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
|
||||||
|
public EnabledMode resourcePackDraggingEnabled = EnabledMode.ENABLED;
|
||||||
|
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
|
||||||
|
public EnabledMode serverDraggingEnabled = EnabledMode.ENABLED;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.mrmelon54.DraggableLists.config;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
|
||||||
|
public enum EnabledMode {
|
||||||
|
DISABLED,
|
||||||
|
REQUIRES_MODIFIER,
|
||||||
|
ENABLED;
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return switch (this) {
|
||||||
|
case DISABLED -> false;
|
||||||
|
case REQUIRES_MODIFIER -> Screen.hasShiftDown();
|
||||||
|
case ENABLED -> true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-1
@@ -3,6 +3,8 @@ package com.mrmelon54.DraggableLists.mixin.packs;
|
|||||||
import com.mrmelon54.DraggableLists.DragItem;
|
import com.mrmelon54.DraggableLists.DragItem;
|
||||||
import com.mrmelon54.DraggableLists.DragList;
|
import com.mrmelon54.DraggableLists.DragList;
|
||||||
import com.mrmelon54.DraggableLists.DragManager;
|
import com.mrmelon54.DraggableLists.DragManager;
|
||||||
|
import com.mrmelon54.DraggableLists.DraggableLists;
|
||||||
|
import com.mrmelon54.DraggableLists.config.ConfigStructure;
|
||||||
import com.mrmelon54.DraggableLists.duck.AbstractPackDuckProvider;
|
import com.mrmelon54.DraggableLists.duck.AbstractPackDuckProvider;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
@@ -46,7 +48,7 @@ public abstract class TransferableSelectionListMixin extends ObjectSelectionList
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
||||||
if (!draggable_lists$isMouseOverScrollbar(mouseX) && draggable_lists$dragManager.mouseDragged(mouseX, mouseY, button, deltaX, deltaY)) return true;
|
if (DraggableLists.CONFIG.resourcePackDraggingEnabled.isEnabled() && !draggable_lists$isMouseOverScrollbar(mouseX) && draggable_lists$dragManager.mouseDragged(mouseX, mouseY, button, deltaX, deltaY)) return true;
|
||||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -3,6 +3,7 @@ package com.mrmelon54.DraggableLists.mixin.server;
|
|||||||
import com.mrmelon54.DraggableLists.DragItem;
|
import com.mrmelon54.DraggableLists.DragItem;
|
||||||
import com.mrmelon54.DraggableLists.DragList;
|
import com.mrmelon54.DraggableLists.DragList;
|
||||||
import com.mrmelon54.DraggableLists.DragManager;
|
import com.mrmelon54.DraggableLists.DragManager;
|
||||||
|
import com.mrmelon54.DraggableLists.DraggableLists;
|
||||||
import com.mrmelon54.DraggableLists.duck.ServerListDuckProvider;
|
import com.mrmelon54.DraggableLists.duck.ServerListDuckProvider;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
@@ -59,7 +60,7 @@ public abstract class ServerSelectionListMixin extends ObjectSelectionList<Serve
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
||||||
if (draggable_lists$dragManager.mouseDragged(mouseX, mouseY, button, deltaX, deltaY)) return true;
|
if (DraggableLists.CONFIG.serverDraggingEnabled.isEnabled() && draggable_lists$dragManager.mouseDragged(mouseX, mouseY, button, deltaX, deltaY)) return true;
|
||||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,7 @@
|
|||||||
"text.autoconfig.draggable_lists.option.disableResourcePackArrows": "Disable Resource Pack Arrows",
|
"text.autoconfig.draggable_lists.option.disableResourcePackArrows": "Disable Resource Pack Arrows",
|
||||||
"text.autoconfig.draggable_lists.option.disableDatapackArrows": "Disable Datapack Arrows",
|
"text.autoconfig.draggable_lists.option.disableDatapackArrows": "Disable Datapack Arrows",
|
||||||
"text.autoconfig.draggable_lists.option.disableServerArrows": "Disable Server Arrows",
|
"text.autoconfig.draggable_lists.option.disableServerArrows": "Disable Server Arrows",
|
||||||
"text.autoconfig.draggable_lists.option.disableLevelArrows": "Disable Level Arrows"
|
"text.autoconfig.draggable_lists.option.disableLevelArrows": "Disable Level Arrows",
|
||||||
|
"text.autoconfig.draggable_lists.option.resourcePackDraggingEnabled": "Resource Pack Dragging",
|
||||||
|
"text.autoconfig.draggable_lists.option.serverDraggingEnabled": "Server Dragging"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user