Skip to content

Commit afc5fed

Browse files
Merge pull request #69 from PimvanderLoos/feat/mc26.1
Add support for MC 26.1
2 parents ddf9c51 + 8e6fcac commit afc5fed

22 files changed

Lines changed: 1098 additions & 193 deletions

.github/nms-groups.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ java21:
4141
- "1.21.8" # 1_21_R5
4242
- "1.21.10" # 1_21_R6
4343
- "1.21.11" # 1_21_R7
44+
45+
java25:
46+
- "26.1.1" # 26_1_R1

.github/workflows/build-nms.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
GROUPS_FILE: ${{ inputs.groups-file }}
4848
run: |
4949
import json, yaml, os
50-
versions = {"java8": 8, "java16": 16, "java17": 17, "java21": 21}
50+
versions = {"java8": 8, "java16": 16, "java17": 17, "java21": 21, "java25": 25}
5151
with open(os.environ["GROUPS_FILE"], encoding="utf-8") as fh:
5252
groups = yaml.safe_load(fh) or {}
5353
include = []

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3434

35-
- name: Set up JDK 21
35+
- name: Set up JDK 25
3636
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
3737
with:
3838
distribution: temurin
39-
java-version: 21
39+
java-version: 25
4040
cache: maven
4141

4242
- name: Restore NMS Maven cache

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ jobs:
8787
chmod +x ~/bin/gpg-loopback
8888
git config --global gpg.program "$HOME/bin/gpg-loopback"
8989
90-
- name: Set up JDK 21 + GPG
90+
- name: Set up JDK 25 + GPG
9191
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
9292
with:
9393
distribution: temurin
94-
java-version: 21
94+
java-version: 25
9595
cache: maven
9696
gpg-private-key: ${{ secrets.MAVEN_GPG_KEY }}
9797
gpg-passphrase: MAVEN_GPG_PASSPHRASE

NEXT_RELEASE_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add support for Minecraft 26.1

core/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@
233233
<scope>compile</scope>
234234
</dependency>
235235

236+
<dependency>
237+
<groupId>nl.pim16aap2.BigDoors</groupId>
238+
<artifactId>v26_R1</artifactId>
239+
<version>0.1.8.66-SNAPSHOT</version>
240+
<scope>compile</scope>
241+
</dependency>
242+
236243
<dependency>
237244
<groupId>${dependency.xseries.groupid}</groupId>
238245
<artifactId>XSeries</artifactId>

core/src/main/java/nl/pim16aap2/bigDoors/BigDoors.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import nl.pim16aap2.bigDoors.NMS.FallingBlockFactoryProvider_V1_21_R5;
1616
import nl.pim16aap2.bigDoors.NMS.FallingBlockFactoryProvider_V1_21_R6;
1717
import nl.pim16aap2.bigDoors.NMS.FallingBlockFactoryProvider_V1_21_R7;
18+
import nl.pim16aap2.bigDoors.NMS.FallingBlockFactoryProvider_V26_R1;
1819
import nl.pim16aap2.bigDoors.NMS.FallingBlockFactory_V1_11_R1;
1920
import nl.pim16aap2.bigDoors.NMS.FallingBlockFactory_V1_12_R1;
2021
import nl.pim16aap2.bigDoors.NMS.FallingBlockFactory_V1_13_R1;
@@ -781,6 +782,7 @@ public static boolean isOnFlattenedVersion()
781782
}
782783

783784
// Check + initialize for the correct version of Minecraft.
785+
@SuppressWarnings("SwitchStatementWithTooFewBranches")
784786
private @Nullable FallingBlockFactory createFallingBlockFactory()
785787
throws Exception
786788
{
@@ -913,13 +915,30 @@ public static boolean isOnFlattenedVersion()
913915
case 11:
914916
return FallingBlockFactoryProvider_V1_21_R7.getFactory();
915917
}
918+
}
916919

