Skip to content

fix(mod): better logging for 1.7.10, default to github caching #74

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/lifecycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ jobs:
timeout-minutes: 3
uses: ./
with:
cache-mc: "true"
mc: ${{ matrix.version.mc }}
mc-runtime-test: none
modloader: ${{ matrix.version.modloader }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-gametests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs: # TODO: add cleanup job
timeout-minutes: 3
uses: ./
with:
cache-mc: "true"
mc: ${{ matrix.mc }}
modloader: ${{ matrix.modloader }}
regex: ${{ matrix.regex }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test-local-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,3 @@ jobs:
fabric-api: ${{ github.event.inputs.fabric-api }}
fabric-gametest-api: ${{ github.event.inputs.fabric-gametest-api }}
hmc-version: ${{ github.event.inputs.hmc-version }}
cache-mc: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package me.earth.mc_runtime_test.mixin;

import io.netty.channel.ChannelHandlerContext;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Final;
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(NetworkManager.class)
@SuppressWarnings("StringConcatenationArgumentToLogCall")
public class MixinNetworkManager {
@Shadow
@Final
private static Logger logger;

@Inject(method = "scheduleOutboundPacket", at = @At("HEAD"))
protected void scheduleOutboundPacketHook(Packet packet, GenericFutureListener<?>[] futureListeners, CallbackInfo ci) {
logger.info("Sending packet: " + packet.getClass().getName());
}

@Inject(method = "channelRead0", at = @At("HEAD"))
protected void channelRead0Hook(ChannelHandlerContext context, Packet packet, CallbackInfo ci) {
logger.info("Packet received: " + packet.getClass().getName());
}

@Inject(method = "exceptionCaught", at = @At("HEAD"))
private void exceptionCaughtHook(ChannelHandlerContext context, Throwable throwable, CallbackInfo ci) {
logger.error("Exception caught", throwable);
}

}
3 changes: 2 additions & 1 deletion 1_7_10/src/main/resources/mc_runtime_test.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"package": "me.earth.mc_runtime_test.mixin",
"compatibilityLevel": "JAVA_8",
"client": [
"MixinMinecraft"
"MixinMinecraft",
"MixinNetworkManager"
],
"injectors": {
"defaultRequire": 1
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ The following table summarizes the available inputs for customization:

---

## Caching
Mc-Runtime-Test optionally caches `.minecraft` to improve execution time, for this we use `blacksmith/cache` simply follow the instructions [here](https://docs.blacksmith.sh/introduction/quickstart) to enable blacksmith for your repositories and enable the `cache-mc` input.

## Running Your Own Tests
MC-Runtime-Test supports Minecraft’s [Game-Test Framework](https://www.minecraft.net/en-us/creator/article/get-started-gametest-framework). It executes `/test runall` upon joining a world.

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ inputs:
default: "2.5.1"
cache-mc:
description: Cache .minecraft
default: "true"
default: "false"

runs:
using: composite
Expand Down
Loading