mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-29 19:59:08 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@c7714bb Update PlayerPostRespawnEvent to include full location data (#13237) PaperMC/Paper@9d427a5 [ci skip] Enable unpick (#13241) PaperMC/Paper@13e9c10 [ci skip] Update mache for new unpick definitions PaperMC/Paper@9934c17 Set chunk loading radius to 0 in PlayerSpawnFinder
45 lines
1.9 KiB
Diff
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 1b7019c1564fb9fe8f48c3f0983a2c64ea0aa4a5..b6d65c9ce0fc3c5a27e6de40c3ce26f75bf77426 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -551,6 +551,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 7cbb9af035092cf2764913c565a3a9398f09e747..c51231f40c31b153ac463e31656584e6c70d5a78 100644
|
|
--- a/net/minecraft/world/level/Level.java
|
|
+++ b/net/minecraft/world/level/Level.java
|
|
@@ -1449,6 +1449,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
|