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


Java LivingHurtEvent.isCanceled方法代码示例

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


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

示例1: onTakeDamage

import net.minecraftforge.event.entity.living.LivingHurtEvent; //导入方法依赖的package包/类
@Override
public void onTakeDamage(ItemStack itemStack, LivingHurtEvent event, boolean isWornArmor) {
	//System.out.println("Player has been damaged!");
	if(isWornArmor && !event.isCanceled()) {
		if(itemStack.stackTagCompound.getInteger("adrenDelay_armor") <= 0 && event.entity instanceof EntityPlayer) {
			//System.out.println("Attempting to apply potion effects to player.");
			EntityPlayer p = (EntityPlayer)event.entity;
			//if(p.getHealth() <= 4) {
				//System.out.println("Applying Potion Effects.");
				itemStack.stackTagCompound.setInteger("adrenDelay_armor", 300);
				
				p.addPotionEffect(new PotionEffect(1, 100, 1));
				p.addPotionEffect(new PotionEffect(5, 100, 1));
				p.addPotionEffect(new PotionEffect(11, 100, 2));
				
			//}
		}
	}
}
 
开发者ID:Draco18s,项目名称:Artifacts,代码行数:20,代码来源:ComponentAdrenaline.java

示例2: livingAttack

import net.minecraftforge.event.entity.living.LivingHurtEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority=EventPriority.HIGH)
public void livingAttack(LivingHurtEvent event) {
	if(event.isCanceled() || event.getSource().isUnblockable())
		return;
	if(event.getEntityLiving().hasCapability(RIG.RIG_ITEM, null)) {
		ItemStack rig=event.getEntityLiving().getCapability(RIG.RIG_ITEM, null).getStackInSlot(0);
		if(rig.hasTagCompound()) {
			int reslevel=1+rig.getTagCompound().getInteger("ResU");
			if(event.getAmount() > 1f)
				event.setAmount(Math.max(1f,event.getAmount() - reslevel * 0.5f));
			
		}
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:15,代码来源:RIGEvents.java

示例3: entityAttack

import net.minecraftforge.event.entity.living.LivingHurtEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void entityAttack(LivingHurtEvent event) {
    if (event.isCanceled())
        return;
    if (event.entity.worldObj.isRemote)
        return;
    EntityPlayer player;
    boolean arrow = false;
    double distance = 0;
    if (event.source.getSourceOfDamage() instanceof EntityPlayer)
        player = (EntityPlayer) event.source.getSourceOfDamage();
    else if (event.source.getSourceOfDamage() instanceof EntityArrow) {
        if (((EntityArrow) event.source.getSourceOfDamage()).shootingEntity instanceof EntityPlayer) {
            player = (EntityPlayer) ((EntityArrow) event.source.getSourceOfDamage()).shootingEntity;
            arrow = true;
            distance = event.entity.getDistanceSqToEntity(player);
        }
        else
            return;
    }
    else
        return;
    if (isPlayerFake(player))
        return;
    if (event.entityLiving == null)
        return;
    String entName = "entity.attack." + EntityList.getEntityString(event.entityLiving);
    PlayerResearchHelper.progressResearch(player, entName, 1, true);
    if (arrow)
        PlayerResearchHelper.progressResearch(player, "entity.arrowHit", distance, true);
}
 
开发者ID:AlexIIL,项目名称:CivCraft,代码行数:32,代码来源:BeakerEarningListener.java


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