Skip to content

Commit

Permalink
Merge branch '1.20.6' into 1.21
Browse files Browse the repository at this point in the history
# Conflicts:
#	settings.gradle.kts
  • Loading branch information
rfresh2 committed Oct 15, 2024
2 parents 99ae389 + a88d61f commit 5dde07b
Show file tree
Hide file tree
Showing 24 changed files with 237 additions and 154 deletions.
135 changes: 29 additions & 106 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,133 +1,56 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.api.LoomGradleExtensionAPI

plugins {
id("architectury-plugin") version "3.4-SNAPSHOT"
id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false
id("com.gradleup.shadow") version "8.3.2" apply false
id("xaeroplus-all.conventions")
idea
}

val minecraft_version: String by gradle.extra
val mc = libs.minecraft.get()
val parchment = libs.parchment.get()

architectury {
minecraft = minecraft_version
}

subprojects {
apply(plugin = "dev.architectury.loom")
apply(plugin = "com.gradleup.shadow")

configure<LoomGradleExtensionAPI> {
silentMojangMappingsLicense()
runs {
getByName("client") {
programArgs("--username", "rfresh2")
}
}
}

dependencies {
"minecraft"(mc)
"mappings"((project.extensions.getByType(LoomGradleExtensionAPI::class)).layered {
officialMojangMappings()
parchment(parchment)
})
}

tasks {
getByName<ShadowJar>("shadowJar") {
archiveClassifier.set("shadow")
exclude("com/google/**")
exclude("org/objectweb/**")
exclude("org/checkerframework/**")
exclude("org/rfresh/sqlite/native/FreeBSD/**")
exclude("org/rfresh/sqlite/native/Linux-Android/**")
exclude("org/rfresh/sqlite/native/Linux-Musl/**")
exclude("org/rfresh/sqlite/native/Linux/arm/**")
exclude("org/rfresh/sqlite/native/Linux/aarch64/**")
exclude("org/rfresh/sqlite/native/Linux/armv6/**")
exclude("org/rfresh/sqlite/native/Linux/x86/**")
exclude("org/rfresh/sqlite/native/Linux/armv7/**")
exclude("org/rfresh/sqlite/native/Linux/ppc64/**")
exclude("org/rfresh/sqlite/native/Linux/riscv64/**")
exclude("org/rfresh/sqlite/native/Windows/armv7/**")
exclude("org/rfresh/sqlite/native/Windows/aarch64/**")
exclude("org/rfresh/sqlite/native/Windows/armv7/**")
exclude("org/slf4j/**")
}
}
}

allprojects {
apply(plugin = "java")
apply(plugin = "architectury-plugin")
apply(plugin = "maven-publish")

configure<BasePluginExtension> {
archivesName = gradle.extra.get("archives_base_name").toString()
}

version = gradle.extra.get("mod_version").toString()
group = gradle.extra.get("maven_group").toString()

repositories {
maven("https://maven.neoforged.net/releases/") {
name = "NeoForge"
}
maven("https://api.modrinth.com/maven") {
name = "Modrinth"
}
maven("https://maven.2b2t.vc/releases") {
name = "maven.2b2t.vc"
}
maven("https://maven.parchmentmc.org") {
name = "ParchmentMC"
}
maven("https://maven.lenni0451.net/releases") {
name = "Lenni0451"
}
maven("https://maven.shedaniel.me/")
maven("https://maven.terraformersmc.com/releases/")
mavenLocal()
}

tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release = 21
}
}

configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
}

tasks {
register("printWorldMapVersionFabric") {
println(gradle.extra.get("worldmap_version_fabric"))
doLast {
println(gradle.extra.get("worldmap_version_fabric"))
}
outputs.upToDateWhen { false }
}
register("printMinimapVersionFabric") {
println(gradle.extra.get("minimap_version_fabric"))
doLast {
println(gradle.extra.get("minimap_version_fabric"))
}
outputs.upToDateWhen { false }
}
register("printWorldMapVersionForge") {
println(gradle.extra.get("worldmap_version_forge"))
doLast {
println(gradle.extra.get("worldmap_version_forge"))
}
outputs.upToDateWhen { false }
}
register("printMinimapVersionForge") {
println(gradle.extra.get("minimap_version_forge"))
doLast {
println(gradle.extra.get("minimap_version_forge"))
}
outputs.upToDateWhen { false }
}
register("printWorldMapVersionNeo") {
println(gradle.extra.get("worldmap_version_neo"))
doLast {
println(gradle.extra.get("worldmap_version_neo"))
}
outputs.upToDateWhen { false }
}
register("printMinimapVersionNeo") {
println(gradle.extra.get("minimap_version_neo"))
doLast {
println(gradle.extra.get("minimap_version_neo"))
}
outputs.upToDateWhen { false }
}
register("printXaeroPlusVersion") {
println(version)
doLast {
println(version)
}
outputs.upToDateWhen { false }
}
}

