This commit is contained in:
AlphaKR93
2024-01-25 16:10:43 +09:00
parent 04203941c1
commit e12e3db7ef
3 changed files with 38 additions and 46 deletions

View File

@@ -1917,7 +1917,7 @@ index d6cbe98e67fdbf8db46338a88ab1356dd63b50a3..20dd3a63b2f955b05a75eb240e33ae4c
int LARGE_MAX_STACK_SIZE = 64;
int DEFAULT_DISTANCE_LIMIT = 8;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2c06f3ebf7e1069727387bfc60db30c958c14b5a..37977541fee452d1c4ae9a27ee1c9b758fe0dd90 100644
index 2c06f3ebf7e1069727387bfc60db30c958c14b5a..f80a94eaa7d093a01cc4f349516b788d40d66e51 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -308,7 +308,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1929,15 +1929,7 @@ index 2c06f3ebf7e1069727387bfc60db30c958c14b5a..37977541fee452d1c4ae9a27ee1c9b75
private ChunkPos chunkPosition;
private Vec3 deltaMovement;
private float yRot;
@@ -438,6 +438,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public UUID getOriginWorld() {
return this.originWorld;
}
+<<<<<<< HEAD
// Paper end - Entity origin API
// Paper start - make end portalling safe
public BlockPos portalBlock;
@@ -501,6 +502,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -501,6 +501,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this));
}
// Paper end - optimise entity tracking
@@ -1949,7 +1941,7 @@ index 2c06f3ebf7e1069727387bfc60db30c958c14b5a..37977541fee452d1c4ae9a27ee1c9b75
public float getBukkitYaw() {
return this.yRot;
}
@@ -807,6 +813,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -807,6 +812,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public void tick() {
@@ -1962,7 +1954,7 @@ index 2c06f3ebf7e1069727387bfc60db30c958c14b5a..37977541fee452d1c4ae9a27ee1c9b75
this.baseTick();
}
@@ -4402,16 +4414,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4402,16 +4413,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
@@ -1988,7 +1980,7 @@ index 2c06f3ebf7e1069727387bfc60db30c958c14b5a..37977541fee452d1c4ae9a27ee1c9b75
double d1 = 0.0D;
boolean flag = this.isPushedByFluid();
boolean flag1 = false;
@@ -4419,14 +4433,61 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4419,14 +4432,61 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
int k1 = 0;
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
@@ -2056,7 +2048,7 @@ index 2c06f3ebf7e1069727387bfc60db30c958c14b5a..37977541fee452d1c4ae9a27ee1c9b75
if (d2 >= axisalignedbb.minY) {
flag1 = true;
@@ -4448,9 +4509,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4448,9 +4508,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
// CraftBukkit end
}
}

View File

