mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-14 13:13:53 +00:00
Fixed the fuzzy matcher
This commit is contained in:
@ -21,7 +21,8 @@ package com.sk89q.worldedit.extent.transform;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockData;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||
@ -42,37 +43,46 @@ public class BlockTransformExtentTest {
|
||||
|
||||
private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90);
|
||||
private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90);
|
||||
private final Set<BlockType> ignored = new HashSet<BlockType>();
|
||||
private final Set<BlockType> ignored = new HashSet<>();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
ignored.add(BlockType.BED); // Broken in existing rotation code?
|
||||
ignored.add(BlockType.WOODEN_DOOR); // Complicated
|
||||
ignored.add(BlockType.IRON_DOOR); // Complicated
|
||||
ignored.add(BlockType.END_PORTAL); // Not supported in existing rotation code
|
||||
ignored.add(BlockTypes.BLACK_BED); // Broken in existing rotation code?
|
||||
ignored.add(BlockTypes.BLUE_BED); // Complicated
|
||||
ignored.add(BlockTypes.BROWN_BED); // Complicated
|
||||
ignored.add(BlockTypes.CYAN_BED); // Complicated
|
||||
ignored.add(BlockTypes.GRAY_BED); // Complicated
|
||||
ignored.add(BlockTypes.GREEN_BED); // Complicated
|
||||
ignored.add(BlockTypes.LIGHT_BLUE_BED); // Complicated
|
||||
ignored.add(BlockTypes.LIGHT_GRAY_BED); // Complicated
|
||||
ignored.add(BlockTypes.LIME_BED); // Complicated
|
||||
ignored.add(BlockTypes.OAK_DOOR); // Complicated
|
||||
ignored.add(BlockTypes.IRON_DOOR); // Complicated
|
||||
ignored.add(BlockTypes.END_PORTAL); // Not supported in existing rotation code
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransform() throws Exception {
|
||||
BlockRegistry blockRegistry = new BundledBlockRegistry();
|
||||
for (BlockType type : BlockType.values()) {
|
||||
for (BlockType type : BlockTypes.values()) {
|
||||
if (ignored.contains(type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BaseBlock orig = new BaseBlock(type.getID());
|
||||
BaseBlock orig = new BaseBlock(type);
|
||||
for (int i = 1; i < 4; i++) {
|
||||
BaseBlock rotated = BlockTransformExtent.transform(new BaseBlock(orig), ROTATE_90, blockRegistry);
|
||||
BaseBlock reference = new BaseBlock(orig.getType(), BlockData.rotate90(orig.getType().getLegacyId(), orig.getData()));
|
||||
assertThat(type + "#" + type.getID() + " rotated " + (90 * i) + " degrees did not match BlockData.rotate90()'s expected result", rotated, equalTo(reference));
|
||||
BaseBlock reference = new BaseBlock(orig.getType().getLegacyId(), BlockData.rotate90(orig.getType().getLegacyId(), orig.getData()));
|
||||
assertThat(type + "#" + type.getId() + " rotated " + (90 * i) + " degrees did not match BlockData.rotate90()'s expected result", rotated,
|
||||
equalTo(reference));
|
||||
orig = rotated;
|
||||
}
|
||||
|
||||
orig = new BaseBlock(type.getID());
|
||||
orig = new BaseBlock(type);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
BaseBlock rotated = BlockTransformExtent.transform(new BaseBlock(orig), ROTATE_NEG_90, blockRegistry);
|
||||
BaseBlock reference = new BaseBlock(orig.getType(), BlockData.rotate90Reverse(orig.getType().getLegacyId(), orig.getData()));
|
||||
assertThat(type + "#" + type.getID() + " rotated " + (-90 * i) + " degrees did not match BlockData.rotate90Reverse()'s expected result", rotated, equalTo(reference));
|
||||
BaseBlock reference = new BaseBlock(orig.getType().getLegacyId(), BlockData.rotate90Reverse(orig.getType().getLegacyId(), orig.getData()));
|
||||
assertThat(type + "#" + type.getId() + " rotated " + (-90 * i) + " degrees did not match BlockData.rotate90Reverse()'s expected result", rotated, equalTo(reference));
|
||||
orig = rotated;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user