mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-30 12:19:08 +00:00
Keep the bukkitEntity around after changing the handle
This commit is contained in:
@@ -41,10 +41,10 @@ index 0604b5075122494ec82b4e1b458645958b93c806..8fec4a46a9cf13d832306bd87a4fe17b
|
||||
this.guardEntityTick(this::tickNonPassenger, entity);
|
||||
profilerFiller.pop();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 30e6492e60fc7b5767d09574304ad3a3977e862a..1fbbade760d5ddbb0fc2f764d382d37d01f9ea33 100644
|
||||
index 30e6492e60fc7b5767d09574304ad3a3977e862a..9844928c361cfc31d618186ecd10fba5975bbb7d 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -559,6 +559,23 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -559,6 +559,24 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return to.entityState() != null && to.entityState().comparePositionAndMotion(this);
|
||||
}
|
||||
// Sakura end - store entity data/state
|
||||
@@ -52,8 +52,9 @@ index 30e6492e60fc7b5767d09574304ad3a3977e862a..1fbbade760d5ddbb0fc2f764d382d37d
|
||||
+ public final void updateBukkitHandle(Entity entity) {
|
||||
+ if (this.bukkitEntity != null) {
|
||||
+ this.bukkitEntity.setHandle(entity);
|
||||
+ } else {
|
||||
+ this.bukkitEntity = entity.getBukkitEntity();
|
||||
+ }
|
||||
+ this.bukkitEntity = entity.getBukkitEntity();
|
||||
+ }
|
||||
+
|
||||
+ public final long getPackedOriginPosition() {
|
||||
@@ -68,7 +69,7 @@ index 30e6492e60fc7b5767d09574304ad3a3977e862a..1fbbade760d5ddbb0fc2f764d382d37d
|
||||
|
||||
public Entity(EntityType<?> entityType, Level level) {
|
||||
this.type = entityType;
|
||||
@@ -4960,6 +4977,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4960,6 +4978,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (this.removalReason != Entity.RemovalReason.UNLOADED_TO_CHUNK) { this.getPassengers().forEach(Entity::stopRiding); } // Paper - rewrite chunk system
|
||||
this.levelCallback.onRemove(removalReason);
|
||||
this.onRemoval(removalReason);
|
||||
@@ -275,7 +276,7 @@ index b6467f9ff64a76104076a01bfd56852ce712d95b..e6aa1d1a5fc5cd2ffc156125c4eef2d0
|
||||
|
||||
@Nullable
|
||||
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
||||
index 5c61a690327cd1c872cdb3604cfa89d988918360..410a086f2fe2b6f695dd9bcce5a1f064b239f5c2 100644
|
||||
index 8688f08fa902445807fe018c44e4a3b3ca01c55e..0db34fe552d65145e5714b4a9adec20c119384e7 100644
|
||||
--- a/net/minecraft/world/level/Level.java
|
||||
+++ b/net/minecraft/world/level/Level.java
|
||||
@@ -841,6 +841,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise cannon entity movement
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 1fbbade760d5ddbb0fc2f764d382d37d01f9ea33..b2ba5578c76c72df077b46f330f59c1ab52ce561 100644
|
||||
index 9844928c361cfc31d618186ecd10fba5975bbb7d..6d38f9437088984cc06a54823c0dae125f6bfafa 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -1182,7 +1182,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1183,7 +1183,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
Vec3 vec3 = this.collide(movement);
|
||||
double d = vec3.lengthSqr();
|
||||
if (d > 1.0E-7 || movement.lengthSqr() - d < 1.0E-7) {
|
||||
@@ -17,7 +17,7 @@ index 1fbbade760d5ddbb0fc2f764d382d37d01f9ea33..b2ba5578c76c72df077b46f330f59c1a
|
||||
BlockHitResult blockHitResult = this.level()
|
||||
.clip(
|
||||
new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)
|
||||
@@ -1484,6 +1484,131 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1485,6 +1485,131 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return distance;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,10 +67,10 @@ index 651a45b795818bd7b1364b95c52570fd99dd35e4..47c8ed946cb2ad81a4469daf60dabc40
|
||||
if (xSmaller && z != 0.0) {
|
||||
z = performAABBCollisionsZ(axisalignedbb, z, aabbs);
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c431fd2d03 100644
|
||||
index 6d38f9437088984cc06a54823c0dae125f6bfafa..661f913bfa8a8bd0c4929a79745ea2e0f45098e4 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -576,6 +576,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -577,6 +577,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
}
|
||||
// Sakura end - merge cannon entities
|
||||
@@ -84,7 +84,7 @@ index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c4
|
||||
|
||||
public Entity(EntityType<?> entityType, Level level) {
|
||||
this.type = entityType;
|
||||
@@ -1088,7 +1095,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1089,7 +1096,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
protected void checkSupportingBlock(boolean onGround, @Nullable Vec3 movement) {
|
||||
@@ -93,7 +93,7 @@ index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c4
|
||||
AABB boundingBox = this.getBoundingBox();
|
||||
AABB aabb = new AABB(boundingBox.minX, boundingBox.minY - 1.0E-6, boundingBox.minZ, boundingBox.maxX, boundingBox.minY, boundingBox.maxZ);
|
||||
Optional<BlockPos> optional = this.level.findSupportingBlock(this, aabb);
|
||||
@@ -1154,7 +1161,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1155,7 +1162,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
this.wasOnFire = this.isOnFire();
|
||||
@@ -105,7 +105,7 @@ index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c4
|
||||
this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper - EAR 2
|
||||
this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper - EAR 2
|
||||
movement = this.limitPistonMovement(movement);
|
||||
@@ -1181,8 +1191,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1182,8 +1192,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
movement = this.maybeBackOffFromEdge(movement, type);
|
||||
Vec3 vec3 = this.collide(movement);
|
||||
double d = vec3.lengthSqr();
|
||||
@@ -119,7 +119,7 @@ index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c4
|
||||
BlockHitResult blockHitResult = this.level()
|
||||
.clip(
|
||||
new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)
|
||||
@@ -1223,6 +1236,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1224,6 +1237,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
} else {
|
||||
if (this.horizontalCollision) {
|
||||
Vec3 deltaMovement = this.getDeltaMovement();
|
||||
@@ -132,7 +132,7 @@ index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c4
|
||||
this.setDeltaMovement(flag ? 0.0 : deltaMovement.x, deltaMovement.y, flag1 ? 0.0 : deltaMovement.z);
|
||||
}
|
||||
|
||||
@@ -1513,7 +1532,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1514,7 +1533,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
bb = currBoundingBox.expandTowards(movement.x, movement.y, movement.z);
|
||||
}
|
||||
this.collectCollisions(bb, voxelList, bbList, ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER);
|
||||
@@ -141,7 +141,7 @@ index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c4
|
||||
}
|
||||
|
||||
private Vec3 collideAxisScan(Vec3 movement, AABB currBoundingBox, List<VoxelShape> voxelList, List<AABB> bbList) {
|
||||
@@ -1521,7 +1540,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1522,7 +1541,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
double y = movement.y;
|
||||
double z = movement.z;
|
||||
|
||||
@@ -153,7 +153,7 @@ index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c4
|
||||
|
||||
if (y != 0.0) {
|
||||
y = this.scanY(currBoundingBox, y, voxelList, bbList);
|
||||
@@ -1643,7 +1665,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1644,7 +1666,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), null // Sakura - load chunks on movement
|
||||
);
|
||||
potentialCollisionsBB.addAll(entityAABBs);
|
||||
@@ -162,7 +162,7 @@ index b2ba5578c76c72df077b46f330f59c1ab52ce561..c5b840f990f9f357d4b63f7e450e91c4
|
||||
|
||||
final boolean collidedX = collided.x != movement.x;
|
||||
final boolean collidedY = collided.y != movement.y;
|
||||
@@ -1802,9 +1824,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1803,9 +1825,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
for (Entity.Movement movement : movements) {
|
||||
Vec3 vec3 = movement.from();
|
||||
Vec3 vec31 = movement.to();
|
||||
@@ -743,7 +743,7 @@ index f14e84e67746208dd188525fb91ab30b190d332b..1d66e5848a7f1b3c5e6b70f2e3835166
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index 2cf701ee91393800347cf44e06d6b6a6f4a99492..9aab4fc49357db20af346c227d8a566ebd3b1f69 100644
|
||||
index 0208a21f1984fff141eb079169bf269d61c26d3d..99b1551df53e42a7e0a6b1fd35603e4500676739 100644
|
||||
--- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -145,6 +145,11 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
|
||||
@@ -21,10 +21,10 @@ index 88b377a53159a473a43bdf06b78bfd3d4a2362a1..539c2e465d4c89584b5bccaad18fadc4
|
||||
} else {entity.inactiveTick();} // Paper - EAR 2
|
||||
profilerFiller.pop();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index e72c6eed0280aab425ae1dfa1d104a2d87651b63..770cc8898b94a0e10b697de6adcd04a3b850bbf6 100644
|
||||
index a80fd65ea35590a992c6340a2f42f578afdaf1ab..8c50cd2cd5b2c1ae5238be359c52b13948472cf7 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -591,6 +591,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -592,6 +592,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return this.physics;
|
||||
}
|
||||
// Sakura end - configure cannon physics
|
||||
@@ -44,7 +44,7 @@ index e72c6eed0280aab425ae1dfa1d104a2d87651b63..770cc8898b94a0e10b697de6adcd04a3
|
||||
|
||||
public Entity(EntityType<?> entityType, Level level) {
|
||||
this.type = entityType;
|
||||
@@ -620,6 +633,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -621,6 +634,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.setPos(0.0, 0.0, 0.0);
|
||||
this.eyeHeight = this.dimensions.eyeHeight();
|
||||
this.despawnTime = type == EntityType.PLAYER ? -1 : level.paperConfig().entities.spawning.despawnTime.getOrDefault(type, io.papermc.paper.configuration.type.number.IntOr.Disabled.DISABLED).or(-1); // Paper - entity despawn time limit
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable left shooting and adjusting limits
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 770cc8898b94a0e10b697de6adcd04a3b850bbf6..5117f1b572eca36f043b78689b8377dc66cfa899 100644
|
||||
index 8c50cd2cd5b2c1ae5238be359c52b13948472cf7..5cf439ad2d823302f306f179151caffa131f7b89 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -604,6 +604,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -605,6 +605,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return Math.max(x, z) >= this.travelDistanceLimit;
|
||||
}
|
||||
// Sakura end - entity travel distance limits
|
||||
@@ -55,7 +55,7 @@ index 770cc8898b94a0e10b697de6adcd04a3b850bbf6..5117f1b572eca36f043b78689b8377dc
|
||||
|
||||
public Entity(EntityType<?> entityType, Level level) {
|
||||
this.type = entityType;
|
||||
@@ -1575,6 +1615,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1576,6 +1616,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
if (xSmaller && z != 0.0) {
|
||||
@@ -63,7 +63,7 @@ index 770cc8898b94a0e10b697de6adcd04a3b850bbf6..5117f1b572eca36f043b78689b8377dc
|
||||
z = this.scanZ(currBoundingBox, z, voxelList, bbList);
|
||||
if (z != 0.0) {
|
||||
currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetZ(currBoundingBox, z);
|
||||
@@ -1582,6 +1623,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1583,6 +1624,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
if (x != 0.0) {
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise check inside blocks and traverse blocks
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 5117f1b572eca36f043b78689b8377dc66cfa899..db49df628a4b35b0cdca48cf3eff372540755b76 100644
|
||||
index 5cf439ad2d823302f306f179151caffa131f7b89..52125b7e0febdc587ae3548a2d123d351207cb4e 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -1888,6 +1888,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1889,6 +1889,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
private void checkInsideBlocks(List<Entity.Movement> movements, Set<BlockState> blocksInside) {
|
||||
if (this.isAffectedByBlocks()) {
|
||||
LongSet set = this.visitedBlocks;
|
||||
@@ -20,7 +20,7 @@ index 5117f1b572eca36f043b78689b8377dc66cfa899..db49df628a4b35b0cdca48cf3eff3725
|
||||
|
||||
for (Entity.Movement movement : movements) {
|
||||
Vec3 vec3 = movement.from();
|
||||
@@ -1907,7 +1912,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1908,7 +1913,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user