TARDIS Mod compat

#220
This commit is contained in:
FalsePattern committed 2025-06-06 12:30:08 +02:00
1 parent 00688eb30d
commit a0c8fe49a3
5 files changed
+57 -1

No files matched your search

@@ -29,16 +29,20 @@ import net.minecraft.world.chunk.Chunk;
import java.util.function.IntFunction;
import static com.falsepattern.endlessids.EndlessIDs.FAKE_BIOME_ARRAY_PLACEHOLDER;
import static com.falsepattern.endlessids.EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
public class BiomePatchHelper {
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
return getBiomeArrayTweaked(chunk, false, biomesForGeneration);
}
public static byte[] getBiomeArrayTweaked(Chunk chunk, boolean fake, IntFunction<BiomeGenBase> biomesForGeneration) {
val chunkBiomes = ((ChunkBiomeHook) chunk).getBiomeShortArray();
for (int i = 0; i < chunkBiomes.length; ++i) {
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
}
return ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
return fake ? FAKE_BIOME_ARRAY_PLACEHOLDER : ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
}
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
@@ -0,0 +1,45 @@
/*
* 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.tardismod;
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import tardis.common.dimension.TardisChunkProvider;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
//Also fixes a bug in TARDISMod where only the first block of each chunk is set to sky, the rest is Ocean due to a wrong
// array index variable.
@Mixin(TardisChunkProvider.class)
public class TardisChunkProviderMixin {
@Redirect(method = "provideChunk",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
require = 1)
private byte[] setBiomesTweaked(Chunk instance) {
return BiomePatchHelper.getBiomeArrayTweaked(instance, true, i -> BiomeGenBase.sky);
}
}
@@ -209,6 +209,9 @@ public enum Mixin implements IMixin {
RWGRealisticBiomeBaseMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RWG)), "biome.rwg.RealisticBiomeBaseMixin"),
RWGVillageMaterialsMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.RWG)), "biome.rwg.VillageMaterialsMixin"),
//endregion RWG
//region TARDIS Mod
TardisChunkProviderMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.TARDIS)), "biome.tardismod.TardisChunkProviderMixin"),
//endregion
//region Thaumcraft
ThaumcraftUtilsMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(require(TargetedMod.THAUMCRAFT)), "biome.thaumcraft.UtilsMixin"),
//endregion Thaumcraft
@@ -75,6 +75,7 @@ public enum TargetedMod implements ITargetedMod {
RESTRUCTURED("Restructured", false, contains("restructured-")),
RTG("Realistic Terrain Generation", false, contains("rtg-")),
RWG("Realistic World Gen", false, contains("rwg-")),
TARDIS("TARDIS Mod", false, contains("tardismod-")),
THAUMCRAFT("Thaumcraft", false, contains("thaumcraft")),
THUTCORE("ThutCore", false, contains("thutcore-").or(contains("thutmods-"))),
TMOR("The Mists Of RioV", false, contains("the mists of riov-").or(contains("the-mists-of-riov-"))),