Skip to content

Commit

Permalink
avoid MacOS ARM JVM crash area
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Jan 8, 2024
1 parent 8187640 commit d60252a
Showing 1 changed file with 9 additions and 60 deletions.
69 changes: 9 additions & 60 deletions src/main/java/xaeroplus/mixin/client/MixinMapWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import xaero.map.MapProcessor;
Expand Down Expand Up @@ -195,66 +194,16 @@ public void writeChunk(
}
}

@Redirect(method = "writeChunk", at = @At(value = "INVOKE", target = "Lxaero/map/MapWriter;loadPixel(Lnet/minecraft/world/World;Lnet/minecraft/registry/Registry;Lxaero/map/region/MapBlock;Lxaero/map/region/MapBlock;Lnet/minecraft/world/chunk/WorldChunk;IIIIZZIZZLnet/minecraft/registry/Registry;ZILnet/minecraft/util/math/BlockPos$Mutable;)V"), remap = true)
public void redirectLoadPixelForNetherFix(MapWriter instance,
World world,
Registry<Block> blockRegistry,
MapBlock pixel,
MapBlock currentPixel,
WorldChunk bchunk,
int insideX,
int insideZ,
int highY,
int lowY,
boolean cave,
boolean fullCave,
int mappedHeight,
boolean canReuseBiomeColours,
boolean ignoreHeightmaps,
Registry<Biome> biomeRegistry,
boolean flowers,
int worldBottomY,
BlockPos.Mutable mutableBlockPos3) {
@Inject(method = "loadPixel", at = @At("HEAD"), remap = true)
public void netherCaveFixInject(final World world, final Registry<Block> blockRegistry, final MapBlock pixel, final MapBlock currentPixel, final WorldChunk bchunk, final int insideX, final int insideZ, final int highY, final int lowY, final boolean cave, final boolean fullCave, final int mappedHeight, final boolean canReuseBiomeColours, final boolean ignoreHeightmaps, final Registry<Biome> biomeRegistry, final boolean flowers, final int worldBottomY, final BlockPos.Mutable mutableBlockPos3, final CallbackInfo ci,
@Local(index = 10, argsOnly = true) LocalBooleanRef caveRef,
@Local(index = 11, argsOnly = true) LocalBooleanRef fullCaveRef
) {
if (XaeroPlusSettingRegistry.netherCaveFix.getValue()) {
final boolean nether = world.getRegistryKey() == NETHER;
final boolean shouldForceFullInNether = !cave && nether;
instance.loadPixel(world,
blockRegistry,
pixel,
currentPixel,
bchunk,
insideX,
insideZ,
highY,
lowY,
shouldForceFullInNether || cave,
shouldForceFullInNether || fullCave,
mappedHeight,
canReuseBiomeColours,
ignoreHeightmaps,
biomeRegistry,
flowers,
worldBottomY,
mutableBlockPos3);
} else {
instance.loadPixel(world,
blockRegistry,
pixel,
currentPixel,
bchunk,
insideX,
insideZ,
highY,
lowY,
cave,
fullCave,
mappedHeight,
canReuseBiomeColours,
ignoreHeightmaps,
biomeRegistry,
flowers,
worldBottomY,
mutableBlockPos3);
var nether = world.getRegistryKey() == NETHER;
var shouldForceFullInNether = !cave && nether;
caveRef.set(shouldForceFullInNether || cave);
fullCaveRef.set(shouldForceFullInNether || fullCave);
}
}
}

0 comments on commit d60252a

Please sign in to comment.