Modify entity origin API to store world/pos seperatly

This commit is contained in:
Shane Freeder 2021-06-16 06:36:02 +01:00 committed by Jason
parent d8c3fb7e47
commit 86953b2641
33 changed files with 150 additions and 120 deletions

View File

@ -17,7 +17,7 @@ index 88bac72edf19c578902f49d20353989ed4d96f8f..e79faeb26d079de0108268fd2607cf9e
if (index >= 0 && index < this.list.size()) {
Tag tag = this.list.get(index);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2db7c62d25791bc7856d007e9197f8c8041f8dfa..461b376987d3bc7c786fe6d29c5a07a5129c3355 100644
index 94c5631820590d31cfd4e8a4fb2395dd6b395841..a1d5519f2133349a805296132bbe84272818091b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1110,6 +1110,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@ -25,50 +25,71 @@ index 2db7c62d25791bc7856d007e9197f8c8041f8dfa..461b376987d3bc7c786fe6d29c5a07a5
}
}
+ // Paper start - Set origin location when the entity is being added to the world
+ if (entity.origin == null) {
+ entity.origin = entity.getBukkitEntity().getLocation();
+ if (entity.getOriginVector() == null) {
+ entity.setOrigin(entity.getBukkitEntity().getLocation());
+ }
+ // Paper end
}
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a5e3f27a471bf2396db640685edfc93f77fe2c0c..864724d962d536c1a4402a8da1e0b378e9d7efd5 100644
index 4a86e7e9e81a31d7a785279c294c000c559a76d6..e61f3decd7fa30c67acb4b2e4cb9c9c3ce2c9d7a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -280,6 +280,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -280,6 +280,27 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
public boolean forceExplosionKnockback; // SPIGOT-949
public boolean persistentInvisibility = false;
+ public org.bukkit.Location origin; // Paper
+ // Paper start
+ @javax.annotation.Nullable
+ private org.bukkit.util.Vector origin;
+ @javax.annotation.Nullable
+ private UUID originWorld;
+
+ public void setOrigin(@javax.annotation.Nonnull Location location) {
+ this.origin = location.toVector();
+ this.originWorld = location.getWorld().getUID();
+ }
+
+ @javax.annotation.Nullable
+ public org.bukkit.util.Vector getOriginVector() {
+ return this.origin != null ? this.origin.clone() : null;
+ }
+
+ @javax.annotation.Nullable
+ public UUID getOriginWorld() {
+ return this.originWorld;
+ }
+ // Paper
// Spigot start
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
@@ -1813,6 +1814,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1813,6 +1834,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
this.bukkitEntity.storeBukkitValues(nbt);
}
// CraftBukkit end
+ // Paper start - Save the entity's origin location
+ if (this.origin != null) {
+ nbt.setUUID("Paper.OriginWorld", origin.getWorld().getUID());
+ nbt.setUUID("Paper.OriginWorld", originWorld);
+ nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
+ }
+ // Paper end
return nbt;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1939,6 +1946,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1939,6 +1966,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
// CraftBukkit end
+ // Paper start - Restore the entity's origin location
+ ListTag originTag = nbt.getList("Paper.Origin", 6);
+ if (!originTag.isEmpty()) {
+ org.bukkit.World originWorld = level.getWorld();
+ UUID originWorld = level.getWorld().getUID();
+ if (nbt.contains("Paper.OriginWorld")) {
+ originWorld = Bukkit.getWorld(nbt.getUUID("Paper.OriginWorld"));
+ originWorld = nbt.getUUID("Paper.OriginWorld");
+ }
+ origin = new org.bukkit.Location(originWorld, originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
+ this.originWorld = originWorld;
+ origin = new org.bukkit.util.Vector(originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
+ }
+ // Paper end
+
@ -76,7 +97,7 @@ index a5e3f27a471bf2396db640685edfc93f77fe2c0c..864724d962d536c1a4402a8da1e0b378
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 11ed0127e2ea268f16c6b4b380d132a71ec9b3dc..eb838fcad0593573f536d5e043cbd3f4bbe25d74 100644
index 11ed0127e2ea268f16c6b4b380d132a71ec9b3dc..6c262832ba5259ec92d336114c203c254a39924c 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -329,6 +329,14 @@ public class FallingBlockEntity extends Entity {
@ -88,14 +109,14 @@ index 11ed0127e2ea268f16c6b4b380d132a71ec9b3dc..eb838fcad0593573f536d5e043cbd3f4
+ int srcX = nbt.getInt("SourceLoc_x");
+ int srcY = nbt.getInt("SourceLoc_y");
+ int srcZ = nbt.getInt("SourceLoc_z");
+ origin = new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ);
+ this.setOrigin(new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ));
+ }
+ // Paper end
}
public Level getLevel() {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 394164f50256ad9a167e15531a9202875abb6cb6..abc62c560816d945642d830a020deb28ff2efa37 100644
index 394164f50256ad9a167e15531a9202875abb6cb6..8ad1b3cb16533d62deda643ce0cdda308743f78e 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -120,6 +120,14 @@ public class PrimedTnt extends Entity {
@ -107,17 +128,17 @@ index 394164f50256ad9a167e15531a9202875abb6cb6..abc62c560816d945642d830a020deb28
+ int srcX = nbt.getInt("SourceLoc_x");
+ int srcY = nbt.getInt("SourceLoc_y");
+ int srcZ = nbt.getInt("SourceLoc_z");
+ origin = new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ);
+ this.setOrigin(new org.bukkit.Location(level.getWorld(), srcX, srcY, srcZ));
+ }
+ // Paper end
}
@Nullable
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 6722d97d498fb2951b7dd8af3b68dd771ce8f5c1..417357f6a187747a5e27fa60a57cee3fb91f3d2e 100644
index 6722d97d498fb2951b7dd8af3b68dd771ce8f5c1..af1a792a456c2efdc959497c02c1e060ed545724 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1098,4 +1098,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1098,4 +1098,21 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return this.spigot;
}
// Spigot end
@ -125,8 +146,17 @@ index 6722d97d498fb2951b7dd8af3b68dd771ce8f5c1..417357f6a187747a5e27fa60a57cee3f
+ // Paper start
+ @Override
+ public Location getOrigin() {
+ Location origin = getHandle().origin;
+ return origin == null ? null : origin.clone();
+ Vector originVector = this.getHandle().getOriginVector();
+ if (originVector == null) {
+ return null;
+ }
+ World world = this.getWorld();
+ if (this.getHandle().getOriginWorld() != null) {
+ world = org.bukkit.Bukkit.getWorld(this.getHandle().getOriginWorld());
+ }
+
+ //noinspection ConstantConditions
+ return originVector.toLocation(world);
+ }
+ // Paper end
}

View File

@ -29,10 +29,10 @@ index d16ae924bcbe31c964f7fb448757c748e5c4418c..4bba6977a0287837b8927718c040ac61
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 84c2a14d7336d57d5db66d01c75e31a58860d96c..7e7291cc41735a6c251738492a4cdd1c7798066f 100644
index e61f3decd7fa30c67acb4b2e4cb9c9c3ce2c9d7a..dbe30ad6a729c5a99f7ff977134738e509dcadad 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -602,7 +602,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -622,7 +622,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public void checkOutOfWorld() {

View File

@ -23,10 +23,10 @@ index 416a6760883cb40367535c7c5acd779742bb8af5..670efbe53241a0ae32d618c83da601cc
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index cb65a20d34196866eead7844b93c65bfb853f74c..daac0e45a1c5307489831638f54472eaee4b2282 100644
index dbe30ad6a729c5a99f7ff977134738e509dcadad..881e295be6908d0e14147e2d57dd2974aa972725 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2875,7 +2875,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2896,7 +2896,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
double d4 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType());
BlockPos blockposition = new BlockPos(Mth.clamp(this.getX() * d4, d0, d2), this.getY(), Mth.clamp(this.getZ() * d4, d1, d3));
// CraftBukkit start

View File

@ -25,10 +25,10 @@ index abbbe1786eb68af02f9d39650aad730ac44aac8a..3ac2ac3db9b1c271b3c21930bb137166
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index daac0e45a1c5307489831638f54472eaee4b2282..e9e87dc8c80d83dc7c472b0611077d8f9f4e5fcf 100644
index 881e295be6908d0e14147e2d57dd2974aa972725..0d8590368ed35bd95f3b8abcd34eb172ef8ae43b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2524,6 +2524,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2545,6 +2545,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@Nullable
public Team getTeam() {
@ -37,7 +37,7 @@ index daac0e45a1c5307489831638f54472eaee4b2282..e9e87dc8c80d83dc7c472b0611077d8f
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index cc8fb033ca8241acb984e3440a44c7a083e2f3f6..46e514bfe80d999f50173866b59fbc9419bbf3d0 100644
index b750699a64a878fffb5cb6aa1cdda106116bbfb3..f23769ce887bfc646162dd9d14b4ba4cc6790c75 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -803,6 +803,7 @@ public abstract class LivingEntity extends Entity {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Use a Shared Random for Entities
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index e9e87dc8c80d83dc7c472b0611077d8f9f4e5fcf..eceaeed527f34860e1c55b9f96863f140055faa7 100644
index 0d8590368ed35bd95f3b8abcd34eb172ef8ae43b..9aa25ee1e4e3ad205e9e373bbf95d24bd305e078 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -153,6 +153,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@ -31,7 +31,7 @@ index e9e87dc8c80d83dc7c472b0611077d8f9f4e5fcf..eceaeed527f34860e1c55b9f96863f14
private CraftEntity bukkitEntity;
public CraftEntity getBukkitEntity() {
@@ -304,7 +319,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -324,7 +339,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO;
this.nextStep = 1.0F;
@ -41,7 +41,7 @@ index e9e87dc8c80d83dc7c472b0611077d8f9f4e5fcf..eceaeed527f34860e1c55b9f96863f14
this.fluidHeight = new Object2DoubleArrayMap(2);
this.firstTick = true;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
index 2b88f5be9bd0766f28e07251175aa353242cf11f..5faa9e05e041a8bdcac88f3c3af7620353c10c3a 100644
index a24c05706ac8f088f1342ca947c5f1ff0fe80366..3093fc37c47bec1a6e884553809277fff1053d8e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -50,7 +50,7 @@ public class Squid extends WaterAnimal {

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9394dd781bb27b273c442972c5923615ac406507..b1c9a21574d6adba5d01caea0abac16a0e214a8f 100644
index dd7ad5ec09d88722b683acd5921ad3711cececcf..f69b1edf90ee7e368927293d0b039025222d5d40 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1116,6 +1116,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
entity.origin = entity.getBukkitEntity().getLocation();
entity.setOrigin(entity.getBukkitEntity().getLocation());
}
// Paper end
+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 416dd12638540312aa48b530e24ba3ad7ab6079c..ee0efcc86fba880472a6f26f3133d2354a56bf5f 100644
index a015bee73ae4d0aebeb12beb50f6f6d9b1758805..739fee2b1f9df1dd13f7a0f9acb27fc5d40c16a5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2219,6 +2219,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2240,6 +2240,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
protected boolean addPassenger(Entity entity) { // CraftBukkit

View File

@ -27,10 +27,10 @@ index 2dc58b9f769ea43b737804456aafab47ecc143b8..c611b5a63498f5ad1f50a75ccd5d7299
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ee0efcc86fba880472a6f26f3133d2354a56bf5f..0204bde9802429aca5470c235cb10232e5c8f58a 100644
index 739fee2b1f9df1dd13f7a0f9acb27fc5d40c16a5..23342cd50e4722dd80c0d32057b6473f68963652 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -301,6 +301,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -321,6 +321,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
@ -39,7 +39,7 @@ index ee0efcc86fba880472a6f26f3133d2354a56bf5f..0204bde9802429aca5470c235cb10232
// Spigot end
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 971e4c6d742e0c63b3c5dfa6d87b2468f8ce5010..f0357f9d7b6a39bbdf6486a9d35d890942cc5e4c 100644
index 70804eb057cc7d6605e045baf6b9ffdb8cb2d477..8044082ed3ca6076af38e4299e50f1f690d02a72 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3224,8 +3224,11 @@ public abstract class LivingEntity extends Entity {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2b804995d608eaa7e317287cf8d944c2e96a65fb..1603a0ff6a0c82e18ef5446c129a1c05488abf86 100644
index 23342cd50e4722dd80c0d32057b6473f68963652..01b3dca8b90d38c5fbe23e72769f54bd87144772 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -301,6 +301,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -321,6 +321,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
@ -16,8 +16,8 @@ index 2b804995d608eaa7e317287cf8d944c2e96a65fb..1603a0ff6a0c82e18ef5446c129a1c05
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1840,6 +1841,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
nbt.setUUID("Paper.OriginWorld", origin.getWorld().getUID());
@@ -1860,6 +1861,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
nbt.setUUID("Paper.OriginWorld", originWorld);
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
}
+ // Save entity's from mob spawner status
@ -27,9 +27,9 @@ index 2b804995d608eaa7e317287cf8d944c2e96a65fb..1603a0ff6a0c82e18ef5446c129a1c05
// Paper end
return nbt;
} catch (Throwable throwable) {
@@ -1976,6 +1981,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
origin = new org.bukkit.Location(originWorld, originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
@@ -1997,6 +2002,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
this.originWorld = originWorld;
origin = new org.bukkit.util.Vector(originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
}
+
+ spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -49,12 +49,12 @@ index 037dafb59e54047d1d54474c44897d35b8f46c98..e310c1eb1108780bcff4d7ba9d49cefa
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
Entity vehicle = entity.getVehicle();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 808169e6d78b9e3647763239bbd05fcfba6449a6..a2a7b6a62ea1292fce37581863bee931d1497223 100644
index 52f9c17558ed19e7ff3e913287bcd4f6014630fe..e132d38199766e3e787169501d8bb05964506e0f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1135,5 +1135,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Location origin = getHandle().origin;
return origin == null ? null : origin.clone();
@@ -1144,5 +1144,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
//noinspection ConstantConditions
return originVector.toLocation(world);
}
+
+ @Override

View File

@ -6,10 +6,10 @@ Subject: [PATCH] add more information to Entity.toString()
UUID, ticks lived, valid, dead
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 75aae3301ea1cef6fdeb1155e880a7451e76fb02..2ec198a29b85bf118f05a639d6290334ab3810d6 100644
index 01b3dca8b90d38c5fbe23e72769f54bd87144772..1533eaa192a0116bff94707ca7c2604c40f7d7bb 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2784,7 +2784,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2805,7 +2805,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public String toString() {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0be7bd3c5deef99f9ffe6d3d6390c9297d5b5815..0680ed44a47cfafdff400dd3033c9600afd3514b 100644
index fc64814fd2db9e0eb2b54fd79c049c01e523c97d..6506626389e5dac0907747868b210f07d0a961d0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2341,6 +2341,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2362,6 +2362,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
this.setYHeadRot(yaw);
}

View File

@ -17,10 +17,10 @@ index 3ca3a1c16ea0900bfb868a6e2fc88e3522bf7752..8beca0412c65ad03376fb76e2d993bc8
this.fallDistance = 0;
this.foodData = new FoodData(this);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0680ed44a47cfafdff400dd3033c9600afd3514b..62bb61b6f8e099eddf3ad12b7ff47f62cab2eaa9 100644
index 6506626389e5dac0907747868b210f07d0a961d0..5de194823ed9980cad5845268af123974853d6c1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2587,6 +2587,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2608,6 +2608,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}

View File

@ -41,10 +41,10 @@ index 8beca0412c65ad03376fb76e2d993bc841bf9e0b..77d9a4ce7be345b6a999a0269b26c0e6
if (entity1 != entity && this.connection != null) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 62bb61b6f8e099eddf3ad12b7ff47f62cab2eaa9..f95b6e77318f18c62b7c7dda2be23161ddd914d7 100644
index 5de194823ed9980cad5845268af123974853d6c1..7cca53fbd5f56e274284ff6c26516e67f48acb5f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2214,12 +2214,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2235,12 +2235,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
@ -62,7 +62,7 @@ index 62bb61b6f8e099eddf3ad12b7ff47f62cab2eaa9..f95b6e77318f18c62b7c7dda2be23161
}
}
@@ -2282,7 +2285,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2303,7 +2306,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
return true; // CraftBukkit
}
@ -74,7 +74,7 @@ index 62bb61b6f8e099eddf3ad12b7ff47f62cab2eaa9..f95b6e77318f18c62b7c7dda2be23161
if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
@@ -2292,7 +2298,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2313,7 +2319,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
VehicleExitEvent event = new VehicleExitEvent(
(Vehicle) this.getBukkitEntity(),
@ -83,7 +83,7 @@ index 62bb61b6f8e099eddf3ad12b7ff47f62cab2eaa9..f95b6e77318f18c62b7c7dda2be23161
);
// Suppress during worldgen
if (this.valid) {
@@ -2306,7 +2312,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2327,7 +2333,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
// CraftBukkit end
// Spigot start

View File

@ -10,7 +10,7 @@ persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f1d08ad4f29eb2b94dc24962bac177397df1110c..efc4d75baca19bb2c89be26e6880116dd9774b1b 100644
index 479bea88e497adfe8cfacd53b5de825bba8e4722..278d8cc1987fd6edf5bd316d6a9163f8824ee654 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1111,6 +1111,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
@ -35,7 +35,7 @@ index ea336bdf2f15aabe74de82ef6c29b93573254e31..da3100d6577166e222164c174b280205
});
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f95b6e77318f18c62b7c7dda2be23161ddd914d7..b2275c1171f52cbdf283d210c6488e974fa07d98 100644
index 7cca53fbd5f56e274284ff6c26516e67f48acb5f..44835dc1a22d485ec3205d375a14be165a87b613 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -67,6 +67,8 @@ import net.minecraft.world.InteractionHand;
@ -55,8 +55,8 @@ index f95b6e77318f18c62b7c7dda2be23161ddd914d7..b2275c1171f52cbdf283d210c6488e97
// Paper end
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
@@ -1843,6 +1846,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
nbt.setUUID("Paper.OriginWorld", origin.getWorld().getUID());
@@ -1863,6 +1866,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
nbt.setUUID("Paper.OriginWorld", originWorld);
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
}
+ if (spawnReason != null) {
@ -65,7 +65,7 @@ index f95b6e77318f18c62b7c7dda2be23161ddd914d7..b2275c1171f52cbdf283d210c6488e97
// Save entity's from mob spawner status
if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true);
@@ -1985,6 +1991,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2006,6 +2012,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -105,10 +105,10 @@ index 7bf688057d684aa1b60f29294c9a7e81ab6742d1..66ae43c40d4bad373b3a5269e8c78d7a
// Spigot Start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index d0774636b151e8dbd778f2e2f2e3de154ff18494..98d3818d38f487fc7e1302ee4af9e4898efec809 100644
index 7f1d9932e0e4e09c3727544d053ad61a365290af..5bf488e5ed1981ef121291867062c2c2efaed6fc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1164,5 +1164,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1173,5 +1173,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean fromMobSpawner() {
return getHandle().spawnedViaMobSpawner;
}

