-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
611 additions
and
30 deletions.
There are no files selected for viewing
File renamed without changes.
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,52 @@ | ||
name: Gradle build | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
subproject: | ||
- 1.17.1-forge | ||
- 1.17.1-fabric | ||
- 1.18.2-forge | ||
- 1.18.2-fabric | ||
- 1.19.2-forge | ||
- 1.19.2-fabric | ||
- 1.19.4-forge | ||
- 1.19.4-fabric | ||
- 1.20.1-forge | ||
- 1.20.1-fabric | ||
- 1.20.4-neoforge | ||
- 1.20.4-fabric | ||
- 1.20.6-neoforge | ||
- 1.20.6-fabric | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get cache key | ||
id: cache_key | ||
run: echo "gradle_key=gradle-`cat versions/mainProject`" >> $GITHUB_OUTPUT | ||
- name: Cache Gradle stuff | ||
uses: actions/cache@v3 | ||
with: | ||
key: ${{ steps.cache_key.outputs.gradle_key }}-${{ hashFiles('*.gradle.kts', 'gradle.properties', 'gradle/**') }} | ||
restore-keys: ${{ steps.cache_key.outputs.gradle_key }}- | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
.gradle/loom-cache | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 21 | ||
- name: Install Xvfb | ||
run: apt install xvfb | ||
- name: Launch Xvfb | ||
run: screen -d -m Xvfb :1 -screen 0 1920x1080x24 | ||
- name: Run tests | ||
run: | | ||
./gradlew :${{ matrix.subproject }}:runTestHost --stacktrace & | ||
./gradlew :${{ matrix.subproject }}:runTestJoiner --stacktrace && | ||
fg | ||
- name: Stop Xvfb | ||
run: screen -X quit |
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
12 changes: 12 additions & 0 deletions
12
src/main/java/io/github/gaming32/worldhost/mixin/DisconnectedScreenAccessor.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.github.gaming32.worldhost.mixin; | ||
|
||
import net.minecraft.client.gui.screens.DisconnectedScreen; | ||
import net.minecraft.network.chat.Component; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(DisconnectedScreen.class) | ||
public interface DisconnectedScreenAccessor { | ||
@Accessor | ||
Component getReason(); | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/io/github/gaming32/worldhost/mixin/MixinInputConstants.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.github.gaming32.worldhost.mixin; | ||
|
||
import com.mojang.blaze3d.platform.InputConstants; | ||
import io.github.gaming32.worldhost.testing.WorldHostTesting; | ||
import io.github.gaming32.worldhost.testing.WindowCallbackManager; | ||
import org.lwjgl.glfw.GLFWCharModsCallbackI; | ||
import org.lwjgl.glfw.GLFWCursorPosCallbackI; | ||
import org.lwjgl.glfw.GLFWDropCallbackI; | ||
import org.lwjgl.glfw.GLFWKeyCallbackI; | ||
import org.lwjgl.glfw.GLFWMouseButtonCallbackI; | ||
import org.lwjgl.glfw.GLFWScrollCallbackI; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(InputConstants.class) | ||
public class MixinInputConstants { | ||
@Inject(method = "setupKeyboardCallbacks", at = @At("HEAD"), cancellable = true) | ||
private static void mockKeyboardCallbacks( | ||
long window, | ||
GLFWKeyCallbackI keyCallback, | ||
GLFWCharModsCallbackI charModifierCallback, | ||
CallbackInfo ci | ||
) { | ||
if (!WorldHostTesting.ENABLED) return; | ||
WindowCallbackManager.keyCallback = keyCallback; | ||
WindowCallbackManager.charModsCallback = charModifierCallback; | ||
ci.cancel(); | ||
} | ||
|
||
@Inject(method = "setupMouseCallbacks", at = @At("HEAD"), cancellable = true) | ||
private static void mockMouseCallbacks( | ||
long window, | ||
GLFWCursorPosCallbackI cursorPositionCallback, | ||
GLFWMouseButtonCallbackI mouseButtonCallback, | ||
GLFWScrollCallbackI scrollCallback, | ||
GLFWDropCallbackI dragAndDropCallback, | ||
CallbackInfo ci | ||
) { | ||
if (!WorldHostTesting.ENABLED) return; | ||
WindowCallbackManager.cursorPosCallback = cursorPositionCallback; | ||
WindowCallbackManager.mouseButtonCallback = mouseButtonCallback; | ||
WindowCallbackManager.scrollCallback = scrollCallback; | ||
WindowCallbackManager.dropCallback = dragAndDropCallback; | ||
ci.cancel(); | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/main/java/io/github/gaming32/worldhost/mixin/MixinOptions.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.github.gaming32.worldhost.mixin; | ||
|
||
import io.github.gaming32.worldhost.testing.WorldHostTesting; | ||
import net.minecraft.client.Options; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Options.class) | ||
public class MixinOptions { | ||
@Shadow public boolean pauseOnLostFocus; | ||
|
||
@Inject(method = "load", at = @At("RETURN")) | ||
private void dontPauseWhileTesting(CallbackInfo ci) { | ||
if (WorldHostTesting.ENABLED) { | ||
pauseOnLostFocus = false; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.