Expand Down
18 changes: 18 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
`kotlin-dsl`
}

repositories {
maven("https://maven.fabricmc.net/") { name = "Fabric" }
maven("https://maven.architectury.dev/")
maven("https://files.minecraftforge.net/maven/")
mavenCentral()
gradlePluginPortal()
}

dependencies {
implementation("architectury-plugin:architectury-plugin.gradle.plugin:3.4-SNAPSHOT")
implementation("dev.architectury:architectury-loom:1.7-SNAPSHOT")
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.3")
}

45 changes: 45 additions & 0 deletions buildSrc/src/main/kotlin/xaeroplus-all.conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugins {
java
id("maven-publish")
id("architectury-plugin")
}

configure<BasePluginExtension> {
archivesName = "XaeroPlus"
}

version = gradle.extra.get("mod_version").toString()
group = "xaeroplus"

repositories {
maven("https://maven.neoforged.net/releases/") {
name = "NeoForge"
}
maven("https://api.modrinth.com/maven") {
name = "Modrinth"
}
maven("https://maven.2b2t.vc/releases") {
name = "maven.2b2t.vc"
}
maven("https://maven.parchmentmc.org") {
name = "ParchmentMC"
}
maven("https://maven.lenni0451.net/releases") {
name = "Lenni0451"
}
maven("https://maven.shedaniel.me/")
maven("https://maven.terraformersmc.com/releases/")
mavenLocal()
}

tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release = 21
}
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
49 changes: 49 additions & 0 deletions buildSrc/src/main/kotlin/xaeroplus-platform.conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
plugins {
id("dev.architectury.loom")
id("com.gradleup.shadow")
}

loom {
silentMojangMappingsLicense()
runs {
getByName("client") {
programArgs("--username", "rfresh2")
}
}
}

val minecraft_version: String by gradle.extra
val parchment_version: String by gradle.extra
val mc = "com.mojang:minecraft:${minecraft_version}"
val parchment = "org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}"

dependencies {
minecraft(mc)
mappings(loom.layered {
officialMojangMappings()
parchment(parchment)
})
}

tasks {
shadowJar {
archiveClassifier.set("shadow")
exclude("com/google/**")
exclude("org/objectweb/**")
exclude("org/checkerframework/**")
exclude("org/rfresh/sqlite/native/FreeBSD/**")
exclude("org/rfresh/sqlite/native/Linux-Android/**")
exclude("org/rfresh/sqlite/native/Linux-Musl/**")
exclude("org/rfresh/sqlite/native/Linux/arm/**")
exclude("org/rfresh/sqlite/native/Linux/aarch64/**")
exclude("org/rfresh/sqlite/native/Linux/armv6/**")
exclude("org/rfresh/sqlite/native/Linux/x86/**")
exclude("org/rfresh/sqlite/native/Linux/armv7/**")
exclude("org/rfresh/sqlite/native/Linux/ppc64/**")
exclude("org/rfresh/sqlite/native/Linux/riscv64/**")
exclude("org/rfresh/sqlite/native/Windows/armv7/**")
exclude("org/rfresh/sqlite/native/Windows/aarch64/**")
exclude("org/rfresh/sqlite/native/Windows/armv7/**")
exclude("org/slf4j/**")
}
}
16 changes: 11 additions & 5 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import kotlin.streams.asStream

plugins {
id("xaeroplus-all.conventions")
id("xaeroplus-platform.conventions")
}

architectury {
common(rootProject.properties["enabled_platforms"].toString().split(","))
}
Expand All @@ -22,14 +29,14 @@ dependencies {
}

