From a0c174f2e1be2a5b17b167fb4339fd03f0b5c3ee Mon Sep 17 00:00:00 2001 From: FalsePattern Date: Thu, 5 Jun 2025 11:20:02 +0200 Subject: [PATCH] move biome conflict avoidance to config option --- README.MD | 9 +++ .../endlessids/config/GeneralConfig.java | 13 ++-- .../biome/vanilla/BiomeGenBaseMixin.java | 29 --------- .../vanilla/BiomeGenBasePlaceholderMixin.java | 61 +++++++++++++++++++ .../endlessids/mixin/plugin/Mixin.java | 1 + 5 files changed, 77 insertions(+), 36 deletions(-) create mode 100644 src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/vanilla/BiomeGenBasePlaceholderMixin.java diff --git a/README.MD b/README.MD index 3c2e0ca..4d8e91e 100644 --- a/README.MD +++ b/README.MD @@ -28,6 +28,15 @@ If you notice any problems when opening NEID worlds with EndlessIDs, please open | DataWatcher IDs | 32 | 127 (Broken) | 127 (Broken) | 65,536 | | Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same | Same | +## A note about biomes + +Minecraft has a system known as "Biome Mutations", where a biome can have modified versions of itself at (id + 128). +Older versions of EndlessIDs used to have a system for this called the "conflict avoidance system", where it would temporarily +register placeholder biomes at these offsets to avoid conflicts. + +This system has been disabled by default as it was causing weird biome registration problems, so if you want to use this +mod, we HIGHLY recommend also installing `AntiIDConflict`. + ## Mod compat This mod also contains patches for the following mods: diff --git a/src/main/java/com/falsepattern/endlessids/config/GeneralConfig.java b/src/main/java/com/falsepattern/endlessids/config/GeneralConfig.java index 187ddbe..4e636c4 100644 --- a/src/main/java/com/falsepattern/endlessids/config/GeneralConfig.java +++ b/src/main/java/com/falsepattern/endlessids/config/GeneralConfig.java @@ -105,13 +105,12 @@ public class GeneralConfig { @Config.DefaultInt(0) public static int extraItemIDBits; - - @Config.Comment("DEPRECATED, will be removed in the next version of EndlessIDs!\n" + - "This property does nothing.\n" + - "Use extraBlockIDBits and extraItemIDBits instead.") - @Config.DefaultInt(0) - @Deprecated - public static int countCorrectionBits; + @Config.Comment({"Older versions of EndlessIDs used to have a \"biome conflict avoidance\" system for automatic biome", + "registration logic in some mods conflicting with biome mutations due to the way those get registered.", + "It has been disabled in newer releases because it caused more issues than it solved.", + "You should use AntiIDConflict to fix those, however, the option is still available here in case you need it."}) + @Config.DefaultBoolean(false) + public static boolean biomeConflictAvoidancePlaceholders; static { ConfigurationManager.selfInit(); diff --git a/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/vanilla/BiomeGenBaseMixin.java b/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/vanilla/BiomeGenBaseMixin.java index 5accf54..ff58e6e 100644 --- a/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/vanilla/BiomeGenBaseMixin.java +++ b/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/vanilla/BiomeGenBaseMixin.java @@ -22,49 +22,20 @@ package com.falsepattern.endlessids.mixin.mixins.common.biome.vanilla; -import com.falsepattern.endlessids.PlaceholderBiome; import com.falsepattern.endlessids.constants.ExtendedConstants; import com.falsepattern.endlessids.constants.VanillaConstants; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyConstant; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.world.biome.BiomeGenBase; @Mixin(BiomeGenBase.class) public abstract class BiomeGenBaseMixin { - @Shadow - @Final - private static BiomeGenBase[] biomeList; - - @Shadow - @Final - public int biomeID; - @ModifyConstant(method = "", constant = @Constant(intValue = VanillaConstants.biomeIDCount), require = 1) private static int extendBiomeList(int constant) { return ExtendedConstants.biomeIDCount; } - - @Inject(method = "(IZ)V", - at = @At(value = "RETURN"), - require = 1) - private void generatePlaceholders(int id, boolean register, CallbackInfo ci) { - if (((Object) this) instanceof PlaceholderBiome || !register) { - return; - } - if (biomeID >= 128 && biomeList[biomeID - 128] == null) { - new PlaceholderBiome(biomeID - 128, (BiomeGenBase) (Object) this); - } - if (biomeID <= ExtendedConstants.biomeIDCount - 129 && biomeList[biomeID + 128] == null) { - new PlaceholderBiome(biomeID + 128, (BiomeGenBase) (Object) this); - } - } } diff --git a/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/vanilla/BiomeGenBasePlaceholderMixin.java b/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/vanilla/BiomeGenBasePlaceholderMixin.java new file mode 100644 index 0000000..5c19437 --- /dev/null +++ b/src/main/java/com/falsepattern/endlessids/mixin/mixins/common/biome/vanilla/BiomeGenBasePlaceholderMixin.java @@ -0,0 +1,61 @@ +/* + * EndlessIDs + * + * Copyright (C) 2022-2024 FalsePattern + * All Rights Reserved + * + * The above copyright notice, this permission notice and the words "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, either version 3 of the License, or + * (at your option) any later version. + * + * 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 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.vanilla; + +import com.falsepattern.endlessids.PlaceholderBiome; +import com.falsepattern.endlessids.constants.ExtendedConstants; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import net.minecraft.world.biome.BiomeGenBase; + +@Mixin(BiomeGenBase.class) +public abstract class BiomeGenBasePlaceholderMixin { + @Shadow + @Final + private static BiomeGenBase[] biomeList; + + @Shadow + @Final + public int biomeID; + + @Inject(method = "(IZ)V", + at = @At(value = "RETURN"), + require = 1) + private void generatePlaceholders(int id, boolean register, CallbackInfo ci) { + if (((Object) this) instanceof PlaceholderBiome || !register) { + return; + } + if (biomeID >= 128 && biomeList[biomeID - 128] == null) { + new PlaceholderBiome(biomeID - 128, (BiomeGenBase) (Object) this); + } + if (biomeID <= ExtendedConstants.biomeIDCount - 129 && biomeList[biomeID + 128] == null) { + new PlaceholderBiome(biomeID + 128, (BiomeGenBase) (Object) this); + } + } +} 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 a0cd287..579fa94 100644 --- a/src/main/java/com/falsepattern/endlessids/mixin/plugin/Mixin.java +++ b/src/main/java/com/falsepattern/endlessids/mixin/plugin/Mixin.java @@ -52,6 +52,7 @@ public enum Mixin implements IMixin { //region vanilla BiomeDictionaryMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome), "biome.vanilla.BiomeDictionaryMixin"), BiomeGenBaseMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome), "biome.vanilla.BiomeGenBaseMixin"), + BiomeGenBasePlaceholderMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome && GeneralConfig.biomeConflictAvoidancePlaceholders), "biome.vanilla.BiomeGenBasePlaceholderMixin"), ChunkMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome), "biome.vanilla.ChunkMixin"), GenLayerRiverMixMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome).and(avoid(TargetedMod.DRAGONAPI)), "biome.vanilla.GenLayerRiverMixMixin"), GenLayerVoronoiZoomMixin(Side.COMMON, condition(() -> GeneralConfig.extendBiome), "biome.vanilla.GenLayerVoronoiZoomMixin"),