Skip to content

Commit e0b4429

Browse files
committed
fix fakeplayer will prevent time jumping
1 parent 19d0769 commit e0b4429

File tree

6 files changed

+30
-3
lines changed

6 files changed

+30
-3
lines changed

common/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies {
1818
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
1919

2020
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
21+
compileOnly annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0")
2122
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
2223

2324
implementation "com.google.auto.service:auto-service:1.1.1"

common/src/main/java/com/github/litermc/vschunkloader/VSCListeners.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static void onServerLevelUnload(final ServerLevel level) {
2727
public static void preServerTick(final MinecraftServer server) {
2828
final ServerShipWorld shipWorld = VSGameUtilsKt.getShipObjectWorld(server);
2929
for (final ServerShip ship : shipWorld.getAllShips()) {
30-
if (!Config.forceLoadAllShips) {
30+
if (Config.forceLoadAllShips) {
3131
final String slug = ship.getSlug();
3232
if (slug != null && slug.startsWith(VSCApi.REUSABLE_SHIP_SLUG_PREFIX)) {
3333
continue;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.github.litermc.vschunkloader.mixin;
2+
3+
import com.github.litermc.vschunkloader.platform.PlatformHelper;
4+
5+
import net.minecraft.server.level.ServerPlayer;
6+
import net.minecraft.server.players.SleepStatus;
7+
8+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
9+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.injection.At;
12+
13+
@Mixin(SleepStatus.class)
14+
public class MixinSleepStatus {
15+
@WrapOperation(
16+
method = "update",
17+
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;isSpectator()Z")
18+
)
19+
public boolean update$isSpectator(final ServerPlayer player, final Operation<Boolean> operation) {
20+
return operation.call(player) || PlatformHelper.get().isFakePlayer(player);
21+
}
22+
}

common/src/main/resources/vschunkloader.mixins.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"mixins": [
88
"MixinMinecraftPlayer",
99
"MixinShipObjectServerWorld",
10-
"MixinShipSelector"
10+
"MixinShipSelector",
11+
"MixinSleepStatus"
1112
],
1213
"client": [
1314
],

fabric/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dependencies {
2525
include modApi("teamreborn:energy:3.0.0")
2626
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
2727
implementation project(":common")
28+
compileOnly annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0")
2829
implementation "com.google.auto.service:auto-service:1.1.1"
2930
annotationProcessor "com.google.auto.service:auto-service:1.1.1"
3031

forge/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ dependencies {
3939
include modApi("dev.architectury:architectury-forge:${architectury_version}")
4040

4141
compileOnly project(":common")
42-
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
42+
annotationProcessor "org.spongepowered:mixin:0.8.5-SNAPSHOT:processor"
43+
compileOnly annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0")
44+
implementation include("io.github.llamalad7:mixinextras-forge:0.5.0")
4345
implementation "com.google.auto.service:auto-service:1.1.1"
4446
annotationProcessor "com.google.auto.service:auto-service:1.1.1"
4547

0 commit comments

Comments
 (0)