2011-01-01 07:01:53 +00:00
|
|
|
package org.bukkit;
|
|
|
|
|
2011-01-13 23:33:10 +00:00
|
|
|
import java.lang.reflect.Constructor;
|
2011-01-01 07:01:53 +00:00
|
|
|
import java.util.Map;
|
2012-01-29 11:10:40 +01:00
|
|
|
|
|
|
|
import org.apache.commons.lang.Validate;
|
2012-02-26 22:07:26 -05:00
|
|
|
import org.bukkit.map.MapView;
|
2012-12-20 08:38:59 -06:00
|
|
|
import org.bukkit.material.Bed;
|
|
|
|
import org.bukkit.material.Button;
|
|
|
|
import org.bukkit.material.Cake;
|
|
|
|
import org.bukkit.material.Cauldron;
|
|
|
|
import org.bukkit.material.Chest;
|
|
|
|
import org.bukkit.material.Coal;
|
|
|
|
import org.bukkit.material.CocoaPlant;
|
|
|
|
import org.bukkit.material.Command;
|
|
|
|
import org.bukkit.material.Crops;
|
|
|
|
import org.bukkit.material.DetectorRail;
|
|
|
|
import org.bukkit.material.Diode;
|
|
|
|
import org.bukkit.material.Dispenser;
|
|
|
|
import org.bukkit.material.Door;
|
|
|
|
import org.bukkit.material.Dye;
|
|
|
|
import org.bukkit.material.EnderChest;
|
|
|
|
import org.bukkit.material.FlowerPot;
|
|
|
|
import org.bukkit.material.Furnace;
|
|
|
|
import org.bukkit.material.Gate;
|
|
|
|
import org.bukkit.material.Ladder;
|
2016-03-01 08:30:03 +11:00
|
|
|
import org.bukkit.material.Leaves;
|
2012-12-20 08:38:59 -06:00
|
|
|
import org.bukkit.material.Lever;
|
|
|
|
import org.bukkit.material.LongGrass;
|
|
|
|
import org.bukkit.material.MaterialData;
|
|
|
|
import org.bukkit.material.MonsterEggs;
|
|
|
|
import org.bukkit.material.Mushroom;
|
2012-04-29 21:09:57 -04:00
|
|
|
import org.bukkit.material.NetherWarts;
|
2012-12-20 08:38:59 -06:00
|
|
|
import org.bukkit.material.PistonBaseMaterial;
|
|
|
|
import org.bukkit.material.PistonExtensionMaterial;
|
|
|
|
import org.bukkit.material.PoweredRail;
|
|
|
|
import org.bukkit.material.PressurePlate;
|
|
|
|
import org.bukkit.material.Pumpkin;
|
|
|
|
import org.bukkit.material.Rails;
|
|
|
|
import org.bukkit.material.RedstoneTorch;
|
|
|
|
import org.bukkit.material.RedstoneWire;
|
|
|
|
import org.bukkit.material.Sandstone;
|
2016-03-01 08:30:03 +11:00
|
|
|
import org.bukkit.material.Sapling;
|
2012-12-20 08:38:59 -06:00
|
|
|
import org.bukkit.material.Sign;
|
|
|
|
import org.bukkit.material.Skull;
|
|
|
|
import org.bukkit.material.SmoothBrick;
|
|
|
|
import org.bukkit.material.SpawnEgg;
|
|
|
|
import org.bukkit.material.Stairs;
|
|
|
|
import org.bukkit.material.Step;
|
|
|
|
import org.bukkit.material.Torch;
|
|
|
|
import org.bukkit.material.TrapDoor;
|
|
|
|
import org.bukkit.material.Tree;
|
|
|
|
import org.bukkit.material.Tripwire;
|
|
|
|
import org.bukkit.material.TripwireHook;
|
|
|
|
import org.bukkit.material.Vine;
|
2016-03-01 08:30:03 +11:00
|
|
|
import org.bukkit.material.Wood;
|
2012-12-20 08:38:59 -06:00
|
|
|
import org.bukkit.material.WoodenStep;
|
|
|
|
import org.bukkit.material.Wool;
|
2012-02-26 22:07:26 -05:00
|
|
|
import org.bukkit.potion.Potion;
|
2012-01-15 09:18:20 +00:00
|
|
|
import org.bukkit.util.Java15Compat;
|
2011-01-01 07:01:53 +00:00
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
import com.google.common.collect.Maps;
|
2016-03-01 08:30:03 +11:00
|
|
|
|
2014-11-26 08:15:59 +11:00
|
|
|
import org.bukkit.material.Banner;
|
2012-01-29 11:10:40 +01:00
|
|
|
|
2011-01-01 07:01:53 +00:00
|
|
|
/**
|
2014-03-24 13:20:52 -05:00
|
|
|
* An enum of all material IDs accepted by the official server and client
|
2011-01-01 07:01:53 +00:00
|
|
|
*/
|
|
|
|
public enum Material {
|
2012-12-17 01:16:28 -06:00
|
|
|
AIR(0, 0),
|
2011-01-13 23:33:10 +00:00
|
|
|
STONE(1),
|
|
|
|
GRASS(2),
|
|
|
|
DIRT(3),
|
|
|
|
COBBLESTONE(4),
|
2016-03-01 08:30:03 +11:00
|
|
|
WOOD(5, Wood.class),
|
|
|
|
SAPLING(6, Sapling.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
BEDROCK(7),
|
2011-04-02 16:42:12 -07:00
|
|
|
WATER(8, MaterialData.class),
|
|
|
|
STATIONARY_WATER(9, MaterialData.class),
|
|
|
|
LAVA(10, MaterialData.class),
|
|
|
|
STATIONARY_LAVA(11, MaterialData.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
SAND(12),
|
|
|
|
GRAVEL(13),
|
|
|
|
GOLD_ORE(14),
|
|
|
|
IRON_ORE(15),
|
|
|
|
COAL_ORE(16),
|
2011-03-14 18:08:57 -07:00
|
|
|
LOG(17, Tree.class),
|
2016-03-01 08:30:03 +11:00
|
|
|
LEAVES(18, Leaves.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
SPONGE(19),
|
|
|
|
GLASS(20),
|
|
|
|
LAPIS_ORE(21),
|
|
|
|
LAPIS_BLOCK(22),
|
2011-04-02 16:42:12 -07:00
|
|
|
DISPENSER(23, Dispenser.class),
|
2012-03-31 08:35:59 -05:00
|
|
|
SANDSTONE(24, Sandstone.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
NOTE_BLOCK(25),
|
2011-04-02 16:42:12 -07:00
|
|
|
BED_BLOCK(26, Bed.class),
|
2011-04-25 13:26:58 -07:00
|
|
|
POWERED_RAIL(27, PoweredRail.class),
|
|
|
|
DETECTOR_RAIL(28, DetectorRail.class),
|
2011-06-30 15:18:11 +01:00
|
|
|
PISTON_STICKY_BASE(29, PistonBaseMaterial.class),
|
2011-04-21 15:41:40 +01:00
|
|
|
WEB(30),
|
2011-06-07 02:15:19 -04:00
|
|
|
LONG_GRASS(31, LongGrass.class),
|
2011-05-26 06:28:24 +01:00
|
|
|
DEAD_BUSH(32),
|
2011-06-30 15:18:11 +01:00
|
|
|
PISTON_BASE(33, PistonBaseMaterial.class),
|
|
|
|
PISTON_EXTENSION(34, PistonExtensionMaterial.class),
|
2011-01-14 00:20:00 +00:00
|
|
|
WOOL(35, Wool.class),
|
2011-06-30 15:18:11 +01:00
|
|
|
PISTON_MOVING_PIECE(36),
|
2011-01-13 23:33:10 +00:00
|
|
|
YELLOW_FLOWER(37),
|
|
|
|
RED_ROSE(38),
|
|
|
|
BROWN_MUSHROOM(39),
|
|
|
|
RED_MUSHROOM(40),
|
|
|
|
GOLD_BLOCK(41),
|
|
|
|
IRON_BLOCK(42),
|
2011-03-14 18:08:57 -07:00
|
|
|
DOUBLE_STEP(43, Step.class),
|
|
|
|
STEP(44, Step.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
BRICK(45),
|
2011-01-01 07:01:53 +00:00
|
|
|
TNT(46),
|
2011-01-13 23:33:10 +00:00
|
|
|
BOOKSHELF(47),
|
|
|
|
MOSSY_COBBLESTONE(48),
|
|
|
|
OBSIDIAN(49),
|
2011-01-15 20:38:41 +00:00
|
|
|
TORCH(50, Torch.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
FIRE(51),
|
|
|
|
MOB_SPAWNER(52),
|
2011-04-02 16:42:12 -07:00
|
|
|
WOOD_STAIRS(53, Stairs.class),
|
2012-08-04 21:23:59 -05:00
|
|
|
CHEST(54, Chest.class),
|
2011-01-15 20:38:41 +00:00
|
|
|
REDSTONE_WIRE(55, RedstoneWire.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
DIAMOND_ORE(56),
|
|
|
|
DIAMOND_BLOCK(57),
|
|
|
|
WORKBENCH(58),
|
2011-03-14 18:08:57 -07:00
|
|
|
CROPS(59, Crops.class),
|
2011-04-02 16:42:12 -07:00
|
|
|
SOIL(60, MaterialData.class),
|
|
|
|
FURNACE(61, Furnace.class),
|
|
|
|
BURNING_FURNACE(62, Furnace.class),
|
2012-01-29 11:10:40 +01:00
|
|
|
SIGN_POST(63, 64, Sign.class),
|
2011-03-25 14:54:58 -07:00
|
|
|
WOODEN_DOOR(64, Door.class),
|
2011-01-15 20:45:24 +00:00
|
|
|
LADDER(65, Ladder.class),
|
2011-04-02 16:42:12 -07:00
|
|
|
RAILS(66, Rails.class),
|
|
|
|
COBBLESTONE_STAIRS(67, Stairs.class),
|
2012-01-29 11:10:40 +01:00
|
|
|
WALL_SIGN(68, 64, Sign.class),
|
2011-01-15 20:51:16 +00:00
|
|
|
LEVER(69, Lever.class),
|
2011-04-02 16:42:12 -07:00
|
|
|
STONE_PLATE(70, PressurePlate.class),
|
2011-03-25 14:54:58 -07:00
|
|
|
IRON_DOOR_BLOCK(71, Door.class),
|
2011-04-02 16:42:12 -07:00
|
|
|
WOOD_PLATE(72, PressurePlate.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
REDSTONE_ORE(73),
|
|
|
|
GLOWING_REDSTONE_ORE(74),
|
2011-01-15 20:38:41 +00:00
|
|
|
REDSTONE_TORCH_OFF(75, RedstoneTorch.class),
|
|
|
|
REDSTONE_TORCH_ON(76, RedstoneTorch.class),
|
2011-01-15 20:58:34 +00:00
|
|
|
STONE_BUTTON(77, Button.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
SNOW(78),
|
|
|
|
ICE(79),
|
|
|
|
SNOW_BLOCK(80),
|
2011-04-02 16:42:12 -07:00
|
|
|
CACTUS(81, MaterialData.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
CLAY(82),
|
2011-04-02 16:42:12 -07:00
|
|
|
SUGAR_CANE_BLOCK(83, MaterialData.class),
|
2011-08-22 01:27:48 -04:00
|
|
|
JUKEBOX(84),
|
2011-01-13 23:33:10 +00:00
|
|
|
FENCE(85),
|
2011-04-02 16:42:12 -07:00
|
|
|
PUMPKIN(86, Pumpkin.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
NETHERRACK(87),
|
|
|
|
SOUL_SAND(88),
|
|
|
|
GLOWSTONE(89),
|
|
|
|
PORTAL(90),
|
2011-04-02 16:42:12 -07:00
|
|
|
JACK_O_LANTERN(91, Pumpkin.class),
|
2012-01-29 11:10:40 +01:00
|
|
|
CAKE_BLOCK(92, 64, Cake.class),
|
2011-03-26 12:29:52 -04:00
|
|
|
DIODE_BLOCK_OFF(93, Diode.class),
|
|
|
|
DIODE_BLOCK_ON(94, Diode.class),
|
2013-11-13 17:53:49 -07:00
|
|
|
STAINED_GLASS(95),
|
2011-05-26 06:28:24 +01:00
|
|
|
TRAP_DOOR(96, TrapDoor.class),
|
2011-09-25 15:27:16 +01:00
|
|
|
MONSTER_EGGS(97, MonsterEggs.class),
|
2011-09-15 16:33:53 -07:00
|
|
|
SMOOTH_BRICK(98, SmoothBrick.class),
|
2012-02-26 22:07:26 -05:00
|
|
|
HUGE_MUSHROOM_1(99, Mushroom.class),
|
|
|
|
HUGE_MUSHROOM_2(100, Mushroom.class),
|
2011-09-15 02:54:19 +01:00
|
|
|
IRON_FENCE(101),
|
|
|
|
THIN_GLASS(102),
|
|
|
|
MELON_BLOCK(103),
|
2012-02-26 22:07:26 -05:00
|
|
|
PUMPKIN_STEM(104, MaterialData.class),
|
|
|
|
MELON_STEM(105, MaterialData.class),
|
|
|
|
VINE(106, Vine.class),
|
|
|
|
FENCE_GATE(107, Gate.class),
|
|
|
|
BRICK_STAIRS(108, Stairs.class),
|
|
|
|
SMOOTH_STAIRS(109, Stairs.class),
|
2011-10-29 09:43:19 +01:00
|
|
|
MYCEL(110),
|
|
|
|
WATER_LILY(111),
|
|
|
|
NETHER_BRICK(112),
|
|
|
|
NETHER_FENCE(113),
|
2012-02-26 22:07:26 -05:00
|
|
|
NETHER_BRICK_STAIRS(114, Stairs.class),
|
2012-04-29 21:09:57 -04:00
|
|
|
NETHER_WARTS(115, NetherWarts.class),
|
2011-10-29 09:43:19 +01:00
|
|
|
ENCHANTMENT_TABLE(116),
|
2012-02-26 22:07:26 -05:00
|
|
|
BREWING_STAND(117, MaterialData.class),
|
|
|
|
CAULDRON(118, Cauldron.class),
|
2011-10-29 09:43:19 +01:00
|
|
|
ENDER_PORTAL(119),
|
2011-11-28 15:52:11 +11:00
|
|
|
ENDER_PORTAL_FRAME(120),
|
2011-11-21 22:38:51 +00:00
|
|
|
ENDER_STONE(121),
|
|
|
|
DRAGON_EGG(122),
|
2012-03-01 10:48:44 +00:00
|
|
|
REDSTONE_LAMP_OFF(123),
|
|
|
|
REDSTONE_LAMP_ON(124),
|
2016-03-01 08:30:03 +11:00
|
|
|
WOOD_DOUBLE_STEP(125, Wood.class),
|
2012-10-22 03:30:04 -05:00
|
|
|
WOOD_STEP(126, WoodenStep.class),
|
|
|
|
COCOA(127, CocoaPlant.class),
|
|
|
|
SANDSTONE_STAIRS(128, Stairs.class),
|
|
|
|
EMERALD_ORE(129),
|
|
|
|
ENDER_CHEST(130, EnderChest.class),
|
|
|
|
TRIPWIRE_HOOK(131, TripwireHook.class),
|
|
|
|
TRIPWIRE(132, Tripwire.class),
|
|
|
|
EMERALD_BLOCK(133),
|
|
|
|
SPRUCE_WOOD_STAIRS(134, Stairs.class),
|
|
|
|
BIRCH_WOOD_STAIRS(135, Stairs.class),
|
|
|
|
JUNGLE_WOOD_STAIRS(136, Stairs.class),
|
|
|
|
COMMAND(137, Command.class),
|
|
|
|
BEACON(138),
|
|
|
|
COBBLE_WALL(139),
|
|
|
|
FLOWER_POT(140, FlowerPot.class),
|
|
|
|
CARROT(141),
|
|
|
|
POTATO(142),
|
|
|
|
WOOD_BUTTON(143, Button.class),
|
|
|
|
SKULL(144, Skull.class),
|
|
|
|
ANVIL(145),
|
2015-09-12 18:00:26 -07:00
|
|
|
TRAPPED_CHEST(146, Chest.class),
|
2013-03-13 17:32:25 -05:00
|
|
|
GOLD_PLATE(147),
|
|
|
|
IRON_PLATE(148),
|
|
|
|
REDSTONE_COMPARATOR_OFF(149),
|
|
|
|
REDSTONE_COMPARATOR_ON(150),
|
|
|
|
DAYLIGHT_DETECTOR(151),
|
|
|
|
REDSTONE_BLOCK(152),
|
|
|
|
QUARTZ_ORE(153),
|
|
|
|
HOPPER(154),
|
|
|
|
QUARTZ_BLOCK(155),
|
|
|
|
QUARTZ_STAIRS(156, Stairs.class),
|
2013-04-12 16:20:50 -05:00
|
|
|
ACTIVATOR_RAIL(157, PoweredRail.class),
|
|
|
|
DROPPER(158, Dispenser.class),
|
2013-07-01 05:50:24 -05:00
|
|
|
STAINED_CLAY(159),
|
2013-11-13 17:53:49 -07:00
|
|
|
STAINED_GLASS_PANE(160),
|
2016-03-01 08:30:03 +11:00
|
|
|
LEAVES_2(161, Leaves.class),
|
|
|
|
LOG_2(162, Tree.class),
|
2013-12-03 21:33:30 -08:00
|
|
|
ACACIA_STAIRS(163, Stairs.class),
|
|
|
|
DARK_OAK_STAIRS(164, Stairs.class),
|
2014-11-26 08:15:59 +11:00
|
|
|
SLIME_BLOCK(165),
|
|
|
|
BARRIER(166),
|
|
|
|
IRON_TRAPDOOR(167, TrapDoor.class),
|
|
|
|
PRISMARINE(168),
|
|
|
|
SEA_LANTERN(169),
|
2013-07-01 05:50:24 -05:00
|
|
|
HAY_BLOCK(170),
|
|
|
|
CARPET(171),
|
|
|
|
HARD_CLAY(172),
|
|
|
|
COAL_BLOCK(173),
|
2013-11-13 17:53:49 -07:00
|
|
|
PACKED_ICE(174),
|
|
|
|
DOUBLE_PLANT(175),
|
2014-11-26 08:15:59 +11:00
|
|
|
STANDING_BANNER(176, Banner.class),
|
|
|
|
WALL_BANNER(177, Banner.class),
|
|
|
|
DAYLIGHT_DETECTOR_INVERTED(178),
|
|
|
|
RED_SANDSTONE(179),
|
|
|
|
RED_SANDSTONE_STAIRS(180, Stairs.class),
|
|
|
|
DOUBLE_STONE_SLAB2(181),
|
|
|
|
STONE_SLAB2(182),
|
2014-12-12 19:21:07 +01:00
|
|
|
SPRUCE_FENCE_GATE(183, Gate.class),
|
|
|
|
BIRCH_FENCE_GATE(184, Gate.class),
|
|
|
|
JUNGLE_FENCE_GATE(185, Gate.class),
|
|
|
|
DARK_OAK_FENCE_GATE(186, Gate.class),
|
|
|
|
ACACIA_FENCE_GATE(187, Gate.class),
|
2014-11-26 08:15:59 +11:00
|
|
|
SPRUCE_FENCE(188),
|
|
|
|
BIRCH_FENCE(189),
|
|
|
|
JUNGLE_FENCE(190),
|
|
|
|
DARK_OAK_FENCE(191),
|
2015-07-08 22:39:33 +01:00
|
|
|
ACACIA_FENCE(192),
|
2015-06-19 12:50:44 -04:00
|
|
|
SPRUCE_DOOR(193, Door.class),
|
|
|
|
BIRCH_DOOR(194, Door.class),
|
|
|
|
JUNGLE_DOOR(195, Door.class),
|
|
|
|
ACACIA_DOOR(196, Door.class),
|
|
|
|
DARK_OAK_DOOR(197, Door.class),
|
2016-03-01 08:30:03 +11:00
|
|
|
END_ROD(198),
|
|
|
|
CHORUS_PLANT(199),
|
|
|
|
CHORUS_FLOWER(200),
|
|
|
|
PURPUR_BLOCK(201),
|
|
|
|
PURPUR_PILLAR(202),
|
|
|
|
PURPUR_STAIRS(203, Stairs.class),
|
|
|
|
PURPUR_DOUBLE_SLAB(204),
|
|
|
|
PURPUR_SLAB(205),
|
|
|
|
END_BRICKS(206),
|
|
|
|
BEETROOT_BLOCK(207, Crops.class),
|
|
|
|
GRASS_PATH(208),
|
|
|
|
END_GATEWAY(209),
|
|
|
|
COMMAND_REPEATING(210),
|
|
|
|
COMMAND_CHAIN(211),
|
2016-03-01 13:24:38 +11:00
|
|
|
FROSTED_ICE(212),
|
2016-03-01 08:30:03 +11:00
|
|
|
STRUCTURE_BLOCK(255),
|
2011-01-31 01:06:53 +00:00
|
|
|
// ----- Item Separator -----
|
|
|
|
IRON_SPADE(256, 1, 250),
|
|
|
|
IRON_PICKAXE(257, 1, 250),
|
|
|
|
IRON_AXE(258, 1, 250),
|
|
|
|
FLINT_AND_STEEL(259, 1, 64),
|
2011-09-17 16:55:22 -04:00
|
|
|
APPLE(260),
|
2011-11-28 09:49:22 +11:00
|
|
|
BOW(261, 1, 384),
|
2011-01-13 23:33:10 +00:00
|
|
|
ARROW(262),
|
2011-03-14 18:08:57 -07:00
|
|
|
COAL(263, Coal.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
DIAMOND(264),
|
|
|
|
IRON_INGOT(265),
|
|
|
|
GOLD_INGOT(266),
|
2011-06-07 02:23:01 -04:00
|
|
|
IRON_SWORD(267, 1, 250),
|
2011-01-31 01:06:53 +00:00
|
|
|
WOOD_SWORD(268, 1, 59),
|
|
|
|
WOOD_SPADE(269, 1, 59),
|
|
|
|
WOOD_PICKAXE(270, 1, 59),
|
|
|
|
WOOD_AXE(271, 1, 59),
|
|
|
|
STONE_SWORD(272, 1, 131),
|
|
|
|
STONE_SPADE(273, 1, 131),
|
|
|
|
STONE_PICKAXE(274, 1, 131),
|
|
|
|
STONE_AXE(275, 1, 131),
|
|
|
|
DIAMOND_SWORD(276, 1, 1561),
|
|
|
|
DIAMOND_SPADE(277, 1, 1561),
|
|
|
|
DIAMOND_PICKAXE(278, 1, 1561),
|
|
|
|
DIAMOND_AXE(279, 1, 1561),
|
2011-01-13 23:33:10 +00:00
|
|
|
STICK(280),
|
|
|
|
BOWL(281),
|
2011-01-20 02:51:17 +00:00
|
|
|
MUSHROOM_SOUP(282, 1),
|
2011-01-31 01:06:53 +00:00
|
|
|
GOLD_SWORD(283, 1, 32),
|
|
|
|
GOLD_SPADE(284, 1, 32),
|
|
|
|
GOLD_PICKAXE(285, 1, 32),
|
|
|
|
GOLD_AXE(286, 1, 32),
|
2011-01-13 23:33:10 +00:00
|
|
|
STRING(287),
|
|
|
|
FEATHER(288),
|
|
|
|
SULPHUR(289),
|
2011-01-31 01:06:53 +00:00
|
|
|
WOOD_HOE(290, 1, 59),
|
|
|
|
STONE_HOE(291, 1, 131),
|
|
|
|
IRON_HOE(292, 1, 250),
|
|
|
|
DIAMOND_HOE(293, 1, 1561),
|
|
|
|
GOLD_HOE(294, 1, 32),
|
2011-01-13 23:33:10 +00:00
|
|
|
SEEDS(295),
|
|
|
|
WHEAT(296),
|
2011-09-17 16:55:22 -04:00
|
|
|
BREAD(297),
|
2012-01-29 11:10:40 +01:00
|
|
|
LEATHER_HELMET(298, 1, 55),
|
2012-01-05 17:07:25 +01:00
|
|
|
LEATHER_CHESTPLATE(299, 1, 80),
|
|
|
|
LEATHER_LEGGINGS(300, 1, 75),
|
|
|
|
LEATHER_BOOTS(301, 1, 65),
|
2012-01-29 11:10:40 +01:00
|
|
|
CHAINMAIL_HELMET(302, 1, 165),
|
2012-01-05 17:07:25 +01:00
|
|
|
CHAINMAIL_CHESTPLATE(303, 1, 240),
|
|
|
|
CHAINMAIL_LEGGINGS(304, 1, 225),
|
|
|
|
CHAINMAIL_BOOTS(305, 1, 195),
|
|
|
|
IRON_HELMET(306, 1, 165),
|
|
|
|
IRON_CHESTPLATE(307, 1, 240),
|
|
|
|
IRON_LEGGINGS(308, 1, 225),
|
|
|
|
IRON_BOOTS(309, 1, 195),
|
|
|
|
DIAMOND_HELMET(310, 1, 363),
|
|
|
|
DIAMOND_CHESTPLATE(311, 1, 528),
|
|
|
|
DIAMOND_LEGGINGS(312, 1, 495),
|
|
|
|
DIAMOND_BOOTS(313, 1, 429),
|
|
|
|
GOLD_HELMET(314, 1, 77),
|
|
|
|
GOLD_CHESTPLATE(315, 1, 112),
|
|
|
|
GOLD_LEGGINGS(316, 1, 105),
|
|
|
|
GOLD_BOOTS(317, 1, 91),
|
2011-01-13 23:33:10 +00:00
|
|
|
FLINT(318),
|
2011-09-17 16:55:22 -04:00
|
|
|
PORK(319),
|
|
|
|
GRILLED_PORK(320),
|
2011-01-13 23:33:10 +00:00
|
|
|
PAINTING(321),
|
2011-09-17 16:55:22 -04:00
|
|
|
GOLDEN_APPLE(322),
|
2012-07-29 02:34:09 -05:00
|
|
|
SIGN(323, 16),
|
2014-11-26 08:15:59 +11:00
|
|
|
WOOD_DOOR(324, 64),
|
2012-07-29 02:34:09 -05:00
|
|
|
BUCKET(325, 16),
|
2011-01-20 02:51:17 +00:00
|
|
|
WATER_BUCKET(326, 1),
|
|
|
|
LAVA_BUCKET(327, 1),
|
|
|
|
MINECART(328, 1),
|
|
|
|
SADDLE(329, 1),
|
2014-11-26 08:15:59 +11:00
|
|
|
IRON_DOOR(330, 64),
|
2011-03-26 12:29:52 -04:00
|
|
|
REDSTONE(331),
|
2011-01-20 02:51:17 +00:00
|
|
|
SNOW_BALL(332, 16),
|
|
|
|
BOAT(333, 1),
|
2011-01-13 23:33:10 +00:00
|
|
|
LEATHER(334),
|
2011-07-12 02:24:14 -04:00
|
|
|
MILK_BUCKET(335, 1),
|
2011-01-13 23:33:10 +00:00
|
|
|
CLAY_BRICK(336),
|
|
|
|
CLAY_BALL(337),
|
|
|
|
SUGAR_CANE(338),
|
|
|
|
PAPER(339),
|
|
|
|
BOOK(340),
|
|
|
|
SLIME_BALL(341),
|
2011-01-20 02:51:17 +00:00
|
|
|
STORAGE_MINECART(342, 1),
|
|
|
|
POWERED_MINECART(343, 1),
|
|
|
|
EGG(344, 16),
|
2011-01-13 23:33:10 +00:00
|
|
|
COMPASS(345),
|
2011-07-12 02:24:14 -04:00
|
|
|
FISHING_ROD(346, 1, 64),
|
2011-01-13 23:33:10 +00:00
|
|
|
WATCH(347),
|
|
|
|
GLOWSTONE_DUST(348),
|
2011-09-17 16:55:22 -04:00
|
|
|
RAW_FISH(349),
|
|
|
|
COOKED_FISH(350),
|
2011-01-14 00:20:00 +00:00
|
|
|
INK_SACK(351, Dye.class),
|
2011-01-13 23:33:10 +00:00
|
|
|
BONE(352),
|
|
|
|
SUGAR(353),
|
2011-01-20 02:51:17 +00:00
|
|
|
CAKE(354, 1),
|
2011-07-12 02:24:14 -04:00
|
|
|
BED(355, 1),
|
2011-02-23 03:18:08 +00:00
|
|
|
DIODE(356),
|
2011-09-17 16:55:22 -04:00
|
|
|
COOKIE(357),
|
2012-02-26 22:07:26 -05:00
|
|
|
/**
|
|
|
|
* @see MapView
|
|
|
|
*/
|
2012-10-22 03:30:04 -05:00
|
|
|
MAP(358, MaterialData.class),
|
2011-07-12 02:24:14 -04:00
|
|
|
SHEARS(359, 1, 238),
|
2011-09-15 02:54:19 +01:00
|
|
|
MELON(360),
|
|
|
|
PUMPKIN_SEEDS(361),
|
|
|
|
MELON_SEEDS(362),
|
|
|
|
RAW_BEEF(363),
|
|
|
|
COOKED_BEEF(364),
|
|
|
|
RAW_CHICKEN(365),
|
|
|
|
COOKED_CHICKEN(366),
|
|
|
|
ROTTEN_FLESH(367),
|
2012-01-04 09:36:43 +01:00
|
|
|
ENDER_PEARL(368, 16),
|
2011-10-29 09:43:19 +01:00
|
|
|
BLAZE_ROD(369),
|
|
|
|
GHAST_TEAR(370),
|
|
|
|
GOLD_NUGGET(371),
|
|
|
|
NETHER_STALK(372),
|
2012-02-26 22:07:26 -05:00
|
|
|
POTION(373, 1, MaterialData.class),
|
2011-10-29 09:43:19 +01:00
|
|
|
GLASS_BOTTLE(374),
|
|
|
|
SPIDER_EYE(375),
|
|
|
|
FERMENTED_SPIDER_EYE(376),
|
|
|
|
BLAZE_POWDER(377),
|
|
|
|
MAGMA_CREAM(378),
|
|
|
|
BREWING_STAND_ITEM(379),
|
|
|
|
CAULDRON_ITEM(380),
|
|
|
|
EYE_OF_ENDER(381),
|
|
|
|
SPECKLED_MELON(382),
|
2012-03-01 10:48:44 +00:00
|
|
|
MONSTER_EGG(383, 64, SpawnEgg.class),
|
|
|
|
EXP_BOTTLE(384, 64),
|
|
|
|
FIREBALL(385, 64),
|
2012-10-22 03:30:04 -05:00
|
|
|
BOOK_AND_QUILL(386, 1),
|
2013-11-13 17:53:49 -07:00
|
|
|
WRITTEN_BOOK(387, 16),
|
2012-10-22 03:30:04 -05:00
|
|
|
EMERALD(388, 64),
|
|
|
|
ITEM_FRAME(389),
|
|
|
|
FLOWER_POT_ITEM(390),
|
|
|
|
CARROT_ITEM(391),
|
|
|
|
POTATO_ITEM(392),
|
|
|
|
BAKED_POTATO(393),
|
|
|
|
POISONOUS_POTATO(394),
|
|
|
|
EMPTY_MAP(395),
|
|
|
|
GOLDEN_CARROT(396),
|
|
|
|
SKULL_ITEM(397),
|
|
|
|
CARROT_STICK(398, 1, 25),
|
|
|
|
NETHER_STAR(399),
|
|
|
|
PUMPKIN_PIE(400),
|
2012-12-20 08:38:59 -06:00
|
|
|
FIREWORK(401),
|
|
|
|
FIREWORK_CHARGE(402),
|
|
|
|
ENCHANTED_BOOK(403, 1),
|
2013-03-13 17:32:25 -05:00
|
|
|
REDSTONE_COMPARATOR(404),
|
|
|
|
NETHER_BRICK_ITEM(405),
|
|
|
|
QUARTZ(406),
|
2013-03-15 22:19:58 -05:00
|
|
|
EXPLOSIVE_MINECART(407, 1),
|
2013-03-13 17:32:25 -05:00
|
|
|
HOPPER_MINECART(408, 1),
|
2014-11-26 08:15:59 +11:00
|
|
|
PRISMARINE_SHARD(409),
|
|
|
|
PRISMARINE_CRYSTALS(410),
|
|
|
|
RABBIT(411),
|
|
|
|
COOKED_RABBIT(412),
|
|
|
|
RABBIT_STEW(413, 1),
|
|
|
|
RABBIT_FOOT(414),
|
|
|
|
RABBIT_HIDE(415),
|
|
|
|
ARMOR_STAND(416, 16),
|
2013-07-01 05:50:24 -05:00
|
|
|
IRON_BARDING(417, 1),
|
|
|
|
GOLD_BARDING(418, 1),
|
|
|
|
DIAMOND_BARDING(419, 1),
|
|
|
|
LEASH(420),
|
|
|
|
NAME_TAG(421),
|
2013-11-13 17:53:49 -07:00
|
|
|
COMMAND_MINECART(422, 1),
|
2014-11-26 08:15:59 +11:00
|
|
|
MUTTON(423),
|
|
|
|
COOKED_MUTTON(424),
|
|
|
|
BANNER(425, 16),
|
2016-03-01 08:30:03 +11:00
|
|
|
END_CRYSTAL(426),
|
2014-11-26 08:15:59 +11:00
|
|
|
SPRUCE_DOOR_ITEM(427),
|
|
|
|
BIRCH_DOOR_ITEM(428),
|
|
|
|
JUNGLE_DOOR_ITEM(429),
|
|
|
|
ACACIA_DOOR_ITEM(430),
|
|
|
|
DARK_OAK_DOOR_ITEM(431),
|
2016-03-01 08:30:03 +11:00
|
|
|
CHORUS_FRUIT(432),
|
|
|
|
CHORUS_FRUIT_POPPED(433),
|
|
|
|
BEETROOT(434),
|
|
|
|
BEETROOT_SEEDS(435),
|
|
|
|
BEETROOT_SOUP(436, 1),
|
|
|
|
DRAGONS_BREATH(437),
|
|
|
|
SPLASH_POTION(438, 1),
|
|
|
|
SPECTRAL_ARROW(439),
|
|
|
|
TIPPED_ARROW(440),
|
2016-03-02 20:45:27 -05:00
|
|
|
LINGERING_POTION(441, 1),
|
2016-03-01 20:00:51 +11:00
|
|
|
SHIELD(442, 1, 336),
|
2016-03-01 08:30:03 +11:00
|
|
|
ELYTRA(443, 1),
|
|
|
|
BOAT_SPRUCE(444, 1),
|
|
|
|
BOAT_BIRCH(445, 1),
|
|
|
|
BOAT_JUNGLE(446, 1),
|
|
|
|
BOAT_ACACIA(447, 1),
|
|
|
|
BOAT_DARK_OAK(448, 1),
|
2011-01-20 02:51:17 +00:00
|
|
|
GOLD_RECORD(2256, 1),
|
2011-10-29 09:43:19 +01:00
|
|
|
GREEN_RECORD(2257, 1),
|
|
|
|
RECORD_3(2258, 1),
|
|
|
|
RECORD_4(2259, 1),
|
|
|
|
RECORD_5(2260, 1),
|
|
|
|
RECORD_6(2261, 1),
|
|
|
|
RECORD_7(2262, 1),
|
|
|
|
RECORD_8(2263, 1),
|
|
|
|
RECORD_9(2264, 1),
|
|
|
|
RECORD_10(2265, 1),
|
2012-07-29 02:34:09 -05:00
|
|
|
RECORD_11(2266, 1),
|
2012-11-06 06:04:18 -06:00
|
|
|
RECORD_12(2267, 1),
|
2012-10-22 03:30:04 -05:00
|
|
|
;
|
2011-01-01 08:01:07 -05:00
|
|
|
|
2011-01-01 07:01:53 +00:00
|
|
|
private final int id;
|
2012-11-17 11:13:58 -06:00
|
|
|
private final Constructor<? extends MaterialData> ctor;
|
2012-01-29 11:10:40 +01:00
|
|
|
private static Material[] byId = new Material[383];
|
|
|
|
private final static Map<String, Material> BY_NAME = Maps.newHashMap();
|
2011-01-20 02:51:17 +00:00
|
|
|
private final int maxStack;
|
2011-01-31 01:06:53 +00:00
|
|
|
private final short durability;
|
2011-01-01 07:01:53 +00:00
|
|
|
|
|
|
|
private Material(final int id) {
|
2011-01-20 02:51:17 +00:00
|
|
|
this(id, 64);
|
|
|
|
}
|
|
|
|
|
|
|
|
private Material(final int id, final int stack) {
|
2012-11-17 11:13:58 -06:00
|
|
|
this(id, stack, MaterialData.class);
|
2011-01-13 23:33:10 +00:00
|
|
|
}
|
|
|
|
|
2011-01-31 01:06:53 +00:00
|
|
|
private Material(final int id, final int stack, final int durability) {
|
2012-11-17 11:13:58 -06:00
|
|
|
this(id, stack, durability, MaterialData.class);
|
2011-01-31 01:06:53 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 00:20:00 +00:00
|
|
|
private Material(final int id, final Class<? extends MaterialData> data) {
|
2011-01-20 02:51:17 +00:00
|
|
|
this(id, 64, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
private Material(final int id, final int stack, final Class<? extends MaterialData> data) {
|
2012-01-29 11:10:40 +01:00
|
|
|
this(id, stack, 0, data);
|
2011-01-31 01:06:53 +00:00
|
|
|
}
|
|
|
|
|
2011-02-04 22:45:52 +01:00
|
|
|
private Material(final int id, final int stack, final int durability, final Class<? extends MaterialData> data) {
|
2011-01-01 07:01:53 +00:00
|
|
|
this.id = id;
|
2011-05-14 23:22:54 +02:00
|
|
|
this.durability = (short) durability;
|
2011-01-20 02:51:17 +00:00
|
|
|
this.maxStack = stack;
|
2012-11-17 11:13:58 -06:00
|
|
|
// try to cache the constructor for this material
|
|
|
|
try {
|
|
|
|
this.ctor = data.getConstructor(int.class, byte.class);
|
|
|
|
} catch (NoSuchMethodException ex) {
|
|
|
|
throw new AssertionError(ex);
|
|
|
|
} catch (SecurityException ex) {
|
|
|
|
throw new AssertionError(ex);
|
|
|
|
}
|
2011-01-01 07:01:53 +00:00
|
|
|
}
|
|
|
|
|
2011-01-20 02:51:17 +00:00
|
|
|
/**
|
|
|
|
* Gets the item ID or block ID of this Material
|
|
|
|
*
|
|
|
|
* @return ID of this material
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-01-20 02:51:17 +00:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-01-15 20:53:43 +01:00
|
|
|
public int getId() {
|
2011-01-01 07:01:53 +00:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
2011-01-20 02:51:17 +00:00
|
|
|
/**
|
|
|
|
* Gets the maximum amount of this material that can be held in a stack
|
|
|
|
*
|
|
|
|
* @return Maximum stack size for this material
|
|
|
|
*/
|
|
|
|
public int getMaxStackSize() {
|
|
|
|
return maxStack;
|
|
|
|
}
|
|
|
|
|
2011-01-31 01:06:53 +00:00
|
|
|
/**
|
|
|
|
* Gets the maximum durability of this material
|
|
|
|
*
|
|
|
|
* @return Maximum durability for this material
|
|
|
|
*/
|
|
|
|
public short getMaxDurability() {
|
|
|
|
return durability;
|
|
|
|
}
|
|
|
|
|
2011-01-20 02:51:17 +00:00
|
|
|
/**
|
|
|
|
* Gets the MaterialData class associated with this Material
|
|
|
|
*
|
|
|
|
* @return MaterialData associated with this Material
|
|
|
|
*/
|
2011-01-14 00:20:00 +00:00
|
|
|
public Class<? extends MaterialData> getData() {
|
2012-11-17 11:13:58 -06:00
|
|
|
return ctor.getDeclaringClass();
|
2011-01-13 23:33:10 +00:00
|
|
|
}
|
|
|
|
|
2011-01-20 02:51:17 +00:00
|
|
|
/**
|
2013-12-15 01:07:43 -05:00
|
|
|
* Constructs a new MaterialData relevant for this Material, with the
|
|
|
|
* given initial data
|
2011-01-20 02:51:17 +00:00
|
|
|
*
|
|
|
|
* @param raw Initial data to construct the MaterialData with
|
|
|
|
* @return New MaterialData with the given data
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-01-20 02:51:17 +00:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-01-13 23:33:10 +00:00
|
|
|
public MaterialData getNewData(final byte raw) {
|
|
|
|
try {
|
|
|
|
return ctor.newInstance(id, raw);
|
|
|
|
} catch (InstantiationException ex) {
|
2012-11-17 11:13:58 -06:00
|
|
|
final Throwable t = ex.getCause();
|
|
|
|
if (t instanceof RuntimeException) {
|
|
|
|
throw (RuntimeException) t;
|
|
|
|
}
|
|
|
|
if (t instanceof Error) {
|
|
|
|
throw (Error) t;
|
|
|
|
}
|
|
|
|
throw new AssertionError(t);
|
|
|
|
} catch (Throwable t) {
|
|
|
|
throw new AssertionError(t);
|
2011-01-13 23:33:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-20 02:51:17 +00:00
|
|
|
/**
|
|
|
|
* Checks if this Material is a placable block
|
|
|
|
*
|
|
|
|
* @return true if this material is a block
|
|
|
|
*/
|
2011-01-07 04:40:46 -05:00
|
|
|
public boolean isBlock() {
|
2011-02-02 00:02:08 +01:00
|
|
|
return id < 256;
|
2011-01-07 04:40:46 -05:00
|
|
|
}
|
2011-02-01 12:55:29 +00:00
|
|
|
|
2011-12-06 09:44:16 +00:00
|
|
|
/**
|
|
|
|
* Checks if this Material is edible.
|
|
|
|
*
|
|
|
|
* @return true if this Material is edible.
|
|
|
|
*/
|
|
|
|
public boolean isEdible() {
|
2012-12-14 02:03:05 -06:00
|
|
|
switch (this) {
|
|
|
|
case BREAD:
|
|
|
|
case CARROT_ITEM:
|
|
|
|
case BAKED_POTATO:
|
|
|
|
case POTATO_ITEM:
|
|
|
|
case POISONOUS_POTATO:
|
|
|
|
case GOLDEN_CARROT:
|
|
|
|
case PUMPKIN_PIE:
|
|
|
|
case COOKIE:
|
|
|
|
case MELON:
|
|
|
|
case MUSHROOM_SOUP:
|
|
|
|
case RAW_CHICKEN:
|
|
|
|
case COOKED_CHICKEN:
|
|
|
|
case RAW_BEEF:
|
|
|
|
case COOKED_BEEF:
|
|
|
|
case RAW_FISH:
|
|
|
|
case COOKED_FISH:
|
|
|
|
case PORK:
|
|
|
|
case GRILLED_PORK:
|
|
|
|
case APPLE:
|
|
|
|
case GOLDEN_APPLE:
|
|
|
|
case ROTTEN_FLESH:
|
|
|
|
case SPIDER_EYE:
|
2014-11-26 08:15:59 +11:00
|
|
|
case RABBIT:
|
|
|
|
case COOKED_RABBIT:
|
|
|
|
case RABBIT_STEW:
|
|
|
|
case MUTTON:
|
|
|
|
case COOKED_MUTTON:
|
2016-03-01 08:30:03 +11:00
|
|
|
case BEETROOT:
|
|
|
|
case CHORUS_FRUIT:
|
|
|
|
case BEETROOT_SOUP:
|
2012-12-14 02:03:05 -06:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
2011-12-06 09:44:16 +00:00
|
|
|
}
|
|
|
|
|
2011-02-01 12:55:29 +00:00
|
|
|
/**
|
|
|
|
* Attempts to get the Material with the given ID
|
|
|
|
*
|
|
|
|
* @param id ID of the material to get
|
|
|
|
* @return Material if found, or null
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2011-02-01 12:55:29 +00:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-01-01 07:01:53 +00:00
|
|
|
public static Material getMaterial(final int id) {
|
2013-01-11 02:07:38 +01:00
|
|
|
if (byId.length > id && id >= 0) {
|
2012-01-29 11:10:40 +01:00
|
|
|
return byId[id];
|
2012-01-15 09:18:20 +00:00
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
2011-01-10 17:24:35 -05:00
|
|
|
}
|
|
|
|
|
2011-02-01 12:55:29 +00:00
|
|
|
/**
|
|
|
|
* Attempts to get the Material with the given name.
|
2013-12-15 01:07:43 -05:00
|
|
|
* <p>
|
2011-02-01 12:55:29 +00:00
|
|
|
* This is a normal lookup, names must be the precise name they are given
|
|
|
|
* in the enum.
|
|
|
|
*
|
|
|
|
* @param name Name of the material to get
|
|
|
|
* @return Material if found, or null
|
|
|
|
*/
|
2011-01-10 17:24:35 -05:00
|
|
|
public static Material getMaterial(final String name) {
|
2012-01-29 11:10:40 +01:00
|
|
|
return BY_NAME.get(name);
|
2011-01-01 07:01:53 +00:00
|
|
|
}
|
2011-02-01 12:55:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attempts to match the Material with the given name.
|
2013-12-15 01:07:43 -05:00
|
|
|
* <p>
|
|
|
|
* This is a match lookup; names will be converted to uppercase, then
|
|
|
|
* stripped of special characters in an attempt to format it like the
|
|
|
|
* enum.
|
2013-08-19 13:32:18 -05:00
|
|
|
* <p>
|
|
|
|
* Using this for match by ID is deprecated.
|
2011-02-01 12:55:29 +00:00
|
|
|
*
|
|
|
|
* @param name Name of the material to get
|
|
|
|
* @return Material if found, or null
|
|
|
|
*/
|
|
|
|
public static Material matchMaterial(final String name) {
|
2012-01-29 11:10:40 +01:00
|
|
|
Validate.notNull(name, "Name cannot be null");
|
|
|
|
|
2011-02-01 12:55:29 +00:00
|
|
|
Material result = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
result = getMaterial(Integer.parseInt(name));
|
2011-05-14 23:22:54 +02:00
|
|
|
} catch (NumberFormatException ex) {}
|
2011-02-01 12:55:29 +00:00
|
|
|
|
|
|
|
if (result == null) {
|
|
|
|
String filtered = name.toUpperCase();
|
2011-05-14 23:22:54 +02:00
|
|
|
|
2011-02-01 12:55:29 +00:00
|
|
|
filtered = filtered.replaceAll("\\s+", "_").replaceAll("\\W", "");
|
2012-01-29 11:10:40 +01:00
|
|
|
result = BY_NAME.get(filtered);
|
2011-02-01 12:55:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2011-02-02 00:02:08 +01:00
|
|
|
|
2011-01-01 07:01:53 +00:00
|
|
|
static {
|
|
|
|
for (Material material : values()) {
|
2012-01-29 11:10:40 +01:00
|
|
|
if (byId.length > material.id) {
|
|
|
|
byId[material.id] = material;
|
2012-01-15 09:18:20 +00:00
|
|
|
} else {
|
2012-01-29 11:10:40 +01:00
|
|
|
byId = Java15Compat.Arrays_copyOfRange(byId, 0, material.id + 2);
|
|
|
|
byId[material.id] = material;
|
2012-01-15 09:18:20 +00:00
|
|
|
}
|
2012-01-29 11:10:40 +01:00
|
|
|
BY_NAME.put(material.name(), material);
|
2011-01-01 07:01:53 +00:00
|
|
|
}
|
|
|
|
}
|
2012-02-26 12:53:31 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return True if this material represents a playable music disk.
|
|
|
|
*/
|
|
|
|
public boolean isRecord() {
|
2012-11-24 02:26:07 -06:00
|
|
|
return id >= GOLD_RECORD.id && id <= RECORD_12.id;
|
2012-02-26 12:53:31 -05:00
|
|
|
}
|
2012-12-09 15:13:25 -06:00
|
|
|
|
|
|
|
/**
|
2013-12-15 01:07:43 -05:00
|
|
|
* Check if the material is a block and solid (cannot be passed through by
|
|
|
|
* a player)
|
2012-12-09 15:13:25 -06:00
|
|
|
*
|
|
|
|
* @return True if this material is a block and solid
|
|
|
|
*/
|
|
|
|
public boolean isSolid() {
|
|
|
|
if (!isBlock() || id == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
switch (this) {
|
|
|
|
case STONE:
|
|
|
|
case GRASS:
|
|
|
|
case DIRT:
|
|
|
|
case COBBLESTONE:
|
|
|
|
case WOOD:
|
|
|
|
case BEDROCK:
|
|
|
|
case SAND:
|
|
|
|
case GRAVEL:
|
|
|
|
case GOLD_ORE:
|
|
|
|
case IRON_ORE:
|
|
|
|
case COAL_ORE:
|
|
|
|
case LOG:
|
|
|
|
case LEAVES:
|
|
|
|
case SPONGE:
|
|
|
|
case GLASS:
|
|
|
|
case LAPIS_ORE:
|
|
|
|
case LAPIS_BLOCK:
|
|
|
|
case DISPENSER:
|
|
|
|
case SANDSTONE:
|
|
|
|
case NOTE_BLOCK:
|
|
|
|
case BED_BLOCK:
|
|
|
|
case PISTON_STICKY_BASE:
|
|
|
|
case PISTON_BASE:
|
|
|
|
case PISTON_EXTENSION:
|
|
|
|
case WOOL:
|
|
|
|
case PISTON_MOVING_PIECE:
|
|
|
|
case GOLD_BLOCK:
|
|
|
|
case IRON_BLOCK:
|
|
|
|
case DOUBLE_STEP:
|
|
|
|
case STEP:
|
|
|
|
case BRICK:
|
|
|
|
case TNT:
|
|
|
|
case BOOKSHELF:
|
|
|
|
case MOSSY_COBBLESTONE:
|
|
|
|
case OBSIDIAN:
|
|
|
|
case MOB_SPAWNER:
|
|
|
|
case WOOD_STAIRS:
|
|
|
|
case CHEST:
|
|
|
|
case DIAMOND_ORE:
|
|
|
|
case DIAMOND_BLOCK:
|
|
|
|
case WORKBENCH:
|
|
|
|
case SOIL:
|
|
|
|
case FURNACE:
|
|
|
|
case BURNING_FURNACE:
|
2015-01-25 22:39:38 +11:00
|
|
|
case SIGN_POST:
|
2012-12-09 15:13:25 -06:00
|
|
|
case WOODEN_DOOR:
|
|
|
|
case COBBLESTONE_STAIRS:
|
2015-01-25 22:39:38 +11:00
|
|
|
case WALL_SIGN:
|
2012-12-09 15:13:25 -06:00
|
|
|
case STONE_PLATE:
|
|
|
|
case IRON_DOOR_BLOCK:
|
|
|
|
case WOOD_PLATE:
|
|
|
|
case REDSTONE_ORE:
|
|
|
|
case GLOWING_REDSTONE_ORE:
|
|
|
|
case ICE:
|
|
|
|
case SNOW_BLOCK:
|
|
|
|
case CACTUS:
|
|
|
|
case CLAY:
|
|
|
|
case JUKEBOX:
|
|
|
|
case FENCE:
|
|
|
|
case PUMPKIN:
|
|
|
|
case NETHERRACK:
|
|
|
|
case SOUL_SAND:
|
|
|
|
case GLOWSTONE:
|
|
|
|
case JACK_O_LANTERN:
|
|
|
|
case CAKE_BLOCK:
|
2013-11-13 17:53:49 -07:00
|
|
|
case STAINED_GLASS:
|
2012-12-09 15:13:25 -06:00
|
|
|
case TRAP_DOOR:
|
|
|
|
case MONSTER_EGGS:
|
|
|
|
case SMOOTH_BRICK:
|
|
|
|
case HUGE_MUSHROOM_1:
|
|
|
|
case HUGE_MUSHROOM_2:
|
|
|
|
case IRON_FENCE:
|
|
|
|
case THIN_GLASS:
|
|
|
|
case MELON_BLOCK:
|
|
|
|
case FENCE_GATE:
|
|
|
|
case BRICK_STAIRS:
|
|
|
|
case SMOOTH_STAIRS:
|
|
|
|
case MYCEL:
|
|
|
|
case NETHER_BRICK:
|
|
|
|
case NETHER_FENCE:
|
|
|
|
case NETHER_BRICK_STAIRS:
|
|
|
|
case ENCHANTMENT_TABLE:
|
|
|
|
case BREWING_STAND:
|
|
|
|
case CAULDRON:
|
|
|
|
case ENDER_PORTAL_FRAME:
|
|
|
|
case ENDER_STONE:
|
|
|
|
case DRAGON_EGG:
|
|
|
|
case REDSTONE_LAMP_OFF:
|
|
|
|
case REDSTONE_LAMP_ON:
|
|
|
|
case WOOD_DOUBLE_STEP:
|
|
|
|
case WOOD_STEP:
|
|
|
|
case SANDSTONE_STAIRS:
|
|
|
|
case EMERALD_ORE:
|
|
|
|
case ENDER_CHEST:
|
|
|
|
case EMERALD_BLOCK:
|
|
|
|
case SPRUCE_WOOD_STAIRS:
|
|
|
|
case BIRCH_WOOD_STAIRS:
|
|
|
|
case JUNGLE_WOOD_STAIRS:
|
|
|
|
case COMMAND:
|
|
|
|
case BEACON:
|
|
|
|
case COBBLE_WALL:
|
|
|
|
case ANVIL:
|
2013-03-13 17:32:25 -05:00
|
|
|
case TRAPPED_CHEST:
|
|
|
|
case GOLD_PLATE:
|
|
|
|
case IRON_PLATE:
|
|
|
|
case DAYLIGHT_DETECTOR:
|
|
|
|
case REDSTONE_BLOCK:
|
|
|
|
case QUARTZ_ORE:
|
|
|
|
case HOPPER:
|
|
|
|
case QUARTZ_BLOCK:
|
|
|
|
case QUARTZ_STAIRS:
|
|
|
|
case DROPPER:
|
2013-07-01 05:50:24 -05:00
|
|
|
case STAINED_CLAY:
|
|
|
|
case HAY_BLOCK:
|
|
|
|
case HARD_CLAY:
|
|
|
|
case COAL_BLOCK:
|
2013-11-13 17:53:49 -07:00
|
|
|
case STAINED_GLASS_PANE:
|
|
|
|
case LEAVES_2:
|
|
|
|
case LOG_2:
|
|
|
|
case ACACIA_STAIRS:
|
|
|
|
case DARK_OAK_STAIRS:
|
|
|
|
case PACKED_ICE:
|
2014-11-26 08:15:59 +11:00
|
|
|
case RED_SANDSTONE:
|
|
|
|
case SLIME_BLOCK:
|
|
|
|
case BARRIER:
|
|
|
|
case IRON_TRAPDOOR:
|
|
|
|
case PRISMARINE:
|
|
|
|
case SEA_LANTERN:
|
|
|
|
case DOUBLE_STONE_SLAB2:
|
|
|
|
case RED_SANDSTONE_STAIRS:
|
|
|
|
case STONE_SLAB2:
|
|
|
|
case SPRUCE_FENCE_GATE:
|
|
|
|
case BIRCH_FENCE_GATE:
|
|
|
|
case JUNGLE_FENCE_GATE:
|
|
|
|
case DARK_OAK_FENCE_GATE:
|
|
|
|
case ACACIA_FENCE_GATE:
|
|
|
|
case SPRUCE_FENCE:
|
|
|
|
case BIRCH_FENCE:
|
|
|
|
case JUNGLE_FENCE:
|
|
|
|
case DARK_OAK_FENCE:
|
|
|
|
case ACACIA_FENCE:
|
2015-01-25 12:09:17 +00:00
|
|
|
case STANDING_BANNER:
|
|
|
|
case WALL_BANNER:
|
|
|
|
case DAYLIGHT_DETECTOR_INVERTED:
|
|
|
|
case SPRUCE_DOOR:
|
|
|
|
case BIRCH_DOOR:
|
|
|
|
case JUNGLE_DOOR:
|
|
|
|
case ACACIA_DOOR:
|
|
|
|
case DARK_OAK_DOOR:
|
2016-03-01 08:30:03 +11:00
|
|
|
case PURPUR_BLOCK:
|
|
|
|
case PURPUR_PILLAR:
|
|
|
|
case PURPUR_STAIRS:
|
|
|
|
case PURPUR_DOUBLE_SLAB:
|
|
|
|
case PURPUR_SLAB:
|
|
|
|
case END_BRICKS:
|
|
|
|
case GRASS_PATH:
|
|
|
|
case STRUCTURE_BLOCK:
|
|
|
|
case COMMAND_REPEATING:
|
|
|
|
case COMMAND_CHAIN:
|
2016-03-01 13:30:13 +11:00
|
|
|
case FROSTED_ICE:
|
2012-12-09 15:13:25 -06:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2012-12-14 02:03:05 -06:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the material is a block and does not block any light
|
|
|
|
*
|
|
|
|
* @return True if this material is a block and does not block any light
|
|
|
|
*/
|
|
|
|
public boolean isTransparent() {
|
|
|
|
if (!isBlock()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
switch (this) {
|
|
|
|
case AIR:
|
|
|
|
case SAPLING:
|
|
|
|
case POWERED_RAIL:
|
|
|
|
case DETECTOR_RAIL:
|
|
|
|
case LONG_GRASS:
|
|
|
|
case DEAD_BUSH:
|
|
|
|
case YELLOW_FLOWER:
|
|
|
|
case RED_ROSE:
|
|
|
|
case BROWN_MUSHROOM:
|
|
|
|
case RED_MUSHROOM:
|
|
|
|
case TORCH:
|
|
|
|
case FIRE:
|
|
|
|
case REDSTONE_WIRE:
|
|
|
|
case CROPS:
|
|
|
|
case LADDER:
|
|
|
|
case RAILS:
|
|
|
|
case LEVER:
|
|
|
|
case REDSTONE_TORCH_OFF:
|
|
|
|
case REDSTONE_TORCH_ON:
|
|
|
|
case STONE_BUTTON:
|
|
|
|
case SNOW:
|
|
|
|
case SUGAR_CANE_BLOCK:
|
|
|
|
case PORTAL:
|
|
|
|
case DIODE_BLOCK_OFF:
|
|
|
|
case DIODE_BLOCK_ON:
|
|
|
|
case PUMPKIN_STEM:
|
|
|
|
case MELON_STEM:
|
|
|
|
case VINE:
|
|
|
|
case WATER_LILY:
|
|
|
|
case NETHER_WARTS:
|
|
|
|
case ENDER_PORTAL:
|
|
|
|
case COCOA:
|
|
|
|
case TRIPWIRE_HOOK:
|
|
|
|
case TRIPWIRE:
|
|
|
|
case FLOWER_POT:
|
|
|
|
case CARROT:
|
|
|
|
case POTATO:
|
|
|
|
case WOOD_BUTTON:
|
|
|
|
case SKULL:
|
2013-03-13 17:32:25 -05:00
|
|
|
case REDSTONE_COMPARATOR_OFF:
|
|
|
|
case REDSTONE_COMPARATOR_ON:
|
|
|
|
case ACTIVATOR_RAIL:
|
2013-07-01 05:50:24 -05:00
|
|
|
case CARPET:
|
2013-11-13 17:53:49 -07:00
|
|
|
case DOUBLE_PLANT:
|
2016-03-01 08:30:03 +11:00
|
|
|
case END_ROD:
|
|
|
|
case CHORUS_PLANT:
|
|
|
|
case CHORUS_FLOWER:
|
|
|
|
case BEETROOT_BLOCK:
|
|
|
|
case END_GATEWAY:
|
2012-12-14 02:03:05 -06:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the material is a block and can catch fire
|
|
|
|
*
|
|
|
|
* @return True if this material is a block and can catch fire
|
|
|
|
*/
|
|
|
|
public boolean isFlammable() {
|
|
|
|
if (!isBlock()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
switch (this) {
|
|
|
|
case WOOD:
|
|
|
|
case LOG:
|
|
|
|
case LEAVES:
|
|
|
|
case NOTE_BLOCK:
|
|
|
|
case BED_BLOCK:
|
|
|
|
case LONG_GRASS:
|
|
|
|
case DEAD_BUSH:
|
|
|
|
case WOOL:
|
|
|
|
case TNT:
|
|
|
|
case BOOKSHELF:
|
|
|
|
case WOOD_STAIRS:
|
|
|
|
case CHEST:
|
|
|
|
case WORKBENCH:
|
|
|
|
case SIGN_POST:
|
|
|
|
case WOODEN_DOOR:
|
|
|
|
case WALL_SIGN:
|
|
|
|
case WOOD_PLATE:
|
|
|
|
case JUKEBOX:
|
|
|
|
case FENCE:
|
|
|
|
case TRAP_DOOR:
|
|
|
|
case HUGE_MUSHROOM_1:
|
|
|
|
case HUGE_MUSHROOM_2:
|
|
|
|
case VINE:
|
|
|
|
case FENCE_GATE:
|
|
|
|
case WOOD_DOUBLE_STEP:
|
|
|
|
case WOOD_STEP:
|
|
|
|
case SPRUCE_WOOD_STAIRS:
|
|
|
|
case BIRCH_WOOD_STAIRS:
|
|
|
|
case JUNGLE_WOOD_STAIRS:
|
2013-03-13 17:32:25 -05:00
|
|
|
case TRAPPED_CHEST:
|
|
|
|
case DAYLIGHT_DETECTOR:
|
2013-07-01 05:50:24 -05:00
|
|
|
case CARPET:
|
2013-11-13 17:53:49 -07:00
|
|
|
case LEAVES_2:
|
|
|
|
case LOG_2:
|
|
|
|
case ACACIA_STAIRS:
|
|
|
|
case DARK_OAK_STAIRS:
|
2014-11-26 08:15:59 +11:00
|
|
|
case DOUBLE_PLANT:
|
|
|
|
case SPRUCE_FENCE_GATE:
|
|
|
|
case BIRCH_FENCE_GATE:
|
|
|
|
case JUNGLE_FENCE_GATE:
|
|
|
|
case DARK_OAK_FENCE_GATE:
|
|
|
|
case ACACIA_FENCE_GATE:
|
|
|
|
case SPRUCE_FENCE:
|
|
|
|
case BIRCH_FENCE:
|
|
|
|
case JUNGLE_FENCE:
|
|
|
|
case DARK_OAK_FENCE:
|
|
|
|
case ACACIA_FENCE:
|
2015-01-25 12:09:17 +00:00
|
|
|
case STANDING_BANNER:
|
|
|
|
case WALL_BANNER:
|
|
|
|
case DAYLIGHT_DETECTOR_INVERTED:
|
|
|
|
case SPRUCE_DOOR:
|
|
|
|
case BIRCH_DOOR:
|
|
|
|
case JUNGLE_DOOR:
|
|
|
|
case ACACIA_DOOR:
|
|
|
|
case DARK_OAK_DOOR:
|
2012-12-14 02:03:05 -06:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the material is a block and can burn away
|
|
|
|
*
|
|
|
|
* @return True if this material is a block and can burn away
|
|
|
|
*/
|
|
|
|
public boolean isBurnable() {
|
|
|
|
if (!isBlock()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
switch (this) {
|
|
|
|
case WOOD:
|
|
|
|
case LOG:
|
|
|
|
case LEAVES:
|
|
|
|
case LONG_GRASS:
|
|
|
|
case WOOL:
|
2013-11-13 17:53:49 -07:00
|
|
|
case YELLOW_FLOWER:
|
|
|
|
case RED_ROSE:
|
2012-12-14 02:03:05 -06:00
|
|
|
case TNT:
|
|
|
|
case BOOKSHELF:
|
|
|
|
case WOOD_STAIRS:
|
|
|
|
case FENCE:
|
|
|
|
case VINE:
|
|
|
|
case WOOD_DOUBLE_STEP:
|
|
|
|
case WOOD_STEP:
|
|
|
|
case SPRUCE_WOOD_STAIRS:
|
|
|
|
case BIRCH_WOOD_STAIRS:
|
|
|
|
case JUNGLE_WOOD_STAIRS:
|
2013-07-01 05:50:24 -05:00
|
|
|
case HAY_BLOCK:
|
|
|
|
case COAL_BLOCK:
|
2013-11-13 17:53:49 -07:00
|
|
|
case LEAVES_2:
|
|
|
|
case LOG_2:
|
|
|
|
case CARPET:
|
|
|
|
case DOUBLE_PLANT:
|
2014-11-26 08:15:59 +11:00
|
|
|
case DEAD_BUSH:
|
|
|
|
case FENCE_GATE:
|
|
|
|
case SPRUCE_FENCE_GATE:
|
|
|
|
case BIRCH_FENCE_GATE:
|
|
|
|
case JUNGLE_FENCE_GATE:
|
|
|
|
case DARK_OAK_FENCE_GATE:
|
|
|
|
case ACACIA_FENCE_GATE:
|
|
|
|
case SPRUCE_FENCE:
|
|
|
|
case BIRCH_FENCE:
|
|
|
|
case JUNGLE_FENCE:
|
|
|
|
case DARK_OAK_FENCE:
|
|
|
|
case ACACIA_FENCE:
|
2016-03-01 08:30:03 +11:00
|
|
|
case ACACIA_STAIRS:
|
|
|
|
case DARK_OAK_STAIRS:
|
2012-12-14 02:03:05 -06:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the material is a block and completely blocks vision
|
|
|
|
*
|
|
|
|
* @return True if this material is a block and completely blocks vision
|
|
|
|
*/
|
|
|
|
public boolean isOccluding() {
|
|
|
|
if (!isBlock()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
switch (this) {
|
|
|
|
case STONE:
|
|
|
|
case GRASS:
|
|
|
|
case DIRT:
|
|
|
|
case COBBLESTONE:
|
|
|
|
case WOOD:
|
|
|
|
case BEDROCK:
|
|
|
|
case SAND:
|
|
|
|
case GRAVEL:
|
|
|
|
case GOLD_ORE:
|
|
|
|
case IRON_ORE:
|
|
|
|
case COAL_ORE:
|
|
|
|
case LOG:
|
|
|
|
case SPONGE:
|
|
|
|
case LAPIS_ORE:
|
|
|
|
case LAPIS_BLOCK:
|
|
|
|
case DISPENSER:
|
|
|
|
case SANDSTONE:
|
|
|
|
case NOTE_BLOCK:
|
|
|
|
case WOOL:
|
|
|
|
case GOLD_BLOCK:
|
|
|
|
case IRON_BLOCK:
|
|
|
|
case DOUBLE_STEP:
|
|
|
|
case BRICK:
|
|
|
|
case BOOKSHELF:
|
|
|
|
case MOSSY_COBBLESTONE:
|
|
|
|
case OBSIDIAN:
|
|
|
|
case MOB_SPAWNER:
|
|
|
|
case DIAMOND_ORE:
|
|
|
|
case DIAMOND_BLOCK:
|
|
|
|
case WORKBENCH:
|
|
|
|
case FURNACE:
|
|
|
|
case BURNING_FURNACE:
|
|
|
|
case REDSTONE_ORE:
|
|
|
|
case GLOWING_REDSTONE_ORE:
|
|
|
|
case SNOW_BLOCK:
|
|
|
|
case CLAY:
|
|
|
|
case JUKEBOX:
|
|
|
|
case PUMPKIN:
|
|
|
|
case NETHERRACK:
|
|
|
|
case SOUL_SAND:
|
|
|
|
case JACK_O_LANTERN:
|
|
|
|
case MONSTER_EGGS:
|
|
|
|
case SMOOTH_BRICK:
|
|
|
|
case HUGE_MUSHROOM_1:
|
|
|
|
case HUGE_MUSHROOM_2:
|
|
|
|
case MELON_BLOCK:
|
|
|
|
case MYCEL:
|
|
|
|
case NETHER_BRICK:
|
|
|
|
case ENDER_STONE:
|
|
|
|
case REDSTONE_LAMP_OFF:
|
|
|
|
case REDSTONE_LAMP_ON:
|
|
|
|
case WOOD_DOUBLE_STEP:
|
|
|
|
case EMERALD_ORE:
|
|
|
|
case EMERALD_BLOCK:
|
|
|
|
case COMMAND:
|
2013-03-13 17:32:25 -05:00
|
|
|
case QUARTZ_ORE:
|
|
|
|
case QUARTZ_BLOCK:
|
|
|
|
case DROPPER:
|
2013-07-01 05:50:24 -05:00
|
|
|
case STAINED_CLAY:
|
|
|
|
case HAY_BLOCK:
|
|
|
|
case HARD_CLAY:
|
|
|
|
case COAL_BLOCK:
|
2013-11-13 17:53:49 -07:00
|
|
|
case LOG_2:
|
|
|
|
case PACKED_ICE:
|
2014-11-26 08:15:59 +11:00
|
|
|
case SLIME_BLOCK:
|
|
|
|
case BARRIER:
|
|
|
|
case PRISMARINE:
|
|
|
|
case RED_SANDSTONE:
|
2015-01-25 12:09:17 +00:00
|
|
|
case DOUBLE_STONE_SLAB2:
|
2016-03-01 08:30:03 +11:00
|
|
|
case PURPUR_BLOCK:
|
|
|
|
case PURPUR_PILLAR:
|
|
|
|
case PURPUR_DOUBLE_SLAB:
|
|
|
|
case END_BRICKS:
|
|
|
|
case STRUCTURE_BLOCK:
|
|
|
|
case COMMAND_REPEATING:
|
|
|
|
case COMMAND_CHAIN:
|
2012-12-14 02:03:05 -06:00
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2013-02-14 22:40:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return True if this material is affected by gravity.
|
|
|
|
*/
|
|
|
|
public boolean hasGravity() {
|
|
|
|
if (!isBlock()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
switch (this) {
|
|
|
|
case SAND:
|
|
|
|
case GRAVEL:
|
|
|
|
case ANVIL:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2011-01-01 07:01:53 +00:00
|
|
|
}
|