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

Paper Changes:
PaperMC/Paper@4eda045 Backport fix for MC-296337 (Fixes #12617) (#12619)
PaperMC/Paper@7ebc94c Add Registry#getTagValues (#12603)
PaperMC/Paper@e87320d Fix UOE when using generateTree with pale oak (#12616)
PaperMC/Paper@94f2903 Do not blow up accessing unregistered memories from API (Fixes #12618) (#12639)
PaperMC/Paper@03efecf Do not fire PlayerDropItemEvent for /give command
PaperMC/Paper@3527ccd feat: expose updateDemand and restock on Villager (#12608)
PaperMC/Paper@320f25c fix sponge-absorb deleting chest content (#12647)
PaperMC/Paper@95565e0 Add missing attribute serialization updater
PaperMC/Paper@519e422 Fix infinite loop in RegionFile IO
PaperMC/Paper@ba7fb23 Finish moving over to Holderable (#12646)
PaperMC/Paper@39203a6 [ci skip] Publish PR API and dev bundles (#12672)
PaperMC/Paper@a1b3058 Provide env environment variable and copy spigots sys prop for overriding default repository
2025-06-23 10:47:22 +01:00

45 lines
2.0 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 3c638e9039a037d20c008f22f0c5bace3d3493c6..cffd3f64b253dba53eacc60c8ae82dd297f98e5b 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -534,6 +534,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
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(Entity to) {
+ return to.entityState() != null && to.entityState().comparePositionAndMotion(this);
+ }
+ // Sakura end - store entity data/state
public Entity(EntityType<?> entityType, Level level) {
this.type = entityType;
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 0e676210ef390e3cce2fc24622f68da119c9a05f..7bf2b9a5a6c0a5c78e8623e158367552eb253fbc 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -1498,6 +1498,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
public <T extends Entity> void guardEntityTick(Consumer<T> consumerEntity, T entity) {
try {
+ entity.storeEntityState(); // Sakura - store entity data/state
consumerEntity.accept(entity);
} catch (Throwable var6) {
// Paper start - Prevent block entity and entity crashes