|
24 | 24 | import com.sk89q.worldedit.extension.input.InputParseException; |
25 | 25 | import com.sk89q.worldedit.extension.input.ParserContext; |
26 | 26 | import com.sk89q.worldedit.function.pattern.Pattern; |
27 | | -import com.sk89q.worldedit.function.pattern.RandomStatePattern; |
| 27 | +import com.sk89q.worldedit.function.pattern.RandomPattern; |
28 | 28 | import com.sk89q.worldedit.internal.registry.InputParser; |
29 | 29 | import com.sk89q.worldedit.world.block.BaseBlock; |
| 30 | +import com.sk89q.worldedit.world.block.BlockState; |
30 | 31 | import com.sk89q.worldedit.world.block.FuzzyBlockState; |
31 | 32 |
|
32 | 33 | import java.util.Collections; |
@@ -66,8 +67,15 @@ public Pattern parseFromInput(String input, ParserContext context) throws InputP |
66 | 67 | if (block.getStates().size() == block.getBlockType().getPropertyMap().size()) { |
67 | 68 | // they requested random with *, but didn't leave any states empty - simplify |
68 | 69 | return block; |
69 | | - } else if (block.toImmutableState() instanceof FuzzyBlockState) { |
70 | | - return new RandomStatePattern((FuzzyBlockState) block.toImmutableState()); |
| 70 | + // FAWE start - use RandomPattern instead of RandomStatePattern |
| 71 | + } else if (block.toImmutableState() instanceof FuzzyBlockState fbs) { |
| 72 | + RandomPattern randomPattern = new RandomPattern(); |
| 73 | + fbs.getBlockType().getAllStates().stream() |
| 74 | + .filter(fbs::equalsFuzzy) |
| 75 | + .map(BlockState::toBaseBlock) |
| 76 | + .forEach(bb -> randomPattern.add(bb, 1.0)); |
| 77 | + return randomPattern; |
| 78 | + // FAWE end |
71 | 79 | } else { |
72 | 80 | return null; // only should happen if parseLogic changes |
73 | 81 | } |
|
0 commit comments