forked from DimensionalDevelopment/JustEnoughIDs
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from jchung01/mod-support
Add biome support for Chunk Pregenerator's chunk viewer
- Loading branch information
Showing
5 changed files
with
47 additions
and
1 deletion.
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
30 changes: 30 additions & 0 deletions
30
src/main/java/org/dimdev/jeid/mixin/modsupport/chunkpregenerator/MixinBiomeEntry.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,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; | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"package": "org.dimdev.jeid.mixin.modsupport.chunkpregenerator", | ||
"required": true, | ||
"refmap": "mixins.jeid.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": [ | ||
"MixinBiomeEntry" | ||
] | ||
} |