View File

@ -14,7 +14,7 @@ Adds flying monsters to control ghast and phantoms
Adds villagers as separate config
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 30ccb9c0ffabfe5536c89d1dafb97afb467371a7..9514eace33ef9de9a1d92f602549552456dc4ceb 100644
index 9f53a439fe196f2347dd4eb5b05c1fe80beb593f..256ae7b9e587402648133498e35fa18f8c0be455 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -124,10 +124,10 @@ index 30ccb9c0ffabfe5536c89d1dafb97afb467371a7..9514eace33ef9de9a1d92f6025495524
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b2275c1171f52cbdf283d210c6488e974fa07d98..4ea2bea8641e08bb0350582efc8b43293703c453 100644
index 44835dc1a22d485ec3205d375a14be165a87b613..751e87bc953192a5688ac84765dcb30916d85c3d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -306,6 +306,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -326,6 +326,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
@ -135,7 +135,7 @@ index b2275c1171f52cbdf283d210c6488e974fa07d98..4ea2bea8641e08bb0350582efc8b4329
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
@@ -747,6 +748,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -767,6 +768,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
} else {
this.wasOnFire = this.isOnFire();
if (movementType == MoverType.PISTON) {
@ -143,7 +143,7 @@ index b2275c1171f52cbdf283d210c6488e974fa07d98..4ea2bea8641e08bb0350582efc8b4329
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
@@ -759,6 +761,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -779,6 +781,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
this.stuckSpeedMultiplier = Vec3.ZERO;
this.setDeltaMovement(Vec3.ZERO);
}

View File

@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the
heightmap resolves the issue without having to load all spawn chunks.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4ea2bea8641e08bb0350582efc8b43293703c453..1569ef6efd811c173dc421761f433152cca9f9ea 100644
index 751e87bc953192a5688ac84765dcb30916d85c3d..8e9dd40960bcf2c8685a2d8b33a2cc8eb4b292de 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2984,6 +2984,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -3005,6 +3005,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
BlockPos blockposition1;
if (flag1) {

View File

@ -21,10 +21,10 @@ index b6d680d6d6762125db180638ee43bf9ece4dc51a..c9b5f662b94e47a25949449af8ce42ed
private void lightQueueSize() {
lightQueueSize = getInt("light-queue-size", lightQueueSize);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1569ef6efd811c173dc421761f433152cca9f9ea..745d540572b901ae4a20dd13486d0bbc8aba9573 100644
index 8e9dd40960bcf2c8685a2d8b33a2cc8eb4b292de..ed46bb23229b80c929e28bc0b128dfa494460a55 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -308,6 +308,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -328,6 +328,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive = false; // Paper
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
@ -32,7 +32,7 @@ index 1569ef6efd811c173dc421761f433152cca9f9ea..745d540572b901ae4a20dd13486d0bbc
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1862,6 +1863,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1882,6 +1883,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true);
}
@ -42,7 +42,7 @@ index 1569ef6efd811c173dc421761f433152cca9f9ea..745d540572b901ae4a20dd13486d0bbc
// Paper end
return nbt;
} catch (Throwable throwable) {
@@ -2000,6 +2004,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2021,6 +2025,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status

View File

@ -250,10 +250,10 @@ index 3a13c151066c8784fdc844e1d6310f77ff32e7f1..c4242a1602bbb02541c330bc02016f15
Iterator iterator = list.iterator();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 581f80c490932f66f57e7a91d8738e09521f5a1c..20f861c99b11844849d75ce4606abee80da147de 100644
index ca458234ec19708954fc051b3594ca3004f245ed..03c915c52f81d7a96c858000d58bfcec329df85f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1491,7 +1491,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1511,7 +1511,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
this.yo = y;
this.zo = d4;
this.setPos(d3, y, d4);

View File

@ -7,10 +7,10 @@ The code following this has better support for null worlds to move
them back to the world spawn.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 20f861c99b11844849d75ce4606abee80da147de..5ed88a5b233267aef1c7b12fe994262efc3c9dc2 100644
index 03c915c52f81d7a96c858000d58bfcec329df85f..309bd9d45b74ccb1f72cabe0911b5979091a796d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1980,9 +1980,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2000,9 +2000,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
bworld = server.getWorld(worldName);
}

