当前位置: 首页>>代码示例>>Java>>正文


Java Material.SPLASH_POTION属性代码示例

本文整理汇总了Java中org.bukkit.Material.SPLASH_POTION属性的典型用法代码示例。如果您正苦于以下问题:Java Material.SPLASH_POTION属性的具体用法?Java Material.SPLASH_POTION怎么用?Java Material.SPLASH_POTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.SPLASH_POTION属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, @NotNull SkriptParser.ParseResult parseResult) {
	switch (parseResult.mark) {
		case 0:
			material = Material.POTION;
			break;
		case 1:
			material = Material.SPLASH_POTION;
			break;
		case 2:
			material = Material.LINGERING_POTION;
			break;
		case 3:
			material = Material.TIPPED_ARROW;
			break;
		default:
			material = Material.POTION;
			break;
	}
	potionEffects = (Expression<PotionEffect>) expr[0];
	return true;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:22,代码来源:ExprCustomPotionItem.java

示例2: isInteractableItem

/**
 * checks if this item is interactable
 */
public static boolean isInteractableItem(ItemStack item) {
	if (item == null || item.getType() == Material.AIR) {
		return false;
	}
	if (item.getType().isBlock()) {
		return true;
	}
	if (item.getType() == Material.REDSTONE || item.getType() == Material.WATER_BUCKET || item.getType() == Material.LAVA_BUCKET) {
		return true;
	}
	if (item.getType() == Material.MONSTER_EGG) {
		return true;
	}
	if (item.getType() == Material.EGG || item.getType() == Material.SNOW_BALL || item.getType() == Material.BOW || item.getType() == Material.ENDER_PEARL || item.getType() == Material.EYE_OF_ENDER || item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.EXP_BOTTLE || item.getType() == Material.FIREWORK_CHARGE) {
		return true;
	}
	if (item.getType().isEdible()) {
		return true;
	}
	return false;
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:24,代码来源:HitboxUtils.java

示例3: howMuchSpaceForItemAsync

@Override
public int howMuchSpaceForItemAsync(WrappedDirection insertDirection, ItemStack insertion) {
	if (!cachedChunk.isLoaded()) {
		return 0;
	}
	if (isInvLocked(cachedBrewingStand)) {
		return 0;
	}
	if (insertion.getType() == Material.POTION || insertion.getType() == Material.SPLASH_POTION || insertion.getType() == Material.LINGERING_POTION) {
		if (cachedInv.getItem(0) != null && cachedInv.getItem(1) != null && cachedInv.getItem(2) != null) {
			return 0;
		} else {
			return 1;
		}
	} else if (insertDirection.isSide() && insertion.getType() == Material.BLAZE_POWDER) {
		return howManyItemsFit(insertion, cachedInv.getFuel());
	} else if (isBrewingIngredient(insertion)) {
		return howManyItemsFit(insertion, cachedInv.getIngredient());
	} else {
		return 0;
	}
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:22,代码来源:BrewingStandContainer.java

示例4: splashPotion

public static ItemStack splashPotion(PotionType type, boolean extended, boolean upgraded, String name, String... lores) {
    ItemStack potion = new ItemStack(Material.SPLASH_POTION, 1);
    PotionMeta meta = (PotionMeta) potion.getItemMeta();
    meta.setBasePotionData(new PotionData(type, extended, upgraded));
    potion.setItemMeta(meta);
    return potion;
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:7,代码来源:GuiUtil.java

示例5: parseItem

public ItemStack parseItem(Element el, Material type, short damage) throws InvalidXMLException {
    int amount = XMLUtils.parseNumber(el.getAttribute("amount"), Integer.class, 1);

    // If the item is a potion with non-zero damage, and there is
    // no modern potion ID, decode the legacy damage value.
    final Potion legacyPotion;
    if(type == Material.POTION && damage > 0 && el.getAttribute("potion") == null) {
        try {
            legacyPotion = Potion.fromDamage(damage);
        } catch(IllegalArgumentException e) {
            throw new InvalidXMLException("Invalid legacy potion damage value " + damage + ": " + e.getMessage(), el, e);
        }

        // If the legacy splash bit is set, convert to a splash potion
        if(legacyPotion.isSplash()) {
            type = Material.SPLASH_POTION;
            legacyPotion.setSplash(false);
        }

        // Potions always have damage 0
        damage = 0;
    } else {
        legacyPotion = null;
    }

    ItemStack itemStack = new ItemStack(type, amount, damage);
    if(itemStack.getType() != type) {
        throw new InvalidXMLException("Invalid item/block", el);
    }

    final ItemMeta meta = itemStack.getItemMeta();
    if(meta != null) { // This happens if the item is "air"
        parseItemMeta(el, meta);

        // If we decoded a legacy potion, apply it now, but only if there are no custom effects.
        // This emulates the old behavior of custom effects overriding default effects.
        if(legacyPotion != null) {
            final PotionMeta potionMeta = (PotionMeta) meta;
            if(!potionMeta.hasCustomEffects()) {
                potionMeta.setBasePotionData(new PotionData(legacyPotion.getType(),
                                                            legacyPotion.hasExtendedDuration(),
                                                            legacyPotion.getLevel() == 2));
            }
        }

        itemStack.setItemMeta(meta);
    }

    return itemStack;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:50,代码来源:GlobalItemParser.java

示例6: insertItem

@Override
public ItemStack insertItem(WrappedDirection insertDirection, ItemStack insertion) {
	if (!cachedChunk.isLoaded()) {
		return insertion;
	}
	if (isInvLocked(cachedBrewingStand)) {
		return insertion;
	}
	if (insertion.getType() == Material.POTION || insertion.getType() == Material.SPLASH_POTION || insertion.getType() == Material.LINGERING_POTION) {
		if (cachedInv.getItem(0) == null) {
			cachedInv.setItem(0, insertion);
			return null;
		} else if (cachedInv.getItem(1) == null) {
			cachedInv.setItem(1, insertion);
			return null;
		} else if (cachedInv.getItem(2) == null) {
			cachedInv.setItem(2, insertion);
			return null;
		}
	} else if (insertDirection.isSide() && insertion.getType() == Material.BLAZE_POWDER) {
		ItemStack oldFuel = cachedInv.getFuel();
		cachedInv.setFuel(putItemInSlot(insertion, oldFuel));
		if (insertion == null || insertion.getAmount() == 0) {
			insertion = null;
		}
	} else if (isBrewingIngredient(insertion)) {
		ItemStack oldIngredient = cachedInv.getIngredient();
		cachedInv.setIngredient(putItemInSlot(insertion, oldIngredient));
		if (insertion == null || insertion.getAmount() == 0) {
			insertion = null;
		}
	}
	return insertion;

}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:35,代码来源:BrewingStandContainer.java

示例7: isPotionItem

public static boolean isPotionItem(@NotNull ItemStack item) {
	return (item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION
			|| item.getType() == Material.LINGERING_POTION || item.getType() == Material.TIPPED_ARROW);
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:4,代码来源:PotionUtils.java


注:本文中的org.bukkit.Material.SPLASH_POTION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。