Java Code Examples for org.bukkit.Material#GRAVEL

The following examples show how to use org.bukkit.Material#GRAVEL . 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: ItemsTests.java    From Civs with GNU General Public License v3.0 6 votes vote down vote up
@Test
public void cvInventoryAddItemsShouldAddToCorrectIndexes() {
    TestUtil.world.setChunkLoaded(false);
    CVInventory cvInventory = new CVInventory(new Location(TestUtil.world, 0, 0, 0));
    ItemStack[] itemStacks = {
            new ItemStack(Material.COBBLESTONE, 64),
            new ItemStack(Material.COBBLESTONE, 32),
            new ItemStack(Material.GRAVEL, 4)
    };
    cvInventory.addItem(itemStacks);
    assertEquals(Material.GRAVEL, cvInventory.getItem(2).getType());
    ItemStack[] itemStack2 = { new ItemStack(Material.COBBLESTONE, 4) };
    cvInventory.addItem(itemStack2);
    assertNull(cvInventory.getItem(3));
    assertEquals(36, cvInventory.getItem(1).getAmount());
    ItemStack[] itemStack3 = { new ItemStack(Material.COBBLESTONE, 64) };
    cvInventory.addItem(itemStack3);
    assertEquals(64, cvInventory.getItem(1).getAmount());
    assertEquals(36, cvInventory.getItem(3).getAmount());
    cvInventory.removeItem(itemStack2);
    assertEquals(60, cvInventory.getItem(0).getAmount());
}
 
Example 2
Source File: Miner.java    From AnnihilationPro with MIT License 6 votes vote down vote up
@AnnihilationEvent
public void onResourceBreak(ResourceBreakEvent event)
{
	if(event.getPlayer().getKit().equals(this))
	{
		if(event.getResource().Type != Material.LOG && event.getResource().Type != Material.MELON_BLOCK && event.getResource().Type != Material.GRAVEL)
		{
			ItemStack[] products = event.getProducts();
			if(products != null)
			{
				for(int x = 0; x < products.length; x++)
				{
					boolean y = rand.nextBoolean();
					if(y)
						products[x].setAmount(products[x].getAmount()*2);
				}
			}
			event.setProducts(products);	
		}
	}
}
 
Example 3
Source File: GrindStone.java    From Slimefun4 with GNU General Public License v3.0 6 votes vote down vote up
public GrindStone(Category category, SlimefunItemStack item) {
       super(category, item, 
			new ItemStack[] {null, null, null, null, new ItemStack(Material.OAK_FENCE), null, null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null},
			new ItemStack[] {
					new ItemStack(Material.BLAZE_ROD), new ItemStack(Material.BLAZE_POWDER, 4), 
					new ItemStack(Material.BONE), new ItemStack(Material.BONE_MEAL, 4), 
					new ItemStack(Material.GRAVEL), new ItemStack(Material.FLINT), 
					new ItemStack(Material.ENDER_EYE), new CustomItem(SlimefunItems.ENDER_LUMP_1, 2), 
					new ItemStack(Material.COBBLESTONE), new ItemStack(Material.GRAVEL), 
					new ItemStack(Material.ANDESITE), new ItemStack(Material.GRAVEL),
					new ItemStack(Material.DIORITE), new ItemStack(Material.GRAVEL),
					new ItemStack(Material.GRANITE), new ItemStack(Material.GRAVEL),
					new ItemStack(Material.DIRT), SlimefunItems.STONE_CHUNK, 
					new ItemStack(Material.SANDSTONE), new ItemStack(Material.SAND, 4), 
					new ItemStack(Material.RED_SANDSTONE), new ItemStack(Material.RED_SAND, 4),
					new ItemStack(Material.PRISMARINE_BRICKS), new ItemStack(Material.PRISMARINE, 2),
					new ItemStack(Material.PRISMARINE), new ItemStack(Material.PRISMARINE_SHARD, 4)
			},
			BlockFace.SELF
	);
}
 
