-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from tropicthedev/1.21
Project Restructure and Preliminary Minecraft 1.21 Support
- Loading branch information
Showing
32 changed files
with
349 additions
and
289 deletions.
There are no files selected for viewing
This file contains 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,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
This file contains 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 |
---|---|---|
@@ -1,33 +1,37 @@ | ||
# This workflow will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: | ||
- latest | ||
pull_request: | ||
branches: | ||
- latest | ||
name: build | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
java: [ 21, ] | ||
|
||
runs-on: ubuntu-latest | ||
|
||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 1.17 | ||
uses: actions/setup-java@v1 | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Validate gradle wrapper | ||
uses: gradle/wrapper-validation-action@v2 | ||
|
||
- name: Setup jdk ${{ matrix.java }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 1.17 | ||
java-version: ${{ matrix.java }} | ||
distribution: 'temurin' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build | ||
- uses: actions/upload-artifact@v2 | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: AllStackable | ||
name: AllStackable_Java${{ matrix.java }} | ||
path: build/libs/AllStackable-*.*-*.*[^sourcedv].jar | ||
|
This file contains 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 |
---|---|---|
|
@@ -31,3 +31,10 @@ bin/ | |
# fabric | ||
|
||
run/ | ||
|
||
# java | ||
|
||
hs_err_*.log | ||
replay_*.log | ||
*.hprof | ||
*.jfr |
This file contains 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 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 |
---|---|---|
@@ -1,14 +1,16 @@ | ||
# Done to increase the memory available to gradle. | ||
org.gradle.jvmargs=-Xmx1G | ||
org.gradle.jvmargs=-Xmx1G | ||
org.gradle.parallel=true | ||
|
||
#Fabric | ||
minecraft_version=1.20.6 | ||
yarn_mappings=1.20.6+build.1 | ||
loader_version=0.15.11 | ||
fabric_version=0.98.0+1.20.6 | ||
# Fabric | ||
loader_version=0.16.5 | ||
yarn_mappings=1.21+build.9 | ||
minecraft_version=1.21 | ||
fabric_version=0.102.0+1.21 | ||
|
||
# Mod Properties | ||
mod_version = 2.1.0 | ||
maven_group = online.connlost.allstackable | ||
archives_base_name = AllStackable | ||
mod_version = 2.1.0 | ||
maven_group=online.connlost.allstackable | ||
archives_base_name=AllStackable | ||
|
||
|
This file contains 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 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 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 |
---|---|---|
|
@@ -89,4 +89,4 @@ exit /b %EXIT_CODE% | |
:mainEnd | ||
if "%OS%"=="Windows_NT" endlocal | ||
|
||
:omega | ||
:omega |
This file contains 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
pluginManagement { | ||
repositories { | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
repositories { | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} |
24 changes: 11 additions & 13 deletions
24
...ckable/client/AllStackableClientInit.java → ...lost/allstackable/AllStackableClient.java
This file contains 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 |
---|---|---|
@@ -1,37 +1,35 @@ | ||
package online.connlost.allstackable.client; | ||
package online.connlost.allstackable; | ||
|
||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; | ||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; | ||
import net.fabricmc.fabric.api.networking.v1.PacketSender; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.network.ClientPlayNetworkHandler; | ||
import net.minecraft.network.PacketByteBuf; | ||
|
||
import java.util.ArrayList; | ||
import java.util.LinkedHashMap; | ||
|
||
import online.connlost.allstackable.AllStackableInit; | ||
import online.connlost.allstackable.util.ByteArrayPayload; | ||
import org.apache.commons.lang3.SerializationUtils; | ||
|
||
|
||
public class AllStackableClientInit implements ClientModInitializer { | ||
|
||
public class AllStackableClient implements ClientModInitializer { | ||
@Override | ||
@Environment(EnvType.CLIENT) | ||
public void onInitializeClient() { | ||
ClientPlayConnectionEvents.INIT.register((handler, client) ->{ | ||
ClientPlayConnectionEvents.INIT.register((handler, client) -> { | ||
ClientPlayNetworking.registerReceiver( | ||
AllStackableInit.SHARE_CONFIG_PACKET_ID, | ||
(client1, handler1, buf, sender1) -> configHandler(handler1, sender1, client1, buf) | ||
ByteArrayPayload.ID, | ||
(packet, context) -> { | ||
configHandler(packet.data()); | ||
} | ||
); | ||
}); | ||
} | ||
|
||
private void configHandler(ClientPlayNetworkHandler handler, PacketSender sender, MinecraftClient client, PacketByteBuf buf){ | ||
ArrayList<LinkedHashMap<String, Integer>> configList = SerializationUtils.deserialize(buf.readByteArray()); | ||
// Updated configHandler method to match the new PlayPayloadHandler API | ||
private void configHandler(byte[] configPayload) { | ||
ArrayList<LinkedHashMap<String, Integer>> configList = SerializationUtils.deserialize(configPayload); | ||
ConfigSync.syncConfig(configList); | ||
} | ||
} |
26 changes: 12 additions & 14 deletions
26
...nlost/allstackable/client/ConfigSync.java → ...ine/connlost/allstackable/ConfigSync.java
This file contains 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
6 changes: 3 additions & 3 deletions
6
...kable/mixin/MixinMinecraftClientGame.java → ...stackable/mixin/MixinMinecraftClient.java
This file contains 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 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,11 @@ | ||
{ | ||
"required": true, | ||
"package": "online.connlost.allstackable.mixin", | ||
"compatibilityLevel": "JAVA_21", | ||
"client": [ | ||
"MixinMinecraftClient" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
15 changes: 5 additions & 10 deletions
15
...nnlost/allstackable/AllStackableInit.java → ...e/connlost/allstackable/AllStackable.java
This file contains 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 |
---|---|---|
@@ -1,28 +1,23 @@ | ||
package online.connlost.allstackable; | ||
|
||
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry; | ||
import online.connlost.allstackable.server.Server; | ||
import online.connlost.allstackable.server.command.StackSizeCommand; | ||
import online.connlost.allstackable.util.ByteArrayPayload; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.minecraft.util.Identifier; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; | ||
|
||
public class AllStackableInit implements ModInitializer { | ||
public static final Identifier SHARE_CONFIG_PACKET_ID = new Identifier("allstackable", "config"); | ||
public class AllStackable implements ModInitializer { | ||
public static final Logger LOGGER = LogManager.getLogger(); | ||
|
||
|
||
@Override | ||
public void onInitialize() { | ||
PayloadTypeRegistry.playS2C().register(ByteArrayPayload.ID, ByteArrayPayload.CODEC); | ||
LOGGER.info("[All Stackable] Start loading!"); | ||
StackSizeCommand.register(); | ||
LOGGER.info("[All Stackable] Command registered."); | ||
ServerLifecycleEvents.SERVER_STARTED.register(server -> { | ||
Server.onServerLoaded(server); | ||
}); | ||
|
||
ServerLifecycleEvents.SERVER_STARTED.register(Server::onServerLoaded); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.