• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SummonAidEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SummonAidEvent类属于net.minecraftforge.event.entity.living.ZombieEvent包,在下文中一共展示了SummonAidEvent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onZombieSummonAid

import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; //导入依赖的package包/类
@SubscribeEvent
public void onZombieSummonAid(SummonAidEvent event)
{
    if (event.entity instanceof EntityEvolvedZombie)
    {
        event.customSummonedAid = new EntityEvolvedZombie(event.world);

        if (((EntityLivingBase) event.entity).getRNG().nextFloat() < ((EntityEvolvedZombie) event.entity).getEntityAttribute(((EntityEvolvedZombie) event.entity).getReinforcementsAttribute()).getAttributeValue())
        {
            event.setResult(Result.ALLOW);
        }
        else
        {
            event.setResult(Result.DENY);
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:18,代码来源:EventHandlerGC.java


示例2: fireZombieSummonAid

import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; //导入依赖的package包/类
public static SummonAidEvent fireZombieSummonAid(EntityZombie zombie, World world, int x, int y, int z, EntityLivingBase attacker, double summonChance)
{
    SummonAidEvent summonEvent = new SummonAidEvent(zombie, world, x, y, z, attacker, summonChance);
    MinecraftForge.EVENT_BUS.post(summonEvent);
    return summonEvent;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:ForgeEventFactory.java


示例3: onSummonAid

import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; //导入依赖的package包/类
@SubscribeEvent
public void onSummonAid(SummonAidEvent event) {
	if (!cache.isEmpty() && cache.remove(event.getSummoner())) {
		event.setResult(Result.DENY);
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:7,代码来源:TileEntityMobGrinder.java


示例4: attackEntityFrom

import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; //导入依赖的package包/类
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
{
    if (!super.attackEntityFrom(p_70097_1_, p_70097_2_))
    {
        return false;
    }
    else
    {
        EntityLivingBase entitylivingbase = this.getAttackTarget();

        if (entitylivingbase == null && this.getEntityToAttack() instanceof EntityLivingBase)
        {
            entitylivingbase = (EntityLivingBase)this.getEntityToAttack();
        }

        if (entitylivingbase == null && p_70097_1_.getEntity() instanceof EntityLivingBase)
        {
            entitylivingbase = (EntityLivingBase)p_70097_1_.getEntity();
        }


        int i = MathHelper.floor_double(this.posX);
        int j = MathHelper.floor_double(this.posY);
        int k = MathHelper.floor_double(this.posZ);

        SummonAidEvent summonAid = ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(field_110186_bp).getAttributeValue());
        
        if (summonAid.getResult() == Result.DENY)
        {
            return true;
        }
        else if (summonAid.getResult() == Result.ALLOW || entitylivingbase != null && this.worldObj.difficultySetting == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue())
        {
            EntityZombie entityzombie;
            if (summonAid.customSummonedAid != null && summonAid.getResult() == Result.ALLOW)
            {
                entityzombie = summonAid.customSummonedAid;
            }
            else
            {
                entityzombie = new EntityZombie(this.worldObj);
            }

            for (int l = 0; l < 50; ++l)
            {
                int i1 = i + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
                int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
                int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);

                if (World.doesBlockHaveSolidTopSurface(this.worldObj, i1, j1 - 1, k1) && this.worldObj.getBlockLightValue(i1, j1, k1) < 10)
                {
                    entityzombie.setPosition((double)i1, (double)j1, (double)k1);

                    if (this.worldObj.checkNoEntityCollision(entityzombie.boundingBox) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.boundingBox))
                    {
                        this.worldObj.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
                        if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase);
                        entityzombie.onSpawnWithEgg((IEntityLivingData)null);
                        this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
                        entityzombie.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
                        break;
                    }
                }
            }
        }

        return true;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:70,代码来源:EntityZombie.java


示例5: attackEntityFrom

import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; //导入依赖的package包/类
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
{
    if (!super.attackEntityFrom(p_70097_1_, p_70097_2_))
    {
        return false;
    }
    else
    {
        EntityLivingBase entitylivingbase = this.getAttackTarget();

        if (entitylivingbase == null && this.getEntityToAttack() instanceof EntityLivingBase)
        {
            entitylivingbase = (EntityLivingBase)this.getEntityToAttack();
        }

        if (entitylivingbase == null && p_70097_1_.getEntity() instanceof EntityLivingBase)
        {
            entitylivingbase = (EntityLivingBase)p_70097_1_.getEntity();
        }


        int i = MathHelper.floor_double(this.posX);
        int j = MathHelper.floor_double(this.posY);
        int k = MathHelper.floor_double(this.posZ);

        SummonAidEvent summonAid = ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(field_110186_bp).getAttributeValue());
        
        if (summonAid.getResult() == Result.DENY)
        {
            return true;
        }
        else if (summonAid.getResult() == Result.ALLOW || entitylivingbase != null && this.worldObj.difficultySetting == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue())
        {
            EntityZombie entityzombie;
            if (summonAid.customSummonedAid != null && summonAid.getResult() == Result.ALLOW)
            {
                entityzombie = summonAid.customSummonedAid;
            }
            else
            {
                entityzombie = new EntityZombie(this.worldObj);
            }

            for (int l = 0; l < 50; ++l)
            {
                int i1 = i + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
                int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
                int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);

                if (World.doesBlockHaveSolidTopSurface(this.worldObj, i1, j1 - 1, k1) && this.worldObj.getBlockLightValue(i1, j1, k1) < 10)
                {
                    entityzombie.setPosition((double)i1, (double)j1, (double)k1);

                    if (this.worldObj.checkNoEntityCollision(entityzombie.boundingBox) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.boundingBox))
                    {
                        this.worldObj.spawnEntityInWorld(entityzombie);
                        if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase);
                        entityzombie.onSpawnWithEgg((IEntityLivingData)null);
                        this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
                        entityzombie.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
                        break;
                    }
                }
            }
        }

        return true;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:70,代码来源:EntityZombie.java


示例6: attackEntityFrom

import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; //导入依赖的package包/类
/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
    if (!super.attackEntityFrom(par1DamageSource, par2))
    {
        return false;
    }
    else
    {
        EntityLivingBase entitylivingbase = this.getAttackTarget();

        if (entitylivingbase == null && this.getEntityToAttack() instanceof EntityLivingBase)
        {
            entitylivingbase = (EntityLivingBase)this.getEntityToAttack();
        }

        if (entitylivingbase == null && par1DamageSource.getEntity() instanceof EntityLivingBase)
        {
            entitylivingbase = (EntityLivingBase)par1DamageSource.getEntity();
        }

        int i = MathHelper.floor_double(this.posX);
        int j = MathHelper.floor_double(this.posY);
        int k = MathHelper.floor_double(this.posZ);

        SummonAidEvent summonAid = ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(field_110186_bp).getAttributeValue());
        
        if (summonAid.getResult() == Result.DENY)
        {
            return true;
        }
        else if (summonAid.getResult() == Result.ALLOW || entitylivingbase != null && this.worldObj.difficultySetting >= 3 && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue())
        {
            EntityZombie entityzombie;
            if (summonAid.customSummonedAid != null && summonAid.getResult() == Result.ALLOW)
            {
                entityzombie = summonAid.customSummonedAid;
            }
            else
            {
                entityzombie = new EntityZombie(this.worldObj);
            }
            
            for (int l = 0; l < 50; ++l)
            {
                int i1 = i + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
                int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
                int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);

                if (this.worldObj.doesBlockHaveSolidTopSurface(i1, j1 - 1, k1) && this.worldObj.getBlockLightValue(i1, j1, k1) < 10)
                {
                    entityzombie.setPosition((double)i1, (double)j1, (double)k1);

                    if (this.worldObj.checkNoEntityCollision(entityzombie.boundingBox) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.boundingBox))
                    {
                        this.worldObj.spawnEntityInWorld(entityzombie);
                        if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase);
                        entityzombie.onSpawnWithEgg((EntityLivingData)null);
                        this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
                        entityzombie.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
                        break;
                    }
                }
            }
        }

        return true;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:72,代码来源:EntityZombie.java


