-
Notifications
You must be signed in to change notification settings - Fork 8
Add support for MC 26.2 #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
90fdde2
Add 26.2 module
PimvanderLoos c88f3ae
Add MC 26.1 code generation support
PimvanderLoos ad56f02
Add compilation of 26.2 to CI pipeline
PimvanderLoos 47ccd28
Add MC 26.2 resource pack version
PimvanderLoos 8f94153
Add full MC 26.1 support
PimvanderLoos 1bf99a0
Update XSeries for 26.2 materials support
PimvanderLoos fd89ead
Fix accidental fallthrough
PimvanderLoos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,3 +44,4 @@ java21: | |
|
|
||
| java25: | ||
| - "26.1.2" # 26_1_R1 | ||
| - "26.2" # 26_2_R1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Added support for MC 26.2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <packaging>jar</packaging> | ||
| <artifactId>v26_2_R1</artifactId> | ||
|
|
||
| <parent> | ||
| <groupId>nl.pim16aap2.BigDoors</groupId> | ||
| <artifactId>nms</artifactId> | ||
| <version>0.1.8.68-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <properties> | ||
| <maven.compiler.source>8</maven.compiler.source> | ||
| <maven.compiler.target>8</maven.compiler.target> | ||
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.spigotmc</groupId> | ||
| <artifactId>spigot</artifactId> | ||
| <version>26.2-R0.1-SNAPSHOT</version> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>nl.pim16aap2.BigDoors</groupId> | ||
| <artifactId>nms-api</artifactId> | ||
| <version>0.1.8.68-SNAPSHOT</version> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
63 changes: 63 additions & 0 deletions
63
nms/v26_2_R1/src/main/java/nl/pim16aap2/bigDoors/NMS/CraftBlockDataFactory_V26_2_R1.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| package nl.pim16aap2.bigDoors.NMS; | ||
|
|
||
| import net.minecraft.world.level.block.state.BlockState; | ||
| import org.bukkit.craftbukkit.block.data.CraftBlockData; | ||
|
|
||
| import java.lang.reflect.Method; | ||
| import java.util.function.Function; | ||
|
|
||
| final class CraftBlockDataFactory_V26_2_R1 | ||
| { | ||
| private static final Function<BlockState, CraftBlockData> FROM_STATE = findFromStateFunction(); | ||
|
|
||
| private CraftBlockDataFactory_V26_2_R1() | ||
| { | ||
| } | ||
|
|
||
| public static CraftBlockData fromState(BlockState state) | ||
| { | ||
| return FROM_STATE.apply(state); | ||
| } | ||
|
|
||
| static boolean isInitialized() | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| private static Function<BlockState, CraftBlockData> findFromStateFunction() | ||
| { | ||
| // On Spigot, we can use CraftBlockData#fromData(BlockState) without reflection. | ||
| // On Paper, it's CraftBlockData#createData(BlockState), which is not present in Spigot, so we'll use reflection. | ||
| try | ||
| { | ||
| CraftBlockData.class.getMethod("fromData", BlockState.class); | ||
| return CraftBlockData::fromData; | ||
| } | ||
| catch (NoSuchMethodException ignored) | ||
| { | ||
| // Ignored | ||
| } | ||
|
|
||
| try | ||
| { | ||
| Method method = CraftBlockData.class.getMethod("createData", BlockState.class); | ||
| method.setAccessible(true); | ||
| return state -> | ||
| { | ||
| try | ||
| { | ||
| return (CraftBlockData) method.invoke(null, state); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| throw new RuntimeException("Failed to create block data from state: " + state, e); | ||
| } | ||
| }; | ||
| } | ||
| catch (NoSuchMethodException ignored) | ||
| { | ||
| // ignored | ||
| } | ||
| throw new IllegalStateException("Failed to find method to create CraftBlockData from state"); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.