mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-21 05:55:08 +01:00
74 lines
4.6 KiB
Diff
74 lines
4.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Sun, 24 Oct 2021 20:29:45 -0700
|
|
Subject: [PATCH] Fix issues with mob conversion
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
|
|
index 6f6454bcec7e0d1cefbf818fc2fc6eb90adeec83..3972e2ed0554e2550519e994888e068df0a151e5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Skeleton.java
|
|
@@ -94,12 +94,19 @@ public class Skeleton extends AbstractSkeleton {
|
|
}
|
|
|
|
protected void doFreezeConversion() {
|
|
- this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), (entityskeletonstray) -> {
|
|
+ final Stray stray = this.convertTo(EntityType.STRAY, ConversionParams.single(this, true, true), (entityskeletonstray) -> { // Paper - Fix issues with mob conversion; reset conversion time to prevent event spam
|
|
if (!this.isSilent()) {
|
|
this.level().levelEvent((Player) null, 1048, this.blockPosition(), 0);
|
|
}
|
|
|
|
- }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN); // CraftBukkit - add spawn and transform reasons
|
|
+ }, org.bukkit.event.entity.EntityTransformEvent.TransformReason.FROZEN, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FROZEN);// CraftBukkit - add spawn and transform reasons
|
|
+
|
|
+ // Paper start - Fix issues with mob conversion; reset conversion time to prevent event spam
|
|
+ if (stray == null) {
|
|
+ this.conversionTime = 300;
|
|
+ }
|
|
+ // Paper end - Fix issues with mob conversion
|
|
+
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
|
index 34fff71edbdcefe87985f31cbf1ef282435ace06..92270912ef26924f611a1df7cb3d5b485b0a262d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
|
@@ -241,9 +241,15 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
|
|
}
|
|
|
|
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
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
|
|
index e2075fb22596b6dc4dbbb9c20c91c63f0ddb7ba7..e3a8aa0ae0d1fa6f2b697e20464224f8b8c6b8ea 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java
|
|
@@ -100,9 +100,15 @@ public abstract class AbstractPiglin extends Monster {
|
|
}
|
|
|
|
protected void finishConversion(ServerLevel world) {
|
|
- this.convertTo(EntityType.ZOMBIFIED_PIGLIN, ConversionParams.single(this, true, true), (entitypigzombie) -> {
|
|
+ net.minecraft.world.entity.Entity converted = this.convertTo(EntityType.ZOMBIFIED_PIGLIN, ConversionParams.single(this, true, true), (entitypigzombie) -> { // Paper - Fix issues with mob conversion; reset to prevent event spam
|
|
entitypigzombie.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
|
|
}
|
|
|
|
public boolean isAdult() {
|