mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
90fe0d58a5
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry 255b2aa1 SPIGOT-7080: Add World#locateNearestBiome ff984826 Remove javadoc.io doc links CraftBukkit Changes: 71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler 38c599f9d PR-1272: Only allow one entity in CraftItem instead of two f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld Spigot Changes: e0e223fe Remove javadoc.io doc links
73 lines
3.1 KiB
Diff
73 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
|
|
Date: Sun, 6 Mar 2022 11:09:09 -0500
|
|
Subject: [PATCH] Prevent entity loading causing async lookups
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index cb2b6ac12a93e5080e3d408e9797c011b5dccd09..bca885b3632c06c51d7d68f9f3ee1964a41bfdf3 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -763,6 +763,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
|
|
public void baseTick() {
|
|
this.level().getProfiler().push("entityBaseTick");
|
|
+ if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Update last hurt when ticking
|
|
this.feetBlockState = null;
|
|
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
|
this.stopRiding();
|
|
diff --git a/src/main/java/net/minecraft/world/entity/NeutralMob.java b/src/main/java/net/minecraft/world/entity/NeutralMob.java
|
|
index fa64c7baa7587f2cfe80b78ed83be011239618cf..55defe4f42bea4600a4e2b93c88e90231e61f6ef 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/NeutralMob.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/NeutralMob.java
|
|
@@ -42,18 +42,11 @@ public interface NeutralMob {
|
|
UUID uuid = nbt.getUUID("AngryAt");
|
|
|
|
this.setPersistentAngerTarget(uuid);
|
|
- Entity entity = ((ServerLevel) world).getEntity(uuid);
|
|
-
|
|
- if (entity != null) {
|
|
- if (entity instanceof Mob) {
|
|
- this.setLastHurtByMob((Mob) entity);
|
|
- }
|
|
-
|
|
- if (entity.getType() == EntityType.PLAYER) {
|
|
- this.setLastHurtByPlayer((Player) entity);
|
|
- }
|
|
-
|
|
- }
|
|
+ // Paper - Moved diff to separate method
|
|
+ // If this entity already survived its first tick, e.g. is loaded and ticked in sync, actively
|
|
+ // tick the initial persistent anger.
|
|
+ // If not, let the first tick on the baseTick call the method later down the line.
|
|
+ if (this instanceof Entity entity && !entity.firstTick) this.tickInitialPersistentAnger(world);
|
|
}
|
|
}
|
|
}
|
|
@@ -127,4 +120,26 @@ public interface NeutralMob {
|
|
|
|
@Nullable
|
|
LivingEntity getTarget();
|
|
+
|
|
+ // Paper start - Update last hurt when ticking
|
|
+ default void tickInitialPersistentAnger(Level level) {
|
|
+ UUID target = getPersistentAngerTarget();
|
|
+ if (target == null) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ Entity entity = ((ServerLevel) level).getEntity(target);
|
|
+
|
|
+ if (entity != null) {
|
|
+ if (entity instanceof Mob) {
|
|
+ this.setLastHurtByMob((Mob) entity);
|
|
+ }
|
|
+
|
|
+ if (entity.getType() == EntityType.PLAYER) {
|
|
+ this.setLastHurtByPlayer((Player) entity);
|
|
+ }
|
|
+
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
}
|