View File

@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the
same item twice because the source was destroyed.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5ed88a5b233267aef1c7b12fe994262efc3c9dc2..83dc25cfc557cd79e3e0596d9cb319bb9dafb126 100644
index 309bd9d45b74ccb1f72cabe0911b5979091a796d..2003e18898a12ad8ef0312ec4d9f337263ae7d33 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2126,11 +2126,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2147,11 +2147,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
} else {
// CraftBukkit start - Capture drops for death event
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
@ -34,7 +34,7 @@ index 5ed88a5b233267aef1c7b12fe994262efc3c9dc2..83dc25cfc557cd79e3e0596d9cb319bb
entityitem.setDefaultPickUpDelay();
// CraftBukkit start
@@ -2874,6 +2875,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2895,6 +2896,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@Nullable
public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
// CraftBukkit end
@ -47,7 +47,7 @@ index 5ed88a5b233267aef1c7b12fe994262efc3c9dc2..83dc25cfc557cd79e3e0596d9cb319bb
if (this.level instanceof ServerLevel && !this.isRemoved()) {
this.level.getProfiler().push("changeDimension");
// CraftBukkit start
@@ -2894,6 +2901,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2915,6 +2922,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
// CraftBukkit end
this.level.getProfiler().popPush("reloading");
@ -59,7 +59,7 @@ index 5ed88a5b233267aef1c7b12fe994262efc3c9dc2..83dc25cfc557cd79e3e0596d9cb319bb
Entity entity = this.getType().create((Level) worldserver);
if (entity != null) {
@@ -2907,10 +2919,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2928,10 +2940,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
// CraftBukkit start - Forward the CraftEntity to the new entity
this.getBukkitEntity().setHandle(entity);
entity.bukkitEntity = this.getBukkitEntity();
@ -70,7 +70,7 @@ index 5ed88a5b233267aef1c7b12fe994262efc3c9dc2..83dc25cfc557cd79e3e0596d9cb319bb
// CraftBukkit end
}
@@ -3035,7 +3043,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -3056,7 +3064,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public boolean canChangeDimensions() {

View File

@ -312,7 +312,7 @@ index 28afe2f238ded241acf77c3272a44068646b9133..6b492b72b177e3c58580561585609b17
List<Entity> list = this.entity.getPassengers();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 83dc25cfc557cd79e3e0596d9cb319bb9dafb126..b2a53fde2ba0316c33a4bfc58020849d5db02b51 100644
index 2003e18898a12ad8ef0312ec4d9f337263ae7d33..3816c478551df2dad89d6fc42576d8050d4cb249 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -50,6 +50,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;
@ -323,7 +323,7 @@ index 83dc25cfc557cd79e3e0596d9cb319bb9dafb126..b2a53fde2ba0316c33a4bfc58020849d
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
@@ -323,6 +324,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -343,6 +344,21 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
// CraftBukkit end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b2a53fde2ba0316c33a4bfc58020849d5db02b51..9d08ebbbf2f3ff710022fb3ef1fce802a15f1b4e 100644
index 3816c478551df2dad89d6fc42576d8050d4cb249..2dcf344bcbc17fbe1ebca29756c36e36b06b7185 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -540,7 +540,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -560,7 +560,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public void setPos(double x, double y, double z) {
this.setPosRaw(x, y, z);
@ -17,7 +17,7 @@ index b2a53fde2ba0316c33a4bfc58020849d5db02b51..9d08ebbbf2f3ff710022fb3ef1fce802
}
protected AABB makeBoundingBox() {
@@ -3717,6 +3717,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -3738,6 +3738,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public final void setPosRaw(double x, double y, double z) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize WorldBorder collision checks and air
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9d08ebbbf2f3ff710022fb3ef1fce802a15f1b4e..d961faf2609ef820d27837b8f0bf6382f9ce97b6 100644
index 2dcf344bcbc17fbe1ebca29756c36e36b06b7185..3352097dfbee8ed374e55d4ef9b7f9b2e0c8b58c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1024,7 +1024,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1044,7 +1044,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
AABB axisalignedbb = this.getBoundingBox();
CollisionContext voxelshapecollision = CollisionContext.of(this);
VoxelShape voxelshape = this.level.getWorldBorder().getCollisionShape();

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add entity liquid API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d961faf2609ef820d27837b8f0bf6382f9ce97b6..6ae4da8ccff3627b37c4b0c0b65d23a37513fecc 100644
index 3352097dfbee8ed374e55d4ef9b7f9b2e0c8b58c..831290b1f2a6fd0e683085b0cbaee68ee7d1cf5e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1319,7 +1319,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1339,7 +1339,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
return this.isInWater() || this.isInRain();
}
@ -17,10 +17,10 @@ index d961faf2609ef820d27837b8f0bf6382f9ce97b6..6ae4da8ccff3627b37c4b0c0b65d23a3
return this.isInWater() || this.isInRain() || this.isInBubbleColumn();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 98d3818d38f487fc7e1302ee4af9e4898efec809..a13042367ac284ce23d799eba1330aa2777173e7 100644
index 5bf488e5ed1981ef121291867062c2c2efaed6fc..9fa6368733b14024b6530684b458b601adc69689 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1169,5 +1169,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1178,5 +1178,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason() {
return getHandle().spawnReason;
}

View File

@ -31,7 +31,7 @@ index ffc64bd05428f147c03e242d9f9a134cd560c452..93fc13fa6f631f779227262fb9aeebe4
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6ae4da8ccff3627b37c4b0c0b65d23a37513fecc..1e7e1a85195b62ccb379db020fe87bf150cab6ba 100644
index 831290b1f2a6fd0e683085b0cbaee68ee7d1cf5e..5369ef871c7a8c2d84629ad06906d46dc5d54861 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -152,6 +152,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@ -42,7 +42,7 @@ index 6ae4da8ccff3627b37c4b0c0b65d23a37513fecc..1e7e1a85195b62ccb379db020fe87bf1
static boolean isLevelAtLeast(CompoundTag tag, int level) {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@@ -1522,6 +1523,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1542,6 +1543,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public void moveTo(double x, double y, double z, float yaw, float pitch) {
@ -69,7 +69,7 @@ index a87531f4669c7947e02764b5ceb098385ad99159..9228c0bc797fb95c8ac949bdc568eada
if (entity instanceof Mob) {
Mob entityinsentient = (Mob) entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index a13042367ac284ce23d799eba1330aa2777173e7..5d11d573a68bea7b341bb987b6cfb998bd1b74fb 100644
index 9fa6368733b14024b6530684b458b601adc69689..5929caf68b37470298012fd48dd1b62b005fdf89 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -563,7 +563,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1e7e1a85195b62ccb379db020fe87bf150cab6ba..80b8e5751dd4c2617602ac2fc81263233b549a5e 100644
index 5369ef871c7a8c2d84629ad06906d46dc5d54861..3dcbd9f3e17a52441100b2b89e83dc5a91a7031e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3904,4 +3904,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -3925,4 +3925,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
void accept(Entity entity, double x, double y, double z);
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 80b8e5751dd4c2617602ac2fc81263233b549a5e..73b19cfa45225d838e5e7fd6a0903ab9f13a5859 100644
index 3dcbd9f3e17a52441100b2b89e83dc5a91a7031e..24d955c436b4ecf95a0bd0b0ff30b3794df9798e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -52,6 +52,7 @@ import net.minecraft.resources.ResourceKey;
@ -16,7 +16,7 @@ index 80b8e5751dd4c2617602ac2fc81263233b549a5e..73b19cfa45225d838e5e7fd6a0903ab9
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.level.TicketType;
@@ -3909,5 +3910,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -3930,5 +3931,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}
@ -27,10 +27,10 @@ index 80b8e5751dd4c2617602ac2fc81263233b549a5e..73b19cfa45225d838e5e7fd6a0903ab9
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 5d11d573a68bea7b341bb987b6cfb998bd1b74fb..b75a14a3af6c23128010f37f10cf78e477b72c4f 100644
index 5929caf68b37470298012fd48dd1b62b005fdf89..281d9ff8c7741d44131743271046af07d34ba21d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1193,5 +1193,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1202,5 +1202,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean isInLava() {
return getHandle().isInLava();
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix CME on adding a passenger in CreatureSpawnEvent
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 73b19cfa45225d838e5e7fd6a0903ab9f13a5859..2e2effe72235bda3c9ef985840d4322551625ed8 100644
index 24d955c436b4ecf95a0bd0b0ff30b3794df9798e..e0d98ed993414f5834dcbd4c4b482209a5cb4188 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3413,7 +3413,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -3434,7 +3434,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
private Stream<Entity> getIndirectPassengersStream() {

View File

@ -21,10 +21,10 @@ index f4b533b8e8b6c4bb59d032e91a94353f4b201b69..5344d25e7bef34954aa058ec019b4ba8
private void keepLoadedRange() {
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2e2effe72235bda3c9ef985840d4322551625ed8..75860a8c0373d3675e3b7e20d7b427f787ebd16b 100644
index e0d98ed993414f5834dcbd4c4b482209a5cb4188..143f4b9e7247d0d715a69aff69d5652bc9343fa0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1704,6 +1704,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1724,6 +1724,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public boolean isPushable() {

View File

@ -41,10 +41,10 @@ index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f9
public Vec3 updateEntityPosition(Vec3 orig) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 75860a8c0373d3675e3b7e20d7b427f787ebd16b..1e82f9b9fc83cd39fecd5e0a99ca457e8c371558 100644
index 143f4b9e7247d0d715a69aff69d5652bc9343fa0..5e9fd6e501df6a84e508cde01e456323d6707b3e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3731,6 +3731,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -3752,6 +3752,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public final void setPosRaw(double x, double y, double z) {

View File

@ -28,10 +28,10 @@ index aefc43e5fdcecb268a83a31cb6d4e4c4facebe4d..cc15735a8a63952724facf3e053c6776
public int wanderingTraderSpawnDayTicks = 24000;
public int wanderingTraderSpawnChanceFailureIncrement = 25;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1e82f9b9fc83cd39fecd5e0a99ca457e8c371558..1d29f8bb0829705aeae1b387ebf484e5eb504ef5 100644
index 5e9fd6e501df6a84e508cde01e456323d6707b3e..b3bb5bfa00a74240496cfb2df212a92582802fa6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1587,6 +1587,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -1607,6 +1607,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) {

View File

@ -21,7 +21,7 @@ index 02a3033bf5c0f99fbedb900f83ace2bf6bd60ee2..d55bebc250a6d43a292477811a938575
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
index 2c4c1fc2a2afe88864b72d86708a3ddb6a1f50a0..567a9755e7ef0d6bf1803a3ba8460fb7de2e66b1 100644
index 2c4c1fc2a2afe88864b72d86708a3ddb6a1f50a0..b643a2449e329560c936c0a06fb4cc494d0737a7 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
@@ -31,6 +31,7 @@ public class EndCrystal extends Entity {
@ -38,7 +38,7 @@ index 2c4c1fc2a2afe88864b72d86708a3ddb6a1f50a0..567a9755e7ef0d6bf1803a3ba8460fb7
}
+ // Paper start - Fix invulnerable end crystals
+ if (this.level.paperConfig.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
+ if ((this.origin.getWorld() != null && !((ServerLevel) this.level).uuid.equals(this.origin.getWorld().getUID()))
+ if (!java.util.Objects.equals(((ServerLevel) this.level).uuid, this.getOriginWorld())
+ || ((ServerLevel) this.level).dragonFight() == null
+ || ((ServerLevel) this.level).dragonFight().respawnStage == null
+ || ((ServerLevel) this.level).dragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) {

View File

@ -11,10 +11,10 @@ Move the tick logic into the post tick, where portaling was
designed to happen in the first place.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1d29f8bb0829705aeae1b387ebf484e5eb504ef5..05e0d36b2241c2950b8741444b32aae8a5e4fc98 100644
index b3bb5bfa00a74240496cfb2df212a92582802fa6..3747b90d76c3a3aed3421c680d196a9caf9c3602 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -341,6 +341,37 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -361,6 +361,37 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
// Paper end - optimise entity tracking
@ -52,7 +52,7 @@ index 1d29f8bb0829705aeae1b387ebf484e5eb504ef5..05e0d36b2241c2950b8741444b32aae8
public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
this.passengers = ImmutableList.of();
@@ -2487,6 +2518,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
@@ -2508,6 +2539,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
this.processPortalCooldown();