Java Code Examples for org.bukkit.Material#SAND

The following examples show how to use org.bukkit.Material#SAND . 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: 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 2
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 3
Source File: SurgarCanePopulator.java    From UhcCore with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void populate(World world, Random random, Chunk chunk){
    for (int x = 1; x < 15; x++) {
        for (int z = 1; z < 15; z++) {
            Block block = world.getHighestBlockAt(chunk.getBlock(x, 0, z).getLocation());
            Block below = block.getRelative(BlockFace.DOWN);

            if (percentage > random.nextInt(100) && (below.getType() == Material.SAND || below.getType() == Material.GRASS)){

                Material water = UniversalMaterial.STATIONARY_WATER.getType();
                if (
                        below.getRelative(BlockFace.NORTH).getType() == water ||
                        below.getRelative(BlockFace.EAST).getType() == water ||
                        below.getRelative(BlockFace.SOUTH).getType() == water ||
                        below.getRelative(BlockFace.WEST).getType() == water
                ){
                    if (block.getType() == Material.AIR){
                        int height = random.nextInt(3)+1;
                        Location location = block.getLocation();
                        while (height > 0){
                            world.getBlockAt(location).setType(UniversalMaterial.SUGAR_CANE_BLOCK.getType());
                            location = location.add(0, 1, 0);
                            height--;
                        }
                    }
                }
            }
        }
    }
}
 
Example 4
Source File: TreePopulator.java    From GiantTrees with GNU General Public License v3.0 5 votes vote down vote up
int getHighestSoil(Block highestBlock) {
  while ((highestBlock.getY() > 0)
         && (highestBlock.getType() != Material.DIRT)
         && // Includes podzol
         (highestBlock.getType() != Material.GRASS)
         && (highestBlock.getType() != Material.MYCELIUM)
         && (highestBlock.getType() != Material.SAND)) {
    highestBlock = highestBlock.getRelative(BlockFace.DOWN);
  }
  return highestBlock.getY();
}
 
Example 5
Source File: CreateTreeCommand.java    From GiantTrees with GNU General Public License v3.0 5 votes vote down vote up
Block getHighestSoil(Block highestBlock) {
  while ((highestBlock.getY() > 0)
         && (highestBlock.getType() != Material.DIRT)
         && // Includes podzol
         (highestBlock.getType() != Material.GRASS)
         && (highestBlock.getType() != Material.MYCELIUM)
         && (highestBlock.getType() != Material.SAND)) {
    highestBlock = highestBlock.getRelative(BlockFace.DOWN);
  }
  return highestBlock;
}
 
Example 6
Source File: ItemEntryTest.java    From LanguageUtils with MIT License 4 votes vote down vote up
@Test
public void testEquals() throws Exception {
    //Same Material
    ItemEntry equalEntry1 = new ItemEntry(Material.STONE);
    ItemEntry equalEntry2 = new ItemEntry(Material.STONE);

    assertThat(equalEntry1, is(equalEntry2));
    assertThat(equalEntry1.hashCode(), is(equalEntry2.hashCode()));

    //Same Material + metadata
    ItemEntry equalEntry3 = new ItemEntry(Material.STONE, 2);
    ItemEntry equalEntry4 = new ItemEntry(Material.STONE, 2);

    assertThat(equalEntry3, is(equalEntry4));
    assertThat(equalEntry3.hashCode(), is(equalEntry4.hashCode()));

    //Different Material
    ItemEntry diffEntry1 = new ItemEntry(Material.STONE);
    ItemEntry diffEntry2 = new ItemEntry(Material.ANVIL);

    assertThat(diffEntry1, not(diffEntry2));
    assertThat(diffEntry1.hashCode(), not(diffEntry2.hashCode()));

    //Different metadata
    ItemEntry diffEntry3 = new ItemEntry(Material.STONE, 4);
    ItemEntry diffEntry4 = new ItemEntry(Material.STONE, 7);

    assertThat(diffEntry3, not(diffEntry4));
    assertThat(diffEntry3.hashCode(), not(diffEntry4.hashCode()));

    //Different Material + metadata
    ItemEntry diffEntry5 = new ItemEntry(Material.STONE, 4);
    ItemEntry diffEntry6 = new ItemEntry(Material.SAND, 2);

    assertThat(diffEntry5, not(diffEntry6));
    assertThat(diffEntry5.hashCode(), not(diffEntry6.hashCode()));


    //HashMap Test
    Map<ItemEntry, EnumItem> testMap = new HashMap<ItemEntry, EnumItem>();

    testMap.put(equalEntry1, EnumItem.STONE);
    assertTrue(testMap.containsKey(equalEntry1));

    testMap.put(equalEntry3, EnumItem.POLISHED_GRANITE);
    assertTrue(testMap.containsKey(equalEntry4));

    assertFalse(testMap.containsKey(diffEntry2));
    assertFalse(testMap.containsKey(diffEntry3));
    assertFalse(testMap.containsKey(diffEntry6));
}
 
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);
}