Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Continue moving out of legacy BlockType
Dieser Commit ist enthalten in:
Ursprung
e291cccb94
Commit
57c13ef8f4
@ -379,9 +379,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LazyBlock getLazyBlock(Vector position) {
|
public LazyBlock getLazyBlock(Vector position) {
|
||||||
World world = getWorld();
|
return new LazyBlock(getBlock(position), this, position);
|
||||||
Block bukkitBlock = world.getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
|
||||||
return new LazyBlock(bukkitBlock.getTypeId(), bukkitBlock.getData(), this, position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -390,8 +388,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
if (adapter != null) {
|
if (adapter != null) {
|
||||||
return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position));
|
return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position));
|
||||||
} else {
|
} else {
|
||||||
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
return new BaseBlock(getBlock(position));
|
||||||
return new BaseBlock(bukkitBlock.getTypeId(), bukkitBlock.getData());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1529,7 +1529,7 @@ public class EditSession implements Extent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Snow should not cover these blocks
|
// Snow should not cover these blocks
|
||||||
if (BlockType.isTranslucent(id.getLegacyId())) {
|
if (id.getMaterial().isTranslucent()) {
|
||||||
// Add snow on leaves
|
// Add snow on leaves
|
||||||
if (BlockCategories.LEAVES.contains(id)) {
|
if (BlockCategories.LEAVES.contains(id)) {
|
||||||
break;
|
break;
|
||||||
|
@ -114,19 +114,6 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
|||||||
this(id);
|
this(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct a block with the given ID, data value and NBT data structure.
|
|
||||||
*
|
|
||||||
* @param id ID value
|
|
||||||
* @param data data value
|
|
||||||
* @param nbtData NBT data, which may be null
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public BaseBlock(int id, int data, @Nullable CompoundTag nbtData) {
|
|
||||||
this(id);
|
|
||||||
this.nbtData = nbtData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a clone of another block.
|
* Create a clone of another block.
|
||||||
*
|
*
|
||||||
@ -136,16 +123,6 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
|||||||
this(other.toImmutableState(), other.getNbtData());
|
this(other.toImmutableState(), other.getNbtData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the legacy numerical ID of the block.
|
|
||||||
*
|
|
||||||
* @return legacy numerical ID
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public int getId() {
|
|
||||||
return this.blockState.getBlockType().getLegacyId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block's data value.
|
* Get the block's data value.
|
||||||
*
|
*
|
||||||
|
@ -32,23 +32,18 @@ public final class BlockID {
|
|||||||
public static final int DIRT = 3;
|
public static final int DIRT = 3;
|
||||||
public static final int SAPLING = 6;
|
public static final int SAPLING = 6;
|
||||||
public static final int BEDROCK = 7;
|
public static final int BEDROCK = 7;
|
||||||
public static final int WATER = 8; // FLOWING_WATER
|
|
||||||
public static final int STATIONARY_WATER = 9; // WATER
|
|
||||||
public static final int SAND = 12;
|
public static final int SAND = 12;
|
||||||
public static final int GRAVEL = 13;
|
public static final int GRAVEL = 13;
|
||||||
public static final int GOLD_ORE = 14;
|
public static final int GOLD_ORE = 14;
|
||||||
public static final int IRON_ORE = 15;
|
public static final int IRON_ORE = 15;
|
||||||
public static final int COAL_ORE = 16;
|
public static final int COAL_ORE = 16;
|
||||||
public static final int LOG = 17;
|
public static final int LOG = 17;
|
||||||
public static final int LEAVES = 18;
|
|
||||||
public static final int GLASS = 20;
|
|
||||||
public static final int LAPIS_LAZULI_ORE = 21; // LAPIS_ORE
|
public static final int LAPIS_LAZULI_ORE = 21; // LAPIS_ORE
|
||||||
public static final int DISPENSER = 23;
|
public static final int DISPENSER = 23;
|
||||||
public static final int BED = 26;
|
public static final int BED = 26;
|
||||||
public static final int POWERED_RAIL = 27; // GOLDEN_RAIL
|
public static final int POWERED_RAIL = 27; // GOLDEN_RAIL
|
||||||
public static final int DETECTOR_RAIL = 28;
|
public static final int DETECTOR_RAIL = 28;
|
||||||
public static final int PISTON_STICKY_BASE = 29; // STICKY_PISTON
|
public static final int PISTON_STICKY_BASE = 29; // STICKY_PISTON
|
||||||
public static final int WEB = 30;
|
|
||||||
public static final int LONG_GRASS = 31; // TALLGRASS
|
public static final int LONG_GRASS = 31; // TALLGRASS
|
||||||
public static final int DEAD_BUSH = 32; // DEADBUSH
|
public static final int DEAD_BUSH = 32; // DEADBUSH
|
||||||
public static final int PISTON_BASE = 33; // PISTON
|
public static final int PISTON_BASE = 33; // PISTON
|
||||||
@ -62,7 +57,6 @@ public final class BlockID {
|
|||||||
public static final int TNT = 46;
|
public static final int TNT = 46;
|
||||||
public static final int TORCH = 50;
|
public static final int TORCH = 50;
|
||||||
public static final int FIRE = 51;
|
public static final int FIRE = 51;
|
||||||
public static final int MOB_SPAWNER = 52;
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int WOODEN_STAIRS = 53;
|
public static final int WOODEN_STAIRS = 53;
|
||||||
public static final int OAK_WOOD_STAIRS = 53; // OAK_STAIRS
|
public static final int OAK_WOOD_STAIRS = 53; // OAK_STAIRS
|
||||||
@ -88,7 +82,6 @@ public final class BlockID {
|
|||||||
public static final int REDSTONE_TORCH_ON = 76; // LIT_REDSTONE_TORCH
|
public static final int REDSTONE_TORCH_ON = 76; // LIT_REDSTONE_TORCH
|
||||||
public static final int STONE_BUTTON = 77;
|
public static final int STONE_BUTTON = 77;
|
||||||
public static final int SNOW = 78; // SNOW_LAYER
|
public static final int SNOW = 78; // SNOW_LAYER
|
||||||
public static final int ICE = 79;
|
|
||||||
public static final int CACTUS = 81;
|
public static final int CACTUS = 81;
|
||||||
public static final int CLAY = 82;
|
public static final int CLAY = 82;
|
||||||
public static final int REED = 83; // REEDS
|
public static final int REED = 83; // REEDS
|
||||||
@ -109,8 +102,6 @@ public final class BlockID {
|
|||||||
public static final int TRAP_DOOR = 96; // TRAPDOOR
|
public static final int TRAP_DOOR = 96; // TRAPDOOR
|
||||||
public static final int BROWN_MUSHROOM_CAP = 99; // BROWN_MUSHROOM_BLOCK
|
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 RED_MUSHROOM_CAP = 100; // RED_MUSHROOM_BLOCK
|
||||||
public static final int IRON_BARS = 101;
|
|
||||||
public static final int GLASS_PANE = 102;
|
|
||||||
public static final int PUMPKIN_STEM = 104;
|
public static final int PUMPKIN_STEM = 104;
|
||||||
public static final int MELON_STEM = 105;
|
public static final int MELON_STEM = 105;
|
||||||
public static final int VINE = 106;
|
public static final int VINE = 106;
|
||||||
@ -119,7 +110,6 @@ public final class BlockID {
|
|||||||
public static final int STONE_BRICK_STAIRS = 109;
|
public static final int STONE_BRICK_STAIRS = 109;
|
||||||
public static final int MYCELIUM = 110;
|
public static final int MYCELIUM = 110;
|
||||||
public static final int LILY_PAD = 111; // WATERLILY
|
public static final int LILY_PAD = 111; // WATERLILY
|
||||||
public static final int NETHER_BRICK_FENCE = 113;
|
|
||||||
public static final int NETHER_BRICK_STAIRS = 114;
|
public static final int NETHER_BRICK_STAIRS = 114;
|
||||||
public static final int NETHER_WART = 115;
|
public static final int NETHER_WART = 115;
|
||||||
public static final int ENCHANTMENT_TABLE = 116; // ENCHANTING_TABLE
|
public static final int ENCHANTMENT_TABLE = 116; // ENCHANTING_TABLE
|
||||||
@ -155,12 +145,9 @@ public final class BlockID {
|
|||||||
public static final int ACTIVATOR_RAIL = 157;
|
public static final int ACTIVATOR_RAIL = 157;
|
||||||
public static final int DROPPER = 158;
|
public static final int DROPPER = 158;
|
||||||
public static final int STAINED_CLAY = 159; // STAINED_HARDENED_CLAY
|
public static final int STAINED_CLAY = 159; // STAINED_HARDENED_CLAY
|
||||||
public static final int STAINED_GLASS_PANE = 160;
|
|
||||||
public static final int LEAVES2 = 161;
|
|
||||||
public static final int LOG2 = 162;
|
public static final int LOG2 = 162;
|
||||||
public static final int ACACIA_STAIRS = 163;
|
public static final int ACACIA_STAIRS = 163;
|
||||||
public static final int DARK_OAK_STAIRS = 164;
|
public static final int DARK_OAK_STAIRS = 164;
|
||||||
public static final int BARRIER = 166;
|
|
||||||
public static final int IRON_TRAP_DOOR = 167;
|
public static final int IRON_TRAP_DOOR = 167;
|
||||||
public static final int HAY_BLOCK = 170;
|
public static final int HAY_BLOCK = 170;
|
||||||
public static final int CARPET = 171;
|
public static final int CARPET = 171;
|
||||||
@ -169,29 +156,12 @@ public final class BlockID {
|
|||||||
public static final int STANDING_BANNER = 176;
|
public static final int STANDING_BANNER = 176;
|
||||||
public static final int WALL_BANNER = 177;
|
public static final int WALL_BANNER = 177;
|
||||||
public static final int DAYLIGHT_SENSOR_INVERTED = 178;
|
public static final int DAYLIGHT_SENSOR_INVERTED = 178;
|
||||||
public static final int RED_SANDSTONE_STAIRS = 180;
|
|
||||||
public static final int STEP2 = 182;
|
public static final int STEP2 = 182;
|
||||||
public static final int SPRUCE_FENCE_GATE = 183;
|
|
||||||
public static final int BIRCH_FENCE_GATE = 184;
|
|
||||||
public static final int JUNGLE_FENCE_GATE = 185;
|
|
||||||
public static final int DARK_OAK_FENCE_GATE = 186;
|
|
||||||
public static final int ACACIA_FENCE_GATE = 187;
|
|
||||||
public static final int SPRUCE_FENCE = 188;
|
|
||||||
public static final int BIRCH_FENCE = 189;
|
|
||||||
public static final int JUNGLE_FENCE = 190;
|
|
||||||
public static final int DARK_OAK_FENCE = 191;
|
|
||||||
public static final int ACACIA_FENCE = 192;
|
|
||||||
public static final int SPRUCE_DOOR = 193;
|
public static final int SPRUCE_DOOR = 193;
|
||||||
public static final int BIRCH_DOOR = 194;
|
public static final int BIRCH_DOOR = 194;
|
||||||
public static final int JUNGLE_DOOR = 195;
|
public static final int JUNGLE_DOOR = 195;
|
||||||
public static final int ACACIA_DOOR = 196;
|
public static final int ACACIA_DOOR = 196;
|
||||||
public static final int DARK_OAK_DOOR = 197;
|
public static final int DARK_OAK_DOOR = 197;
|
||||||
public static final int END_ROD = 198;
|
|
||||||
public static final int CHORUS_PLANT = 199;
|
|
||||||
public static final int CHORUS_FLOWER = 200;
|
|
||||||
public static final int PURPUR_STAIRS = 203;
|
|
||||||
public static final int PURPUR_SLAB = 205;
|
|
||||||
public static final int BEETROOTS = 207;
|
|
||||||
|
|
||||||
private BlockID() {
|
private BlockID() {
|
||||||
}
|
}
|
||||||
|
@ -180,4 +180,17 @@ public interface BlockMaterial {
|
|||||||
*/
|
*/
|
||||||
boolean isReplacedDuringPlacement();
|
boolean isReplacedDuringPlacement();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get whether this block is translucent.
|
||||||
|
*
|
||||||
|
* @return true if the block is translucent
|
||||||
|
*/
|
||||||
|
boolean isTranslucent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether the block has a container (Item container)
|
||||||
|
*
|
||||||
|
* @return If it has a container
|
||||||
|
*/
|
||||||
|
boolean hasContainer();
|
||||||
}
|
}
|
||||||
|
@ -232,32 +232,6 @@ public enum BlockType {
|
|||||||
return centralTopLimit(block.getBlockType().getLegacyId(), 0);
|
return centralTopLimit(block.getBlockType().getLegacyId(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* HashSet for isContainerBlock.
|
|
||||||
*/
|
|
||||||
private static final Set<Integer> isContainerBlock = new HashSet<>();
|
|
||||||
static {
|
|
||||||
isContainerBlock.add(BlockID.DISPENSER);
|
|
||||||
isContainerBlock.add(BlockID.FURNACE);
|
|
||||||
isContainerBlock.add(BlockID.BURNING_FURNACE);
|
|
||||||
isContainerBlock.add(BlockID.CHEST);
|
|
||||||
isContainerBlock.add(BlockID.BREWING_STAND);
|
|
||||||
isContainerBlock.add(BlockID.TRAPPED_CHEST);
|
|
||||||
isContainerBlock.add(BlockID.HOPPER);
|
|
||||||
isContainerBlock.add(BlockID.DROPPER);
|
|
||||||
//isContainerBlock.add(BlockID.ENDER_CHEST); // ender chest has no own inventory, don't add this here
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the block is a container block.
|
|
||||||
*
|
|
||||||
* @param id the block ID
|
|
||||||
* @return true if the block is a container
|
|
||||||
*/
|
|
||||||
public static boolean isContainerBlock(int id) {
|
|
||||||
return isContainerBlock.contains(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HashSet for isNaturalBlock.
|
* HashSet for isNaturalBlock.
|
||||||
*/
|
*/
|
||||||
@ -292,18 +266,6 @@ public enum BlockType {
|
|||||||
isNaturalTerrainBlock.add(BlockID.EMERALD_ORE);
|
isNaturalTerrainBlock.add(BlockID.EMERALD_ORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the block type is naturally occurring.
|
|
||||||
*
|
|
||||||
* @param id the type ID of the block
|
|
||||||
* @return true if the block type is naturally occurring
|
|
||||||
* @deprecated Use {@link #isNaturalTerrainBlock(int, int)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static boolean isNaturalTerrainBlock(int id) {
|
|
||||||
return isNaturalTerrainBlock.contains(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the block type is naturally occurring
|
* Checks if the block type is naturally occurring
|
||||||
*
|
*
|
||||||
@ -315,148 +277,6 @@ public enum BlockType {
|
|||||||
return isNaturalTerrainBlock.contains(-16*id-data) || isNaturalTerrainBlock.contains(id);
|
return isNaturalTerrainBlock.contains(-16*id-data) || isNaturalTerrainBlock.contains(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* HashSet for isTranslucent.
|
|
||||||
*/
|
|
||||||
private static final Set<Integer> isTranslucent = new HashSet<>();
|
|
||||||
static {
|
|
||||||
isTranslucent.add(BlockID.AIR);
|
|
||||||
isTranslucent.add(BlockID.SAPLING);
|
|
||||||
isTranslucent.add(BlockID.WATER);
|
|
||||||
isTranslucent.add(BlockID.STATIONARY_WATER);
|
|
||||||
isTranslucent.add(BlockID.LEAVES);
|
|
||||||
isTranslucent.add(BlockID.GLASS);
|
|
||||||
isTranslucent.add(BlockID.BED);
|
|
||||||
isTranslucent.add(BlockID.POWERED_RAIL);
|
|
||||||
isTranslucent.add(BlockID.DETECTOR_RAIL);
|
|
||||||
//isTranslucent.add(BlockID.PISTON_STICKY_BASE);
|
|
||||||
isTranslucent.add(BlockID.WEB);
|
|
||||||
isTranslucent.add(BlockID.LONG_GRASS);
|
|
||||||
isTranslucent.add(BlockID.DEAD_BUSH);
|
|
||||||
//isTranslucent.add(BlockID.PISTON_BASE);
|
|
||||||
isTranslucent.add(BlockID.PISTON_EXTENSION);
|
|
||||||
//isTranslucent.add(BlockID.PISTON_MOVING_PIECE);
|
|
||||||
isTranslucent.add(BlockID.YELLOW_FLOWER);
|
|
||||||
isTranslucent.add(BlockID.RED_FLOWER);
|
|
||||||
isTranslucent.add(BlockID.BROWN_MUSHROOM);
|
|
||||||
isTranslucent.add(BlockID.RED_MUSHROOM);
|
|
||||||
isTranslucent.add(BlockID.STEP);
|
|
||||||
isTranslucent.add(BlockID.TORCH);
|
|
||||||
isTranslucent.add(BlockID.FIRE);
|
|
||||||
isTranslucent.add(BlockID.MOB_SPAWNER);
|
|
||||||
isTranslucent.add(BlockID.OAK_WOOD_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.CHEST);
|
|
||||||
isTranslucent.add(BlockID.REDSTONE_WIRE);
|
|
||||||
isTranslucent.add(BlockID.CROPS);
|
|
||||||
isTranslucent.add(BlockID.SIGN_POST);
|
|
||||||
isTranslucent.add(BlockID.WOODEN_DOOR);
|
|
||||||
isTranslucent.add(BlockID.LADDER);
|
|
||||||
isTranslucent.add(BlockID.MINECART_TRACKS);
|
|
||||||
isTranslucent.add(BlockID.COBBLESTONE_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.WALL_SIGN);
|
|
||||||
isTranslucent.add(BlockID.LEVER);
|
|
||||||
isTranslucent.add(BlockID.STONE_PRESSURE_PLATE);
|
|
||||||
isTranslucent.add(BlockID.IRON_DOOR);
|
|
||||||
isTranslucent.add(BlockID.WOODEN_PRESSURE_PLATE);
|
|
||||||
isTranslucent.add(BlockID.REDSTONE_TORCH_OFF);
|
|
||||||
isTranslucent.add(BlockID.REDSTONE_TORCH_ON);
|
|
||||||
isTranslucent.add(BlockID.STONE_BUTTON);
|
|
||||||
isTranslucent.add(BlockID.SNOW);
|
|
||||||
isTranslucent.add(BlockID.ICE);
|
|
||||||
isTranslucent.add(BlockID.CACTUS);
|
|
||||||
isTranslucent.add(BlockID.REED);
|
|
||||||
isTranslucent.add(BlockID.FENCE);
|
|
||||||
isTranslucent.add(BlockID.PORTAL);
|
|
||||||
isTranslucent.add(BlockID.CAKE_BLOCK);
|
|
||||||
isTranslucent.add(BlockID.REDSTONE_REPEATER_OFF);
|
|
||||||
isTranslucent.add(BlockID.REDSTONE_REPEATER_ON);
|
|
||||||
isTranslucent.add(BlockID.TRAP_DOOR);
|
|
||||||
isTranslucent.add(BlockID.IRON_BARS);
|
|
||||||
isTranslucent.add(BlockID.GLASS_PANE);
|
|
||||||
isTranslucent.add(BlockID.PUMPKIN_STEM);
|
|
||||||
isTranslucent.add(BlockID.MELON_STEM);
|
|
||||||
isTranslucent.add(BlockID.VINE);
|
|
||||||
isTranslucent.add(BlockID.FENCE_GATE);
|
|
||||||
isTranslucent.add(BlockID.BRICK_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.STONE_BRICK_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.LILY_PAD);
|
|
||||||
isTranslucent.add(BlockID.NETHER_BRICK_FENCE);
|
|
||||||
isTranslucent.add(BlockID.NETHER_BRICK_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.NETHER_WART);
|
|
||||||
isTranslucent.add(BlockID.ENCHANTMENT_TABLE);
|
|
||||||
isTranslucent.add(BlockID.BREWING_STAND);
|
|
||||||
isTranslucent.add(BlockID.CAULDRON);
|
|
||||||
isTranslucent.add(BlockID.WOODEN_STEP);
|
|
||||||
isTranslucent.add(BlockID.COCOA_PLANT);
|
|
||||||
isTranslucent.add(BlockID.SANDSTONE_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.ENDER_CHEST);
|
|
||||||
isTranslucent.add(BlockID.TRIPWIRE_HOOK);
|
|
||||||
isTranslucent.add(BlockID.TRIPWIRE);
|
|
||||||
isTranslucent.add(BlockID.SPRUCE_WOOD_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.BIRCH_WOOD_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.JUNGLE_WOOD_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.COBBLESTONE_WALL);
|
|
||||||
isTranslucent.add(BlockID.FLOWER_POT);
|
|
||||||
isTranslucent.add(BlockID.CARROTS);
|
|
||||||
isTranslucent.add(BlockID.POTATOES);
|
|
||||||
isTranslucent.add(BlockID.WOODEN_BUTTON);
|
|
||||||
isTranslucent.add(BlockID.HEAD);
|
|
||||||
isTranslucent.add(BlockID.ANVIL);
|
|
||||||
isTranslucent.add(BlockID.TRAPPED_CHEST);
|
|
||||||
isTranslucent.add(BlockID.PRESSURE_PLATE_LIGHT);
|
|
||||||
isTranslucent.add(BlockID.PRESSURE_PLATE_HEAVY);
|
|
||||||
isTranslucent.add(BlockID.COMPARATOR_OFF);
|
|
||||||
isTranslucent.add(BlockID.COMPARATOR_ON);
|
|
||||||
isTranslucent.add(BlockID.DAYLIGHT_SENSOR);
|
|
||||||
isTranslucent.add(BlockID.HOPPER);
|
|
||||||
isTranslucent.add(BlockID.QUARTZ_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.ACTIVATOR_RAIL);
|
|
||||||
isTranslucent.add(BlockID.ACACIA_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.DARK_OAK_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.BARRIER);
|
|
||||||
isTranslucent.add(BlockID.IRON_TRAP_DOOR);
|
|
||||||
isTranslucent.add(BlockID.CARPET);
|
|
||||||
isTranslucent.add(BlockID.LEAVES2);
|
|
||||||
isTranslucent.add(BlockID.STAINED_GLASS_PANE);
|
|
||||||
isTranslucent.add(BlockID.DOUBLE_PLANT);
|
|
||||||
isTranslucent.add(BlockID.STANDING_BANNER);
|
|
||||||
isTranslucent.add(BlockID.WALL_BANNER);
|
|
||||||
isTranslucent.add(BlockID.DAYLIGHT_SENSOR_INVERTED);
|
|
||||||
isTranslucent.add(BlockID.RED_SANDSTONE_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.STEP2);
|
|
||||||
isTranslucent.add(BlockID.SPRUCE_FENCE_GATE);
|
|
||||||
isTranslucent.add(BlockID.BIRCH_FENCE_GATE);
|
|
||||||
isTranslucent.add(BlockID.JUNGLE_FENCE_GATE);
|
|
||||||
isTranslucent.add(BlockID.DARK_OAK_FENCE_GATE);
|
|
||||||
isTranslucent.add(BlockID.ACACIA_FENCE_GATE);
|
|
||||||
isTranslucent.add(BlockID.SPRUCE_FENCE);
|
|
||||||
isTranslucent.add(BlockID.BIRCH_FENCE);
|
|
||||||
isTranslucent.add(BlockID.JUNGLE_FENCE);
|
|
||||||
isTranslucent.add(BlockID.DARK_OAK_FENCE);
|
|
||||||
isTranslucent.add(BlockID.ACACIA_FENCE);
|
|
||||||
isTranslucent.add(BlockID.SPRUCE_DOOR);
|
|
||||||
isTranslucent.add(BlockID.BIRCH_DOOR);
|
|
||||||
isTranslucent.add(BlockID.JUNGLE_DOOR);
|
|
||||||
isTranslucent.add(BlockID.ACACIA_DOOR);
|
|
||||||
isTranslucent.add(BlockID.DARK_OAK_DOOR);
|
|
||||||
isTranslucent.add(BlockID.END_ROD);
|
|
||||||
isTranslucent.add(BlockID.CHORUS_PLANT);
|
|
||||||
isTranslucent.add(BlockID.CHORUS_FLOWER);
|
|
||||||
isTranslucent.add(BlockID.PURPUR_STAIRS);
|
|
||||||
isTranslucent.add(BlockID.PURPUR_SLAB);
|
|
||||||
isTranslucent.add(BlockID.BEETROOTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the block type lets light through.
|
|
||||||
*
|
|
||||||
* @param id the type ID of the block
|
|
||||||
* @return true if the block type lets light through
|
|
||||||
*/
|
|
||||||
public static boolean isTranslucent(int id) {
|
|
||||||
return isTranslucent.contains(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
||||||
|
@ -21,7 +21,6 @@ package com.sk89q.worldedit.extent.validation;
|
|||||||
|
|
||||||
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.type.BlockStateHolder;
|
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockType;
|
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
|
@ -19,19 +19,17 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent.world;
|
package com.sk89q.worldedit.extent.world;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
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.BlockID;
|
|
||||||
import com.sk89q.worldedit.blocks.BlockType;
|
|
||||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||||
|
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles various quirks when setting blocks, such as ice turning
|
* Handles various quirks when setting blocks, such as ice turning
|
||||||
* into water or containers dropping their contents.
|
* into water or containers dropping their contents.
|
||||||
@ -54,10 +52,9 @@ public class BlockQuirkExtent extends AbstractDelegateExtent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
public boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||||
BaseBlock lazyBlock = getExtent().getLazyBlock(position);
|
BlockType existing = getExtent().getBlock(position).getBlockType();
|
||||||
com.sk89q.worldedit.blocks.type.BlockType existing = lazyBlock.getBlockType();
|
|
||||||
|
|
||||||
if (BlockType.isContainerBlock(existing.getLegacyId())) {
|
if (existing.getMaterial().hasContainer()) {
|
||||||
world.clearContainerBlockContents(position); // Clear the container block so that it doesn't drop items
|
world.clearContainerBlockContents(position); // Clear the container block so that it doesn't drop items
|
||||||
} else if (existing == BlockTypes.ICE) {
|
} else if (existing == BlockTypes.ICE) {
|
||||||
world.setBlock(position, BlockTypes.AIR.getDefaultState()); // Ice turns until water so this has to be done first
|
world.setBlock(position, BlockTypes.AIR.getDefaultState()); // Ice turns until water so this has to be done first
|
||||||
|
@ -19,17 +19,16 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent.world;
|
package com.sk89q.worldedit.extent.world;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
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.type.BlockStateHolder;
|
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes changes to the world as if a player had done so during survival mode.
|
* Makes changes to the world as if a player had done so during survival mode.
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockType(double x, double y, double z) {
|
public int getBlockType(double x, double y, double z) {
|
||||||
return editSession.getLazyBlock(toWorld(x, y, z)).getId();
|
return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -58,7 +58,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockTypeAbs(double x, double y, double z) {
|
public int getBlockTypeAbs(double x, double y, double z) {
|
||||||
return editSession.getLazyBlock(new Vector(x, y, z)).getId();
|
return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -68,7 +68,7 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockTypeRel(double x, double y, double z) {
|
public int getBlockTypeRel(double x, double y, double z) {
|
||||||
return editSession.getLazyBlock(toWorldRel(x, y, z)).getId();
|
return editSession.getBlock(toWorld(x, y, z)).getBlockType().getLegacyId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,8 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util;
|
package com.sk89q.worldedit.util;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.blocks.BlockType;
|
|
||||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
@ -26,6 +26,7 @@ import com.sk89q.worldedit.blocks.BaseItem;
|
|||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockState;
|
import com.sk89q.worldedit.blocks.type.BlockState;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||||
|
import com.sk89q.worldedit.blocks.type.BlockType;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||||
@ -93,7 +94,7 @@ public abstract class AbstractWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean queueBlockBreakEffect(Platform server, Vector position, com.sk89q.worldedit.blocks.type.BlockType blockType, double priority) {
|
public boolean queueBlockBreakEffect(Platform server, Vector position, BlockType blockType, double priority) {
|
||||||
if (taskId == -1) {
|
if (taskId == -1) {
|
||||||
taskId = server.schedule(0, 1, () -> {
|
taskId = server.schedule(0, 1, () -> {
|
||||||
int max = Math.max(1, Math.min(30, effectQueue.size() / 3));
|
int max = Math.max(1, Math.min(30, effectQueue.size() / 3));
|
||||||
@ -131,10 +132,10 @@ public abstract class AbstractWorld implements World {
|
|||||||
|
|
||||||
private class QueuedEffect implements Comparable<QueuedEffect> {
|
private class QueuedEffect implements Comparable<QueuedEffect> {
|
||||||
private final Vector position;
|
private final Vector position;
|
||||||
private final com.sk89q.worldedit.blocks.type.BlockType blockType;
|
private final BlockType blockType;
|
||||||
private final double priority;
|
private final double priority;
|
||||||
|
|
||||||
private QueuedEffect(Vector position, com.sk89q.worldedit.blocks.type.BlockType blockType, double priority) {
|
private QueuedEffect(Vector position, BlockType blockType, double priority) {
|
||||||
this.position = position;
|
this.position = position;
|
||||||
this.blockType = blockType;
|
this.blockType = blockType;
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
|
@ -45,6 +45,8 @@ class SimpleBlockMaterial implements BlockMaterial {
|
|||||||
private boolean burnable;
|
private boolean burnable;
|
||||||
private boolean toolRequired;
|
private boolean toolRequired;
|
||||||
private boolean replacedDuringPlacement;
|
private boolean replacedDuringPlacement;
|
||||||
|
private boolean isTranslucent;
|
||||||
|
private boolean hasContainer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRenderedAsNormalBlock() {
|
public boolean isRenderedAsNormalBlock() {
|
||||||
@ -240,7 +242,25 @@ class SimpleBlockMaterial implements BlockMaterial {
|
|||||||
return replacedDuringPlacement;
|
return replacedDuringPlacement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTranslucent(boolean isTranslucent) {
|
||||||
|
this.isTranslucent = isTranslucent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTranslucent() {
|
||||||
|
return this.isTranslucent;
|
||||||
|
}
|
||||||
|
|
||||||
public void setReplacedDuringPlacement(boolean replacedDuringPlacement) {
|
public void setReplacedDuringPlacement(boolean replacedDuringPlacement) {
|
||||||
this.replacedDuringPlacement = replacedDuringPlacement;
|
this.replacedDuringPlacement = replacedDuringPlacement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasContainer() {
|
||||||
|
return this.hasContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasContainer(boolean hasContainer) {
|
||||||
|
this.hasContainer = hasContainer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@ import com.sk89q.worldedit.blocks.BaseItemStack;
|
|||||||
import com.sk89q.worldedit.blocks.LazyBlock;
|
import com.sk89q.worldedit.blocks.LazyBlock;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockState;
|
import com.sk89q.worldedit.blocks.type.BlockState;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.blocks.type.BlockTypes;
|
|
||||||
import com.sk89q.worldedit.blocks.type.ItemTypes;
|
import com.sk89q.worldedit.blocks.type.ItemTypes;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -47,6 +46,7 @@ import com.sk89q.worldedit.util.Location;
|
|||||||
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||||
import com.sk89q.worldedit.world.AbstractWorld;
|
import com.sk89q.worldedit.world.AbstractWorld;
|
||||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||||
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockLeaves;
|
import net.minecraft.block.BlockLeaves;
|
||||||
import net.minecraft.block.BlockOldLeaf;
|
import net.minecraft.block.BlockOldLeaf;
|
||||||
@ -356,15 +356,12 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||||
IBlockState state = world.getBlockState(pos);
|
IBlockState state = world.getBlockState(pos);
|
||||||
|
|
||||||
return BlockTypes.getBlockType(net.minecraftforge.fml.common.registry.ForgeRegistries.BLOCKS.getKey(state.getBlock()).toString()).getDefaultState(); // TODO Data
|
return LegacyMapper.getInstance().getBlockFromLegacy(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LazyBlock getLazyBlock(Vector position) {
|
public LazyBlock getLazyBlock(Vector position) {
|
||||||
World world = getWorld();
|
return new LazyBlock(getBlock(position), this, position);
|
||||||
BlockPos pos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
|
||||||
IBlockState state = world.getBlockState(pos);
|
|
||||||
return new LazyBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), this, position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -377,7 +374,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return new TileEntityBaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), tile);
|
return new TileEntityBaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state), tile);
|
||||||
} else {
|
} else {
|
||||||
return new BaseBlock(Block.getIdFromBlock(state.getBlock()), state.getBlock().getMetaFromState(state));
|
return new BaseBlock(getBlock(position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +401,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Entity> getEntities(Region region) {
|
public List<? extends Entity> getEntities(Region region) {
|
||||||
List<Entity> entities = new ArrayList<Entity>();
|
List<Entity> entities = new ArrayList<>();
|
||||||
for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) {
|
for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) {
|
||||||
if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) {
|
if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) {
|
||||||
entities.add(new ForgeEntity(entity));
|
entities.add(new ForgeEntity(entity));
|
||||||
@ -415,7 +412,7 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Entity> getEntities() {
|
public List<? extends Entity> getEntities() {
|
||||||
List<Entity> entities = new ArrayList<Entity>();
|
List<Entity> entities = new ArrayList<>();
|
||||||
for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) {
|
for (net.minecraft.entity.Entity entity : getWorld().loadedEntityList) {
|
||||||
entities.add(new ForgeEntity(entity));
|
entities.add(new ForgeEntity(entity));
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren