Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 02:50:06 +01:00
Maintain insertion order for RandomPattern sub-patterns (#2603)
Dieser Commit ist enthalten in:
Ursprung
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
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren