Skip to content

Commit ebbc0bf

Browse files
authored
Minecraft 26.1 support (#120)
1 parent 746d21f commit ebbc0bf

8 files changed

Lines changed: 29 additions & 27 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
- name: Set up JDK
1818
uses: actions/setup-java@v4.7.0
1919
with:
20-
distribution: adopt
21-
java-version: 17
20+
distribution: temurin
21+
java-version: 25
2222
- name: Build LimboFilter
2323
run: ./gradlew build
2424
- name: Upload LimboFilter

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
- name: Set up JDK
1414
uses: actions/setup-java@v4.7.0
1515
with:
16-
distribution: adopt
17-
java-version: 17
16+
distribution: temurin
17+
java-version: 25
1818
- name: Build LimboFilter
1919
run: ./gradlew build
2020
- name: Upload LimboFilter

build.gradle

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
plugins {
44
id("java")
55
id("checkstyle")
6-
id("com.github.spotbugs").version("6.1.7")
7-
id("org.cadixdev.licenser").version("0.6.1")
8-
id("com.gradleup.shadow").version("8.3.6")
6+
id("com.github.spotbugs").version("6.4.8")
7+
id("net.minecraftforge.licenser").version("1.2.0")
8+
id("com.gradleup.shadow").version("9.4.0")
99
}
1010

1111
setGroup("net.elytrium")
@@ -16,8 +16,8 @@ compileJava {
1616
}
1717

1818
java {
19-
setSourceCompatibility(JavaVersion.VERSION_17)
20-
setTargetCompatibility(JavaVersion.VERSION_17)
19+
setSourceCompatibility(JavaVersion.VERSION_21)
20+
setTargetCompatibility(JavaVersion.VERSION_21)
2121
}
2222

2323
repositories {
@@ -66,7 +66,6 @@ license {
6666
}
6767

6868
checkstyle {
69-
setToolVersion("10.1")
7069
setConfigFile(file("${this.getRootDir()}/config/checkstyle/checkstyle.xml"))
7170
setConfigProperties("configDirectory": "${this.getRootDir()}/config/checkstyle")
7271

@@ -103,16 +102,7 @@ sourceSets.main.getJava().srcDir(
103102
assemble.dependsOn(shadowJar)
104103

105104
String getCurrentShortRevision() {
106-
OutputStream outputStream = new ByteArrayOutputStream()
107-
exec {
108-
if (System.getProperty("os.name").toLowerCase().contains("win")) {
109-
commandLine("cmd", "/c", "git rev-parse --short HEAD")
110-
} else {
111-
commandLine("bash", "-c", "git rev-parse --short HEAD")
112-
}
113-
114-
setStandardOutput(outputStream)
115-
}
116-
117-
return outputStream.toString().trim()
105+
return System.getProperty("os.name").toLowerCase().contains("win")
106+
? ["cmd", "/c", "git rev-parse --short HEAD"].execute().text.trim()
107+
: ["bash", "-c", "git rev-parse --short HEAD"].execute().text.trim()
118108
}

config/spotbugs/suppressions.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@
77
<Match>
88
<Bug pattern="EI_EXPOSE_REP2"/>
99
</Match>
10+
<Match>
11+
<Bug pattern="AT_STALE_THREAD_WRITE_OF_PRIMITIVE"/>
12+
</Match>
1013
</FindBugsFilter>

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
limboapiVersion=1.1.27
2-
velocityVersion=3.4.0-SNAPSHOT
2+
velocityVersion=3.5.0-SNAPSHOT
33
nettyVersion=4.1.86.Final
44
fastutilVersion=8.5.11
55
log4jVersion=2.19.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/net/elytrium/limbofilter/LimboFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.velocitypowered.api.proxy.ProxyServer;
3131
import com.velocitypowered.api.scheduler.ScheduledTask;
3232
import com.velocitypowered.proxy.console.VelocityConsole;
33-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3433
import java.io.File;
3534
import java.io.FileNotFoundException;
3635
import java.io.IOError;
@@ -164,7 +163,6 @@ public void onProxyInitialization(ProxyInitializeEvent event) {
164163
Configurator.setLevel(consoleLogger.getName(), consoleLogger.getLevel());
165164
}
166165

167-
@SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH", justification = "LEGACY_AMPERSAND can't be null in velocity.")
168166
public void reload() {
169167
Settings.IMP.reload(this.configFile, Settings.IMP.PREFIX);
170168

@@ -299,6 +297,7 @@ public void reload() {
299297
new PacketMapping(0x16, ProtocolVersion.MINECRAFT_1_20_5, false),
300298
new PacketMapping(0x18, ProtocolVersion.MINECRAFT_1_21_2, false),
301299
new PacketMapping(0x19, ProtocolVersion.MINECRAFT_1_21_6, false),
300+
new PacketMapping(0x1A, ProtocolVersion.MINECRAFT_26_1, false),
302301
})
303302
.registerPacket(PacketDirection.CLIENTBOUND, SetEntityMetadata.class, null, new PacketMapping[]{
304303
new PacketMapping(0x1C, ProtocolVersion.MINIMUM_VERSION, true),
@@ -318,6 +317,7 @@ public void reload() {
318317
new PacketMapping(0x5D, ProtocolVersion.MINECRAFT_1_21_2, true),
319318
new PacketMapping(0x5C, ProtocolVersion.MINECRAFT_1_21_5, true),
320319
new PacketMapping(0x61, ProtocolVersion.MINECRAFT_1_21_9, true),
320+
new PacketMapping(0x63, ProtocolVersion.MINECRAFT_26_1, true),
321321
})
322322
.registerPacket(PacketDirection.CLIENTBOUND, SpawnEntity.class, null, new PacketMapping[]{
323323
new PacketMapping(0x0E, ProtocolVersion.MINIMUM_VERSION, true),

src/main/java/net/elytrium/limbofilter/protocol/packets/Interact.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.velocitypowered.proxy.protocol.MinecraftPacket;
2323
import com.velocitypowered.proxy.protocol.ProtocolUtils;
2424
import io.netty.buffer.ByteBuf;
25+
import net.elytrium.limbofilter.protocol.data.PackedVector;
2526

2627
public class Interact implements MinecraftPacket {
2728

@@ -35,7 +36,15 @@ public class Interact implements MinecraftPacket {
3536

3637
@Override
3738
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion protocolVersion) {
38-
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_7_6) > 0) {
39+
if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_26_1) >= 0) {
40+
this.entityId = ProtocolUtils.readVarInt(buf);
41+
this.hand = ProtocolUtils.readVarInt(buf);
42+
PackedVector target = PackedVector.read(buf);
43+
this.targetX = (float) target.x();
44+
this.targetY = (float) target.y();
45+
this.targetZ = (float) target.z();
46+
this.sneaking = buf.readBoolean();
47+
} else if (protocolVersion.compareTo(ProtocolVersion.MINECRAFT_1_7_6) > 0) {
3948
this.entityId = ProtocolUtils.readVarInt(buf);
4049
this.type = ProtocolUtils.readVarInt(buf);
4150
if (this.type == 2) {

0 commit comments

Comments
 (0)