本文整理汇总了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;
}
}
开发者ID:kenijey,项目名称:harshencastle,代码行数:16,代码来源:HandlerHarshenInventory.java
示例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;
}
}
}
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:30,代码来源:ModEnchantments.java
示例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);
}
}
}
开发者ID:baileyholl,项目名称:Event-Tweaks,代码行数:10,代码来源:EXPEventHandler.java
示例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();
}
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:16,代码来源:EntityXPOrb.java
示例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();
}
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:16,代码来源:EntityXPOrb.java
示例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);
}
开发者ID:Mithion,项目名称:GriefGuardian,代码行数:9,代码来源:ClaimGuardEventHandler.java
示例7: onPlayerPickXP
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerPickXP(PlayerPickupXpEvent event) {
ModEnchantments.onPlayerPickupXP(event);
}
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:5,代码来源:ServerEventHandler.java
示例8: onPlayerPickupEvent
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerPickupEvent(PlayerPickupXpEvent event){
//TODO Xpbonus achievement
}
开发者ID:inifire201,项目名称:MagicWinds,代码行数:5,代码来源:EventHandlerCommon.java
示例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;
}
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:7,代码来源:PotionMultipleXP.java
注:本文中的net.minecraftforge.event.entity.player.PlayerPickupXpEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论