本文整理汇总了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;未经允许,请勿转载。 |
请发表评论