-
-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
71 additions
and
43 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
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
42 changes: 42 additions & 0 deletions
42
src/main/java/net/coderbot/iris/shaderpack/IrisDefines.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,42 @@ | ||
package net.coderbot.iris.shaderpack; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import net.coderbot.iris.Iris; | ||
import net.coderbot.iris.gl.shader.StandardMacros; | ||
import net.coderbot.iris.parsing.BiomeCategories; | ||
import net.coderbot.iris.uniforms.BiomeParameters; | ||
import net.minecraft.world.level.biome.Biome; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.regex.Pattern; | ||
|
||
public class IrisDefines { | ||
private static final Pattern SEMVER_PATTERN = Pattern.compile("(?<major>\\d+)\\.(?<minor>\\d+)\\.*(?<bugfix>\\d*)(.*)"); | ||
|
||
private static void define(List<StringPair> defines, String key) { | ||
defines.add(new StringPair(key, "")); | ||
} | ||
|
||
private static void define(List<StringPair> defines, String key, String value) { | ||
defines.add(new StringPair(key, value)); | ||
} | ||
|
||
public static ImmutableList<StringPair> createIrisReplacements() { | ||
ArrayList<StringPair> s = new ArrayList<>(StandardMacros.createStandardEnvironmentDefines()); | ||
define(s, "PPT_NONE", "0"); | ||
define(s, "PPT_RAIN", "1"); | ||
define(s, "PPT_SNOW", "2"); | ||
define(s, "BIOME_SWAMP_HILLS", "-1"); | ||
|
||
BiomeParameters.getBiomeMap().forEach((biome, id) -> define(s, "BIOME_" + biome.location().getPath().toUpperCase(Locale.ROOT), String.valueOf(id))); | ||
|
||
BiomeCategories[] categories = BiomeCategories.values(); | ||
for (int i = 0; i < categories.length; i++) { | ||
define(s, "CAT_" + categories[i].name().toUpperCase(Locale.ROOT), String.valueOf(i)); | ||
} | ||
|
||
return ImmutableList.copyOf(s); | ||
} | ||
} |
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