Navigation Menu

Skip to content

Commit

Permalink
Fix mixins. Close #22 Close 23
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredlll08 committed Dec 14, 2021
1 parent a154410 commit 5814692
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
Expand Up @@ -19,21 +19,23 @@ public class AmbientEnvironmentCommon {
public static final PerlinSimplexNoise GRASS_NOISE = new PerlinSimplexNoise(new XoroshiroRandomSource("NOISE_GRASS".hashCode()), OCTAVES);
public static final PerlinSimplexNoise WATER_NOISE = new PerlinSimplexNoise(new XoroshiroRandomSource("NOISE_WATER".hashCode()), OCTAVES);

public static void init() {

BiomeColorsAccessor.setGrassColorResolver(AmbientEnvironmentCommon.GRASS_RESOLVER);
BiomeColorsAccessor.setWaterColorResolver(AmbientEnvironmentCommon.WATER_RESOLVER);
}

public static final ColorResolver GRASS_RESOLVER = Util.make(() -> {
final var baseResolver = BiomeColors.GRASS_COLOR_RESOLVER;
return (biome, x, z) -> modifyColour(GRASS_NOISE, baseResolver, biome, x, z, 8f, 0.25f);
});

public static final ColorResolver WATER_RESOLVER = Util.make(() -> {
final var baseResolver = BiomeColors.WATER_COLOR_RESOLVER;
return (biome, x, z) -> modifyColour(WATER_NOISE, baseResolver, biome, x, z, 16f, 0.3f);
});

public static void init() {

BiomeColorsAccessor.setGrassColorResolver(AmbientEnvironmentCommon.GRASS_RESOLVER);
BiomeColorsAccessor.setWaterColorResolver(AmbientEnvironmentCommon.WATER_RESOLVER);
}


private static int modifyColour(PerlinSimplexNoise generator, ColorResolver resolver, Biome biome, double x, double z, double scale, double darkness) {

final int base = resolver.getColor(biome, x, z);
Expand Down
2 changes: 2 additions & 0 deletions Common/src/main/resources/ambientenvironment.mixins.json
@@ -1,7 +1,9 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.blamejared.ambientenvironment.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "${refmap_target}refmap.json",
"client": [
"BiomeColorsAccessor"
],
Expand Down
4 changes: 4 additions & 0 deletions Fabric/build.gradle
Expand Up @@ -84,6 +84,10 @@ processResources {
filesMatching("fabric.mod.json") {
expand "version": project.version
}

filesMatching("${mod_id}.mixins.json") {
expand "refmap_target": "${archivesBaseName}-"
}
}

tasks.withType(JavaCompile) {
Expand Down
1 change: 0 additions & 1 deletion Fabric/src/main/resources/fabric.mod.json
Expand Up @@ -21,7 +21,6 @@
},
"depends": {
"fabricloader": ">=0.12",
"fabric": "*",
"minecraft": "1.18.x"
},
"mixins": [
Expand Down
4 changes: 4 additions & 0 deletions Forge/build.gradle
Expand Up @@ -118,6 +118,10 @@ tasks.withType(JavaCompile) {

processResources {
from project(":Common").sourceSets.main.resources

filesMatching("${mod_id}.mixins.json") {
expand "refmap_target": "${mod_id}."
}
}

jar {
Expand Down

0 comments on commit 5814692

Please sign in to comment.