mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
net.minecraft.world.entity.monster.hoglin
This commit is contained in:
parent
5c36e5e6b5
commit
636e4ccaf2
@ -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
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,48 +0,0 @@
|
|||||||
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
|
||||||
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
|
||||||
@@ -63,7 +63,8 @@
|
|
||||||
public int timeInOverworld;
|
|
||||||
public boolean cannotBeHunted;
|
|
||||||
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super Hoglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ADULT, SensorType.HOGLIN_SPECIFIC_SENSOR);
|
|
||||||
- protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, new MemoryModuleType[]{MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULT, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED, MemoryModuleType.IS_PANICKING});
|
|
||||||
+ // CraftBukkit - decompile error
|
|
||||||
+ protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.<MemoryModuleType<?>>of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLIN, new MemoryModuleType[]{MemoryModuleType.AVOID_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_ADULT_HOGLINS, MemoryModuleType.NEAREST_VISIBLE_ADULT, MemoryModuleType.NEAREST_REPELLENT, MemoryModuleType.PACIFIED, MemoryModuleType.IS_PANICKING});
|
|
||||||
|
|
||||||
public Hoglin(EntityType<? extends Hoglin> type, Level world) {
|
|
||||||
super(type, world);
|
|
||||||
@@ -134,7 +135,7 @@
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Brain<Hoglin> getBrain() {
|
|
||||||
- return super.getBrain();
|
|
||||||
+ return (Brain<Hoglin>) super.getBrain(); // CraftBukkit - decompile error
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -240,9 +241,15 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
private void finishConversion() {
|
|
||||||
- this.convertTo(EntityType.ZOGLIN, ConversionParams.single(this, true, false), (entityzoglin) -> {
|
|
||||||
+ net.minecraft.world.entity.Entity converted = this.convertTo(EntityType.ZOGLIN, ConversionParams.single(this, true, false), (entityzoglin) -> {
|
|
||||||
entityzoglin.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
|
|
||||||
@@ -326,7 +333,7 @@
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected SoundEvent getAmbientSound() {
|
|
||||||
- return this.level().isClientSide ? null : (SoundEvent) HoglinAi.getSoundForCurrentActivity(this).orElse((Object) null);
|
|
||||||
+ return this.level().isClientSide ? null : (SoundEvent) HoglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - decompile error
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
@ -1,11 +0,0 @@
|
|||||||
--- a/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
|
|
||||||
+++ b/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
|
|
||||||
@@ -45,7 +45,7 @@
|
|
||||||
double j = f * (double)(attacker.level().random.nextFloat() * 0.5F + 0.2F);
|
|
||||||
Vec3 vec3 = new Vec3(g, 0.0, h).normalize().scale(j).yRot(i);
|
|
||||||
double k = f * (double)attacker.level().random.nextFloat() * 0.5;
|
|
||||||
- target.push(vec3.x, k, vec3.z);
|
|
||||||
+ target.push(vec3.x, k, vec3.z, attacker); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
|
||||||
target.hurtMarked = true;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user