Java Code Examples for org.bukkit.Material#WHEAT
The following examples show how to use
org.bukkit.Material#WHEAT .
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: EntityListener.java From BedwarsRel with GNU General Public License v3.0 | 6 votes |
@EventHandler public void onEntityInteract(EntityInteractEvent event) { if (!(event.getEntity() instanceof Player)) { return; } if (event.getBlock().getType() != Material.SOIL && event.getBlock().getType() != Material.WHEAT) { return; } Player player = (Player) event.getEntity(); Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player); if (game == null) { return; } if (game.getState() == GameState.WAITING) { event.setCancelled(true); } }
Example 2
Source File: FarmerAndroid.java From Slimefun4 with GNU General Public License v3.0 | 6 votes |
private ItemStack getDropFromCrop(Material crop) { Random random = ThreadLocalRandom.current(); if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) && crop == Material.SWEET_BERRY_BUSH) { return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1); } switch (crop) { case WHEAT: return new ItemStack(Material.WHEAT, random.nextInt(2) + 1); case POTATOES: return new ItemStack(Material.POTATO, random.nextInt(3) + 1); case CARROTS: return new ItemStack(Material.CARROT, random.nextInt(3) + 1); case BEETROOTS: return new ItemStack(Material.BEETROOT, random.nextInt(3) + 1); case COCOA: return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1); case NETHER_WART: return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1); default: return null; } }
Example 3
Source File: ControllableCowBase.java From EntityAPI with GNU Lesser General Public License v3.0 | 5 votes |
@Override public BehaviourItem[] getDefaultMovementBehaviours() { return new BehaviourItem[]{ new BehaviourItem(0, new BehaviourFloat(this)), new BehaviourItem(1, new BehaviourPanic(this, 2.0D)), new BehaviourItem(2, new BehaviourBreed(this, 1.0D)), new BehaviourItem(3, new BehaviourTempt(this, Material.WHEAT, false, 1.25D)), new BehaviourItem(4, new BehaviourFollowParent(this, 1.25D)), new BehaviourItem(5, new BehaviourRandomStroll(this, 1.0D)), new BehaviourItem(6, new BehaviourLookAtNearestEntity(this, HumanEntity.class, 6.0F)), new BehaviourItem(7, new BehaviourLookAtRandom(this)) }; }
Example 4
Source File: ControllableMushroomCowBase.java From EntityAPI with GNU Lesser General Public License v3.0 | 5 votes |
@Override public BehaviourItem[] getDefaultMovementBehaviours() { return new BehaviourItem[]{ new BehaviourItem(0, new BehaviourFloat(this)), new BehaviourItem(1, new BehaviourPanic(this, 2.0D)), new BehaviourItem(2, new BehaviourBreed(this, 1.0D)), new BehaviourItem(3, new BehaviourTempt(this, Material.WHEAT, false, 1.25D)), new BehaviourItem(4, new BehaviourFollowParent(this, 1.25D)), new BehaviourItem(5, new BehaviourRandomStroll(this, 1.0D)), new BehaviourItem(6, new BehaviourLookAtNearestEntity(this, HumanEntity.class, 6.0F)), new BehaviourItem(7, new BehaviourLookAtRandom(this)) }; }
Example 5
Source File: ControllableSheepBase.java From EntityAPI with GNU Lesser General Public License v3.0 | 5 votes |
@Override public BehaviourItem[] getDefaultMovementBehaviours() { return new BehaviourItem[]{ new BehaviourItem(0, new BehaviourFloat(this)), new BehaviourItem(1, new BehaviourPanic(this, 1.25D)), new BehaviourItem(2, new BehaviourBreed(this, 1.0D)), new BehaviourItem(3, new BehaviourTempt(this, Material.WHEAT, false, 1.1D)), new BehaviourItem(4, new BehaviourFollowParent(this, 1.1D)), new BehaviourItem(5, new BehaviourEatGrass(this)), new BehaviourItem(6, new BehaviourRandomStroll(this, 1.0D)), new BehaviourItem(7, new BehaviourLookAtNearestEntity(this, HumanEntity.class, 6.0F)), new BehaviourItem(8, new BehaviourLookAtRandom(this)) }; }
Example 6
Source File: XBlock.java From IridiumSkyblock with GNU General Public License v2.0 | 4 votes |
public static boolean isWheat(Material material) { return XMaterial.ISFLAT ? material == Material.WHEAT : material.name().equals("CROPS"); }
Example 7
Source File: XBlock.java From XSeries with MIT License | 4 votes |
public static boolean isWheat(Material material) { return ISFLAT ? material == Material.WHEAT : material.name().equals("CROPS"); }
Example 8
Source File: BukkitCompat.java From StackMob-3 with GNU General Public License v3.0 | 4 votes |
@Override public boolean checkFood(Entity entity, ItemStack food) { Material type = food.getType(); switch (entity.getType()) { case COW: case SHEEP: case MUSHROOM_COW: return type == Material.WHEAT; case PIG: return (type == Material.CARROT || type == Material.BEETROOT || type == Material.POTATO); case CHICKEN: return type == Material.WHEAT_SEEDS || type == Material.MELON_SEEDS || type == Material.BEETROOT_SEEDS || type == Material.PUMPKIN_SEEDS; case HORSE: return (type == Material.GOLDEN_APPLE || type == Material.GOLDEN_CARROT) && ((Horse)entity).isTamed(); case WOLF: return (type == Material.BEEF || type == Material.CHICKEN || type == Material.COD || type == Material.MUTTON || type == Material.PORKCHOP || type == Material.RABBIT || type == Material.SALMON || type == Material.COOKED_BEEF || type == Material.COOKED_CHICKEN || type == Material.COOKED_COD || type == Material.COOKED_MUTTON || type == Material.COOKED_PORKCHOP || type == Material.COOKED_RABBIT || type == Material.COOKED_SALMON) && ((Wolf) entity).isTamed(); case OCELOT: return (type == Material.SALMON || type == Material.COD || type == Material.PUFFERFISH || type == Material.TROPICAL_FISH) && ((Ocelot) entity).isTamed(); case RABBIT: return type == Material.CARROT || type == Material.GOLDEN_CARROT || type == Material.DANDELION; case LLAMA: return type == Material.HAY_BLOCK; case TURTLE: return type == Material.SEAGRASS; } return false; }
Example 9
Source File: BukkitCompat.java From StackMob-3 with GNU General Public License v3.0 | 4 votes |
@Override public boolean checkFood(Entity entity, ItemStack food) { Material type = food.getType(); switch (entity.getType()) { case COW: case SHEEP: case MUSHROOM_COW: return type == Material.WHEAT; case PIG: return (type == Material.CARROT || type == Material.BEETROOT || type == Material.POTATO); case CHICKEN: return type == Material.WHEAT_SEEDS || type == Material.MELON_SEEDS || type == Material.BEETROOT_SEEDS || type == Material.PUMPKIN_SEEDS; case HORSE: return (type == Material.GOLDEN_APPLE || type == Material.GOLDEN_CARROT) && ((Horse)entity).isTamed(); case WOLF: return (type == Material.BEEF || type == Material.CHICKEN || type == Material.COD || type == Material.MUTTON || type == Material.PORKCHOP || type == Material.RABBIT || type == Material.SALMON || type == Material.COOKED_BEEF || type == Material.COOKED_CHICKEN || type == Material.COOKED_COD || type == Material.COOKED_MUTTON || type == Material.COOKED_PORKCHOP || type == Material.COOKED_RABBIT || type == Material.COOKED_SALMON) && ((Wolf) entity).isTamed(); case OCELOT: return (type == Material.SALMON || type == Material.COD || type == Material.PUFFERFISH || type == Material.TROPICAL_FISH); case RABBIT: return type == Material.CARROT || type == Material.GOLDEN_CARROT || type == Material.DANDELION; case LLAMA: return type == Material.HAY_BLOCK; case TURTLE: return type == Material.SEAGRASS; case PANDA: return type == Material.BAMBOO; case FOX: return type == Material.SWEET_BERRIES; case CAT: return (type == Material.COD || type == Material.SALMON) && ((Cat) entity).isTamed(); } return false; }