Java Code Examples for org.bukkit.Material#CRAFTING_TABLE

The following examples show how to use org.bukkit.Material#CRAFTING_TABLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NMSHandler.java    From SkyWarsReloaded with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ItemStack getMaterial(String item) {
	if (item.equalsIgnoreCase("SKULL_ITEM")) {
		return new ItemStack(Material.SKELETON_SKULL, 1);
	} else if (item.equalsIgnoreCase("ENDER_PORTAL_FRAME")) {
		return new ItemStack(Material.END_PORTAL_FRAME, 1);
	} else if (item.equalsIgnoreCase("WORKBENCH")) {
		return new ItemStack(Material.CRAFTING_TABLE, 1);
	} else if (item.equalsIgnoreCase("IRON_FENCE")) {
		return new ItemStack(Material.IRON_BARS, 1);
	} else if (item.equalsIgnoreCase("REDSTONE_COMPARATOR")) {
		return new ItemStack(Material.COMPARATOR);
	} else if (item.equalsIgnoreCase("SIGN_POST")) {
		return new ItemStack(Material.SIGN);
	} else if (item.equalsIgnoreCase("STONE_PLATE")) {
		return new ItemStack(Material.STONE_PRESSURE_PLATE);
	} else if (item.equalsIgnoreCase("IRON_PLATE")) {
		return new ItemStack(Material.HEAVY_WEIGHTED_PRESSURE_PLATE);
	} else if (item.equalsIgnoreCase("GOLD_PLATE")) {
		return new ItemStack(Material.LIGHT_WEIGHTED_PRESSURE_PLATE);
	} else if (item.equalsIgnoreCase("MOB_SPAWNER")) {
		return new ItemStack(Material.SPAWNER);
	} else if (item.equalsIgnoreCase("SNOW_BALL")) {
		return new ItemStack(Material.SNOWBALL);
	} else {
		return new ItemStack(Material.AIR, 1);
	}
}
 
Example 2
Source File: TestMultiBlocks.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testEqual() {
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "MULTIBLOCK_TEST", new CustomItem(Material.BRICK, "&5Multiblock Test"));

    MultiBlock multiblock = new MultiBlock(item, new Material[] { Material.BIRCH_WOOD, Material.BIRCH_WOOD, Material.BIRCH_WOOD, null, Material.CRAFTING_TABLE, null, Material.BIRCH_WOOD, Material.DISPENSER, Material.BIRCH_WOOD }, BlockFace.DOWN);
    MultiBlock multiblock2 = new MultiBlock(item, new Material[] { Material.BIRCH_WOOD, Material.BIRCH_WOOD, Material.BIRCH_WOOD, null, Material.CRAFTING_TABLE, null, Material.BIRCH_WOOD, Material.DISPENSER, Material.BIRCH_WOOD }, BlockFace.DOWN);

    Assertions.assertTrue(multiblock.equals(multiblock2));
}
 
Example 3
Source File: TestMultiBlocks.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testEqualWithTags() {
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "MULTIBLOCK_TEST", new CustomItem(Material.BRICK, "&5Multiblock Test"));

    // The wooden fences are different but the structure should still match.
    MultiBlock multiblock = new MultiBlock(item, new Material[] { Material.OAK_FENCE, Material.OAK_FENCE, Material.OAK_FENCE, null, Material.CRAFTING_TABLE, null, Material.BIRCH_WOOD, Material.DISPENSER, Material.BIRCH_WOOD }, BlockFace.DOWN);
    MultiBlock multiblock2 = new MultiBlock(item, new Material[] { Material.BIRCH_FENCE, Material.BIRCH_FENCE, Material.BIRCH_FENCE, null, Material.CRAFTING_TABLE, null, Material.BIRCH_WOOD, Material.DISPENSER, Material.BIRCH_WOOD }, BlockFace.DOWN);

    Assertions.assertTrue(multiblock.equals(multiblock2));
}
 
Example 4
Source File: TestMultiBlocks.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testEqualWithMovingPistons() {
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "PISTON_MULTIBLOCK_TEST", new CustomItem(Material.BRICK, "&5Multiblock Test"));

    // Some Pistons are moving but that should not interefere with the Multiblock
    MultiBlock multiblock = new MultiBlock(item, new Material[] { Material.PISTON, Material.MOVING_PISTON, Material.PISTON, null, Material.CRAFTING_TABLE, null, Material.PISTON, Material.STONE, Material.PISTON }, BlockFace.DOWN);
    MultiBlock multiblock2 = new MultiBlock(item, new Material[] { Material.MOVING_PISTON, Material.PISTON, Material.MOVING_PISTON, null, Material.CRAFTING_TABLE, null, Material.PISTON, Material.STONE, Material.PISTON }, BlockFace.DOWN);
    MultiBlock multiblock3 = new MultiBlock(item, new Material[] { Material.PISTON, Material.PISTON, Material.STICKY_PISTON, null, Material.CRAFTING_TABLE, null, Material.PISTON, Material.STONE, Material.PISTON }, BlockFace.DOWN);

    Assertions.assertTrue(multiblock.equals(multiblock2));
    Assertions.assertFalse(multiblock.equals(multiblock3));
}
 
