本文整理汇总了Java中net.minecraftforge.event.entity.player.PlayerPickupXpEvent类的典型用法代码示例。如果您正苦于以下问题:Java PlayerPickupXpEvent类的具体用法?Java PlayerPickupXpEvent怎么用?Java PlayerPickupXpEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerPickupXpEvent类属于net.minecraftforge.event.entity.player包,在下文中一共展示了PlayerPickupXpEvent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onPlayerPickupXP
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入依赖的package包/类
public static void onPlayerPickupXP(PlayerPickupXpEvent event) {
EntityPlayer player = event.entityPlayer;
EntityXPOrb orb = event.orb;
if (player.worldObj.isRemote)
return;
if (!EtFuturum.enableMending)
return;
ItemStack[] stacks = new ItemStack[5];
stacks[0] = player.getCurrentEquippedItem(); // held
stacks[1] = player.getEquipmentInSlot(1); // boots
stacks[2] = player.getEquipmentInSlot(2); // leggings
stacks[3] = player.getEquipmentInSlot(3); // chestplate
stacks[4] = player.getEquipmentInSlot(4); // helmet
for (ItemStack stack : stacks)
if (stack != null && stack.getItemDamage() > 0 && EnchantmentHelper.getEnchantmentLevel(mending.effectId, stack) > 0) {
int xp = orb.xpValue;
while (xp > 0 && stack.getItemDamage() > 0) {
stack.setItemDamage(stack.getItemDamage() - 2);
xp--;
}
if (xp <= 0) {
orb.setDead();
event.setCanceled(true);
return;
}
}
}
示例3: 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);
}
}
}
示例4: onCollideWithPlayer
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入依赖的package包/类
public void onCollideWithPlayer(EntityPlayer p_70100_1_)
{
if (!this.worldObj.isRemote)
{
if (this.field_70532_c == 0 && p_70100_1_.xpCooldown == 0)
{
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(p_70100_1_, this))) return;
p_70100_1_.xpCooldown = 2;
this.worldObj.playSoundAtEntity(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
p_70100_1_.onItemPickup(this, 1);
p_70100_1_.addExperience(CraftEventFactory.callPlayerExpChangeEvent(p_70100_1_, this.xpValue).getAmount());
this.setDead();
}
}
}
示例5: onCollideWithPlayer
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入依赖的package包/类
public void onCollideWithPlayer(EntityPlayer p_70100_1_)
{
if (!this.worldObj.isRemote)
{
if (this.field_70532_c == 0 && p_70100_1_.xpCooldown == 0)
{
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(p_70100_1_, this))) return;
p_70100_1_.xpCooldown = 2;
this.worldObj.playSoundAtEntity(p_70100_1_, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
p_70100_1_.onItemPickup(this, 1);
p_70100_1_.addExperience(this.xpValue);
this.setDead();
}
}
}
示例6: onPlayerAttemptXPPickup
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerAttemptXPPickup(PlayerPickupXpEvent event){
if (event.entityPlayer.worldObj.isRemote)
return;
if (!ClaimsList.For(event.entity.worldObj).actionIsTrusted(event.entityPlayer, PermissionsMutex.PICKUP_XP, event.orb.posX, event.orb.posY, event.orb.posZ))
event.setCanceled(true);
}
示例7: onPlayerPickXP
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerPickXP(PlayerPickupXpEvent event) {
ModEnchantments.onPlayerPickupXP(event);
}
示例8: onPlayerPickupEvent
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerPickupEvent(PlayerPickupXpEvent event){
//TODO Xpbonus achievement
}
示例9: 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;
}