Skip to content

Commit

Permalink
Merge pull request #72 from jchung01/mod-support
Browse files Browse the repository at this point in the history
Add biome support for Chunk Pregenerator's chunk viewer
  • Loading branch information
ACGaming authored Mar 2, 2025
2 parents 77b87ad + de85793 commit 151f9ad
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ dependencies {
compileOnly rfg.deobf("curse.maven:cubicchunks-292243:5135427")
// RTG+ should also work
compileOnly rfg.deobf("curse.maven:rtg-unofficial-648514:4696300")
compileOnly rfg.deobf("curse.maven:chunk-pregenerator-267193:5632153")

// Chunk Pregenerator dependency
// runtimeOnly "curse.maven:carbon-config-898104:5504476"
// implementation "curse.maven:LibVulpes-236541:3801015"
// implementation "curse.maven:Baubles-227083:2518667"
// implementation "curse.maven:mm-library-368098:3254750"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.jvmargs = -Xmx3G
# Mod Information
maven_group = org.dimdev.jeid
mod_name = JustEnoughIDs
mod_version = 2.2.1
mod_version = 2.2.2
archives_base_name = jeid

# If any properties changes below this line, run `gradlew setupDecompWorkspace` and refresh gradle again to ensure everything is working correctly.
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/dimdev/jeid/core/JEIDMixinLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public List<String> getMixinConfigs() {
if (Loader.isModLoaded("creepingnether")) {
configs.add("mixins.jeid.creepingnether.json");
}
if (Loader.isModLoaded("chunkpregenerator")) {
configs.add("mixins.jeid.chunkpregenerator.json");
}
if (Loader.isModLoaded("cubicchunks")) {
configs.add("mixins.jeid.cubicchunks.json");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.dimdev.jeid.mixin.modsupport.chunkpregenerator;

import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;

import com.llamalad7.mixinextras.sugar.Local;
import org.dimdev.jeid.ducks.INewChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import pregenerator.impl.tracking.types.BaseWorldEntry;
import pregenerator.impl.tracking.types.BiomeEntry;

@Mixin(value = BiomeEntry.class, remap = false)
public class MixinBiomeEntry {
@Unique
private static final byte[] SKIP_BIOME_ARRAY = new byte[0];

@Redirect(method = "getChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B", remap = true))
private static byte[] reid$countIntBiomes(Chunk instance, @Local BaseWorldEntry.Counter<Biome> counter) {
final int[] biomeArray = ((INewChunk) instance).getIntBiomeArray();
for (int id : biomeArray) {
Biome biome = Biome.getBiome(id);
if (biome != null) counter.add(biome);
}
// empty byte[], skips original biome counting
return SKIP_BIOME_ARRAY;
}
}
10 changes: 10 additions & 0 deletions src/main/resources/mixins.jeid.chunkpregenerator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"package": "org.dimdev.jeid.mixin.modsupport.chunkpregenerator",
"required": true,
"refmap": "mixins.jeid.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MixinBiomeEntry"
]
}

0 comments on commit 151f9ad

Please sign in to comment.