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


Java ForgeHooks.onLivingDeath方法代码示例

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


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

示例1: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
@Override
public void onDeath(DamageSource dmg)
   {
       if (ForgeHooks.onLivingDeath(this, dmg)) return;
       Entity entity = dmg.getEntity();
       EntityLivingBase entitylivingbase = this.func_94060_bK();

       if (this.scoreValue >= 0 && entitylivingbase != null) { entitylivingbase.addToPlayerScore(this, this.scoreValue); }

       if (entity != null) { entity.onKillEntity(this); }	// Informing the killer about this
       
       this.worldObj.playSoundAtEntity(this, "random.break", 0.8f, 0.3f);

       if (!this.worldObj.isRemote)	// Spill it all (server-side)
       {
       	AI_Storage.dropFirstWeapon(this);
       	if (this.hasWeaponUpgrade) { AI_Storage.dropSecondWeapon(this); }
       	AI_Storage.dropParts(this);
       	AI_Storage.dropStoredItems(this);
       	
       	if (this.hasCommunicationUpgrade && AI_Targeting.isNameOnWhitelist(this, Commands.cmdTellDeath))
       	{
       		AI_Communication.tellOwnerAboutDeath(this);	// Whelp, you should probably know about this
       	}
       }
       
       this.dead = true;
       this.func_110142_aN().func_94549_h();

       this.worldObj.setEntityState(this, (byte) 3);
   }
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:32,代码来源:Entity_AA.java

示例2: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
public void onDeath(DamageSource p_70645_1_)
{
	if (ForgeHooks.onLivingDeath(this, p_70645_1_)) {
		return;
	}
	super.onDeath(p_70645_1_);
	setSize(0.2F, 0.2F);
	setPosition(this.posX, this.posY, this.posZ);
	this.motionY = 0.1000000014901161D;

	this.captureDrops = true;
	this.capturedDrops.clear();
	if (getCommandSenderName().equals("Notch")) {
		func_146097_a(new ItemStack(Items.apple, 1), true, false);
	}
	if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) {
		this.inventory.dropAllItems();
	}
	this.captureDrops = false;
	if (!this.worldObj.isRemote)
	{
		PlayerDropsEvent event = new PlayerDropsEvent(this, p_70645_1_, this.capturedDrops, this.recentlyHit > 0);
		if (!MinecraftForge.EVENT_BUS.post(event)) {
			for (EntityItem item : this.capturedDrops) {
				joinEntityItemWithWorld(item);
			}
		}
	}
	if (p_70645_1_ != null)
	{
		this.motionX = (-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * 3.141593F / 180.0F) * 0.1F);
		this.motionZ = (-MathHelper.sin((this.attackedAtYaw + this.rotationYaw) * 3.141593F / 180.0F) * 0.1F);
	}
	else
	{
		this.motionX = (this.motionZ = 0.0D);
	}
	this.yOffset = 0.1F;
	addStat(StatList.deathsStat, 1);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:41,代码来源:EntityPlayer.java

