mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-29 03:39:07 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@3af5e77 Add Player#give (#11995) PaperMC/Paper@7e21cb8 fix PlayerChangedMainHandEvent javadoc (#12020) PaperMC/Paper@5a34bf0 Correctly retrun true for empty input shapes in EntityGetter#isUnobstructed PaperMC/Paper@a392d47 Make Watchdog thread extend TickThread PaperMC/Paper@1004374 Add further information to thread check errors PaperMC/Paper@e2f0efd Remove nms.Entity#isChunkLoaded PaperMC/Paper@54b2e9d Add buffer to CraftWorld#warnUnsafeChunk PaperMC/Paper@d4a9578 Experimental annotation changes (#12028) PaperMC/Paper@5bcfb12 Fix activation range config and water animal status (#12047) PaperMC/Paper@e0711af Deprecate UnsafeValues#getSpawnEggLayerColor (#12041) PaperMC/Paper@8927091 Do not record movement for vehicles/players unaffected by blocks PaperMC/Paper@5395ae3 Fix composter block setting bukkit owner twice (#12058)
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 38fc85d18f737736dcdf5142c8357f9af43e4d19..0e790ff68d87ecc6977da77a6a148270014f4766 100644
|
|
--- a/net/minecraft/world/level/Level.java
|
|
+++ b/net/minecraft/world/level/Level.java
|
|
@@ -1510,6 +1510,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
|