aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0358-Entity-Jump-API.patch
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2022-09-26 01:02:51 -0700
committerGitHub <[email protected]>2022-09-26 01:02:51 -0700
commit01a13871deefa50e186a10b63f71c5e0459e7d30 (patch)
treecaf7056fa3ad155645b2dec6046b13841eb5d4a2 /patches/server/0358-Entity-Jump-API.patch
parentabe53a7eb477664aba5f32ff22d81f11ed48a44d (diff)
downloadPaper-01a13871deefa50e186a10b63f71c5e0459e7d30.tar.gz
Paper-01a13871deefa50e186a10b63f71c5e0459e7d30.zip
Rewrite chunk system (#8177)
Patch documentation to come Issues with the old system that are fixed now: - World generation does not scale with cpu cores effectively. - Relies on the main thread for scheduling and maintaining chunk state, dropping chunk load/generate rates at lower tps. - Unreliable prioritisation of chunk gen/load calls that block the main thread. - Shutdown logic is utterly unreliable, as it has to wait for all chunks to unload - is it guaranteed that the chunk system is in a state on shutdown that it can reliably do this? Watchdog shutdown also typically failed due to thread checks, which is now resolved. - Saving of data is not unified (i.e can save chunk data without saving entity data, poses problems for desync if shutdown is really abnormal. - Entities are not loaded with chunks. This caused quite a bit of headache for Chunk#getEntities API, but now the new chunk system loads entities with chunks so that they are ready whenever the chunk loads in. Effectively brings the behavior back to 1.16 era, but still storing entities in their own separate regionfiles. The above list is not complete. The patch documentation will complete it. New chunk system hard relies on starlight and dataconverter, and most importantly the new concurrent utilities in ConcurrentUtil. Some of the old async chunk i/o interface (i.e the old file io thread reroutes _some_ calls to the new file io thread) is kept for plugin compat reasons. It will be removed in the next major version of minecraft. The old legacy chunk system patches have been moved to the removed folder in case we need them again.
Diffstat (limited to 'patches/server/0358-Entity-Jump-API.patch')
-rw-r--r--patches/server/0358-Entity-Jump-API.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/patches/server/0358-Entity-Jump-API.patch b/patches/server/0358-Entity-Jump-API.patch
new file mode 100644
index 0000000000..eb51ab24b2
--- /dev/null
+++ b/patches/server/0358-Entity-Jump-API.patch
@@ -0,0 +1,73 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: BillyGalbreath <[email protected]>
+Date: Sat, 8 Feb 2020 23:26:11 -0600
+Subject: [PATCH] Entity Jump API
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
+index 7e7128973153f4c3a737c1e956e41bab0e85c69a..a5b532a6051f9313bb5042bf61712015768b5426 100644
+--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
+@@ -3240,8 +3240,10 @@ public abstract class LivingEntity extends Entity {
+ } else if (this.isInLava() && (!this.onGround || d7 > d8)) {
+ this.jumpInLiquid(FluidTags.LAVA);
+ } else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) {
++ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
+ this.jumpFromGround();
+ this.noJumpDelay = 10;
++ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
+ }
+ } else {
+ this.noJumpDelay = 0;
+diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
+index dbcf70dacf99b61c0147b43edd6a374b31809733..9c07e3f5554b3b9cf2a2c4d9239a72342567d7f1 100644
+--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
++++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
+@@ -515,7 +515,9 @@ public class Panda extends Animal {
+ Panda entitypanda = (Panda) iterator.next();
+
+ if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.canPerformAction()) {
++ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
+ entitypanda.jumpFromGround();
++ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
+ }
+ }
+
+diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+index f747aa85beab98fbecdbe15b188be6614478bac6..a0eee7dc73bd4a96d9a1aa9555093820c5f7c49c 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
++++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+@@ -177,7 +177,9 @@ public class Ravager extends Raider {
+ }
+
+ if (!flag && this.onGround) {
++ if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper
+ this.jumpFromGround();
++ } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop
+ }
+ }
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+index fb92f55ae3c8c54edce7565b27fb84f50ee85702..ee6783220de6c3142810744a68fda51367589bd1 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+@@ -870,5 +870,19 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
+ public org.bukkit.inventory.EquipmentSlot getHandRaised() {
+ return getHandle().getUsedItemHand() == net.minecraft.world.InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
+ }
++
++ @Override
++ public boolean isJumping() {
++ return getHandle().jumping;
++ }
++
++ @Override
++ public void setJumping(boolean jumping) {
++ getHandle().setJumping(jumping);
++ if (jumping && getHandle() instanceof Mob) {
++ // this is needed to actually make a mob jump
++ ((Mob) getHandle()).getJumpControl().jump();
++ }
++ }
+ // Paper end
+ }