@@ -4231,7 +4231,7 @@ index 1f9e0c139988c4c44a26552881647d36965aa4fa..b8d612d22aca74a08b53393c0723a2ae
@Override
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2ce98683e 100644
index f80a94eaa7d093a01cc4f349516b788d40d66e51..453828b2239b82f99b3bd837b354c901add38644 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -159,7 +159,7 @@ import org.bukkit.plugin.PluginManager;
@@ -4269,7 +4269,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -560,6 +561,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -559,6 +560,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return false;
}
@@ -4295,7 +4295,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
public final boolean hardCollides() {
return this.hardCollides;
}
@@ -580,7 +600,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -579,7 +599,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;
@@ -4304,7 +4304,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
this.remainingFireTicks = -this.getFireImmuneTicks();
this.fluidHeight = new Object2DoubleArrayMap(2);
this.fluidOnEyes = new HashSet();
@@ -832,7 +852,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -831,7 +851,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
// CraftBukkit end
public void baseTick() {
@@ -4313,7 +4313,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups
this.feetBlockState = null;
if (this.isPassenger() && this.getVehicle().isRemoved()) {
@@ -893,7 +913,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -892,7 +912,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
this.firstTick = false;
@@ -4322,7 +4322,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
}
public void setSharedFlagOnFire(boolean onFire) {
@@ -902,10 +922,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -901,10 +921,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public void checkBelowWorld() {
// Paper start - Configurable nether ceiling damage
@@ -4335,7 +4335,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
this.onBelowWorld();
}
@@ -1113,7 +1134,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1112,7 +1133,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
}
@@ -4344,7 +4344,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) {
movement = movement.multiply(this.stuckSpeedMultiplier);
this.stuckSpeedMultiplier = Vec3.ZERO;
@@ -1122,7 +1143,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1121,7 +1142,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
// Paper start - ignore movement changes while inactive.
if (isTemporarilyActive && !(this instanceof ItemEntity || this instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) && movement == getDeltaMovement() && movementType == MoverType.SELF) {
setDeltaMovement(Vec3.ZERO);
@@ -4353,7 +4353,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
return;
}
// Paper end
@@ -1143,8 +1164,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1142,8 +1163,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.setPos(this.getX() + vec3d1.x, this.getY() + vec3d1.y, this.getZ() + vec3d1.z);
}
@@ -4364,7 +4364,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
boolean flag = !Mth.equal(movement.x, vec3d1.x);
boolean flag1 = !Mth.equal(movement.z, vec3d1.z);
@@ -1163,7 +1184,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1162,7 +1183,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.checkFallDamage(vec3d1.y, this.onGround(), iblockdata, blockposition);
if (this.isRemoved()) {
@@ -4373,7 +4373,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
} else {
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -1301,7 +1322,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1300,7 +1321,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.setRemainingFireTicks(-this.getFireImmuneTicks());
}
@@ -4382,7 +4382,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
}
}
// Paper start - detailed watchdog information
@@ -1799,7 +1820,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1798,7 +1819,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public boolean fireImmune() {
@@ -4391,7 +4391,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
}
public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -1872,7 +1893,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1871,7 +1892,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return this.isInWater() || flag;
}
@@ -4400,7 +4400,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
Entity entity = this.getVehicle();
if (entity instanceof Boat) {
@@ -2488,6 +2509,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2487,6 +2508,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
nbttagcompound.putBoolean("Paper.FreezeLock", true);
}
// Paper end
@@ -4412,7 +4412,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2635,6 +2661,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2634,6 +2660,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
@@ -4424,7 +4424,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
@@ -3010,6 +3041,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3009,6 +3040,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.passengers = ImmutableList.copyOf(list);
}
@@ -4438,7 +4438,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
this.gameEvent(GameEvent.ENTITY_MOUNT, passenger);
}
}
@@ -3049,6 +3087,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3048,6 +3086,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return false;
}
// CraftBukkit end
@@ -4453,7 +4453,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -3128,12 +3174,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3127,12 +3173,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return Vec3.directionFromRotation(this.getRotationVector());
}
@@ -4470,7 +4470,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
}
this.isInsidePortal = true;
@@ -3151,7 +3200,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3150,7 +3199,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
ServerLevel worldserver1 = minecraftserver.getLevel(resourcekey);
if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
@@ -4479,7 +4479,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
this.portalTime = i;
// Paper start - Add EntityPortalReadyEvent
io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER);
@@ -3169,7 +3218,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3168,7 +3217,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
} // Paper - Add EntityPortalReadyEvent
// CraftBukkit end
@@ -4488,7 +4488,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
}
this.isInsidePortal = false;
@@ -3184,7 +3233,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3183,7 +3232,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
this.processPortalCooldown();
@@ -4497,7 +4497,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
}
}
@@ -3374,7 +3423,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3373,7 +3422,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public int getMaxAirSupply() {
@@ -4506,7 +4506,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
}
public int getAirSupply() {
@@ -3644,14 +3693,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3643,14 +3692,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Paper end - Fix item duplication and teleport issues
if (this.level() instanceof ServerLevel && !this.isRemoved()) {
@@ -4523,7 +4523,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
PortalInfo shapedetectorshape = (location == null) ? this.findDimensionEntryPoint(worldserver) : new PortalInfo(new Vec3(location.x(), location.y(), location.z()), Vec3.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit
if (shapedetectorshape == null) {
@@ -3690,7 +3739,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3689,7 +3738,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.unRide();
// CraftBukkit end
@@ -4532,7 +4532,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
// Paper start - Fix item duplication and teleport issues
if (this instanceof Mob) {
((Mob) this).dropLeash(true, true); // Paper drop lead
@@ -3717,10 +3766,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3716,10 +3765,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
this.removeAfterChangingDimensions();
@@ -4545,7 +4545,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
return entity;
}
} else {
@@ -3838,7 +3887,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3837,7 +3886,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public boolean canChangeDimensions() {
@@ -4554,7 +4554,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
}
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
@@ -4136,6 +4185,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4135,6 +4184,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return SlotAccess.NULL;
}
@@ -4575,7 +4575,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
@Override
public void sendSystemMessage(Component message) {}
@@ -4413,6 +4476,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4412,6 +4475,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.yRotO = this.getYRot();
}
@@ -4588,7 +4588,7 @@ index 37977541fee452d1c4ae9a27ee1c9b758fe0dd90..4bbede7891d103d68caa6265903479f2
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
if (false && this.touchingUnloadedChunk()) { // Pufferfish - cost of a lookup here is the same cost as below, so skip
return false;
@@ -4973,4 +5042,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4972,4 +5041,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
}
// Paper end - Expose entity id counter

View File

@@ -7,10 +7,10 @@ Subject: [PATCH] Apply various optimizations
Akarin - Swaps the predicate order of collision
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4bbede7891d103d68caa6265903479f2ce98683e..ef30864618d19a52a5cf91559b820f889e1da155 100644
index 453828b2239b82f99b3bd837b354c901add38644..a3db8a329fe30b63704c068223684492e9d30e9c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2145,8 +2145,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2144,8 +2144,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public void playerTouch(Player player) {}
public void push(Entity entity) {
@@ -21,7 +21,7 @@ index 4bbede7891d103d68caa6265903479f2ce98683e..ef30864618d19a52a5cf91559b820f88
if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
@@ -2174,8 +2175,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2173,8 +2174,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
entity.push(d0, 0.0D, d1);
}
}