Example 4
Source File: ChunkGenerator.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Tests if the specified location is valid for a natural spawn position
 *
 * @param world The world we're testing on
 * @param x     X-coordinate of the block to test
 * @param z     Z-coordinate of the block to test
 * @return true if the location is valid, otherwise false
 */
public boolean canSpawn(World world, int x, int z) {
    Block highest = world.getBlockAt(x, world.getHighestBlockYAt(x, z), z);

    switch (world.getEnvironment()) {
        case NETHER:
            return true;
        case THE_END:
            return highest.getType() != Material.AIR && highest.getType() != Material.WATER && highest.getType() != Material.LAVA;
        case NORMAL:
        default:
            return highest.getType() == Material.SAND || highest.getType() == Material.GRAVEL;
    }
}
 
Example 5
Source File: ItemsTests.java    From Civs with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void cvInventoryCheckItemsShouldNotAdd() {
    TestUtil.world.setChunkLoaded(false);
    CVInventory cvInventory = new CVInventory(new Location(TestUtil.world, 0, 0, 0));
    ItemStack[] itemStacks = {
            new ItemStack(Material.COBBLESTONE, 64),
            new ItemStack(Material.COBBLESTONE, 32),
            new ItemStack(Material.GRAVEL, 4)
    };
    Map<Integer, ItemStack> returnedItems = cvInventory.checkAddItems(itemStacks);
    assertNull(cvInventory.getItem(0));
    assertTrue(returnedItems.isEmpty());
}
 
Example 6
Source File: AutomatedPanningMachine.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onInteract(Player p, Block b) {
    ItemStack input = p.getInventory().getItemInMainHand();

    if (SlimefunUtils.isItemSimilar(input, new ItemStack(Material.GRAVEL), true) || SlimefunUtils.isItemSimilar(input, new ItemStack(Material.SOUL_SAND), true)) {
        Material material = input.getType();

        if (p.getGameMode() != GameMode.CREATIVE) {
            ItemUtils.consumeItem(input, false);
        }

        ItemStack output = material == Material.GRAVEL ? goldPan.getRandomOutput() : netherGoldPan.getRandomOutput();
        TaskQueue queue = new TaskQueue();

        queue.thenRepeatEvery(20, 5, () -> b.getWorld().playEffect(b.getRelative(BlockFace.DOWN).getLocation(), Effect.STEP_SOUND, material));

        queue.thenRun(20, () -> {
            if (output.getType() != Material.AIR) {
                Inventory outputChest = findOutputChest(b.getRelative(BlockFace.DOWN), output);

                if (outputChest != null) {
                    outputChest.addItem(output.clone());
                }
                else {
                    b.getWorld().dropItemNaturally(b.getLocation(), output.clone());
                }

                p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
            }
            else {
                p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARMOR_STAND_BREAK, 1F, 1F);
            }
        });

        queue.execute(SlimefunPlugin.instance);
    }
    else {
        SlimefunPlugin.getLocalization().sendMessage(p, "machines.wrong-item", true);
    }
}
 
Example 7
Source File: OreCrusher.java    From Slimefun4 with GNU General Public License v3.0 4 votes vote down vote up
public OreCrusher(Category category, SlimefunItemStack item) {
    super(category, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.IRON_BARS), new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.IRON_BARS) }, new ItemStack[] { new ItemStack(Material.COBBLESTONE, 8), new ItemStack(Material.SAND, 1), SlimefunItems.GOLD_4K, SlimefunItems.GOLD_DUST, new ItemStack(Material.GRAVEL), new ItemStack(Material.SAND), new ItemStack(Material.MAGMA_BLOCK, 4), SlimefunItems.SULFATE }, BlockFace.SELF);

    addItemSetting(doubleOres);
}
 
Example 8
Source File: GoldPan.java    From Slimefun4 with GNU General Public License v3.0 4 votes vote down vote up
protected Material getInput() {
    return Material.GRAVEL;
}