Skip to content

Commit

Permalink
correct dim tint while cross-dim writing
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Jul 17, 2024
1 parent 05ddcf7 commit c5236c6
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
package xaeroplus.mixin.client;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
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;
import xaero.map.MapProcessor;
import xaero.map.cache.BlockStateShortShapeCache;
import xaero.map.region.MapRegion;
import xaero.map.region.MapTile;
import xaero.map.region.MapTileChunk;
import xaero.map.region.texture.LeafRegionTexture;
import xaero.map.world.MapDimension;
import xaero.map.world.MapWorld;
import xaeroplus.feature.extensions.SeenChunksTrackingMapTileChunk;
import xaeroplus.settings.XaeroPlusSettingRegistry;

import java.io.DataInputStream;

@Mixin(value = MapTileChunk.class, remap = false)
public class MixinMapTileChunk implements SeenChunksTrackingMapTileChunk {
public abstract class MixinMapTileChunk implements SeenChunksTrackingMapTileChunk {
private final boolean[][] seenTiles = new boolean[4][4];

@Shadow private LeafRegionTexture leafTexture;

@Shadow public abstract MapRegion getInRegion();

@Override
public boolean[][] getSeenTiles() {
return seenTiles;
Expand Down Expand Up @@ -47,4 +56,16 @@ public void readCacheData(
}
}
}

@WrapOperation(method = "updateBuffers", at = @At(
value = "INVOKE",
target = "Lxaero/map/world/MapWorld;getCurrentDimension()Lxaero/map/world/MapDimension;"
))
public MapDimension useRegionDimensionInsteadOfMapWorld(final MapWorld mapWorld, final Operation<MapDimension> original) {
if (XaeroPlusSettingRegistry.writesWhileDimSwitched.getValue()) {
return getInRegion().getDim();
} else {
return original.call(mapWorld);
}
}
}

0 comments on commit c5236c6

Please sign in to comment.