diff --git a/build.gradle.kts b/build.gradle.kts index a547e9c..5e1a52c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -205,6 +205,9 @@ dependencies { //Restructured 1.0.4.2 compileOnly(deobfCurse("restructured-230570:2276784")) + //TARDIS Mod 0.995 + compileOnly(deobfCurse("tardismod-230170:2305503")) + //Thaumcraft 4.2.3.5 compileOnly(deobfCurse("thaumcraft-223628:2227552")) diff --git a/src/main/java/com/falsepattern/endlessids/mixin/helpers/BiomePatchHelper.java b/src/main/java/com/falsepattern/endlessids/mixin/helpers/BiomePatchHelper.java index 2efe7d2..0a22eed 100644 --- a/src/main/java/com/falsepattern/endlessids/mixin/helpers/BiomePatchHelper.java +++ b/src/main/java/com/falsepattern/endlessids/mixin/helpers/BiomePatchHelper.java @@ -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 biomesForGeneration) { + return getBiomeArrayTweaked(chunk, false, biomesForGeneration); + } + public static byte[] getBiomeArrayTweaked(Chunk chunk, boolean fake, IntFunction 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) { diff --git a/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/tardismod/TardisChunkProviderMixin.java b/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/tardismod/TardisChunkProviderMixin.java new file mode 100644 index 0000000..40663cc --- /dev/null +++ b/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/tardismod/TardisChunkProviderMixin.java @@ -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 . + */ + +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); + } +} diff --git a/src/main/java/com/falsepattern/endlessids/mixin/plugin/Mixin.java b/src/main/java/com/falsepattern/endlessids/mixin/plugin/Mixin.java index 5f5061f..9a289a9 100644 --- a/src/main/java/com/falsepattern/endlessids/mixin/plugin/Mixin.java +++ b/src/main/java/com/falsepattern/endlessids/mixin/plugin/Mixin.java @@ -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 diff --git a/src/main/java/com/falsepattern/endlessids/mixin/plugin/TargetedMod.java b/src/main/java/com/falsepattern/endlessids/mixin/plugin/TargetedMod.java index 8b721e3..b2bc86e 100644 --- a/src/main/java/com/falsepattern/endlessids/mixin/plugin/TargetedMod.java +++ b/src/main/java/com/falsepattern/endlessids/mixin/plugin/TargetedMod.java @@ -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-"))),