Nostalgic World Generation / OWG compat (#158, #176)

This commit is contained in:
FalsePattern committed 2024-06-09 21:11:17 +02:00
1 parent 0f810afe90
commit 098254dc82
5 files changed
+83

No files matched your search

@@ -0,0 +1,74 @@
package com.falsepattern.endlessids.mixin.mixins.common.biome.owg;
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import owg.generator.ChunkGeneratorBeta;
import owg.map.MapGenOLD;
import owg.world.ManagerOWG;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.structure.MapGenMineshaft;
import net.minecraft.world.gen.structure.MapGenStronghold;
import java.util.Random;
@Mixin(ChunkGeneratorBeta.class)
public abstract class ChunkGeneratorBetaMixin implements IChunkProvider {
@Shadow private Random rand;
@Shadow private BiomeGenBase[] biomesForGeneration;
@Shadow private World worldObj;
@Shadow public abstract void generateTerrain(int i, int j, Block[] blocks, BiomeGenBase[] abiomegenbase, double[] ad);
@Shadow public abstract void replaceBlocksForBiome(int i, int j, Block[] blocks, byte[] metadata, BiomeGenBase[] abiomegenbase);
@Shadow private MapGenOLD field_902_u;
@Shadow @Final private boolean mapFeaturesEnabled;
@Shadow private MapGenStronghold strongholdGenerator;
@Shadow private MapGenMineshaft mineshaftGenerator;
@Shadow private int biomeSettings;
public Chunk provideChunk(int i, int j) {
this.rand.setSeed((long)i * 341873128712L + (long)j * 132897987541L);
Block[] blocks = new Block[128 * 16 * 16];
byte[] metadata = new byte[128 * 16 * 16];
this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, i * 16, j * 16, 16, 16);
double[] ad = ManagerOWG.temperature;
this.generateTerrain(i, j, blocks, this.biomesForGeneration, ad);
this.replaceBlocksForBiome(i, j, blocks, metadata, this.biomesForGeneration);
this.field_902_u.generate(this, this.worldObj, i, j, blocks);
if (this.mapFeaturesEnabled) {
this.strongholdGenerator.func_151539_a(this, this.worldObj, i, j, blocks);
this.mineshaftGenerator.func_151539_a(this, this.worldObj, i, j, blocks);
}
Chunk chunk = new Chunk(this.worldObj, blocks, metadata, i, j);
short[] abyte1 = ((ChunkBiomeHook)chunk).getBiomeShortArray();
int k;
if (this.biomeSettings == 0) {
for(k = 0; k < abyte1.length; ++k) {
abyte1[k] = (short)this.biomesForGeneration[k].biomeID;
}
} else {
for(k = 0; k < abyte1.length; ++k) {
abyte1[k] = (short)this.biomesForGeneration[(k * 16 & 255) + k / 16].biomeID;
}
}
chunk.generateSkylightMap();
return chunk;
}
}
@@ -137,6 +137,9 @@ public enum Mixin implements IMixin {
//region NomadicTents
NomadicTentsTentChunkProviderMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.NOMADICTENTS)), "biome.nomadictents.TentChunkProviderMixin"),
//endregion NomadicTents
//region OWG
OWGChunkGeneratorBetaMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.OWG)), "biome.owg.ChunkGeneratorBetaMixin"),
//endregion OWG
//region RandomThings
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"),
@@ -42,6 +42,7 @@ public enum TargetedMod implements ITargetedMod {
NATURESCOMPASS("Nature's Compass", false, startsWith("naturescompass")),
NETHERLICIOUS("Netherlicious", false, startsWith("netherlicious-")),
NOMADICTENTS("Nomadic Tents", false, startsWith("nomadictents")),
OWG("Nostalgic world generation", false, startsWith("owg-").or(startsWith("nostalgiagenerator-"))),
RANDOMTHINGS("Random Things", false, startsWith("randomthings-")),
RESTRUCTURED("Restructured", false, startsWith("restructured-")),
RTG("Realistic Terrain Generation", false, startsWith("rtg-")),