mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Maintain insertion order for RandomPattern sub-patterns (#2603)
This commit is contained in:
parent
164271374b
commit
641297497a
@ -33,7 +33,7 @@ public abstract class RandomCollection<T> {
|
|||||||
public static <T> RandomCollection<T> of(Map<T, Double> weights, SimpleRandom random) {
|
public static <T> RandomCollection<T> of(Map<T, Double> weights, SimpleRandom random) {
|
||||||
checkNotNull(random);
|
checkNotNull(random);
|
||||||
return FastRandomCollection.create(weights, random)
|
return FastRandomCollection.create(weights, random)
|
||||||
.orElse(new SimpleRandomCollection<>(weights, random));
|
.orElseGet(() -> new SimpleRandomCollection<>(weights, random));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRandom(SimpleRandom random) {
|
public void setRandom(SimpleRandom random) {
|
||||||
|
@ -27,7 +27,7 @@ import com.sk89q.worldedit.extent.Extent;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -41,7 +41,7 @@ public class RandomPattern extends AbstractPattern {
|
|||||||
|
|
||||||
//FAWE start - SimpleRandom > Random, LHS<P> > List
|
//FAWE start - SimpleRandom > Random, LHS<P> > List
|
||||||
private final SimpleRandom random;
|
private final SimpleRandom random;
|
||||||
private Map<Pattern, Double> weights = new HashMap<>();
|
private Map<Pattern, Double> weights = new LinkedHashMap<>();
|
||||||
private RandomCollection<Pattern> collection;
|
private RandomCollection<Pattern> collection;
|
||||||
private LinkedHashSet<Pattern> patterns = new LinkedHashSet<>();
|
private LinkedHashSet<Pattern> patterns = new LinkedHashSet<>();
|
||||||
//FAWE end
|
//FAWE end
|
||||||
|
Loading…
Reference in New Issue
Block a user