ForgePatch/patches/minecraft/net/minecraft/entity/monster/EntityZombie.java.patch

59 lines
5.1 KiB
Diff

--- a/net/minecraft/entity/monster/EntityZombie.java
+++ b/net/minecraft/entity/monster/EntityZombie.java
@@ -109,7 +109,7 @@
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a((double)0.23F);
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() * (double)0.1F);
+ this.func_110140_aT().func_111150_b(field_110186_bp).func_111128_a(this.field_70146_Z.nextDouble() * net.minecraftforge.common.ForgeConfig.SERVER.zombieBaseSummonChance.get());
}
protected void func_70088_a() {
@@ -285,20 +285,25 @@
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);
- EntityZombie entityzombie = new EntityZombie(this.field_70170_p);
+ net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent event = net.minecraftforge.event.ForgeEventFactory.fireZombieSummonAid(this, field_70170_p, i, j, k, entitylivingbase, this.func_110148_a(field_110186_bp).func_111126_e());
+ if (event.getResult() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
+ if (event.getResult() == net.minecraftforge.eventbus.api.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")) {
+ EntityZombie entityzombie = event.getCustomSummonedAid() != null && event.getResult() == net.minecraftforge.eventbus.api.Event.Result.ALLOW ? event.getCustomSummonedAid() : new EntityZombie(this.field_70170_p);
+
for(int l = 0; l < 50; ++l) {
int i1 = i + MathHelper.func_76136_a(this.field_70146_Z, 7, 40) * MathHelper.func_76136_a(this.field_70146_Z, -1, 1);
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_201696_r(new BlockPos(i1, j1, k1)) < 10) {
+ if (this.field_70170_p.func_195595_w(new BlockPos(i1, j1 - 1, k1)) && this.field_70170_p.func_201696_r(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_195587_c(entityzombie, entityzombie.func_174813_aQ()) && this.field_70170_p.func_195586_b(entityzombie, entityzombie.func_174813_aQ()) && !this.field_70170_p.func_72953_d(entityzombie.func_174813_aQ())) {
this.field_70170_p.func_72838_d(entityzombie);
+ if (entitylivingbase != null)
entityzombie.func_70624_b(entitylivingbase);
entityzombie.func_204210_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombie)), (IEntityLivingData)null, (NBTTagCompound)null);
this.func_110148_a(field_110186_bp).func_111121_a(new AttributeModifier("Zombie reinforcement caller charge", (double)-0.05F, 0));
@@ -406,7 +411,7 @@
entityzombievillager.func_82149_j(entityvillager);
this.field_70170_p.func_72900_e(entityvillager);
entityzombievillager.func_204210_a(this.field_70170_p.func_175649_E(new BlockPos(entityzombievillager)), new EntityZombie.GroupData(false), (NBTTagCompound)null);
- entityzombievillager.func_190733_a(entityvillager.func_70946_n());
+ entityzombievillager.setProfession(entityvillager.getProfessionForge());
entityzombievillager.func_82227_f(entityvillager.func_70631_g_());
entityzombievillager.func_94061_f(entityvillager.func_175446_cd());
if (entityvillager.func_145818_k_()) {
@@ -439,7 +444,7 @@
float f = p_204210_1_.func_180170_c();
this.func_98053_h(this.field_70146_Z.nextFloat() < 0.55F * f);
if (p_204210_2_ == null) {
- p_204210_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < 0.05F);
+ p_204210_2_ = new EntityZombie.GroupData(this.field_70170_p.field_73012_v.nextFloat() < net.minecraftforge.common.ForgeConfig.SERVER.zombieBabyChance.get());
}
if (p_204210_2_ instanceof EntityZombie.GroupData) {