當前位置: 首頁>>代碼示例>>Java>>正文


Java LivingDeathEvent.isCanceled方法代碼示例

本文整理匯總了Java中net.minecraftforge.event.entity.living.LivingDeathEvent.isCanceled方法的典型用法代碼示例。如果您正苦於以下問題:Java LivingDeathEvent.isCanceled方法的具體用法?Java LivingDeathEvent.isCanceled怎麽用?Java LivingDeathEvent.isCanceled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.event.entity.living.LivingDeathEvent的用法示例。


在下文中一共展示了LivingDeathEvent.isCanceled方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: japaneseDeath

import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void japaneseDeath(LivingDeathEvent event)
{
    EntityLivingBase living = event.getEntityLiving();
    World world = living.world;
    if(!event.isCanceled() && !world.isRemote && living.hasCapability(JAPANESE_MOB_CAP,null))
    {
        JapaneseMob japaneseMob = living.getCapability(JAPANESE_MOB_CAP,null);
        int i = japaneseMob.spirits;

        while (i > 0)
        {
            int j = EntitySpirit.getSpiritSplit(i);
            i -= j;
            world.spawnEntity(new EntitySpirit(world, living.posX, living.posY, living.posZ, j));
        }
    }
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:19,代碼來源:JapaneseMobHandler.java

示例2: onDeath

import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@Override
public void onDeath(ItemStack itemStack, LivingDeathEvent event, boolean isWornArmor) {
	System.out.println("ABORTING DEATH");
	if(isWornArmor && !event.isCanceled()) {
		EntityPlayer player = (EntityPlayer)event.entity;
		NBTTagCompound data = itemStack.getTagCompound();
		//System.out.println("Cooldown: " + data.getInteger("resCooldown"));
		if(data.getInteger("resCooldown_armor") <= 0) {
			event.setCanceled(true);
			player.setHealth(20);
			data.setInteger("resCooldown_armor", 6000);
			itemStack.damageItem(5, player);
			return;
		}
	}
}
 
開發者ID:Draco18s,項目名稱:Artifacts,代碼行數:17,代碼來源:ComponentResurrect.java

示例3: entityDeath

import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void entityDeath(LivingDeathEvent event) {
    if (event.isCanceled())
        return;
    if (event.entity.worldObj.isRemote)
        return;
    if (event.source.getSourceOfDamage() == null)
        return;
    EntityPlayer player;
    Entity ent = event.source.getSourceOfDamage();
    boolean arrow = false;
    double distance = 0;
    if (ent instanceof EntityPlayer)
        player = (EntityPlayer) event.source.getSourceOfDamage();
    else if (ent instanceof EntityArrow) {
        if (((EntityArrow) ent).shootingEntity instanceof EntityPlayer) {
            player = (EntityPlayer) ((EntityArrow) ent).shootingEntity;
            arrow = true;
            distance = event.entity.getDistanceSqToEntity(player);
        }
        else
            return;
    }
    else
        return;
    if (isPlayerFake(player))
        return;
    String name = "entity.kill." + EntityList.getEntityString(event.entity);
    PlayerResearchHelper.progressResearch(player, name, 1, true);
    if (arrow)
        PlayerResearchHelper.progressResearch(player, "entity.arrowHit", distance, true);
}
 
開發者ID:AlexIIL,項目名稱:CivCraft,代碼行數:33,代碼來源:BeakerEarningListener.java

示例4: onDeath

import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onDeath(LivingDeathEvent event) {
	if (!event.isCanceled()) {
		if (Config.enableChatBox) {
			if (event.entity instanceof EntityPlayer) {
				for (TileEntityChatBox box : chatBoxMap.keySet()) {
					if (Config.readRange < 0 || Vec3.createVectorHelper(box.xCoord, box.yCoord, box.zCoord).distanceTo(((EntityPlayer) event.entity).getPosition(1.0f)) <= Config.readRange)
						box.onDeath((EntityPlayer) event.entity, event.source);
				}
			}
		}
	}
}
 
開發者ID:austinv11,項目名稱:PeripheralsPlusPlus,代碼行數:14,代碼來源:TileEntityChatBox.java

示例5: onLivingDeath

import net.minecraftforge.event.entity.living.LivingDeathEvent; //導入方法依賴的package包/類
@ForgeSubscribe(priority=EventPriority.LOWEST)
public void onLivingDeath(LivingDeathEvent event) {
	if (!event.isCanceled() && !(event.entityLiving instanceof EntityPlayer)) {
		Map<EntityLivingBase, EntityStats> entityStats = getEntityStatsMap(getSide(event.entityLiving));
		entityStats.remove(event.entityLiving);
	}
}
 
開發者ID:Hunternif,項目名稱:Dota2Items,代碼行數:8,代碼來源:StatsTracker.java


注:本文中的net.minecraftforge.event.entity.living.LivingDeathEvent.isCanceled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。