tasks {
val remapForgeTask = register("remapForge") {
register("remapForge") {
group = "build"
description = "Remap the source files, replacing fabric-specific strings with forge-specific strings."
val remapDir = project.layout.buildDirectory.dir("remappedSources/forge").get().asFile
doLast {
val remapDir = file("build/remappedSources/forge")
// clear directory if it exists
if (remapDir.exists()) {
remapDir.delete()
remapDir.deleteRecursively()
}
remapDir.mkdirs()
// create sourceset directory structure
Expand Down Expand Up @@ -62,7 +69,7 @@ tasks {
}

// exec remap on every source file
remapDir.walk().forEach { file ->
remapDir.walk().asStream().parallel().forEach { file ->
if (file.isFile && (file.extension == "java" || file.extension == "json")) {
var text = file.readText()
remap.forEach { (fabric, forge) ->
Expand All @@ -73,6 +80,5 @@ tasks {
}
}
}
compileJava.get().dependsOn(remapForgeTask)
}

29 changes: 16 additions & 13 deletions common/src/main/java/xaeroplus/mixin/client/MixinGuiMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import java.util.List;
import java.util.stream.Collectors;

import static java.util.Arrays.asList;
import static java.util.Objects.isNull;
import static net.minecraft.world.level.Level.*;
import static org.lwjgl.glfw.GLFW.*;
Expand Down Expand Up @@ -96,6 +95,7 @@ public abstract class MixinGuiMap extends ScreenBase implements IRightClickableE
@Shadow private Button keybindingsButton;
@Shadow private Button dimensionToggleButton;
@Shadow private int rightClickX;
@Shadow private int rightClickY;
@Shadow private int rightClickZ;
@Shadow private int mouseBlockPosX;
@Shadow private int mouseBlockPosZ;
Expand Down Expand Up @@ -532,38 +532,41 @@ public void onInputPress(final int code, final int scanCode, final int modifiers

@Inject(method = "getRightClickOptions", at = @At(value = "RETURN"), remap = false)
public void getRightClickOptionsInject(final CallbackInfoReturnable<ArrayList<RightClickOption>> cir) {
final ArrayList<RightClickOption> options = cir.getReturnValue();
int index = 3;
options.add(index++, new RightClickOption("xaeroplus.gui.world_map.copy_coordinates", options.size(), this) {
@Override
public void onAction(final Screen screen) {
Minecraft.getInstance().keyboardHandler.setClipboard(rightClickX + " " + rightClickY + " " + rightClickZ);
}
});
if (BaritoneHelper.isBaritonePresent()) {
final ArrayList<RightClickOption> options = cir.getReturnValue();
int goalX = rightClickX;
int goalZ = rightClickZ;
options.addAll(3, asList(
new RightClickOption("xaeroplus.gui.world_map.baritone_goal_here", options.size(), this) {
options.add(index++, new RightClickOption("xaeroplus.gui.world_map.baritone_goal_here", options.size(), this) {
@Override
public void onAction(Screen screen) {
BaritoneExecutor.goal(goalX, goalZ);
}
}.setNameFormatArgs(Misc.getKeyName(Settings.REGISTRY.worldMapBaritoneGoalHereKeybindSetting.getKeyBinding())),
new RightClickOption("xaeroplus.gui.world_map.baritone_path_here", options.size(), this) {
}.setNameFormatArgs(Misc.getKeyName(Settings.REGISTRY.worldMapBaritoneGoalHereKeybindSetting.getKeyBinding())));
options.add(index++, new RightClickOption("xaeroplus.gui.world_map.baritone_path_here", options.size(), this) {
@Override
public void onAction(Screen screen) {
BaritoneExecutor.path(goalX, goalZ);
}
}.setNameFormatArgs(Misc.getKeyName(Settings.REGISTRY.worldMapBaritonePathHereKeybindSetting.getKeyBinding()))
));
}.setNameFormatArgs(Misc.getKeyName(Settings.REGISTRY.worldMapBaritonePathHereKeybindSetting.getKeyBinding())));
if (BaritoneHelper.isBaritoneElytraPresent()) {
options.addAll(5, asList(
new RightClickOption("xaeroplus.gui.world_map.baritone_elytra_here", options.size(), this) {
options.add(index++, new RightClickOption("xaeroplus.gui.world_map.baritone_elytra_here", options.size(), this) {
@Override
public void onAction(Screen screen) {
BaritoneExecutor.elytra(goalX, goalZ);
}
}.setNameFormatArgs(Misc.getKeyName(Settings.REGISTRY.worldMapBaritoneElytraHereKeybindSetting.getKeyBinding()))
));
}.setNameFormatArgs(Misc.getKeyName(Settings.REGISTRY.worldMapBaritoneElytraHereKeybindSetting.getKeyBinding())));
}
}

if (Settings.REGISTRY.disableWaypointSharing.get()) {
cir.getReturnValue().removeIf(option -> ((AccessorRightClickOption) option).getName().equals("gui.xaero_right_click_map_share_location"));
options.removeIf(option -> ((AccessorRightClickOption) option).getName().equals("gui.xaero_right_click_map_share_location"));
}
}

Expand Down
Loading

0 comments on commit 5dde07b

Please sign in to comment.