917-
default:
918-
logger.severe("Unsupported version of Minecraft: " + SERVER_VERSION);
919-
if (config.allowCodeGeneration())
920-
return FallbackGeneratorManager.getFallingBlockFactory();
921-
return null;
920+
switch (SERVER_VERSION.getMajor())
921+
{
922+
case 26:
923+
{
924+
switch (SERVER_VERSION.getMinor())
925+
{
926+
case 1:
927+
switch (SERVER_VERSION.getPatch())
928+
{
929+
case 0:
930+
case 1:
931+
return FallingBlockFactoryProvider_V26_R1.getFactory();
932+
}
933+
}
934+
}
922935
}
936+
937+
logger.severe("Unsupported version of Minecraft: " + SERVER_VERSION);
938+
if (config.allowCodeGeneration())
939+
return FallbackGeneratorManager.getFallingBlockFactory();
940+
941+
return null;
923942
}
924943

925944
private void overrideVersion()

core/src/main/java/nl/pim16aap2/bigDoors/codegeneration/NMSBlockClassGenerator.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,21 +242,27 @@ private DynamicType.Builder<?> addRotateBlockUpDownMethodNorthSouth(DynamicType.
242242
{
243243
final Object blockRotatableAxis = fieldBlockRotatableAxis.get(null);
244244

245-
final MethodCall getCurrentAxis = (MethodCall) invoke(methodEnumOrdinal)
246-
.onMethodCall((MethodCall) invoke(methodGetIBlockDataHolderState).onField(FIELD_BLOCK_DATA)
247-
.with(blockRotatableAxis)
248-
.withAssigner(Assigner.DEFAULT,
249-
Assigner.Typing.DYNAMIC))
250-
.withAssigner(Assigner.DEFAULT, Assigner.Typing.DYNAMIC);
251-
252-
final MethodCall getNewAxis = (MethodCall) invoke(named(METHOD_ROTATE_UP_DOWN_NS_IMPL))
253-
.withArgument(0).withMethodCall(getCurrentAxis).withField(FIELD_AXES_VALUES)
254-
.withAssigner(Assigner.DEFAULT, Assigner.Typing.DYNAMIC);
245+
final MethodCall getCurrentAxis = (MethodCall)
246+
invoke(methodEnumOrdinal)
247+
.onMethodCall((MethodCall) invoke(methodGetIBlockDataHolderState)
248+
.onField(FIELD_BLOCK_DATA)
249+
.with(blockRotatableAxis)
250+
.withAssigner(Assigner.DEFAULT, Assigner.Typing.DYNAMIC))
251+
.withAssigner(Assigner.DEFAULT, Assigner.Typing.DYNAMIC);
252+
253+
final MethodCall getNewAxis = (MethodCall)
254+
invoke(named(METHOD_ROTATE_UP_DOWN_NS_IMPL))
255+
.withArgument(0)
256+
.withMethodCall(getCurrentAxis)
257+
.withField(FIELD_AXES_VALUES)
258+
.withAssigner(Assigner.DEFAULT, Assigner.Typing.DYNAMIC);
255259

256260
final MethodCall setNewAxis = (MethodCall)
257-
invoke(methodSetIBlockDataHolderState).onField(FIELD_BLOCK_DATA).with(blockRotatableAxis)
258-
.withMethodCall(getNewAxis)
259-
.withAssigner(Assigner.DEFAULT, Assigner.Typing.DYNAMIC);
261+
invoke(methodSetIBlockDataHolderState)
262+
.onField(FIELD_BLOCK_DATA)
263+
.with(blockRotatableAxis)
264+
.withMethodCall(getNewAxis)
265+
.withAssigner(Assigner.DEFAULT, Assigner.Typing.DYNAMIC);
260266

261267
builder = builder
262268
.define(METHOD_ROTATE_UP_DOWN_NS)

0 commit comments

Comments
 (0)