-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix compat with radon by adding a config option
- Loading branch information
1 parent
b7347fe
commit 3759413
Showing
6 changed files
with
78 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/com/mystic/atlantis/mixin/SkyLightEngineRadonFix.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.mystic.atlantis.mixin; | ||
|
||
import com.mystic.atlantis.dimension.DimensionAtlantis; | ||
import com.mystic.atlantis.event.ACommonFEvents; | ||
import net.caffeinemc.phosphor.mixin.chunk.light.MixinChunkSkyLightProvider; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.core.QuartPos; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.ChunkPos; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.biome.Biome; | ||
import net.minecraft.world.level.chunk.ChunkAccess; | ||
import net.minecraft.world.level.lighting.SkyLightEngine; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
|
||
@Mixin(value = {SkyLightEngine.class}, priority = 2000) | ||
public abstract class SkyLightEngineRadonFix { | ||
|
||
/** | ||
* @author Mysticpasta1 | ||
* @reason fix radon messing with my per biome lighting code! | ||
*/ | ||
@Overwrite | ||
public int computeLevelFromNeighbor(long fromId, long toId, int currentLevel) { | ||
if(chunkSource.getLevel() instanceof Level level) { | ||
if (DimensionAtlantis.isAtlantisDimension(level)) { | ||
int propagatedLevel = getPropagatedLevel(fromId, null, toId, currentLevel); | ||
|
||
BlockPos blockPos = BlockPos.of(toId); | ||
ChunkPos chunkPos = new ChunkPos(blockPos); | ||
|
||
BlockGetter blockGetter = chunkSource.getChunkForLighting(chunkPos.x, chunkPos.z); | ||
if (blockGetter instanceof ChunkAccess chunkAccess) { | ||
Holder<Biome> biome = chunkAccess.getNoiseBiome( | ||
QuartPos.fromBlock(blockPos.getX()), | ||
QuartPos.fromBlock(blockPos.getY()), | ||
QuartPos.fromBlock(blockPos.getZ()) | ||
); | ||
if (biome.unwrapKey().isPresent()) { | ||
if (ACommonFEvents.map != null) { | ||
if (ACommonFEvents.map.containsKey(biome.unwrapKey().get().location())) { | ||
return Math.min(ACommonFEvents.map.get(biome.unwrapKey().get().location()), propagatedLevel); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return this.getPropagatedLevel(fromId, null, toId, currentLevel); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters