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


Java Material.BUCKET屬性代碼示例

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


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

示例1: getSingleIngredientResult

/**
 * Get the MaterialData that vanilla crafting recipes leave in a crafting inventory if the ingredient is of stack size 1.
 * For most materials the returned data will have Material.AIR, but there are exceptions for filled buckets and dragons breath.
 * 
 * @param ingredient the material data used as a crafting ingredient.
 * @return the material data that vanilla recipes would give back upon crafting
 */
public static MaterialData getSingleIngredientResult(MaterialData ingredient) {
	if (ingredient == null) return new MaterialData(Material.AIR);
	
	switch(ingredient.getItemType()) {
		case MILK_BUCKET:
		case WATER_BUCKET:
		case LAVA_BUCKET:
			return new MaterialData(Material.BUCKET);
			
		case DRAGONS_BREATH:
			return new MaterialData(Material.GLASS_BOTTLE);
			
		default: return new MaterialData(Material.AIR);
	}
}
 
開發者ID:Jannyboy11,項目名稱:CustomRecipes,代碼行數:22,代碼來源:InventoryUtils.java

示例2: handleCategoryInventoryClick

private void handleCategoryInventoryClick(InventoryClickEvent ice,
		Game game, Player player) {
	int catSize = getCategoriesSize(player);
	int sizeCategories = getInventorySize(catSize) + 9;
	int rawSlot = ice.getRawSlot();

	if ((rawSlot >= getInventorySize(catSize))
			&& (rawSlot < sizeCategories)) {
		ice.setCancelled(true);

		if (ice.getCurrentItem().getType() == Material.BUCKET) {
			game.getPlayerSettings(player).setOneStackPerShift(false);
			player.playSound(player.getLocation(),
					SoundMachine.get("CLICK", "UI_BUTTON_CLICK"), 10.0F,
					1.0F);
			openCategoryInventory(player);
			return;
		}
		if (ice.getCurrentItem().getType() == Material.LAVA_BUCKET) {
			game.getPlayerSettings(player).setOneStackPerShift(true);
			player.playSound(player.getLocation(),
					SoundMachine.get("CLICK", "UI_BUTTON_CLICK"), 10.0F,
					1.0F);
			openCategoryInventory(player);
			return;
		}

	}

	if (rawSlot >= sizeCategories) {
		if (ice.isShiftClick()) {
			ice.setCancelled(true);
			return;
		}

		ice.setCancelled(false);
		return;
	}

	MerchantCategory clickedCategory = getCategoryByMaterial(ice
			.getCurrentItem().getType());
	if (clickedCategory == null) {
		if (ice.isShiftClick()) {
			ice.setCancelled(true);
			return;
		}

		ice.setCancelled(false);
		return;
	}

	openBuyInventory(clickedCategory, player, game);
}
 
開發者ID:Ldcr993519867,項目名稱:BedwarsXP,代碼行數:53,代碼來源:XPItemShop.java

示例3: onInteract

public void onInteract(PlayerInteractEvent e, Entity ent) {
	//e.getPlayer().sendMessage("A");
	if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
		for (Entity en : e.getPlayer().getWorld().getEntities()) {
			if (en.getCustomName() != null && en.getCustomName().equals(getName()) && en.getLocation().add(-0.5, 0, -0.5).equals(e.getClickedBlock().getLocation())) {
				
				Menu m;
				
				if (e.getPlayer().getInventory().getItemInHand().getType() == Material.TRIPWIRE_HOOK) {
					m = new Menu("Keycode2", 27);
				}
				else {
					m = new Menu("Keycode", 27);
				}
				
				ItemStack code = new ItemStack(Material.PAPER, 1);
				
				ItemMeta codem = code.getItemMeta();
				codem.setDisplayName("&f&l".replace('&', '�'));
				
				code.setItemMeta(codem);
				
				m.inv.setItem(15, code);
				
				ItemStack res = new ItemStack(Material.BUCKET, 1);
				
				ItemMeta resm = res.getItemMeta();
				resm.setDisplayName("&f&lReset".replace('&', '�'));
				
				res.setItemMeta(resm);
				
				m.inv.setItem(13, res);
				
				for (int i = 0; i < 27; i++) {
					ItemStack it = new ItemStack(Material.IRON_BLOCK, 1);
					
					
					HashMap<Integer, Integer> id = new HashMap<Integer, Integer>();
					id.put(0, 1);
					id.put(1, 2);
					id.put(2, 3);
					id.put(9, 4);
					id.put(10, 5);
					id.put(11, 6);
					id.put(18, 7);
					id.put(19, 8);
					id.put(20, 9);
					id.put(12, 0);
					if (id.containsKey(i)) {
						ItemMeta itm = it.getItemMeta();
						itm.setDisplayName(("&f&l" + String.valueOf(id.get(i))).replace('&', '�'));
						
						it.setItemMeta(itm);
						m.inv.setItem(i, it);
					}
				}
				
				
				if (plu.containsKey(e.getPlayer())) {plu.remove(e.getPlayer());}
				if (plr.containsKey(e.getPlayer())) {plr.remove(e.getPlayer());}
				if (plrs.contains(e.getPlayer())) {plrs.remove(e.getPlayer());}
				
				if (e.getPlayer().getInventory().getItemInHand().getType() == Material.TRIPWIRE_HOOK) {
					m.show(e.getPlayer());
					e.getPlayer().sendMessage(ChatColor.GREEN + "Please enter the keycode to then reset");
					plr.put(e.getPlayer(), en);
				}
				else {
					m.show(e.getPlayer());
					e.getPlayer().sendMessage(ChatColor.GREEN + "Please enter the keycode");
					plu.put(e.getPlayer(), en);
				}
				
				e.setCancelled(true);
			}
		}
	}
}
 
開發者ID:GigaGamma,項目名稱:SuperiorCraft,代碼行數:78,代碼來源:Keycode.java

示例4: isBucket

public static boolean isBucket(Material bucket) {
    return bucket == Material.BUCKET || bucket == Material.LAVA_BUCKET || bucket == Material.WATER_BUCKET || bucket == Material.MILK_BUCKET;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:3,代碼來源:Materials.java


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