2010-10-15 07:22:03 +00:00
|
|
|
// $Id$
|
|
|
|
/*
|
|
|
|
* WorldEdit
|
2012-01-05 21:38:23 +00:00
|
|
|
* Copyright (C) 2010 sk89q <http://www.sk89q.com> and contributors
|
2010-10-15 07:22:03 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.sk89q.worldedit.blocks;
|
|
|
|
|
2012-10-28 19:12:39 +00:00
|
|
|
import java.util.EnumSet;
|
|
|
|
import java.util.HashMap;
|
2012-01-22 09:23:41 +00:00
|
|
|
import java.util.HashSet;
|
2010-10-15 07:22:03 +00:00
|
|
|
import java.util.Map;
|
2011-09-18 04:52:12 +00:00
|
|
|
import java.util.Random;
|
2012-01-22 09:23:41 +00:00
|
|
|
import java.util.Set;
|
2011-09-16 01:32:58 +00:00
|
|
|
|
2011-06-05 18:59:23 +00:00
|
|
|
import com.sk89q.util.StringUtil;
|
2011-09-29 10:35:08 +00:00
|
|
|
import com.sk89q.worldedit.PlayerDirection;
|
2010-10-15 07:22:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Block types.
|
|
|
|
*
|
|
|
|
* @author sk89q
|
|
|
|
*/
|
|
|
|
public enum BlockType {
|
2011-09-03 16:54:20 +00:00
|
|
|
AIR(BlockID.AIR, "Air", "air"),
|
|
|
|
STONE(BlockID.STONE, "Stone", "stone", "rock"),
|
|
|
|
GRASS(BlockID.GRASS, "Grass", "grass"),
|
|
|
|
DIRT(BlockID.DIRT, "Dirt", "dirt"),
|
|
|
|
COBBLESTONE(BlockID.COBBLESTONE, "Cobblestone", "cobblestone", "cobble"),
|
|
|
|
WOOD(BlockID.WOOD, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
|
|
|
|
SAPLING(BlockID.SAPLING, "Sapling", "sapling", "seedling"),
|
|
|
|
BEDROCK(BlockID.BEDROCK, "Bedrock", "adminium", "bedrock"),
|
|
|
|
WATER(BlockID.WATER, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
|
|
|
|
STATIONARY_WATER(BlockID.STATIONARY_WATER, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
|
|
|
|
LAVA(BlockID.LAVA, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
|
|
|
|
STATIONARY_LAVA(BlockID.STATIONARY_LAVA, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
|
|
|
|
SAND(BlockID.SAND, "Sand", "sand"),
|
|
|
|
GRAVEL(BlockID.GRAVEL, "Gravel", "gravel"),
|
|
|
|
GOLD_ORE(BlockID.GOLD_ORE, "Gold ore", "goldore"),
|
|
|
|
IRON_ORE(BlockID.IRON_ORE, "Iron ore", "ironore"),
|
|
|
|
COAL_ORE(BlockID.COAL_ORE, "Coal ore", "coalore"),
|
|
|
|
LOG(BlockID.LOG, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
|
|
|
|
LEAVES(BlockID.LEAVES, "Leaves", "leaves", "leaf"),
|
|
|
|
SPONGE(BlockID.SPONGE, "Sponge", "sponge"),
|
|
|
|
GLASS(BlockID.GLASS, "Glass", "glass"),
|
|
|
|
LAPIS_LAZULI_ORE(BlockID.LAPIS_LAZULI_ORE, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
|
|
|
|
LAPIS_LAZULI(BlockID.LAPIS_LAZULI_BLOCK, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
|
|
|
|
DISPENSER(BlockID.DISPENSER, "Dispenser", "dispenser"),
|
|
|
|
SANDSTONE(BlockID.SANDSTONE, "Sandstone", "sandstone"),
|
|
|
|
NOTE_BLOCK(BlockID.NOTE_BLOCK, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
|
|
|
|
BED(BlockID.BED, "Bed", "bed"),
|
|
|
|
POWERED_RAIL(BlockID.POWERED_RAIL, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
|
|
|
|
DETECTOR_RAIL(BlockID.DETECTOR_RAIL, "Detector Rail", "detectorrail", "detector"),
|
|
|
|
PISTON_STICKY_BASE(BlockID.PISTON_STICKY_BASE, "Sticky Piston", "stickypiston"),
|
|
|
|
WEB(BlockID.WEB, "Web", "web", "spiderweb"),
|
|
|
|
LONG_GRASS(BlockID.LONG_GRASS, "Long grass", "longgrass", "tallgrass"),
|
|
|
|
DEAD_BUSH(BlockID.DEAD_BUSH, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
|
|
|
|
PISTON_BASE(BlockID.PISTON_BASE, "Piston", "piston"),
|
|
|
|
PISTON_EXTENSION(BlockID.PISTON_EXTENSION, "Piston extension", "pistonextendsion", "pistonhead"),
|
|
|
|
CLOTH(BlockID.CLOTH, "Wool", "cloth", "wool"),
|
|
|
|
PISTON_MOVING_PIECE(BlockID.PISTON_MOVING_PIECE, "Piston moving piece", "movingpiston"),
|
|
|
|
YELLOW_FLOWER(BlockID.YELLOW_FLOWER, "Yellow flower", "yellowflower", "flower"),
|
|
|
|
RED_FLOWER(BlockID.RED_FLOWER, "Red rose", "redflower", "redrose", "rose"),
|
|
|
|
BROWN_MUSHROOM(BlockID.BROWN_MUSHROOM, "Brown mushroom", "brownmushroom", "mushroom"),
|
|
|
|
RED_MUSHROOM(BlockID.RED_MUSHROOM, "Red mushroom", "redmushroom"),
|
|
|
|
GOLD_BLOCK(BlockID.GOLD_BLOCK, "Gold block", "gold", "goldblock"),
|
|
|
|
IRON_BLOCK(BlockID.IRON_BLOCK, "Iron block", "iron", "ironblock"),
|
|
|
|
DOUBLE_STEP(BlockID.DOUBLE_STEP, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
|
|
|
|
STEP(BlockID.STEP, "Step", "slab", "stoneslab", "step", "halfstep"),
|
|
|
|
BRICK(BlockID.BRICK, "Brick", "brick", "brickblock"),
|
|
|
|
TNT(BlockID.TNT, "TNT", "tnt", "c4", "explosive"),
|
|
|
|
BOOKCASE(BlockID.BOOKCASE, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
|
|
|
|
MOSSY_COBBLESTONE(BlockID.MOSSY_COBBLESTONE, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
|
|
|
|
OBSIDIAN(BlockID.OBSIDIAN, "Obsidian", "obsidian"),
|
|
|
|
TORCH(BlockID.TORCH, "Torch", "torch", "light", "candle"),
|
|
|
|
FIRE(BlockID.FIRE, "Fire", "fire", "flame", "flames"),
|
|
|
|
MOB_SPAWNER(BlockID.MOB_SPAWNER, "Mob spawner", "mobspawner", "spawner"),
|
|
|
|
WOODEN_STAIRS(BlockID.WOODEN_STAIRS, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
|
|
|
|
CHEST(BlockID.CHEST, "Chest", "chest", "storage", "storagechest"),
|
|
|
|
REDSTONE_WIRE(BlockID.REDSTONE_WIRE, "Redstone wire", "redstone", "redstoneblock"),
|
|
|
|
DIAMOND_ORE(BlockID.DIAMOND_ORE, "Diamond ore", "diamondore"),
|
|
|
|
DIAMOND_BLOCK(BlockID.DIAMOND_BLOCK, "Diamond block", "diamond", "diamondblock"),
|
|
|
|
WORKBENCH(BlockID.WORKBENCH, "Workbench", "workbench", "table", "craftingtable", "crafting"),
|
|
|
|
CROPS(BlockID.CROPS, "Crops", "crops", "crop", "plant", "plants"),
|
|
|
|
SOIL(BlockID.SOIL, "Soil", "soil", "farmland"),
|
|
|
|
FURNACE(BlockID.FURNACE, "Furnace", "furnace"),
|
|
|
|
BURNING_FURNACE(BlockID.BURNING_FURNACE, "Furnace (burning)", "burningfurnace", "litfurnace"),
|
|
|
|
SIGN_POST(BlockID.SIGN_POST, "Sign post", "sign", "signpost"),
|
|
|
|
WOODEN_DOOR(BlockID.WOODEN_DOOR, "Wooden door", "wooddoor", "woodendoor", "door"),
|
|
|
|
LADDER(BlockID.LADDER, "Ladder", "ladder"),
|
|
|
|
MINECART_TRACKS(BlockID.MINECART_TRACKS, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
|
|
|
|
COBBLESTONE_STAIRS(BlockID.COBBLESTONE_STAIRS, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
|
|
|
|
WALL_SIGN(BlockID.WALL_SIGN, "Wall sign", "wallsign"),
|
|
|
|
LEVER(BlockID.LEVER, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
|
|
|
|
STONE_PRESSURE_PLATE(BlockID.STONE_PRESSURE_PLATE, "Stone pressure plate", "stonepressureplate", "stoneplate"),
|
|
|
|
IRON_DOOR(BlockID.IRON_DOOR, "Iron Door", "irondoor"),
|
|
|
|
WOODEN_PRESSURE_PLATE(BlockID.WOODEN_PRESSURE_PLATE, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
|
|
|
|
REDSTONE_ORE(BlockID.REDSTONE_ORE, "Redstone ore", "redstoneore"),
|
|
|
|
GLOWING_REDSTONE_ORE(BlockID.GLOWING_REDSTONE_ORE, "Glowing redstone ore", "glowingredstoneore"),
|
|
|
|
REDSTONE_TORCH_OFF(BlockID.REDSTONE_TORCH_OFF, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
|
|
|
|
REDSTONE_TORCH_ON(BlockID.REDSTONE_TORCH_ON, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
|
|
|
|
STONE_BUTTON(BlockID.STONE_BUTTON, "Stone Button", "stonebutton", "button"),
|
|
|
|
SNOW(BlockID.SNOW, "Snow", "snow"),
|
|
|
|
ICE(BlockID.ICE, "Ice", "ice"),
|
|
|
|
SNOW_BLOCK(BlockID.SNOW_BLOCK, "Snow block", "snowblock"),
|
|
|
|
CACTUS(BlockID.CACTUS, "Cactus", "cactus", "cacti"),
|
|
|
|
CLAY(BlockID.CLAY, "Clay", "clay"),
|
|
|
|
SUGAR_CANE(BlockID.REED, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
|
|
|
|
JUKEBOX(BlockID.JUKEBOX, "Jukebox", "jukebox", "stereo", "recordplayer"),
|
|
|
|
FENCE(BlockID.FENCE, "Fence", "fence"),
|
|
|
|
PUMPKIN(BlockID.PUMPKIN, "Pumpkin", "pumpkin"),
|
|
|
|
NETHERRACK(BlockID.NETHERRACK, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
|
|
|
|
SOUL_SAND(BlockID.SLOW_SAND, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
|
|
|
|
GLOWSTONE(BlockID.LIGHTSTONE, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
|
|
|
|
PORTAL(BlockID.PORTAL, "Portal", "portal"),
|
|
|
|
JACK_O_LANTERN(BlockID.JACKOLANTERN, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
|
|
|
|
CAKE(BlockID.CAKE_BLOCK, "Cake", "cake", "cakeblock"),
|
|
|
|
REDSTONE_REPEATER_OFF(BlockID.REDSTONE_REPEATER_OFF, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeateroff", "delayeroff"),
|
|
|
|
REDSTONE_REPEATER_ON(BlockID.REDSTONE_REPEATER_ON, "Redstone repeater (on)", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
|
|
|
|
LOCKED_CHEST(BlockID.LOCKED_CHEST, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
|
2011-09-14 05:45:47 +00:00
|
|
|
TRAP_DOOR(BlockID.TRAP_DOOR, "Trap door", "trapdoor", "hatch", "floordoor"),
|
|
|
|
SILVERFISH_BLOCK(BlockID.SILVERFISH_BLOCK, "Silverfish block", "silverfish", "silver"),
|
|
|
|
STONE_BRICK(BlockID.STONE_BRICK, "Stone brick", "stonebrick", "sbrick", "smoothstonebrick"),
|
|
|
|
RED_MUSHROOM_CAP(BlockID.RED_MUSHROOM_CAP, "Red mushroom cap", "giantmushroomred", "redgiantmushroom", "redmushroomcap"),
|
|
|
|
BROWN_MUSHROOM_CAP(BlockID.BROWN_MUSHROOM_CAP, "Brown mushroom cap", "giantmushroombrown", "browngiantmushoom", "brownmushroomcap"),
|
|
|
|
IRON_BARS(BlockID.IRON_BARS, "Iron bars", "ironbars", "ironfence"),
|
|
|
|
GLASS_PANE(BlockID.GLASS_PANE, "Glass pane", "window", "glasspane", "glasswindow"),
|
|
|
|
MELON_BLOCK(BlockID.MELON_BLOCK, "Melon (block)", "melonblock"),
|
|
|
|
PUMPKIN_STEM(BlockID.PUMPKIN_STEM, "Pumpkin stem", "pumpkinstem"),
|
|
|
|
MELON_STEM(BlockID.MELON_STEM, "Melon stem", "melonstem"),
|
|
|
|
VINE(BlockID.VINE, "Vine", "vine", "vines", "creepers"),
|
|
|
|
FENCE_GATE(BlockID.FENCE_GATE, "Fence gate", "fencegate", "gate"),
|
|
|
|
BRICK_STAIRS(BlockID.BRICK_STAIRS, "Brick stairs", "brickstairs", "bricksteps"),
|
2011-10-29 15:11:12 +00:00
|
|
|
STONE_BRICK_STAIRS(BlockID.STONE_BRICK_STAIRS, "Stone brick stairs", "stonebrickstairs", "smoothstonebrickstairs"),
|
2011-11-23 01:29:48 +00:00
|
|
|
MYCELIUM(BlockID.MYCELIUM, "Mycelium", "fungus", "mycel"),
|
2011-10-29 15:11:12 +00:00
|
|
|
LILY_PAD(BlockID.LILY_PAD, "Lily pad", "lilypad", "waterlily"),
|
|
|
|
NETHER_BRICK(BlockID.NETHER_BRICK, "Nether brick", "netherbrick"),
|
|
|
|
NETHER_BRICK_FENCE(BlockID.NETHER_BRICK_FENCE, "Nether brick fence", "netherbrickfence", "netherfence"),
|
|
|
|
NETHER_BRICK_STAIRS(BlockID.NETHER_BRICK_STAIRS, "Nether brick stairs", "netherbrickstairs", "netherbricksteps", "netherstairs", "nethersteps"),
|
|
|
|
NETHER_WART(BlockID.NETHER_WART, "Nether wart", "netherwart", "netherstalk"),
|
|
|
|
ENCHANTMENT_TABLE(BlockID.ENCHANTMENT_TABLE, "Enchantment table", "enchantmenttable", "enchanttable"),
|
|
|
|
BREWING_STAND(BlockID.BREWING_STAND, "Brewing Stand", "brewingstand"),
|
|
|
|
CAULDRON(BlockID.CAULDRON, "Cauldron"),
|
|
|
|
END_PORTAL(BlockID.END_PORTAL, "End Portal", "endportal", "blackstuff", "airportal", "weirdblackstuff"),
|
|
|
|
END_PORTAL_FRAME(BlockID.END_PORTAL_FRAME, "End Portal Frame", "endportalframe", "airportalframe", "crystalblock"),
|
2011-11-27 23:29:26 +00:00
|
|
|
END_STONE(BlockID.END_STONE, "End Stone", "endstone", "enderstone", "endersand"),
|
2012-03-02 04:28:09 +00:00
|
|
|
DRAGON_EGG(BlockID.DRAGON_EGG, "Dragon Egg", "dragonegg", "dragons"),
|
|
|
|
REDSTONE_LAMP_OFF(BlockID.REDSTONE_LAMP_OFF, "Redstone lamp (off)", "redstonelamp", "redstonelampoff", "rslamp", "rslampoff", "rsglow", "rsglowoff"),
|
2012-08-07 01:49:13 +00:00
|
|
|
REDSTONE_LAMP_ON(BlockID.REDSTONE_LAMP_ON, "Redstone lamp (on)", "redstonelampon", "rslampon", "rsglowon"),
|
|
|
|
DOUBLE_WOODEN_STEP(BlockID.DOUBLE_WOODEN_STEP, "Double wood step", "doublewoodslab", "doublewoodstep"),
|
|
|
|
WOODEN_STEP(BlockID.WOODEN_STEP, "Wood step", "woodenslab", "woodslab", "woodstep", "woodhalfstep"),
|
|
|
|
COCOA_PLANT(BlockID.COCOA_PLANT, "Cocoa plant", "cocoplant", "cocoaplant"),
|
|
|
|
SANDSTONE_STAIRS(BlockID.SANDSTONE_STAIRS, "Sandstone stairs", "sandstairs", "sandstonestairs"),
|
|
|
|
EMERALD_ORE(BlockID.EMERALD_ORE, "Emerald ore", "emeraldore"),
|
|
|
|
ENDER_CHEST(BlockID.ENDER_CHEST, "Ender chest", "enderchest"),
|
|
|
|
TRIPWIRE_HOOK(BlockID.TRIPWIRE_HOOK, "Tripwire hook", "tripwirehook"),
|
2012-10-20 00:01:45 +00:00
|
|
|
TRIPWIRE(BlockID.TRIPWIRE, "Tripwire", "tripwire", "string"),
|
|
|
|
EMERALD_BLOCK(BlockID.EMERALD_BLOCK, "Emerald block", "emeraldblock", "emerald"),
|
2012-08-07 01:49:13 +00:00
|
|
|
SPRUCE_WOOD_STAIRS(BlockID.SPRUCE_WOOD_STAIRS, "Spruce wood stairs", "sprucestairs", "sprucewoodstairs"),
|
|
|
|
BIRCH_WOOD_STAIRS(BlockID.BIRCH_WOOD_STAIRS, "Birch wood stairs", "birchstairs", "birchwoodstairs"),
|
2012-10-28 19:12:39 +00:00
|
|
|
JUNGLE_WOOD_STAIRS(BlockID.JUNGLE_WOOD_STAIRS, "Jungle wood stairs", "junglestairs", "junglewoodstairs"),
|
|
|
|
COMMAND_BLOCK(BlockID.COMMAND_BLOCK, "Command block", "commandblock", "cmdblock", "command", "cmd"),
|
|
|
|
BEACON(BlockID.BEACON, "Beacon", "beacon", "beaconblock"),
|
|
|
|
COBBLESTONE_WALL(BlockID.COBBLESTONE_WALL, "Cobblestone wall", "cobblestonewall", "cobblewall"),
|
|
|
|
FLOWER_POT(BlockID.FLOWER_POT, "Flower pot", "flowerpot", "plantpot", "pot"),
|
|
|
|
CARROTS(BlockID.CARROTS, "Carrots", "carrots", "carrotsplant", "carrotsblock"),
|
|
|
|
POTATOES(BlockID.POTATOES, "Potatoes", "patatoes", "potatoesblock"),
|
|
|
|
WOODEN_BUTTON(BlockID.WOODEN_BUTTON, "Wooden button", "woodbutton", "woodenbutton"),
|
|
|
|
HEAD(BlockID.HEAD, "Head", "head", "headmount", "mount"),
|
2013-03-03 05:55:57 +00:00
|
|
|
ANVIL(BlockID.ANVIL, "Anvil", "anvil", "blacksmith"),
|
|
|
|
TRAPPED_CHEST(BlockID.TRAPPED_CHEST, "Trapped Chest", "trappedchest", "redstonechest"),
|
|
|
|
PRESSURE_PLATE_LIGHT(BlockID.PRESSURE_PLATE_LIGHT, "Weighted Pressure Plate (Light)", "lightpressureplate"),
|
|
|
|
PRESSURE_PLATE_HEAVY(BlockID.PRESSURE_PLATE_HEAVY, "Weighted Pressure Plate (Heavy)", "heavypressureplate"),
|
|
|
|
COMPARATOR_OFF(BlockID.COMPARATOR_OFF, "Redstone Comparator (inactive)", "redstonecomparator", "comparator"),
|
|
|
|
COMPARATOR_ON(BlockID.COMPARATOR_ON, "Redstone Comparator (active)", "redstonecomparatoron", "comparatoron"),
|
|
|
|
DAYLIGHT_SENSOR(BlockID.DAYLIGHT_SENSOR, "Daylight Sesnor", "daylightsensor", "lightsensor"),
|
|
|
|
REDSTONE_BLOCK(BlockID.REDSTONE_BLOCK, "Block of Redstone", "redstoneblock", "blockofredstone"),
|
|
|
|
QUARTZ_ORE(BlockID.QUARTZ_ORE, "Nether Quartz Ore", "quartzore", "netherquartzore"),
|
|
|
|
HOPPER(BlockID.HOPPER, "Hopper", "hopper"),
|
|
|
|
QUARTZ_BLOCK(BlockID.QUARTZ_BLOCK, "Block of Quartz", "quartzblock"),
|
|
|
|
QUARTZ_STAIRS(BlockID.QUARTZ_STAIRS, "Quartz Stairs", "quartzstairs"),
|
|
|
|
ACTIVATOR_RAIL(BlockID.ACTIVATOR_RAIL, "Activator Rail", "activatorrail", "tntrail", "activatortrack"),
|
|
|
|
DROPPER(BlockID.DROPPER, "Dropper", "dropper");
|
2010-10-15 07:22:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores a map of the IDs for fast access.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Map<Integer, BlockType> ids = new HashMap<Integer, BlockType>();
|
2010-10-15 07:22:03 +00:00
|
|
|
/**
|
|
|
|
* Stores a map of the names for fast access.
|
|
|
|
*/
|
2011-11-23 01:29:48 +00:00
|
|
|
private static final Map<String, BlockType> lookup = new HashMap<String, BlockType>();
|
2010-10-15 07:22:03 +00:00
|
|
|
|
|
|
|
private final int id;
|
|
|
|
private final String name;
|
|
|
|
private final String[] lookupKeys;
|
|
|
|
|
|
|
|
static {
|
2012-01-22 09:23:41 +00:00
|
|
|
for (BlockType type : EnumSet.allOf(BlockType.class)) {
|
|
|
|
ids.put(type.id, type);
|
2010-10-15 07:22:03 +00:00
|
|
|
for (String key : type.lookupKeys) {
|
|
|
|
lookup.put(key, type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct the type.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @param name
|
|
|
|
*/
|
|
|
|
BlockType(int id, String name, String lookupKey) {
|
|
|
|
this.id = id;
|
|
|
|
this.name = name;
|
2011-10-29 15:11:12 +00:00
|
|
|
this.lookupKeys = new String[] { lookupKey };
|
2010-10-15 07:22:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct the type.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @param name
|
|
|
|
*/
|
2011-11-23 01:29:48 +00:00
|
|
|
BlockType(int id, String name, String... lookupKeys) {
|
2010-10-15 07:22:03 +00:00
|
|
|
this.id = id;
|
|
|
|
this.name = name;
|
|
|
|
this.lookupKeys = lookupKeys;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return type from ID. May return null.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static BlockType fromID(int id) {
|
2012-01-22 09:23:41 +00:00
|
|
|
return ids.get(id);
|
2010-10-15 07:22:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return type from name. May return null.
|
|
|
|
*
|
|
|
|
* @param name
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static BlockType lookup(String name) {
|
2011-06-05 18:59:23 +00:00
|
|
|
return lookup(name, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return type from name. May return null.
|
|
|
|
*
|
|
|
|
* @param name
|
|
|
|
* @param fuzzy
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static BlockType lookup(String name, boolean fuzzy) {
|
2012-02-05 05:04:20 +00:00
|
|
|
try {
|
|
|
|
return fromID(Integer.parseInt(name));
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
return StringUtil.lookup(lookup, name, fuzzy);
|
|
|
|
}
|
2010-10-15 07:22:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get block numeric ID.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public int getID() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get user-friendly block name.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
2010-11-05 06:29:38 +00:00
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
|
2010-11-05 06:29:38 +00:00
|
|
|
/**
|
2011-09-16 02:25:20 +00:00
|
|
|
* HashSet for shouldPlaceLast.
|
2010-11-05 06:29:38 +00:00
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> shouldPlaceLast = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
|
|
|
shouldPlaceLast.add(BlockID.SAPLING);
|
2011-09-19 04:41:33 +00:00
|
|
|
shouldPlaceLast.add(BlockID.BED);
|
2011-09-16 02:25:20 +00:00
|
|
|
shouldPlaceLast.add(BlockID.POWERED_RAIL);
|
|
|
|
shouldPlaceLast.add(BlockID.DETECTOR_RAIL);
|
|
|
|
shouldPlaceLast.add(BlockID.LONG_GRASS);
|
|
|
|
shouldPlaceLast.add(BlockID.DEAD_BUSH);
|
2011-09-24 01:00:10 +00:00
|
|
|
shouldPlaceLast.add(BlockID.PISTON_EXTENSION);
|
2011-09-16 02:25:20 +00:00
|
|
|
shouldPlaceLast.add(BlockID.YELLOW_FLOWER);
|
|
|
|
shouldPlaceLast.add(BlockID.RED_FLOWER);
|
|
|
|
shouldPlaceLast.add(BlockID.BROWN_MUSHROOM);
|
|
|
|
shouldPlaceLast.add(BlockID.RED_MUSHROOM);
|
|
|
|
shouldPlaceLast.add(BlockID.TORCH);
|
|
|
|
shouldPlaceLast.add(BlockID.FIRE);
|
|
|
|
shouldPlaceLast.add(BlockID.REDSTONE_WIRE);
|
|
|
|
shouldPlaceLast.add(BlockID.CROPS);
|
|
|
|
shouldPlaceLast.add(BlockID.LADDER);
|
|
|
|
shouldPlaceLast.add(BlockID.MINECART_TRACKS);
|
|
|
|
shouldPlaceLast.add(BlockID.LEVER);
|
|
|
|
shouldPlaceLast.add(BlockID.STONE_PRESSURE_PLATE);
|
|
|
|
shouldPlaceLast.add(BlockID.WOODEN_PRESSURE_PLATE);
|
|
|
|
shouldPlaceLast.add(BlockID.REDSTONE_TORCH_OFF);
|
|
|
|
shouldPlaceLast.add(BlockID.REDSTONE_TORCH_ON);
|
|
|
|
shouldPlaceLast.add(BlockID.STONE_BUTTON);
|
|
|
|
shouldPlaceLast.add(BlockID.SNOW);
|
|
|
|
shouldPlaceLast.add(BlockID.PORTAL);
|
|
|
|
shouldPlaceLast.add(BlockID.REDSTONE_REPEATER_OFF);
|
|
|
|
shouldPlaceLast.add(BlockID.REDSTONE_REPEATER_ON);
|
|
|
|
shouldPlaceLast.add(BlockID.TRAP_DOOR);
|
|
|
|
shouldPlaceLast.add(BlockID.VINE);
|
2011-10-29 15:11:12 +00:00
|
|
|
shouldPlaceLast.add(BlockID.LILY_PAD);
|
|
|
|
shouldPlaceLast.add(BlockID.NETHER_WART);
|
2012-01-17 00:49:54 +00:00
|
|
|
shouldPlaceLast.add(BlockID.PISTON_BASE);
|
|
|
|
shouldPlaceLast.add(BlockID.PISTON_STICKY_BASE);
|
|
|
|
shouldPlaceLast.add(BlockID.PISTON_EXTENSION);
|
|
|
|
shouldPlaceLast.add(BlockID.PISTON_MOVING_PIECE);
|
2012-08-13 21:23:50 +00:00
|
|
|
shouldPlaceLast.add(BlockID.COCOA_PLANT);
|
|
|
|
shouldPlaceLast.add(BlockID.TRIPWIRE_HOOK);
|
|
|
|
shouldPlaceLast.add(BlockID.TRIPWIRE);
|
2012-10-29 03:49:26 +00:00
|
|
|
shouldPlaceLast.add(BlockID.FLOWER_POT);
|
|
|
|
shouldPlaceLast.add(BlockID.CARROTS);
|
|
|
|
shouldPlaceLast.add(BlockID.POTATOES);
|
|
|
|
shouldPlaceLast.add(BlockID.WOODEN_BUTTON);
|
|
|
|
shouldPlaceLast.add(BlockID.HEAD);
|
2013-03-03 05:55:57 +00:00
|
|
|
shouldPlaceLast.add(BlockID.PRESSURE_PLATE_LIGHT);
|
|
|
|
shouldPlaceLast.add(BlockID.PRESSURE_PLATE_HEAVY);
|
|
|
|
shouldPlaceLast.add(BlockID.COMPARATOR_OFF);
|
|
|
|
shouldPlaceLast.add(BlockID.COMPARATOR_ON);
|
|
|
|
shouldPlaceLast.add(BlockID.ACTIVATOR_RAIL);
|
2010-11-05 06:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks to see whether a block should be placed last.
|
2011-09-24 19:32:03 +00:00
|
|
|
*
|
2010-11-05 06:29:38 +00:00
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean shouldPlaceLast(int id) {
|
2011-09-16 02:25:20 +00:00
|
|
|
return shouldPlaceLast.contains(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks to see whether this block should be placed last.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean shouldPlaceLast() {
|
|
|
|
return shouldPlaceLast.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-11-01 16:43:59 +00:00
|
|
|
/**
|
|
|
|
* HashSet for shouldPlaceLast.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> shouldPlaceFinal = new HashSet<Integer>();
|
2011-11-01 16:43:59 +00:00
|
|
|
static {
|
2012-01-17 00:49:54 +00:00
|
|
|
shouldPlaceFinal.add(BlockID.SIGN_POST);
|
|
|
|
shouldPlaceFinal.add(BlockID.WOODEN_DOOR);
|
|
|
|
shouldPlaceFinal.add(BlockID.WALL_SIGN);
|
|
|
|
shouldPlaceFinal.add(BlockID.IRON_DOOR);
|
|
|
|
shouldPlaceFinal.add(BlockID.CACTUS);
|
|
|
|
shouldPlaceFinal.add(BlockID.REED);
|
|
|
|
shouldPlaceFinal.add(BlockID.CAKE_BLOCK);
|
|
|
|
shouldPlaceFinal.add(BlockID.PISTON_EXTENSION);
|
|
|
|
shouldPlaceFinal.add(BlockID.PISTON_MOVING_PIECE);
|
2011-11-01 16:43:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks to see whether a block should be placed in the final queue.
|
|
|
|
*
|
|
|
|
* This applies to blocks that can be attached to other blocks that have an attachment.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean shouldPlaceFinal(int id) {
|
|
|
|
return shouldPlaceFinal.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
|
|
|
* HashSet for canPassThrough.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> canPassThrough = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
|
|
|
canPassThrough.add(BlockID.AIR);
|
|
|
|
canPassThrough.add(BlockID.WATER);
|
|
|
|
canPassThrough.add(BlockID.STATIONARY_WATER);
|
|
|
|
canPassThrough.add(BlockID.SAPLING);
|
|
|
|
canPassThrough.add(BlockID.POWERED_RAIL);
|
|
|
|
canPassThrough.add(BlockID.DETECTOR_RAIL);
|
|
|
|
canPassThrough.add(BlockID.WEB);
|
|
|
|
canPassThrough.add(BlockID.LONG_GRASS);
|
|
|
|
canPassThrough.add(BlockID.DEAD_BUSH);
|
|
|
|
canPassThrough.add(BlockID.YELLOW_FLOWER);
|
|
|
|
canPassThrough.add(BlockID.RED_FLOWER);
|
|
|
|
canPassThrough.add(BlockID.BROWN_MUSHROOM);
|
|
|
|
canPassThrough.add(BlockID.RED_MUSHROOM);
|
|
|
|
canPassThrough.add(BlockID.TORCH);
|
|
|
|
canPassThrough.add(BlockID.FIRE);
|
|
|
|
canPassThrough.add(BlockID.REDSTONE_WIRE);
|
|
|
|
canPassThrough.add(BlockID.CROPS);
|
|
|
|
canPassThrough.add(BlockID.SIGN_POST);
|
|
|
|
canPassThrough.add(BlockID.LADDER);
|
|
|
|
canPassThrough.add(BlockID.MINECART_TRACKS);
|
|
|
|
canPassThrough.add(BlockID.WALL_SIGN);
|
|
|
|
canPassThrough.add(BlockID.LEVER);
|
|
|
|
canPassThrough.add(BlockID.STONE_PRESSURE_PLATE);
|
|
|
|
canPassThrough.add(BlockID.WOODEN_PRESSURE_PLATE);
|
|
|
|
canPassThrough.add(BlockID.REDSTONE_TORCH_OFF);
|
|
|
|
canPassThrough.add(BlockID.REDSTONE_TORCH_ON);
|
|
|
|
canPassThrough.add(BlockID.STONE_BUTTON);
|
|
|
|
canPassThrough.add(BlockID.SNOW);
|
|
|
|
canPassThrough.add(BlockID.REED);
|
|
|
|
canPassThrough.add(BlockID.PORTAL);
|
|
|
|
canPassThrough.add(BlockID.REDSTONE_REPEATER_OFF);
|
|
|
|
canPassThrough.add(BlockID.REDSTONE_REPEATER_ON);
|
2011-10-29 15:11:12 +00:00
|
|
|
canPassThrough.add(BlockID.PUMPKIN_STEM);
|
|
|
|
canPassThrough.add(BlockID.MELON_STEM);
|
2011-09-16 02:25:20 +00:00
|
|
|
canPassThrough.add(BlockID.VINE);
|
2011-10-29 15:11:12 +00:00
|
|
|
canPassThrough.add(BlockID.NETHER_WART);
|
|
|
|
canPassThrough.add(BlockID.END_PORTAL);
|
2012-08-13 21:23:50 +00:00
|
|
|
canPassThrough.add(BlockID.TRIPWIRE_HOOK);
|
|
|
|
canPassThrough.add(BlockID.TRIPWIRE);
|
2012-10-29 03:49:26 +00:00
|
|
|
canPassThrough.add(BlockID.FLOWER_POT);
|
|
|
|
canPassThrough.add(BlockID.CARROTS);
|
|
|
|
canPassThrough.add(BlockID.POTATOES);
|
|
|
|
canPassThrough.add(BlockID.WOODEN_BUTTON);
|
|
|
|
canPassThrough.add(BlockID.HEAD);
|
2013-03-03 05:55:57 +00:00
|
|
|
canPassThrough.add(BlockID.PRESSURE_PLATE_LIGHT);
|
|
|
|
canPassThrough.add(BlockID.PRESSURE_PLATE_HEAVY);
|
|
|
|
canPassThrough.add(BlockID.COMPARATOR_OFF);
|
|
|
|
canPassThrough.add(BlockID.COMPARATOR_ON);
|
|
|
|
canPassThrough.add(BlockID.ACTIVATOR_RAIL);
|
2010-11-05 06:29:38 +00:00
|
|
|
}
|
2010-11-07 04:47:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether a block can be passed through.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean canPassThrough(int id) {
|
2011-09-16 02:25:20 +00:00
|
|
|
return canPassThrough.contains(id);
|
2011-10-29 15:11:12 +00:00
|
|
|
}
|
2011-09-16 02:25:20 +00:00
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
/**
|
|
|
|
* Checks whether a block can be passed through.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean canPassThrough() {
|
|
|
|
return canPassThrough.contains(id);
|
2011-09-16 02:25:20 +00:00
|
|
|
}
|
|
|
|
|
2012-08-12 13:42:50 +00:00
|
|
|
/**
|
|
|
|
* HashSet for centralTopLimit.
|
|
|
|
*/
|
|
|
|
private static final Map<Integer, Double> centralTopLimit = new HashMap<Integer, Double>();
|
|
|
|
static {
|
|
|
|
centralTopLimit.put(BlockID.BED, 0.5625);
|
|
|
|
centralTopLimit.put(BlockID.BREWING_STAND, 0.875);
|
2012-08-12 13:59:58 +00:00
|
|
|
centralTopLimit.put(BlockID.CAKE_BLOCK, 0.4375);
|
2012-08-12 13:42:50 +00:00
|
|
|
centralTopLimit.put(BlockID.CAULDRON, 0.3125);
|
2012-08-13 22:40:11 +00:00
|
|
|
centralTopLimit.put(BlockID.COCOA_PLANT, 0.750);
|
2012-08-12 13:42:50 +00:00
|
|
|
centralTopLimit.put(BlockID.ENCHANTMENT_TABLE, 0.75);
|
|
|
|
for (int data = 0; data < 16; ++data) {
|
|
|
|
if ((data & 4) != 0) {
|
|
|
|
centralTopLimit.put(BlockID.END_PORTAL_FRAME, 0.8125);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
centralTopLimit.put(BlockID.FENCE, 1.5);
|
|
|
|
centralTopLimit.put(BlockID.FENCE_GATE, 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(BlockID.LILY_PAD, 0.015625);
|
|
|
|
centralTopLimit.put(BlockID.REDSTONE_REPEATER_ON, .125);
|
|
|
|
centralTopLimit.put(BlockID.REDSTONE_REPEATER_OFF, .125);
|
|
|
|
centralTopLimit.put(BlockID.TRAP_DOOR, 0.1875);
|
|
|
|
centralTopLimit.put(BlockID.SLOW_SAND, 0.875);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* @param data
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static double centralTopLimit(int id, int data) {
|
|
|
|
if (centralTopLimit.containsKey(id))
|
|
|
|
return centralTopLimit.get(id);
|
|
|
|
|
|
|
|
if (centralTopLimit.containsKey(-16*id-data))
|
|
|
|
return centralTopLimit.get(-16*id-data);
|
|
|
|
|
|
|
|
return canPassThrough(id) ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the y offset a player falls to when falling onto the top of a block at xp+0.5/zp+0.5.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public double centralTopLimit() {
|
|
|
|
if (centralTopLimit.containsKey(id))
|
|
|
|
return centralTopLimit.get(id);
|
|
|
|
|
|
|
|
return canPassThrough(id) ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
|
|
|
* HashSet for usesData.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> usesData = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
2012-03-24 18:35:51 +00:00
|
|
|
usesData.add(BlockID.WOOD);
|
2011-09-16 02:25:20 +00:00
|
|
|
usesData.add(BlockID.SAPLING);
|
|
|
|
usesData.add(BlockID.WATER);
|
|
|
|
usesData.add(BlockID.STATIONARY_WATER);
|
|
|
|
usesData.add(BlockID.LAVA);
|
|
|
|
usesData.add(BlockID.STATIONARY_LAVA);
|
|
|
|
usesData.add(BlockID.LOG);
|
|
|
|
usesData.add(BlockID.LEAVES);
|
|
|
|
usesData.add(BlockID.DISPENSER);
|
2012-03-24 18:35:51 +00:00
|
|
|
usesData.add(BlockID.SANDSTONE);
|
2011-09-16 02:25:20 +00:00
|
|
|
usesData.add(BlockID.BED);
|
|
|
|
usesData.add(BlockID.POWERED_RAIL);
|
|
|
|
usesData.add(BlockID.DETECTOR_RAIL);
|
|
|
|
usesData.add(BlockID.PISTON_STICKY_BASE);
|
|
|
|
usesData.add(BlockID.LONG_GRASS);
|
|
|
|
usesData.add(BlockID.PISTON_BASE);
|
|
|
|
usesData.add(BlockID.PISTON_EXTENSION);
|
|
|
|
usesData.add(BlockID.CLOTH);
|
|
|
|
usesData.add(BlockID.DOUBLE_STEP);
|
|
|
|
usesData.add(BlockID.STEP);
|
|
|
|
usesData.add(BlockID.TORCH);
|
2011-10-04 21:13:41 +00:00
|
|
|
usesData.add(BlockID.FIRE);
|
2011-09-16 02:25:20 +00:00
|
|
|
usesData.add(BlockID.WOODEN_STAIRS);
|
2011-10-04 21:13:41 +00:00
|
|
|
usesData.add(BlockID.CHEST);
|
2011-09-16 02:25:20 +00:00
|
|
|
usesData.add(BlockID.REDSTONE_WIRE);
|
|
|
|
usesData.add(BlockID.CROPS);
|
|
|
|
usesData.add(BlockID.SOIL);
|
|
|
|
usesData.add(BlockID.FURNACE);
|
|
|
|
usesData.add(BlockID.BURNING_FURNACE);
|
|
|
|
usesData.add(BlockID.SIGN_POST);
|
|
|
|
usesData.add(BlockID.WOODEN_DOOR);
|
|
|
|
usesData.add(BlockID.LADDER);
|
|
|
|
usesData.add(BlockID.MINECART_TRACKS);
|
|
|
|
usesData.add(BlockID.COBBLESTONE_STAIRS);
|
|
|
|
usesData.add(BlockID.WALL_SIGN);
|
|
|
|
usesData.add(BlockID.LEVER);
|
|
|
|
usesData.add(BlockID.STONE_PRESSURE_PLATE);
|
|
|
|
usesData.add(BlockID.IRON_DOOR);
|
|
|
|
usesData.add(BlockID.WOODEN_PRESSURE_PLATE);
|
|
|
|
usesData.add(BlockID.REDSTONE_TORCH_OFF);
|
|
|
|
usesData.add(BlockID.REDSTONE_TORCH_ON);
|
|
|
|
usesData.add(BlockID.STONE_BUTTON);
|
|
|
|
usesData.add(BlockID.SNOW);
|
|
|
|
usesData.add(BlockID.CACTUS);
|
2011-10-04 21:13:41 +00:00
|
|
|
usesData.add(BlockID.REED);
|
|
|
|
usesData.add(BlockID.JUKEBOX);
|
2011-09-16 02:25:20 +00:00
|
|
|
usesData.add(BlockID.PUMPKIN);
|
|
|
|
usesData.add(BlockID.JACKOLANTERN);
|
|
|
|
usesData.add(BlockID.CAKE_BLOCK);
|
|
|
|
usesData.add(BlockID.REDSTONE_REPEATER_OFF);
|
|
|
|
usesData.add(BlockID.REDSTONE_REPEATER_ON);
|
|
|
|
usesData.add(BlockID.TRAP_DOOR);
|
2011-09-17 18:11:59 +00:00
|
|
|
usesData.add(BlockID.SILVERFISH_BLOCK);
|
2011-09-16 02:25:20 +00:00
|
|
|
usesData.add(BlockID.STONE_BRICK);
|
|
|
|
usesData.add(BlockID.RED_MUSHROOM_CAP);
|
|
|
|
usesData.add(BlockID.BROWN_MUSHROOM_CAP);
|
|
|
|
usesData.add(BlockID.PUMPKIN_STEM);
|
|
|
|
usesData.add(BlockID.MELON_STEM);
|
|
|
|
usesData.add(BlockID.VINE);
|
|
|
|
usesData.add(BlockID.FENCE_GATE);
|
|
|
|
usesData.add(BlockID.BRICK_STAIRS);
|
|
|
|
usesData.add(BlockID.STONE_BRICK_STAIRS);
|
2011-10-29 15:11:12 +00:00
|
|
|
usesData.add(BlockID.NETHER_BRICK_STAIRS);
|
|
|
|
usesData.add(BlockID.NETHER_WART);
|
|
|
|
usesData.add(BlockID.ENCHANTMENT_TABLE);
|
|
|
|
usesData.add(BlockID.BREWING_STAND);
|
|
|
|
usesData.add(BlockID.CAULDRON);
|
|
|
|
usesData.add(BlockID.END_PORTAL_FRAME);
|
2012-08-13 21:23:50 +00:00
|
|
|
usesData.add(BlockID.DOUBLE_WOODEN_STEP);
|
|
|
|
usesData.add(BlockID.WOODEN_STEP);
|
|
|
|
usesData.add(BlockID.COCOA_PLANT);
|
|
|
|
usesData.add(BlockID.SANDSTONE_STAIRS);
|
|
|
|
usesData.add(BlockID.ENDER_CHEST);
|
|
|
|
usesData.add(BlockID.TRIPWIRE_HOOK);
|
|
|
|
usesData.add(BlockID.TRIPWIRE);
|
|
|
|
usesData.add(BlockID.SPRUCE_WOOD_STAIRS);
|
|
|
|
usesData.add(BlockID.BIRCH_WOOD_STAIRS);
|
|
|
|
usesData.add(BlockID.JUNGLE_WOOD_STAIRS);
|
2012-10-29 03:49:26 +00:00
|
|
|
usesData.add(BlockID.COBBLESTONE_WALL);
|
|
|
|
usesData.add(BlockID.FLOWER_POT);
|
|
|
|
usesData.add(BlockID.CARROTS);
|
|
|
|
usesData.add(BlockID.POTATOES);
|
|
|
|
usesData.add(BlockID.WOODEN_BUTTON);
|
|
|
|
usesData.add(BlockID.HEAD);
|
|
|
|
usesData.add(BlockID.ANVIL);
|
2013-03-03 05:55:57 +00:00
|
|
|
usesData.add(BlockID.PRESSURE_PLATE_LIGHT);
|
|
|
|
usesData.add(BlockID.PRESSURE_PLATE_HEAVY);
|
|
|
|
usesData.add(BlockID.QUARTZ_BLOCK);
|
|
|
|
usesData.add(BlockID.QUARTZ_STAIRS);
|
|
|
|
usesData.add(BlockID.ACTIVATOR_RAIL);
|
|
|
|
usesData.add(BlockID.DROPPER);
|
2010-11-07 04:47:50 +00:00
|
|
|
}
|
2010-11-17 04:39:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the block uses its data value.
|
2011-09-24 19:32:03 +00:00
|
|
|
*
|
2010-11-17 04:39:48 +00:00
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean usesData(int id) {
|
2011-09-16 02:25:20 +00:00
|
|
|
return usesData.contains(id);
|
2010-11-17 04:39:48 +00:00
|
|
|
}
|
2011-09-16 02:25:20 +00:00
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the block uses its data value.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean usesData() {
|
|
|
|
return usesData.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
|
|
|
* HashSet for isContainerBlock.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> isContainerBlock = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
|
|
|
isContainerBlock.add(BlockID.DISPENSER);
|
|
|
|
isContainerBlock.add(BlockID.FURNACE);
|
|
|
|
isContainerBlock.add(BlockID.BURNING_FURNACE);
|
|
|
|
isContainerBlock.add(BlockID.CHEST);
|
2011-10-29 15:11:12 +00:00
|
|
|
isContainerBlock.add(BlockID.BREWING_STAND);
|
2013-03-03 05:55:57 +00:00
|
|
|
isContainerBlock.add(BlockID.TRAPPED_CHEST);
|
|
|
|
isContainerBlock.add(BlockID.HOPPER);
|
|
|
|
isContainerBlock.add(BlockID.DROPPER);
|
2012-08-13 21:23:50 +00:00
|
|
|
//isContainerBlock.add(BlockID.ENDER_CHEST); // ender chest has no own inventory, don't add this here
|
2011-09-16 02:25:20 +00:00
|
|
|
}
|
|
|
|
|
2011-01-23 08:36:26 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the block is a container block.
|
2011-09-24 19:32:03 +00:00
|
|
|
*
|
2011-01-23 08:36:26 +00:00
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean isContainerBlock(int id) {
|
2011-09-16 02:25:20 +00:00
|
|
|
return isContainerBlock.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the block is a container block.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean isContainerBlock() {
|
|
|
|
return isContainerBlock.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
|
|
|
* HashSet for isRedstoneBlock.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> isRedstoneBlock = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
|
|
|
isRedstoneBlock.add(BlockID.POWERED_RAIL);
|
|
|
|
isRedstoneBlock.add(BlockID.DETECTOR_RAIL);
|
|
|
|
isRedstoneBlock.add(BlockID.PISTON_STICKY_BASE);
|
|
|
|
isRedstoneBlock.add(BlockID.PISTON_BASE);
|
|
|
|
isRedstoneBlock.add(BlockID.LEVER);
|
|
|
|
isRedstoneBlock.add(BlockID.STONE_PRESSURE_PLATE);
|
|
|
|
isRedstoneBlock.add(BlockID.WOODEN_PRESSURE_PLATE);
|
|
|
|
isRedstoneBlock.add(BlockID.REDSTONE_TORCH_OFF);
|
|
|
|
isRedstoneBlock.add(BlockID.REDSTONE_TORCH_ON);
|
|
|
|
isRedstoneBlock.add(BlockID.STONE_BUTTON);
|
|
|
|
isRedstoneBlock.add(BlockID.REDSTONE_WIRE);
|
|
|
|
isRedstoneBlock.add(BlockID.WOODEN_DOOR);
|
|
|
|
isRedstoneBlock.add(BlockID.IRON_DOOR);
|
|
|
|
isRedstoneBlock.add(BlockID.TNT);
|
|
|
|
isRedstoneBlock.add(BlockID.DISPENSER);
|
|
|
|
isRedstoneBlock.add(BlockID.NOTE_BLOCK);
|
|
|
|
isRedstoneBlock.add(BlockID.REDSTONE_REPEATER_OFF);
|
|
|
|
isRedstoneBlock.add(BlockID.REDSTONE_REPEATER_ON);
|
2012-08-13 21:23:50 +00:00
|
|
|
isRedstoneBlock.add(BlockID.TRIPWIRE_HOOK);
|
2012-10-29 03:49:26 +00:00
|
|
|
isRedstoneBlock.add(BlockID.COMMAND_BLOCK);
|
|
|
|
isRedstoneBlock.add(BlockID.WOODEN_BUTTON);
|
2013-03-03 05:55:57 +00:00
|
|
|
isRedstoneBlock.add(BlockID.TRAPPED_CHEST);
|
|
|
|
isRedstoneBlock.add(BlockID.PRESSURE_PLATE_LIGHT);
|
|
|
|
isRedstoneBlock.add(BlockID.PRESSURE_PLATE_HEAVY);
|
|
|
|
isRedstoneBlock.add(BlockID.COMPARATOR_OFF);
|
|
|
|
isRedstoneBlock.add(BlockID.COMPARATOR_ON);
|
|
|
|
isRedstoneBlock.add(BlockID.DAYLIGHT_SENSOR);
|
|
|
|
isRedstoneBlock.add(BlockID.REDSTONE_BLOCK);
|
|
|
|
isRedstoneBlock.add(BlockID.HOPPER);
|
|
|
|
isRedstoneBlock.add(BlockID.ACTIVATOR_RAIL);
|
|
|
|
isRedstoneBlock.add(BlockID.DROPPER);
|
2011-01-23 08:36:26 +00:00
|
|
|
}
|
2010-12-31 22:31:49 +00:00
|
|
|
|
2011-02-27 07:18:28 +00:00
|
|
|
/**
|
|
|
|
* Returns true if a block uses redstone in some way.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean isRedstoneBlock(int id) {
|
2011-09-16 02:25:20 +00:00
|
|
|
return isRedstoneBlock.contains(id);
|
2011-04-21 23:40:11 +00:00
|
|
|
}
|
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
/**
|
|
|
|
* Returns true if a block uses redstone in some way.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean isRedstoneBlock() {
|
|
|
|
return isRedstoneBlock.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
|
|
|
* HashSet for canTransferRedstone.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> canTransferRedstone = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
|
|
|
canTransferRedstone.add(BlockID.REDSTONE_TORCH_OFF);
|
|
|
|
canTransferRedstone.add(BlockID.REDSTONE_TORCH_ON);
|
|
|
|
canTransferRedstone.add(BlockID.REDSTONE_WIRE);
|
|
|
|
canTransferRedstone.add(BlockID.REDSTONE_REPEATER_OFF);
|
|
|
|
canTransferRedstone.add(BlockID.REDSTONE_REPEATER_ON);
|
2013-03-03 05:55:57 +00:00
|
|
|
canTransferRedstone.add(BlockID.COMPARATOR_OFF);
|
|
|
|
canTransferRedstone.add(BlockID.COMPARATOR_ON);
|
2011-09-16 02:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-04-21 23:40:11 +00:00
|
|
|
* Returns true if a block can transfer redstone.
|
|
|
|
* Made this since isRedstoneBlock was getting big.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean canTransferRedstone(int id) {
|
2011-09-16 02:25:20 +00:00
|
|
|
return canTransferRedstone.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
/**
|
|
|
|
* Returns true if a block can transfer redstone.
|
|
|
|
* Made this since isRedstoneBlock was getting big.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean canTransferRedstone() {
|
|
|
|
return canTransferRedstone.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
|
|
|
* HashSet for isRedstoneSource.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> isRedstoneSource = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
|
|
|
isRedstoneSource.add(BlockID.DETECTOR_RAIL);
|
|
|
|
isRedstoneSource.add(BlockID.REDSTONE_TORCH_OFF);
|
|
|
|
isRedstoneSource.add(BlockID.REDSTONE_TORCH_ON);
|
|
|
|
isRedstoneSource.add(BlockID.LEVER);
|
|
|
|
isRedstoneSource.add(BlockID.STONE_PRESSURE_PLATE);
|
|
|
|
isRedstoneSource.add(BlockID.WOODEN_PRESSURE_PLATE);
|
|
|
|
isRedstoneSource.add(BlockID.STONE_BUTTON);
|
2012-08-13 21:23:50 +00:00
|
|
|
isRedstoneSource.add(BlockID.TRIPWIRE_HOOK);
|
2012-10-29 03:49:26 +00:00
|
|
|
isRedstoneSource.add(BlockID.WOODEN_BUTTON);
|
2013-03-03 05:55:57 +00:00
|
|
|
isRedstoneSource.add(BlockID.PRESSURE_PLATE_LIGHT);
|
|
|
|
isRedstoneSource.add(BlockID.PRESSURE_PLATE_HEAVY);
|
|
|
|
isRedstoneSource.add(BlockID.DAYLIGHT_SENSOR);
|
|
|
|
isRedstoneSource.add(BlockID.REDSTONE_BLOCK);
|
2011-04-21 23:40:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Yay for convenience methods.
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean isRedstoneSource(int id) {
|
2011-09-16 02:25:20 +00:00
|
|
|
return isRedstoneSource.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
/**
|
|
|
|
* Yay for convenience methods.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean isRedstoneSource() {
|
|
|
|
return isRedstoneSource.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
|
|
|
* HashSet for isRailBlock.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> isRailBlock = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
|
|
|
isRailBlock.add(BlockID.POWERED_RAIL);
|
|
|
|
isRailBlock.add(BlockID.DETECTOR_RAIL);
|
|
|
|
isRailBlock.add(BlockID.MINECART_TRACKS);
|
2013-03-03 05:55:57 +00:00
|
|
|
isRailBlock.add(BlockID.ACTIVATOR_RAIL);
|
2011-02-27 07:18:28 +00:00
|
|
|
}
|
|
|
|
|
2011-05-12 00:04:29 +00:00
|
|
|
/**
|
|
|
|
* Checks if the id is that of one of the rail types
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean isRailBlock(int id) {
|
2011-09-16 02:25:20 +00:00
|
|
|
return isRailBlock.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
/**
|
|
|
|
* Checks if the id is that of one of the rail types
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean isRailBlock() {
|
|
|
|
return isRailBlock.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
|
|
|
* HashSet for isNaturalBlock.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> isNaturalTerrainBlock = new HashSet<Integer>();
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
2011-09-19 04:41:33 +00:00
|
|
|
isNaturalTerrainBlock.add(BlockID.STONE);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.GRASS);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.DIRT);
|
2011-09-16 02:25:20 +00:00
|
|
|
// isNaturalBlock.add(BlockID.COBBLESTONE); // technically can occur next to water and lava
|
2011-09-19 04:41:33 +00:00
|
|
|
isNaturalTerrainBlock.add(BlockID.BEDROCK);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.SAND);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.GRAVEL);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.CLAY);
|
2011-10-29 15:11:12 +00:00
|
|
|
isNaturalTerrainBlock.add(BlockID.MYCELIUM);
|
2011-09-16 02:25:20 +00:00
|
|
|
|
|
|
|
// hell
|
2011-09-19 04:41:33 +00:00
|
|
|
isNaturalTerrainBlock.add(BlockID.NETHERSTONE);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.SLOW_SAND);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.LIGHTSTONE);
|
2013-03-03 05:55:57 +00:00
|
|
|
isNaturalTerrainBlock.add(BlockID.QUARTZ_ORE);
|
2011-09-16 02:25:20 +00:00
|
|
|
|
|
|
|
// ores
|
2011-09-19 04:41:33 +00:00
|
|
|
isNaturalTerrainBlock.add(BlockID.COAL_ORE);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.IRON_ORE);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.GOLD_ORE);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.LAPIS_LAZULI_ORE);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.DIAMOND_ORE);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.REDSTONE_ORE);
|
|
|
|
isNaturalTerrainBlock.add(BlockID.GLOWING_REDSTONE_ORE);
|
2012-08-13 21:23:50 +00:00
|
|
|
isNaturalTerrainBlock.add(BlockID.EMERALD_ORE);
|
2011-09-03 16:54:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if the block type is naturally occuring
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
2011-09-19 04:41:33 +00:00
|
|
|
public static boolean isNaturalTerrainBlock(int id) {
|
|
|
|
return isNaturalTerrainBlock.contains(id);
|
2011-09-16 02:25:20 +00:00
|
|
|
}
|
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
/**
|
|
|
|
* Checks if the block type is naturally occuring
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public boolean isNaturalTerrainBlock() {
|
|
|
|
return isNaturalTerrainBlock.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-10-24 18:46:17 +00:00
|
|
|
/**
|
|
|
|
* HashSet for emitsLight.
|
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> emitsLight = new HashSet<Integer>();
|
2011-10-24 18:46:17 +00:00
|
|
|
static {
|
|
|
|
emitsLight.add(BlockID.LAVA);
|
|
|
|
emitsLight.add(BlockID.STATIONARY_LAVA);
|
|
|
|
emitsLight.add(BlockID.BROWN_MUSHROOM);
|
|
|
|
emitsLight.add(BlockID.RED_MUSHROOM);
|
|
|
|
emitsLight.add(BlockID.TORCH);
|
|
|
|
emitsLight.add(BlockID.FIRE);
|
|
|
|
emitsLight.add(BlockID.BURNING_FURNACE);
|
|
|
|
emitsLight.add(BlockID.GLOWING_REDSTONE_ORE);
|
|
|
|
emitsLight.add(BlockID.REDSTONE_TORCH_ON);
|
|
|
|
emitsLight.add(BlockID.LIGHTSTONE);
|
|
|
|
emitsLight.add(BlockID.PORTAL);
|
|
|
|
emitsLight.add(BlockID.JACKOLANTERN);
|
|
|
|
emitsLight.add(BlockID.REDSTONE_REPEATER_ON);
|
|
|
|
emitsLight.add(BlockID.LOCKED_CHEST);
|
|
|
|
emitsLight.add(BlockID.BROWN_MUSHROOM_CAP);
|
|
|
|
emitsLight.add(BlockID.RED_MUSHROOM_CAP);
|
2011-10-29 15:11:12 +00:00
|
|
|
emitsLight.add(BlockID.END_PORTAL);
|
2012-03-02 04:28:09 +00:00
|
|
|
emitsLight.add(BlockID.REDSTONE_LAMP_ON);
|
2012-08-13 21:23:50 +00:00
|
|
|
emitsLight.add(BlockID.ENDER_CHEST);
|
2013-03-03 05:55:57 +00:00
|
|
|
emitsLight.add(BlockID.BEACON);
|
|
|
|
emitsLight.add(BlockID.REDSTONE_BLOCK);
|
2011-10-24 18:46:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if the block type emits light
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean emitsLight(int id) {
|
|
|
|
return emitsLight.contains(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-10-29 15:11:12 +00:00
|
|
|
* HashSet for isTranslucent.
|
2011-10-24 18:46:17 +00:00
|
|
|
*/
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Set<Integer> isTranslucent = new HashSet<Integer>();
|
2011-10-24 18:46:17 +00:00
|
|
|
static {
|
|
|
|
isTranslucent.add(BlockID.AIR);
|
|
|
|
isTranslucent.add(BlockID.SAPLING);
|
|
|
|
isTranslucent.add(BlockID.WATER);
|
|
|
|
isTranslucent.add(BlockID.STATIONARY_WATER);
|
2012-08-13 21:52:47 +00:00
|
|
|
isTranslucent.add(BlockID.LEAVES);
|
2011-10-24 18:46:17 +00:00
|
|
|
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);
|
2012-08-13 21:52:47 +00:00
|
|
|
isTranslucent.add(BlockID.PISTON_EXTENSION);
|
2011-10-24 18:46:17 +00:00
|
|
|
//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.TORCH);
|
|
|
|
isTranslucent.add(BlockID.FIRE);
|
2012-08-13 21:52:47 +00:00
|
|
|
isTranslucent.add(BlockID.MOB_SPAWNER);
|
|
|
|
isTranslucent.add(BlockID.WOODEN_STAIRS);
|
|
|
|
isTranslucent.add(BlockID.CHEST);
|
2011-10-24 18:46:17 +00:00
|
|
|
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);
|
2012-08-13 21:52:47 +00:00
|
|
|
isTranslucent.add(BlockID.COBBLESTONE_STAIRS);
|
2011-10-24 18:46:17 +00:00
|
|
|
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);
|
2012-08-13 21:52:47 +00:00
|
|
|
isTranslucent.add(BlockID.CACTUS);
|
2011-10-24 18:46:17 +00:00
|
|
|
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);
|
2011-10-29 15:11:12 +00:00
|
|
|
isTranslucent.add(BlockID.BRICK_STAIRS);
|
2011-10-24 18:46:17 +00:00
|
|
|
isTranslucent.add(BlockID.STONE_BRICK_STAIRS);
|
2011-10-29 15:11:12 +00:00
|
|
|
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);
|
2012-08-13 21:23:50 +00:00
|
|
|
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);
|
2012-10-29 03:49:26 +00:00
|
|
|
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);
|
2013-03-03 05:55:57 +00:00
|
|
|
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);
|
2011-10-24 18:46:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if the block type lets light through
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public static boolean isTranslucent(int id) {
|
|
|
|
return isTranslucent.contains(id);
|
|
|
|
}
|
|
|
|
|
2011-09-16 02:25:20 +00:00
|
|
|
/**
|
2011-11-03 23:41:19 +00:00
|
|
|
* HashMap for getBlockBagItem.
|
2011-09-16 02:25:20 +00:00
|
|
|
*/
|
2011-11-03 23:41:19 +00:00
|
|
|
private static final Map<Integer, BaseItem> dataBlockBagItems = new HashMap<Integer, BaseItem>();
|
|
|
|
private static final Map<Integer, BaseItem> nonDataBlockBagItems = new HashMap<Integer, BaseItem>();
|
2011-11-03 13:58:25 +00:00
|
|
|
private static final BaseItem doNotDestroy = new BaseItemStack(BlockID.AIR, 0);
|
2011-09-16 02:25:20 +00:00
|
|
|
static {
|
2011-11-03 23:41:19 +00:00
|
|
|
/*
|
|
|
|
* rules:
|
2012-03-02 04:28:09 +00:00
|
|
|
*
|
2011-11-03 23:41:19 +00:00
|
|
|
* 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
|
2013-03-03 05:55:57 +00:00
|
|
|
* 4. block yields more than one item => addIdentities
|
2011-11-03 23:41:19 +00:00
|
|
|
* 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
|
|
|
|
addIdentity(BlockID.DIRT); // rule 1
|
|
|
|
addIdentity(BlockID.COBBLESTONE); // rule 1
|
|
|
|
addIdentity(BlockID.WOOD); // rule 1
|
|
|
|
addIdentities(BlockID.SAPLING, 3); // 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, 3); // 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);
|
2011-11-04 12:53:21 +00:00
|
|
|
// PISTON_EXTENSION, rule 7
|
2011-11-03 23:41:19 +00:00
|
|
|
addIdentities(BlockID.CLOTH, 16); // rule 1
|
2011-11-04 12:53:21 +00:00
|
|
|
// PISTON_MOVING_PIECE, rule 7
|
2011-11-03 23:41:19 +00:00
|
|
|
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.WOODEN_STAIRS); // rule 3
|
|
|
|
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
|
2011-11-23 01:29:48 +00:00
|
|
|
addIdentity(BlockID.REDSTONE_ORE); // rule 4
|
2011-11-03 23:41:19 +00:00
|
|
|
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
|
|
|
|
addIdentity(BlockID.LOCKED_CHEST); // ???
|
|
|
|
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);
|
2012-03-02 04:28:09 +00:00
|
|
|
|
|
|
|
addIdentity(BlockID.REDSTONE_LAMP_OFF);
|
|
|
|
nonDataBlockBagItems.put(BlockID.REDSTONE_LAMP_ON, new BaseItem(BlockID.REDSTONE_LAMP_OFF));
|
2012-08-13 21:23:50 +00:00
|
|
|
|
|
|
|
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, (short) (15 - ClothColor.ID.BROWN))); // rule 3
|
|
|
|
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
|
2013-03-03 05:55:57 +00:00
|
|
|
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, (short) 2)); // rule 4, quartz pillars
|
|
|
|
}
|
|
|
|
addIdentity(BlockID.QUARTZ_STAIRS); // rule 1
|
|
|
|
addIdentity(BlockID.ACTIVATOR_RAIL); // rule 1
|
|
|
|
addIdentity(BlockID.DROPPER); // rule 1
|
|
|
|
|
2011-11-03 13:58:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-11-03 23:41:19 +00:00
|
|
|
* Get the block or item that this block can be constructed from. If nothing is
|
2011-11-03 13:58:25 +00:00
|
|
|
* 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
|
|
|
|
* @param data
|
|
|
|
* @return
|
|
|
|
*/
|
2011-11-03 23:41:19 +00:00
|
|
|
public static BaseItem getBlockBagItem(int type, int data) {
|
|
|
|
BaseItem dropped = nonDataBlockBagItems.get(type);
|
2011-11-03 13:58:25 +00:00
|
|
|
if (dropped != null) return dropped;
|
|
|
|
|
2011-11-03 23:41:19 +00:00
|
|
|
dropped = dataBlockBagItems.get(typeDataKey(type, data));
|
2011-11-03 13:58:25 +00:00
|
|
|
|
|
|
|
if (dropped == null) {
|
|
|
|
return new BaseItemStack(BlockID.AIR, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dropped == doNotDestroy) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return dropped;
|
2011-05-12 00:04:29 +00:00
|
|
|
}
|
|
|
|
|
2011-11-03 23:41:19 +00:00
|
|
|
private static void addIdentity(int type) {
|
|
|
|
nonDataBlockBagItems.put(type, new BaseItem(type));
|
|
|
|
}
|
2011-11-23 01:29:48 +00:00
|
|
|
|
2011-11-03 23:41:19 +00:00
|
|
|
private static void addIdentities(int type, int maxData) {
|
|
|
|
for (int data = 0; data < maxData; ++data) {
|
2011-11-05 16:58:51 +00:00
|
|
|
dataBlockBagItems.put(typeDataKey(type, data), new BaseItem(type, (short) data));
|
2011-11-03 23:41:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-31 22:31:49 +00:00
|
|
|
/**
|
|
|
|
* Get the block or item that would have been dropped. If nothing is
|
|
|
|
* dropped, 0 will be returned. If the block should not be destroyed
|
|
|
|
* (i.e. bedrock), -1 will be returned.
|
2011-09-24 19:32:03 +00:00
|
|
|
*
|
2010-12-31 22:31:49 +00:00
|
|
|
* @param id
|
|
|
|
* @return
|
2011-09-19 05:14:43 +00:00
|
|
|
* @deprecated This function ignores the data value.
|
2010-12-31 22:31:49 +00:00
|
|
|
*/
|
2011-09-18 04:52:12 +00:00
|
|
|
@Deprecated
|
2010-12-31 22:31:49 +00:00
|
|
|
public static int getDroppedBlock(int id) {
|
2011-11-03 23:41:19 +00:00
|
|
|
BaseItem dropped = nonDataBlockBagItems.get(id);
|
2010-12-31 22:31:49 +00:00
|
|
|
if (dropped == null) {
|
2011-09-03 16:54:20 +00:00
|
|
|
return BlockID.AIR;
|
2010-12-31 22:31:49 +00:00
|
|
|
}
|
2011-11-03 13:58:25 +00:00
|
|
|
return dropped.getType();
|
2010-12-31 22:31:49 +00:00
|
|
|
}
|
2011-09-24 19:32:03 +00:00
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
public BaseItemStack getBlockDrop(short data) {
|
|
|
|
return getBlockDrop(id, data);
|
|
|
|
}
|
|
|
|
|
2011-09-18 04:52:12 +00:00
|
|
|
private static final Random random = new Random();
|
|
|
|
public static BaseItemStack getBlockDrop(int id, short data) {
|
2011-10-29 15:11:12 +00:00
|
|
|
int store;
|
2011-09-18 04:52:12 +00:00
|
|
|
switch (id) {
|
|
|
|
case BlockID.STONE:
|
|
|
|
return new BaseItemStack(BlockID.COBBLESTONE);
|
|
|
|
|
|
|
|
case BlockID.GRASS:
|
|
|
|
return new BaseItemStack(BlockID.DIRT);
|
|
|
|
|
|
|
|
case BlockID.GRAVEL:
|
2011-10-29 15:11:12 +00:00
|
|
|
if (random.nextInt(10) == 0) {
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.FLINT);
|
2011-09-21 21:45:17 +00:00
|
|
|
} else {
|
|
|
|
return new BaseItemStack(BlockID.GRAVEL);
|
2011-09-18 04:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case BlockID.COAL_ORE:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.COAL);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.LEAVES:
|
|
|
|
if (random.nextDouble() > 0.95) {
|
|
|
|
return new BaseItemStack(BlockID.SAPLING, 1, data);
|
2011-09-19 04:41:33 +00:00
|
|
|
} else {
|
|
|
|
return null;
|
2011-09-18 04:52:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case BlockID.LAPIS_LAZULI_ORE:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.INK_SACK, random.nextInt(5) + 4, (short) 4);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.BED:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.BED_ITEM);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.LONG_GRASS:
|
2011-09-21 21:45:17 +00:00
|
|
|
if (random.nextInt(8) == 0) {
|
|
|
|
return new BaseItemStack(ItemID.SEEDS);
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.DOUBLE_STEP:
|
|
|
|
return new BaseItemStack(BlockID.STEP, 2, data);
|
|
|
|
|
|
|
|
case BlockID.REDSTONE_WIRE:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.REDSTONE_DUST);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.DIAMOND_ORE:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.DIAMOND);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.CROPS:
|
2011-10-29 15:11:12 +00:00
|
|
|
if (data == 7) return new BaseItemStack(ItemID.WHEAT);
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.SEEDS);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.SOIL:
|
|
|
|
return new BaseItemStack(BlockID.DIRT);
|
|
|
|
|
|
|
|
case BlockID.BURNING_FURNACE:
|
|
|
|
return new BaseItemStack(BlockID.FURNACE);
|
|
|
|
|
|
|
|
case BlockID.SIGN_POST:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.SIGN);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.WOODEN_DOOR:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.WOODEN_DOOR_ITEM);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.WALL_SIGN:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.SIGN);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.IRON_DOOR:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.IRON_DOOR_ITEM);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.REDSTONE_ORE:
|
|
|
|
case BlockID.GLOWING_REDSTONE_ORE:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.REDSTONE_DUST, (random.nextInt(2) + 4));
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.REDSTONE_TORCH_OFF:
|
|
|
|
return new BaseItemStack(BlockID.REDSTONE_TORCH_ON);
|
|
|
|
|
|
|
|
case BlockID.CLAY:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.CLAY_BALL, 4);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.REED:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.SUGAR_CANE_ITEM);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.LIGHTSTONE:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.LIGHTSTONE_DUST, (random.nextInt(3) + 2));
|
2011-09-18 04:52:12 +00:00
|
|
|
|
|
|
|
case BlockID.REDSTONE_REPEATER_OFF:
|
|
|
|
case BlockID.REDSTONE_REPEATER_ON:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.REDSTONE_REPEATER);
|
2011-09-18 04:52:12 +00:00
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2011-09-19 04:41:33 +00:00
|
|
|
case BlockID.MELON_BLOCK:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.MELON, (random.nextInt(5) + 3));
|
2011-09-19 04:41:33 +00:00
|
|
|
|
|
|
|
case BlockID.PUMPKIN_STEM:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.PUMPKIN_SEEDS);
|
2011-09-19 04:41:33 +00:00
|
|
|
|
|
|
|
case BlockID.MELON_STEM:
|
2011-09-19 06:38:30 +00:00
|
|
|
return new BaseItemStack(ItemID.MELON_SEEDS);
|
2011-09-19 04:41:33 +00:00
|
|
|
|
2011-10-29 15:11:12 +00:00
|
|
|
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);
|
|
|
|
|
2013-03-03 05:55:57 +00:00
|
|
|
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, (data >= 2 ? 2 : data));
|
|
|
|
|
|
|
|
case BlockID.WOODEN_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
|
|
|
|
|
2011-09-18 04:52:12 +00:00
|
|
|
case BlockID.BEDROCK:
|
|
|
|
case BlockID.WATER:
|
|
|
|
case BlockID.STATIONARY_WATER:
|
|
|
|
case BlockID.LAVA:
|
|
|
|
case BlockID.STATIONARY_LAVA:
|
|
|
|
case BlockID.GLASS:
|
|
|
|
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:
|
2011-09-19 04:41:33 +00:00
|
|
|
case BlockID.LOCKED_CHEST:
|
|
|
|
case BlockID.SILVERFISH_BLOCK:
|
|
|
|
case BlockID.VINE:
|
2011-10-29 15:11:12 +00:00
|
|
|
case BlockID.END_PORTAL:
|
|
|
|
case BlockID.END_PORTAL_FRAME:
|
2013-03-03 05:55:57 +00:00
|
|
|
case BlockID.HEAD:
|
2011-09-18 04:52:12 +00:00
|
|
|
return null;
|
|
|
|
}
|
2011-10-29 15:11:12 +00:00
|
|
|
|
2011-09-19 04:41:33 +00:00
|
|
|
if (usesData(id)) {
|
|
|
|
return new BaseItemStack(id, 1, data);
|
|
|
|
} else {
|
|
|
|
return new BaseItemStack(id);
|
|
|
|
}
|
2011-09-18 04:52:12 +00:00
|
|
|
}
|
2011-08-17 20:24:27 +00:00
|
|
|
|
2012-01-22 09:23:41 +00:00
|
|
|
private static final Map<Integer, PlayerDirection> dataAttachments = new HashMap<Integer, PlayerDirection>();
|
|
|
|
private static final Map<Integer, PlayerDirection> nonDataAttachments = new HashMap<Integer, PlayerDirection>();
|
2011-09-29 10:35:08 +00:00
|
|
|
static {
|
|
|
|
nonDataAttachments.put(BlockID.SAPLING, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.POWERED_RAIL, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.DETECTOR_RAIL, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.LONG_GRASS, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.DEAD_BUSH, PlayerDirection.DOWN);
|
|
|
|
for (int offset = 0; offset <= 8; offset += 8) {
|
2011-11-03 13:58:25 +00:00
|
|
|
dataAttachments.put(typeDataKey(BlockID.PISTON_EXTENSION, offset + 0), PlayerDirection.UP);
|
|
|
|
dataAttachments.put(typeDataKey(BlockID.PISTON_EXTENSION, offset + 1), PlayerDirection.DOWN);
|
2011-10-04 21:13:41 +00:00
|
|
|
addCardinals(BlockID.PISTON_EXTENSION, offset + 2, offset + 5, offset + 3, offset + 4);
|
2011-09-29 10:35:08 +00:00
|
|
|
}
|
|
|
|
nonDataAttachments.put(BlockID.YELLOW_FLOWER, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.RED_FLOWER, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.BROWN_MUSHROOM, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.RED_MUSHROOM, PlayerDirection.DOWN);
|
|
|
|
for (int blockId : new int[] { BlockID.TORCH, BlockID.REDSTONE_TORCH_ON, BlockID.REDSTONE_TORCH_OFF }) {
|
2011-11-03 13:58:25 +00:00
|
|
|
dataAttachments.put(typeDataKey(blockId, 5), PlayerDirection.DOWN);
|
2011-09-29 10:35:08 +00:00
|
|
|
addCardinals(blockId, 4, 1, 3, 2);
|
|
|
|
}
|
|
|
|
nonDataAttachments.put(BlockID.REDSTONE_WIRE, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.CROPS, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.SIGN_POST, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.WOODEN_DOOR, PlayerDirection.DOWN);
|
|
|
|
addCardinals(BlockID.LADDER, 2, 5, 3, 4);
|
|
|
|
nonDataAttachments.put(BlockID.MINECART_TRACKS, PlayerDirection.DOWN);
|
|
|
|
addCardinals(BlockID.WALL_SIGN, 2, 5, 3, 4);
|
|
|
|
for (int offset = 0; offset <= 8; offset += 8) {
|
2011-10-04 21:13:41 +00:00
|
|
|
addCardinals(BlockID.LEVER, offset + 4, offset + 1, offset + 3, offset + 2);
|
2011-11-03 13:58:25 +00:00
|
|
|
dataAttachments.put(typeDataKey(BlockID.LEVER, offset + 5), PlayerDirection.DOWN);
|
|
|
|
dataAttachments.put(typeDataKey(BlockID.LEVER, offset + 6), PlayerDirection.DOWN);
|
2011-09-29 10:35:08 +00:00
|
|
|
}
|
|
|
|
nonDataAttachments.put(BlockID.STONE_PRESSURE_PLATE, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.IRON_DOOR, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.WOODEN_PRESSURE_PLATE, PlayerDirection.DOWN);
|
|
|
|
// redstone torches: see torches
|
|
|
|
for (int offset = 0; offset <= 8; offset += 8) {
|
2011-10-04 21:13:41 +00:00
|
|
|
addCardinals(BlockID.STONE_BUTTON, offset + 4, offset + 1, offset + 3, offset + 2);
|
2013-03-03 05:55:57 +00:00
|
|
|
addCardinals(BlockID.WOODEN_BUTTON, offset + 4, offset + 1, offset + 3, offset + 2);
|
2011-09-29 10:35:08 +00:00
|
|
|
}
|
2011-09-30 06:56:09 +00:00
|
|
|
nonDataAttachments.put(BlockID.CACTUS, PlayerDirection.DOWN);
|
2011-09-29 10:35:08 +00:00
|
|
|
nonDataAttachments.put(BlockID.REED, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.CAKE_BLOCK, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.REDSTONE_REPEATER_OFF, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.REDSTONE_REPEATER_ON, PlayerDirection.DOWN);
|
|
|
|
for (int offset = 0; offset <= 4; offset += 4) {
|
2011-10-04 21:13:41 +00:00
|
|
|
addCardinals(BlockID.TRAP_DOOR, offset + 0, offset + 3, offset + 1, offset + 2);
|
2011-09-29 10:35:08 +00:00
|
|
|
}
|
|
|
|
nonDataAttachments.put(BlockID.PUMPKIN_STEM, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.MELON_STEM, PlayerDirection.DOWN);
|
|
|
|
// vines are complicated, but I'll list the single-attachment variants anyway
|
2011-11-03 13:58:25 +00:00
|
|
|
dataAttachments.put(typeDataKey(BlockID.VINE, 0), PlayerDirection.UP);
|
2011-09-29 10:35:08 +00:00
|
|
|
addCardinals(BlockID.VINE, 1, 2, 4, 8);
|
2011-10-29 15:11:12 +00:00
|
|
|
nonDataAttachments.put(BlockID.NETHER_WART, PlayerDirection.DOWN);
|
2012-08-13 21:23:50 +00:00
|
|
|
for (int offset = 0; offset <= 4; offset += 4) {
|
|
|
|
addCardinals(BlockID.COCOA_PLANT, offset + 0, offset + 1, offset + 2, offset + 3);
|
|
|
|
}
|
|
|
|
for (int offset = 0; offset <= 4; offset += 4) {
|
|
|
|
addCardinals(BlockID.TRIPWIRE_HOOK, offset + 2, offset + 3, offset + 0, offset + 1);
|
|
|
|
}
|
|
|
|
nonDataAttachments.put(BlockID.TRIPWIRE, PlayerDirection.DOWN);
|
2013-03-03 05:55:57 +00:00
|
|
|
nonDataAttachments.put(BlockID.FLOWER_POT, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.CARROTS, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.POTATOES, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.ANVIL, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.PRESSURE_PLATE_LIGHT, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.PRESSURE_PLATE_HEAVY, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.COMPARATOR_OFF, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.COMPARATOR_ON, PlayerDirection.DOWN);
|
|
|
|
nonDataAttachments.put(BlockID.ACTIVATOR_RAIL, PlayerDirection.DOWN);
|
2011-09-29 10:35:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the direction to the block(B) this block(A) is attached to.
|
2012-03-02 04:28:09 +00:00
|
|
|
* Attached means that if block B is destroyed, block A will pop off.
|
2011-09-29 10:35:08 +00:00
|
|
|
*
|
|
|
|
* @param type The block id of block A
|
|
|
|
* @param data The data value of block A
|
|
|
|
* @return direction to block B
|
|
|
|
*/
|
|
|
|
public static PlayerDirection getAttachment(int type, int data) {
|
|
|
|
PlayerDirection direction = nonDataAttachments.get(type);
|
|
|
|
if (direction != null) return direction;
|
|
|
|
|
2011-11-03 13:58:25 +00:00
|
|
|
return dataAttachments.get(typeDataKey(type, data));
|
2011-09-29 10:35:08 +00:00
|
|
|
}
|
|
|
|
|
2011-11-03 13:58:25 +00:00
|
|
|
private static int typeDataKey(int type, int data) {
|
2011-09-29 10:35:08 +00:00
|
|
|
return (type << 4) | (data & 0xf);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void addCardinals(int type, int west, int north, int east, int south) {
|
2011-11-03 13:58:25 +00:00
|
|
|
dataAttachments.put(typeDataKey(type, west), PlayerDirection.WEST);
|
|
|
|
dataAttachments.put(typeDataKey(type, north), PlayerDirection.NORTH);
|
|
|
|
dataAttachments.put(typeDataKey(type, east), PlayerDirection.EAST);
|
|
|
|
dataAttachments.put(typeDataKey(type, south), PlayerDirection.SOUTH);
|
2011-09-29 10:35:08 +00:00
|
|
|
}
|
2011-04-21 23:40:11 +00:00
|
|
|
}
|