示例3: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
public void onDeath(DamageSource p_70645_1_) {
	;
	;
	if (ForgeHooks.onLivingDeath(this, p_70645_1_)) {
		return;
	}
	Entity entity = p_70645_1_.getEntity();
	EntityLivingBase entitylivingbase = func_94060_bK();
	if ((this.scoreValue >= 0) && (entitylivingbase != null)) {
		entitylivingbase.addToPlayerScore(this, this.scoreValue);
	}
	if (entity != null) {
		entity.onKillEntity(this);
	}
	this.dead = true;
	func_110142_aN().func_94549_h();
	if (!this.worldObj.isRemote) {
		int i = 0;
		if ((entity instanceof EntityPlayer)) {
			i = EnchantmentHelper
					.getLootingModifier((EntityLivingBase) entity);
		}
		this.captureDrops = true;
		this.capturedDrops.clear();
		int j = 0;
		if ((func_146066_aG())
				&& (this.worldObj.getGameRules()
						.getGameRuleBooleanValue("doMobLoot"))) {
			dropFewItems(this.recentlyHit > 0, i);
			dropEquipment(this.recentlyHit > 0, i);
			if (this.recentlyHit > 0) {
				j = this.rand.nextInt(200) - i;
				if (j < 5) {
					dropRareDrop(j <= 0 ? 1 : 0);
				}
			}
		}
		this.captureDrops = false;
		if (!ForgeHooks.onLivingDrops(this, p_70645_1_, this.capturedDrops,
				i, this.recentlyHit > 0, j)) {
			for (EntityItem item : this.capturedDrops) {
				this.worldObj.spawnEntityInWorld(item);
			}
		}
	}
	this.worldObj.setEntityState(this, (byte) 3);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:48,代码来源:EntityLivingBase.java

示例4: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
public void onDeath(DamageSource p_70645_1_)
{
    if (ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
    super.onDeath(p_70645_1_);
    this.setSize(0.2F, 0.2F);
    this.setPosition(this.posX, this.posY, this.posZ);
    this.motionY = 0.10000000149011612D;

    captureDrops = true;
    capturedDrops.clear();

    if (this.getCommandSenderName().equals("Notch"))
    {
        this.func_146097_a(new ItemStack(Items.apple, 1), true, false);
    }

    if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
    {
        this.inventory.dropAllItems();
    }

    captureDrops = false;

    if (!worldObj.isRemote)
    {
        PlayerDropsEvent event = new PlayerDropsEvent(this, p_70645_1_, capturedDrops, recentlyHit > 0);
        if (!MinecraftForge.EVENT_BUS.post(event))
        {
            for (EntityItem item : capturedDrops)
            {
                joinEntityItemWithWorld(item);
            }
        }
    }

    if (p_70645_1_ != null)
    {
        this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F);
        this.motionZ = (double)(-MathHelper.sin((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F);
    }
    else
    {
        this.motionX = this.motionZ = 0.0D;
    }

    this.yOffset = 0.1F;
    this.addStat(StatList.deathsStat, 1);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:49,代码来源:EntityPlayer.java

示例5: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
public void onDeath(DamageSource p_70645_1_)
{
    if (ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
    Entity entity = p_70645_1_.getEntity();
    EntityLivingBase entitylivingbase = this.func_94060_bK();

    if (this.scoreValue >= 0 && entitylivingbase != null)
    {
        entitylivingbase.addToPlayerScore(this, this.scoreValue);
    }

    if (entity != null)
    {
        entity.onKillEntity(this);
    }

    this.dead = true;
    this.func_110142_aN().func_94549_h();

    if (!this.worldObj.isRemote)
    {
        int i = 0;

        if (entity instanceof EntityPlayer)
        {
            i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity);
        }

        captureDrops = true;
        capturedDrops.clear();
        int j = 0;

        if (this.func_146066_aG() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
        {
            this.dropFewItems(this.recentlyHit > 0, i);
            this.dropEquipment(this.recentlyHit > 0, i);

            if (this.recentlyHit > 0)
            {
                j = this.rand.nextInt(200) - i;

                if (j < 5)
                {
                    this.dropRareDrop(j <= 0 ? 1 : 0);
                }
            }
        }

        captureDrops = false;

        if (!ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, recentlyHit > 0, j))
        {
            for (EntityItem item : capturedDrops)
            {
                worldObj.spawnEntityInWorld(item);
            }
        }
    }

    this.worldObj.setEntityState(this, (byte)3);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:62,代码来源:EntityLivingBase.java

示例6: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
public void onDeath(DamageSource p_70645_1_)
{
    if (ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
    this.mcServer.getConfigurationManager().sendChatMsg(this.func_110142_aN().func_151521_b());

    if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
    {
        captureDrops = true;
        capturedDrops.clear();

        this.inventory.dropAllItems();

        captureDrops = false;
        PlayerDropsEvent event = new PlayerDropsEvent(this, p_70645_1_, capturedDrops, recentlyHit > 0);
        if (!MinecraftForge.EVENT_BUS.post(event))
        {
            for (EntityItem item : capturedDrops)
            {
                joinEntityItemWithWorld(item);
            }
        }
    }

    Collection collection = this.worldObj.getScoreboard().func_96520_a(IScoreObjectiveCriteria.deathCount);
    Iterator iterator = collection.iterator();

    while (iterator.hasNext())
    {
        ScoreObjective scoreobjective = (ScoreObjective)iterator.next();
        Score score = this.getWorldScoreboard().func_96529_a(this.getCommandSenderName(), scoreobjective);
        score.func_96648_a();
    }

    EntityLivingBase entitylivingbase = this.func_94060_bK();

    if (entitylivingbase != null)
    {
        int i = EntityList.getEntityID(entitylivingbase);
        EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(i));

        if (entityegginfo != null)
        {
            this.addStat(entityegginfo.field_151513_e, 1);
        }

        entitylivingbase.addToPlayerScore(this, this.scoreValue);
    }

    this.addStat(StatList.deathsStat, 1);
    this.func_110142_aN().func_94549_h();
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:52,代码来源:EntityPlayerMP.java

示例7: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource par1DamageSource)
{
    if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return;
    Entity entity = par1DamageSource.getEntity();
    EntityLivingBase entitylivingbase = this.func_94060_bK();

    if (this.scoreValue >= 0 && entitylivingbase != null)
    {
        entitylivingbase.addToPlayerScore(this, this.scoreValue);
    }

    if (entity != null)
    {
        entity.onKillEntity(this);
    }

    this.dead = true;

    if (!this.worldObj.isRemote)
    {
        int i = 0;

        if (entity instanceof EntityPlayer)
        {
            i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity);
        }

        captureDrops = true;
        capturedDrops.clear();
        int j = 0;

        if (!this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
        {
            this.dropFewItems(this.recentlyHit > 0, i);
            this.dropEquipment(this.recentlyHit > 0, i);

            if (this.recentlyHit > 0)
            {
                j = this.rand.nextInt(200) - i;

                if (j < 5)
                {
                    this.dropRareDrop(j <= 0 ? 1 : 0);
                }
            }
        }

        captureDrops = false;

        if (!ForgeHooks.onLivingDrops(this, par1DamageSource, capturedDrops, i, recentlyHit > 0, j))
        {
            for (EntityItem item : capturedDrops)
            {
                worldObj.spawnEntityInWorld(item);
            }
        }
    }

    this.worldObj.setEntityState(this, (byte)3);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:64,代码来源:EntityLivingBase.java

示例8: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource par1DamageSource)
{
    if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return;
    this.mcServer.getConfigurationManager().sendChatMsg(this.func_110142_aN().func_94546_b());

    if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
    {
        captureDrops = true;
        capturedDrops.clear();

        this.inventory.dropAllItems();

        captureDrops = false;
        PlayerDropsEvent event = new PlayerDropsEvent(this, par1DamageSource, capturedDrops, recentlyHit > 0);
        if (!MinecraftForge.EVENT_BUS.post(event))
        {
            for (EntityItem item : capturedDrops)
            {
                joinEntityItemWithWorld(item);
            }
        }
    }

    Collection collection = this.worldObj.getScoreboard().func_96520_a(ScoreObjectiveCriteria.deathCount);
    Iterator iterator = collection.iterator();

    while (iterator.hasNext())
    {
        ScoreObjective scoreobjective = (ScoreObjective)iterator.next();
        Score score = this.getWorldScoreboard().func_96529_a(this.getEntityName(), scoreobjective);
        score.func_96648_a();
    }

    EntityLivingBase entitylivingbase = this.func_94060_bK();

    if (entitylivingbase != null)
    {
        entitylivingbase.addToPlayerScore(this, this.scoreValue);
    }

    this.addStat(StatList.deathsStat, 1);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:46,代码来源:EntityPlayerMP.java

示例9: onDeath

import net.minecraftforge.common.ForgeHooks; //导入方法依赖的package包/类
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource par1DamageSource)
{
    if (ForgeHooks.onLivingDeath(this, par1DamageSource)) return;
    super.onDeath(par1DamageSource);
    this.setSize(0.2F, 0.2F);
    this.setPosition(this.posX, this.posY, this.posZ);
    this.motionY = 0.10000000149011612D;

    captureDrops = true;
    capturedDrops.clear();

    if (this.username.equals("Notch"))
    {
        this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true);
    }

    if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
    {
        this.inventory.dropAllItems();
    }

    captureDrops = false;

    if (!worldObj.isRemote)
    {
        PlayerDropsEvent event = new PlayerDropsEvent(this, par1DamageSource, capturedDrops, recentlyHit > 0);
        if (!MinecraftForge.EVENT_BUS.post(event))
        {
            for (EntityItem item : capturedDrops)
            {
                joinEntityItemWithWorld(item);
            }
        }
    }

    if (par1DamageSource != null)
    {
        this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F);
        this.motionZ = (double)(-MathHelper.sin((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F);
    }
    else
    {
        this.motionX = this.motionZ = 0.0D;
    }

    this.yOffset = 0.1F;
    this.addStat(StatList.deathsStat, 1);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:52,代码来源:EntityPlayer.java


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