Fixed end biome source injection (#2940)

(cherry picked from commit 348a9c6486)

(cherry picked from commit f1c68e5823)
This commit is contained in:
TelepathicGrunt 2023-03-15 09:13:42 +00:00 committed by modmuss50
parent 68a20504ee
commit 16f1e31314

View file

@ -43,6 +43,9 @@ public class TheEndBiomeSourceMixin extends BiomeSourceMixin {
@Unique @Unique
private boolean biomeSetModified = false; private boolean biomeSetModified = false;
@Unique
private boolean hasCheckedForModifiedSet = false;
@Inject(method = "<init>", at = @At("RETURN")) @Inject(method = "<init>", at = @At("RETURN"))
private void init(Registry<Biome> biomeRegistry, CallbackInfo ci) { private void init(Registry<Biome> biomeRegistry, CallbackInfo ci) {
overrides = Suppliers.memoize(() -> TheEndBiomeData.createOverrides(biomeRegistry)); overrides = Suppliers.memoize(() -> TheEndBiomeData.createOverrides(biomeRegistry));
@ -55,8 +58,12 @@ public class TheEndBiomeSourceMixin extends BiomeSourceMixin {
@Override @Override
protected void fabric_modifyBiomeSet(Set<RegistryEntry<Biome>> biomes) { protected void fabric_modifyBiomeSet(Set<RegistryEntry<Biome>> biomes) {
if (!biomeSetModified) { if (!hasCheckedForModifiedSet) {
biomeSetModified = true; hasCheckedForModifiedSet = true;
biomeSetModified = !overrides.get().customBiomes.isEmpty();
}
if (biomeSetModified) {
biomes.addAll(overrides.get().customBiomes); biomes.addAll(overrides.get().customBiomes);
} }
} }