mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-19 14:59:30 +00:00
49 lines
2.1 KiB
Diff
49 lines
2.1 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 5e48d84c5ab335975f6533472aec1e1789375bbf..30e6492e60fc7b5767d09574304ad3a3977e862a 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -540,6 +540,25 @@ 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 Vec3 stuckSpeedMultiplier() {
|
|
+ return this.stuckSpeedMultiplier;
|
|
+ }
|
|
+
|
|
+ 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 9fbce0f31a73928a7db752e085fb3d0020fc6387..869670abd843d6c10babf8ffaa7bfc919f8a818a 100644
|
|
--- a/net/minecraft/world/level/Level.java
|
|
+++ b/net/minecraft/world/level/Level.java
|
|
@@ -1514,6 +1514,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
|
|
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
|