From 6b3426e1debd9b3dd7b3d0acf48bfd5941f09fae Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 26 Mar 2019 18:14:35 -0400 Subject: [PATCH] BaseBlock is technically mutable so that technically shouldn't use it. --- .../worldedit/function/pattern/RandomStatePattern.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java index f2e2870a9..698111dac 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomStatePattern.java @@ -31,15 +31,15 @@ import java.util.stream.Collectors; public class RandomStatePattern implements Pattern { private final Random rand = new Random(); - private final List blocks; + private final List blocks; public RandomStatePattern(FuzzyBlockState state) { blocks = state.getBlockType().getAllStates().stream().filter(state::equalsFuzzy) - .map(BlockState::toBaseBlock).collect(Collectors.toList()); + .collect(Collectors.toList()); } @Override public BaseBlock apply(BlockVector3 position) { - return blocks.get(rand.nextInt(blocks.size())); + return blocks.get(rand.nextInt(blocks.size())).toBaseBlock(); } }