geforkt von Mirrors/FastAsyncWorldEdit
Move simulateBlockMine up to the platforms.
Dieser Commit ist enthalten in:
Ursprung
11f5d05e7b
Commit
e291cccb94
@ -30,14 +30,10 @@ public final class BlockID {
|
|||||||
public static final int STONE = 1;
|
public static final int STONE = 1;
|
||||||
public static final int GRASS = 2;
|
public static final int GRASS = 2;
|
||||||
public static final int DIRT = 3;
|
public static final int DIRT = 3;
|
||||||
public static final int COBBLESTONE = 4;
|
|
||||||
public static final int WOOD = 5; // PLANKS
|
|
||||||
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 WATER = 8; // FLOWING_WATER
|
||||||
public static final int STATIONARY_WATER = 9; // WATER
|
public static final int STATIONARY_WATER = 9; // WATER
|
||||||
public static final int LAVA = 10; // FLOWING_LAVA
|
|
||||||
public static final int STATIONARY_LAVA = 11; // LAVA
|
|
||||||
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;
|
||||||
@ -45,13 +41,9 @@ public final class BlockID {
|
|||||||
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 LEAVES = 18;
|
||||||
public static final int SPONGE = 19;
|
|
||||||
public static final int GLASS = 20;
|
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 LAPIS_LAZULI_BLOCK = 22; // LAPIS_BLOCK
|
|
||||||
public static final int DISPENSER = 23;
|
public static final int DISPENSER = 23;
|
||||||
public static final int SANDSTONE = 24;
|
|
||||||
public static final int NOTE_BLOCK = 25; // NOTEBLOCK
|
|
||||||
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;
|
||||||
@ -61,21 +53,13 @@ public final class BlockID {
|
|||||||
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
|
||||||
public static final int PISTON_EXTENSION = 34; // PISTON_HEAD
|
public static final int PISTON_EXTENSION = 34; // PISTON_HEAD
|
||||||
public static final int CLOTH = 35; // WOOL
|
|
||||||
public static final int PISTON_MOVING_PIECE = 36; // PISTON_EXTENSION
|
public static final int PISTON_MOVING_PIECE = 36; // PISTON_EXTENSION
|
||||||
public static final int YELLOW_FLOWER = 37;
|
public static final int YELLOW_FLOWER = 37;
|
||||||
public static final int RED_FLOWER = 38;
|
public static final int RED_FLOWER = 38;
|
||||||
public static final int BROWN_MUSHROOM = 39;
|
public static final int BROWN_MUSHROOM = 39;
|
||||||
public static final int RED_MUSHROOM = 40;
|
public static final int RED_MUSHROOM = 40;
|
||||||
public static final int GOLD_BLOCK = 41;
|
|
||||||
public static final int IRON_BLOCK = 42;
|
|
||||||
public static final int DOUBLE_STEP = 43; // DOUBLE_STONE_SLAB
|
|
||||||
public static final int STEP = 44; // STONE_SLAB
|
public static final int STEP = 44; // STONE_SLAB
|
||||||
public static final int BRICK = 45; // BRICK_BLOCK
|
|
||||||
public static final int TNT = 46;
|
public static final int TNT = 46;
|
||||||
public static final int BOOKCASE = 47; // BOOKSHELF
|
|
||||||
public static final int MOSSY_COBBLESTONE = 48;
|
|
||||||
public static final int OBSIDIAN = 49;
|
|
||||||
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;
|
public static final int MOB_SPAWNER = 52;
|
||||||
@ -85,10 +69,7 @@ public final class BlockID {
|
|||||||
public static final int CHEST = 54;
|
public static final int CHEST = 54;
|
||||||
public static final int REDSTONE_WIRE = 55;
|
public static final int REDSTONE_WIRE = 55;
|
||||||
public static final int DIAMOND_ORE = 56;
|
public static final int DIAMOND_ORE = 56;
|
||||||
public static final int DIAMOND_BLOCK = 57;
|
|
||||||
public static final int WORKBENCH = 58; // CRAFTING_TABLE
|
|
||||||
public static final int CROPS = 59; // WHEAT
|
public static final int CROPS = 59; // WHEAT
|
||||||
public static final int SOIL = 60; // FARMLAND
|
|
||||||
public static final int FURNACE = 61;
|
public static final int FURNACE = 61;
|
||||||
public static final int BURNING_FURNACE = 62; // LIT_FURNACE
|
public static final int BURNING_FURNACE = 62; // LIT_FURNACE
|
||||||
public static final int SIGN_POST = 63; // STANDING_SIGN
|
public static final int SIGN_POST = 63; // STANDING_SIGN
|
||||||
@ -108,11 +89,9 @@ public final class BlockID {
|
|||||||
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 ICE = 79;
|
||||||
public static final int SNOW_BLOCK = 80; // SNOW
|
|
||||||
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
|
||||||
public static final int JUKEBOX = 84;
|
|
||||||
public static final int FENCE = 85;
|
public static final int FENCE = 85;
|
||||||
public static final int PUMPKIN = 86;
|
public static final int PUMPKIN = 86;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -128,13 +107,10 @@ public final class BlockID {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public static final int LOCKED_CHEST = 95;
|
public static final int LOCKED_CHEST = 95;
|
||||||
public static final int TRAP_DOOR = 96; // TRAPDOOR
|
public static final int TRAP_DOOR = 96; // TRAPDOOR
|
||||||
public static final int SILVERFISH_BLOCK = 97; // MONSTER_EGG
|
|
||||||
public static final int STONE_BRICK = 98; // STONEBRICK
|
|
||||||
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 IRON_BARS = 101;
|
||||||
public static final int GLASS_PANE = 102;
|
public static final int GLASS_PANE = 102;
|
||||||
public static final int MELON_BLOCK = 103;
|
|
||||||
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;
|
||||||
@ -143,19 +119,13 @@ 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 = 112;
|
|
||||||
public static final int NETHER_BRICK_FENCE = 113;
|
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
|
||||||
public static final int BREWING_STAND = 117;
|
public static final int BREWING_STAND = 117;
|
||||||
public static final int CAULDRON = 118;
|
public static final int CAULDRON = 118;
|
||||||
public static final int END_PORTAL = 119;
|
|
||||||
public static final int END_PORTAL_FRAME = 120;
|
public static final int END_PORTAL_FRAME = 120;
|
||||||
public static final int END_STONE = 121;
|
|
||||||
public static final int REDSTONE_LAMP_OFF = 123; // REDSTONE_LAMP
|
|
||||||
public static final int REDSTONE_LAMP_ON = 124; // LIT_REDSTONE_LAMP
|
|
||||||
public static final int DOUBLE_WOODEN_STEP = 125; // DOUBLE_WOODEN_SLAB
|
|
||||||
public static final int WOODEN_STEP = 126; // WOODEN_SLAB
|
public static final int WOODEN_STEP = 126; // WOODEN_SLAB
|
||||||
public static final int COCOA_PLANT = 127; // COCOA
|
public static final int COCOA_PLANT = 127; // COCOA
|
||||||
public static final int SANDSTONE_STAIRS = 128;
|
public static final int SANDSTONE_STAIRS = 128;
|
||||||
@ -163,11 +133,9 @@ public final class BlockID {
|
|||||||
public static final int ENDER_CHEST = 130;
|
public static final int ENDER_CHEST = 130;
|
||||||
public static final int TRIPWIRE_HOOK = 131;
|
public static final int TRIPWIRE_HOOK = 131;
|
||||||
public static final int TRIPWIRE = 132;
|
public static final int TRIPWIRE = 132;
|
||||||
public static final int EMERALD_BLOCK = 133;
|
|
||||||
public static final int SPRUCE_WOOD_STAIRS = 134; // SPRUCE_STAIRS
|
public static final int SPRUCE_WOOD_STAIRS = 134; // SPRUCE_STAIRS
|
||||||
public static final int BIRCH_WOOD_STAIRS = 135; // BRUCE_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 JUNGLE_WOOD_STAIRS = 136; // JUNGLE_STAIRS
|
||||||
public static final int COMMAND_BLOCK = 137;
|
|
||||||
public static final int COBBLESTONE_WALL = 139;
|
public static final int COBBLESTONE_WALL = 139;
|
||||||
public static final int FLOWER_POT = 140;
|
public static final int FLOWER_POT = 140;
|
||||||
public static final int CARROTS = 141;
|
public static final int CARROTS = 141;
|
||||||
@ -181,10 +149,8 @@ public final class BlockID {
|
|||||||
public static final int COMPARATOR_OFF = 149; // UNPOWERED_COMPARATOR
|
public static final int COMPARATOR_OFF = 149; // UNPOWERED_COMPARATOR
|
||||||
public static final int COMPARATOR_ON = 150; // COMPARATOR
|
public static final int COMPARATOR_ON = 150; // COMPARATOR
|
||||||
public static final int DAYLIGHT_SENSOR = 151; // DAYLIGHT_DETECTOR
|
public static final int DAYLIGHT_SENSOR = 151; // DAYLIGHT_DETECTOR
|
||||||
public static final int REDSTONE_BLOCK = 152;
|
|
||||||
public static final int QUARTZ_ORE = 153;
|
public static final int QUARTZ_ORE = 153;
|
||||||
public static final int HOPPER = 154;
|
public static final int HOPPER = 154;
|
||||||
public static final int QUARTZ_BLOCK = 155;
|
|
||||||
public static final int QUARTZ_STAIRS = 156;
|
public static final int QUARTZ_STAIRS = 156;
|
||||||
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;
|
||||||
@ -198,8 +164,6 @@ public final class BlockID {
|
|||||||
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;
|
||||||
public static final int HARDENED_CLAY = 172;
|
|
||||||
public static final int COAL_BLOCK = 173;
|
|
||||||
public static final int PACKED_ICE = 174;
|
public static final int PACKED_ICE = 174;
|
||||||
public static final int DOUBLE_PLANT = 175;
|
public static final int DOUBLE_PLANT = 175;
|
||||||
public static final int STANDING_BANNER = 176;
|
public static final int STANDING_BANNER = 176;
|
||||||
|
@ -27,11 +27,8 @@ import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block types.
|
* Block types.
|
||||||
*
|
*
|
||||||
@ -460,469 +457,6 @@ public enum BlockType {
|
|||||||
return isTranslucent.contains(id);
|
return isTranslucent.contains(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* HashMap for getBlockBagItem.
|
|
||||||
*/
|
|
||||||
private static final Map<Integer, BaseItem> dataBlockBagItems = new HashMap<>();
|
|
||||||
private static final Map<Integer, BaseItem> nonDataBlockBagItems = new HashMap<>();
|
|
||||||
private static final BaseItem doNotDestroy = new BaseItemStack(BlockID.AIR, 0);
|
|
||||||
static {
|
|
||||||
/*
|
|
||||||
* rules:
|
|
||||||
*
|
|
||||||
* 1. block yields itself => addIdentity
|
|
||||||
* 2. block is part of a 2-block object => drop an appropriate item for one of the 2 blocks
|
|
||||||
* 3. block can be placed by right-clicking an obtainable item on the ground => use that item
|
|
||||||
* 4. block yields more than one item => addIdentities
|
|
||||||
* 5. block yields exactly one item => use that item
|
|
||||||
* 6. block is a liquid => drop nothing
|
|
||||||
* 7. block is created from thin air by the game other than by the map generator => drop nothing
|
|
||||||
*/
|
|
||||||
|
|
||||||
nonDataBlockBagItems.put(BlockID.STONE, new BaseItem(BlockID.COBBLESTONE)); // rule 5
|
|
||||||
nonDataBlockBagItems.put(BlockID.GRASS, new BaseItem(BlockID.DIRT)); // rule 5
|
|
||||||
addIdentities(BlockID.DIRT, 3); // rule 1
|
|
||||||
addIdentity(BlockID.COBBLESTONE); // rule 1
|
|
||||||
addIdentities(BlockID.WOOD, 6); // rule 1
|
|
||||||
addIdentities(BlockID.SAPLING, 6); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.BEDROCK, doNotDestroy); // exception
|
|
||||||
// WATER, rule 6
|
|
||||||
// STATIONARY_WATER, rule 6
|
|
||||||
// LAVA, rule 6
|
|
||||||
// STATIONARY_LAVA, rule 6
|
|
||||||
addIdentity(BlockID.SAND); // rule 1
|
|
||||||
addIdentity(BlockID.GRAVEL); // rule 1
|
|
||||||
addIdentity(BlockID.GOLD_ORE); // rule 1
|
|
||||||
addIdentity(BlockID.IRON_ORE); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.COAL_ORE, new BaseItem(ItemID.COAL)); // rule 5
|
|
||||||
addIdentities(BlockID.LOG, 4); // rule 1
|
|
||||||
addIdentities(BlockID.LEAVES, 4); // rule 1 with shears, otherwise rule 3
|
|
||||||
addIdentity(BlockID.SPONGE); // rule 1
|
|
||||||
addIdentity(BlockID.GLASS); // rule 3
|
|
||||||
addIdentity(BlockID.LAPIS_LAZULI_ORE); // rule 4
|
|
||||||
addIdentity(BlockID.LAPIS_LAZULI_BLOCK); // rule 1
|
|
||||||
addIdentity(BlockID.DISPENSER); // rule 1
|
|
||||||
addIdentity(BlockID.SANDSTONE); // rule 1
|
|
||||||
addIdentity(BlockID.NOTE_BLOCK); // rule 1
|
|
||||||
addIdentities(BlockID.BED, 8); // rule 2
|
|
||||||
addIdentity(BlockID.POWERED_RAIL); // rule 1
|
|
||||||
addIdentity(BlockID.DETECTOR_RAIL); // rule 1
|
|
||||||
addIdentity(BlockID.PISTON_STICKY_BASE);
|
|
||||||
nonDataBlockBagItems.put(BlockID.WEB, new BaseItem(ItemID.STRING)); // rule 5
|
|
||||||
// LONG_GRASS
|
|
||||||
// DEAD_BUSH
|
|
||||||
addIdentity(BlockID.PISTON_BASE);
|
|
||||||
// PISTON_EXTENSION, rule 7
|
|
||||||
addIdentities(BlockID.CLOTH, 16); // rule 1
|
|
||||||
// PISTON_MOVING_PIECE, rule 7
|
|
||||||
addIdentity(BlockID.YELLOW_FLOWER); // rule 1
|
|
||||||
addIdentity(BlockID.RED_FLOWER); // rule 1
|
|
||||||
addIdentity(BlockID.BROWN_MUSHROOM); // rule 1
|
|
||||||
addIdentity(BlockID.RED_MUSHROOM); // rule 1
|
|
||||||
addIdentity(BlockID.GOLD_BLOCK); // rule 1
|
|
||||||
addIdentity(BlockID.IRON_BLOCK); // rule 1
|
|
||||||
addIdentities(BlockID.DOUBLE_STEP, 7); // rule 3
|
|
||||||
addIdentities(BlockID.STEP, 7); // rule 1
|
|
||||||
addIdentity(BlockID.BRICK); // rule 1
|
|
||||||
addIdentity(BlockID.TNT);
|
|
||||||
addIdentity(BlockID.BOOKCASE); // rule 3
|
|
||||||
addIdentity(BlockID.MOSSY_COBBLESTONE); // rule 1
|
|
||||||
addIdentity(BlockID.OBSIDIAN); // rule 1
|
|
||||||
addIdentity(BlockID.TORCH); // rule 1
|
|
||||||
// FIRE
|
|
||||||
// MOB_SPAWNER
|
|
||||||
addIdentity(BlockID.OAK_WOOD_STAIRS); // rule 1
|
|
||||||
addIdentity(BlockID.CHEST); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.REDSTONE_WIRE, new BaseItem(ItemID.REDSTONE_DUST)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.DIAMOND_ORE, new BaseItem(ItemID.DIAMOND)); // rule 5
|
|
||||||
addIdentity(BlockID.DIAMOND_BLOCK); // rule 1
|
|
||||||
addIdentity(BlockID.WORKBENCH); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.CROPS, new BaseItem(ItemID.SEEDS)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.SOIL, new BaseItem(BlockID.DIRT)); // rule 5
|
|
||||||
addIdentity(BlockID.FURNACE); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.BURNING_FURNACE, new BaseItem(BlockID.FURNACE));
|
|
||||||
nonDataBlockBagItems.put(BlockID.SIGN_POST, new BaseItem(ItemID.SIGN)); // rule 3
|
|
||||||
addIdentities(BlockID.WOODEN_DOOR, 8); // rule 2
|
|
||||||
addIdentity(BlockID.LADDER); // rule 1
|
|
||||||
addIdentity(BlockID.MINECART_TRACKS); // rule 1
|
|
||||||
addIdentity(BlockID.COBBLESTONE_STAIRS); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.WALL_SIGN, new BaseItem(ItemID.SIGN)); // rule 3
|
|
||||||
addIdentity(BlockID.LEVER); // rule 1
|
|
||||||
addIdentity(BlockID.STONE_PRESSURE_PLATE); // rule 1
|
|
||||||
addIdentities(BlockID.IRON_DOOR, 8); // rule 2
|
|
||||||
addIdentity(BlockID.WOODEN_PRESSURE_PLATE); // rule 1
|
|
||||||
addIdentity(BlockID.REDSTONE_ORE); // rule 4
|
|
||||||
nonDataBlockBagItems.put(BlockID.GLOWING_REDSTONE_ORE, new BaseItem(BlockID.REDSTONE_ORE)); // rule 4
|
|
||||||
nonDataBlockBagItems.put(BlockID.REDSTONE_TORCH_OFF, new BaseItem(BlockID.REDSTONE_TORCH_ON)); // rule 3
|
|
||||||
addIdentity(BlockID.REDSTONE_TORCH_ON); // rule 1
|
|
||||||
addIdentity(BlockID.STONE_BUTTON); // rule 1
|
|
||||||
addIdentity(BlockID.SNOW); // rule 1
|
|
||||||
addIdentity(BlockID.ICE); // exception
|
|
||||||
addIdentity(BlockID.SNOW_BLOCK); // rule 3
|
|
||||||
addIdentity(BlockID.CACTUS);
|
|
||||||
addIdentity(BlockID.CLAY); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.REED, new BaseItem(ItemID.SUGAR_CANE_ITEM)); // rule 3
|
|
||||||
addIdentity(BlockID.JUKEBOX); // rule 1
|
|
||||||
addIdentity(BlockID.FENCE); // rule 1
|
|
||||||
addIdentity(BlockID.PUMPKIN); // rule 1
|
|
||||||
addIdentity(BlockID.NETHERRACK); // rule 1
|
|
||||||
addIdentity(BlockID.SLOW_SAND); // rule 1
|
|
||||||
addIdentity(BlockID.LIGHTSTONE); // rule 4
|
|
||||||
// PORTAL
|
|
||||||
addIdentity(BlockID.JACKOLANTERN); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.CAKE_BLOCK, new BaseItem(ItemID.CAKE_ITEM)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.REDSTONE_REPEATER_OFF, new BaseItem(ItemID.REDSTONE_REPEATER)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.REDSTONE_REPEATER_ON, new BaseItem(ItemID.REDSTONE_REPEATER)); // rule 3
|
|
||||||
addIdentities(BlockID.STAINED_GLASS_PANE, 16); // ???
|
|
||||||
addIdentity(BlockID.TRAP_DOOR); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.SILVERFISH_BLOCK, doNotDestroy); // exception
|
|
||||||
addIdentity(BlockID.STONE_BRICK); // rule 1
|
|
||||||
addIdentity(BlockID.BROWN_MUSHROOM_CAP);
|
|
||||||
addIdentity(BlockID.RED_MUSHROOM_CAP);
|
|
||||||
addIdentity(BlockID.IRON_BARS); // rule 1
|
|
||||||
addIdentity(BlockID.GLASS_PANE); // rule 1
|
|
||||||
addIdentity(BlockID.MELON_BLOCK); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.PUMPKIN_STEM, new BaseItem(ItemID.PUMPKIN_SEEDS)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.MELON_STEM, new BaseItem(ItemID.MELON_SEEDS)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.VINE, doNotDestroy); // exception
|
|
||||||
addIdentity(BlockID.FENCE_GATE); // rule 1
|
|
||||||
addIdentity(BlockID.BRICK_STAIRS); // rule 3
|
|
||||||
addIdentity(BlockID.STONE_BRICK_STAIRS); // rule 3
|
|
||||||
|
|
||||||
// 1.9 blocks
|
|
||||||
nonDataBlockBagItems.put(BlockID.MYCELIUM, new BaseItem(BlockID.DIRT));
|
|
||||||
addIdentity(BlockID.LILY_PAD);
|
|
||||||
addIdentity(BlockID.NETHER_BRICK);
|
|
||||||
addIdentity(BlockID.NETHER_BRICK_FENCE);
|
|
||||||
addIdentity(BlockID.NETHER_BRICK_STAIRS);
|
|
||||||
nonDataBlockBagItems.put(BlockID.NETHER_WART, new BaseItem(ItemID.NETHER_WART_SEED));
|
|
||||||
addIdentity(BlockID.ENCHANTMENT_TABLE);
|
|
||||||
nonDataBlockBagItems.put(BlockID.BREWING_STAND, new BaseItem(ItemID.BREWING_STAND));
|
|
||||||
nonDataBlockBagItems.put(BlockID.CAULDRON, new BaseItem(ItemID.CAULDRON));
|
|
||||||
nonDataBlockBagItems.put(BlockID.END_PORTAL, doNotDestroy);
|
|
||||||
nonDataBlockBagItems.put(BlockID.END_PORTAL_FRAME, doNotDestroy);
|
|
||||||
addIdentity(BlockID.END_STONE);
|
|
||||||
|
|
||||||
addIdentity(BlockID.REDSTONE_LAMP_OFF);
|
|
||||||
nonDataBlockBagItems.put(BlockID.REDSTONE_LAMP_ON, new BaseItem(BlockID.REDSTONE_LAMP_OFF));
|
|
||||||
|
|
||||||
addIdentities(BlockID.DOUBLE_WOODEN_STEP, 7); // rule 3
|
|
||||||
addIdentities(BlockID.WOODEN_STEP, 7); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.COCOA_PLANT, new BaseItem(ItemID.INK_SACK)); // rule 3 TODO data removed
|
|
||||||
addIdentity(BlockID.SANDSTONE_STAIRS); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.EMERALD_ORE, new BaseItem(ItemID.EMERALD)); // rule 5
|
|
||||||
addIdentity(BlockID.ENDER_CHEST); // rule 3
|
|
||||||
addIdentity(BlockID.TRIPWIRE_HOOK); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.TRIPWIRE, new BaseItem(ItemID.STRING)); // rule 3
|
|
||||||
addIdentity(BlockID.EMERALD_BLOCK); // rule 1
|
|
||||||
addIdentity(BlockID.SPRUCE_WOOD_STAIRS); // rule 1
|
|
||||||
addIdentity(BlockID.BIRCH_WOOD_STAIRS); // rule 1
|
|
||||||
addIdentity(BlockID.JUNGLE_WOOD_STAIRS); // rule 1
|
|
||||||
addIdentity(BlockID.COMMAND_BLOCK); // rule 1
|
|
||||||
addIdentities(BlockID.COBBLESTONE_WALL, 1); // rule 4
|
|
||||||
nonDataBlockBagItems.put(BlockID.FLOWER_POT, new BaseItemStack(ItemID.FLOWER_POT)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.CARROTS, new BaseItemStack(ItemID.CARROT)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.POTATOES, new BaseItemStack(ItemID.POTATO)); // rule 3
|
|
||||||
addIdentity(BlockID.WOODEN_BUTTON); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.HEAD, doNotDestroy); // exception, can't handle TE data
|
|
||||||
addIdentities(BlockID.ANVIL, 2); // rule 4
|
|
||||||
addIdentity(BlockID.TRAPPED_CHEST); // rule 1
|
|
||||||
addIdentity(BlockID.PRESSURE_PLATE_LIGHT); // rule 1
|
|
||||||
addIdentity(BlockID.PRESSURE_PLATE_HEAVY); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.COMPARATOR_OFF, new BaseItemStack(ItemID.COMPARATOR)); // rule 3
|
|
||||||
nonDataBlockBagItems.put(BlockID.COMPARATOR_ON, new BaseItemStack(ItemID.COMPARATOR)); // rule 3
|
|
||||||
addIdentity(BlockID.DAYLIGHT_SENSOR); // rule 1
|
|
||||||
addIdentity(BlockID.REDSTONE_BLOCK); // rule 1
|
|
||||||
nonDataBlockBagItems.put(BlockID.QUARTZ_ORE, new BaseItemStack(ItemID.NETHER_QUARTZ)); // rule 3
|
|
||||||
addIdentity(BlockID.HOPPER); // rule 1
|
|
||||||
addIdentities(BlockID.QUARTZ_BLOCK, 1); // rule 4
|
|
||||||
for (int i = 2; i <= 4; i++) {
|
|
||||||
dataBlockBagItems.put(typeDataKey(BlockID.QUARTZ_BLOCK, i), new BaseItem(BlockID.QUARTZ_BLOCK)); // rule 4, quartz pillars TODO data
|
|
||||||
// removed
|
|
||||||
}
|
|
||||||
addIdentity(BlockID.QUARTZ_STAIRS); // rule 1
|
|
||||||
addIdentity(BlockID.ACTIVATOR_RAIL); // rule 1
|
|
||||||
addIdentity(BlockID.DROPPER); // rule 1
|
|
||||||
|
|
||||||
addIdentities(BlockID.STAINED_CLAY, 16); // rule 1
|
|
||||||
addIdentity(BlockID.HAY_BLOCK); // rule 1
|
|
||||||
addIdentities(BlockID.CARPET, 16); // rule 1
|
|
||||||
addIdentity(BlockID.HARDENED_CLAY); // rule 1
|
|
||||||
addIdentity(BlockID.COAL_BLOCK); // rule 1
|
|
||||||
|
|
||||||
addIdentities(BlockID.LOG2, 1);
|
|
||||||
addIdentities(BlockID.LEAVES2, 1);
|
|
||||||
addIdentity(BlockID.ACACIA_STAIRS);
|
|
||||||
addIdentity(BlockID.DARK_OAK_STAIRS);
|
|
||||||
addIdentity(BlockID.PACKED_ICE);
|
|
||||||
addIdentities(BlockID.STAINED_GLASS_PANE, 16);
|
|
||||||
addIdentities(BlockID.DOUBLE_PLANT, 6);
|
|
||||||
|
|
||||||
addIdentities(BlockID.ACACIA_DOOR, 8); // rule 2
|
|
||||||
addIdentities(BlockID.BIRCH_DOOR, 8); // rule 2
|
|
||||||
addIdentities(BlockID.JUNGLE_DOOR, 8); // rule 2
|
|
||||||
addIdentities(BlockID.DARK_OAK_DOOR, 8); // rule 2
|
|
||||||
addIdentities(BlockID.SPRUCE_DOOR, 8); // rule 2
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the block or item that this block can be constructed from. If nothing is
|
|
||||||
* dropped, a block with a BaseItemStack of type AIR and size 0 will be returned.
|
|
||||||
* If the block should not be destroyed (i.e. bedrock), null will be returned.
|
|
||||||
*
|
|
||||||
* @param type the type of of the block
|
|
||||||
* @param data the data value of the block
|
|
||||||
* @return the item or null
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
public static BaseItem getBlockBagItem(int type, int data) {
|
|
||||||
BaseItem dropped = nonDataBlockBagItems.get(type);
|
|
||||||
if (dropped != null) return dropped;
|
|
||||||
|
|
||||||
dropped = dataBlockBagItems.get(typeDataKey(type, data));
|
|
||||||
|
|
||||||
if (dropped == null) {
|
|
||||||
return new BaseItemStack(BlockID.AIR, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dropped == doNotDestroy) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return dropped;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addIdentity(int type) {
|
|
||||||
nonDataBlockBagItems.put(type, new BaseItem(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void addIdentities(int type, int maxData) {
|
|
||||||
for (int data = 0; data < maxData; ++data) {
|
|
||||||
dataBlockBagItems.put(typeDataKey(type, data), new BaseItem(type)); // TODO data removed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Random random = new Random();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the block drop for a block.
|
|
||||||
*
|
|
||||||
* @param id the type ID of the block
|
|
||||||
* @param data the data value
|
|
||||||
* @return an item or null
|
|
||||||
*/
|
|
||||||
@Nullable
|
|
||||||
public static BaseItemStack getBlockDrop(int id, short data) {
|
|
||||||
int store;
|
|
||||||
switch (id) {
|
|
||||||
case BlockID.STONE:
|
|
||||||
return new BaseItemStack(BlockID.COBBLESTONE);
|
|
||||||
|
|
||||||
case BlockID.GRASS:
|
|
||||||
return new BaseItemStack(BlockID.DIRT);
|
|
||||||
|
|
||||||
case BlockID.GRAVEL:
|
|
||||||
if (random.nextInt(10) == 0) {
|
|
||||||
return new BaseItemStack(ItemID.FLINT);
|
|
||||||
} else {
|
|
||||||
return new BaseItemStack(BlockID.GRAVEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
case BlockID.COAL_ORE:
|
|
||||||
return new BaseItemStack(ItemID.COAL);
|
|
||||||
|
|
||||||
case BlockID.LEAVES:
|
|
||||||
if (random.nextDouble() > 0.95) {
|
|
||||||
return new BaseItemStack(BlockID.SAPLING, 1, data);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
case BlockID.LAPIS_LAZULI_ORE:
|
|
||||||
return new BaseItemStack(ItemID.INK_SACK, random.nextInt(5) + 4, (short) 4);
|
|
||||||
|
|
||||||
case BlockID.BED:
|
|
||||||
return new BaseItemStack(ItemID.BED_ITEM);
|
|
||||||
|
|
||||||
case BlockID.LONG_GRASS:
|
|
||||||
if (random.nextInt(8) == 0) {
|
|
||||||
return new BaseItemStack(ItemID.SEEDS);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
case BlockID.DOUBLE_STEP:
|
|
||||||
return new BaseItemStack(BlockID.STEP, 2, data);
|
|
||||||
|
|
||||||
case BlockID.REDSTONE_WIRE:
|
|
||||||
return new BaseItemStack(ItemID.REDSTONE_DUST);
|
|
||||||
|
|
||||||
case BlockID.DIAMOND_ORE:
|
|
||||||
return new BaseItemStack(ItemID.DIAMOND);
|
|
||||||
|
|
||||||
case BlockID.CROPS:
|
|
||||||
if (data == 7) return new BaseItemStack(ItemID.WHEAT);
|
|
||||||
return new BaseItemStack(ItemID.SEEDS);
|
|
||||||
|
|
||||||
case BlockID.SOIL:
|
|
||||||
return new BaseItemStack(BlockID.DIRT);
|
|
||||||
|
|
||||||
case BlockID.BURNING_FURNACE:
|
|
||||||
return new BaseItemStack(BlockID.FURNACE);
|
|
||||||
|
|
||||||
case BlockID.SIGN_POST:
|
|
||||||
return new BaseItemStack(ItemID.SIGN);
|
|
||||||
|
|
||||||
case BlockID.WOODEN_DOOR:
|
|
||||||
return new BaseItemStack(ItemID.WOODEN_DOOR_ITEM);
|
|
||||||
|
|
||||||
case BlockID.WALL_SIGN:
|
|
||||||
return new BaseItemStack(ItemID.SIGN);
|
|
||||||
|
|
||||||
case BlockID.IRON_DOOR:
|
|
||||||
return new BaseItemStack(ItemID.IRON_DOOR_ITEM);
|
|
||||||
|
|
||||||
case BlockID.REDSTONE_ORE:
|
|
||||||
case BlockID.GLOWING_REDSTONE_ORE:
|
|
||||||
return new BaseItemStack(ItemID.REDSTONE_DUST, (random.nextInt(2) + 4));
|
|
||||||
|
|
||||||
case BlockID.REDSTONE_TORCH_OFF:
|
|
||||||
return new BaseItemStack(BlockID.REDSTONE_TORCH_ON);
|
|
||||||
|
|
||||||
case BlockID.CLAY:
|
|
||||||
return new BaseItemStack(ItemID.CLAY_BALL, 4);
|
|
||||||
|
|
||||||
case BlockID.REED:
|
|
||||||
return new BaseItemStack(ItemID.SUGAR_CANE_ITEM);
|
|
||||||
|
|
||||||
case BlockID.LIGHTSTONE:
|
|
||||||
return new BaseItemStack(ItemID.LIGHTSTONE_DUST, (random.nextInt(3) + 2));
|
|
||||||
|
|
||||||
case BlockID.REDSTONE_REPEATER_OFF:
|
|
||||||
case BlockID.REDSTONE_REPEATER_ON:
|
|
||||||
return new BaseItemStack(ItemID.REDSTONE_REPEATER);
|
|
||||||
|
|
||||||
case BlockID.BROWN_MUSHROOM_CAP:
|
|
||||||
store = random.nextInt(10);
|
|
||||||
if (store == 0) {
|
|
||||||
return new BaseItemStack(BlockID.BROWN_MUSHROOM, 2);
|
|
||||||
} else if (store == 1) {
|
|
||||||
return new BaseItemStack(BlockID.BROWN_MUSHROOM);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
case BlockID.RED_MUSHROOM_CAP:
|
|
||||||
store = random.nextInt(10);
|
|
||||||
if (store == 0) {
|
|
||||||
return new BaseItemStack(BlockID.RED_MUSHROOM, 2);
|
|
||||||
} else if (store == 1) {
|
|
||||||
return new BaseItemStack(BlockID.RED_MUSHROOM);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
case BlockID.MELON_BLOCK:
|
|
||||||
return new BaseItemStack(ItemID.MELON, (random.nextInt(5) + 3));
|
|
||||||
|
|
||||||
case BlockID.PUMPKIN_STEM:
|
|
||||||
return new BaseItemStack(ItemID.PUMPKIN_SEEDS);
|
|
||||||
|
|
||||||
case BlockID.MELON_STEM:
|
|
||||||
return new BaseItemStack(ItemID.MELON_SEEDS);
|
|
||||||
|
|
||||||
case BlockID.MYCELIUM:
|
|
||||||
return new BaseItemStack(BlockID.DIRT);
|
|
||||||
|
|
||||||
case BlockID.LILY_PAD:
|
|
||||||
return new BaseItemStack(BlockID.LILY_PAD);
|
|
||||||
|
|
||||||
case BlockID.NETHER_WART:
|
|
||||||
return new BaseItemStack(ItemID.NETHER_WART_SEED, random.nextInt(3) + 1);
|
|
||||||
|
|
||||||
case BlockID.BREWING_STAND:
|
|
||||||
return new BaseItemStack(ItemID.BREWING_STAND);
|
|
||||||
|
|
||||||
case BlockID.CAULDRON:
|
|
||||||
return new BaseItemStack(ItemID.CAULDRON);
|
|
||||||
|
|
||||||
case BlockID.REDSTONE_LAMP_ON:
|
|
||||||
return new BaseItemStack(BlockID.REDSTONE_LAMP_OFF);
|
|
||||||
|
|
||||||
case BlockID.DOUBLE_WOODEN_STEP:
|
|
||||||
return new BaseItemStack(BlockID.WOODEN_STEP, 2, data);
|
|
||||||
|
|
||||||
case BlockID.COCOA_PLANT:
|
|
||||||
return new BaseItemStack(ItemID.INK_SACK, (data >= 2 ? 3 : 1), (short) 3);
|
|
||||||
|
|
||||||
case BlockID.EMERALD_ORE:
|
|
||||||
return new BaseItemStack(ItemID.EMERALD);
|
|
||||||
|
|
||||||
case BlockID.TRIPWIRE:
|
|
||||||
return new BaseItemStack(ItemID.STRING);
|
|
||||||
|
|
||||||
case BlockID.FLOWER_POT:
|
|
||||||
return new BaseItemStack(ItemID.FLOWER_POT);
|
|
||||||
|
|
||||||
case BlockID.CARROTS:
|
|
||||||
return new BaseItemStack(ItemID.CARROT, random.nextInt(3) + 1);
|
|
||||||
|
|
||||||
case BlockID.POTATOES:
|
|
||||||
return new BaseItemStack(ItemID.POTATO, random.nextInt(3) + 1);
|
|
||||||
|
|
||||||
case BlockID.COMPARATOR_OFF:
|
|
||||||
case BlockID.COMPARATOR_ON:
|
|
||||||
return new BaseItemStack(ItemID.COMPARATOR);
|
|
||||||
|
|
||||||
case BlockID.QUARTZ_ORE:
|
|
||||||
return new BaseItemStack(ItemID.NETHER_QUARTZ);
|
|
||||||
|
|
||||||
case BlockID.QUARTZ_BLOCK:
|
|
||||||
return new BaseItemStack(BlockID.QUARTZ_BLOCK, 1, (data >= 2 ? 2 : data));
|
|
||||||
|
|
||||||
case BlockID.LOG:
|
|
||||||
return new BaseItemStack(BlockID.LOG, 1, (short) (data & 0x3)); // strip orientation data
|
|
||||||
|
|
||||||
case BlockID.HAY_BLOCK:
|
|
||||||
return new BaseItemStack(BlockID.HAY_BLOCK); // strip orientation data
|
|
||||||
|
|
||||||
case BlockID.OAK_WOOD_STAIRS:
|
|
||||||
case BlockID.COBBLESTONE_STAIRS:
|
|
||||||
case BlockID.BRICK_STAIRS:
|
|
||||||
case BlockID.STONE_BRICK_STAIRS:
|
|
||||||
case BlockID.NETHER_BRICK_STAIRS:
|
|
||||||
case BlockID.SPRUCE_WOOD_STAIRS:
|
|
||||||
case BlockID.BIRCH_WOOD_STAIRS:
|
|
||||||
case BlockID.JUNGLE_WOOD_STAIRS:
|
|
||||||
case BlockID.QUARTZ_STAIRS:
|
|
||||||
return new BaseItemStack(id); // strip data from stairs
|
|
||||||
|
|
||||||
case BlockID.BEDROCK:
|
|
||||||
case BlockID.WATER:
|
|
||||||
case BlockID.STATIONARY_WATER:
|
|
||||||
case BlockID.LAVA:
|
|
||||||
case BlockID.STATIONARY_LAVA:
|
|
||||||
case BlockID.GLASS:
|
|
||||||
case BlockID.STAINED_GLASS_PANE:
|
|
||||||
case BlockID.PISTON_EXTENSION:
|
|
||||||
case BlockID.BOOKCASE:
|
|
||||||
case BlockID.FIRE:
|
|
||||||
case BlockID.MOB_SPAWNER:
|
|
||||||
case BlockID.SNOW:
|
|
||||||
case BlockID.ICE:
|
|
||||||
case BlockID.PORTAL:
|
|
||||||
case BlockID.AIR:
|
|
||||||
case BlockID.SILVERFISH_BLOCK:
|
|
||||||
case BlockID.VINE:
|
|
||||||
case BlockID.END_PORTAL:
|
|
||||||
case BlockID.END_PORTAL_FRAME:
|
|
||||||
case BlockID.HEAD:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new BaseItemStack(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 {
|
||||||
|
@ -1,63 +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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of item IDs.
|
|
||||||
*
|
|
||||||
* {@deprecated Please use {@link com.sk89q.worldedit.blocks.type.ItemTypes}}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public final class ItemID {
|
|
||||||
|
|
||||||
public static final int COAL = 263;
|
|
||||||
public static final int DIAMOND = 264;
|
|
||||||
public static final int STRING = 287;
|
|
||||||
public static final int SEEDS = 295;
|
|
||||||
public static final int WHEAT = 296;
|
|
||||||
public static final int FLINT = 318;
|
|
||||||
public static final int SIGN = 323;
|
|
||||||
public static final int WOODEN_DOOR_ITEM = 324;
|
|
||||||
public static final int IRON_DOOR_ITEM = 330;
|
|
||||||
public static final int REDSTONE_DUST = 331;
|
|
||||||
public static final int CLAY_BALL = 337;
|
|
||||||
public static final int SUGAR_CANE_ITEM = 338;
|
|
||||||
public static final int LIGHTSTONE_DUST = 348;
|
|
||||||
public static final int INK_SACK = 351;
|
|
||||||
public static final int CAKE_ITEM = 354;
|
|
||||||
public static final int BED_ITEM = 355;
|
|
||||||
public static final int REDSTONE_REPEATER = 356;
|
|
||||||
public static final int MELON = 360;
|
|
||||||
public static final int PUMPKIN_SEEDS = 361;
|
|
||||||
public static final int MELON_SEEDS = 362;
|
|
||||||
public static final int NETHER_WART_SEED = 372;
|
|
||||||
public static final int BREWING_STAND = 379;
|
|
||||||
public static final int CAULDRON = 380;
|
|
||||||
public static final int EMERALD = 388;
|
|
||||||
public static final int FLOWER_POT = 390;
|
|
||||||
public static final int CARROT = 391;
|
|
||||||
public static final int POTATO = 392;
|
|
||||||
public static final int COMPARATOR = 404;
|
|
||||||
public static final int NETHER_QUARTZ = 406;
|
|
||||||
|
|
||||||
private ItemID() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -22,10 +22,8 @@ package com.sk89q.worldedit.world;
|
|||||||
import com.sk89q.worldedit.BlockVector2D;
|
import com.sk89q.worldedit.BlockVector2D;
|
||||||
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.BaseItem;
|
import com.sk89q.worldedit.blocks.BaseItem;
|
||||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
import com.sk89q.worldedit.blocks.BlockType;
|
|
||||||
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.BlockTypes;
|
||||||
@ -77,27 +75,6 @@ public abstract class AbstractWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void simulateBlockMine(Vector pt) {
|
|
||||||
BaseBlock block = getLazyBlock(pt);
|
|
||||||
BaseItemStack stack = BlockType.getBlockDrop(block.getId(), (short) block.getData());
|
|
||||||
|
|
||||||
if (stack != null) {
|
|
||||||
final int amount = stack.getAmount();
|
|
||||||
if (amount > 1) {
|
|
||||||
dropItem(pt, new BaseItemStack(stack.getType(), stack.getNbtData(), 1), amount);
|
|
||||||
} else {
|
|
||||||
dropItem(pt, stack, amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
setBlock(pt, BlockTypes.AIR.getDefaultState());
|
|
||||||
} catch (WorldEditException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkLoadedChunk(Vector pt) {
|
public void checkLoadedChunk(Vector pt) {
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,10 @@ public class NullWorld extends AbstractWorld {
|
|||||||
public void dropItem(Vector position, BaseItemStack item) {
|
public void dropItem(Vector position, BaseItemStack item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simulateBlockMine(Vector position) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean regenerate(Region region, EditSession editSession) {
|
public boolean regenerate(Region region, EditSession editSession) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.forge;
|
package com.sk89q.worldedit.forge;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
@ -45,8 +47,6 @@ 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.Registries;
|
|
||||||
|
|
||||||
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;
|
||||||
@ -88,15 +88,13 @@ import net.minecraft.world.gen.feature.WorldGenTrees;
|
|||||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An adapter to Minecraft worlds for WorldEdit.
|
* An adapter to Minecraft worlds for WorldEdit.
|
||||||
@ -267,6 +265,14 @@ public class ForgeWorld extends AbstractWorld {
|
|||||||
getWorld().spawnEntity(entity);
|
getWorld().spawnEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simulateBlockMine(Vector position) {
|
||||||
|
BlockPos pos = ForgeAdapter.toBlockPos(position);
|
||||||
|
IBlockState state = getWorld().getBlockState(pos);
|
||||||
|
state.getBlock().dropBlockAsItem(getWorld(), pos, state, 0);
|
||||||
|
getWorld().setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean regenerate(Region region, EditSession editSession) {
|
public boolean regenerate(Region region, EditSession editSession) {
|
||||||
// Don't even try to regen if it's going to fail.
|
// Don't even try to regen if it's going to fail.
|
||||||
|
@ -215,6 +215,11 @@ public abstract class SpongeWorld extends AbstractWorld {
|
|||||||
getWorld().spawnEntity(entity);
|
getWorld().spawnEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simulateBlockMine(Vector position) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getWorld().hashCode();
|
return getWorld().hashCode();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren