/** * Gets the Material that we are trying to place. * * @return The Material that we are trying to place */ public Material getMaterial() { return Material.getMaterial(material); }
/** * Gets the Material that this MaterialData represents * * @return Material represented by this MaterialData */ public Material getItemType() { return Material.getMaterial(type); }
/** * Gets the type of block that changed, causing this event * * @return Changed block's type */ public Material getChangedType() { return Material.getMaterial(changed); }
private static Material getType0(int id) { Material material = Material.getMaterial(id); return material == null ? Material.AIR : material; }
@Override public final Material getType() { return Material.getMaterial(typeId); }
/** * Get the Material corresponding to the specified item identifier. * * @param name the identifier. * @return the Material, or null. */ public static Material getItem(String name) { if (!items.containsKey(name)) { return null; } return Material.getMaterial(items.get(name)); }
/** * Get the Material corresponding to the specified block identifier. * * @param name the identifier. * @return the Material, or null. */ public static Material getBlock(String name) { if (!blocks.containsKey(name)) { return null; } return Material.getMaterial(blocks.get(name)); }
@Override public FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData) throws IllegalArgumentException { Material material = Material.getMaterial(blockId); return spawnFallingBlock(location, material, blockData); }
@Deprecated public ItemType getItem(int id) { return getItem(Material.getMaterial(id)); }
@Override public Material getType(int x, int y, int z) { return Material.getMaterial(getTypeId(x, y, z)); }
@Override public Material getBlockType(int x, int y, int z) { return Material.getMaterial(getBlockTypeId(x, y, z)); }
@Deprecated public BlockType getBlock(int id) { return getBlock(Material.getMaterial(id)); }
@Override public Material getType() { return Material.getMaterial(getTypeIdNoCache()); }
/** * Create a Bukkit Material form a WorldEdit ItemType * * @param itemType The WorldEdit ItemType * @return The Bukkit Material */ public static Material adapt(ItemType itemType) { checkNotNull(itemType); if (!itemType.getId().startsWith("minecraft:")) { throw new IllegalArgumentException("Bukkit only supports Minecraft items"); } return Material.getMaterial(itemType.getId().substring(10).toUpperCase()); }
/** * Create a Bukkit Material form a WorldEdit BlockType * * @param blockType The WorldEdit BlockType * @return The Bukkit Material */ public static Material adapt(BlockType blockType) { checkNotNull(blockType); if (!blockType.getId().startsWith("minecraft:")) { throw new IllegalArgumentException("Bukkit only supports Minecraft blocks"); } return Material.getMaterial(blockType.getId().substring(10).toUpperCase()); }
private void createData(final byte data) { Material mat = Material.getMaterial(type); if (mat == null) { this.data = new MaterialData(type, data); } else { this.data = mat.getNewData(data); } }
private void makeData(byte data) { Material mat = Material.getMaterial(typeId); if (mat == null) { this.data = new MaterialData(typeId, data); } else { this.data = mat.getNewData(data); } }
@Override public String toString() { return Material.getMaterial(getItemTypeId()).toString() + (isStem() ? "{STEM}" : getPaintedFaces()); }
@Override public boolean canPlaceAt(GlowPlayer player, GlowBlock block, BlockFace against) { int typeIdBelow = block.getWorld() .getBlockTypeIdAt(block.getX(), block.getY() - 1, block.getZ()); Material typeBelow = Material.getMaterial(typeIdBelow); return typeBelow == Material.GRASS || typeBelow == Material.DIRT || typeBelow == Material.SOIL; }
@Override public boolean canPlaceAt(GlowPlayer player, GlowBlock block, BlockFace against) { int typeIdBelow = block.getWorld() .getBlockTypeIdAt(block.getX(), block.getY() - 1, block.getZ()); Material typeBelow = Material.getMaterial(typeIdBelow); return typeBelow == Material.GRASS || typeBelow == Material.DIRT || typeBelow == Material.SOIL; }