mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Update configs, and remove unused BlockData methods.
This commit is contained in:
@ -126,7 +126,7 @@ public abstract class LocalConfiguration {
|
||||
public String navigationWand = ItemTypes.COMPASS.getId();
|
||||
public int navigationWandMaxDistance = 50;
|
||||
public int scriptTimeout = 3000;
|
||||
public Set<Integer> allowedDataCycleBlocks = new HashSet<>();
|
||||
public Set<String> allowedDataCycleBlocks = new HashSet<>();
|
||||
public String saveDir = "schematics";
|
||||
public String scriptsDir = "craftscripts";
|
||||
public boolean showHelpInfo = true;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,15 +29,11 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@Deprecated
|
||||
public final class BlockID {
|
||||
public static final int SAPLING = 6;
|
||||
public static final int LOG = 17;
|
||||
public static final int DISPENSER = 23;
|
||||
public static final int BED = 26;
|
||||
public static final int POWERED_RAIL = 27; // GOLDEN_RAIL
|
||||
public static final int DETECTOR_RAIL = 28;
|
||||
public static final int PISTON_STICKY_BASE = 29; // STICKY_PISTON
|
||||
public static final int LONG_GRASS = 31; // TALLGRASS
|
||||
public static final int DEAD_BUSH = 32; // DEADBUSH
|
||||
public static final int PISTON_BASE = 33; // PISTON
|
||||
public static final int PISTON_EXTENSION = 34; // PISTON_HEAD
|
||||
public static final int YELLOW_FLOWER = 37;
|
||||
public static final int RED_FLOWER = 38;
|
||||
@ -45,17 +41,12 @@ public final class BlockID {
|
||||
public static final int RED_MUSHROOM = 40;
|
||||
public static final int STEP = 44; // STONE_SLAB
|
||||
public static final int TORCH = 50;
|
||||
public static final int OAK_WOOD_STAIRS = 53; // OAK_STAIRS
|
||||
public static final int CHEST = 54;
|
||||
public static final int REDSTONE_WIRE = 55;
|
||||
public static final int CROPS = 59; // WHEAT
|
||||
public static final int FURNACE = 61;
|
||||
public static final int BURNING_FURNACE = 62; // LIT_FURNACE
|
||||
public static final int SIGN_POST = 63; // STANDING_SIGN
|
||||
public static final int WOODEN_DOOR = 64; // WOODEN_DOOR
|
||||
public static final int LADDER = 65;
|
||||
public static final int MINECART_TRACKS = 66; // RAIL
|
||||
public static final int COBBLESTONE_STAIRS = 67; // STONE_STAIRS
|
||||
public static final int WALL_SIGN = 68;
|
||||
public static final int LEVER = 69;
|
||||
public static final int STONE_PRESSURE_PLATE = 70;
|
||||
@ -68,23 +59,16 @@ public final class BlockID {
|
||||
public static final int CACTUS = 81;
|
||||
public static final int REED = 83; // REEDS
|
||||
public static final int FENCE = 85;
|
||||
public static final int PUMPKIN = 86;
|
||||
public static final int SLOW_SAND = 88; // SOUL_SAND
|
||||
public static final int JACKOLANTERN = 91; // LIT_PUMPKIN
|
||||
public static final int CAKE_BLOCK = 92; // CAKE
|
||||
public static final int REDSTONE_REPEATER_OFF = 93; // UNPOWERED_REPEATER
|
||||
public static final int REDSTONE_REPEATER_ON = 94; // POWERED_REPEATER
|
||||
public static final int TRAP_DOOR = 96; // TRAPDOOR
|
||||
public static final int BROWN_MUSHROOM_CAP = 99; // BROWN_MUSHROOM_BLOCK
|
||||
public static final int RED_MUSHROOM_CAP = 100; // RED_MUSHROOM_BLOCK
|
||||
public static final int PUMPKIN_STEM = 104;
|
||||
public static final int MELON_STEM = 105;
|
||||
public static final int VINE = 106;
|
||||
public static final int FENCE_GATE = 107;
|
||||
public static final int BRICK_STAIRS = 108;
|
||||
public static final int STONE_BRICK_STAIRS = 109;
|
||||
public static final int LILY_PAD = 111; // WATERLILY
|
||||
public static final int NETHER_BRICK_STAIRS = 114;
|
||||
public static final int NETHER_WART = 115;
|
||||
public static final int ENCHANTMENT_TABLE = 116; // ENCHANTING_TABLE
|
||||
public static final int BREWING_STAND = 117;
|
||||
@ -92,13 +76,8 @@ public final class BlockID {
|
||||
public static final int END_PORTAL_FRAME = 120;
|
||||
public static final int WOODEN_STEP = 126; // WOODEN_SLAB
|
||||
public static final int COCOA_PLANT = 127; // COCOA
|
||||
public static final int SANDSTONE_STAIRS = 128;
|
||||
public static final int ENDER_CHEST = 130;
|
||||
public static final int TRIPWIRE_HOOK = 131;
|
||||
public static final int TRIPWIRE = 132;
|
||||
public static final int SPRUCE_WOOD_STAIRS = 134; // SPRUCE_STAIRS
|
||||
public static final int BIRCH_WOOD_STAIRS = 135; // BRUCE_STAIRS
|
||||
public static final int JUNGLE_WOOD_STAIRS = 136; // JUNGLE_STAIRS
|
||||
public static final int COBBLESTONE_WALL = 139;
|
||||
public static final int FLOWER_POT = 140;
|
||||
public static final int CARROTS = 141;
|
||||
@ -106,21 +85,14 @@ public final class BlockID {
|
||||
public static final int WOODEN_BUTTON = 143;
|
||||
public static final int HEAD = 144; // SKULL
|
||||
public static final int ANVIL = 145;
|
||||
public static final int TRAPPED_CHEST = 146;
|
||||
public static final int PRESSURE_PLATE_LIGHT = 147; // LIGHT_WEIGHTED_PRESSURE_PLATE
|
||||
public static final int PRESSURE_PLATE_HEAVY = 148; // HEAVY_WEIGHTED_PRESSURE_PLATE
|
||||
public static final int COMPARATOR_OFF = 149; // UNPOWERED_COMPARATOR
|
||||
public static final int COMPARATOR_ON = 150; // COMPARATOR
|
||||
public static final int DAYLIGHT_SENSOR = 151; // DAYLIGHT_DETECTOR
|
||||
public static final int HOPPER = 154;
|
||||
public static final int QUARTZ_STAIRS = 156;
|
||||
public static final int ACTIVATOR_RAIL = 157;
|
||||
public static final int DROPPER = 158;
|
||||
public static final int LOG2 = 162;
|
||||
public static final int ACACIA_STAIRS = 163;
|
||||
public static final int DARK_OAK_STAIRS = 164;
|
||||
public static final int IRON_TRAP_DOOR = 167;
|
||||
public static final int HAY_BLOCK = 170;
|
||||
public static final int CARPET = 171;
|
||||
public static final int DOUBLE_PLANT = 175;
|
||||
public static final int STANDING_BANNER = 176;
|
||||
|
@ -23,15 +23,12 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockData;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
||||
/**
|
||||
* A mode that cycles the data values of supported blocks.
|
||||
@ -49,24 +46,24 @@ public class BlockDataCyler implements DoubleActionBlockTool {
|
||||
World world = (World) clicked.getExtent();
|
||||
|
||||
BlockState block = world.getBlock(clicked.toVector());
|
||||
int[] datas = LegacyMapper.getInstance().getLegacyFromBlock(block);
|
||||
int type = datas[0];
|
||||
int data = datas[1];
|
||||
|
||||
if (!config.allowedDataCycleBlocks.isEmpty()
|
||||
&& !player.hasPermission("worldedit.override.data-cycler")
|
||||
&& !config.allowedDataCycleBlocks.contains(type)) {
|
||||
&& !config.allowedDataCycleBlocks.contains(block.getBlockType().getId())) {
|
||||
player.printError("You are not permitted to cycle the data value of that block.");
|
||||
return true;
|
||||
}
|
||||
|
||||
int increment = forward ? 1 : -1;
|
||||
BaseBlock newBlock = new BaseBlock(type, BlockData.cycle(type, data, increment));
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
if (newBlock.getData() < 0) {
|
||||
if (block.getStates().keySet().isEmpty()) {
|
||||
player.printError("That block's data cannot be cycled!");
|
||||
} else {
|
||||
BlockState newBlock = block;
|
||||
|
||||
// TODO Forward = cycle value, Backward = Next property
|
||||
// int increment = forward ? 1 : -1;
|
||||
// BaseBlock newBlock = new BaseBlock(type, BlockData.cycle(type, data, increment));
|
||||
EditSession editSession = session.createEditSession(player);
|
||||
|
||||
try {
|
||||
editSession.setBlock(clicked.toVector(), newBlock);
|
||||
} catch (MaxChangedBlocksException e) {
|
||||
|
@ -84,7 +84,7 @@ public class YAMLConfiguration extends LocalConfiguration {
|
||||
butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius));
|
||||
|
||||
disallowedBlocks = new HashSet<>(config.getStringList("limits.disallowed-blocks", Lists.newArrayList(defaultDisallowedBlocks)));
|
||||
allowedDataCycleBlocks = new HashSet<>(config.getIntList("limits.allowed-data-cycle-blocks", null));
|
||||
allowedDataCycleBlocks = new HashSet<>(config.getStringList("limits.allowed-data-cycle-blocks", null));
|
||||
|
||||
registerHelp = config.getBoolean("register-help", true);
|
||||
logCommands = config.getBoolean("logging.log-commands", logCommands);
|
||||
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
// TODO FIX
|
||||
public class CuboidClipboardTest {
|
||||
// @Test
|
||||
// public void testFlipCenterPlane() throws Exception {
|
||||
// testFlip(0, 1, CuboidClipboard.FlipDirection.UP_DOWN);
|
||||
// testFlip(2, 3, CuboidClipboard.FlipDirection.NORTH_SOUTH);
|
||||
// testFlip(4, 5, CuboidClipboard.FlipDirection.WEST_EAST);
|
||||
// }
|
||||
//
|
||||
// private void testFlip(int data, int expectedDataAfterFlip, CuboidClipboard.FlipDirection flipDirection) {
|
||||
// BlockType blockType = new BlockType("minecraft:piston_base");
|
||||
// final CuboidClipboard clipboard = new CuboidClipboard(new Vector(1, 1, 1));
|
||||
// clipboard.setBlock(Vector.ZERO, new BaseBlock(blockType, data));
|
||||
// clipboard.flip(flipDirection);
|
||||
// assertEquals(expectedDataAfterFlip, clipboard.getBlock(Vector.ZERO).getData());
|
||||
// }
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.blocks;
|
||||
|
||||
import com.sk89q.worldedit.CuboidClipboard.FlipDirection;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.TreeSet;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class BlockDataTest {
|
||||
|
||||
@Test
|
||||
public void testRotateFlip() {
|
||||
for (int type = 0; type < 256; ++type) {
|
||||
for (int data = 0; data < 16; ++data) {
|
||||
final String message = type + "/" + data;
|
||||
|
||||
//Test r90(r-90(x))==x
|
||||
assertEquals(message, data, BlockData.rotate90(type, BlockData.rotate90Reverse(type, data)));
|
||||
//Test r-90(r90(x))==x
|
||||
assertEquals(message, data, BlockData.rotate90Reverse(type, BlockData.rotate90(type, data)));
|
||||
|
||||
final int flipped = BlockData.flip(type, BlockData.flip(type, data, FlipDirection.WEST_EAST), FlipDirection.NORTH_SOUTH);
|
||||
|
||||
//Test r90(r90(x))==flipNS(flipWE(x))
|
||||
assertEquals(message, flipped, BlockData.rotate90(type, BlockData.rotate90(type, data)));
|
||||
//Test r-90(r-90(x))==flipNS(flipWE(x))
|
||||
assertEquals(message, flipped, BlockData.rotate90Reverse(type, BlockData.rotate90Reverse(type, data)));
|
||||
|
||||
//Test flipNS(flipNS(x))==x
|
||||
assertEquals(message, data, BlockData.flip(type, BlockData.flip(type, data, FlipDirection.NORTH_SOUTH), FlipDirection.NORTH_SOUTH));
|
||||
//Test flipWE(flipWE(x))==x
|
||||
assertEquals(message, data, BlockData.flip(type, BlockData.flip(type, data, FlipDirection.WEST_EAST), FlipDirection.WEST_EAST));
|
||||
//Test flipUD(flipUD(x))==x
|
||||
assertEquals(message, data, BlockData.flip(type, BlockData.flip(type, data, FlipDirection.UP_DOWN), FlipDirection.UP_DOWN));
|
||||
|
||||
//Test r90(r90(r90(r90(x))))==x
|
||||
assertEquals(message, data, BlockData.rotate90(type, BlockData.rotate90(type, BlockData.rotate90(type, BlockData.rotate90(type, data)))));
|
||||
//Test r-90(r-90(r-90(r-90(x))))==x
|
||||
assertEquals(message, data, BlockData.rotate90Reverse(type, BlockData.rotate90Reverse(type, BlockData.rotate90Reverse(type, BlockData.rotate90Reverse(type, data)))));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.extent.transform;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockData;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@Ignore("Old BlockData class needs to be updated manually. Current block definitions are in blocks.json, " +
|
||||
"which is automatically generated and generally accurate.")
|
||||
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<>();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
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 : BlockTypes.values()) {
|
||||
if (ignored.contains(type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BaseBlock orig = new BaseBlock(type);
|
||||
for (int i = 1; i < 4; i++) {
|
||||
BaseBlock rotated = BlockTransformExtent.transform(new BaseBlock(orig), ROTATE_90);
|
||||
BaseBlock reference = new BaseBlock(orig.getBlockType().getLegacyId(), BlockData.rotate90(orig.getBlockType().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);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
BaseBlock rotated = BlockTransformExtent.transform(new BaseBlock(orig), ROTATE_NEG_90);
|
||||
BaseBlock reference = new BaseBlock(orig.getBlockType().getLegacyId(), BlockData.rotate90Reverse(orig.getBlockType().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