mirror of
https://github.com/darksaid98/draggable_lists.git
synced 2026-12-01 22:15:45 +00:00
Finish 1.20.4 port
This commit is contained in:
8 files changed
+24
-27
No files matched your search
@@ -10,7 +10,7 @@ import net.minecraft.server.packs.repository.Pack;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class DraggableLists {
|
||||
public static final String MOD_ID = "draggable";
|
||||
public static final String MOD_ID = "draggable_lists";
|
||||
private static ConfigStructure config;
|
||||
|
||||
public static ConfigStructure getConfig() {
|
||||
@@ -25,12 +25,4 @@ public class DraggableLists {
|
||||
public static Supplier<Screen> createConfigScreen(Screen screen) {
|
||||
return AutoConfig.getConfigScreen(ConfigStructure.class, screen);
|
||||
}
|
||||
|
||||
public static boolean shouldNotTouch(Pack pack) {
|
||||
return pack.isFixedPosition() || pack.isRequired() || pack.getId().equals("vanilla");
|
||||
}
|
||||
|
||||
public static boolean shouldNotTouch(PackSelectionModel.Entry pack) {
|
||||
return pack.isFixedPosition() || pack.isRequired() || pack.getId().equals("vanilla");
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -29,14 +29,14 @@ public abstract class MixinPackSelectionModel_EntryBase implements AbstractPackD
|
||||
|
||||
@Override
|
||||
public void draggable_lists$moveTo(int j) {
|
||||
if (DraggableLists.shouldNotTouch(pack)) return;
|
||||
if (pack.isFixedPosition()) return;
|
||||
|
||||
List<Pack> list = getSelfList();
|
||||
list.remove(pack);
|
||||
list.add(j, pack);
|
||||
|
||||
// get all fixed position resource packs, remove them and add them all at the end
|
||||
Stream<Pack> packStream = list.stream().filter(DraggableLists::shouldNotTouch);
|
||||
Stream<Pack> packStream = list.stream().filter(Pack::isFixedPosition);
|
||||
List<Pack> list1 = packStream.toList();
|
||||
list.removeAll(list1);
|
||||
list.addAll(list1);
|
||||
|
||||
+3
-2
@@ -123,7 +123,7 @@ public abstract class MixinTransferableSelectionList extends ObjectSelectionList
|
||||
|
||||
@Override
|
||||
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) {
|
||||
super.render(guiGraphics, mouseX, mouseY, delta);
|
||||
super.renderWidget(guiGraphics, mouseX, mouseY, delta);
|
||||
|
||||
if (this.draggable_lists$draggingObject instanceof ResourcePackEntryDuckProvider duckProvider) {
|
||||
int z = Mth.floor(mouseY + draggable_lists$draggingOffsetY);
|
||||
@@ -188,6 +188,7 @@ public abstract class MixinTransferableSelectionList extends ObjectSelectionList
|
||||
|
||||
@Unique
|
||||
boolean draggable_lists$isValidForDragging(ResourcePackEntryDuckProvider resourcePackEntryDuckProvider) {
|
||||
return !DraggableLists.shouldNotTouch(resourcePackEntryDuckProvider.draggable_lists$getUnderlyingPack()) && resourcePackEntryDuckProvider.draggable_lists$getUnderlyingPack().isSelected();
|
||||
PackSelectionModel.Entry entry = resourcePackEntryDuckProvider.draggable_lists$getUnderlyingPack();
|
||||
return !entry.isFixedPosition() && entry.isSelected();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -173,7 +173,7 @@ public abstract class MixinServerSelectionList extends ObjectSelectionList<Serve
|
||||
|
||||
@Unique
|
||||
int draggable_lists$capYCoordinate(int y, boolean useScreenSpace) {
|
||||
int scrollableTop = y + 4;
|
||||
int scrollableTop = getY() + 4;
|
||||
int scrollableHeight = getBottom() - getY() - (useScreenSpace ? 2 : itemHeight + 2);
|
||||
if (y < scrollableTop) y = scrollableTop;
|
||||
if (y > scrollableTop + scrollableHeight) y = scrollableTop + scrollableHeight;
|
||||
|
||||
+14
-10
@@ -2,17 +2,21 @@ plugins {
|
||||
id "com.github.johnrengelman.shadow" version "7.1.2"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://maven.neoforged.net/releases" }
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
neoForge()
|
||||
forge()
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
||||
|
||||
forge {
|
||||
convertAccessWideners = true
|
||||
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
|
||||
|
||||
mixinConfig "draggable_lists-common.mixins.json"
|
||||
mixinConfig "draggable_lists.mixins.json"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -20,15 +24,15 @@ configurations {
|
||||
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentNeoForge.extendsFrom common
|
||||
developmentForge.extendsFrom common
|
||||
}
|
||||
|
||||
dependencies {
|
||||
neoForge "net.neoforged:neoforge:${rootProject.forge_version}"
|
||||
forge "net.minecraftforge:forge:${rootProject.forge_version}"
|
||||
// Remove the next line if you don't want to depend on the API
|
||||
modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_version}"
|
||||
modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"
|
||||
|
||||
modApi "me.shedaniel.cloth:cloth-config-neoforge:${rootProject.cloth_config_version}"
|
||||
modApi "me.shedaniel.cloth:cloth-config-forge:${rootProject.cloth_config_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }
|
||||
@@ -78,7 +82,7 @@ components.java {
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenNeoForge(MavenPublication) {
|
||||
mavenForge(MavenPublication) {
|
||||
artifactId = rootProject.archives_base_name + "-" + project.name
|
||||
from components.java
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
loom.platform=neoforge
|
||||
loom.platform=forge
|
||||
+1
-1
@@ -15,7 +15,7 @@ architectury_version=11.0.9
|
||||
fabric_loader_version=0.15.3
|
||||
fabric_api_version=0.93.1+1.20.4
|
||||
|
||||
forge_version=20.4.93-beta
|
||||
forge_version=1.20.4-49.0.19
|
||||
|
||||
quilt_loader_version=0.22.0
|
||||
quilt_fabric_api_version=7.4.0+0.90.0-1.20.1
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ pluginManagement {
|
||||
repositories {
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven { url "https://maven.architectury.dev/" }
|
||||
maven { url "https://maven.neoforged.net/releases" }
|
||||
maven { url "https://maven.minecraftforge.net/" }
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user