示例7: attackEntityFrom

import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; //导入依赖的package包/类
@Override
   public boolean attackEntityFrom(DamageSource dmgSource, float damageAmount){
if (!super.attackEntityFrom(dmgSource, damageAmount)){
    return false;
}
else{
    EntityLivingBase entitylivingbase = this.getAttackTarget();
    if (entitylivingbase == null && this.getEntityToAttack() instanceof EntityLivingBase){
	entitylivingbase = (EntityLivingBase)this.getEntityToAttack();
    }
    if (entitylivingbase == null && dmgSource.getEntity() instanceof EntityLivingBase){
	entitylivingbase = (EntityLivingBase)dmgSource.getEntity();
    }
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.posY);
    int k = MathHelper.floor_double(this.posZ);
   
    // Calculate whether or not to summon Aid
    SummonAidEvent summonAid = ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(groundhogReinforce).getAttributeValue());
    if (summonAid.getResult() == Result.DENY){
	return true;
    }
    else if (summonAid.getResult() == Result.ALLOW || entitylivingbase != null && this.worldObj.difficultySetting == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(groundhogReinforce).getAttributeValue()){
	EntityGroundhog entityGroundhog;
	if (summonAid.customSummonedAid != null && summonAid.getResult() == Result.ALLOW){
	    entityGroundhog = (EntityGroundhog) summonAid.customSummonedAid;
	}
	else{
	    entityGroundhog = new EntityGroundhog(this.worldObj);
	}

	for (int l = 0; l < 50; ++l){
	    int i1 = i + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
	    int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
	    int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);

	    if (World.doesBlockHaveSolidTopSurface(this.worldObj, i1, j1 - 1, k1) && this.worldObj.getBlockLightValue(i1, j1, k1) < 10){
		entityGroundhog.setPosition((double)i1, (double)j1, (double)k1);

		if (this.worldObj.checkNoEntityCollision(entityGroundhog.boundingBox) && this.worldObj.getCollidingBoundingBoxes(entityGroundhog, entityGroundhog.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(entityGroundhog.boundingBox)){
		    this.worldObj.spawnEntityInWorld(entityGroundhog);
		    if (entitylivingbase != null) entityGroundhog.setAttackTarget(entitylivingbase);
		    entityGroundhog.onSpawnWithEgg((IEntityLivingData)null);
		    this.getEntityAttribute(groundhogReinforce).applyModifier(new AttributeModifier("Groundhog reinforcement caller charge", -0.05000000074505806D, 0));
		    entityGroundhog.getEntityAttribute(groundhogReinforce).applyModifier(new AttributeModifier("Groundhog reinforcement callee charge", -0.05000000074505806D, 0));
		    break;
		}
	    }
	}
    }
}

if (this.isEntityInvulnerable()){
           return false;
       }
       else{
           // Get close groundhogs and set them to attack the player
           Entity entity = dmgSource.getEntity();
           if (entity instanceof EntityPlayer){
               List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(32.0D, 32.0D, 32.0D));
               for (int i = 0; i < list.size(); ++i){
                   Entity entity1 = (Entity)list.get(i);
                   if (entity1 instanceof EntityGroundhog){
               	EntityGroundhog entitypigzombie = (EntityGroundhog)entity1;
                       entitypigzombie.becomeAngryAt(entity);
                   }
               }
               this.becomeAngryAt(entity);
           }
           return true;
       }
   }
 
开发者ID:OwnAgePau,项目名称:Soul-Forest,代码行数:73,代码来源:EntityGroundhog.java


示例8: onSummonAid

import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onSummonAid(SummonAidEvent event) {
  if (!cache.isEmpty() && cache.remove(event.getSummoner().getUniqueID())) {
    event.setResult(Result.DENY);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:7,代码来源:ZombieCache.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExactComparisonCriteria类代码示例发布时间:2022-05-22
下一篇:
Java Error类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap