Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Cleanup a little bit more code.
Dieser Commit ist enthalten in:
Ursprung
526aa6cf49
Commit
5f4cc3e694
@ -21,7 +21,7 @@ buildscript {
|
|||||||
|
|
||||||
configurations.all {
|
configurations.all {
|
||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
force 'com.google.guava:guava:20.0'
|
force 'com.google.guava:guava:21.0'
|
||||||
force 'org.ow2.asm:asm:6.0_BETA'
|
force 'org.ow2.asm:asm:6.0_BETA'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ apply plugin: 'idea'
|
|||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
|
||||||
maven { url "https://hub.spigotmc.org/nexus/content/groups/public" }
|
maven { url "https://hub.spigotmc.org/nexus/content/groups/public" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ dependencies {
|
|||||||
compile 'com.sk89q:jchronic:0.2.4a'
|
compile 'com.sk89q:jchronic:0.2.4a'
|
||||||
compile 'com.google.code.findbugs:jsr305:1.3.9'
|
compile 'com.google.code.findbugs:jsr305:1.3.9'
|
||||||
compile 'com.thoughtworks.paranamer:paranamer:2.6'
|
compile 'com.thoughtworks.paranamer:paranamer:2.6'
|
||||||
compile 'com.google.code.gson:gson:2.2.4'
|
compile 'com.google.code.gson:gson:2.8.0'
|
||||||
compile 'com.sk89q.lib:jlibnoise:1.0.0'
|
compile 'com.sk89q.lib:jlibnoise:1.0.0'
|
||||||
//compile 'net.sf.trove4j:trove4j:3.0.3'
|
//compile 'net.sf.trove4j:trove4j:3.0.3'
|
||||||
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
|
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
|
||||||
|
@ -117,7 +117,7 @@ public class MobSpawnerBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getNbtData() {
|
public CompoundTag getNbtData() {
|
||||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
Map<String, Tag> values = new HashMap<>();
|
||||||
values.put("EntityId", new StringTag(mobType));
|
values.put("EntityId", new StringTag(mobType));
|
||||||
values.put("Delay", new ShortTag(delay));
|
values.put("Delay", new ShortTag(delay));
|
||||||
values.put("SpawnCount", new ShortTag(spawnCount));
|
values.put("SpawnCount", new ShortTag(spawnCount));
|
||||||
|
@ -92,7 +92,7 @@ public class SignBlock extends BaseBlock implements TileEntityBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getNbtData() {
|
public CompoundTag getNbtData() {
|
||||||
Map<String, Tag> values = new HashMap<String, Tag>();
|
Map<String, Tag> values = new HashMap<>();
|
||||||
values.put("Text1", new StringTag(text[0]));
|
values.put("Text1", new StringTag(text[0]));
|
||||||
values.put("Text2", new StringTag(text[1]));
|
values.put("Text2", new StringTag(text[1]));
|
||||||
values.put("Text3", new StringTag(text[2]));
|
values.put("Text3", new StringTag(text[2]));
|
||||||
|
@ -107,6 +107,7 @@ import com.sk89q.worldedit.world.block.BlockState;
|
|||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -1785,7 +1786,7 @@ public class EditSession implements Extent {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BaseBlock((int) typeVariable.getValue(), (int) dataVariable.getValue());
|
return LegacyMapper.getInstance().getBlockFromLegacy((int) typeVariable.getValue(), (int) dataVariable.getValue());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.WARNING, "Failed to create shape", e);
|
log.log(Level.WARNING, "Failed to create shape", e);
|
||||||
return null;
|
return null;
|
||||||
|
@ -28,24 +28,22 @@ import com.sk89q.worldedit.util.Direction;
|
|||||||
*/
|
*/
|
||||||
public enum PlayerDirection {
|
public enum PlayerDirection {
|
||||||
|
|
||||||
NORTH(new Vector(0, 0, -1), new Vector(-1, 0, 0), true),
|
NORTH(new Vector(0, 0, -1), true),
|
||||||
NORTH_EAST((new Vector(1, 0, -1)).normalize(), (new Vector(-1, 0, -1)).normalize(), false),
|
NORTH_EAST((new Vector(1, 0, -1)).normalize(), false),
|
||||||
EAST(new Vector(1, 0, 0), new Vector(0, 0, -1), true),
|
EAST(new Vector(1, 0, 0), true),
|
||||||
SOUTH_EAST((new Vector(1, 0, 1)).normalize(), (new Vector(1, 0, -1)).normalize(), false),
|
SOUTH_EAST((new Vector(1, 0, 1)).normalize(), false),
|
||||||
SOUTH(new Vector(0, 0, 1), new Vector(1, 0, 0), true),
|
SOUTH(new Vector(0, 0, 1), true),
|
||||||
SOUTH_WEST((new Vector(-1, 0, 1)).normalize(), (new Vector(1, 0, 1)).normalize(), false),
|
SOUTH_WEST((new Vector(-1, 0, 1)).normalize(), false),
|
||||||
WEST(new Vector(-1, 0, 0), new Vector(0, 0, 1), true),
|
WEST(new Vector(-1, 0, 0), true),
|
||||||
NORTH_WEST((new Vector(-1, 0, -1)).normalize(), (new Vector(-1, 0, 1)).normalize(), false),
|
NORTH_WEST((new Vector(-1, 0, -1)).normalize(), false),
|
||||||
UP(new Vector(0, 1, 0), new Vector(0, 0, 1), true),
|
UP(new Vector(0, 1, 0), true),
|
||||||
DOWN(new Vector(0, -1, 0), new Vector(0, 0, 1), true);
|
DOWN(new Vector(0, -1, 0), true);
|
||||||
|
|
||||||
private final Vector dir;
|
private final Vector dir;
|
||||||
private final Vector leftDir;
|
|
||||||
private final boolean isOrthogonal;
|
private final boolean isOrthogonal;
|
||||||
|
|
||||||
PlayerDirection(Vector vec, Vector leftDir, boolean isOrthogonal) {
|
PlayerDirection(Vector vec, boolean isOrthogonal) {
|
||||||
this.dir = vec;
|
this.dir = vec;
|
||||||
this.leftDir = leftDir;
|
|
||||||
this.isOrthogonal = isOrthogonal;
|
this.isOrthogonal = isOrthogonal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,11 +51,6 @@ public enum PlayerDirection {
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public Vector leftVector() {
|
|
||||||
return leftDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOrthogonal() {
|
public boolean isOrthogonal() {
|
||||||
return isOrthogonal;
|
return isOrthogonal;
|
||||||
}
|
}
|
||||||
|
@ -83,25 +83,6 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
|||||||
this.nbtData = nbtData;
|
this.nbtData = nbtData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a block with the given ID and data value.
|
|
||||||
*
|
|
||||||
* @param id ID value
|
|
||||||
* @param data data value
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public BaseBlock(int id, int data) {
|
|
||||||
try {
|
|
||||||
this.blockState = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
|
||||||
if (this.blockState == null) {
|
|
||||||
this.blockState = BlockTypes.AIR.getDefaultState();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println(id);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a clone of another block.
|
* Create a clone of another block.
|
||||||
*
|
*
|
||||||
|
@ -28,81 +28,64 @@ import com.sk89q.worldedit.world.block.BlockTypes;
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final class BlockID {
|
public final class BlockID {
|
||||||
public static final int SAPLING = 6;
|
static final int SAPLING = 6;
|
||||||
public static final int BED = 26;
|
static final int POWERED_RAIL = 27; // GOLDEN_RAIL
|
||||||
public static final int POWERED_RAIL = 27; // GOLDEN_RAIL
|
static final int DETECTOR_RAIL = 28;
|
||||||
public static final int DETECTOR_RAIL = 28;
|
static final int LONG_GRASS = 31; // TALLGRASS
|
||||||
public static final int LONG_GRASS = 31; // TALLGRASS
|
static final int DEAD_BUSH = 32; // DEADBUSH
|
||||||
public static final int DEAD_BUSH = 32; // DEADBUSH
|
static final int PISTON_EXTENSION = 34; // PISTON_HEAD
|
||||||
public static final int PISTON_EXTENSION = 34; // PISTON_HEAD
|
static final int YELLOW_FLOWER = 37;
|
||||||
public static final int YELLOW_FLOWER = 37;
|
static final int RED_FLOWER = 38;
|
||||||
public static final int RED_FLOWER = 38;
|
static final int BROWN_MUSHROOM = 39;
|
||||||
public static final int BROWN_MUSHROOM = 39;
|
static final int RED_MUSHROOM = 40;
|
||||||
public static final int RED_MUSHROOM = 40;
|
static final int TORCH = 50;
|
||||||
public static final int STEP = 44; // STONE_SLAB
|
static final int REDSTONE_WIRE = 55;
|
||||||
public static final int TORCH = 50;
|
static final int CROPS = 59; // WHEAT
|
||||||
public static final int REDSTONE_WIRE = 55;
|
static final int SIGN_POST = 63; // STANDING_SIGN
|
||||||
public static final int CROPS = 59; // WHEAT
|
static final int WOODEN_DOOR = 64; // WOODEN_DOOR
|
||||||
public static final int SIGN_POST = 63; // STANDING_SIGN
|
static final int LADDER = 65;
|
||||||
public static final int WOODEN_DOOR = 64; // WOODEN_DOOR
|
static final int MINECART_TRACKS = 66; // RAIL
|
||||||
public static final int LADDER = 65;
|
static final int WALL_SIGN = 68;
|
||||||
public static final int MINECART_TRACKS = 66; // RAIL
|
static final int LEVER = 69;
|
||||||
public static final int WALL_SIGN = 68;
|
static final int STONE_PRESSURE_PLATE = 70;
|
||||||
public static final int LEVER = 69;
|
static final int IRON_DOOR = 71;
|
||||||
public static final int STONE_PRESSURE_PLATE = 70;
|
static final int WOODEN_PRESSURE_PLATE = 72;
|
||||||
public static final int IRON_DOOR = 71;
|
static final int REDSTONE_TORCH_OFF = 75; // UNLIT_REDSTONE_TORCH
|
||||||
public static final int WOODEN_PRESSURE_PLATE = 72;
|
static final int REDSTONE_TORCH_ON = 76; // LIT_REDSTONE_TORCH
|
||||||
public static final int REDSTONE_TORCH_OFF = 75; // UNLIT_REDSTONE_TORCH
|
static final int STONE_BUTTON = 77;
|
||||||
public static final int REDSTONE_TORCH_ON = 76; // LIT_REDSTONE_TORCH
|
static final int CACTUS = 81;
|
||||||
public static final int STONE_BUTTON = 77;
|
static final int REED = 83; // REEDS
|
||||||
public static final int SNOW = 78; // SNOW_LAYER
|
static final int CAKE_BLOCK = 92; // CAKE
|
||||||
public static final int CACTUS = 81;
|
static final int REDSTONE_REPEATER_OFF = 93; // UNPOWERED_REPEATER
|
||||||
public static final int REED = 83; // REEDS
|
static final int REDSTONE_REPEATER_ON = 94; // POWERED_REPEATER
|
||||||
public static final int FENCE = 85;
|
static final int TRAP_DOOR = 96; // TRAPDOOR
|
||||||
public static final int SLOW_SAND = 88; // SOUL_SAND
|
static final int PUMPKIN_STEM = 104;
|
||||||
public static final int CAKE_BLOCK = 92; // CAKE
|
static final int MELON_STEM = 105;
|
||||||
public static final int REDSTONE_REPEATER_OFF = 93; // UNPOWERED_REPEATER
|
static final int VINE = 106;
|
||||||
public static final int REDSTONE_REPEATER_ON = 94; // POWERED_REPEATER
|
static final int NETHER_WART = 115;
|
||||||
public static final int TRAP_DOOR = 96; // TRAPDOOR
|
static final int COCOA_PLANT = 127; // COCOA
|
||||||
public static final int PUMPKIN_STEM = 104;
|
static final int TRIPWIRE_HOOK = 131;
|
||||||
public static final int MELON_STEM = 105;
|
static final int TRIPWIRE = 132;
|
||||||
public static final int VINE = 106;
|
static final int FLOWER_POT = 140;
|
||||||
public static final int FENCE_GATE = 107;
|
static final int CARROTS = 141;
|
||||||
public static final int LILY_PAD = 111; // WATERLILY
|
static final int POTATOES = 142;
|
||||||
public static final int NETHER_WART = 115;
|
static final int WOODEN_BUTTON = 143;
|
||||||
public static final int ENCHANTMENT_TABLE = 116; // ENCHANTING_TABLE
|
static final int ANVIL = 145;
|
||||||
public static final int BREWING_STAND = 117;
|
static final int PRESSURE_PLATE_LIGHT = 147; // LIGHT_WEIGHTED_PRESSURE_PLATE
|
||||||
public static final int CAULDRON = 118;
|
static final int PRESSURE_PLATE_HEAVY = 148; // HEAVY_WEIGHTED_PRESSURE_PLATE
|
||||||
public static final int END_PORTAL_FRAME = 120;
|
static final int COMPARATOR_OFF = 149; // UNPOWERED_COMPARATOR
|
||||||
public static final int WOODEN_STEP = 126; // WOODEN_SLAB
|
static final int COMPARATOR_ON = 150; // COMPARATOR
|
||||||
public static final int COCOA_PLANT = 127; // COCOA
|
static final int ACTIVATOR_RAIL = 157;
|
||||||
public static final int TRIPWIRE_HOOK = 131;
|
static final int IRON_TRAP_DOOR = 167;
|
||||||
public static final int TRIPWIRE = 132;
|
static final int CARPET = 171;
|
||||||
public static final int COBBLESTONE_WALL = 139;
|
static final int DOUBLE_PLANT = 175;
|
||||||
public static final int FLOWER_POT = 140;
|
static final int STANDING_BANNER = 176;
|
||||||
public static final int CARROTS = 141;
|
static final int WALL_BANNER = 177;
|
||||||
public static final int POTATOES = 142;
|
static final int SPRUCE_DOOR = 193;
|
||||||
public static final int WOODEN_BUTTON = 143;
|
static final int BIRCH_DOOR = 194;
|
||||||
public static final int HEAD = 144; // SKULL
|
static final int JUNGLE_DOOR = 195;
|
||||||
public static final int ANVIL = 145;
|
static final int ACACIA_DOOR = 196;
|
||||||
public static final int PRESSURE_PLATE_LIGHT = 147; // LIGHT_WEIGHTED_PRESSURE_PLATE
|
static final int DARK_OAK_DOOR = 197;
|
||||||
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 ACTIVATOR_RAIL = 157;
|
|
||||||
public static final int IRON_TRAP_DOOR = 167;
|
|
||||||
public static final int CARPET = 171;
|
|
||||||
public static final int DOUBLE_PLANT = 175;
|
|
||||||
public static final int STANDING_BANNER = 176;
|
|
||||||
public static final int WALL_BANNER = 177;
|
|
||||||
public static final int STEP2 = 182;
|
|
||||||
public static final int SPRUCE_DOOR = 193;
|
|
||||||
public static final int BIRCH_DOOR = 194;
|
|
||||||
public static final int JUNGLE_DOOR = 195;
|
|
||||||
public static final int ACACIA_DOOR = 196;
|
|
||||||
public static final int DARK_OAK_DOOR = 197;
|
|
||||||
|
|
||||||
private BlockID() {
|
private BlockID() {
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.blocks;
|
package com.sk89q.worldedit.blocks;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.PlayerDirection;
|
import com.sk89q.worldedit.PlayerDirection;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -37,95 +34,6 @@ public enum BlockType {
|
|||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
|
||||||
* HashSet for centralTopLimit.
|
|
||||||
*/
|
|
||||||
private static final Map<Integer, Double> centralTopLimit = new HashMap<>();
|
|
||||||
static {
|
|
||||||
centralTopLimit.put(BlockID.BED, 0.5625);
|
|
||||||
centralTopLimit.put(BlockID.BREWING_STAND, 0.875);
|
|
||||||
centralTopLimit.put(BlockID.CAKE_BLOCK, 0.4375);
|
|
||||||
for (int data = 6; data < 16; ++data) {
|
|
||||||
centralTopLimit.put(-16*BlockID.CAKE_BLOCK-data, 0.0);
|
|
||||||
}
|
|
||||||
centralTopLimit.put(BlockID.CAULDRON, 0.3125);
|
|
||||||
centralTopLimit.put(BlockID.COCOA_PLANT, 0.750);
|
|
||||||
centralTopLimit.put(BlockID.ENCHANTMENT_TABLE, 0.75);
|
|
||||||
for (int data = 0; data < 16; ++data) {
|
|
||||||
if ((data & 4) != 0) {
|
|
||||||
centralTopLimit.put(-16*BlockID.END_PORTAL_FRAME-data, 1.0);
|
|
||||||
} else {
|
|
||||||
centralTopLimit.put(-16*BlockID.END_PORTAL_FRAME-data, 0.8125);
|
|
||||||
}
|
|
||||||
centralTopLimit.put(-16*BlockID.HEAD-data, 0.75);
|
|
||||||
}
|
|
||||||
// Heads on the floor are lower
|
|
||||||
centralTopLimit.put(-16*BlockID.HEAD-1, 0.5);
|
|
||||||
centralTopLimit.put(-16*BlockID.HEAD-9, 0.5);
|
|
||||||
centralTopLimit.put(BlockID.FENCE, 1.5);
|
|
||||||
for (int data = 0; data < 8; ++data) {
|
|
||||||
centralTopLimit.put(-16*BlockID.STEP-data, 0.5);
|
|
||||||
centralTopLimit.put(-16*BlockID.WOODEN_STEP-data, 0.5);
|
|
||||||
centralTopLimit.put(-16*BlockID.STEP2-data, 0.5);
|
|
||||||
centralTopLimit.put(-16*BlockID.SNOW-data, 0.125*data);
|
|
||||||
centralTopLimit.put(-16*BlockID.SNOW-(data+8), 0.125*data);
|
|
||||||
}
|
|
||||||
centralTopLimit.put(BlockID.LILY_PAD, 0.015625);
|
|
||||||
centralTopLimit.put(BlockID.REDSTONE_REPEATER_ON, .125);
|
|
||||||
centralTopLimit.put(BlockID.REDSTONE_REPEATER_OFF, .125);
|
|
||||||
for (int data = 0; data < 4; ++data) {
|
|
||||||
centralTopLimit.put(-16*BlockID.TRAP_DOOR-(data+ 0), 0.1875); // closed lower trap doors
|
|
||||||
centralTopLimit.put(-16*BlockID.TRAP_DOOR-(data+ 4), 0.0); // opened lower trap doors
|
|
||||||
centralTopLimit.put(-16*BlockID.TRAP_DOOR-(data+ 8), 1.0); // closed upper trap doors
|
|
||||||
centralTopLimit.put(-16*BlockID.TRAP_DOOR-(data+12), 0.0); // opened upper trap doors
|
|
||||||
|
|
||||||
centralTopLimit.put(-16*BlockID.FENCE_GATE-(data+ 0), 1.5);
|
|
||||||
centralTopLimit.put(-16*BlockID.FENCE_GATE-(data+ 4), 0.0);
|
|
||||||
centralTopLimit.put(-16*BlockID.FENCE_GATE-(data+ 8), 1.5);
|
|
||||||
centralTopLimit.put(-16*BlockID.FENCE_GATE-(data+12), 0.0);
|
|
||||||
}
|
|
||||||
centralTopLimit.put(BlockID.SLOW_SAND, 0.875);
|
|
||||||
centralTopLimit.put(BlockID.COBBLESTONE_WALL, 1.5);
|
|
||||||
centralTopLimit.put(BlockID.FLOWER_POT, 0.375);
|
|
||||||
centralTopLimit.put(BlockID.COMPARATOR_OFF, .125);
|
|
||||||
centralTopLimit.put(BlockID.COMPARATOR_ON, .125);
|
|
||||||
centralTopLimit.put(BlockID.DAYLIGHT_SENSOR, 0.375);
|
|
||||||
centralTopLimit.put(BlockID.HOPPER, 0.625);
|
|
||||||
|
|
||||||
// Some default values to be used if no data value is given
|
|
||||||
centralTopLimit.put(BlockID.HEAD, 0.75);
|
|
||||||
centralTopLimit.put(BlockID.TRAP_DOOR, 1.0);
|
|
||||||
centralTopLimit.put(BlockID.FENCE_GATE, 1.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the y offset a player falls to when falling onto the top of a block at xp+0.5/zp+0.5.
|
|
||||||
*
|
|
||||||
* @param id the block ID
|
|
||||||
* @param data the block data value
|
|
||||||
* @return the y offset
|
|
||||||
*/
|
|
||||||
public static double centralTopLimit(int id, int data) {
|
|
||||||
if (centralTopLimit.containsKey(-16*id-data))
|
|
||||||
return centralTopLimit.get(-16*id-data);
|
|
||||||
|
|
||||||
if (centralTopLimit.containsKey(id))
|
|
||||||
return centralTopLimit.get(id);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the y offset a player falls to when falling onto the top of a block at xp+0.5/zp+0.5.
|
|
||||||
*
|
|
||||||
* @param block the block
|
|
||||||
* @return the y offset
|
|
||||||
*/
|
|
||||||
public static double centralTopLimit(BlockStateHolder block) {
|
|
||||||
checkNotNull(block);
|
|
||||||
return centralTopLimit(block.getBlockType().getLegacyId(), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Map<Integer, PlayerDirection> dataAttachments = new HashMap<>();
|
private static final Map<Integer, PlayerDirection> dataAttachments = new HashMap<>();
|
||||||
private static final Map<Integer, PlayerDirection> nonDataAttachments = new HashMap<>();
|
private static final Map<Integer, PlayerDirection> nonDataAttachments = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
|
@ -221,32 +221,6 @@ public class ClipboardCommands {
|
|||||||
player.print("The clipboard copy has been flipped.");
|
player.print("The clipboard copy has been flipped.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
|
||||||
aliases = { "/load" },
|
|
||||||
usage = "<filename>",
|
|
||||||
desc = "Load a schematic into your clipboard",
|
|
||||||
min = 0,
|
|
||||||
max = 1
|
|
||||||
)
|
|
||||||
@Deprecated
|
|
||||||
@CommandPermissions("worldedit.clipboard.load")
|
|
||||||
public void load(Actor actor) {
|
|
||||||
actor.printError("This command is no longer used. See //schematic load.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command(
|
|
||||||
aliases = { "/save" },
|
|
||||||
usage = "<filename>",
|
|
||||||
desc = "Save a schematic into your clipboard",
|
|
||||||
min = 0,
|
|
||||||
max = 1
|
|
||||||
)
|
|
||||||
@Deprecated
|
|
||||||
@CommandPermissions("worldedit.clipboard.save")
|
|
||||||
public void save(Actor actor) {
|
|
||||||
actor.printError("This command is no longer used. See //schematic save.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
aliases = { "clearclipboard" },
|
aliases = { "clearclipboard" },
|
||||||
usage = "",
|
usage = "",
|
||||||
|
@ -87,7 +87,6 @@ public class SchematicCommands {
|
|||||||
desc = "Load a schematic into your clipboard",
|
desc = "Load a schematic into your clipboard",
|
||||||
min = 1, max = 2
|
min = 1, max = 2
|
||||||
)
|
)
|
||||||
@Deprecated
|
|
||||||
@CommandPermissions({ "worldedit.clipboard.load", "worldedit.schematic.load" })
|
@CommandPermissions({ "worldedit.clipboard.load", "worldedit.schematic.load" })
|
||||||
public void load(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws FilenameException {
|
public void load(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws FilenameException {
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
@ -131,7 +130,6 @@ public class SchematicCommands {
|
|||||||
desc = "Save a schematic into your clipboard",
|
desc = "Save a schematic into your clipboard",
|
||||||
min = 1, max = 2
|
min = 1, max = 2
|
||||||
)
|
)
|
||||||
@Deprecated
|
|
||||||
@CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" })
|
@CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" })
|
||||||
public void save(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws CommandException, WorldEditException {
|
public void save(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws CommandException, WorldEditException {
|
||||||
LocalConfiguration config = worldEdit.getConfiguration();
|
LocalConfiguration config = worldEdit.getConfiguration();
|
||||||
|
@ -23,7 +23,6 @@ import com.sk89q.worldedit.PlayerDirection;
|
|||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BlockType;
|
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
@ -112,9 +111,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
|
|
||||||
if (free == 2) {
|
if (free == 2) {
|
||||||
if (y - 1 != origY) {
|
if (y - 1 != origY) {
|
||||||
final Vector pos = new Vector(x, y - 2, z);
|
setPosition(new Vector(x + 0.5, y - 2 + 1, z + 0.5));
|
||||||
final BlockState state = world.getBlock(pos);
|
|
||||||
setPosition(new Vector(x + 0.5, y - 2 + BlockType.centralTopLimit(state), z + 0.5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -135,7 +132,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
final Vector pos = new Vector(x, y, z);
|
final Vector pos = new Vector(x, y, z);
|
||||||
final BlockState id = world.getBlock(pos);
|
final BlockState id = world.getBlock(pos);
|
||||||
if (id.getBlockType().getMaterial().isMovementBlocker()) {
|
if (id.getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
setPosition(new Vector(x + 0.5, y + BlockType.centralTopLimit(id), z + 0.5));
|
setPosition(new Vector(x + 0.5, y + 1, z + 0.5));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +175,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setPosition(platform.add(0.5, BlockType.centralTopLimit(block), 0.5));
|
setPosition(platform.add(0.5, 1, 0.5));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,7 +215,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
// Don't want to end up in lava
|
// Don't want to end up in lava
|
||||||
if (type != BlockTypes.AIR && type != BlockTypes.LAVA) {
|
if (type != BlockTypes.AIR && type != BlockTypes.LAVA) {
|
||||||
// Found a block!
|
// Found a block!
|
||||||
setPosition(platform.add(0.5, BlockType.centralTopLimit(block), 0.5));
|
setPosition(platform.add(0.5, 1, 0.5));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +298,10 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
@Override
|
@Override
|
||||||
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
public void floatAt(int x, int y, int z, boolean alwaysGlass) {
|
||||||
try {
|
try {
|
||||||
getLocation().getExtent().setBlock(new Vector(x, y - 1, z), BlockTypes.GLASS.getDefaultState());
|
Vector spot = new Vector(x, y - 1, z);
|
||||||
|
if (!getLocation().getExtent().getBlock(spot).getBlockType().getMaterial().isMovementBlocker()) {
|
||||||
|
getLocation().getExtent().setBlock(spot, BlockTypes.GLASS.getDefaultState());
|
||||||
|
}
|
||||||
} catch (WorldEditException e) {
|
} catch (WorldEditException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public enum Direction {
|
|||||||
private final Vector direction;
|
private final Vector direction;
|
||||||
private final int flags;
|
private final int flags;
|
||||||
|
|
||||||
private Direction(Vector vector, int flags) {
|
Direction(Vector vector, int flags) {
|
||||||
this.direction = vector.normalize();
|
this.direction = vector.normalize();
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,8 @@ public final class Closer implements Closeable {
|
|||||||
public RuntimeException rethrow(Throwable e) throws IOException {
|
public RuntimeException rethrow(Throwable e) throws IOException {
|
||||||
thrown = e;
|
thrown = e;
|
||||||
Throwables.propagateIfPossible(e, IOException.class);
|
Throwables.propagateIfPossible(e, IOException.class);
|
||||||
throw Throwables.propagate(e);
|
Throwables.throwIfUnchecked(e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,7 +125,8 @@ public final class Closer implements Closeable {
|
|||||||
thrown = e;
|
thrown = e;
|
||||||
Throwables.propagateIfPossible(e, IOException.class);
|
Throwables.propagateIfPossible(e, IOException.class);
|
||||||
Throwables.propagateIfPossible(e, declaredType);
|
Throwables.propagateIfPossible(e, declaredType);
|
||||||
throw Throwables.propagate(e);
|
Throwables.throwIfUnchecked(e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,7 +149,8 @@ public final class Closer implements Closeable {
|
|||||||
thrown = e;
|
thrown = e;
|
||||||
Throwables.propagateIfPossible(e, IOException.class);
|
Throwables.propagateIfPossible(e, IOException.class);
|
||||||
Throwables.propagateIfPossible(e, declaredType1, declaredType2);
|
Throwables.propagateIfPossible(e, declaredType1, declaredType2);
|
||||||
throw Throwables.propagate(e);
|
Throwables.throwIfUnchecked(e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +42,7 @@ public class CommandContextTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUpTest() {
|
public void setUpTest() {
|
||||||
try {
|
try {
|
||||||
firstCommand = new CommandContext(firstCmdString, new HashSet<Character>(Arrays.asList('o', 'w')));
|
firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w')));
|
||||||
} catch (CommandException e) {
|
} catch (CommandException e) {
|
||||||
log.log(Level.WARNING, "Error", e);
|
log.log(Level.WARNING, "Error", e);
|
||||||
fail("Unexpected exception when creating CommandContext");
|
fail("Unexpected exception when creating CommandContext");
|
||||||
@ -52,7 +52,7 @@ public class CommandContextTest {
|
|||||||
@Test(expected = CommandException.class)
|
@Test(expected = CommandException.class)
|
||||||
public void testInvalidFlags() throws CommandException {
|
public void testInvalidFlags() throws CommandException {
|
||||||
final String failingCommand = "herpderp -opw testers";
|
final String failingCommand = "herpderp -opw testers";
|
||||||
new CommandContext(failingCommand, new HashSet<Character>(Arrays.asList('o', 'w')));
|
new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w')));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -39,7 +39,7 @@ class ForgeBiomeRegistry implements BiomeRegistry {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BaseBiome> getBiomes() {
|
public List<BaseBiome> getBiomes() {
|
||||||
List<BaseBiome> list = new ArrayList<BaseBiome>();
|
List<BaseBiome> list = new ArrayList<>();
|
||||||
for (Biome biome : Biome.REGISTRY) {
|
for (Biome biome : Biome.REGISTRY) {
|
||||||
list.add(new BaseBiome(Biome.getIdForBiome(biome)));
|
list.add(new BaseBiome(Biome.getIdForBiome(biome)));
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
@Override
|
@Override
|
||||||
public List<? extends com.sk89q.worldedit.world.World> getWorlds() {
|
public List<? extends com.sk89q.worldedit.world.World> getWorlds() {
|
||||||
WorldServer[] worlds = DimensionManager.getWorlds();
|
WorldServer[] worlds = DimensionManager.getWorlds();
|
||||||
List<com.sk89q.worldedit.world.World> ret = new ArrayList<com.sk89q.worldedit.world.World>(worlds.length);
|
List<com.sk89q.worldedit.world.World> ret = new ArrayList<>(worlds.length);
|
||||||
for (WorldServer world : worlds) {
|
for (WorldServer world : worlds) {
|
||||||
ret.add(new ForgeWorld(world));
|
ret.add(new ForgeWorld(world));
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Capability, Preference> getCapabilities() {
|
public Map<Capability, Preference> getCapabilities() {
|
||||||
Map<Capability, Preference> capabilities = new EnumMap<Capability, Preference>(Capability.class);
|
Map<Capability, Preference> capabilities = new EnumMap<>(Capability.class);
|
||||||
capabilities.put(Capability.CONFIGURATION, Preference.PREFER_OTHERS);
|
capabilities.put(Capability.CONFIGURATION, Preference.PREFER_OTHERS);
|
||||||
capabilities.put(Capability.WORLDEDIT_CUI, Preference.NORMAL);
|
capabilities.put(Capability.WORLDEDIT_CUI, Preference.NORMAL);
|
||||||
capabilities.put(Capability.GAME_HOOKS, Preference.NORMAL);
|
capabilities.put(Capability.GAME_HOOKS, Preference.NORMAL);
|
||||||
@ -176,7 +176,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Actor> getConnectedUsers() {
|
public Collection<Actor> getConnectedUsers() {
|
||||||
List<Actor> users = new ArrayList<Actor>();
|
List<Actor> users = new ArrayList<>();
|
||||||
PlayerList scm = server.getPlayerList();
|
PlayerList scm = server.getPlayerList();
|
||||||
for (EntityPlayerMP entity : scm.getPlayers()) {
|
for (EntityPlayerMP entity : scm.getPlayers()) {
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
|
@ -205,7 +205,7 @@ final class NBTConverter {
|
|||||||
|
|
||||||
public static ListTag fromNative(NBTTagList other) {
|
public static ListTag fromNative(NBTTagList other) {
|
||||||
other = other.copy();
|
other = other.copy();
|
||||||
List<Tag> list = new ArrayList<Tag>();
|
List<Tag> list = new ArrayList<>();
|
||||||
Class<? extends Tag> listClass = StringTag.class;
|
Class<? extends Tag> listClass = StringTag.class;
|
||||||
int tags = other.tagCount();
|
int tags = other.tagCount();
|
||||||
for (int i = 0; i < tags; i++) {
|
for (int i = 0; i < tags; i++) {
|
||||||
@ -243,7 +243,7 @@ final class NBTConverter {
|
|||||||
|
|
||||||
public static CompoundTag fromNative(NBTTagCompound other) {
|
public static CompoundTag fromNative(NBTTagCompound other) {
|
||||||
Set<String> tags = other.getKeySet();
|
Set<String> tags = other.getKeySet();
|
||||||
Map<String, Tag> map = new HashMap<String, Tag>();
|
Map<String, Tag> map = new HashMap<>();
|
||||||
for (String tagName : tags) {
|
for (String tagName : tags) {
|
||||||
map.put(tagName, fromNative(other.getTag(tagName)));
|
map.put(tagName, fromNative(other.getTag(tagName)));
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class ThreadSafeCache {
|
|||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
if (now - lastRefresh > REFRESH_DELAY) {
|
if (now - lastRefresh > REFRESH_DELAY) {
|
||||||
Set<UUID> onlineIds = new HashSet<UUID>();
|
Set<UUID> onlineIds = new HashSet<>();
|
||||||
|
|
||||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||||
if (server == null || server.getPlayerList() == null) {
|
if (server == null || server.getPlayerList() == null) {
|
||||||
@ -67,7 +67,7 @@ public class ThreadSafeCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onlineIds = new CopyOnWriteArraySet<UUID>(onlineIds);
|
this.onlineIds = new CopyOnWriteArraySet<>(onlineIds);
|
||||||
|
|
||||||
lastRefresh = now;
|
lastRefresh = now;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.sk89q.worldedit.forge.net;
|
package com.sk89q.worldedit.forge.net;
|
||||||
|
|
||||||
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
import com.sk89q.worldedit.forge.ForgeWorldEdit;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@ -32,13 +32,8 @@ public class LeftClickAirEventMessage implements IMessage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMessage onMessage(LeftClickAirEventMessage message, final MessageContext ctx) {
|
public IMessage onMessage(LeftClickAirEventMessage message, final MessageContext ctx) {
|
||||||
ctx.getServerHandler().player.mcServer.addScheduledTask(new Runnable() {
|
ctx.getServerHandler().player.mcServer.addScheduledTask(
|
||||||
|
() -> ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(ctx.getServerHandler().player)));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(ctx.getServerHandler().player));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren