Restructured compat (#105)

This commit is contained in:
FalsePattern committed 2023-04-02 13:08:27 +02:00
1 parent e7340cd9b1
commit 8c715bd579
5 files changed
+45

No files matched your search

@@ -0,0 +1,37 @@
package com.falsepattern.endlessids.mixin.mixins.common.biome.restructured;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import org.blockartistry.mod.Restructured.world.BiomeHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import java.util.Random;
@Mixin(BiomeHelper.class)
public abstract class BiomeHelperMixin {
/**
* @author FalsePattern
* @reason Compat
*/
@Overwrite
public static BiomeGenBase chunkBiomeSurvey(World world, Chunk chunk, Random rand) {
short[] biomes = ((IChunkMixin)chunk).getBiomeShortArray();
int[] counts = new int[biomes.length];
int highIndex = BiomeGenBase.plains.biomeID;
int highCount = -1;
for(int i = 0; i < 32; ++i) {
int id = biomes[rand.nextInt(biomes.length)] & 65535;
if (id != 65535 && ++counts[id] > highCount) {
highIndex = id;
highCount = counts[id];
}
}
return BiomeGenBase.getBiome(highIndex);
}
}
@@ -136,6 +136,9 @@ public enum Mixin implements IMixin {
ItemBiomePainterMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RANDOMTHINGS)), "biome.randomthings.ItemBiomePainterMixin"),
MessagePaintBiomeMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RANDOMTHINGS)), "biome.randomthings.MessagePaintBiomeMixin"),
//endregion RandomThings
//region Restructured
RSBiomeHelperMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RESTRUCTURED)), "biome.restructured.BiomeHelperMixin"),
//endregion Restructured
//region RTG
RTGChunkProviderRTGMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RTG)), "biome.rtg.ChunkProviderRTGMixin"),
RTGLandscapeGeneratorMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RTG)), "biome.rtg.LandscapeGeneratorMixin"),
@@ -41,6 +41,7 @@ public enum TargetedMod implements ITargetedMod {
NETHERLICIOUS("Netherlicious", false, startsWith("netherlicious-")),
NOMADICTENTS("Nomadic Tents", false, startsWith("nomadictents")),
RANDOMTHINGS("Random Things", false, startsWith("randomthings-")),
RESTRUCTURED("Restructured", false, startsWith("restructured-")),
RTG("Realistic Terrain Generation", false, startsWith("rtg-")),
RWG("Realistic World Gen", false, startsWith("rwg-")),
THAUMCRAFT("Thaumcraft", false, startsWith("thaumcraft")),