net.minecraft.world.entity.monster.hoglin

This commit is contained in:
Jake Potrebic
2024-12-14 12:59:41 -08:00
parent 5c36e5e6b5
commit 636e4ccaf2
4 changed files with 27 additions and 59 deletions

View File

@@ -0,0 +1,16 @@
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -262,7 +_,12 @@
}
private void finishConversion() {
- this.convertTo(EntityType.ZOGLIN, ConversionParams.single(this, true, false), mob -> mob.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)));
+ final Entity converted = this.convertTo(EntityType.ZOGLIN, ConversionParams.single(this, true, false), mob -> {mob.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0));}, org.bukkit.event.entity.EntityTransformEvent.TransformReason.PIGLIN_ZOMBIFIED, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PIGLIN_ZOMBIFIED); // CraftBukkit - add spawn and transform reasons
+ // Paper start - Fix issues with mob conversion; reset to prevent event spam
+ if (converted == null) {
+ this.timeInOverworld = 0;
+ }
+ // Paper end - Fix issues with mob conversion
}
@Override

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
+++ b/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
@@ -45,7 +_,7 @@
double d3 = d * (hoglin.level().random.nextFloat() * 0.5F + 0.2F);
Vec3 vec3 = new Vec3(d1, 0.0, d2).normalize().scale(d3).yRot(f);
double d4 = d * hoglin.level().random.nextFloat() * 0.5;
- target.push(vec3.x, d4, vec3.z);
+ target.push(vec3.x, d4, vec3.z, hoglin); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
target.hurtMarked = true;
}
}