Fix Cycler tool not using full block data (#1868)

(cherry picked from commit 8ee45137aa5d7a3b80b661601ab14e48f13756ec)
This commit is contained in:
Maddy Miller 2021-08-09 01:23:44 +10:00 committed by dordsor21
parent 6562f8adbd
commit f06ba41f91
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -34,7 +34,7 @@ import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BaseBlock;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.HashMap; import java.util.HashMap;
@ -62,7 +62,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
World world = (World) clicked.getExtent(); World world = (World) clicked.getExtent();
BlockVector3 blockPoint = clicked.toVector().toBlockPoint(); BlockVector3 blockPoint = clicked.toVector().toBlockPoint();
BlockState block = world.getBlock(blockPoint); BaseBlock block = world.getFullBlock(blockPoint);
if (!config.allowedDataCycleBlocks.isEmpty() if (!config.allowedDataCycleBlocks.isEmpty()
&& !player.hasPermission("worldedit.override.data-cycler") && !player.hasPermission("worldedit.override.data-cycler")
@ -87,7 +87,7 @@ public class BlockDataCyler implements DoubleActionBlockTool {
index = (index + 1) % currentProperty.getValues().size(); index = (index + 1) % currentProperty.getValues().size();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Property<Object> objProp = (Property<Object>) currentProperty; Property<Object> objProp = (Property<Object>) currentProperty;
BlockState newBlock = block.with(objProp, currentProperty.getValues().get(index)); BaseBlock newBlock = block.with(objProp, currentProperty.getValues().get(index));
try (EditSession editSession = session.createEditSession(player)) { try (EditSession editSession = session.createEditSession(player)) {
try { try {