Skip to content

Commit

Permalink
Fix a bug in porting lib that prevents cross-dimension chunk loading, f…
Browse files Browse the repository at this point in the history
…ixes #12
  • Loading branch information
hlysine committed May 26, 2024
1 parent e2c1a09 commit 7ce8383
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.hlysine.create_power_loader.mixin.portinglib;

import io.github.fabricators_of_create.porting_lib.chunk.loading.PortingLibChunkManager;
import net.minecraft.server.level.ServerLevel;
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.CallbackInfoReturnable;

@Mixin(PortingLibChunkManager.class)
public class PortingLibChunkManagerMixin {

@Inject(
method = "hasForcedChunks",
at = @At("RETURN"),
cancellable = true
)
private static void hasForcedChunks(ServerLevel level, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(!cir.getReturnValue() && level.getForcedChunks().isEmpty());
}
}
3 changes: 2 additions & 1 deletion src/main/resources/create_power_loader.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"GlobalRailwayManagerMixin",
"GlobalStationMixin",
"TrackEdgePointMixin",
"TrainMixin"
"TrainMixin",
"portinglib.PortingLibChunkManagerMixin"
],
"client": [
],
Expand Down

0 comments on commit 7ce8383

Please sign in to comment.