当前位置: 首页>>代码示例>>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;未经允许,请勿转载。