Skip to content

Commit

Permalink
only set signal on multiplayer worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Aug 24, 2024
1 parent ff256b4 commit 63b8aa5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public MapRegion createMapRegionInActualDimensionIfSignalled(String worldId, Str
))
public MapDimension updateWorldSyncedGetActualDimension(final MapWorld mapWorld, final Operation<MapDimension> original) {
var world = this.world;
return XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && world != null
return XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && world != null && mapWorld.isMultiplayer()
? mapWorld.getDimension(world.dimension())
: original.call(mapWorld);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void readCacheData(
target = "Lxaero/map/world/MapWorld;getCurrentDimension()Lxaero/map/world/MapDimension;"
))
public MapDimension useRegionDimensionInsteadOfMapWorld(final MapWorld mapWorld, final Operation<MapDimension> original) {
if (XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue()) {
if (XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && mapWorld.isMultiplayer()) {
return getInRegion().getDim();
} else {
return original.call(mapWorld);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void netherCaveFixInject(final Level world, final Registry<Block> blockRe
remap = true) // $REMAP
public ResourceKey<Level> removeCustomDimSwitchWriterPrevention(final MapWorld mapWorld, final Operation<ResourceKey<Level>> original) {
var world = mapProcessor.getWorld();
return XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && world != null
return XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && world != null && mapWorld.isMultiplayer()
? world.dimension() // makes if condition in injected code always true
: original.call(mapWorld);
}
Expand All @@ -280,7 +280,7 @@ public ResourceKey<Level> removeCustomDimSwitchWriterPrevention(final MapWorld m

@Inject(method = "writeChunk", at = @At("HEAD"))
public void getActualMapRegionDimSignalHead(final Level world, final Registry<Block> blockRegistry, final int distance, final boolean onlyLoad, final Registry<Biome> biomeRegistry, final OverlayManager overlayManager, final boolean loadChunks, final boolean updateChunks, final boolean ignoreHeightmaps, final boolean flowers, final boolean detailedDebug, final BlockPos.MutableBlockPos mutableBlockPos3, final BlockTintProvider blockTintProvider, final int caveDepth, final int caveStart, final int layerToWrite, final int tileChunkX, final int tileChunkZ, final int tileChunkLocalX, final int tileChunkLocalZ, final int chunkX, final int chunkZ, final CallbackInfoReturnable<Boolean> cir) {
((CustomMapProcessor) mapProcessor).xaeroPlus$getLeafRegionActualDimSignal().set(XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue());
((CustomMapProcessor) mapProcessor).xaeroPlus$getLeafRegionActualDimSignal().set(XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && mapProcessor.getMapWorld().isMultiplayer());
}

@Inject(method = "writeChunk", at = @At("RETURN"))
Expand All @@ -291,7 +291,7 @@ public void getActualMapRegionDimSignalReturn(final Level world, final Registry<
@Inject(method = "writeChunk", at = @At("HEAD"))
public void setGetCurrentDimActualDimSignalHead(final Level world, final Registry<Block> blockRegistry, final int distance, final boolean onlyLoad, final Registry<Biome> biomeRegistry, final OverlayManager overlayManager, final boolean loadChunks, final boolean updateChunks, final boolean ignoreHeightmaps, final boolean flowers, final boolean detailedDebug, final BlockPos.MutableBlockPos mutableBlockPos3, final BlockTintProvider blockTintProvider, final int caveDepth, final int caveStart, final int layerToWrite, final int tileChunkX, final int tileChunkZ, final int tileChunkLocalX, final int tileChunkLocalZ, final int chunkX, final int chunkZ, final CallbackInfoReturnable<Boolean> cir) {
var mapWorld = mapProcessor.getWorld();
var setSignal = XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && mapWorld != null;
var setSignal = XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && mapWorld != null && mapProcessor.getMapWorld().isMultiplayer();
((CustomMapProcessor) mapProcessor).xaeroPlus$getCurrentDimensionActualDimSignal().set(setSignal);
}

Expand All @@ -305,7 +305,7 @@ public void setGetCurrentDimActualDimSignalTail(final Level world, final Registr
target = "Lxaero/map/MapProcessor;getLeafMapRegion(IIIZ)Lxaero/map/region/MapRegion;"
))
public MapRegion getActualMapRegionInOnRender(final MapProcessor mapProcessor, int caveLayer, int regX, int regZ, boolean create, final Operation<MapRegion> original) {
if (XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue()) {
if (XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue() && mapProcessor.getMapWorld().isMultiplayer()) {
((CustomMapProcessor) mapProcessor).xaeroPlus$getLeafRegionActualDimSignal().set(true);
}
try {
Expand Down

0 comments on commit 63b8aa5

Please sign in to comment.