Example 5
Source File: TestMultiBlocks.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testNotEqual() {
    SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "MULTIBLOCK_TEST", new CustomItem(Material.BRICK, "&5Multiblock Test"));

    MultiBlock multiblock = new MultiBlock(item, new Material[] { Material.BIRCH_WOOD, Material.BIRCH_WOOD, Material.BIRCH_WOOD, null, Material.CRAFTING_TABLE, null, Material.BIRCH_WOOD, Material.DISPENSER, Material.BIRCH_WOOD }, BlockFace.DOWN);
    MultiBlock multiblock2 = new MultiBlock(item, new Material[] { Material.BIRCH_WOOD, Material.BIRCH_WOOD, Material.BIRCH_WOOD, null, Material.EMERALD_BLOCK, null, Material.BIRCH_WOOD, Material.DISPENSER, Material.BIRCH_WOOD }, BlockFace.DOWN);
    MultiBlock multiblock3 = new MultiBlock(item, new Material[] { Material.DROPPER, Material.BIRCH_WOOD, Material.BIRCH_WOOD, null, Material.DIAMOND_BLOCK, null, Material.BIRCH_WOOD, Material.DISPENSER, Material.TNT }, BlockFace.DOWN);
    MultiBlock multiblock4 = new MultiBlock(item, new Material[] { Material.BIRCH_WOOD, Material.BIRCH_WOOD, Material.BIRCH_WOOD, null, Material.CRAFTING_TABLE, null, Material.BIRCH_WOOD, Material.DISPENSER, Material.BIRCH_WOOD }, BlockFace.SELF);

    Assertions.assertFalse(multiblock.equals(null));
    Assertions.assertFalse(multiblock.equals(multiblock2));
    Assertions.assertFalse(multiblock.equals(multiblock3));
    Assertions.assertFalse(multiblock.equals(multiblock4));
}
 
Example 6
Source File: BlockListener.java    From MineTinker with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onClick(PlayerInteractEvent event) {
	Player player = event.getPlayer();

	ItemStack norm = null;
	if (event.getHand() == EquipmentSlot.HAND) {
		norm = player.getInventory().getItemInMainHand();
	} else if (event.getHand() == EquipmentSlot.OFF_HAND) {
		norm = player.getInventory().getItemInOffHand();
	}

	if (norm == null) return;

	if (event.getAction() == Action.RIGHT_CLICK_AIR) {
		if (modManager.isModifierItem(norm)) {
			event.setCancelled(true);
		}
	} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
		Block block = event.getClickedBlock();

		if (block == null) {
			return;
		}
		if (!player.isSneaking()) {
			Material type = block.getType();

			if (type == Material.ANVIL || type == Material.CRAFTING_TABLE
					|| type == Material.CHEST || type == Material.ENDER_CHEST
					|| type == Material.DROPPER || type == Material.HOPPER
					|| type == Material.DISPENSER || type == Material.TRAPPED_CHEST
					|| type == Material.FURNACE || type == Material.ENCHANTING_TABLE) {

				return;
			}
		}

		if (modManager.isModifierItem(norm)) {
			event.setCancelled(true);
			return;
		}

		if (block.getType() == Material.getMaterial(MineTinker.getPlugin().getConfig().getString("BlockToEnchantModifiers", Material.BOOKSHELF.name()))) {
			ItemStack item = player.getInventory().getItemInMainHand();

			for (Modifier m : modManager.getAllMods()) {
				if (m.getModItem().getType().equals(item.getType())) {
					if (!m.isEnchantable()) continue;
					m.enchantItem(player);
					event.setCancelled(true);
					break;
				}
			}
		}
	}
}
 
Example 7
Source File: CraftingPipe.java    From Transport-Pipes with MIT License 4 votes vote down vote up
@Override
public Material getBreakParticleData() {
    return Material.CRAFTING_TABLE;
}
 
Example 8
Source File: Kitchen.java    From ExoticGarden with GNU General Public License v3.0 4 votes vote down vote up
public Kitchen(ExoticGarden plugin, Category category) {
    super(category, new SlimefunItemStack("KITCHEN", Material.CAULDRON, "&eKitchen", "", "&a&oYou can make a bunch of different yummies here!", "&a&oThe result goes in the Furnace output slot"), new ItemStack[] { new CustomItem(Material.BRICK_STAIRS, "&oBrick Stairs (upside down)"), new CustomItem(Material.BRICK_STAIRS, "&oBrick Stairs (upside down)"), new ItemStack(Material.BRICKS), new ItemStack(Material.STONE_PRESSURE_PLATE), new ItemStack(Material.IRON_TRAPDOOR), new ItemStack(Material.BOOKSHELF), new ItemStack(Material.FURNACE), new ItemStack(Material.DISPENSER), new ItemStack(Material.CRAFTING_TABLE) }, new ItemStack[0], BlockFace.SELF);

    this.plugin = plugin;
}
 
Example 9
Source File: EnhancedCraftingTable.java    From Slimefun4 with GNU General Public License v3.0 4 votes vote down vote up
public EnhancedCraftingTable(Category category, SlimefunItemStack item) {
    super(category, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.CRAFTING_TABLE), null, null, new ItemStack(Material.DISPENSER), null }, new ItemStack[0], BlockFace.SELF);
}
 
Example 10
Source File: MagicWorkbench.java    From Slimefun4 with GNU General Public License v3.0 4 votes vote down vote up
public MagicWorkbench(Category category, SlimefunItemStack item) {
    super(category, item, new ItemStack[] { null, null, null, null, null, null, new ItemStack(Material.BOOKSHELF), new ItemStack(Material.CRAFTING_TABLE), new ItemStack(Material.DISPENSER) }, new ItemStack[0], BlockFace.UP);
}