當前位置: 首頁>>代碼示例>>Java>>正文


Java Material.LAPIS_ORE屬性代碼示例

本文整理匯總了Java中org.bukkit.Material.LAPIS_ORE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.LAPIS_ORE屬性的具體用法?Java Material.LAPIS_ORE怎麽用?Java Material.LAPIS_ORE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.LAPIS_ORE屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBlockBreak

/**
 *
 * @param e BlockBreakEvent
 * @since 4.2.0
 */
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
	List<ItemStack> drops = new ArrayList<ItemStack>();
	ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
	int fortune = 1;

	if (item != null) {
		if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS) && !item.getEnchantments().containsKey(Enchantment.SILK_TOUCH)) {
			fortune = SlimefunStartup.randomize(item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) + 2) - 1;
			if (fortune <= 0) fortune = 1;
			fortune = (e.getBlock().getType() == Material.LAPIS_ORE ? 4 + SlimefunStartup.randomize(5) : 1) * (fortune + 1);
		}

		if (!item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && e.getBlock().getType().toString().endsWith("_ORE")) {
			if (Talisman.checkFor(e, SlimefunItem.getByID("MINER_TALISMAN"))) {
				if (drops.isEmpty()) drops = (List<ItemStack>) e.getBlock().getDrops();
				for (ItemStack drop : new ArrayList<ItemStack>(drops)) {
					if (!drop.getType().isBlock()) drops.add(new CustomItem(drop, fortune * 2));
				}
			}
		}
	}
}
 
開發者ID:StarWishsama,項目名稱:Slimefun4-Chinese-Version,代碼行數:28,代碼來源:TalismanListener.java

示例2: onCommand

public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
 if (cmd.getName().equalsIgnoreCase("klotentoren")) {
  sender.sendMessage("ja hoor");
  Player p = (Player) sender;
  ArmorStand armorStand = (ArmorStand) p.getLocation().getWorld().spawn(p.getLocation(), ArmorStand.class);
  ItemStack is = new ItemStack(Material.LAPIS_ORE, 64);
  armorStand.setHelmet(is);
  armorStand.setPassenger((Entity) sender);
  armorStand.setBasePlate(false);
  ArmorStand armorStand2 = (ArmorStand) p.getLocation().getWorld().spawn(p.getLocation(), ArmorStand.class);
  armorStand2.setHelmet(is);
  armorStand2.setBasePlate(false);
  ArmorStand armorStand3 = (ArmorStand) p.getLocation().getWorld().spawn(p.getLocation(), ArmorStand.class);
  armorStand3.setHelmet(is);
  armorStand3.setBasePlate(false);
  ArmorStand armorStand4 = (ArmorStand) p.getLocation().getWorld().spawn(p.getLocation(), ArmorStand.class);
  armorStand4.setHelmet(is);
  armorStand4.setBasePlate(false);
  degree = 0;
  flyingheight = 28;
  direction = false;
  rotating = false;
  uploopcounter = 0;

  Bukkit.getScheduler().scheduleSyncRepeatingTask(main.getPL(), new Runnable() {
   @Override
   public void run() {
    if (rotating == true) {
     degree++;
     degree++;
    }
    if (degree == 360 || degree > 360) {
     degree = 0;
    }
    moveEntity(armorStand, degree + 1 * 90);
    moveEntity(armorStand2, degree + 2 * 90);
    moveEntity(armorStand3, degree + 3 * 90);
    moveEntity(armorStand4, degree + 4 * 90);
   }
  }, 0, 1);

  Bukkit.getScheduler().scheduleSyncRepeatingTask(main.getPL(), new Runnable() {
   @Override
   public void run() {
    if (flyingheight == 60) {
     direction = true;
    } else if (flyingheight == 28 || flyingheight < 35) {
     direction = false;
    }
    if (direction == true) {
     rotating = true;
     flyingheight--;
     //flyingheight--;
    } else {
     smallBittUp();
    }
   }
  }, 90, 1);
 } else {}
 return false;
}
 
開發者ID:Mindgamesnl,項目名稱:UselessCode,代碼行數:61,代碼來源:DumbDropTowerTest.java


注:本文中的org.bukkit.Material.LAPIS_ORE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。