Skip to content

Commit

Permalink
Fix inconsistency of placed feature locations
Browse files Browse the repository at this point in the history
`BiomeSource#getBiomes` mixin applies to all biome sources, including one for Overworld.
The return value is a set; however one caller in the worldgen code iterates over it: `PlacedFeatureIndexer`.
Using a hash set here randomizes the return value, affecting feature placement.
Use a linked hash set instead.
  • Loading branch information
apple502j committed Oct 7, 2023
1 parent 670b2ea commit 2d3e4ff
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package net.fabricmc.fabric.mixin.biome;

import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.function.Supplier;

Expand All @@ -33,7 +33,7 @@
public class BiomeSourceMixin {
@Redirect(method = "getBiomes", at = @At(value = "INVOKE", target = "Ljava/util/function/Supplier;get()Ljava/lang/Object;"))
private Object getBiomes(Supplier<Set<RegistryEntry<Biome>>> instance) {
var biomes = new HashSet<>(instance.get());
var biomes = new LinkedHashSet<>(instance.get());
fabric_modifyBiomeSet(biomes);
return Collections.unmodifiableSet(biomes);
}
Expand Down

0 comments on commit 2d3e4ff

Please sign in to comment.