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


Java PotionType.UNCRAFTABLE屬性代碼示例

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


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

示例1: toBukkit

public static PotionData toBukkit(String type) {
    if (type == null) {
        return new PotionData(PotionType.UNCRAFTABLE, false, false);
    }
    if (type.startsWith("minecraft:")) {
        type = type.substring(10);
    }
    PotionType potionType = null;
    potionType = extendable.inverse().get(type);
    if (potionType != null) {
        return new PotionData(potionType, true, false);
    }
    potionType = upgradeable.inverse().get(type);
    if (potionType != null) {
        return new PotionData(potionType, false, true);
    }
    potionType = regular.inverse().get(type);
    if (potionType != null) {
        return new PotionData(potionType, false, false);
    }
    return new PotionData(PotionType.UNCRAFTABLE, false, false);
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:22,代碼來源:CraftPotionUtil.java

示例2: actualPotionEffects

public static PotionEffect[] actualPotionEffects(@NotNull PotionMeta meta) {
	List<PotionEffect> effects = new ArrayList<>();
	effects.addAll(meta.getCustomEffects());
	if (meta.getBasePotionData().getType() != PotionType.UNCRAFTABLE) {
		effects.add(fromPotionData(meta.getBasePotionData()));
	}
	return effects.toArray(new PotionEffect[effects.size()]);
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:8,代碼來源:PotionUtils.java

示例3: applyHash

@Override
int applyHash() {
    final int original;
    int hash = original = super.applyHash();
    if (type.getType() != PotionType.UNCRAFTABLE) {
    	hash = 73 * hash + type.hashCode();
    }
    if (hasCustomEffects()) {
        hash = 73 * hash + customEffects.hashCode();
    }
    return original != hash ? CraftMetaPotion.class.hashCode() ^ hash : hash;
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:12,代碼來源:CraftMetaPotion.java

示例4: serialize

@Override
Builder<String, Object> serialize(Builder<String, Object> builder) {
    super.serialize(builder);
    if (type.getType() != PotionType.UNCRAFTABLE) {
        builder.put(DEFAULT_POTION.BUKKIT, CraftPotionUtil.fromBukkit(type));
    }

    if (hasCustomEffects()) {
        builder.put(POTION_EFFECTS.BUKKIT, ImmutableList.copyOf(this.customEffects));
    }

    return builder;
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:13,代碼來源:CraftMetaPotion.java

示例5: change

@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
	ItemStack i = item.getSingle(e);
	if (i == null) {
		return;
	}
	if (PotionUtils.isPotionItem(i)) {
		PotionMeta meta = (PotionMeta) i.getItemMeta();
		PotionEffect potionEffect = (meta.getBasePotionData().getType() != PotionType.UNCRAFTABLE)
			? PotionUtils.getEffectByEffectType(meta, effectType.getSingle(e))
			: PotionUtils.fromPotionData(meta.getBasePotionData());
		if (potionEffect == null) {
			return;
		}
		if (meta.getBasePotionData().getType() != PotionType.UNCRAFTABLE) {
			meta.removeCustomEffect(effectType.getSingle(e));
		} else {
			meta.setBasePotionData(PotionUtils.emptyPotionData());
		}
		Number number = (Number) delta[0];
		switch (mode) {
			case ADD:
				meta.addCustomEffect(new PotionEffect(
					potionEffect.getType(),
					potionEffect.getDuration(),
					potionEffect.getAmplifier() + number.intValue(),
					potionEffect.isAmbient(),
					potionEffect.hasParticles(),
					potionEffect.getColor()
				), true);
				break;
			case SET:
				meta.addCustomEffect(new PotionEffect(
					potionEffect.getType(),
					potionEffect.getDuration(),
					number.intValue(),
					potionEffect.isAmbient(),
					potionEffect.hasParticles(),
					potionEffect.getColor()
				), true);
				break;
			case REMOVE:
				meta.addCustomEffect(new PotionEffect(
					potionEffect.getType(),
					potionEffect.getDuration(),
					(potionEffect.getAmplifier() - number.intValue() > 0)
						? potionEffect.getAmplifier() - number.intValue()
						: potionEffect.getAmplifier(),
					potionEffect.isAmbient(),
					potionEffect.hasParticles(),
					potionEffect.getColor()
				), true);
				break;
		}
	}
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:56,代碼來源:SExprItemEffectTypeAmplifier.java

示例6: change

@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
	ItemStack i = item.getSingle(e);
	if (i == null) {
		return;
	}
	if (PotionUtils.isPotionItem(i)) {
		PotionMeta meta = (PotionMeta) i.getItemMeta();
		PotionEffect potionEffect = (meta.getBasePotionData().getType() != PotionType.UNCRAFTABLE)
			? PotionUtils.getEffectByEffectType(meta, effectType.getSingle(e))
			: PotionUtils.fromPotionData(meta.getBasePotionData());
		if (potionEffect == null) {
			return;
		}
		if (meta.getBasePotionData().getType() != PotionType.UNCRAFTABLE) {
			meta.removeCustomEffect(effectType.getSingle(e));
		} else {
			meta.setBasePotionData(PotionUtils.emptyPotionData());
		}
		Timespan timespan = (Timespan) delta[0];
		switch (mode) {
			case ADD:
				meta.addCustomEffect(new PotionEffect(
					potionEffect.getType(),
					potionEffect.getDuration() + Math.toIntExact(timespan.getTicks_i()),
					potionEffect.getAmplifier(),
					potionEffect.isAmbient(),
					potionEffect.hasParticles(),
					potionEffect.getColor()
				), true);
				break;
			case SET:
				meta.addCustomEffect(new PotionEffect(
					potionEffect.getType(),
					Math.toIntExact(timespan.getTicks_i()),
					potionEffect.getAmplifier(),
					potionEffect.isAmbient(),
					potionEffect.hasParticles(),
					potionEffect.getColor()
				), true);
				break;
			case REMOVE:
				meta.addCustomEffect(new PotionEffect(
					potionEffect.getType(),
					(potionEffect.getDuration() - Math.toIntExact(timespan.getTicks_i()) > 0)
						? potionEffect.getDuration() - Math.toIntExact(timespan.getTicks_i())
						: potionEffect.getDuration(),
					potionEffect.getAmplifier(),
					potionEffect.isAmbient(),
					potionEffect.hasParticles(),
					potionEffect.getColor()
				), true);
				break;
		}
	}
}
 
開發者ID:Syst3ms,項目名稱:QuarSK,代碼行數:56,代碼來源:SExprItemEffectTypeDuration.java

示例7: getPotionType

public static PotionType getPotionType(ItemMeta meta) {
	
	String string = meta.toString();
	
	if(string.contains("water")) {
		return PotionType.WATER;
	}
	else if(string.contains("mundane")) {
		return PotionType.MUNDANE;
	}
	else if(string.contains("thick")) {
		return PotionType.THICK;
	}
	else if(string.contains("awkward")) {
		return PotionType.AWKWARD;
	}
	else if(string.contains("night_vision")) {
		return PotionType.NIGHT_VISION;
	}
	else if(string.contains("invisibility")) {
		return PotionType.INVISIBILITY;
	}
	else if(string.contains("leaping")) {
		return PotionType.JUMP;
	}
	else if(string.contains("fire_resistance")) {
		return PotionType.FIRE_RESISTANCE;
	}
	else if(string.contains("swiftness")) {
		return PotionType.SPEED;
	}
	else if(string.contains("slowness")) {
		return PotionType.SLOWNESS;
	}
	else if(string.contains("water_breathing")) {
		return PotionType.WATER_BREATHING;
	}
	else if(string.contains("healing")) {
		return PotionType.INSTANT_HEAL;
	}
	else if(string.contains("harming")) {
		return PotionType.INSTANT_DAMAGE;
	}
	else if(string.contains("poison")) {
		return PotionType.POISON;
	}
	else if(string.contains("regeneration")) {
		return PotionType.REGEN;
	}
	else if(string.contains("strength")) {
		return PotionType.STRENGTH;
	}
	else if(string.contains("weakness")) {
		return PotionType.WEAKNESS;
	}
	else if(string.contains("luck")) {
		return PotionType.LUCK;
	}
	else if(string.contains("empty")) {
		return PotionType.UNCRAFTABLE;
	}
	
	return PotionType.AWKWARD;
}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:64,代碼來源:TowerGUI.java

示例8: isPotionEmpty

boolean isPotionEmpty() {
    return (type.getType() == PotionType.UNCRAFTABLE) && !(hasCustomEffects());
}
 
開發者ID:bergerkiller,項目名稱:SpigotSource,代碼行數:3,代碼來源:CraftMetaPotion.java


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