9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-27 18:59:06 +00:00

Improve entity merging plugin compatibility

This commit is contained in:
Samsuik
2024-01-28 20:27:11 +00:00
parent c21196e257
commit fc29f27b74
7 changed files with 32 additions and 31 deletions

View File

@@ -178,10 +178,10 @@ index 4a19da041971d9f9031af70ae39798233287b3c9..3ace813ccce8b836edef76a16b92ca99
this.guardEntityTick(this::tickNonPassenger, entity);
gameprofilerfiller.pop();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1bd5db8e0919d126d18e250bb1cb35cb96d63f5c..bc7a65dc8c8718f2e02249ff251764a4fb13f9a7 100644
index 1bd5db8e0919d126d18e250bb1cb35cb96d63f5c..3362751c6b6afcb45bb46e3d09c79fb6508784da 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -575,6 +575,107 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -575,6 +575,108 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return BlockPos.asLong(v.getBlockX(), v.getBlockY(), v.getBlockZ());
}
// Sakura end
@@ -281,6 +281,7 @@ index 1bd5db8e0919d126d18e250bb1cb35cb96d63f5c..bc7a65dc8c8718f2e02249ff251764a4
+ //noinspection ConstantValue
+ if (bukkitEntity != null) {
+ bukkitEntity.setHandle(entity);
+ bukkitEntity = entity.bukkitEntity;
+ }
+
+ discard();
@@ -289,7 +290,7 @@ index 1bd5db8e0919d126d18e250bb1cb35cb96d63f5c..bc7a65dc8c8718f2e02249ff251764a4
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -621,6 +722,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -621,6 +723,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.getEntityData().registrationLocked = true; // Spigot
this.setPos(0.0D, 0.0D, 0.0D);
this.eyeHeight = this.getEyeHeight(net.minecraft.world.entity.Pose.STANDING, this.dimensions);
@@ -297,7 +298,7 @@ index 1bd5db8e0919d126d18e250bb1cb35cb96d63f5c..bc7a65dc8c8718f2e02249ff251764a4
}
public boolean isColliding(BlockPos pos, BlockState state) {
@@ -2337,6 +2439,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2337,6 +2440,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
nbt.putBoolean("Paper.FreezeLock", true);
}
// Paper end
@@ -309,7 +310,7 @@ index 1bd5db8e0919d126d18e250bb1cb35cb96d63f5c..bc7a65dc8c8718f2e02249ff251764a4
return nbt;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2505,6 +2612,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2505,6 +2613,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
@@ -321,7 +322,7 @@ index 1bd5db8e0919d126d18e250bb1cb35cb96d63f5c..bc7a65dc8c8718f2e02249ff251764a4
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
@@ -4619,6 +4731,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4619,6 +4732,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return;
}
// Paper end - rewrite chunk system

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise Fast Movement
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bc7a65dc8c8718f2e02249ff251764a4fb13f9a7..8d7b525c17178e33776e7547cffb20226f588a40 100644
index 3362751c6b6afcb45bb46e3d09c79fb6508784da..225bb97532d494901dfb07582e0f464f9adae6e0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1135,6 +1135,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1136,6 +1136,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
// Paper end - detailed watchdog information
@@ -104,7 +104,7 @@ index bc7a65dc8c8718f2e02249ff251764a4fb13f9a7..8d7b525c17178e33776e7547cffb2022
public void move(MoverType movementType, Vec3 movement) {
// Paper start - detailed watchdog information
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
@@ -1486,6 +1575,92 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1487,6 +1576,92 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return offsetFactor;
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] isPushedByFluid API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c3a028ef2fe49b9afb48b6f871b370b38976a09e..9e8847f1a8e54002f7ccf534dbe9da42a26794e0 100644
index 225bb97532d494901dfb07582e0f464f9adae6e0..944cb81c4196a4f2c8784d7cc3c600e59e89ef34 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -676,6 +676,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -677,6 +677,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
discard();
}
// Sakura end
@@ -16,7 +16,7 @@ index c3a028ef2fe49b9afb48b6f871b370b38976a09e..9e8847f1a8e54002f7ccf534dbe9da42
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -3972,7 +3973,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3973,7 +3974,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean isPushedByFluid() {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise TNT fluid state and pushing
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9e8847f1a8e54002f7ccf534dbe9da42a26794e0..a7c380e4b1be65c1c252dd7644d92a3c85ca6529 100644
index 944cb81c4196a4f2c8784d7cc3c600e59e89ef34..f56aa48748612dbe2dc964efcd5cba04ef1b7bb1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2021,7 +2021,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2022,7 +2022,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return this.isInWater() || flag;
}

View File

@@ -86,7 +86,7 @@ index 93c7be878632296683a794235455013c33bec9e7..c201c7e558205e3ca27db9b1f1486125
x /= distance;
y /= distance;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8e65b9d51 100644
index f56aa48748612dbe2dc964efcd5cba04ef1b7bb1..28e568f3333cf1000a9bd2a39b89a569695e4238 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -363,7 +363,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -98,7 +98,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
public boolean isInPowderSnow;
public boolean wasInPowderSnow;
public boolean wasOnFire;
@@ -677,6 +677,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -678,6 +678,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
// Sakura end
public boolean pushedByFluid = true; // Sakura
@@ -112,7 +112,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -1143,7 +1150,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1144,7 +1151,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -121,7 +121,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
@@ -1161,10 +1168,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1162,10 +1169,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
Vec3 vec3d1 = this.collideScan(movement);
double d0 = vec3d1.lengthSqr();
@@ -134,7 +134,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
BlockHitResult movingobjectpositionblock = this.level.clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
@@ -1200,6 +1207,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1201,6 +1208,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -147,7 +147,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
}
@@ -1240,7 +1253,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1241,7 +1254,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
this.wasOnFire = this.isOnFire();
@@ -156,7 +156,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper
this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper
movement = this.limitPistonMovement(movement);
@@ -1267,8 +1280,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1268,8 +1281,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
Vec3 vec3d1 = this.collide(movement);
double d0 = vec3d1.lengthSqr();
@@ -167,7 +167,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
BlockHitResult movingobjectpositionblock = this.level.clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
@@ -1304,6 +1317,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1305,6 +1318,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -180,7 +180,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
}
@@ -1600,7 +1619,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1601,7 +1620,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
double y = movement.y;
double z = movement.z;
@@ -192,7 +192,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
if (y != 0.0) {
y = scanY(currBoundingBox, y, bbList);
@@ -1707,7 +1729,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1708,7 +1730,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
io.papermc.paper.util.CollisionUtil.addBoxesToIfIntersects(world.getWorldBorder().getCollisionShape(), collisionBox, potentialCollisions);
}
@@ -201,7 +201,7 @@ index 4c0be56d4dba46c4a28ab7149f9280c85a9cbe6e..b682bf36bdde2b5162be7c2b2e1164e8
if (stepHeight > 0.0
&& (this.onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0))
@@ -1826,8 +1848,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1827,8 +1849,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
protected void checkInsideBlocks() {
AABB axisalignedbb = this.getBoundingBox();

View File

@@ -39,10 +39,10 @@ index 9132adee72a2ae9c1c069a4f385c2b8d101484ba..aee02670c421dc238085871021a27266
if (predicate != null && !predicate.test(blockData, mutablePos)) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b682bf36bdde2b5162be7c2b2e1164e8e65b9d51..4e8b0f4e29e8afadf1ae6349c96eb28cbf3bb2bb 100644
index 28e568f3333cf1000a9bd2a39b89a569695e4238..8940b93d3a3bb6b5ee03d64b26d606114d6af64a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -684,6 +684,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -685,6 +685,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return this.physics;
}
// Sakura end

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise check inside blocks and fluids
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a15d5cd0acfba3e3e8ed46dda9fbab671eca4112..2c6dbe4d6c1c9cd6ab67bee2885c3831b758fa09 100644
index 8940b93d3a3bb6b5ee03d64b26d606114d6af64a..5974974bee3008896e4aeb39802ea69d1c50f35d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1867,14 +1867,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1868,14 +1868,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
BlockPos blockposition1 = BlockPos.containing(axisalignedbb.maxX - offset, axisalignedbb.maxY - offset, axisalignedbb.maxZ - offset);
// Sakura end
@@ -46,7 +46,7 @@ index a15d5cd0acfba3e3e8ed46dda9fbab671eca4112..2c6dbe4d6c1c9cd6ab67bee2885c3831
try {
iblockdata.entityInside(this.level, blockposition_mutableblockposition, this);
@@ -4525,7 +4544,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4526,7 +4545,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
@@ -55,7 +55,7 @@ index a15d5cd0acfba3e3e8ed46dda9fbab671eca4112..2c6dbe4d6c1c9cd6ab67bee2885c3831
return false;
} else {
AABB axisalignedbb = this.getBoundingBox().deflate(0.001D);
@@ -4542,11 +4561,30 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4543,11 +4562,30 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
int k1 = 0;
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();