-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite biome coloring to not require rendering mod patches
- Loading branch information
Showing
7 changed files
with
56 additions
and
158 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
52 changes: 52 additions & 0 deletions
52
src/main/java/com/gregtechceu/gtceu/core/mixins/BiomeColorsMixin.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,52 @@ | ||
package com.gregtechceu.gtceu.core.mixins; | ||
|
||
import com.gregtechceu.gtceu.client.EnvironmentalHazardClientHandler; | ||
import com.gregtechceu.gtceu.config.ConfigHolder; | ||
|
||
import net.minecraft.client.renderer.BiomeColors; | ||
import net.minecraft.core.SectionPos; | ||
import net.minecraft.world.level.ChunkPos; | ||
import net.minecraft.world.level.ColorResolver; | ||
|
||
import org.spongepowered.asm.mixin.*; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(BiomeColors.class) | ||
public class BiomeColorsMixin { | ||
|
||
@Shadow | ||
@Final | ||
@Mutable | ||
public static ColorResolver WATER_COLOR_RESOLVER; | ||
@Shadow | ||
@Final | ||
@Mutable | ||
public static ColorResolver GRASS_COLOR_RESOLVER; | ||
@Shadow | ||
@Final | ||
@Mutable | ||
public static ColorResolver FOLIAGE_COLOR_RESOLVER; | ||
|
||
@Unique | ||
private static ColorResolver gtceu$wrapResolver(ColorResolver resolver) { | ||
return (biome, x, z) -> { | ||
var originalColor = resolver.getColor(biome, x, z); | ||
if (!ConfigHolder.INSTANCE.gameplay.environmentalHazards) { | ||
return originalColor; | ||
} | ||
|
||
var clientHandler = EnvironmentalHazardClientHandler.INSTANCE; | ||
var chunkPos = new ChunkPos(SectionPos.posToSectionCoord(x), SectionPos.posToSectionCoord(z)); | ||
return clientHandler.colorZone(originalColor, chunkPos); | ||
}; | ||
} | ||
|
||
@Inject(method = "<clinit>", at = @At("RETURN")) | ||
private static void addPollutionWrapper(CallbackInfo ci) { | ||
WATER_COLOR_RESOLVER = gtceu$wrapResolver(WATER_COLOR_RESOLVER); | ||
GRASS_COLOR_RESOLVER = gtceu$wrapResolver(GRASS_COLOR_RESOLVER); | ||
FOLIAGE_COLOR_RESOLVER = gtceu$wrapResolver(FOLIAGE_COLOR_RESOLVER); | ||
} | ||
} |
53 changes: 0 additions & 53 deletions
53
src/main/java/com/gregtechceu/gtceu/core/mixins/BlockColorsMixin.java
This file was deleted.
Oops, something went wrong.
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
43 changes: 0 additions & 43 deletions
43
src/main/java/com/gregtechceu/gtceu/core/mixins/embeddium/BiomeColorCacheMixin.java
This file was deleted.
Oops, something went wrong.
54 changes: 0 additions & 54 deletions
54
src/main/java/com/gregtechceu/gtceu/core/mixins/embeddium/VanillaColorAdapterMixin.java
This file was deleted.
Oops, something went wrong.
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