本文整理汇总了Java中net.minecraftforge.event.entity.player.PlayerPickupXpEvent.getOrb方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerPickupXpEvent.getOrb方法的具体用法?Java PlayerPickupXpEvent.getOrb怎么用?Java PlayerPickupXpEvent.getOrb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.entity.player.PlayerPickupXpEvent
的用法示例。
在下文中一共展示了PlayerPickupXpEvent.getOrb方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerInteractXP
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerInteractXP(PlayerPickupXpEvent event)
{
if (!EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, event.getEntityPlayer()).isEmpty())
return;
HarshenItemStackHandler handler = HarshenUtils.getHandler(event.getEntityPlayer());
for(int o = 0; o < handler.getSlots(); o++)
if(handler.getStackInSlot(o).isItemDamaged() && EnchantmentHelper.getEnchantmentLevel(Enchantments.MENDING, handler.getStackInSlot(o)) > 0)
{
int i = Math.min(event.getOrb().xpValue * 2, (handler.getStackInSlot(o).getItemDamage()));
event.getOrb().xpValue -= i / 2;
HarshenUtils.damageFirstOccuringItem(event.getEntityPlayer(), handler.getStackInSlot(o).getItem(), - i);
break;
}
}
示例2: healPlayerWithExp
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void healPlayerWithExp(PlayerPickupXpEvent e) {
if(!e.getEntity().getEntityWorld().isRemote) {
e.getOrb().xpValue *= 1.0;
if (ConfigurationFile.xpOrbHealValue > 0.0f) {
e.getEntityPlayer().heal(ConfigurationFile.xpOrbHealValue);
}
}
}
示例3: onPlayerPickupXP
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onPlayerPickupXP(PlayerPickupXpEvent event) {
PotionEffect effect = event.getEntityPlayer().getActivePotionEffect(AlchemyPotionLoader.multiple_xp);
if (effect != null)
event.getOrb().xpValue *= effect.getAmplifier() + 1;
}