當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。