some more patches

This commit is contained in:
Jake Potrebic 2023-06-07 17:54:54 -07:00
parent c13b259ff2
commit 236eabd751
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
44 changed files with 121 additions and 150 deletions

View File

@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..09837f6e6c6ab8a1df2aacdb86646993
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index 56033c41c2be567d6787420d319d4603fc0a1d10..354d386940b5ee7c92708390b83db51c281660f4 100644
index d19585f0833d13867f242768dc7ed952add87e05..3ef4e3c028761ca1656b823eda3cf015c16075cf 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -121,6 +121,24 @@ public abstract class ChunkGenerator {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Collision option for requiring a player participant
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 909d9da2e0b30d4bf187623a46695c86d67b2248..4dc8a8fcffddfc6673d5c161be1224d822ad3dab 100644
index ebafdcbea42abde85c63ad4bbb426a811d3811e9..1f92d5dbaad1fb2bdfedb6c2044aa99a61388b21 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1800,6 +1800,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1834,6 +1834,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) {
@ -17,19 +17,19 @@ index 909d9da2e0b30d4bf187623a46695c86d67b2248..4dc8a8fcffddfc6673d5c161be1224d8
double d1 = entity.getZ() - this.getZ();
double d2 = Mth.absMax(d0, d1);
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index a2e3b3a60ec31f2399f733ab1931c060ced7ae6d..33dd6f9b3fde5bd19cfc6386dd9454df4a887489 100644
index 1f909082eb123bfe37e1078962ee7d71c78a8194..b9ca93026797874c8fa2d68e7177ca1fc0724da7 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -833,6 +833,7 @@ public abstract class AbstractMinecart extends Entity {
@@ -840,6 +840,7 @@ public abstract class AbstractMinecart extends Entity {
public void push(Entity entity) {
if (!this.level.isClientSide) {
if (!this.level().isClientSide) {
if (!entity.noPhysics && !this.noPhysics) {
+ if (!this.level.paperConfig().collisions.allowVehicleCollisions && this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper
if (!this.hasPassenger(entity)) {
// CraftBukkit start
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index b2ecd45588d930f6847d11d3fb3c5fb02abd7737..8b562ca6cc92c31c764aebf05d511e347cff8a83 100644
index b978d5fb28ef1472bd890df0229cf7535ead6b00..9fd8c9b82ee6a2cf94a90d0acb42637a2fde7ad5 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -246,6 +246,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {

View File

@ -7,7 +7,7 @@ The duplicate ProjectileHitEvent in EntityFireball was removed. The
event was always called before the duplicate call.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
index cf87b51d1914274bd3e32a387629be7b04cf1734..2096e8a0bdbcfc865f175f3a01ab688542481531 100644
index b430d508e69de01d8271a73e0ed41865dcf012c4..6c9a8f062f989db022154155e8a05b334a0510da 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
@@ -88,7 +88,7 @@ public abstract class AbstractHurtingProjectile extends Projectile {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Return chat component with empty text instead of throwing
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 75f809ee3d46971ce2ae9ec5bc89aeec1e85fdfb..ec1da07fdfc86c2905766886f6f922320c73fb6a 100644
index 4ac91ba7dc754b120189fd32d24076d51b17d7c6..19b0ae77e99c972159cb236403f420baa0cc46e0 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -89,7 +89,12 @@ public abstract class AbstractContainerMenu {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Make schedule command per-world
diff --git a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
index 2c6d5f22ef41601f863b11e2e626621d8047dd14..1eb93353766208f52e385ab445cfb754e42b7f3d 100644
index e4b4cea196cc3274317cd93351ec50196d318ee9..20d1cf83438272ad774a805b4b3b87546485c787 100644
--- a/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
+++ b/src/main/java/net/minecraft/server/commands/ScheduleCommand.java
@@ -31,7 +31,7 @@ public class ScheduleCommand {
@ -17,7 +17,7 @@ index 2c6d5f22ef41601f863b11e2e626621d8047dd14..1eb93353766208f52e385ab445cfb754
};
public ScheduleCommand() {}
@@ -82,7 +82,7 @@ public class ScheduleCommand {
@@ -86,7 +86,7 @@ public class ScheduleCommand {
}
private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Configurable max leash distance
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index bffec7fdf49994f702ea4c378237dac0983d0a19..56d64f3836391fabfa9d3362d9bd62182ea6e290 100644
index 5f3a14ca456e65894e824864ccf3cd5fabc9c6bd..d84f49457a759f0dd556df8a9634239b530e2761 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -48,7 +48,7 @@ public abstract class PathfinderMob extends Mob {
@ -13,8 +13,8 @@ index bffec7fdf49994f702ea4c378237dac0983d0a19..56d64f3836391fabfa9d3362d9bd6218
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
- if (f > 10.0F) {
+ if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper
this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.dropLeash(true, true);
}
@@ -57,7 +57,7 @@ public abstract class PathfinderMob extends Mob {
@ -22,7 +22,7 @@ index bffec7fdf49994f702ea4c378237dac0983d0a19..56d64f3836391fabfa9d3362d9bd6218
this.onLeashDistance(f);
- if (f > 10.0F) {
+ if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper
this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.dropLeash(true, true);
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement BlockPreDispenseEvent
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
index 85c5319837295bd2f85baebfe8d6660b267f1d5f..8f55d0753fa26924235c943595f0d1a06a933a6f 100644
index 9ec043ff2cd38e589066a3eb7f42834e4e7592cf..4720b884e1e311f44a012f1219fe648a411247b4 100644
--- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@@ -93,6 +93,7 @@ public class DispenserBlock extends BaseEntityBlock {
@@ -92,6 +92,7 @@ public class DispenserBlock extends BaseEntityBlock {
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
if (idispensebehavior != DispenseItemBehavior.NOOP) {
@ -17,7 +17,7 @@ index 85c5319837295bd2f85baebfe8d6660b267f1d5f..8f55d0753fa26924235c943595f0d1a0
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index df9c057391d28fb47b722d006aa0c828863ea6b2..1e4d8cc53941ead119769d16cc82db1a7be1f6da 100644
index 12a8e9f41dfff700a8e5b8874cf1317e6d68e43a..79451f5aec55829f41670cb4366e6971d18c6ece 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1936,5 +1936,11 @@ public class CraftEventFactory {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
index 31c7fc4eb9fc2bf0be1e4c45758b116e8e007747..1ffbb43bfdb173689fdd9d2398b021846e0246fa 100644
index 79fba896aabe1ff2a19f6c50f5dfdb351587e391..335d0a85378c04dd466fafd42048b2474c815cb9 100644
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
@@ -158,13 +158,27 @@ public class BeaconMenu extends AbstractContainerMenu {

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Add toggle for always placing the dragon egg
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index ed0d1d6285556f0949a7ea81ad692b663ec191a7..1ee1b757b90ae0d080aa57f4186228a6f4279c1f 100644
index 58823aeb8316628be716051b74307b01c37ad8a0..2be95e545ca85cf94b1e847ff452cd586c4eea05 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -370,7 +370,7 @@ public class EndDragonFight {
@@ -356,7 +356,7 @@ public class EndDragonFight {
this.dragonEvent.setVisible(false);
this.spawnExitPortal(true);
this.spawnNewGateway();
- if (!this.previouslyKilled) {
+ if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg
this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState());
this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent
Co-Authored-By: MiniDigger <admin@benndorf.dev>
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index 24c31e96be460bcb5062a1fcf7f86c1affc4978c..7b4f8e897e9876cea1562cdf746a57940044987a 100644
index 00f01ab2eff69c18b50ec07b7623af66c66a28b6..1b1f814770d1a906ed880df578845be2e9a14f46 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -62,7 +62,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
@ -18,7 +18,7 @@ index 24c31e96be460bcb5062a1fcf7f86c1affc4978c..7b4f8e897e9876cea1562cdf746a5794
this.recipes = Lists.newArrayList();
this.input = ItemStack.EMPTY;
this.slotUpdateListener = () -> {
@@ -156,7 +156,29 @@ public class StonecutterMenu extends AbstractContainerMenu {
@@ -160,7 +160,29 @@ public class StonecutterMenu extends AbstractContainerMenu {
@Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
if (this.isValidRecipeIndex(id)) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index fa9cc50488d5044e13a97fb4aa9269fec999ad88..608cce7fe11cc873299440895f1fff62bdfcba8a 100644
index 76b2772fb79ebb4e0712d1e501c37fd14ea2fa62..1887b9cd309556eeacac2a5e5cd922560101fa72 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1295,12 +1295,15 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1298,12 +1298,15 @@ public abstract class Mob extends LivingEntity implements Targeting {
return InteractionResult.PASS;
} else if (this.getLeashHolder() == player) {
// CraftBukkit start - fire PlayerUnleashEntityEvent
@ -24,63 +24,63 @@ index fa9cc50488d5044e13a97fb4aa9269fec999ad88..608cce7fe11cc873299440895f1fff62
- this.dropLeash(true, !player.getAbilities().instabuild);
+ this.dropLeash(true, event.isDropLeash()); // Paper - drop leash variable
this.gameEvent(GameEvent.ENTITY_INTERACT, player);
return InteractionResult.sidedSuccess(this.level.isClientSide);
return InteractionResult.sidedSuccess(this.level().isClientSide);
} else {
@@ -1469,8 +1472,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1471,8 +1474,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE, true);
+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? EntityUnleashEvent.UnleashReason.PLAYER_UNLEASH : EntityUnleashEvent.UnleashReason.HOLDER_GONE, true);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
}
}
@@ -1533,8 +1539,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1535,8 +1541,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
boolean flag1 = super.startRiding(entity, force);
if (flag1 && this.isLeashed()) {
- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, true);
+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
}
return flag1;
@@ -1717,8 +1726,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1719,8 +1728,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();
- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.dropLeash(true, false);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, false);
+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
this.getAllSlots().forEach((itemstack) -> {
if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit
});
if (!itemstack.isEmpty()) {
itemstack.setCount(0);
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index 56d64f3836391fabfa9d3362d9bd62182ea6e290..e49fb8be7d3975506a6c39c87cace664e45b3c86 100644
index d84f49457a759f0dd556df8a9634239b530e2761..a4dfe40d30a5abf5d614d0921b3b23023fdbc4b1 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -49,8 +49,11 @@ public abstract class PathfinderMob extends Mob {
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper
- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
}
@ -89,19 +89,19 @@ index 56d64f3836391fabfa9d3362d9bd62182ea6e290..e49fb8be7d3975506a6c39c87cace664
@@ -58,8 +61,11 @@ public abstract class PathfinderMob extends Mob {
this.onLeashDistance(f);
if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper
- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);
} else if (f > 6.0F) {
double d0 = (entity.getX() - this.getX()) / (double) f;
diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
index b5e35033e63da0e5f2c21fddf3b704d6730f0938..7a6cdae1b566f59508b180e720de4eff4ccf13d5 100644
index 16784fcc853e23689a854e7dc6c03ed8182a164e..4eb97572a97a8d98af37c4223f42fc63659bc0ca 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java
@@ -126,11 +126,14 @@ public class LeashFenceKnotEntity extends HangingEntity {
@ -122,7 +122,7 @@ index b5e35033e63da0e5f2c21fddf3b704d6730f0938..7a6cdae1b566f59508b180e720de4eff
flag1 = true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 1e4d8cc53941ead119769d16cc82db1a7be1f6da..b20e4452b8cf5d7ed50db0de24f1167de6253a11 100644
index 79451f5aec55829f41670cb4366e6971d18c6ece..484b318abe3353e551552fbebd611f9201311643 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1558,8 +1558,10 @@ public class CraftEventFactory {
@ -135,6 +135,6 @@ index 1e4d8cc53941ead119769d16cc82db1a7be1f6da..b20e4452b8cf5d7ed50db0de24f1167d
+ public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(Mob entity, net.minecraft.world.entity.player.Player player, InteractionHand enumhand, boolean dropLeash) {
+ PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand), dropLeash);
+ // Paper end
entity.level.getCraftServer().getPluginManager().callEvent(event);
entity.level().getCraftServer().getPluginManager().callEvent(event);
return event;
}

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Reset shield blocking on dimension change
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index cd2d5dc3a51a4600699bd20630d32a7d0897900e..ed9c6a4664b995fb62c97f86ce69a473b47f7efb 100644
index 38a24e4561dc9be4f95db5c0d0e4465ce3b4a2a4..e38638cc2995ca9c49acb5fa50508db1c0ce00fd 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1200,6 +1200,11 @@ public class ServerPlayer extends Player {
this.level.getCraftServer().getPluginManager().callEvent(changeEvent);
@@ -1198,6 +1198,11 @@ public class ServerPlayer extends Player {
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end
}
+ // Paper start

View File

@ -5,24 +5,24 @@ Subject: [PATCH] add DragonEggFormEvent
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 1ee1b757b90ae0d080aa57f4186228a6f4279c1f..abd13cefd3d8409e1ef8ea70d92877f76f89da6c 100644
index 2be95e545ca85cf94b1e847ff452cd586c4eea05..eab54838ba540f41cc59a359dd00ba80d82c771e 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -370,9 +370,23 @@ public class EndDragonFight {
@@ -356,9 +356,23 @@ public class EndDragonFight {
this.dragonEvent.setVisible(false);
this.spawnExitPortal(true);
this.spawnNewGateway();
+ // Paper start - DragonEggFormEvent
+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION);
+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin));
+ org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition);
+ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
+ io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition), eggState,
+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
+ // Paper end - DragonEggFormEvent
if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg
- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState());
- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
+ // Paper start - DragonEggFormEvent
+ //this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState());
+ // this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
+ } else {
+ eggEvent.setCancelled(true);
+ }

View File

@ -5,10 +5,10 @@ Subject: [PATCH] EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9e3dc2ba64b146d1715b81be7202ddbd0122382e..7ad22703d50667849e195d3e7b6792078104425c 100644
index 571352506c8c76cca674dcc0c6e17d8ab89d1572..31a9b86f9e9e837b10717a37177552cc4588a01a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1507,6 +1507,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1512,6 +1512,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
@ -17,10 +17,10 @@ index 9e3dc2ba64b146d1715b81be7202ddbd0122382e..7ad22703d50667849e195d3e7b679207
this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2af673fe240fbb0ce7667e207a833d09afa7074b..652b2c5dc17c6ba65eb59cbd3ac218d280fef044 100644
index 7222bee995a3628629d40e94d70ada0730d05e28..e3067058aacfcc06910d106b68934dc285bbd11a 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -217,6 +217,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -220,6 +220,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper
@ -29,27 +29,27 @@ index 2af673fe240fbb0ce7667e207a833d09afa7074b..652b2c5dc17c6ba65eb59cbd3ac218d2
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index fcd670d1371dca3bb644dfea79f98670d75a68a4..276cdeb349c6b9c23ff4198beb807b5f090de3b6 100644
index 922e953234998f1322cb9fb72b02321b7975a674..7952ba7e7e9f36fe6dea851dbc239d39ff61a74a 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3291,6 +3291,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3340,6 +3340,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.pushEntities();
this.level.getProfiler().pop();
this.level().getProfiler().pop();
+ // Paper start
+ if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
+ if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
+ Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
+ Location to = new Location (this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) {
+ if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
+ Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
+ Location to = new Location (this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
+ io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
+ if (!event.callEvent()) {
+ absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
+ this.absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch());
+ } else if (!to.equals(event.getTo())) {
+ absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
+ this.absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
+ }
+ }
+ }
+ // Paper end
if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 652b2c5dc17c6ba65eb59cbd3ac218d280fef044..421bec0fead072a8f0e8756f9ba3670d8465842f 100644
index e3067058aacfcc06910d106b68934dc285bbd11a..010024a8ea56455ebfb16d70fffd1d51a169b411 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1511,6 +1511,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1420,6 +1420,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
this.getChunkSource().blockChanged(pos);
@ -16,7 +16,7 @@ index 652b2c5dc17c6ba65eb59cbd3ac218d280fef044..421bec0fead072a8f0e8756f9ba3670d
VoxelShape voxelshape = oldState.getCollisionShape(this, pos);
VoxelShape voxelshape1 = newState.getCollisionShape(this, pos);
@@ -1552,6 +1553,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1461,6 +1462,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}

View File

@ -7,13 +7,13 @@ Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is
critical section for much of the server, including the lighting engine.
diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java
index 3010e5dfbed06ef61ccbc49de790209beff0259b..82bce6109d59cba30178a446f0ff129da6f3692f 100644
index 3abec6de94f0ef1d788320e33653c598887f17ca..d0a8092bf57a29ab7c00ec0ddf52a9fdb2a33267 100644
--- a/src/main/java/net/minecraft/core/Direction.java
+++ b/src/main/java/net/minecraft/core/Direction.java
@@ -62,6 +62,11 @@ public enum Direction implements StringRepresentable {
}, (direction1, direction2) -> {
throw new IllegalArgumentException("Duplicate keys");
}, Long2ObjectOpenHashMap::new));
@@ -52,6 +52,11 @@ public enum Direction implements StringRepresentable {
})).toArray((i) -> {
return new Direction[i];
});
+ // Paper start
+ private final int adjX;
+ private final int adjY;
@ -22,7 +22,7 @@ index 3010e5dfbed06ef61ccbc49de790209beff0259b..82bce6109d59cba30178a446f0ff129d
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id;
@@ -71,6 +76,11 @@ public enum Direction implements StringRepresentable {
@@ -61,6 +66,11 @@ public enum Direction implements StringRepresentable {
this.axis = axis;
this.axisDirection = direction;
this.normal = vector;
@ -34,7 +34,7 @@ index 3010e5dfbed06ef61ccbc49de790209beff0259b..82bce6109d59cba30178a446f0ff129d
}
public static Direction[] orderedByNearest(Entity entity) {
@@ -358,15 +368,15 @@ public enum Direction implements StringRepresentable {
@@ -348,15 +358,15 @@ public enum Direction implements StringRepresentable {
}
public int getStepX() {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index b20e4452b8cf5d7ed50db0de24f1167de6253a11..0e8029a9beeb8bee245f1c94c8ee596ec0131177 100644
index 484b318abe3353e551552fbebd611f9201311643..7ef3e4dd903c77fd6112e90999a474ff674a5e7f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -418,13 +418,30 @@ public class CraftEventFactory {
@ -24,12 +24,12 @@ index b20e4452b8cf5d7ed50db0de24f1167de6253a11..0e8029a9beeb8bee245f1c94c8ee596e
if (!event.isCancelled()) {
- for (ItemEntity item : items) {
- item.level.addFreshEntity(item);
- item.level().addFreshEntity(item);
+ // Paper start
+ for (Item bukkit : list) {
+ if (!bukkit.isValid()) {
+ Entity item = ((org.bukkit.craftbukkit.entity.CraftItem) bukkit).getHandle();
+ item.level.addFreshEntity(item);
+ item.level().addFreshEntity(item);
+ }
+ }
+ } else {

View File

@ -41,7 +41,7 @@ index 233e372ba5d785352c9ac12dac37395bac63315c..0e61caa5c9f21788fbeaa90ed75d23e1
return BuiltInRegistries.ATTRIBUTE.get(CraftNamespacedKey.toMinecraft(attribute.getKey()));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index bec679a287ac26b6413b9d0b90a6758b905ecde6..44df0768689309cc492c101f97cafcd59081809d 100644
index 7204d2b542d8454fe12cce1ff049363045d4f5e5..37148ccf704dd8e5aa7d9ab100e6df142e822255 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -705,6 +705,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {

View File

@ -283,10 +283,10 @@ index 0000000000000000000000000000000000000000..b9922b07cb105618390187d98acdf89e
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7ad22703d50667849e195d3e7b6792078104425c..97ebd8d4bb8f0558d8b74782c810c5db0485d802 100644
index 31a9b86f9e9e837b10717a37177552cc4588a01a..1565a32a4e388cb3aec5b8c8d2cdf684383a38eb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1707,7 +1707,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1712,7 +1712,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public void sendSystemMessage(Component message) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expose Tracked Players
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index e67fb2f213fc174dba36f283ca4441fcf4596140..04bb6b608201f20eecfc5cb3a8367f58cebe1d2b 100644
index 2b936e32a67c108df9a7f6b335357a25bad6d291..bed8b8d3091216856168277af7f51c54b5b1e1f1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1348,5 +1348,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {

View File

@ -21,7 +21,7 @@ index a20d47f54f12dfc0a5f76dd969238e34c958b618..935dac757280731bfeb0a8f033cbe315
this.saveUserBanList();
this.loadIpBanList();
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 520cd1a6b347687b2ec6d13f034be391d1a1af85..cc885fd0eb19516d3864a43c2e4ae785950c5ba6 100644
index 97b8c8cf85527db734e70679b29d64cdfbbddec3..b1a03f081cedfdc41393ef025bd81eb6952601ba 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -198,6 +198,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -48,7 +48,7 @@ index 520cd1a6b347687b2ec6d13f034be391d1a1af85..cc885fd0eb19516d3864a43c2e4ae785
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index e287ed6e916e750ac8e87a5025b9f1503470d1cf..3ef97c793a85a9287b7fad66281e532285aaf5fc 100644
index a7ec827bac431e7022a07e9071dcec5b7e54da2f..654d304582cc35989fcdb46b78724529f9ba40bc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -186,6 +186,7 @@ public abstract class PlayerList {

View File

@ -5,34 +5,24 @@ Subject: [PATCH] added PlayerNameEntityEvent
diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/java/net/minecraft/world/item/NameTagItem.java
index 13080fb2350d4ee2107063948dd2ef359dff8306..623f78c078fb3aa2665d7e8a37672438227bce6b 100644
index af072de68435d1678651bdf2fa13b314ca9c9d58..2941c16ef486345b57ab2dfcd26f0272285d3b5a 100644
--- a/src/main/java/net/minecraft/world/item/NameTagItem.java
+++ b/src/main/java/net/minecraft/world/item/NameTagItem.java
@@ -1,5 +1,9 @@
package net.minecraft.world.item;
+// Paper start
+import io.papermc.paper.adventure.PaperAdventure;
+import io.papermc.paper.event.player.PlayerNameEntityEvent;
+// Paper end
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
@@ -15,9 +19,14 @@ public class NameTagItem extends Item {
@@ -15,9 +15,14 @@ public class NameTagItem extends Item {
public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) {
if (stack.hasCustomHoverName() && !(entity instanceof Player)) {
if (!user.level.isClientSide && entity.isAlive()) {
if (!user.level().isClientSide && entity.isAlive()) {
- entity.setCustomName(stack.getHoverName());
- if (entity instanceof Mob) {
- ((Mob)entity).setPersistenceRequired();
+ // Paper start
+ PlayerNameEntityEvent event = new PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), PaperAdventure.asAdventure(stack.getHoverName()), true);
+ io.papermc.paper.event.player.PlayerNameEntityEvent event = new io.papermc.paper.event.player.PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(stack.getHoverName()), true);
+ if (!event.callEvent()) return InteractionResult.PASS;
+ LivingEntity newEntityLiving = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle();
+ newEntityLiving.setCustomName(event.getName() != null ? PaperAdventure.asVanilla(event.getName()) : null);
+ newEntityLiving.setCustomName(event.getName() != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null);
+ if (event.isPersistent() && newEntityLiving instanceof Mob) {
+ ((Mob) newEntityLiving).setPersistenceRequired();
+ // Paper end
+ // Paper end
}
stack.shrink(1);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent grindstones from overstacking items
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index 4770f2b19847be6002f9fea9c258f8239b735589..89838076f3231ff4318ebb2718c9406399b4e4f5 100644
index 03d3edadf39d4871a332808458870ea9479669c4..b56766ff0e61691294b40ea8c2370940c0e8b640 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -198,13 +198,13 @@ public class GrindstoneMenu extends AbstractContainerMenu {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add recipe to cook events
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 5327d41fc5064e953856c348f40f2b396aa0c66b..7558ae098b242ea7e647055acfe253b95b00d498 100644
index 5ea9a6e9fa197fd00952c5ade426d7de50497a5e..d1eff8a4c83227d74502b5924df43f87c457a537 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
@@ -437,7 +437,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add Block#isValidTool
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 86a932d397ca92ab7d6f3b64860ede8adb86c0b5..9a1304103d367e2d7bc552977542b46e9887bcb4 100644
index e181525525b8809c3d413047716264fd2b32cedd..30fc626f51437e254993edd9b14337fa60ba313c 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -741,5 +741,9 @@ public class CraftBlock implements Block {

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Allow using signs inside spawn protection
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ea910d24fe78aa972123414d9eb42e94c2c462f1..7bea2214ea3ffa93349a4675e1ba3b0e0430ee65 100644
index 92f8a2f70b78be2fc75faab0675628c227aa1706..5917fa180bff6497c8557b05742c605e304b2722 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1827,7 +1827,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
int i = this.player.level.getMaxBuildHeight();
@@ -1819,7 +1819,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
int i = this.player.level().getMaxBuildHeight();
if (blockposition.getY() < i) {
- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - sign check
+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - sign check
this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expand world key API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 3ffea505826bbe4151268ed9cffa5f2ddea27b62..287dd68f1aa78bf5f1406f585e4a657563d6116c 100644
index 5f9c3c237b65986f8c425bbc691ac301f8fdebbc..cb7ceaaaf4e8deec78962660298fa5316f8c5a63 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -990,5 +990,10 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
@ -20,7 +20,7 @@ index 3ffea505826bbe4151268ed9cffa5f2ddea27b62..287dd68f1aa78bf5f1406f585e4a6575
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e7e0059831b19d03da07fbe610a9d20cd1c490ad..5014f7958074591d1eec22c6775d291828ba0560 100644
index 5a01f8475829cd3e398a095da50bc01c5dcd092b..0f5df60d62f0203724e073e6149b6bbbece0e533 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1153,9 +1153,15 @@ public final class CraftServer implements Server {
@ -67,7 +67,7 @@ index e7e0059831b19d03da07fbe610a9d20cd1c490ad..5014f7958074591d1eec22c6775d2918
// Check if a World already exists with the UID.
if (this.getWorld(world.getUID()) != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 289f6fade5f5500867eb75df41df6b8c5465e185..a7c73b19f81e30422ef5f145fdd7c64b6e4fd633 100644
index fbb674d355f30f34de6bb9608e628d5c49047be6..8e92454f435a43a78007ef607f15a94d2ac980ae 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -525,6 +525,11 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Item Rarity API
public net.minecraft.world.item.Item rarity
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index a7c73b19f81e30422ef5f145fdd7c64b6e4fd633..c96665397d08f74b3331f6544d110df5cc1988ef 100644
index 8e92454f435a43a78007ef607f15a94d2ac980ae..44850ec4a8245bc534efb85008486dd6f599b2e4 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -530,6 +530,20 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -5,11 +5,11 @@ Subject: [PATCH] copy TESign#isEditable from snapshots
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index f399a69e9dbac06e591219040634cbdb9382d3a2..ed570d536d2ffcbcf7a591bc436401ee32b238c6 100644
index 97028a14830384f06f4f1de36abfbc6bc1b90a19..a7d75d33367933fdec27538cde5a53cd41f3c252 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -98,6 +98,7 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState<
this.front.applyLegacyStringToSignSide();
@@ -108,6 +108,7 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState<
this.back.applyLegacyStringToSignSide();
super.applyTo(sign);
+ sign.isEditable = getSnapshot().isEditable; // Paper - copy manually

View File

@ -7,10 +7,10 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro
Closes #5036
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3ef97c793a85a9287b7fad66281e532285aaf5fc..481f2f5dc2e62ae0bbdb8bbac5e8c3c5e090def7 100644
index 654d304582cc35989fcdb46b78724529f9ba40bc..3f6f946c5c4870826ae0749fcd1d816906f0f4c3 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -584,6 +584,14 @@ public abstract class PlayerList {
@@ -591,6 +591,14 @@ public abstract class PlayerList {
}
// Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] forced whitelist: use configurable kick message
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 97ebd8d4bb8f0558d8b74782c810c5db0485d802..fd9790dfd445481ed245b82255e05f5bc1459eae 100644
index 1565a32a4e388cb3aec5b8c8d2cdf684383a38eb..84bc412a8169b07f63e9d0395df1b1f42e0f6a83 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2149,7 +2149,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2156,7 +2156,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Don't ignore result of PlayerEditBookEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7bea2214ea3ffa93349a4675e1ba3b0e0430ee65..f851b24fb6ea9de4d6533f526f40a2dad338e0cc 100644
index 5917fa180bff6497c8557b05742c605e304b2722..058a2a2d948b66afb8c70d75d2ce78e3bafcb504 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1286,7 +1286,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1283,7 +1283,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}
itemstack.addTagElement("pages", nbttaglist);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Expose protocol version
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index c96665397d08f74b3331f6544d110df5cc1988ef..451d36303f12d3b6d22baba9d1d17c2a4eba3206 100644
index 44850ec4a8245bc534efb85008486dd6f599b2e4..fb24efa54510fc77a7d4541462242113e16d2f53 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -544,6 +544,11 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -208,7 +208,7 @@ index 0000000000000000000000000000000000000000..dd9d77d7c7f1a5a130a1f4c15e5b1e68
+ public void setErrorIndex(final int errorIndex) {}
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index cc885fd0eb19516d3864a43c2e4ae785950c5ba6..cf3db466459490fd09d9c82238f413a0cc24ab80 100644
index b1a03f081cedfdc41393ef025bd81eb6952601ba..4de78e2ebd8cdc587e74f7eefd35faa29a54079e 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -173,7 +173,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

View File

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
Date: Tue, 2 Feb 2021 09:17:59 +0100
Subject: [PATCH] stop firing pressure plate EntityInteractEvent for ignored
entities
diff --git a/src/main/java/net/minecraft/world/level/block/PressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/PressurePlateBlock.java
index ed4a954a07e69d36c61e69137a4907a43270942b..e47938e8353c9ada6e20d94fc4f129a419cad731 100644
--- a/src/main/java/net/minecraft/world/level/block/PressurePlateBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PressurePlateBlock.java
@@ -59,6 +59,7 @@ public class PressurePlateBlock extends BasePressurePlateBlock {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
+ if (entity.isIgnoringBlockTriggers()) continue; // Paper - don't call event for ignored entities
// CraftBukkit start - Call interact event when turning on a pressure plate
if (this.getSignalForState(world.getBlockState(pos)) == 0) {