This commit is contained in:
Jake Potrebic 2024-06-13 12:04:27 -07:00
parent 0b7552272a
commit ec05cb8b38
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
86 changed files with 509 additions and 526 deletions

View file

@ -5,21 +5,22 @@ Subject: [PATCH] WitchReadyPotionEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index a14e00d55930628333cc63b18727ea56dbdc4ee3..a84f873b27bc3bc1ed3c2769e02a88fec37289fe 100644
index a14e00d55930628333cc63b18727ea56dbdc4ee3..f6d01d21745391595d61b191832be4c28a3e58cb 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -151,6 +151,11 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -151,7 +151,11 @@ public class Witch extends Raider implements RangedAttackMob {
}
if (holder != null) {
- this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder));
+ // Paper start
+ ItemStack potion = PotionContents.createItemStack(Items.POTION, holder);
+ potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion);
+ this.setItemSlot(EquipmentSlot.MAINHAND, potion);
+ // Paper end
this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder));
this.usingTime = this.getMainHandItem().getUseDuration(this);
this.setUsingItem(true);
if (!this.isSilent()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 000a95dfd5c83b84fcd973a388a705d9470a4fe0..4e0db83bb6a4529b6e0727ea181bf79e06c2025a 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index b76b637ff940dde21647d1f34acd59a23159bb3c..c49aad3a4b2dbb6db1ac10e668b196b6bea3b7f3 100644
index 92384c2da9a15a781794e16176349eb39d012696..6b57500b2265be637c8d21807867341202305d59 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -277,6 +277,7 @@ public class Creeper extends Monster implements PowerableMob {
@@ -278,6 +278,7 @@ public class Creeper extends Monster implements PowerableMob {
// CraftBukkit start
} else {
this.swell = 0;

View file

@ -21,10 +21,10 @@ check is essentially the same as this.getHandle() == other.getHandle()
However, replaced it too to make it clearer of intent.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 88e0ac38214c537ea8be5d23a17ac5a58acd3682..621970006f21d219784dc58d7aa8d6062c4620f1 100644
index 69b5946625a53a1351ffc4bdf61c6874949bbeae..bddf98bdf60473eb1d2e533cf533ed7eee797aaa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -500,14 +500,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -502,14 +502,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return false;
}
final CraftEntity other = (CraftEntity) obj;

View file

@ -5,15 +5,15 @@ Subject: [PATCH] Make shield blocking delay configurable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 2bb22c70c52a98abc0f4839ae67e9d27c320251a..249b73a3d794a7bb84e3fdd85ef6c8725d7adae1 100644
index 77365cfbaf6b9eb2ebefdf174066b40d120fc295..804d5c53e9d0abd89168687395e3ab2e4bc08930 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3911,12 +3911,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3938,12 +3938,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem();
- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= 5;
+ return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= getShieldBlockingDelay(); // Paper - Make shield blocking delay configurable
- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= 5;
+ return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= getShieldBlockingDelay(); // Paper - Make shield blocking delay configurable
} else {
return false;
}
@ -35,10 +35,10 @@ index 2bb22c70c52a98abc0f4839ae67e9d27c320251a..249b73a3d794a7bb84e3fdd85ef6c872
return this.isShiftKeyDown();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index d77c31a8b41df69d11c1ce4b77975e9a38e317b3..0e3b9c2d7ae5091f5c485ec679852476d816f083 100644
index fe631496aa551a0029eff7b4d4a5daf16dddac50..bb81e0bfe0692e8f8421758cd21c003978853a08 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -840,5 +840,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -842,5 +842,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setArrowsStuck(final int arrows) {
this.getHandle().setArrowCount(arrows);
}

View file

@ -9,10 +9,10 @@ Adds missing call to Illagers and also adds Arrow ItemStack to skeletons
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index a400e905201aea94e1d601737f352ef5f8edc927..a19a51a40d69ad71b85b2e7e8b4cfab6d8343196 100644
index 1bf013a10502395d9f432f80c517d5c9a50f5eab..aec440d32eb97fa8ce738b98dae1cdc346e8a59b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -201,7 +201,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@@ -205,7 +205,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
// CraftBukkit start
@ -22,10 +22,10 @@ index a400e905201aea94e1d601737f352ef5f8edc927..a19a51a40d69ad71b85b2e7e8b4cfab6
event.getProjectile().remove();
return;
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
index 1be35d24c7ed4160e0c45435fce2dee0a2b99ed1..a7964208c952cb4e34916ae6523850fc3921b07e 100644
index 93e3454de0b0d62895f165b0772526f3eae1e333..c858556ea457931aa14e338e20672cb50cb19f0e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
@@ -183,8 +183,18 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
@@ -185,8 +185,18 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));

View file

