Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.pattern.RandomStatePattern;
import com.sk89q.worldedit.function.pattern.RandomPattern;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.FuzzyBlockState;

import java.util.Collections;
Expand Down Expand Up @@ -66,8 +67,15 @@ public Pattern parseFromInput(String input, ParserContext context) throws InputP
if (block.getStates().size() == block.getBlockType().getPropertyMap().size()) {
// they requested random with *, but didn't leave any states empty - simplify
return block;
} else if (block.toImmutableState() instanceof FuzzyBlockState) {
return new RandomStatePattern((FuzzyBlockState) block.toImmutableState());
// FAWE start - use RandomPattern instead of RandomStatePattern
} else if (block.toImmutableState() instanceof FuzzyBlockState fbs) {
RandomPattern randomPattern = new RandomPattern();
fbs.getBlockType().getAllStates().stream()
.filter(fbs::equalsFuzzy)
.map(BlockState::toBaseBlock)
.forEach(bb -> randomPattern.add(bb, 1.0));
return randomPattern;
// FAWE end
} else {
return null; // only should happen if parseLogic changes
}
Expand Down
Loading