diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ce44ab35..fcb5324b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,36 +3,36 @@ format = { version = "1.1" } [versions] indra = "3.1.3" -minecraft = "1.20.6" -fabricLoader = "0.15.11" -fabricApi = "0.98.0+1.20.6" -modmenu = "10.0.0-beta.1" +minecraft = "1.21.1" +fabricLoader = "0.16.7" +fabricApi = "0.106.0+1.21.1" +modmenu = "11.0.1" viafabricplus = "3.3.0" vineflower = "1.10.1" [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } -parchment = { module = "org.parchmentmc.data:parchment-1.20.6", version = "2024.05.01" } +parchment = { module = "org.parchmentmc.data:parchment-1.21", version = "2024.07.28" } fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabricLoader" } fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabricApi" } fabric-api-bom = { module = "net.fabricmc.fabric-api:fabric-api-bom", version.ref = "fabricApi" } fabric-api-networking = { module = "net.fabricmc.fabric-api:fabric-networking-api-v1" } modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" } -neoforge = { module = "net.neoforged:neoforge", version = "20.6.119"} +neoforge = { module = "net.neoforged:neoforge", version = "21.1.72"} viafabricplus-api = { module = "de.florianmichael:ViaFabricPlus", version.ref = "viafabricplus" } -viaversion = { module = "com.viaversion:viaversion-common", version = "5.0.0-SNAPSHOT" } +viaversion = { module = "com.viaversion:viaversion-common", version = "5.0.5" } vineflower = { module = "org.vineflower:vineflower", version.ref = "vineflower" } -worldedit = { module = "com.sk89q.worldedit:worldedit-fabric-mc1.20.6", version = "7.3.1" } +worldedit = { module = "com.sk89q.worldedit:worldedit-fabric-mc1.21", version = "7.3.7" } [plugins] -architecturyPlugin = { id = "architectury-plugin", version = "3.4.155" } -curseForgeGradle = { id = "net.darkhax.curseforgegradle", version = "1.1.18" } +architecturyPlugin = { id = "architectury-plugin", version = "3.4.159" } +curseForgeGradle = { id = "net.darkhax.curseforgegradle", version = "1.1.25" } indra-git = { id = "net.kyori.indra.git", version.ref = "indra" } indra-spotlessLicenser = { id = "net.kyori.indra.licenser.spotless", version.ref = "indra" } -javaEcosystemCapabilities = { id = "org.gradlex.java-ecosystem-capabilities", version = "1.5.2" } -loom = { id = "dev.architectury.loom", version = "1.6.397" } +jvmConflictResolution = { id = "org.gradlex.jvm-dependency-conflict-resolution", version = "2.1.2" } +loom = { id = "dev.architectury.loom", version = "1.7.413" } minotaur = { id = "com.modrinth.minotaur", version = "2.8.7" } publishGithubRelease = { id = "ca.stellardrift.publish-github-release", version = "0.1.0" } -shadow = { id = "io.github.goooler.shadow", version = "8.1.7" } +shadow = { id = "com.gradleup.shadow", version = "8.3.3" } spotless = { id = "com.diffplug.spotless", version = "6.25.0" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136..a4b76b95 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4413138..df97d72b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf13..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 7101f8e4..9b42019c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/fabric/FabricModWorldEditCUI.java b/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/fabric/FabricModWorldEditCUI.java index b23e7529..39ef0876 100644 --- a/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/fabric/FabricModWorldEditCUI.java +++ b/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/fabric/FabricModWorldEditCUI.java @@ -28,7 +28,6 @@ import org.enginehub.worldeditcui.config.CUIConfiguration; import org.enginehub.worldeditcui.event.listeners.CUIListenerChannel; import org.enginehub.worldeditcui.event.listeners.CUIListenerWorldRender; -import org.enginehub.worldeditcui.fabric.mixins.MinecraftAccess; import org.enginehub.worldeditcui.protocol.CUIPacket; import org.enginehub.worldeditcui.protocol.CUIPacketHandler; import org.enginehub.worldeditcui.render.OptifinePipelineProvider; @@ -127,7 +126,7 @@ public void onInitialize() { private void onTick(final Minecraft mc) { final CUIConfiguration config = this.controller.getConfiguration(); final boolean inGame = mc.player != null; - final boolean clock = ((MinecraftAccess) mc).getTimer().partialTick > 0; + final boolean clock = mc.getTimer().getGameTimeDeltaPartialTick(false) > 0; if (inGame && mc.screen == null) { while (this.keyBindToggleUI.consumeClick()) { @@ -195,7 +194,7 @@ public void onJoinGame(final ClientPacketListener handler, final PacketSender se public void onPostRenderEntities(final WorldRenderContext ctx) { if (this.visible) { - this.worldRenderListener.onRender(ctx.tickDelta()); + this.worldRenderListener.onRender(ctx.tickCounter().getRealtimeDeltaTicks()); } } diff --git a/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/fabric/mixins/MinecraftAccess.java b/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/fabric/mixins/MinecraftAccess.java deleted file mode 100644 index 8f29df29..00000000 --- a/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/fabric/mixins/MinecraftAccess.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2011-2024 WorldEditCUI team and contributors - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.enginehub.worldeditcui.fabric.mixins; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.Timer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -/** - * @author Mark Vainomaa - */ -@Mixin(value = Minecraft.class) -public interface MinecraftAccess { - @Accessor - Timer getTimer(); -} diff --git a/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/render/BufferBuilderRenderSink.java b/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/render/BufferBuilderRenderSink.java index 225ad3fb..a6c8f91a 100644 --- a/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/render/BufferBuilderRenderSink.java +++ b/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/render/BufferBuilderRenderSink.java @@ -11,6 +11,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.BufferUploader; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.client.renderer.ShaderInstance; @@ -34,8 +35,8 @@ public class BufferBuilderRenderSink implements RenderSink { private boolean active; private boolean canFlush; private float r = -1f, g, b, a; - private double loopX, loopY, loopZ; // track previous vertices for lines_loop - private double loopFirstX, loopFirstY, loopFirstZ; // track initial vertices for lines_loop + private float loopX, loopY, loopZ; // track previous vertices for lines_loop + private float loopFirstX, loopFirstY, loopFirstZ; // track initial vertices for lines_loop private boolean canLoop; // line state @@ -87,9 +88,8 @@ public boolean apply(final LineStyle line, final RenderStyle.RenderType type) { this.flush(); if (this.active && this.activeRenderType != null) { this.canFlush = true; - this.builder = Tesselator.getInstance().getBuilder(); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); - this.builder.begin(this.activeRenderType.mode, this.activeRenderType.format); + this.builder = Tesselator.getInstance().begin(this.activeRenderType.mode, this.activeRenderType.format); } LineWidth.set(this.lastLineWidth = line.lineWidth); RenderSystem.depthFunc(this.lastDepthFunc = line.renderType.depthFunc()); @@ -114,49 +114,45 @@ public RenderSink vertex(final double x, final double y, final double z) { // duplicate last if (this.canLoop) { final Vector3f normal = this.activeRenderType.hasNormals ? this.computeNormal(this.loopX, this.loopY, this.loopZ, x, y, z) : null; - builder.vertex(this.loopX, this.loopY, this.loopZ).color(this.r, this.g, this.b, this.a); + builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a); if (normal != null) { // we need to compute normals pointing directly towards the screen - builder.normal(normal.x(), normal.y(), normal.z()); + builder.setNormal(normal.x(), normal.y(), normal.z()); } - builder.endVertex(); - builder.vertex(x, y, z).color(this.r, this.g, this.b, this.a); + builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a); if (normal != null) { - builder.normal(normal.x(), normal.y(), normal.z()); + builder.setNormal(normal.x(), normal.y(), normal.z()); } - builder.endVertex(); } else { - this.loopFirstX = x; - this.loopFirstY = y; - this.loopFirstZ = z; + this.loopFirstX = (float) x; + this.loopFirstY = (float) y; + this.loopFirstZ = (float) z; } - this.loopX = x; - this.loopY = y; - this.loopZ = z; + this.loopX = (float) x; + this.loopY = (float) y; + this.loopZ = (float) z; this.canLoop = true; } else if (this.activeRenderType == this.lines) { // we buffer vertices so we can compute normals here if (this.canLoop) { final Vector3f normal = this.activeRenderType.hasNormals ? this.computeNormal(this.loopX, this.loopY, this.loopZ, x, y, z) : null; - builder.vertex(this.loopX, this.loopY, this.loopZ).color(this.r, this.g, this.b, this.a); + builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a); if (normal != null) { - builder.normal(normal.x(), normal.y(), normal.z()); + builder.setNormal(normal.x(), normal.y(), normal.z()); } - builder.endVertex(); - builder.vertex(x, y, z).color(this.r, this.g, this.b, this.a); + builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a); if (normal != null) { - builder.normal(normal.x(), normal.y(), normal.z()); + builder.setNormal(normal.x(), normal.y(), normal.z()); } - builder.endVertex(); this.canLoop = false; } else { - this.loopX = x; - this.loopY = y; - this.loopZ = z; + this.loopX = (float) x; + this.loopY = (float) y; + this.loopZ = (float) z; this.canLoop = true; } } else { - builder.vertex(x, y, z).color(this.r, this.g, this.b, this.a).endVertex(); + builder.addVertex((float) x, (float) y, (float) z).setColor(this.r, this.g, this.b, this.a); } return this; } @@ -184,17 +180,15 @@ public RenderSink endLineLoop() { if (this.canLoop) { this.canLoop = false; final Vector3f normal = this.activeRenderType.hasNormals ? this.computeNormal(this.loopX, this.loopY, this.loopZ, this.loopFirstX, this.loopFirstY, this.loopFirstZ) : null; - this.builder.vertex(this.loopX, this.loopY, this.loopZ).color(this.r, this.g, this.b, this.a); + this.builder.addVertex(this.loopX, this.loopY, this.loopZ).setColor(this.r, this.g, this.b, this.a); if (normal != null) { - this.builder.normal(normal.x(), normal.y(), normal.z()); + this.builder.setNormal(normal.x(), normal.y(), normal.z()); } - this.builder.endVertex(); - this.builder.vertex(this.loopFirstX, this.loopFirstY, this.loopFirstZ).color(this.r, this.g, this.b, this.a); + this.builder.addVertex(this.loopFirstX, this.loopFirstY, this.loopFirstZ).setColor(this.r, this.g, this.b, this.a); if (normal != null) { - this.builder.normal(normal.x(), normal.y(), normal.z()); + this.builder.setNormal(normal.x(), normal.y(), normal.z()); } - this.builder.endVertex(); } return this; } @@ -237,7 +231,7 @@ public void flush() { if (this.activeRenderType != null) { RenderSystem.setShader(this.activeRenderType.shader); } - Tesselator.getInstance().end(); + BufferUploader.drawWithShader(this.builder.buildOrThrow()); } finally { this.postFlush.run(); this.builder = null; @@ -265,8 +259,7 @@ private void transitionState(final RenderType renderType) { if (this.activeRenderType == null || this.activeRenderType.mode != renderType.mode) { this.canFlush = true; RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); - this.builder = Tesselator.getInstance().getBuilder(); - this.builder.begin(renderType.mode, renderType.format); + this.builder = Tesselator.getInstance().begin(renderType.mode, renderType.format); } this.activeRenderType = renderType; this.active = true; diff --git a/worldeditcui-fabric/src/main/resources/fabric.mod.json b/worldeditcui-fabric/src/main/resources/fabric.mod.json index 5b98754c..d2ee7c33 100644 --- a/worldeditcui-fabric/src/main/resources/fabric.mod.json +++ b/worldeditcui-fabric/src/main/resources/fabric.mod.json @@ -33,9 +33,6 @@ "org.enginehub.worldeditcui.fabric.ConfigPanelFactory" ] }, - "mixins": [ - "worldeditcui.mixins.json" - ], "depends": { "worldeditcui_protocol": "*", "fabric-api-base": "*", diff --git a/worldeditcui-fabric/src/main/resources/worldeditcui.mixins.json b/worldeditcui-fabric/src/main/resources/worldeditcui.mixins.json deleted file mode 100644 index f599f446..00000000 --- a/worldeditcui-fabric/src/main/resources/worldeditcui.mixins.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "required": true, - "package": "org.enginehub.worldeditcui.fabric.mixins", - "minVersion": "0.8", - "compatibilityLevel": "JAVA_17", - "client": [ - "MinecraftAccess" - ], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/worldeditcui-protocol-common/src/main/java/org/enginehub/worldeditcui/protocol/CUIPacket.java b/worldeditcui-protocol-common/src/main/java/org/enginehub/worldeditcui/protocol/CUIPacket.java index 9ff9b48a..4030e211 100644 --- a/worldeditcui-protocol-common/src/main/java/org/enginehub/worldeditcui/protocol/CUIPacket.java +++ b/worldeditcui-protocol-common/src/main/java/org/enginehub/worldeditcui/protocol/CUIPacket.java @@ -30,7 +30,7 @@ public record CUIPacket(boolean multi, String eventType, List args) implements CustomPacketPayload { private static final String PROTOCOL_VERSION = "4"; private static final Logger LOGGER = LogUtils.getLogger(); - public static final CustomPacketPayload.Type TYPE = new Type<>(new ResourceLocation("worldedit", "cui")); + public static final CustomPacketPayload.Type TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("worldedit", "cui")); public static final StreamCodec CODEC = CustomPacketPayload.codec(CUIPacket::encode, CUIPacket::decode); public CUIPacket {