ForgePatch/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch
LexManos 85a2a2e661 Fix issues with ZombieVillagers Closes #3398
1.11 doesn't intertwine zombie types anymore so our edits to split them out for custom professions are not needed.
2016-11-17 12:14:23 -08:00

58 lines
4.8 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/monster/EntityZombie.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityZombie.java
@@ -98,7 +98,7 @@
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.23000000417232513D);
this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D);
this.func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(2.0D);
- this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * 0.10000000149011612D);
+ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance);
}
protected void func_70088_a()
@@ -239,12 +239,24 @@
entitylivingbase = (EntityLivingBase)p_70097_1_.func_76346_g();
}
- if (entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning"))
+ int i = MathHelper.func_76128_c(this.field_70165_t);
+ int j = MathHelper.func_76128_c(this.field_70163_u);
+ int k = MathHelper.func_76128_c(this.field_70161_v);
+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent summonAid = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e());
+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true;
+
+ if (summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW ||
+ entitylivingbase != null && this.field_70170_p.func_175659_aa() == EnumDifficulty.HARD && (double)this.field_70146_Z.nextFloat() < this.func_110148_a(field_110186_bp).func_111126_e() && this.field_70170_p.func_82736_K().func_82766_b("doMobSpawning"))
{
- int i = MathHelper.func_76128_c(this.field_70165_t);
- int j = MathHelper.func_76128_c(this.field_70163_u);
- int k = MathHelper.func_76128_c(this.field_70161_v);
- EntityZombie entityzombie = new EntityZombie(this.field_70170_p);
+ EntityZombie entityzombie;
+ if (summonAid.getCustomSummonedAid() != null && summonAid.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW)
+ {
+ entityzombie = summonAid.getCustomSummonedAid();
+ }
+ else
+ {
+ entityzombie = new EntityZombie(this.field_70170_p);
+ }
for (int l = 0; l < 50; ++l)
{
@@ -252,14 +264,14 @@
int j1 = j + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
int k1 = k + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
- if (this.field_70170_p.func_180495_p(new BlockPos(i1, j1 - 1, k1)).func_185896_q() && this.field_70170_p.func_175671_l(new BlockPos(i1, j1, k1)) < 10)
+ if (this.field_70170_p.func_180495_p(new BlockPos(i1, j1 - 1, k1)).isSideSolid(this.field_70170_p, new BlockPos(i1, j1 - 1, k1), net.minecraft.util.EnumFacing.UP) && this.field_70170_p.func_175671_l(new BlockPos(i1, j1, k1)) < 10)
{
entityzombie.func_70107_b((double)i1, (double)j1, (double)k1);
if (!this.field_70170_p.func_175636_b((double)i1, (double)j1, (double)k1, 7.0D) && this.field_70170_p.func_72917_a(entityzombie.func_174813_aQ(), entityzombie) && this.field_70170_p.func_184144_a(entityzombie, entityzombie.func_174813_aQ()).isEmpty() && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ()))
{
this.field_70170_p.func_72838_d(entityzombie);
- entityzombie.func_70624_b(entitylivingbase);
+ if (entitylivingbase != null) entityzombie.func_70624_b(entitylivingbase);
entityzombie.func_180482_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null);
this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
entityzombie.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));