@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index c7865bb6fa7fbeee365a70a4858b0addb36d4165..338903091e43b71baa46157a95629c2e6b27b992 100644
index 6ff215c3d6db1627eda20ba09a3e10eaba589d99..d20389c6d73114810ab8dc20a02b09db4f1971f1 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -2219,18 +2219,29 @@ public abstract class Player extends LivingEntity {
@@ -2233,18 +2233,29 @@ public abstract class Player extends LivingEntity {
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
}

View file

@ -11,16 +11,13 @@ Co-authored-by: aerulion <aerulion@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 655ce0b58cc327a8dac1b006bec7dcb34964da0a..afc2e4a3eda78a47209581307c100663cdeb1afb 100644
index d790aec175e61bd9dd9c14cbbbd4c3c354bf867a..35edebe672c72849e9f8a9a38f86354f2e987271 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1891,8 +1891,22 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
@@ -1962,6 +1962,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
- public void push(double deltaX, double deltaY, double deltaZ) {
- this.setDeltaMovement(this.getDeltaMovement().add(deltaX, deltaY, deltaZ));
+ public final void push(double deltaX, double deltaY, double deltaZ) { // Paper - override the added overload below
public void push(double deltaX, double deltaY, double deltaZ) {
+ // Paper start - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
+ this.push(deltaX, deltaY, deltaZ, null);
+ }
@ -36,15 +33,15 @@ index 655ce0b58cc327a8dac1b006bec7dcb34964da0a..afc2e4a3eda78a47209581307c100663
+ }
+ this.setDeltaMovement(this.getDeltaMovement().add(delta.getX(), delta.getY(), delta.getZ()));
+ // Paper end - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
this.setDeltaMovement(this.getDeltaMovement().add(deltaX, deltaY, deltaZ));
this.hasImpulse = true;
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 249b73a3d794a7bb84e3fdd85ef6c8725d7adae1..a2fd82e4ff315d462f2da8cf572825c7b4058186 100644
index 804d5c53e9d0abd89168687395e3ab2e4bc08930..e306ed222c7285191fe5716786cbcdfdd6739d9b 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1534,7 +1534,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
d0 = (Math.random() - Math.random()) * 0.01D;
@@ -1517,7 +1517,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
d1 = source.getSourcePosition().z() - this.getZ();
}
- this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? EntityKnockbackEvent.KnockbackCause.DAMAGE : EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
@ -52,7 +49,7 @@ index 249b73a3d794a7bb84e3fdd85ef6c8725d7adae1..a2fd82e4ff315d462f2da8cf572825c7
if (!flag) {
this.indicateDamage(d0, d1);
}
@@ -1587,7 +1587,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1570,7 +1570,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void blockedByShield(LivingEntity target) {
@ -61,7 +58,7 @@ index 249b73a3d794a7bb84e3fdd85ef6c8725d7adae1..a2fd82e4ff315d462f2da8cf572825c7
}
private boolean checkTotemDeathProtection(DamageSource source) {
@@ -1847,23 +1847,27 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1831,10 +1831,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
public void knockback(double strength, double x, double z) {
// CraftBukkit start - EntityKnockbackEvent
@ -74,7 +71,8 @@ index 249b73a3d794a7bb84e3fdd85ef6c8725d7adae1..a2fd82e4ff315d462f2da8cf572825c7
d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
//this.hasImpulse = true; // CraftBukkit - Move down
Vec3 vec3d = this.getDeltaMovement();
@@ -1847,13 +1847,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
Vec3 vec3d1 = (new Vec3(d1, 0.0D, d2)).normalize().scale(d0);
- EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, cause, d0, vec3d1, vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
@ -94,23 +92,23 @@ index 249b73a3d794a7bb84e3fdd85ef6c8725d7adae1..a2fd82e4ff315d462f2da8cf572825c7
}
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 6b802f8f214e5cf2bac145e88bf8e39040cec7ea..42d374959909ae13376055c869b6f5e493a710a5 100644
index 25fd665f3b02edfcc9fc7092b93296a7c6e43338..b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1789,7 +1789,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
if (flag) {
@@ -1693,7 +1693,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (f1 > 0.0F && target instanceof LivingEntity) {
- ((LivingEntity) target).knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot())) * 0.017453292F, this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
+ ((LivingEntity) target).knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot())) * 0.017453292F, this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
LivingEntity entityliving = (LivingEntity) target;
- entityliving.knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
+ entityliving.knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java
index 312398b7f1281144a0529a743d2a09376d575ff5..51fc1574d195b17fd1dc42907de3bb0e451af457 100644
index a7601321fd2cbf62b45162a2d3ee9d59c2f7d077..2d0ca87649702437aa2d7acd8d2cbb57231c77de 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java
@@ -83,7 +83,7 @@ public class RamTarget extends Behavior<Goat> {
@@ -89,7 +89,7 @@ public class RamTarget extends Behavior<Goat> {
float f = 0.25F * (float)(i - j);
float g = Mth.clamp(entity.getSpeed() * 1.65F, 0.2F, 3.0F) + f;
float h = livingEntity.isDamageSourceBlocked(world.damageSources().mobAttack(entity)) ? 0.5F : 1.0F;
@ -133,36 +131,36 @@ index aa8909498c26f095060a1df364b9e20d964a6cc3..30502849f79ce0f472e4289043c7d8ec
});
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 963fdb4132001aa781eda45b75cb4df97d782ddc..3e2f83e2c695b024bdec2c5e11ab38596730ed4a 100644
index 5e83ca6fa874227b5d63148502405bb77f5345ba..96eccd5f4675019a369a5f8171fb18e7b05b3e48 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -457,7 +457,7 @@ public class EnderDragon extends Mob implements Enemy {
@@ -464,7 +464,7 @@ public class EnderDragon extends Mob implements Enemy {
double d3 = entity.getZ() - d1;
double d4 = Math.max(d2 * d2 + d3 * d3, 0.1D);
- entity.push(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
+ entity.push(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D, this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
if (!this.phaseManager.getCurrentPhase().isSitting() && ((LivingEntity) entity).getLastHurtByMobTimestamp() < entity.tickCount - 2) {
entity.hurt(this.damageSources().mobAttack(this), 5.0F);
this.doEnchantDamageEffects(this, entity);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 237e5927beb28bfc09d8c587782bf52799a6b604..47a62680279f15ac93eb521f7ec93c3b8d52c602 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -249,7 +249,7 @@ public abstract class HangingEntity extends Entity {
if (!this.phaseManager.getCurrentPhase().isSitting() && entityliving.getLastHurtByMobTimestamp() < entity.tickCount - 2) {
DamageSource damagesource = this.damageSources().mobAttack(this);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
index cf65d8ef8d69a24ceb44d2a5d84c83dfee322a1d..e4eece7bbd14514ec60da26a8744672baa8956f9 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
@@ -142,7 +142,7 @@ public abstract class BlockAttachedEntity extends Entity {
}
@Override
- public void push(double deltaX, double deltaY, double deltaZ) {
+ public void push(double deltaX, double deltaY, double deltaZ, @org.jetbrains.annotations.Nullable Entity pushingEntity) { // Paper - add push source entity param
+ public void push(double deltaX, double deltaY, double deltaZ, @Nullable Entity pushingEntity) { // Paper - override correct overload
if (false && !this.level().isClientSide && !this.isRemoved() && deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ > 0.0D) { // CraftBukkit - not needed
this.kill();
this.dropItem((Entity) null);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index f36746cd077bca3145b6168a60f05050d3ba14c7..d4f498789ae1d93533f058b0ce4981eed1ce8ea2 100644
index c6e1e1cb3bf36e86dd910037dc7e70498c1c311f..84dcd662981b1eeb03128e7717f6af44c2b9cff6 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -153,9 +153,9 @@ public class ItemFrame extends HangingEntity {
@@ -128,9 +128,9 @@ public class ItemFrame extends HangingEntity {
}
@Override
@ -175,10 +173,10 @@ index f36746cd077bca3145b6168a60f05050d3ba14c7..d4f498789ae1d93533f058b0ce4981ee
}
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 d02c7f6a2a2631a67fb6e078d6bc81971e712038..1264fb03d2dcab088fc4a7c2788c9f9df53cba5d 100644
index 1954c95e65abd98973393c636f5257b2a9f27377..4d91bc4b90a208fec789325dbcec8cc56d1a2a8b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
@@ -257,7 +257,7 @@ public class Ravager extends Raider {
@@ -258,7 +258,7 @@ public class Ravager extends Raider {
double d1 = entity.getZ() - this.getZ();
double d2 = Math.max(d0 * d0 + d1 * d1, 0.001D);
@ -188,10 +186,10 @@ index d02c7f6a2a2631a67fb6e078d6bc81971e712038..1264fb03d2dcab088fc4a7c2788c9f9d
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
index 38c27b4aa37e8b046e3eccdde3f527eb555da6f8..05dee42941a842bf4bba9480a2c04a142541ac29 100644
index a6c33abcbbfc0851c8fa979163de145a578f97a6..18389b3befe31b224010e55244fbcb7c2802845e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java
@@ -40,7 +40,7 @@ public interface HoglinBase {
@@ -47,7 +47,7 @@ public interface HoglinBase {
double j = f * (double)(attacker.level().random.nextFloat() * 0.5F + 0.2F);
Vec3 vec3 = new Vec3(g, 0.0, h).normalize().scale(j).yRot(i);
double k = f * (double)attacker.level().random.nextFloat() * 0.5;
@ -201,61 +199,61 @@ index 38c27b4aa37e8b046e3eccdde3f527eb555da6f8..05dee42941a842bf4bba9480a2c04a14
}
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 338903091e43b71baa46157a95629c2e6b27b992..03129c45fec4da4d124ed18101517e5ab696bbcd 100644
index d20389c6d73114810ab8dc20a02b09db4f1971f1..d4077e88910347fb332996ce88262a1a0577818f 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1293,9 +1293,9 @@ public abstract class Player extends LivingEntity {
if (flag5) {
if (i > 0) {
if (target instanceof LivingEntity) {
- ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
+ ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
} else {
- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
}
@@ -1300,9 +1300,9 @@ public abstract class Player extends LivingEntity {
if (target instanceof LivingEntity) {
LivingEntity entityliving1 = (LivingEntity) target;
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
@@ -1317,7 +1317,7 @@ public abstract class Player extends LivingEntity {
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits
if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
- entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
+ entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
}
// CraftBukkit end
- entityliving1.knockback((double) (f5 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)));
+ entityliving1.knockback((double) (f5 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // Paper - knockback events
} else {
- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * f5 * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * f5 * 0.5F));
+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * f5 * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * f5 * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
@@ -1328,7 +1328,7 @@ public abstract class Player extends LivingEntity {
// CraftBukkit start - Only apply knockback if the damage hits
if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) {
- entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
+ entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
}
// CraftBukkit end
Level world = this.level();
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index efcfbcb3dc352c9015cc9121dc8d98e8deed8bfd..ccb5de967a83c01b69161af0c1c922fc31c7a0d9 100644
index 686237a21eccb43ee9f0b659915c141d6ad49f28..a2617881999ea61bf132ff75fb36e783261e5835 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -421,7 +421,7 @@ public abstract class AbstractArrow extends Projectile {
Vec3 vec3d = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double) this.knockback * 0.6D * d0);
@@ -512,7 +512,7 @@ public abstract class AbstractArrow extends Projectile {
Vec3 vec3d = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale(d0 * 0.6D * d1);
if (vec3d.lengthSqr() > 0.0D) {
- entityliving.push(vec3d.x, 0.1D, vec3d.z);
+ entityliving.push(vec3d.x, 0.1D, vec3d.z, this); // Paper - pass causing entity for knockback events
}
}
if (vec3d.lengthSqr() > 0.0D) {
- target.push(vec3d.x, 0.1D, vec3d.z);
+ target.push(vec3d.x, 0.1D, vec3d.z, this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
}
}
diff --git a/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java b/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java
index 9f9b7373c9a714597858ddcd8932e31b902cf5a1..f7f26d595072372004143c4e26506ed505aff7d8 100644
index de2bc78415ab4efb651030be6560d9c9778a1d17..1e00df3fa3c3b61daa3d59ee1173269a6eae3a43 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java
@@ -89,7 +89,7 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple
@@ -103,7 +103,7 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple
}
@Override
- public void push(double deltaX, double deltaY, double deltaZ) {}
+ public void push(double deltaX, double deltaY, double deltaZ, @org.jetbrains.annotations.Nullable Entity pushingEntity) {} // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
public abstract void explode();
public abstract void explode(Vec3 pos);
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index da9a9b235d1c8bcab3762134d69dcb112470e55d..d15f216193613504c456d63a1c358973afad3ed1 100644
index d93ed33d5ae72e9dd3e6cf044ef79e4b9689dc1c..512d79b66fed3d1bef645c3ecb59bda032c81d15 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -296,13 +296,10 @@ public class Explosion {
@@ -297,13 +297,10 @@ public class Explosion {
// CraftBukkit start - Call EntityKnockbackEvent
if (entity instanceof LivingEntity) {
@ -274,10 +272,10 @@ index da9a9b235d1c8bcab3762134d69dcb112470e55d..d15f216193613504c456d63a1c358973
// CraftBukkit end
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1));
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index d4c44ff13f657343ec19de5e6cef7639330a5e88..fbbb0689b4c6552a3e73390363756e6308b32523 100644
index 4e0db83bb6a4529b6e0727ea181bf79e06c2025a..d625fd361c94c89749a6f41d9783f3864ed5e027 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1861,19 +1861,33 @@ public class CraftEventFactory {
@@ -1867,19 +1867,33 @@ public class CraftEventFactory {
return event;
}

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 6bca713e3cc3d63ec69b06cb7ec1820dd61cd88f..5ed7c2edeca2a2126f2beb8a5dcf4587a4400ddf 100644
index 14fe2bf55b1d00c1f79a1dbbbd6d22bf30ecc277..ad9d5cdedd234e48ec319b3c2e854a3c87a9c6bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -789,6 +789,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View file

@ -13,10 +13,10 @@ public net/minecraft/server/level/ServerPlayer completeUsingItem()V
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 0e3b9c2d7ae5091f5c485ec679852476d816f083..bd5b535663935dc8f4a2a8f5c233c1c720400bd7 100644
index bb81e0bfe0692e8f8421758cd21c003978853a08..8f43b8e3ba64ac150f35c6056178934e5de04b2d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -851,4 +851,53 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -853,4 +853,53 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
getHandle().setShieldBlockingDelay(delay);
}
// Paper end

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Implement World.getEntity(UUID) API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 5ed7c2edeca2a2126f2beb8a5dcf4587a4400ddf..ead66f549576034ef32ee4d74c0e2f5ac79e944e 100644
index ad9d5cdedd234e48ec319b3c2e854a3c87a9c6bd..0f009c32e95e567b9f22f16fbba0c57d4b227ab6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1125,6 +1125,15 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View file

@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 82947c9743433df9c03732e0a3229563de0ab53c..6f2e316480c4cd1ffb32e8d01009a18c2234c731 100644
index 5bf18ab5c397b32d880ea1827f62945d8d0e80ce..ce6be7aed7b392c3e0c851f3f6e1e216bccceaf5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1241,7 +1241,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1239,7 +1239,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
for (net.minecraft.world.level.block.entity.BlockEntity tileentity : chunk.getBlockEntities().values()) {
if (tileentity instanceof net.minecraft.world.Container) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.Container) tileentity).getViewers())) {
@ -19,7 +19,7 @@ index 82947c9743433df9c03732e0a3229563de0ab53c..6f2e316480c4cd1ffb32e8d01009a18c
}
}
}
@@ -2228,7 +2228,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2196,7 +2196,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
@ -29,10 +29,10 @@ index 82947c9743433df9c03732e0a3229563de0ab53c..6f2e316480c4cd1ffb32e8d01009a18c
}
// Spigot End
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 53246654bf8154e723b26097e864f83fd203caa5..c96e761dd29dbad42d590a88f1742c9a494eebfc 100644
index 71eca7032aa2482bde7a2a00163f5547f3487b5e..2758f4fc1c230c0029ece90718057a7b111909f0 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -698,7 +698,7 @@ public class ServerPlayer extends Player {
@@ -707,7 +707,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
// Paper end - Configurable container update tick rate
if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) {
@ -41,7 +41,7 @@ index 53246654bf8154e723b26097e864f83fd203caa5..c96e761dd29dbad42d590a88f1742c9a
this.containerMenu = this.inventoryMenu;
}
@@ -918,7 +918,7 @@ public class ServerPlayer extends Player {
@@ -927,7 +927,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
// SPIGOT-943 - only call if they have an inventory open
if (this.containerMenu != this.inventoryMenu) {
@ -50,7 +50,7 @@ index 53246654bf8154e723b26097e864f83fd203caa5..c96e761dd29dbad42d590a88f1742c9a
}
net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure
@@ -1559,7 +1559,7 @@ public class ServerPlayer extends Player {
@@ -1594,7 +1594,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
// CraftBukkit end
if (this.containerMenu != this.inventoryMenu) {
@ -59,7 +59,7 @@ index 53246654bf8154e723b26097e864f83fd203caa5..c96e761dd29dbad42d590a88f1742c9a
}
// this.nextContainerCounter(); // CraftBukkit - moved up
@@ -1587,7 +1587,13 @@ public class ServerPlayer extends Player {
@@ -1624,7 +1624,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@Override
public void closeContainer() {
@ -75,10 +75,10 @@ index 53246654bf8154e723b26097e864f83fd203caa5..c96e761dd29dbad42d590a88f1742c9a
this.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index de772530d290d58c1d8270bd14915e37db8dbf42..a9b0f12a793c88258bf80b38d16c8b887d07df61 100644
index ecc2ce39629f6edbd09e96c85e14ab2196ac3173..75736ebe99e96a20c2c3e7ac5350ab55402fac81 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2602,10 +2602,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2619,10 +2619,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleContainerClose(ServerboundContainerClosePacket packet) {
@ -96,10 +96,10 @@ index de772530d290d58c1d8270bd14915e37db8dbf42..a9b0f12a793c88258bf80b38d16c8b88
this.player.doCloseContainer();
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d25c762e449e2bce20487454ad52363b35b9af96..3273c3f06c142d4e3c947ca846459f4a8e5eefd8 100644
index 8ff6b8ada1cfb9a4b344ba7d77db95f3ddcff6c5..0c3be0663a3e69701e6b91ef65c7fbd764ae7c46 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -517,7 +517,7 @@ public abstract class PlayerList {
@@ -510,7 +510,7 @@ public abstract class PlayerList {
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
// See SPIGOT-5799, SPIGOT-6145
if (entityplayer.containerMenu != entityplayer.inventoryMenu) {
@ -109,10 +109,10 @@ index d25c762e449e2bce20487454ad52363b35b9af96..3273c3f06c142d4e3c947ca846459f4a
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 03129c45fec4da4d124ed18101517e5ab696bbcd..8f7bce51e393074246575b0d8bb3cad68ecb4270 100644
index d4077e88910347fb332996ce88262a1a0577818f..28cbe9ac2b8d5a21dba11b4162d187a9333e1ddb 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -277,7 +277,7 @@ public abstract class Player extends LivingEntity {
@@ -278,7 +278,7 @@ public abstract class Player extends LivingEntity {
this.updateIsUnderwater();
super.tick();
if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
@ -165,10 +165,10 @@ index dd3377a4f69e5ac10905e52d0eecc2427e72d856..c79607a2f45b7a487a95cf98b9b0eb6b
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 137e5f9a0ccf7e2a73db9e88100dd258e71ec170..bbd7d5a10a7792994314141ead60b41a7a21f965 100644
index a89bc6c124d05fd22848aaddac8ca496f3a324ca..0bc5d64b167081ade57ee2b0dcf0aefe3b3c2d35 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1260,7 +1260,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1273,7 +1273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory
if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) {
@ -178,10 +178,10 @@ index 137e5f9a0ccf7e2a73db9e88100dd258e71ec170..bbd7d5a10a7792994314141ead60b41a
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index fbbb0689b4c6552a3e73390363756e6308b32523..f5d52d29d6b1e4797bcfd6d87d5d5475adb4037f 100644
index d625fd361c94c89749a6f41d9783f3864ed5e027..23d57911616de1df1442d26ec31a187a5f70ed11 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1261,7 +1261,7 @@ public class CraftEventFactory {
@@ -1262,7 +1262,7 @@ public class CraftEventFactory {
public static AbstractContainerMenu callInventoryOpenEvent(ServerPlayer player, AbstractContainerMenu container, boolean cancelled) {
if (player.containerMenu != player.inventoryMenu) { // fire INVENTORY_CLOSE if one already open
@ -190,7 +190,7 @@ index fbbb0689b4c6552a3e73390363756e6308b32523..f5d52d29d6b1e4797bcfd6d87d5d5475
}
CraftServer server = player.level().getCraftServer();
@@ -1448,8 +1448,18 @@ public class CraftEventFactory {
@@ -1449,8 +1449,18 @@ public class CraftEventFactory {
return event;
}

View file

@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a9b0f12a793c88258bf80b38d16c8b887d07df61..096a7f51684fa1939a6b1b973fbbffe58775f003 100644
index 75736ebe99e96a20c2c3e7ac5350ab55402fac81..de22f6ce5e24e5deb5793ad1cc0f8187305903ab 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2479,6 +2479,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2496,6 +2496,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (event.isCancelled()) {

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 afc2e4a3eda78a47209581307c100663cdeb1afb..465c3e0596853d2182e7d85734d31e1121eb71fe 100644
index 35edebe672c72849e9f8a9a38f86354f2e987271..0355f2d1deb9fcb85efa015249d5ba81c0f27302 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3181,7 +3181,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -3280,7 +3280,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public String toString() {
String s = this.level() == null ? "~NULL~" : this.level().toString();

View file

@ -23,12 +23,12 @@ index 3eaf64a6f66c6a844e30967e6b87432e559a59e7..5c5c71db73a2bfebbb33cebd6325a0f4
}
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
index 02f407757a37c9dc8b3f4a899ac3b04719d8ceed..c5269c3117901b8521720d1b32689d7f600f20a3 100644
index e5c896409536b7fb908590d02e40923d5979841f..a28e6b6a50cfd9191732ad2e4aca5f639a1fae75 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
@@ -78,7 +78,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
@@ -79,7 +79,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, r, s, t);
DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, vec34.normalize());
dragonFireball.moveTo(o, p, q, 0.0F, 0.0F);
+ if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events
this.dragon.level().addFreshEntity(dragonFireball);
@ -37,10 +37,10 @@ index 02f407757a37c9dc8b3f4a899ac3b04719d8ceed..c5269c3117901b8521720d1b32689d7f
if (this.currentPath != null) {
while (!this.currentPath.isDone()) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
index d0fb77a9d1e6e207ce23c1df0f91f3409ab6da08..cecfae3bee405fb57df28e83b005e100e72b896b 100644
index 3c77515f6b7f1ff89325afba214e9a8e5f536158..1dade7a4fbdf190661e4431496349444467509cc 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
@@ -62,8 +62,10 @@ public class DragonFireball extends AbstractHurtingProjectile {
@@ -63,8 +63,10 @@ public class DragonFireball extends AbstractHurtingProjectile {
}
}

View file

@ -287,33 +287,33 @@ index 12795451393e48f5c9ab4b1dfd9369e1ee6e0367..369955746f4b51f69fa01103e3771dd7
}
diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java
index d8d59ddaa5277b9602f37d7c5bb5753030582996..47de500fddb0716d142f8f5876a82a95afaa06fa 100644
index 2d34f206b4b02d5f2ee35101233afc6b4f58a579..f1b2d388a1a40a1d909a2e726f32d6c15e1eb0eb 100644
--- a/src/main/java/net/minecraft/world/item/TridentItem.java
+++ b/src/main/java/net/minecraft/world/item/TridentItem.java
@@ -82,19 +82,24 @@ public class TridentItem extends Item implements ProjectileItem {
}
// CraftBukkit start
- if (!world.addFreshEntity(entitythrowntrident)) {
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), (org.bukkit.entity.Projectile) entitythrowntrident.getBukkitEntity());
+ if (!event.callEvent() || !world.addFreshEntity(entitythrowntrident)) {
+ // Paper end - PlayerLaunchProjectileEvent
if (entityhuman instanceof net.minecraft.server.level.ServerPlayer) {
((net.minecraft.server.level.ServerPlayer) entityhuman).getBukkitEntity().updateInventory();
@@ -87,19 +87,24 @@ public class TridentItem extends Item implements ProjectileItem {
}
return;
}
+ if (event.shouldConsume()) { // Paper - PlayerLaunchProjectileEvent
stack.hurtAndBreak(1, entityhuman, LivingEntity.getSlotForHand(user.getUsedItemHand()));
+ } // Paper - PlayerLaunchProjectileEvent
entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved
// CraftBukkit end
// CraftBukkit start
- if (!world.addFreshEntity(entitythrowntrident)) {
+ // Paper start - PlayerLaunchProjectileEvent
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), (org.bukkit.entity.Projectile) entitythrowntrident.getBukkitEntity());
+ if (!event.callEvent() || !world.addFreshEntity(entitythrowntrident)) {
+ // Paper end - PlayerLaunchProjectileEvent
if (entityhuman instanceof net.minecraft.server.level.ServerPlayer) {
((net.minecraft.server.level.ServerPlayer) entityhuman).getBukkitEntity().updateInventory();
}
return;
}
world.playSound((Player) null, (Entity) entitythrowntrident, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0F, 1.0F);
- if (!entityhuman.hasInfiniteMaterials()) {
+ if (event.shouldConsume() && !entityhuman.hasInfiniteMaterials()) {
entityhuman.getInventory().removeItem(stack);
}
// CraftBukkit start - SPIGOT-5458 also need in this branch :(
+ if (event.shouldConsume()) { // Paper - PlayerLaunchProjectileEvent
stack.hurtAndBreak(1, entityhuman, LivingEntity.getSlotForHand(user.getUsedItemHand()));
+ } // Paper - PlayerLaunchProjectileEvent
entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved
// CraftBukkit end
world.playSound((Player) null, (Entity) entitythrowntrident, (SoundEvent) holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F);
- if (!entityhuman.hasInfiniteMaterials()) {
+ if (event.shouldConsume() && !entityhuman.hasInfiniteMaterials()) { // Paper - PlayerLaunchProjectileEvent
entityhuman.getInventory().removeItem(stack);
}
// CraftBukkit start - SPIGOT-5458 also need in this branch :(

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Option to prevent armor stands from doing entity lookups
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index dd7ecba4525d90e6b9509d1c3cab24c1615e37a9..521ad674b42e40df30916cf02ae6ace42c0368a2 100644
index dae6835696e90bc5a541cacd37ea7aa88c60f4f4..1057679ceec86898a3e62bd183c6944f561aa7fd 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -344,6 +344,7 @@ public class ArmorStand extends LivingEntity {
@@ -343,6 +343,7 @@ public class ArmorStand extends LivingEntity {
@Override
protected void pushEntities() {
@ -17,10 +17,10 @@ index dd7ecba4525d90e6b9509d1c3cab24c1615e37a9..521ad674b42e40df30916cf02ae6ace4
Iterator iterator = list.iterator();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 26adc305c5d5ef16dda141f931973666ee163d01..6e23e4d0477f361f2eb5bb93bd9dd2bf5073833c 100644
index 27e2718124aad69546c1d9adb9c8e69fa4a43ca7..16c244f56813479b2e51f1d883ff739949fc86e3 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -759,6 +759,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -764,6 +764,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end - Prevent block entity and entity crashes
}
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index 5e9ef75a14a91f01a1ae5b3fb591d7258740a75d..516999dc425d23c570dabfe4f3c829650a6d205d 100644
index a39de724848d6dc796dd99dde5206f20e513fd18..30eb86b52f00cfa61af4f93aca50ffc3547c95e8 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -276,6 +276,15 @@ public abstract class Projectile extends Entity implements TraceableEntity {
@@ -288,6 +288,15 @@ public abstract class Projectile extends Entity implements TraceableEntity {
} else {
Entity entity1 = this.getOwner();
@ -39,10 +39,10 @@ index 6ca74a5cf691ee92c84bd031e875f72440df6b32..cee3f1200af602b5dfd0b27d05eb0182
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(context.getLevel(), context.getClickedPos()), player, CraftBlockData.fromData(state), defaultReturn);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 6e23e4d0477f361f2eb5bb93bd9dd2bf5073833c..be2220eff094c735bdb0c3e777bfbcfa4d44a578 100644
index 16c244f56813479b2e51f1d883ff739949fc86e3..c0b0a9328faf93b85ceaf6cc9989f1a59520c7f4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -264,6 +264,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -265,6 +265,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
}
@ -89,10 +89,10 @@ index 6e23e4d0477f361f2eb5bb93bd9dd2bf5073833c..be2220eff094c735bdb0c3e777bfbcfa
public boolean isClientSide() {
return this.isClientSide;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index f5d52d29d6b1e4797bcfd6d87d5d5475adb4037f..321c3e48e520865d2e226a8773af0bd4b5f3d5bb 100644
index 23d57911616de1df1442d26ec31a187a5f70ed11..dae99885916e6e913a23a79feccee7d86d98b611 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1298,6 +1298,14 @@ public class CraftEventFactory {
@@ -1299,6 +1299,14 @@ public class CraftEventFactory {
Projectile projectile = (Projectile) entity.getBukkitEntity();
org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Allow disabling armor stand ticking
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 521ad674b42e40df30916cf02ae6ace42c0368a2..b1867bb5c07b70b1cc8e5d3065a78b37c235a11e 100644
index 1057679ceec86898a3e62bd183c6944f561aa7fd..ee3902cbada46ffb78c42dbf6f00c859546c76e1 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -97,9 +97,16 @@ public class ArmorStand extends LivingEntity {
@@ -96,9 +96,16 @@ public class ArmorStand extends LivingEntity {
public Rotations leftLegPose;
public Rotations rightLegPose;
public boolean canMove = true; // Paper
@ -25,7 +25,7 @@ index 521ad674b42e40df30916cf02ae6ace42c0368a2..b1867bb5c07b70b1cc8e5d3065a78b37
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
this.armorItems = NonNullList.withSize(4, ItemStack.EMPTY);
this.headPose = ArmorStand.DEFAULT_HEAD_POSE;
@@ -202,6 +209,7 @@ public class ArmorStand extends LivingEntity {
@@ -201,6 +208,7 @@ public class ArmorStand extends LivingEntity {
this.onEquipItem(enumitemslot, (ItemStack) this.armorItems.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
}
@ -33,7 +33,7 @@ index 521ad674b42e40df30916cf02ae6ace42c0368a2..b1867bb5c07b70b1cc8e5d3065a78b37
}
@Override
@@ -244,6 +252,7 @@ public class ArmorStand extends LivingEntity {
@@ -243,6 +251,7 @@ public class ArmorStand extends LivingEntity {
}
nbt.put("Pose", this.writePose());
@ -41,7 +41,7 @@ index 521ad674b42e40df30916cf02ae6ace42c0368a2..b1867bb5c07b70b1cc8e5d3065a78b37
}
@Override
@@ -278,6 +287,12 @@ public class ArmorStand extends LivingEntity {
@@ -277,6 +286,12 @@ public class ArmorStand extends LivingEntity {
this.setNoBasePlate(nbt.getBoolean("NoBasePlate"));
this.setMarker(nbt.getBoolean("Marker"));
this.noPhysics = !this.hasPhysics();
@ -54,7 +54,7 @@ index 521ad674b42e40df30916cf02ae6ace42c0368a2..b1867bb5c07b70b1cc8e5d3065a78b37
CompoundTag nbttagcompound2 = nbt.getCompound("Pose");
this.readPose(nbttagcompound2);
@@ -657,7 +672,29 @@ public class ArmorStand extends LivingEntity {
@@ -664,7 +679,29 @@ public class ArmorStand extends LivingEntity {
@Override
public void tick() {
@ -84,7 +84,7 @@ index 521ad674b42e40df30916cf02ae6ace42c0368a2..b1867bb5c07b70b1cc8e5d3065a78b37
Rotations vector3f = (Rotations) this.entityData.get(ArmorStand.DATA_HEAD_POSE);
if (!this.headPose.equals(vector3f)) {
@@ -792,31 +829,37 @@ public class ArmorStand extends LivingEntity {
@@ -799,31 +836,37 @@ public class ArmorStand extends LivingEntity {
public void setHeadPose(Rotations angle) {
this.headPose = angle;
this.entityData.set(ArmorStand.DATA_HEAD_POSE, angle);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] SkeletonHorse Additions
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
index f3a02925833733ae50d706ffc681dd05344a7687..69714e0558419b1577c95cf8e75c1d67177ccb89 100644
index 3cb84856c10347162a8736ae1ef65165183ec8fe..5042d1d10061d611c6d283a1a1ba9f94c5ba1db5 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
@@ -20,6 +20,7 @@ import net.minecraft.world.item.enchantment.ItemEnchantments;
@@ -20,6 +20,7 @@ import net.minecraft.world.item.enchantment.providers.VanillaEnchantmentProvider
public class SkeletonTrapGoal extends Goal {
private final SkeletonHorse horse;

View file

@ -5,7 +5,7 @@ Subject: [PATCH] AnvilDamageEvent
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 37cc70f46d85cef1d678ab9df4fb1a73a57ed877..4c766b879f935298ffa4249e9ce4045601cedb20 100644
index 1c98d1ab7159ce0061da80c83901d3dac084f3d3..c6ec9fc6ccde2a5c086a2bfe32686954c074c31d 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -110,6 +110,16 @@ public class AnvilMenu extends ItemCombinerMenu {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index 3e2f83e2c695b024bdec2c5e11ab38596730ed4a..789823dbaaf2e23942749145dbb64071539624aa 100644
index 96eccd5f4675019a369a5f8171fb18e7b05b3e48..201ef4a3f5bc8633f7a51e151e9e87efc4004cad 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -557,6 +557,11 @@ public class EnderDragon extends Mob implements Enemy {
@@ -574,6 +574,11 @@ public class EnderDragon extends Mob implements Enemy {
});
craftBlock.getNMS().spawnAfterBreak((ServerLevel) this.level(), blockposition, ItemStack.EMPTY, false);
}
@ -46,7 +46,7 @@ index c7c4b04dede992991229b149b96ff6a81f499ae3..886b8d2284e3ae85184c842b24869029
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/TntBlock.java b/src/main/java/net/minecraft/world/level/block/TntBlock.java
index 21b83d4d5b58da22ba1fadb0ca376a0076f2e23c..ff872a91effaed7394848fe5c1ab4d2bbac0b5fc 100644
index d80b4b3b38069016a5238f619fa3b156f576d9ae..4896ddca849646135ae101236e534ab8f59bd617 100644
--- a/src/main/java/net/minecraft/world/level/block/TntBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TntBlock.java
@@ -50,6 +50,12 @@ public class TntBlock extends Block {
@ -102,7 +102,7 @@ index 21b83d4d5b58da22ba1fadb0ca376a0076f2e23c..ff872a91effaed7394848fe5c1ab4d2b
TntBlock.explode(world, pos, player);
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 11);
Item item = stack.getItem();
@@ -139,6 +164,12 @@ public class TntBlock extends Block {
@@ -137,6 +162,12 @@ public class TntBlock extends Block {
return;
}
// CraftBukkit end

View file

@ -22,7 +22,7 @@ to take the burden of this into their own hand without having to rely on
plugins doing unsafe things.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 096a7f51684fa1939a6b1b973fbbffe58775f003..b4bf6e47378ddf4c836479773fe833f1aa321292 100644
index de22f6ce5e24e5deb5793ad1cc0f8187305903ab..3921f9d664ef629361d9ad2050cea97c2182e157 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -265,6 +265,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -41,7 +41,7 @@ index 096a7f51684fa1939a6b1b973fbbffe58775f003..b4bf6e47378ddf4c836479773fe833f1
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
@@ -716,7 +718,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -719,7 +721,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) {
// PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async
// CraftBukkit start

View file

@ -8,10 +8,10 @@ Addresses two issues:
- Allay duplication cooldown is saved and exposed as a long, but loaded as an int
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index e40a6bb2055a09d6bf1a91f69a2abb5f6877a122..8007d323023655052acd0cf1f3a753101e9ee74a 100644
index 2d438cd3e69503fdc45a706f25c219af6f7a5db3..0916e24271d07ad5db51c5bc68791722b0f69c2b 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -302,7 +302,7 @@ public class ExperienceOrb extends Entity {
@@ -305,7 +305,7 @@ public class ExperienceOrb extends Entity {
public void addAdditionalSaveData(CompoundTag nbt) {
nbt.putShort("Health", (short) this.health);
nbt.putShort("Age", (short) this.age);
@ -20,7 +20,7 @@ index e40a6bb2055a09d6bf1a91f69a2abb5f6877a122..8007d323023655052acd0cf1f3a75310
nbt.putInt("Count", this.count);
this.savePaperNBT(nbt); // Paper
}
@@ -311,7 +311,7 @@ public class ExperienceOrb extends Entity {
@@ -314,7 +314,7 @@ public class ExperienceOrb extends Entity {
public void readAdditionalSaveData(CompoundTag nbt) {
this.health = nbt.getShort("Health");
this.age = nbt.getShort("Age");
@ -30,10 +30,10 @@ index e40a6bb2055a09d6bf1a91f69a2abb5f6877a122..8007d323023655052acd0cf1f3a75310
this.loadPaperNBT(nbt); // Paper
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
index 296a25deae065425ef9384b7ec15d5aeb76dbd66..991e3274091c4e25eebc6debd44653e5b566eedb 100644
index 56b9123b42d05e0fb20763b8988aa68583a36781..69986f75d3cf729204cca0c7e5428536af31f695 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
@@ -487,7 +487,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -489,7 +489,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
});
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary itemmeta handling
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index e65a5abfaac1f68bbefe0b7f3877823a548d56cc..6358cdada112cd3e17d9363111c931a4d21eb4b9 100644
index abf502b8395bb0a8a32c1fdcd62532790deb1c6e..f53ce5f063d3b7b8d3f6a3bc1165d1788c112e6d 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -168,7 +168,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -165,7 +165,7 @@ public final class ItemStack implements DataComponentHolder {
// CraftBukkit start
ItemStack itemstack = new ItemStack(holder, i, datacomponentpatch);
@ -17,7 +17,7 @@ index e65a5abfaac1f68bbefe0b7f3877823a548d56cc..6358cdada112cd3e17d9363111c931a4
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
}
return itemstack;
@@ -182,8 +182,8 @@ public final class ItemStack implements DataComponentHolder {
@@ -179,8 +179,8 @@ public final class ItemStack implements DataComponentHolder {
} else {
registryfriendlybytebuf.writeVarInt(itemstack.getCount());
// Spigot start - filter

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 46da628073e2bfb77b3deab623dba46228d92618..1c508d1f122d287cd8dc0a905de96436c343327a 100644
index c96346bd0207537899d266fe2c8f29a1663e10c3..e2f176d34443f0d1b00649efa45c65138042a015 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1441,6 +1441,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1321,6 +1321,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas());
@ -16,7 +16,7 @@ index 46da628073e2bfb77b3deab623dba46228d92618..1c508d1f122d287cd8dc0a905de96436
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.updatePlayers(this.level.players());
if (entity instanceof ServerPlayer) {
@@ -1481,7 +1482,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1361,7 +1362,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.broadcastRemoved();
}
@ -26,10 +26,10 @@ index 46da628073e2bfb77b3deab623dba46228d92618..1c508d1f122d287cd8dc0a905de96436
protected void tick() {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 6f2e316480c4cd1ffb32e8d01009a18c2234c731..42dd9ab70c07e92258da70ad29b51c7780401a5d 100644
index ce6be7aed7b392c3e0c851f3f6e1e216bccceaf5..b151506b96a51c74ba408cb555a4d38507b2f8c1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1203,6 +1203,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1201,6 +1201,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit start
private boolean addEntity(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
@ -43,10 +43,10 @@ index 6f2e316480c4cd1ffb32e8d01009a18c2234c731..42dd9ab70c07e92258da70ad29b51c77
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 465c3e0596853d2182e7d85734d31e1121eb71fe..1f28f466aab3d829fe719878faee40f35320163b 100644
index 0355f2d1deb9fcb85efa015249d5ba81c0f27302..8368342ea699851f3f2926414a49b9dd3d8be327 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -244,6 +244,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -250,6 +250,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private CraftEntity bukkitEntity;

View file

@ -9,10 +9,10 @@ thread dumps at an interval until the point of crash.
This will help diagnose what was going on in that time before the crash.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b6c5656665e492a7fdec0ae15545ecbabf585336..a8a53b0aad6cda7fa1cd0565b5a4249a228f87f7 100644
index 1c024fb7f682c81c465f59f4ab5fbeac964d73e1..3fbe9a4981c682ec602d8ad1c390a10f26505f08 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1101,6 +1101,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1108,6 +1108,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status = this.buildServerStatus();
// Spigot start
@ -21,10 +21,10 @@ index b6c5656665e492a7fdec0ae15545ecbabf585336..a8a53b0aad6cda7fa1cd0565b5a4249a
// Paper start - further improve server tick loop
long tickSection = Util.getNanos();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 2d877bf61cf0a7829278e6af096f5401edfe1981..4b844838f62f74870fa6ba0ce8dac78647f9f9e1 100644
index c466ec011d059b9960606ef2ee51ea3a3a65f8d0..baf93b5d5883d0a5c360f1a475949804b7907636 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -212,6 +212,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -216,6 +216,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration
@ -33,10 +33,10 @@ index 2d877bf61cf0a7829278e6af096f5401edfe1981..4b844838f62f74870fa6ba0ce8dac786
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c02ebe1a8fbae4cd01f5ad355b3a5530494fab73..d9a283591efa1adad5107dd517382bb655768190 100644
index dd1a6b7a65fe019ee71c659a165283ee9c0e7a4f..2924bf755df7cc2b8d48e4383b56b2777981231d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -951,6 +951,7 @@ public final class CraftServer implements Server {
@@ -954,6 +954,7 @@ public final class CraftServer implements Server {
@Override
public void reload() {
@ -44,7 +44,7 @@ index c02ebe1a8fbae4cd01f5ad355b3a5530494fab73..d9a283591efa1adad5107dd517382bb6
this.reloadCount++;
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
this.commandsConfiguration = YamlConfiguration.loadConfiguration(this.getCommandsConfigFile());
@@ -1042,6 +1043,7 @@ public final class CraftServer implements Server {
@@ -1045,6 +1046,7 @@ public final class CraftServer implements Server {
this.enablePlugins(PluginLoadOrder.POSTWORLD);
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.pluginsEnabled(); // Paper - Remap plugins
this.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.RELOAD));
@ -53,7 +53,7 @@ index c02ebe1a8fbae4cd01f5ad355b3a5530494fab73..d9a283591efa1adad5107dd517382bb6
@Override
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 7cd1f375b9ad9e6d6f2d26661519f12be064a9d2..9572177323f29ea8315a3dfb943dfe10463f32ae 100644
index d063d356388810fb6f0dddfbc8b5885b3e6442aa..ba4fcfc86b385c8f50f414d5448edc5e99d2433a 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -229,7 +229,7 @@ public class SpigotConfig

View file

@ -23,10 +23,10 @@ Modified isEmpty to use the isEmpty() method instead of the slightly confusing s
The point of this is readability, but does have a side-benefit of a small microptimization
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3273c3f06c142d4e3c947ca846459f4a8e5eefd8..940896725c32981ddd2d5a23d72a87ba3e5e0fee 100644
index 0c3be0663a3e69701e6b91ef65c7fbd764ae7c46..91206bb797f82936abea75f1956c08a92a15bd2c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -634,7 +634,7 @@ public abstract class PlayerList {
@@ -627,7 +627,7 @@ public abstract class PlayerList {
} else if (!this.isWhiteListed(gameprofile, event)) { // Paper - ProfileWhitelistVerifyEvent
//ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); // Paper
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure - moved to isWhitelisted

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Use a Queue for Queueing Commands
Lists are bad as Queues mmmkay.
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 4b844838f62f74870fa6ba0ce8dac78647f9f9e1..3736fdd1dba4fc86012c687c5525a52cb8094f47 100644
index baf93b5d5883d0a5c360f1a475949804b7907636..b15cee6f21ff300b596922a8eed35a5f8a89fe22 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -76,7 +76,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -78,7 +78,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
static final Logger LOGGER = LogUtils.getLogger();
private static final int CONVERSION_RETRY_DELAY_MS = 5000;
private static final int CONVERSION_RETRIES = 2;
@ -18,7 +18,7 @@ index 4b844838f62f74870fa6ba0ce8dac78647f9f9e1..3736fdd1dba4fc86012c687c5525a52c
@Nullable
private QueryThreadGs4 queryThreadGs4;
// private final RemoteControlCommandListener rconConsoleSource; // CraftBukkit - remove field
@@ -434,13 +434,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -438,13 +438,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
public void handleConsoleInput(String command, CommandSourceStack commandSource) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Ability to get block entities from a chunk without snapshots
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 110bdba382c361228c52c1c1f807fef25f127ab5..01596f87ee078fceeb3f2f29bbb2500e63e9efb8 100644
index e37dae711e7059834612ead5f4fcea9f28ad436f..f1d5c2d423dc015cc7720a4544370895f3cc644b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -174,6 +174,13 @@ public class CraftChunk implements Chunk {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize BlockPosition helper methods
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 2074d4327f0c356c220f3a6a9761439e76a15fc3..19fdd77d4830b7218b627fdf4ed755d8935c00aa 100644
index 8994a381b05dcdd1163d2e7a0b63a8875b6063ed..73d7b5148e3a92c085b08303589827a6f0ae8d07 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -153,67 +153,84 @@ public class BlockPos extends Vec3i {
@@ -157,67 +157,84 @@ public class BlockPos extends Vec3i {
@Override
public BlockPos above() {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Slime Pathfinder Events
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da49f23c542 100644
index b1f7ea02e533660322675e1bddb070f0a41084f2..ef27b0af849f071f79271689783b7a557e6d660a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -115,6 +115,7 @@ public class Slime extends Mob implements Enemy {
@@ -117,6 +117,7 @@ public class Slime extends Mob implements Enemy {
@Override
public void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
@ -16,7 +16,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
nbt.putInt("Size", this.getSize() - 1);
nbt.putBoolean("wasOnGround", this.wasOnGround);
}
@@ -123,6 +124,11 @@ public class Slime extends Mob implements Enemy {
@@ -125,6 +126,11 @@ public class Slime extends Mob implements Enemy {
public void readAdditionalSaveData(CompoundTag nbt) {
this.setSize(nbt.getInt("Size") + 1, false);
super.readAdditionalSaveData(nbt);
@ -28,7 +28,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
this.wasOnGround = nbt.getBoolean("wasOnGround");
}
@@ -475,7 +481,7 @@ public class Slime extends Mob implements Enemy {
@@ -483,7 +489,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
@ -37,7 +37,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
}
@Override
@@ -512,7 +518,15 @@ public class Slime extends Mob implements Enemy {
@@ -520,7 +526,15 @@ public class Slime extends Mob implements Enemy {
public boolean canUse() {
LivingEntity entityliving = this.slime.getTarget();
@ -54,7 +54,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
}
@Override
@@ -525,7 +539,15 @@ public class Slime extends Mob implements Enemy {
@@ -533,7 +547,15 @@ public class Slime extends Mob implements Enemy {
public boolean canContinueToUse() {
LivingEntity entityliving = this.slime.getTarget();
@ -71,7 +71,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
}
@Override
@@ -548,6 +570,13 @@ public class Slime extends Mob implements Enemy {
@@ -556,6 +578,13 @@ public class Slime extends Mob implements Enemy {
}
}
@ -85,7 +85,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
}
private static class SlimeRandomDirectionGoal extends Goal {
@@ -563,7 +592,7 @@ public class Slime extends Mob implements Enemy {
@@ -571,7 +600,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
@ -94,7 +94,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
}
@Override
@@ -571,6 +600,11 @@ public class Slime extends Mob implements Enemy {
@@ -579,6 +608,11 @@ public class Slime extends Mob implements Enemy {
if (--this.nextRandomizeTime <= 0) {
this.nextRandomizeTime = this.adjustedTickDelay(40 + this.slime.getRandom().nextInt(60));
this.chosenDegrees = (float) this.slime.getRandom().nextInt(360);
@ -106,7 +106,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
}
MoveControl controllermove = this.slime.getMoveControl();
@@ -593,7 +627,7 @@ public class Slime extends Mob implements Enemy {
@@ -601,7 +635,7 @@ public class Slime extends Mob implements Enemy {
@Override
public boolean canUse() {
@ -115,7 +115,7 @@ index 136ec2413b6fe4680d7f2e903d04c9984b37f4c0..7062ef1cfd7d6279a4c6693cbdb80da4
}
@Override
@@ -606,4 +640,15 @@ public class Slime extends Mob implements Enemy {
@@ -614,4 +648,15 @@ public class Slime extends Mob implements Enemy {
}
}

View file

@ -7,10 +7,10 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData
and cloning it when one is needed.
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index e8815210405152696a9f7ddae64f87ff456fa9bd..3e76f1baa321f1c2551a027a705bbeed48936e2b 100644
index 4ac248f9f5f4f7aa95ddd6e3c3dab1ce94e73d66..d02f7a547dbe8943f82c07103b1fff203e4533c2 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -807,6 +807,14 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -813,6 +813,14 @@ public abstract class BlockBehaviour implements FeatureElement {
this.instrument = blockbase_info.instrument;
this.replaceable = blockbase_info.replaceable;
}

View file

@ -8,7 +8,7 @@ Use larger initial sizes to increase bucket capacity on the BiMap
BiMap.get was seen to be using a good bit of CPU time.
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
index aac210f682303b85e207bb230decb1af62a1a25a..a35fe2b8ef35692fb7b5d520944d0c6ae53ac07e 100644
index 362e49f503f3c792fbecf41ec9f235bbc02644de..6e4d5c168acdb9aaa9fbbee090082e4dc25e89e9 100644
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
@@ -35,11 +35,11 @@ public class MappedRegistry<T> implements WritableRegistry<T> {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add PhantomPreSpawnEvent
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index ef6bbcb6fc9d37748c74b68966e12637efd00aba..4292a0fbab588a8cd58db36bc279f2991231aeec 100644
index 81e75e9d6619f7108fd769e462f24d72cbd5a73c..3c3f70d05fb51b530b792adf84c324840bd03c14 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -165,6 +165,11 @@ public class Phantom extends FlyingMob implements Enemy {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add More Creeper API
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
index c49aad3a4b2dbb6db1ac10e668b196b6bea3b7f3..7db5de71b0353d9807978c0351870fd99b76ee67 100644
index 6b57500b2265be637c8d21807867341202305d59..b3dd475b1c6cd10f89760e59cbba219df19948b6 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -134,7 +134,7 @@ public class Creeper extends Monster implements PowerableMob {
@ -17,7 +17,7 @@ index c49aad3a4b2dbb6db1ac10e668b196b6bea3b7f3..7db5de71b0353d9807978c0351870fd9
}
}
@@ -314,7 +314,18 @@ public class Creeper extends Monster implements PowerableMob {
@@ -315,7 +315,18 @@ public class Creeper extends Monster implements PowerableMob {
}
public void ignite() {

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index ead66f549576034ef32ee4d74c0e2f5ac79e944e..8aac52d6a31c36ce7fd173972ab4709c1dc95f9f 100644
index 0f009c32e95e567b9f22f16fbba0c57d4b227ab6..6bb69da5f20cdb7a77329b248ad8d981e4011d7c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -432,7 +432,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a2fd82e4ff315d462f2da8cf572825c7b4058186..1a64ea5e875fe0d362d3e76cf9d112b238b67bbe 100644
index e306ed222c7285191fe5716786cbcdfdd6739d9b..04f5281ce800895fe19acf3493ce625faef3de13 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3922,6 +3922,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3949,6 +3949,19 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
// Paper start - Make shield blocking delay configurable
@ -29,10 +29,10 @@ index a2fd82e4ff315d462f2da8cf572825c7b4058186..1a64ea5e875fe0d362d3e76cf9d112b2
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index bd5b535663935dc8f4a2a8f5c233c1c720400bd7..fa2cb4820698d4f0f317d7abd14216bdd54143a7 100644
index 8f43b8e3ba64ac150f35c6056178934e5de04b2d..b34793c7b7dfb699139551e1b467dea4efa0b369 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -200,6 +200,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -201,6 +201,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return blocks.get(0);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index bbd7d5a10a7792994314141ead60b41a7a21f965..44faaf75631a00caaa659fc44c35779b7dee510d 100644
index 0bc5d64b167081ade57ee2b0dcf0aefe3b3c2d35..267d612ba89aa964a74a91aec6c27c8d454d39bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2962,6 +2962,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2975,6 +2975,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.adventure$pointers;
}

View file

@ -19,10 +19,10 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou
public net.minecraft.world.entity.LivingEntity getSoundVolume()F
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c96e761dd29dbad42d590a88f1742c9a494eebfc..a0801437d631b148d435b3700e60f97f95e2bb92 100644
index 2758f4fc1c230c0029ece90718057a7b111909f0..a75b325111c1c6ff2686854d43a2f68423c3fca8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -264,6 +264,10 @@ public class ServerPlayer extends Player {
@@ -268,6 +268,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
private int containerCounter;
public boolean wonGame;
private int containerUpdateDelay; // Paper - Configurable container update tick rate
@ -33,7 +33,7 @@ index c96e761dd29dbad42d590a88f1742c9a494eebfc..a0801437d631b148d435b3700e60f97f
// CraftBukkit start
public CraftPlayer.TransferCookieConnection transferCookieConnection;
@@ -887,7 +891,7 @@ public class ServerPlayer extends Player {
@@ -896,7 +900,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@Override
public void die(DamageSource damageSource) {
@ -42,7 +42,7 @@ index c96e761dd29dbad42d590a88f1742c9a494eebfc..a0801437d631b148d435b3700e60f97f
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
// CraftBukkit start - fire PlayerDeathEvent
if (this.isRemoved()) {
@@ -915,6 +919,16 @@ public class ServerPlayer extends Player {
@@ -924,6 +928,16 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
String deathmessage = defaultMessage.getString();
this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel
org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, damageSource, loot, PaperAdventure.asAdventure(defaultMessage), keepInventory); // Paper - Adventure
@ -59,7 +59,7 @@ index c96e761dd29dbad42d590a88f1742c9a494eebfc..a0801437d631b148d435b3700e60f97f
// SPIGOT-943 - only call if they have an inventory open
if (this.containerMenu != this.inventoryMenu) {
@@ -1063,8 +1077,17 @@ public class ServerPlayer extends Player {
@@ -1072,8 +1086,17 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
}
}
}
@ -80,10 +80,10 @@ index c96e761dd29dbad42d590a88f1742c9a494eebfc..a0801437d631b148d435b3700e60f97f
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 1a64ea5e875fe0d362d3e76cf9d112b238b67bbe..59a1cdbfdde5bc167d46eeb86cf2f54f9d0d8404 100644
index 04f5281ce800895fe19acf3493ce625faef3de13..f1f78e3f82ad5ff9a2ec0c8ad2ab1334a69425e6 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -271,6 +271,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -283,6 +283,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
public Set<UUID> collidableExemptions = new HashSet<>();
public boolean bukkitPickUpLoot;
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
@ -91,7 +91,7 @@ index 1a64ea5e875fe0d362d3e76cf9d112b238b67bbe..59a1cdbfdde5bc167d46eeb86cf2f54f
@Override
public float getBukkitYaw() {
@@ -1543,11 +1544,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1526,11 +1527,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isDeadOrDying()) {
if (!this.checkTotemDeathProtection(source)) {
@ -107,7 +107,7 @@ index 1a64ea5e875fe0d362d3e76cf9d112b238b67bbe..59a1cdbfdde5bc167d46eeb86cf2f54f
}
} else if (flag1) {
this.playHurtSound(source);
@@ -1706,6 +1708,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1689,6 +1691,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Entity entity = damageSource.getEntity();
LivingEntity entityliving = this.getKillCredit();
@ -115,7 +115,7 @@ index 1a64ea5e875fe0d362d3e76cf9d112b238b67bbe..59a1cdbfdde5bc167d46eeb86cf2f54f
if (this.deathScore >= 0 && entityliving != null) {
entityliving.awardKillScore(this, this.deathScore, damageSource);
}
@@ -1717,24 +1720,59 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1700,24 +1703,59 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.level().isClientSide && this.hasCustomName()) {
if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
}
@ -131,7 +131,7 @@ index 1a64ea5e875fe0d362d3e76cf9d112b238b67bbe..59a1cdbfdde5bc167d46eeb86cf2f54f
+ // Paper - move below into if for onKill
+
+ // Paper start
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource);
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(worldserver, damageSource);
+ if (deathEvent == null || !deathEvent.isCancelled()) {
+ if (this.deathScore >= 0 && entityliving != null) {
+ entityliving.awardKillScore(this, this.deathScore, damageSource);
@ -148,39 +148,38 @@ index 1a64ea5e875fe0d362d3e76cf9d112b238b67bbe..59a1cdbfdde5bc167d46eeb86cf2f54f
+ if (this.isSleeping()) {
+ this.stopSleeping();
+ }
+
- if (entity == null || entity.killedEntity(worldserver, this)) {
+ if (!this.level().isClientSide && this.hasCustomName()) {
+ if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot
+ }
- if (entity == null || entity.killedEntity(worldserver, this)) {
+
+ this.getCombatTracker().recheckStatus();
+ if (entity != null) {
+ entity.killedEntity((ServerLevel) this.level(), this);
+ }
this.gameEvent(GameEvent.ENTITY_DIE);
- this.dropAllDeathLoot(damageSource);
- this.createWitherRose(entityliving);
- this.dropAllDeathLoot(worldserver, damageSource);
+ } else {
+ this.dead = false;
+ this.setHealth((float) deathEvent.getReviveHealth());
}
- this.level().broadcastEntityEvent(this, (byte) 3);
+ }
+ // Paper end
+ this.createWitherRose(entityliving);
}
this.createWitherRose(entityliving);
}
+ // Paper start
+ if (this.dead) { // Paper
+ this.level().broadcastEntityEvent(this, (byte) 3);
this.level().broadcastEntityEvent(this, (byte) 3);
- }
this.setPose(Pose.DYING);
+ }
+ // Paper end
}
}
@@ -1742,7 +1780,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1725,7 +1763,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (!this.level().isClientSide) {
boolean flag = false;
@ -189,53 +188,51 @@ index 1a64ea5e875fe0d362d3e76cf9d112b238b67bbe..59a1cdbfdde5bc167d46eeb86cf2f54f
if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
BlockPos blockposition = this.blockPosition();
BlockState iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
@@ -1771,7 +1809,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1754,24 +1792,37 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
- protected void dropAllDeathLoot(DamageSource source) {
- protected void dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
+ // Paper start
+ protected boolean clearEquipmentSlots = true;
+ protected Set<EquipmentSlot> clearedEquipmentSlots = new java.util.HashSet<>();
+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(DamageSource source) {
+ // Paper end
Entity entity = source.getEntity();
int i;
+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
+ // Paper end
boolean flag = this.lastHurtByPlayerTime > 0;
@@ -1786,18 +1828,27 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.dropEquipment(); // CraftBukkit - from below
if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
this.dropFromLootTable(source, flag);
if (this.shouldDropLoot() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
this.dropFromLootTable(damageSource, flag);
+ // Paper start
+ final boolean prev = this.clearEquipmentSlots;
+ this.clearEquipmentSlots = false;
+ this.clearedEquipmentSlots.clear();
+ // Paper end
this.dropCustomDeathLoot(source, i, flag);
this.dropCustomDeathLoot(world, damageSource, flag);
+ this.clearEquipmentSlots = prev; // Paper
}
// CraftBukkit start - Call death event
- CraftEventFactory.callEntityDeathEvent(this, source, this.drops);
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, source, this.drops); // Paper
- CraftEventFactory.callEntityDeathEvent(this, damageSource, this.drops);
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, damageSource, this.drops); // Paper
+ this.postDeathDropItems(deathEvent); // Paper
this.drops = new ArrayList<>();
// CraftBukkit end
// this.dropInventory();// CraftBukkit - moved up
this.dropExperience();
// this.dropEquipment();// CraftBukkit - moved up
this.dropExperience(damageSource.getEntity());
+ return deathEvent; // Paper
}
protected void dropEquipment() {}
+ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) {} // Paper - method for post death logic that cannot be ran before the event is potentially cancelled
// CraftBukkit start
public int getExpReward() {
public int getExpReward(@Nullable Entity entity) { // CraftBukkit
Level world = this.level();
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 42d374959909ae13376055c869b6f5e493a710a5..2d2f2f8320df7650a6fc746d7071c9ffdbb8e2d4 100644
index b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e..4b0e269f3580c1c6dac1e5f2dd3cdac1d8e1118a 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1170,6 +1170,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
@@ -1121,6 +1121,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
@ -246,32 +243,32 @@ index 42d374959909ae13376055c869b6f5e493a710a5..2d2f2f8320df7650a6fc746d7071c9ff
+ // Paper end
+
@Override
protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) {
super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops);
@@ -1178,6 +1184,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {
super.dropCustomDeathLoot(world, source, causedByPlayer);
@@ -1129,6 +1135,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
for (int k = 0; k < j; ++k) {
EquipmentSlot enumitemslot = aenumitemslot[k];
for (int j = 0; j < i; ++j) {
EquipmentSlot enumitemslot = aenumitemslot[j];
+ if (this.shouldSkipLoot(enumitemslot)) continue; // Paper
ItemStack itemstack = this.getItemBySlot(enumitemslot);
float f = this.getEquipmentDropChance(enumitemslot);
boolean flag1 = f > 1.0F;
@@ -1188,7 +1195,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
}
this.spawnAtLocation(itemstack);
+ if (this.clearEquipmentSlots) { // Paper
this.setItemSlot(enumitemslot, ItemStack.EMPTY);
+ // Paper start
+ } else {
+ this.clearedEquipmentSlots.add(enumitemslot);
+ }
+ // Paper end
@@ -1153,7 +1160,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
}
this.spawnAtLocation(itemstack);
+ if (this.clearEquipmentSlots) { // Paper
this.setItemSlot(enumitemslot, ItemStack.EMPTY);
+ // Paper start
+ } else {
+ this.clearedEquipmentSlots.add(enumitemslot);
+ }
+ // Paper end
}
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
index d2dfccd1e31b2f050c9f480220cf17df71c687c3..82ced9f42dced65322a55579bb764fb4dc7c1b66 100644
index a6788da1505f9e119c03b94488f5e006da13e918..e46c8231ee318eda0512afbb6343b426b4838643 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
@@ -704,16 +704,38 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
@ -280,7 +277,7 @@ index d2dfccd1e31b2f050c9f480220cf17df71c687c3..82ced9f42dced65322a55579bb764fb4
+ // Paper start - handle the bitten item separately like vanilla
@Override
- protected void dropAllDeathLoot(DamageSource source) {
- protected void dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
+ protected boolean shouldSkipLoot(EquipmentSlot slot) {
+ return slot == EquipmentSlot.MAINHAND;
+ }
@ -288,7 +285,7 @@ index d2dfccd1e31b2f050c9f480220cf17df71c687c3..82ced9f42dced65322a55579bb764fb4
+
+ @Override
+ // Paper start - Cancellable death event
+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(DamageSource source) {
+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel world, DamageSource damageSource) {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND);
- if (!itemstack.isEmpty()) {
@ -298,7 +295,7 @@ index d2dfccd1e31b2f050c9f480220cf17df71c687c3..82ced9f42dced65322a55579bb764fb4
+ releaseMouth = true;
+ }
+
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.dropAllDeathLoot(source);
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.dropAllDeathLoot(world, damageSource);
+
+ // Below is code to drop
+
@ -311,16 +308,16 @@ index d2dfccd1e31b2f050c9f480220cf17df71c687c3..82ced9f42dced65322a55579bb764fb4
this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
}
- super.dropAllDeathLoot(source);
- super.dropAllDeathLoot(world, damageSource);
+ return deathEvent; // Paper - Cancellable death event
}
public static boolean isPathClear(Fox fox, LivingEntity chasedEntity) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
index b93ea19186e9988b75fa55736df602fa7e5d1648..557d938b65af6b0e55571011bd1c50decbb64a3d 100644
index 767817fb1418958c89d0db9da4ae7eb8a5a16076..5654c614f07f07ff642ba4851b0cb6fa185924ae 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java
@@ -77,9 +77,17 @@ public abstract class AbstractChestedHorse extends AbstractHorse {
@@ -71,9 +71,17 @@ public abstract class AbstractChestedHorse extends AbstractHorse {
this.spawnAtLocation(Blocks.CHEST);
}
@ -339,76 +336,76 @@ index b93ea19186e9988b75fa55736df602fa7e5d1648..557d938b65af6b0e55571011bd1c50de
@Override
public void addAdditionalSaveData(CompoundTag nbt) {
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index b1867bb5c07b70b1cc8e5d3065a78b37c235a11e..029d5756f424dba57b4a974b09453c2f0cf0e8e2 100644
index ee3902cbada46ffb78c42dbf6f00c859546c76e1..92bb0c63330ad3a4cb13b2dc655020714e9b1ffd 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -499,8 +499,10 @@ public class ArmorStand extends LivingEntity {
}
// CraftBukkit end
if (source.is(DamageTypeTags.IS_EXPLOSION)) {
- this.brokenByAnything(source);
- this.kill(source); // CraftBukkit
+ // Paper start - avoid duplicate event call
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(source);
+ if (!event.isCancelled()) this.kill(source, false); // CraftBukkit
+ // Paper end
return false;
} else if (source.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) {
if (this.isOnFire()) {
@@ -543,9 +545,9 @@ public class ArmorStand extends LivingEntity {
this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity());
this.lastHit = i;
} else {
- this.brokenByPlayer(source);
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(source); // Paper
this.showBreakingParticles();
- this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
+ if (!event.isCancelled()) this.kill(source, false); // Paper - we still need to kill to follow vanilla logic (emit the game event etc...)
}
@@ -505,8 +505,10 @@ public class ArmorStand extends LivingEntity {
}
// CraftBukkit end
if (source.is(DamageTypeTags.IS_EXPLOSION)) {
- this.brokenByAnything(worldserver, source);
- this.kill(source); // CraftBukkit
+ // Paper start - avoid duplicate event call
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(worldserver, source);
+ if (!event.isCancelled()) this.kill(source, false); // CraftBukkit
+ // Paper end
return false;
} else if (source.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) {
if (this.isOnFire()) {
@@ -549,9 +551,9 @@ public class ArmorStand extends LivingEntity {
this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity());
this.lastHit = i;
} else {
- this.brokenByPlayer(worldserver, source);
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(worldserver, source); // Paper
this.showBreakingParticles();
- this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
+ if (!event.isCancelled()) this.kill(source, false); // Paper - we still need to kill to follow vanilla logic (emit the game event etc...)
}
return true;
@@ -597,8 +599,10 @@ public class ArmorStand extends LivingEntity {
return true;
@@ -604,8 +606,10 @@ public class ArmorStand extends LivingEntity {
f1 -= amount;
if (f1 <= 0.5F) {
- this.brokenByAnything(damageSource);
- this.brokenByAnything(world, damageSource);
- this.kill(damageSource); // CraftBukkit
+ // Paper start - avoid duplicate event call
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(damageSource);
+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(world, damageSource);
+ if (!event.isCancelled()) this.kill(damageSource, false); // CraftBukkit
+ // Paper end
} else {
this.setHealth(f1);
this.gameEvent(GameEvent.ENTITY_DAMAGE, damageSource.getEntity());
@@ -606,15 +610,15 @@ public class ArmorStand extends LivingEntity {
@@ -613,15 +617,15 @@ public class ArmorStand extends LivingEntity {
}
- private void brokenByPlayer(DamageSource damageSource) {
+ private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(DamageSource damageSource) { // Paper
- private void brokenByPlayer(ServerLevel world, DamageSource damageSource) {
+ private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(ServerLevel world, DamageSource damageSource) { // Paper
ItemStack itemstack = new ItemStack(Items.ARMOR_STAND);
itemstack.set(DataComponents.CUSTOM_NAME, this.getCustomName());
this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
- this.brokenByAnything(damageSource);
+ return this.brokenByAnything(damageSource); // Paper
- this.brokenByAnything(world, damageSource);
+ return this.brokenByAnything(world, damageSource); // Paper
}
- private void brokenByAnything(DamageSource damageSource) {
+ private org.bukkit.event.entity.EntityDeathEvent brokenByAnything(DamageSource damageSource) { // Paper
- private void brokenByAnything(ServerLevel world, DamageSource damageSource) {
+ private org.bukkit.event.entity.EntityDeathEvent brokenByAnything(ServerLevel world, DamageSource damageSource) { // Paper
this.playBrokenSound();
// this.dropAllDeathLoot(damagesource); // CraftBukkit - moved down
// this.dropAllDeathLoot(worldserver, damagesource); // CraftBukkit - moved down
@@ -636,7 +640,7 @@ public class ArmorStand extends LivingEntity {
@@ -643,7 +647,7 @@ public class ArmorStand extends LivingEntity {
this.armorItems.set(i, ItemStack.EMPTY);
}
}
- this.dropAllDeathLoot(damageSource); // CraftBukkit - moved from above
+ return this.dropAllDeathLoot(damageSource); // CraftBukkit - moved from above // Paper
- this.dropAllDeathLoot(world, damageSource); // CraftBukkit - moved from above
+ return this.dropAllDeathLoot(world, damageSource); // CraftBukkit - moved from above // Paper
}
@@ -763,7 +767,15 @@ public class ArmorStand extends LivingEntity {
@@ -770,7 +774,15 @@ public class ArmorStand extends LivingEntity {
}
public void kill(DamageSource damageSource) {
@ -426,10 +423,10 @@ index b1867bb5c07b70b1cc8e5d3065a78b37c235a11e..029d5756f424dba57b4a974b09453c2f
// CraftBukkit end
this.gameEvent(GameEvent.ENTITY_DIE);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 44faaf75631a00caaa659fc44c35779b7dee510d..eb021ba25053cdfd4b221f669104f6442d18b102 100644
index 267d612ba89aa964a74a91aec6c27c8d454d39bd..4d07f2c4a67a153f1613993590da4a9789d27e39 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2499,7 +2499,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2512,7 +2512,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendHealthUpdate() {
FoodData foodData = this.getHandle().getFoodData();
@ -446,13 +443,13 @@ index 44faaf75631a00caaa659fc44c35779b7dee510d..eb021ba25053cdfd4b221f669104f644
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 321c3e48e520865d2e226a8773af0bd4b5f3d5bb..3d8c4cc4d1bdd8c5ceea65fc2189070098410849 100644
index dae99885916e6e913a23a79feccee7d86d98b611..3405d27c360cde4e735aef1d5a01a53bbd00b0e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -892,9 +892,16 @@ public class CraftEventFactory {
@@ -893,9 +893,16 @@ public class CraftEventFactory {
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource);
EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward());
EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()));
+ populateFields(victim, event); // Paper - make cancellable
CraftWorld world = (CraftWorld) entity.getWorld();
Bukkit.getServer().getPluginManager().callEvent(event);
@ -466,8 +463,8 @@ index 321c3e48e520865d2e226a8773af0bd4b5f3d5bb..3d8c4cc4d1bdd8c5ceea65fc21890700
victim.expToDrop = event.getDroppedExp();
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
@@ -912,8 +919,15 @@ public class CraftEventFactory {
PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(), 0, deathMessage);
@@ -913,8 +920,15 @@ public class CraftEventFactory {
PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage);
event.setKeepInventory(keepInventory);
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
+ populateFields(victim, event); // Paper - make cancellable
@ -482,7 +479,7 @@ index 321c3e48e520865d2e226a8773af0bd4b5f3d5bb..3d8c4cc4d1bdd8c5ceea65fc21890700
victim.keepLevel = event.getKeepLevel();
victim.newLevel = event.getNewLevel();
@@ -930,6 +944,31 @@ public class CraftEventFactory {
@@ -931,6 +945,31 @@ public class CraftEventFactory {
return event;
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Allow chests to be placed with NBT data
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 6358cdada112cd3e17d9363111c931a4d21eb4b9..b5f1d223a3955e1b478712c581080904f86a2a2a 100644
index f53ce5f063d3b7b8d3f6a3bc1165d1788c112e6d..cc8825acea0d84b36194313656a6f70d8c049072 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -469,6 +469,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -490,6 +490,7 @@ public final class ItemStack implements DataComponentHolder {
enuminteractionresult = InteractionResult.FAIL; // cancel placement
// PAIL: Remove this when MC-99075 fixed
placeEvent.getPlayer().updateInventory();

View file

@ -40,10 +40,10 @@ index da5373d8eb4643414a0f2c699044fde93715c258..6634228ef002cbef67980272a26be4a7
return ichunkaccess == null ? false : ichunkaccess.getBlockState(pos).is(this.blockToRemove) && ichunkaccess.getBlockState(pos.above()).isAir() && ichunkaccess.getBlockState(pos.above(2)).isAir();
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 4d659fc8355542e6b9cadc6e1e86002e136702d2..853d65025d5e049467c1f1e7322580880506c347 100644
index 70888dd25b6a1d1ab7702d73a64a47eebafe76fe..0214e8bbcaefdd92ee3719d9a570f9d256ee29ba 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@@ -500,7 +500,8 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -502,7 +502,8 @@ public class EnderMan extends Monster implements NeutralMob {
int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 2.0D);
int k = Mth.floor(this.enderman.getZ() - 1.0D + randomsource.nextDouble() * 2.0D);
BlockPos blockposition = new BlockPos(i, j, k);
@ -53,7 +53,7 @@ index 4d659fc8355542e6b9cadc6e1e86002e136702d2..853d65025d5e049467c1f1e732258088
BlockPos blockposition1 = blockposition.below();
BlockState iblockdata1 = world.getBlockState(blockposition1);
BlockState iblockdata2 = this.enderman.getCarriedBlock();
@@ -544,7 +545,8 @@ public class EnderMan extends Monster implements NeutralMob {
@@ -546,7 +547,8 @@ public class EnderMan extends Monster implements NeutralMob {
int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 3.0D);
int k = Mth.floor(this.enderman.getZ() - 2.0D + randomsource.nextDouble() * 4.0D);
BlockPos blockposition = new BlockPos(i, j, k);

View file

@ -9,7 +9,7 @@ to the nearest Integer when updating its current cook time.
Co-authored-by: Eric Su <ericsu@alumni.usc.edu>
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 70e068c3d0f72f31df749add2c57450f793524ae..4cd7232f538649d99892f3b31f2741b1d7e792e8 100644
index e2a587ca5b732c62c4956e6f39ad795cd1411cc4..b5a26a44b3cf7d864eae909acf619d857c4fa397 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -79,6 +79,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@ -23,7 +23,7 @@ index 70e068c3d0f72f31df749add2c57450f793524ae..4cd7232f538649d99892f3b31f2741b1
@@ -86,6 +87,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
protected final ContainerData dataAccess;
public final Object2IntOpenHashMap<ResourceLocation> recipesUsed;
private final RecipeManager.CachedCheck<Container, ? extends AbstractCookingRecipe> quickCheck;
private final RecipeManager.CachedCheck<SingleRecipeInput, ? extends AbstractCookingRecipe> quickCheck;
+ public final RecipeType<? extends AbstractCookingRecipe> recipeType; // Paper - cook speed multiplier API
protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) {
@ -37,7 +37,7 @@ index 70e068c3d0f72f31df749add2c57450f793524ae..4cd7232f538649d99892f3b31f2741b1
public static void invalidateCache() {
@@ -295,6 +298,11 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
this.recipesUsed.put(ResourceLocation.parse(s), nbttagcompound1.getInt(s));
}
+ // Paper start - cook speed multiplier API
@ -56,7 +56,7 @@ index 70e068c3d0f72f31df749add2c57450f793524ae..4cd7232f538649d99892f3b31f2741b1
ContainerHelper.saveAllItems(nbt, this.items, registryLookup);
CompoundTag nbttagcompound1 = new CompoundTag();
@@ -374,7 +383,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -375,7 +384,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
CraftItemStack source = CraftItemStack.asCraftMirror(blockEntity.items.get(0));
CookingRecipe<?> recipe = (CookingRecipe<?>) recipeholder.toBukkitRecipe();
@ -65,7 +65,7 @@ index 70e068c3d0f72f31df749add2c57450f793524ae..4cd7232f538649d99892f3b31f2741b1
world.getCraftServer().getPluginManager().callEvent(event);
blockEntity.cookingTotalTime = event.getTotalCookTime();
@@ -382,9 +391,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -383,9 +392,9 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
// CraftBukkit end
++blockEntity.cookingProgress;
@ -77,25 +77,27 @@ index 70e068c3d0f72f31df749add2c57450f793524ae..4cd7232f538649d99892f3b31f2741b1
if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, blockEntity.items, i)) { // CraftBukkit
blockEntity.setRecipeUsed(recipeholder);
}
@@ -484,11 +493,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -485,13 +494,14 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
}
}
- private static int getTotalCookTime(Level world, AbstractFurnaceBlockEntity furnace) {
- if (world == null) return 200; // CraftBukkit - SPIGOT-4302
- return (Integer) furnace.quickCheck.getRecipeFor(furnace, world).map((recipeholder) -> {
+ private static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { // Paper - cook speed multiplier API
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(furnace.getItem(0));
- return (Integer) furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> {
- return ((AbstractCookingRecipe) recipeholder.value()).getCookingTime();
- }).orElse(200);
+ // Paper start - cook speed multiplier API
+ public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) {
+ // Paper start - cook speed multiplier API
+ /* Scale the recipe's cooking time to the current cookSpeedMultiplier */
+ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(furnace, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, furnace, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200));
+ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, singlerecipeinput, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200));
+ return (int) Math.ceil (cookTime / cookSpeedMultiplier);
+ // Paper end - cook speed multiplier API
}
public static boolean isFuel(ItemStack stack) {
@@ -533,7 +543,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
@@ -536,7 +546,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.items.set(slot, stack);
stack.limitSize(this.getMaxStackSize(stack));
if (slot == 0 && !flag) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection throttle kick message
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index 65333e0244d7c3c415266f1740929761ca890af7..f9314bee1ed9b0e4c4591c0acf8a305721765850 100644
index 582bbb376c75ab5bf737f3015ce8ad453746e279..946b423d2184f903dc29c923d7dbe05aaa469c09 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -86,7 +86,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -87,7 +87,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 59a1cdbfdde5bc167d46eeb86cf2f54f9d0d8404..7217cf55beb26823ca9c2eb97dc0af4ff456da08 100644
index f1f78e3f82ad5ff9a2ec0c8ad2ab1334a69425e6..6e903d11ea07e427abdc4983ebe1a2f8eb9bd475 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -121,6 +121,7 @@ import net.minecraft.world.level.storage.loot.LootTable;
@@ -127,6 +127,7 @@ import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
@ -16,7 +16,7 @@ index 59a1cdbfdde5bc167d46eeb86cf2f54f9d0d8404..7217cf55beb26823ca9c2eb97dc0af4f
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.scores.PlayerTeam;
@@ -3986,6 +3987,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -4013,6 +4014,38 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.level().clip(raytrace);
}
@ -56,7 +56,7 @@ index 59a1cdbfdde5bc167d46eeb86cf2f54f9d0d8404..7217cf55beb26823ca9c2eb97dc0af4f
public int getShieldBlockingDelay() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index fa2cb4820698d4f0f317d7abd14216bdd54143a7..b2172a8c70ab77ba7c98b6b2b27595765d7eba11 100644
index b34793c7b7dfb699139551e1b467dea4efa0b369..5de2da8f473b6ee59be1b49c5002a0161981136c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1,5 +1,6 @@
@ -66,7 +66,7 @@ index fa2cb4820698d4f0f317d7abd14216bdd54143a7..b2172a8c70ab77ba7c98b6b2b2759576
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
import java.util.ArrayList;
@@ -225,6 +226,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -226,6 +227,39 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
return null;
}

View file

@ -7,7 +7,7 @@ Subject: [PATCH] Add sun related API
public net.minecraft.world.entity.Mob isSunBurnTick()Z
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 8aac52d6a31c36ce7fd173972ab4709c1dc95f9f..f3d52650e9dd338396d325c9fb7a46e3927d3b36 100644
index 6bb69da5f20cdb7a77329b248ad8d981e4011d7c..eafb186d158c6cf26b97b1982597bde377396172 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -756,6 +756,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View file

@ -12,7 +12,7 @@ public net.minecraft.world.entity.animal.Turtle isTravelling()Z
public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
index cf565f3a4baf5898000d23eeedcf314b0c10db5a..83759d65d5be3e4df2b1815f82bf195fad41c542 100644
index 6f90ee749aed98b97868aa40fc233d164ddc2ef6..34e6bf677a9f4548f3febe6d57e6af9602530271 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
@@ -487,14 +487,17 @@ public class Turtle extends Animal {

View file

@ -19,10 +19,10 @@ spectate the target entity.
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a0801437d631b148d435b3700e60f97f95e2bb92..7076801dce113004b255866c659bdc5e29d8e951 100644
index a75b325111c1c6ff2686854d43a2f68423c3fca8..476476058fb3025306321343f4d33f2f3a8553bb 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2133,6 +2133,21 @@ public class ServerPlayer extends Player {
@@ -2186,6 +2186,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.camera = (Entity) (entity == null ? this : entity);
if (entity1 != this.camera) {

View file

@ -7,10 +7,10 @@ Subject: [PATCH] Add more Witch API
public net.minecraft.world.entity.monster.Witch usingTime
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index d286239d02b81624124c4e32ff4413bbac902d54..5803c1d36b769f0186baa0665976749765b4cb61 100644
index f6d01d21745391595d61b191832be4c28a3e58cb..b8ff1e3d280171378fe383bcc7c6a855d20ae5d1 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -150,21 +150,7 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -151,21 +151,7 @@ public class Witch extends Raider implements RangedAttackMob {
}
if (holder != null) {
@ -19,7 +19,7 @@ index d286239d02b81624124c4e32ff4413bbac902d54..5803c1d36b769f0186baa06659767497
- potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion);
- this.setItemSlot(EquipmentSlot.MAINHAND, potion);
- // Paper end
- this.usingTime = this.getMainHandItem().getUseDuration();
- this.usingTime = this.getMainHandItem().getUseDuration(this);
- this.setUsingItem(true);
- if (!this.isSilent()) {
- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_DRINK, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
@ -27,13 +27,13 @@ index d286239d02b81624124c4e32ff4413bbac902d54..5803c1d36b769f0186baa06659767497
-
- AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
-
- attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.id());
- attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING_ID);
- attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING);
+ this.setDrinkingPotion(PotionContents.createItemStack(Items.POTION, holder)); // Paper - logic moved into setDrinkingPotion, copy exact impl into the method and then comment out
}
}
@@ -176,6 +162,23 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -177,6 +163,23 @@ public class Witch extends Raider implements RangedAttackMob {
super.aiStep();
}
@ -41,7 +41,7 @@ index d286239d02b81624124c4e32ff4413bbac902d54..5803c1d36b769f0186baa06659767497
+ public void setDrinkingPotion(ItemStack potion) {
+ potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion);
+ this.setItemSlot(EquipmentSlot.MAINHAND, potion);
+ this.usingTime = this.getMainHandItem().getUseDuration();
+ this.usingTime = this.getMainHandItem().getUseDuration(this);
+ this.setUsingItem(true);
+ if (!this.isSilent()) {
+ this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_DRINK, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
@ -49,7 +49,7 @@ index d286239d02b81624124c4e32ff4413bbac902d54..5803c1d36b769f0186baa06659767497
+
+ AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
+
+ attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.id());
+ attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING_ID);
+ attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING);
+ }
+ // Paper end

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b4bf6e47378ddf4c836479773fe833f1aa321292..c5a9bd1d5dcf96d0b206de48000ebf63f7a0fcb1 100644
index 3921f9d664ef629361d9ad2050cea97c2182e157..916334ec8be0f1c1e0a5694fca1695ae5a8f767f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -494,9 +494,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -39,10 +39,10 @@ index b4bf6e47378ddf4c836479773fe833f1aa321292..c5a9bd1d5dcf96d0b206de48000ebf63
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
@@ -1162,9 +1172,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1157,9 +1167,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
} else {
this.awaitingTeleportTime = this.tickCount;
if (!this.updateAwaitingTeleport()) {
- double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX()));
- double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY()));
- double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ()));
@ -52,7 +52,7 @@ index b4bf6e47378ddf4c836479773fe833f1aa321292..c5a9bd1d5dcf96d0b206de48000ebf63
float f = Mth.wrapDegrees(packet.getYRot(this.player.getYRot()));
float f1 = Mth.wrapDegrees(packet.getXRot(this.player.getXRot()));
@@ -1222,6 +1232,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1217,6 +1227,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} else {
speed = this.player.getAbilities().walkingSpeed * 10f;
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7076801dce113004b255866c659bdc5e29d8e951..665fcf8382fbcb214eda16dae9e40e33e257ec6f 100644
index 476476058fb3025306321343f4d33f2f3a8553bb..8de0b92285fe2413a4e2fb52fc7bc7a13dad5e90 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2624,6 +2624,7 @@ public class ServerPlayer extends Player {
@@ -2700,6 +2700,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
this.setHealth(this.getMaxHealth());
this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset

View file

@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec
+ }
+}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index cf54e2c8e8aadb9e7343382a5ba59c657234c9b9..c7a21a11efba5c212958d56095217621828c1062 100644
index 54562fa04d14a937451ea7aa9d80194f2c31b471..4cf88f6d815d60cfbf8e4ecf9d96d0cfadd0620b 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -90,7 +90,7 @@ public class Util {
@@ -89,7 +89,7 @@ public class Util {
private static final int DEFAULT_MAX_THREADS = 255;
private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10;
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
@ -92,10 +92,10 @@ index cf54e2c8e8aadb9e7343382a5ba59c657234c9b9..c7a21a11efba5c212958d56095217621
return executorService;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a8a53b0aad6cda7fa1cd0565b5a4249a228f87f7..015eb2e8e9bf28435a8ea9aff544bcd95e679bde 100644
index 3fbe9a4981c682ec602d8ad1c390a10f26505f08..51cd2b33c89f2ba92ad926456551e789c8627c3b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -316,6 +316,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -323,6 +323,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
MinecraftServer.LOGGER.error("Uncaught exception in server thread", throwable);
});

View file

@ -8,10 +8,10 @@ the updates per world, so that we can re-use the same packet
object for every player unless they have per-player time enabled.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 015eb2e8e9bf28435a8ea9aff544bcd95e679bde..4d47119e1780f7d7b53493cc82ffacf70dae54df 100644
index 51cd2b33c89f2ba92ad926456551e789c8627c3b..3d9a333c0f8175fd3b961185f52ea9a83a2fbeb3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1535,12 +1535,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1563,12 +1563,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in.

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow digging into unloaded chunks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index e2d8bb349591d103606b158bc116b09d333c87ce..cbb17ce25cb6218bcf95c2f1c3d0288eeee13a46 100644
index a5b0efd6142075ca1ecb604afbc1d0162199e7a4..da9e864520150acd8027545672aa476be414bb4d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -122,8 +122,8 @@ public class ServerPlayerGameMode {
@@ -124,8 +124,8 @@ public class ServerPlayerGameMode {
BlockState iblockdata;
if (this.hasDelayedDestroy) {
@ -19,7 +19,7 @@ index e2d8bb349591d103606b158bc116b09d333c87ce..cbb17ce25cb6218bcf95c2f1c3d0288e
this.hasDelayedDestroy = false;
} else {
float f = this.incrementDestroyProgress(iblockdata, this.delayedDestroyPos, this.delayedTickStart);
@@ -134,7 +134,13 @@ public class ServerPlayerGameMode {
@@ -136,7 +136,13 @@ public class ServerPlayerGameMode {
}
}
} else if (this.isDestroyingBlock) {
@ -34,7 +34,7 @@ index e2d8bb349591d103606b158bc116b09d333c87ce..cbb17ce25cb6218bcf95c2f1c3d0288e
if (iblockdata.isAir()) {
this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1);
this.lastSentState = -1;
@@ -163,6 +169,7 @@ public class ServerPlayerGameMode {
@@ -165,6 +171,7 @@ public class ServerPlayerGameMode {
public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) {
if (!this.player.canInteractWithBlock(pos, 1.0D)) {
@ -42,7 +42,7 @@ index e2d8bb349591d103606b158bc116b09d333c87ce..cbb17ce25cb6218bcf95c2f1c3d0288e
this.debugLogging(pos, false, sequence, "too far");
} else if (pos.getY() >= worldHeight) {
this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos)));
@@ -302,10 +309,12 @@ public class ServerPlayerGameMode {
@@ -307,10 +314,12 @@ public class ServerPlayerGameMode {
this.debugLogging(pos, true, sequence, "stopped destroying");
} else if (action == ServerboundPlayerActionPacket.Action.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false;
@ -59,10 +59,10 @@ index e2d8bb349591d103606b158bc116b09d333c87ce..cbb17ce25cb6218bcf95c2f1c3d0288e
this.level.destroyBlockProgress(this.player.getId(), pos, -1);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c5a9bd1d5dcf96d0b206de48000ebf63f7a0fcb1..e880b41e1824f986d04a0a32cc735d77f25cf987 100644
index 916334ec8be0f1c1e0a5694fca1695ae5a8f767f..5d81aa23c7b1810df5d70b9972f233d84f5154eb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1583,6 +1583,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1595,6 +1595,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK:

View file

@ -18,10 +18,10 @@ index 5b070d158760789bbcaa984426a55d20767abe4a..e1820a339452cd3388dd7cbb928c5f58
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d9a283591efa1adad5107dd517382bb655768190..eb1b151560ef77cd8208f44880c860626caf8d3b 100644
index 2924bf755df7cc2b8d48e4383b56b2777981231d..006cc9b7817e0413a332c21839549b127ad67cb4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2859,6 +2859,16 @@ public final class CraftServer implements Server {
@@ -2867,6 +2867,16 @@ public final class CraftServer implements Server {
return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions;
}

View file

@ -20,10 +20,10 @@ this is going to be the best soultion all around.
Improvements/suggestions welcome!
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 665fcf8382fbcb214eda16dae9e40e33e257ec6f..2313c451dbcb28e79d8ff139696e2efb0c4ae756 100644
index 8de0b92285fe2413a4e2fb52fc7bc7a13dad5e90..fcbb0b64feb8d5624de3805d4db6d489110b4e69 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2480,9 +2480,15 @@ public class ServerPlayer extends Player {
@@ -2519,9 +2519,15 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@Override
public void stopRiding() {
@ -41,10 +41,10 @@ index 665fcf8382fbcb214eda16dae9e40e33e257ec6f..2313c451dbcb28e79d8ff139696e2efb
Iterator iterator = entityliving.getActiveEffects().iterator();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1f28f466aab3d829fe719878faee40f35320163b..ea8abc813809360b51cd67072d12efa03f4b4f20 100644
index 8368342ea699851f3f2926414a49b9dd3d8be327..ab69b0a0c85009e8857aff85a46b1aab9cec14af 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2600,17 +2600,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2706,17 +2706,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void removeVehicle() {
@ -75,7 +75,7 @@ index 1f28f466aab3d829fe719878faee40f35320163b..ea8abc813809360b51cd67072d12efa0
}
protected void addPassenger(Entity passenger) {
@@ -2635,7 +2646,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2741,7 +2752,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
@ -87,7 +87,7 @@ index 1f28f466aab3d829fe719878faee40f35320163b..ea8abc813809360b51cd67072d12efa0
if (entity.getVehicle() == this) {
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else {
@@ -2645,7 +2659,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2751,7 +2765,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
VehicleExitEvent event = new VehicleExitEvent(
(Vehicle) this.getBukkitEntity(),
@ -96,7 +96,7 @@ index 1f28f466aab3d829fe719878faee40f35320163b..ea8abc813809360b51cd67072d12efa0
);
// Suppress during worldgen
if (this.valid) {
@@ -2658,7 +2672,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2764,7 +2778,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
@ -106,10 +106,10 @@ index 1f28f466aab3d829fe719878faee40f35320163b..ea8abc813809360b51cd67072d12efa0
if (this.valid) {
Bukkit.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7217cf55beb26823ca9c2eb97dc0af4ff456da08..7a9e6671ac38a3473d5562b0eb1de9eecc95c6c5 100644
index 6e903d11ea07e427abdc4983ebe1a2f8eb9bd475..6bac6b338302ff0e0e93d5b66d2fd3ea0e666114 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3569,9 +3569,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3591,9 +3591,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public void stopRiding() {
@ -127,7 +127,7 @@ index 7217cf55beb26823ca9c2eb97dc0af4ff456da08..7a9e6671ac38a3473d5562b0eb1de9ee
this.dismountVehicle(entity);
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
index 509c8fae366e6aeca324b4d8e39bd3182d6d9b9b..c2005b86ac9ff6aa03ef7937c2b7a228addc4f01 100644
index 882236c8ebad90ed2adc873de4dda3b7f3f869d9..632b74e84d6ee58da8806e30b75e16fb864afa64 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
@@ -288,7 +288,13 @@ public class Shulker extends AbstractGolem implements VariantHolder<Optional<Dye
@ -146,10 +146,10 @@ index 509c8fae366e6aeca324b4d8e39bd3182d6d9b9b..c2005b86ac9ff6aa03ef7937c2b7a228
this.clientOldAttachPosition = this.blockPosition();
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 8f7bce51e393074246575b0d8bb3cad68ecb4270..e60385c2b84ca0807ed5fc710017a1de09aa3c4e 100644
index 28cbe9ac2b8d5a21dba11b4162d187a9333e1ddb..e8fb36582430332e511c2d7ac1e604763f4052e3 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1150,7 +1150,13 @@ public abstract class Player extends LivingEntity {
@@ -1160,7 +1160,13 @@ public abstract class Player extends LivingEntity {
@Override
public void removeVehicle() {

View file

@ -7,10 +7,10 @@ Subject: [PATCH] Add more Zombie API
public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index c71d4f91df7ec1cf26888b00fac444bccbbe472e..2d6cf6ea1717b28871c40de69120336c59a4d347 100644
index d97c3c139f10a45febc0cfb1057ff6e33266228e..d981f8679149669f6ca4ea950d744149974532b2 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -93,6 +93,7 @@ public class Zombie extends Monster {
@@ -97,6 +97,7 @@ public class Zombie extends Monster {
private int inWaterTime;
public int conversionTime;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
@ -18,7 +18,7 @@ index c71d4f91df7ec1cf26888b00fac444bccbbe472e..2d6cf6ea1717b28871c40de69120336c
public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world);
@@ -261,6 +262,12 @@ public class Zombie extends Monster {
@@ -267,6 +268,12 @@ public class Zombie extends Monster {
super.aiStep();
}
@ -31,7 +31,7 @@ index c71d4f91df7ec1cf26888b00fac444bccbbe472e..2d6cf6ea1717b28871c40de69120336c
public void startUnderWaterConversion(int ticksUntilWaterConversion) {
this.lastTick = MinecraftServer.currentTick; // CraftBukkit
this.conversionTime = ticksUntilWaterConversion;
@@ -290,9 +297,15 @@ public class Zombie extends Monster {
@@ -296,9 +303,15 @@ public class Zombie extends Monster {
}
public boolean isSunSensitive() {
@ -48,7 +48,7 @@ index c71d4f91df7ec1cf26888b00fac444bccbbe472e..2d6cf6ea1717b28871c40de69120336c
@Override
public boolean hurt(DamageSource source, float amount) {
if (!super.hurt(source, amount)) {
@@ -406,6 +419,7 @@ public class Zombie extends Monster {
@@ -417,6 +430,7 @@ public class Zombie extends Monster {
nbt.putBoolean("CanBreakDoors", this.canBreakDoors());
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
@ -56,7 +56,7 @@ index c71d4f91df7ec1cf26888b00fac444bccbbe472e..2d6cf6ea1717b28871c40de69120336c
}
@Override
@@ -417,6 +431,11 @@ public class Zombie extends Monster {
@@ -428,6 +442,11 @@ public class Zombie extends Monster {
if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) {
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Book Size Limits
Puts some limits on the size of books.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e880b41e1824f986d04a0a32cc735d77f25cf987..3b3384fcbcb66a87dd50dece6bdac558491f66f0 100644
index 5d81aa23c7b1810df5d70b9972f233d84f5154eb..1854bf833f357d2c92b5e6c79149db58550aead1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1040,6 +1040,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1043,6 +1043,45 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleEditBook(ServerboundEditBookPacket packet) {
@ -54,4 +54,4 @@ index e880b41e1824f986d04a0a32cc735d77f25cf987..3b3384fcbcb66a87dd50dece6bdac558
+ // Paper end - Book size limits
// CraftBukkit start
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
this.disconnect("Book edited too quickly!");
this.disconnect(Component.literal("Book edited too quickly!"));

View file

@ -38,11 +38,11 @@ public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
public net.minecraft.server.network.ServerLoginPacketListenerImpl state
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 42c0723e2fe43e1f268119a16067e8bdfb971208..9885dec92cd26dec61c303dda687b0f910d49749 100644
index c45b8b2c89ffec7bd6a6875963c61f11185d3ee1..38947f40864f3661df2eb4baa0aef5740b82f9d9 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -680,6 +680,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
packetlistener1.onDisconnect(ichatbasecomponent);
@@ -692,6 +692,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
packetlistener1.onDisconnect(disconnectiondetails);
}
this.pendingActions.clear(); // Free up packet queue.
+ // Paper start - Add PlayerConnectionCloseEvent
@ -69,10 +69,10 @@ index 42c0723e2fe43e1f268119a16067e8bdfb971208..9885dec92cd26dec61c303dda687b0f9
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 2ca467bd9c53a59f1ca9b8e1c2cf683182a71910..5bb7b0ab8a1e566f07f7f39bf072abcbe44e73d2 100644
index b31f00f2f0b7cec59301afe36c9dd7cdc120fc9d..53b1fd2d1328bde3fe195964ce39ff5c0f5a7c05 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -79,7 +79,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -81,7 +81,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@Nullable
String requestedUsername;
@Nullable

View file

@ -16,10 +16,10 @@ intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 2313c451dbcb28e79d8ff139696e2efb0c4ae756..8b40d5418ce059ece75b02110193663b7bec0593 100644
index fcbb0b64feb8d5624de3805d4db6d489110b4e69..a2adbad6382276b149c41ff422e4aa9baba2ba1f 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -264,6 +264,7 @@ public class ServerPlayer extends Player {
@@ -268,6 +268,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
private int containerCounter;
public boolean wonGame;
private int containerUpdateDelay; // Paper - Configurable container update tick rate
@ -28,7 +28,7 @@ index 2313c451dbcb28e79d8ff139696e2efb0c4ae756..8b40d5418ce059ece75b02110193663b
public boolean queueHealthUpdatePacket;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 940896725c32981ddd2d5a23d72a87ba3e5e0fee..f472d6eb337de1274424dabe39d4e8a094710165 100644
index 91206bb797f82936abea75f1956c08a92a15bd2c..92e81514ce85f32303506d6ffc501946c0320c83 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -182,6 +182,7 @@ public abstract class PlayerList {
@ -106,10 +106,10 @@ index 461656e1cb095243bfe7a9ee2906e5b00574ae78..411b280ac3e27e72091db813c0c9b69b
public Location getLastDeathLocation() {
if (this.getData().contains("LastDeathLocation", 10)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index eb021ba25053cdfd4b221f669104f6442d18b102..0b1ffa30d633d96522f5b768d8341366ecd46624 100644
index 4d07f2c4a67a153f1613993590da4a9789d27e39..835384edd522c94dd07ee6837697099bed5979a7 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -208,6 +208,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -210,6 +210,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener();
public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
@ -117,7 +117,7 @@ index eb021ba25053cdfd4b221f669104f6442d18b102..0b1ffa30d633d96522f5b768d8341366
public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity);
@@ -2031,6 +2032,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2044,6 +2045,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.firstPlayed = firstPlayed;
}
@ -136,7 +136,7 @@ index eb021ba25053cdfd4b221f669104f6442d18b102..0b1ffa30d633d96522f5b768d8341366
public void readExtraData(CompoundTag nbttagcompound) {
this.hasPlayedBefore = true;
if (nbttagcompound.contains("bukkit")) {
@@ -2053,6 +2066,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2066,6 +2079,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setExtraData(CompoundTag nbttagcompound) {
@ -145,7 +145,7 @@ index eb021ba25053cdfd4b221f669104f6442d18b102..0b1ffa30d633d96522f5b768d8341366
if (!nbttagcompound.contains("bukkit")) {
nbttagcompound.put("bukkit", new CompoundTag());
}
@@ -2067,6 +2082,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2080,6 +2095,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
data.putLong("firstPlayed", this.getFirstPlayed());
data.putLong("lastPlayed", System.currentTimeMillis());
data.putString("lastKnownName", handle.getScoreboardName());

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8b40d5418ce059ece75b02110193663b7bec0593..3354c929142b56a992348ff1a6f262b36d24d3a5 100644
index a2adbad6382276b149c41ff422e4aa9baba2ba1f..dfa3542035924ed53a1fafb032334b0bffbe0282 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1799,6 +1799,13 @@ public class ServerPlayer extends Player {
@@ -1836,6 +1836,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public void disconnect() {
this.disconnected = true;
this.ejectPassengers();

View file

@ -8,10 +8,10 @@ We just add a check to ensure that the CraftPlayer's handle
is a ServerPlayer
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0b1ffa30d633d96522f5b768d8341366ecd46624..332f916a5063aa3048675eb906bb3ff5050b37bb 100644
index 835384edd522c94dd07ee6837697099bed5979a7..b03813ebc9aa665f670767be9c37cbb84756838e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -222,8 +222,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -224,8 +224,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void remove() {

View file

@ -11,7 +11,7 @@ floating in the air.
This can replace many uses of BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index be2220eff094c735bdb0c3e777bfbcfa4d44a578..30ceb1e2765217e284abcb786b2c1f7b60f9c3dc 100644
index c0b0a9328faf93b85ceaf6cc9989f1a59520c7f4..8e2acb3c6f815b5b1d3237a2f4e0b5f3683d2c60 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -25,6 +25,7 @@ import net.minecraft.core.registries.Registries;
@ -22,7 +22,7 @@ index be2220eff094c735bdb0c3e777bfbcfa4d44a578..30ceb1e2765217e284abcb786b2c1f7b
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.FullChunkStatus;
import net.minecraft.server.level.ServerLevel;
@@ -575,9 +576,26 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -576,9 +577,26 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return false;
} else {
FluidState fluid = this.getFluidState(pos);

View file

@ -9,10 +9,10 @@ commands if the server is restarting. Using the default async pool caused issues
due to the shutdown logic generally being much later.
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index eec5279ac4386132fa053c57889e32e6b8141614..b754c0b3e2cd878fca5f702daca64f837ec83451 100644
index 72756ef14b8ec8afd80313b9f6aaf76722cb18cf..a05aea8561ac102476ee1b3068942b095950a86a 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -452,6 +452,24 @@ public class Commands {
@@ -450,6 +450,24 @@ public class Commands {
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
// CraftBukkit start
// Register Vanilla commands into builtRoot as before
@ -37,7 +37,7 @@ index eec5279ac4386132fa053c57889e32e6b8141614..b754c0b3e2cd878fca5f702daca64f83
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
RootCommandNode vanillaRoot = new RootCommandNode();
@@ -469,7 +487,14 @@ public class Commands {
@@ -467,7 +485,14 @@ public class Commands {
for (CommandNode node : rootcommandnode.getChildren()) {
bukkit.add(node.getName());
}
@ -53,10 +53,10 @@ index eec5279ac4386132fa053c57889e32e6b8141614..b754c0b3e2cd878fca5f702daca64f83
event.getPlayer().getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4d47119e1780f7d7b53493cc82ffacf70dae54df..8cf548656f7ec76c1663cd16b83d94bf3582d020 100644
index 3d9a333c0f8175fd3b961185f52ea9a83a2fbeb3..6494b92c6a6444a66ea0e5f8f2890c47f334c938 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -924,6 +924,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -931,6 +931,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
MinecraftServer.LOGGER.info("Stopping server");

View file

@ -87,10 +87,10 @@ index d9fc3c25bef251df6a53ee47ec224b07240a931c..2a22827f44dd0d524c22264447959a69
public boolean hasPermission(int level) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index b754c0b3e2cd878fca5f702daca64f837ec83451..f15c388434a0a501f86868de35cc138756975027 100644
index a05aea8561ac102476ee1b3068942b095950a86a..2b5235aea933462ca711abb5b59b6715a9af5ecb 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -488,6 +488,7 @@ public class Commands {
@@ -486,6 +486,7 @@ public class Commands {
bukkit.add(node.getName());
}
// Paper start - Perf: Async command map building
@ -98,7 +98,7 @@ index b754c0b3e2cd878fca5f702daca64f837ec83451..f15c388434a0a501f86868de35cc1387
net.minecraft.server.MinecraftServer.getServer().execute(() -> {
runSync(player, bukkit, rootcommandnode);
});
@@ -495,6 +496,7 @@ public class Commands {
@@ -493,6 +494,7 @@ public class Commands {
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
// Paper end - Perf: Async command map building
@ -106,7 +106,7 @@ index b754c0b3e2cd878fca5f702daca64f837ec83451..f15c388434a0a501f86868de35cc1387
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
event.getPlayer().getServer().getPluginManager().callEvent(event);
@@ -513,6 +515,11 @@ public class Commands {
@@ -511,6 +513,11 @@ public class Commands {
while (iterator.hasNext()) {
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
@ -119,10 +119,10 @@ index b754c0b3e2cd878fca5f702daca64f837ec83451..f15c388434a0a501f86868de35cc1387
if (commandnode2.canUse(source)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 3b3384fcbcb66a87dd50dece6bdac558491f66f0..04a9c48b9a9895ffe6ec0721bdfafb1b524bf386 100644
index 1854bf833f357d2c92b5e6c79149db58550aead1..26228dbf1830134c185e884b22487e3e40ccf3aa 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -766,19 +766,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -769,19 +769,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
builder.suggest(completion.suggestion(), PaperAdventure.asVanilla(completion.tooltip()));
}
}

View file

@ -12,7 +12,7 @@ public net.minecraft.world.entity.player.StackedContents put(II)V
diff --git a/src/main/java/io/papermc/paper/inventory/recipe/RecipeBookExactChoiceRecipe.java b/src/main/java/io/papermc/paper/inventory/recipe/RecipeBookExactChoiceRecipe.java
new file mode 100644
index 0000000000000000000000000000000000000000..2a2f8327a5bd3983a3a13fd663beb98906f27312
index 0000000000000000000000000000000000000000..ef68600f6b59674ddea6c77f7e412902888e39b7
--- /dev/null
+++ b/src/main/java/io/papermc/paper/inventory/recipe/RecipeBookExactChoiceRecipe.java
@@ -0,0 +1,30 @@
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..2a2f8327a5bd3983a3a13fd663beb989
+import net.minecraft.world.item.crafting.Ingredient;
+import net.minecraft.world.item.crafting.Recipe;
+
+public abstract class RecipeBookExactChoiceRecipe<C extends Container> implements Recipe<C> {
+public abstract class RecipeBookExactChoiceRecipe<C extends net.minecraft.world.item.crafting.RecipeInput> implements Recipe<C> {
+
+ private boolean hasExactIngredients;
+
@ -143,18 +143,18 @@ index 0000000000000000000000000000000000000000..413dfa52760db393ad6a8b5341200ee7
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
index fc97748870f2cddea5d5b3afed756d6383fecfa8..5c5a4b4450301cd3bc7c895f976b991467234a42 100644
index 0bd749af8014dd437229594ef6981a2ead803990..25acc13ba1adcc31a83f9cf29563760285f2ba7a 100644
--- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
+++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java
@@ -34,6 +34,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
@@ -31,6 +31,7 @@ public class ServerPlaceRecipe<I extends RecipeInput, R extends Recipe<I>> imple
this.inventory = entity.getInventory();
if (this.testClearGrid() || entity.isCreative()) {
this.stackedContents.clear();
+ this.stackedContents.initialize(recipe.value()); // Paper - Improve exact choice recipe ingredients
entity.getInventory().fillStackedContents(this.stackedContents);
this.menu.fillCraftSlotsStackedContents(this.stackedContents);
if (this.stackedContents.canCraft((Recipe<?>)recipe.value(), null)) {
@@ -80,7 +81,7 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
if (this.stackedContents.canCraft(recipe.value(), null)) {
@@ -77,7 +78,7 @@ public class ServerPlaceRecipe<I extends RecipeInput, R extends Recipe<I>> imple
int l = k;
for (int m : intList) {
@ -163,46 +163,48 @@ index fc97748870f2cddea5d5b3afed756d6383fecfa8..5c5a4b4450301cd3bc7c895f976b9914
if (!itemStack2.isEmpty()) {
int n = itemStack2.getMaxStackSize();
if (n < l) {
@@ -99,10 +100,21 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
@@ -96,12 +97,22 @@ public class ServerPlaceRecipe<I extends RecipeInput, R extends Recipe<I>> imple
@Override
public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) {
public void addItemToSlot(Integer input, int slot, int amount, int gridX, int gridY) {
Slot slot2 = this.menu.getSlot(slot);
- ItemStack itemStack = StackedContents.fromStackingIndex(inputs.next());
- ItemStack itemStack = StackedContents.fromStackingIndex(input);
+ // Paper start - Improve exact choice recipe ingredients
+ final int itemId = inputs.next();
+ ItemStack itemStack = null;
+ boolean isExact = false;
+ if (this.stackedContents.extrasMap != null && itemId >= net.minecraft.core.registries.BuiltInRegistries.ITEM.size()) {
+ itemStack = StackedContents.fromStackingIndexExtras(itemId, this.stackedContents.extrasMap).copy();
+ if (this.stackedContents.extrasMap != null && input >= net.minecraft.core.registries.BuiltInRegistries.ITEM.size()) {
+ itemStack = StackedContents.fromStackingIndexExtras(input, this.stackedContents.extrasMap).copy();
+ isExact = true;
+ }
+ if (itemStack == null) {
+ itemStack = StackedContents.fromStackingIndex(itemId);
+ itemStack = StackedContents.fromStackingIndex(input);
+ }
+ // Paper end - Improve exact choice recipe ingredients
if (!itemStack.isEmpty()) {
for (int i = 0; i < amount; i++) {
- this.moveItemToGrid(slot2, itemStack);
+ this.moveItemToGrid(slot2, itemStack, isExact); // Paper - Improve exact choice recipe ingredients
}
}
}
@@ -131,8 +143,14 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ
int i = amount;
while (i > 0) {
- i = this.moveItemToGrid(slot2, itemStack, i);
+ i = this.moveItemToGrid(slot2, itemStack, i, isExact); // Paper - Improve exact choice recipe ingredients
if (i == -1) {
return;
}
@@ -133,8 +144,15 @@ public class ServerPlaceRecipe<I extends RecipeInput, R extends Recipe<I>> imple
return i;
}
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Improve exact choice recipe ingredients
protected void moveItemToGrid(Slot slot, ItemStack stack) {
- int i = this.inventory.findSlotMatchingUnusedItem(stack);
+
protected int moveItemToGrid(Slot slot, ItemStack stack, int i) {
- int j = this.inventory.findSlotMatchingUnusedItem(stack);
+ // Paper start - Improve exact choice recipe ingredients
+ this.moveItemToGrid(slot, stack, false);
+ return this.moveItemToGrid(slot, stack, i, false);
+ }
+ protected void moveItemToGrid(Slot slot, ItemStack stack, final boolean isExact) {
+ int i = isExact ? this.inventory.findSlotMatchingItem(stack) : this.inventory.findSlotMatchingUnusedItem(stack);
+ protected int moveItemToGrid(Slot slot, ItemStack stack, int i, final boolean isExact) {
+ int j = isExact ? this.inventory.findSlotMatchingItem(stack) : this.inventory.findSlotMatchingUnusedItem(stack);
+ // Paper end - Improve exact choice recipe ingredients
if (i != -1) {
ItemStack itemStack = this.inventory.getItem(i);
if (!itemStack.isEmpty()) {
if (j == -1) {
return -1;
} else {
diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java
index b11121e0846183ceeb7f4ad536aab2ee89ea9d26..0a58698dcd62adf3dc06a8c7dc782aada50409f5 100644
--- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java
@ -296,19 +298,19 @@ index b11121e0846183ceeb7f4ad536aab2ee89ea9d26..0a58698dcd62adf3dc06a8c7dc782aad
}
}
diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
index 3b55a36192f75fafcf2f37727d891b461ca494a1..e037647ea39c5ecc566a9198bb77fecc0ed3f997 100644
index f3b6466089ee8be59747a16aac2cac84be30617d..45c80500201aabc1e8643427ebfb8818ab966750 100644
--- a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
@@ -6,7 +6,7 @@ import net.minecraft.world.Container;
@@ -5,7 +5,7 @@ import net.minecraft.core.NonNullList;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
-public abstract class AbstractCookingRecipe implements Recipe<Container> {
+public abstract class AbstractCookingRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<Container> implements Recipe<Container> { // Paper - improve exact recipe choices
-public abstract class AbstractCookingRecipe implements Recipe<SingleRecipeInput> {
+public abstract class AbstractCookingRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<SingleRecipeInput> implements Recipe<SingleRecipeInput> { // Paper - improve exact recipe choices
protected final RecipeType<?> type;
protected final CookingBookCategory category;
protected final String group;
@@ -25,6 +25,7 @@ public abstract class AbstractCookingRecipe implements Recipe<Container> {
@@ -24,6 +24,7 @@ public abstract class AbstractCookingRecipe implements Recipe<SingleRecipeInput>
this.result = result;
this.experience = experience;
this.cookingTime = cookingTime;
@ -317,10 +319,10 @@ index 3b55a36192f75fafcf2f37727d891b461ca494a1..e037647ea39c5ecc566a9198bb77fecc
@Override
diff --git a/src/main/java/net/minecraft/world/item/crafting/Recipe.java b/src/main/java/net/minecraft/world/item/crafting/Recipe.java
index 5ccc99f8a64503db4478662f31a035b1ca7daade..b975bd02087ee40fc9d35ebd99b7730bb26ef6b2 100644
index 3cab383e01c124349f3f96bcbcfe91356d51aa30..b57568d5e9c4c148a4b3c303c925a813fdd5dc67 100644
--- a/src/main/java/net/minecraft/world/item/crafting/Recipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/Recipe.java
@@ -74,4 +74,10 @@ public interface Recipe<C extends Container> {
@@ -73,4 +73,10 @@ public interface Recipe<T extends RecipeInput> {
}
org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id); // CraftBukkit
@ -332,19 +334,19 @@ index 5ccc99f8a64503db4478662f31a035b1ca7daade..b975bd02087ee40fc9d35ebd99b7730b
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
index 22f8396b438a0ca4532190e1a27f0f5ad77832c5..482d7b12b80328fba97a01bcfeb974b7ac4bcdb7 100644
index 59372daacd6fef45373c0557ccebb6ff5f16f174..63cf2b66f51df68aa3f6d98c69368ce454869d64 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
@@ -18,7 +18,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
@@ -17,7 +17,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
import org.bukkit.inventory.RecipeChoice;
// CraftBukkit end
-public class ShapedRecipe implements CraftingRecipe {
+public class ShapedRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingContainer> implements CraftingRecipe { // Paper - improve exact recipe choices
+public class ShapedRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingInput> implements CraftingRecipe { // Paper - improve exact recipe choices
final ShapedRecipePattern pattern;
final ItemStack result;
@@ -32,6 +32,7 @@ public class ShapedRecipe implements CraftingRecipe {
@@ -31,6 +31,7 @@ public class ShapedRecipe implements CraftingRecipe {
this.pattern = raw;
this.result = result;
this.showNotification = showNotification;
@ -353,19 +355,19 @@ index 22f8396b438a0ca4532190e1a27f0f5ad77832c5..482d7b12b80328fba97a01bcfeb974b7
public ShapedRecipe(String group, CraftingBookCategory category, ShapedRecipePattern raw, ItemStack result) {
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
index 5d58922c0953b997ad7f2a174e2ca60f81789305..3554109bcc4651ca93b6275c914e57e007e2204e 100644
index 62401d045245ec7e303ec526c09b5e6fa4c9f17b..5740296b55827f11c0029e89a86eaab1a24f560c 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipe.java
@@ -21,7 +21,7 @@ import org.bukkit.craftbukkit.inventory.CraftRecipe;
@@ -19,7 +19,7 @@ import org.bukkit.craftbukkit.inventory.CraftRecipe;
import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
// CraftBukkit end
-public class ShapelessRecipe implements CraftingRecipe {
+public class ShapelessRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingContainer> implements CraftingRecipe { // Paper - improve exact recipe choices
+public class ShapelessRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingInput> implements CraftingRecipe { // Paper - improve exact recipe choices
final String group;
final CraftingBookCategory category;
@@ -33,6 +33,7 @@ public class ShapelessRecipe implements CraftingRecipe {
@@ -31,6 +31,7 @@ public class ShapelessRecipe implements CraftingRecipe {
this.category = category;
this.result = result;
this.ingredients = ingredients;
@ -373,11 +375,21 @@ index 5d58922c0953b997ad7f2a174e2ca60f81789305..3554109bcc4651ca93b6275c914e57e0
}
// CraftBukkit start
@@ -78,6 +79,7 @@ public class ShapelessRecipe implements CraftingRecipe {
@@ -75,7 +76,16 @@ public class ShapelessRecipe implements CraftingRecipe {
}
public boolean matches(CraftingContainer inventory, Level world) {
StackedContents autorecipestackmanager = new StackedContents();
+ autorecipestackmanager.initialize(this); // Paper - better exact choice recipes
int i = 0;
public boolean matches(CraftingInput input, Level world) {
- return input.ingredientCount() != this.ingredients.size() ? false : (input.size() == 1 && this.ingredients.size() == 1 ? ((Ingredient) this.ingredients.getFirst()).test(input.getItem(0)) : input.stackedContents().canCraft(this, (IntList) null));
+ // Paper start - unwrap ternary & better exact choice recipes
+ if (input.ingredientCount() != this.ingredients.size()) {
+ return false;
+ }
+ if (input.size() == 1 && this.ingredients.size() == 1) {
+ return this.ingredients.getFirst().test(input.getItem(0));
+ }
+ input.stackedContents().initialize(this); // setup stacked contents for this recipe
+ return input.stackedContents().canCraft(this, null);
+ // Paper end - unwrap ternary & better exact choice recipes
}
for (int j = 0; j < inventory.getContainerSize(); ++j) {
public ItemStack assemble(CraftingInput input, HolderLookup.Provider lookup) {

View file

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Noah van der Aa <ndvdaa@gmail.com>
Date: Mon, 29 Apr 2024 23:12:33 +0200
Subject: [PATCH] Catch JsonParseException in block entity names
As a result, data that no longer parses correctly will not crash the server
instead just logging the exception and continuing (and in most cases should
fix the data)
Player data is fixed pretty much immediately but some block data (like
Shulkers) may need to be changed in order for it to re-save properly
No more crashing though.
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index 81d9a4e6bc1bc4f992ecb77b176daf89d645bbf2..e79b1ccbdf12006d72401b5be1ac25187033ec59 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -151,7 +151,7 @@ public class SkullBlockEntity extends BlockEntity {
}
if (nbt.contains("custom_name", 8)) {
- this.customName = Component.Serializer.fromJson(nbt.getString("custom_name"), registryLookup);
+ this.customName = BlockEntity.parseCustomNameSafe(nbt.getString("custom_name"), registryLookup); // Paper
} else {
this.customName = null;
}