Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
BaseBlock is technically mutable so that technically shouldn't use it.
Dieser Commit ist enthalten in:
Ursprung
2a194b0434
Commit
6b3426e1de
@ -31,15 +31,15 @@ import java.util.stream.Collectors;
|
|||||||
public class RandomStatePattern implements Pattern {
|
public class RandomStatePattern implements Pattern {
|
||||||
|
|
||||||
private final Random rand = new Random();
|
private final Random rand = new Random();
|
||||||
private final List<BaseBlock> blocks;
|
private final List<BlockState> blocks;
|
||||||
|
|
||||||
public RandomStatePattern(FuzzyBlockState state) {
|
public RandomStatePattern(FuzzyBlockState state) {
|
||||||
blocks = state.getBlockType().getAllStates().stream().filter(state::equalsFuzzy)
|
blocks = state.getBlockType().getAllStates().stream().filter(state::equalsFuzzy)
|
||||||
.map(BlockState::toBaseBlock).collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock apply(BlockVector3 position) {
|
public BaseBlock apply(BlockVector3 position) {
|
||||||
return blocks.get(rand.nextInt(blocks.size()));
|
return blocks.get(rand.nextInt(blocks.size())).toBaseBlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren