Skip to content

Commit

Permalink
1.20.6 (#109)
Browse files Browse the repository at this point in the history
* 24w04a

* 24w11a

* chore(build): Use version catalog for Via, remove old multiconnect dep

* chore(build): correct version

* add discord link to modmenu screen

* 24w12a

* chore(build): Target J21

* 24w14a, resolve some warnings

* 1.20.5-rc1

* chore(build): bump GH actions versions

* chore(build): bump loom to latest

* 1.20.5

* Update to 1.20.6 (#110)

* fix: support viaversion 5.0

* chore(build): gradle 8.8, jvm criteria

---------

Co-authored-by: aurora <[email protected]>
  • Loading branch information
zml2008 and aurorasmiles authored Oct 20, 2024
1 parent d16793f commit 2e533c5
Show file tree
Hide file tree
Showing 39 changed files with 295 additions and 217 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true

env:
RUNTIME_VERSION: 17
RUNTIME_VERSION: 21

jobs:
build:
Expand All @@ -20,23 +20,24 @@ jobs:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ env.RUNTIME_VERSION }}
uses: actions/setup-java@v3
- name: setup / checkout repository
uses: actions/checkout@v4
- name: setup / validate gradle wrapper
uses: gradle/actions/wrapper-validation@v3
- name: setup / jdk ${{ env.RUNTIME_VERSION }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.RUNTIME_VERSION }}
- name: run gradle build
uses: gradle/gradle-build-action@v2
- name: setup / gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: ${{ !(startsWith(github.ref, 'refs/heads/mc/') || github.ref == 'refs/heads/master') || github.event_name == 'pull_request' }}
arguments: build
- name: run gradle build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
10 changes: 4 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {
}

group = "org.enginehub.worldeditcui"
version = "${libs.versions.minecraft.get()}+02-SNAPSHOT"
version = "${libs.versions.minecraft.get()}+01-SNAPSHOT"

repositories {
// mirrors:
Expand All @@ -35,7 +35,7 @@ repositories {
}
}

val targetVersion = 17
val targetVersion = 21
java {
sourceCompatibility = JavaVersion.toVersion(targetVersion)
targetCompatibility = sourceCompatibility
Expand Down Expand Up @@ -93,12 +93,10 @@ dependencies {
vineflowerDecompilerClasspath(libs.vineflower)
modImplementation(libs.fabric.loader)
modImplementation(libs.modmenu)
modImplementation(libs.multiconnect.api) {
isTransitive = false
}
modCompileOnly(libs.viafabricplus.api) {
isTransitive = false
}
modCompileOnly(libs.viaversion)

// [1] declare fabric-api dependency...
fabricApi(libs.fabric.api)
Expand Down Expand Up @@ -298,7 +296,7 @@ tasks {
// Rendering plugins
addOptional("canvas-renderer", "sodium", "irisshaders")
// Config screens, version compatibility
addOptional("modmenu", "multiconnect", "viafabricplus", "worldedit")
addOptional("modmenu", "viafabricplus", "worldedit")
addJavaVersion("Java $targetVersion")
addGameVersion(libs.versions.minecraft.get())
}
Expand Down
2 changes: 2 additions & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#This file is generated by updateDaemonJvm
toolchainVersion=21
29 changes: 14 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@ format = { version = "1.1" }

[versions]
indra = "3.1.3"
minecraft = "1.20.3"
fabricLoader = "0.15.0"
fabricApi = "0.91.1+1.20.3"
modmenu = "9.0.0-pre.1"
multiconnect = "1.5.10"
viafabricplus = "2.9.0"
vineflower = "1.9.3"
minecraft = "1.20.6"
fabricLoader = "0.15.11"
fabricApi = "0.98.0+1.20.6"
modmenu = "10.0.0-beta.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.2", version = "2023.10.22" }
parchment = { module = "org.parchmentmc.data:parchment-1.20.6", version = "2024.05.01" }
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabricLoader" }
fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabricApi" }
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" }
multiconnect-api = { module = "net.earthcomputer.multiconnect:multiconnect-api", version.ref = "multiconnect" }
viafabricplus-api = { module = "de.florianmichael:viafabricplus", version.ref = "viafabricplus" }
viafabricplus-api = { module = "de.florianmichael:ViaFabricPlus", version.ref = "viafabricplus" }
viaversion = { module = "com.viaversion:viaversion-common", version = "5.0.0-SNAPSHOT" }
vineflower = { module = "org.vineflower:vineflower", version.ref = "vineflower" }
worldedit = { module = "com.sk89q.worldedit:worldedit-fabric-mc1.20.2", version = "7.2.17" }
worldedit = { module = "com.sk89q.worldedit:worldedit-fabric-mc1.20.6", version = "7.3.1" }

[plugins]
curseForgeGradle = { id = "net.darkhax.curseforgegradle", version = "1.1.17" }
curseForgeGradle = { id = "net.darkhax.curseforgegradle", version = "1.1.18" }
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.3.1" }
loom = { id = "fabric-loom", version = "1.4.4" }
javaEcosystemCapabilities = { id = "org.gradlex.java-ecosystem-capabilities", version = "1.5.2" }
loom = { id = "fabric-loom", version = "1.6.11" }
minotaur = { id = "com.modrinth.minotaur", version = "2.8.7" }
publishGithubRelease = { id = "ca.stellardrift.publish-github-release", version = "0.1.0" }
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }
versions = { id = "com.github.ben-manes.versions", version = "0.50.0" }
versions = { id = "com.github.ben-manes.versions", version = "0.51.0" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
16 changes: 9 additions & 7 deletions src/main/java/org/enginehub/worldeditcui/event/CUIEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.google.common.base.Joiner;
import org.enginehub.worldeditcui.WorldEditCUI;

import java.util.List;

/**
* Base event for CUI events, handles parameter validation and running the logic
*
Expand All @@ -21,7 +23,7 @@
public abstract class CUIEvent
{
protected final WorldEditCUI controller;
protected final String[] params;
protected final List<String> params;
protected final boolean multi;

public CUIEvent(CUIEventArgs args)
Expand Down Expand Up @@ -51,14 +53,14 @@ public boolean isValid()

if (max == min)
{
if (this.params.length != max)
if (this.params.size() != max)
{
return false;
}
}
else
{
if (this.params.length > max || this.params.length < min)
if (this.params.size() > max || this.params.size() < min)
{
return false;
}
Expand All @@ -77,7 +79,7 @@ public void prepare()

if (!this.isValid())
{
String message = String.format("Invalid number of parameters. %s event requires %s parameters but received %s [%s]", this.getEventName(), this.getRequiredParameterString(), this.params.length, Joiner.on(", ").join(this.params));
String message = String.format("Invalid number of parameters. %s event requires %s parameters but received %s [%s]", this.getEventName(), this.getRequiredParameterString(), this.params.size(), Joiner.on(", ").join(this.params));
throw new IllegalArgumentException(message);
}
}
Expand All @@ -94,16 +96,16 @@ private String getRequiredParameterString()

public int getInt(int index)
{
return (int)Float.parseFloat(this.params[index]);
return (int)Float.parseFloat(this.params.get(index));
}

public double getDouble(int index)
{
return Double.parseDouble(this.params[index]);
return Double.parseDouble(this.params.get(index));
}

public String getString(int index)
{
return this.params[index];
return this.params.get(index);
}
}
18 changes: 10 additions & 8 deletions src/main/java/org/enginehub/worldeditcui/event/CUIEventArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import com.google.common.base.Joiner;
import org.enginehub.worldeditcui.WorldEditCUI;

import java.util.List;

/**
* CUI communication event
* Called when a CUI event is sent from the server.
Expand All @@ -22,20 +24,20 @@
*/
public final class CUIEventArgs
{
private WorldEditCUI controller;
private boolean multi;
private String type;
private String[] params;
private final WorldEditCUI controller;
private final boolean multi;
private final String type;
private final List<String> params;

public CUIEventArgs(WorldEditCUI controller, boolean multi, String type, String[] params)
public CUIEventArgs(WorldEditCUI controller, boolean multi, String type, List<String> params)
{
this.controller = controller;
this.multi = multi;
this.type = type;

if (params.length == 1 && params[0].length() == 0)
if (params.size() == 1 && params.get(0).isEmpty())
{
params = new String[] {};
params = List.of();
}

this.params = params;
Expand All @@ -47,7 +49,7 @@ public WorldEditCUI getController()
return this.controller;
}

public String[] getParams()
public List<String> getParams()
{
return this.params;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public String raise()
{
str = "#" + str;
}
styles[i] = new CustomStyle(Colour.parseRgbaOr(str, defaultStyles[i].getColour()));
styles[i] = CustomStyle.customStyle(Colour.parseRgbaOr(str, defaultStyles[i].getColour()));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public String raise()
selection.setGridSpacing(this.getDouble(0));

RenderType renderType = RenderType.ANY;
if (this.params.length > 1 && "cull".equalsIgnoreCase(this.getString(1)))
if (this.params.size() > 1 && "cull".equalsIgnoreCase(this.getString(1)))
{
renderType = RenderType.VISIBLE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ai.attributes.Attributes;
import org.enginehub.worldeditcui.event.CUIEvent;
import org.enginehub.worldeditcui.event.CUIEventArgs;
import org.enginehub.worldeditcui.event.CUIEventType;
Expand Down Expand Up @@ -52,7 +53,7 @@ public String raise()
{
Minecraft mc = Minecraft.getInstance();
Entity entity = mc.getCameraEntity();
double hitDistance = mc.gameMode.getPickRange();
double hitDistance = mc.player.getAttributeValue(Attributes.BLOCK_INTERACTION_RANGE);

selection.setCuboidVertexLatch(id, entity, Math.min(Math.max(this.getDouble(4), hitDistance), 256.0));
this.controller.getDebugger().debug("Setting vertex latch #" + id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public String raise()
return null;
}

final int[] vertexIds = new int[this.params.length];
for (int i = 0; i < this.params.length; ++i)
final int[] vertexIds = new int[this.params.size()];
for (int i = 0; i < this.params.size(); ++i)
{
vertexIds[i] = this.getInt(i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public String raise()
UUID id = null;
if (this.multi)
{
if (selection == null && this.params.length < 2)
if (selection == null && this.params.size() < 2)
{
this.controller.getDebugger().debug("Received clear selection event.");
this.controller.clearRegions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import org.enginehub.worldeditcui.WorldEditCUI;
import org.enginehub.worldeditcui.event.CUIEventArgs;
import org.enginehub.worldeditcui.network.CUIEventPayload;

/**
* Listener class for incoming plugin channel messages
Expand All @@ -28,18 +29,13 @@ public CUIListenerChannel(WorldEditCUI controller)
this.controller = controller;
}

public void onMessage(String message)
public void onMessage(final CUIEventPayload message)
{
String[] split = message.split("\\|", -1);
boolean multi = split[0].startsWith("+");
String type = split[0].substring(multi ? 1 : 0);
String args = message.substring(type.length() + (multi ? 2 : 1));

this.controller.getDebugger().debug("Received CUI event from server: " + message);

try
{
CUIEventArgs eventArgs = new CUIEventArgs(this.controller, multi, type, args.split("\\|", -1));
CUIEventArgs eventArgs = new CUIEventArgs(this.controller, message.multi(), message.eventType(), message.args());
this.controller.getDispatcher().raiseEvent(eventArgs);
}
catch (Exception ex)
Expand Down
Loading

0 comments on commit 2e533c5

Please sign in to comment.