9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-22 00:09:20 +00:00
Files
SakuraMC/sakura-server/minecraft-patches/features/0007-Store-Entity-Data-State.patch
Samsuik 7abe0b920b Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@056268e [ci skip] Correct javadoc for Weapon Component (#13096)
PaperMC/Paper@a0ea729 Fix minimum tick time reporting and off thread reading
PaperMC/Paper@ba2fb8c Update spark-paper dependency version (#13171)
PaperMC/Paper@ce983d7 Misc fixes to tick reporting (#13174)
PaperMC/Paper@9d95cd5 Use BUILD_STARTED_AT instead of Instant.now() for build timestamp (#13175)
PaperMC/Paper@610f1d2 Update fill-gradle to v1.0.9
PaperMC/Paper@ffcb7b2 Update Parchment (#13177)
PaperMC/Paper@c33a9ce Fix incorrect variable use in Entity#startRiding
PaperMC/Paper@c710b66 Add MapPalette.getNearestColor (#13104)
PaperMC/Paper@b57d641 Expose isReplaceable on BlockData (#13180)
PaperMC/Paper@af1823d Reduce impact of tick time calculations (#13188)
PaperMC/Paper@89ca94a [ci skip] Rebuild patches
PaperMC/Paper@e5cc256 [ci skip] Update CONTRIBUTING.md for Gradle and Windows Docs (#13190)
PaperMC/Paper@ab99393 Fix charged creeper explosions not dropping mob skulls (#13167)
2025-10-16 13:58:47 +01:00

45 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Wed, 16 Aug 2023 22:34:49 +0100
Subject: [PATCH] Store Entity Data/State
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index a7139549066914b3bc318bc409b392645344b3c4..4c327ed5103dcab2e97fb85d4c302dd26e57858d 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -552,6 +552,21 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
return flags;
}
// Sakura end - load chunks on movement
+ // Sakura start - store entity data/state
+ private me.samsuik.sakura.entity.EntityState entityState = null;
+
+ public final void storeEntityState() {
+ this.entityState = me.samsuik.sakura.entity.EntityState.of(this);
+ }
+
+ public final me.samsuik.sakura.entity.EntityState entityState() {
+ return this.entityState;
+ }
+
+ public final boolean compareState(final Entity to) {
+ return to.entityState() != null && to.entityState().comparePositionAndMotion(this);
+ }
+ // Sakura end - store entity data/state
public Entity(EntityType<?> type, Level level) {
this.type = type;
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index f8ea7e4536f6e0584c65ea9e20fe63f1cc343425..0900ae1072c9dfa70cad0e4f3dc7b916ed96319f 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -1448,6 +1448,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
public <T extends Entity> void guardEntityTick(Consumer<T> action, T entity) {
try {
+ entity.storeEntityState(); // Sakura - store entity data/state
action.accept(entity);
} catch (Throwable var6) {
// Paper start - Prevent block entity and entity crashes