Mystcraft compat

#150 #196
This commit is contained in:
FalsePattern committed 2025-06-09 16:58:23 +02:00
1 parent ebdfcd21aa
commit 206c745716
5 files changed
+71

No files matched your search

@@ -0,0 +1,63 @@
/*
* EndlessIDs
*
* Copyright (C) 2022-2025 FalsePattern, The MEGA Team
* All Rights Reserved
*
* The above copyright notice, this permission notice and the word "MEGA"
* shall be included in all copies or substantial portions of the Software.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.endlessids.mixin.mixins.common.biome.mystcraft;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.mixin.helpers.ChunkBiomeHook;
import com.xcompwiz.mystcraft.symbol.symbols.SymbolFloatingIslands;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@Mixin(SymbolFloatingIslands.BiomeReplacer.class)
public abstract class BiomeReplacerMixin {
@Shadow(remap = false) private HashMap<List<Integer>, boolean[]> chunks;
@Shadow(remap = false) private BiomeGenBase biome;
/**
* @author FalsePattern
* @reason Control flow, hard to fix with mixins
*/
@Overwrite(remap = false)
public void finalizeChunk(Chunk chunk, int chunkX, int chunkZ) {
boolean[] modified = this.chunks.remove(Arrays.asList(chunkX, chunkZ));
if (modified != null) {
short[] biomes = ((ChunkBiomeHook)chunk).getBiomeShortArray();
for(int coords = 0; coords < modified.length; ++coords) {
if (modified[coords]) {
biomes[coords] = (short)(this.biome.biomeID & ExtendedConstants.biomeIDMask);
}
}
}
}
}
@@ -67,6 +67,7 @@ import static com.falsepattern.endlessids.mixin.plugin.TargetedMod.LOTR;
import static com.falsepattern.endlessids.mixin.plugin.TargetedMod.MATTERMEGADRIVE;
import static com.falsepattern.endlessids.mixin.plugin.TargetedMod.MATTEROVERDRIVE;
import static com.falsepattern.endlessids.mixin.plugin.TargetedMod.MFQM;
import static com.falsepattern.endlessids.mixin.plugin.TargetedMod.MYSTCRAFT;
import static com.falsepattern.endlessids.mixin.plugin.TargetedMod.NATURESCOMPASS;
import static com.falsepattern.endlessids.mixin.plugin.TargetedMod.NETHERLICIOUS;
import static com.falsepattern.endlessids.mixin.plugin.TargetedMod.NOMADICTENTS;
@@ -207,6 +208,8 @@ public class Mixin {
biome_lotr_LOTRWorldChunkManagerMixin(EXT_BIOME, require(LOTR)),
biome_lotr_LOTRWorldProviderMixin(EXT_BIOME, require(LOTR)),
biome_mystcraft_BiomeReplacerMixin(EXT_BIOME, require(MYSTCRAFT)),
biome_naturescompass_BiomeUtilsMixin(EXT_BIOME, require(NATURESCOMPASS)),
biome_netherlicious_BiomeConfigurationMixin(EXT_BIOME, require(NETHERLICIOUS)),
@@ -67,6 +67,7 @@ public enum TargetedMod implements ITargetedMod {
LOTR("LOTR Mod", false, contains("lotrmod")),
MATTEROVERDRIVE("Matter Overdrive", false, contains("matteroverdrive-")),
MATTERMEGADRIVE("Matter Megadrive", false, contains("mattermegadrive-")),
MYSTCRAFT("Mystcraft", false, contains("mystcraft-")),
MFQM("More Fun Quicksand Mod", false, contains("morefunquicksandmod-")),
NATURESCOMPASS("Nature's Compass", false, contains("naturescompass")),
NETHERLICIOUS("Netherlicious", false, contains("netherlicious-")),