[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke 2024-01-19 22:13:42 +01:00
parent 3c246dc632
commit 66431e1300
84 changed files with 265 additions and 271 deletions

View file

@ -21,6 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return whether the block will drop items
+ */
+ boolean isValidTool(@NotNull ItemStack itemStack);
// Paper End
// Paper end
/**

View file

@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ float getYaw();
// Paper end
// Paper Start - Collision API
// Paper start - Collision API
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java

View file

@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return blockLoc;
}
+
+ // Paper Start
+ // Paper start
+ /**
+ * @return The block key for this location's block location.
+ * @see Block#getBlockKey(int, int, int)
@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public long toBlockKey() {
+ return Block.getBlockKey(getBlockX(), getBlockY(), getBlockZ());
+ }
+ // Paper End
+ // Paper end
+
/**
* @return A new location where X/Y/Z are the center of the block
@ -103,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/
int getZ();
+ // Paper Start
+ // Paper start
+ /**
+ * Returns this block's coordinates packed into a long value.
+ * Computed via: {@code Block.getBlockKey(this.getX(), this.getY(), this.getZ())}
@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static int getBlockKeyZ(long packed) {
+ return (int) ((packed << 10) >> 37);
+ }
+ // Paper End
+ // Paper end
+
/**
* Gets the Location of the block

View file

@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
boolean isInPowderedSnow();
// Paper end
+
+ // Paper Start - Collision API
+ // Paper start - Collision API
+ /**
+ * Checks for any collisions with the entity's bounding box at the provided location.
+ * This will check for any colliding entities (boats, shulkers) / worldborder / blocks.
@ -53,5 +53,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return collides or not
+ */
+ boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
+ // Paper End - Collision API
+ // Paper end - Collision API
}

View file

@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
default org.bukkit.Location getSourceLoc() {
return this.getOrigin();
}
+ // Paper Start - Auto expire setting
+ // Paper start - Auto expire setting
+ /**
+ * Sets if this falling block should expire after:
+ * - 30 seconds
@ -104,5 +104,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @param autoExpires if this behavior should occur
+ */
+ void shouldAutoExpire(boolean autoExpires);
+ // Paper End - Auto expire setting
+ // Paper end - Auto expire setting
}

View file

@ -775,7 +775,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
// Paper End - Collision API
// Paper end - Collision API
+
+ // Paper start - Folia schedulers
+ /**

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/
boolean isFrozen();
+ // Paper Start - Freeze Tick Lock API
+ // Paper start - Freeze Tick Lock API
+ /**
+ * Gets if the entity currently has its freeze ticks locked
+ * to a set amount.
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @param locked prevent vanilla modification or not
+ */
+ void lockFreezeTicks(boolean locked);
+ // Paper End - Freeze Tick Lock API
+ // Paper end - Freeze Tick Lock API
+
/**
* Mark the entity's removal.

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable
public UUID getThrower();
+
+ // Paper Start
+ // Paper start
+ /**
+ * Gets if non-player entities can pick this Item up
+ *

View file

@ -318,7 +318,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
+
+ // Paper Start - More cat api
+ // Paper start - More cat api
+ /**
+ * Sets if the cat is lying down.
+ * This is visual and does not affect the behaviour of the cat.
@ -348,7 +348,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return head is up
+ */
+ public boolean isHeadUp();
+ // Paper End - More cat api
+ // Paper end - More cat api
}
diff --git a/src/main/java/org/bukkit/entity/Chicken.java b/src/main/java/org/bukkit/entity/Chicken.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return remaining;
}
+ // Paper Start
+ // Paper start
+ /**
+ * Set if the item will fly at the player
+ * <p>Cancelling the event will set this value to false.</p>
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean getFlyAtPlayer() {
+ return flyAtPlayer;
+ }
+ // Paper End
+ // Paper end
+
@Override
public boolean isCancelled() {

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
*/
void setArrowsInBody(int count, boolean fireEvent); // Paper
+ // Paper Start - Bee Stinger API
+ // Paper start - Bee Stinger API
+ /**
+ * Gets the time in ticks until the next bee stinger leaves the entity's body.
+ *
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @param count amount of bee stingers in entity's body
+ */
+ public void setBeeStingersInBody(int count);
+ // Paper End - Stinger API
+ // Paper end - Stinger API
+
/**
* Returns the living entity's current maximum no damage ticks.

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return !this.getHandle().level().noCollision(this.getHandle(), aabb);
}
// Paper End - Collision API
// Paper end - Collision API
+
+ // Paper start - entity scoreboard name
+ @Override

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Madeline Miller <mnmiller1@me.com>
Date: Thu, 31 Dec 2020 12:48:19 +1000
Subject: [PATCH] Implement API to get Material from Boats and Minecarts
Subject: [PATCH] API to get Material from Boats and Minecarts
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java

View file

@ -29,6 +29,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.getHandle().health = health;
+ }
+ }
// Paper End
// Paper end
@Override

View file

@ -2014,7 +2014,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper
public boolean hasEntityMoveEvent = false; // Paper
public boolean hasEntityMoveEvent = false; // Paper - Add EntityMoveEvent
+ private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
public static Throwable getAddToWorldStackTrace(Entity entity) {
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: TheViperShow <29604693+TheViperShow@users.noreply.github.com>
Date: Wed, 22 Apr 2020 09:40:38 +0200
Subject: [PATCH] Implemented BlockFailedDispenseEvent
Subject: [PATCH] Add BlockFailedDispenseEvent
diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java
@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int i = tileentitydispenser.getRandomSlot(world.random);
if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) { // Paper - BlockFailedDispenseEvent is called here
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) { // Paper - Add BlockFailedDispenseEvent
world.levelEvent(1001, pos, 0);
world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState()));
+ } // Paper
+ } // Paper - Add BlockFailedDispenseEvent
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
int i = tileentitydispenser.getRandomSlot(world.random);
if (i < 0) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - Add BlockFailedDispenseEvent
world.levelEvent(1001, pos, 0);
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Madeline Miller <mnmiller1@me.com>
Date: Sun, 17 Jan 2021 13:16:09 +1000
Subject: [PATCH] Implement BlockPreDispenseEvent
Subject: [PATCH] Add 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
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack);
if (idispensebehavior != DispenseItemBehavior.NOOP) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - BlockPreDispenseEvent is called here
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent
DispenserBlock.eventFired = false; // CraftBukkit - reset event status
tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack));
}

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
Date: Mon, 25 Jan 2021 14:53:57 +0100
Subject: [PATCH] add DragonEggFormEvent
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
@ -12,24 +12,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.dragonEvent.setVisible(false);
this.spawnExitPortal(true);
this.spawnNewGateway();
+ // Paper start - DragonEggFormEvent
+ // Paper start - Add DragonEggFormEvent
+ 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
+ // Paper end - Add DragonEggFormEvent
if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - Add toggle for always placing the dragon egg
- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
+ // Paper start - DragonEggFormEvent
+ // Paper start - Add DragonEggFormEvent
+ // this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
+ } else {
+ eggEvent.setCancelled(true);
+ }
+ if (eggEvent.callEvent()) {
+ eggEvent.getNewState().update(true);
+ // Paper end - Add DragonEggFormEvent
}
+ // Paper end - DragonEggFormEvent
this.previouslyKilled = true;
this.dragonKilled = true;

View file

@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return this.entity.getBukkitYaw();
+ }
// Paper end
// Paper Start - Collision API
// Paper start - Collision API
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
float f = CrossbowItem.getPowerForTime(j, stack);
- if (f >= 1.0F && !CrossbowItem.isCharged(stack) && CrossbowItem.tryLoadProjectiles(user, stack)) {
+ // Paper start - EntityLoadCrossbowEvent
+ // Paper start - Add EntityLoadCrossbowEvent
+ if (f >= 1.0F && !CrossbowItem.isCharged(stack) /*&& CrossbowItem.tryLoadProjectiles(entityliving, itemstack)*/) {
+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND);
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) {
+ if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote();
+ return;
+ }
+ // Paper end
+ // Paper end - Add EntityLoadCrossbowEvent
CrossbowItem.setCharged(stack, true);
SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE;
@ -28,17 +28,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ @io.papermc.paper.annotation.DoNotUse // Paper
+ @io.papermc.paper.annotation.DoNotUse // Paper - Add EntityLoadCrossbowEvent
private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) {
+ // Paper start
+ // Paper start - Add EntityLoadCrossbowEvent
+ return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true);
+ }
+ private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) {
+ // Paper end
+ // Paper end - Add EntityLoadCrossbowEvent
int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, crossbow);
int j = i == 0 ? 1 : 3;
- boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild;
+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - add consume
+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - Add EntityLoadCrossbowEvent
ItemStack itemstack1 = shooter.getProjectile(crossbow);
ItemStack itemstack2 = itemstack1.copy();

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 11 Feb 2020 21:56:48 -0600
Subject: [PATCH] EntityMoveEvent
Subject: [PATCH] Add EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
this.profiler.push(() -> {
return worldserver + " " + worldserver.dimension().location();
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final LevelStorageSource.LevelStorageAccess convertable;
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper
+ public boolean hasEntityMoveEvent = false; // Paper
+ public boolean hasEntityMoveEvent = false; // Paper - Add EntityMoveEvent
public static Throwable getAddToWorldStackTrace(Entity entity) {
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr);
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.pushEntities();
this.level().getProfiler().pop();
+ // Paper start
+ // Paper start - Add EntityMoveEvent
+ 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);
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+ }
+ // Paper end
+ // Paper end - Add EntityMoveEvent
if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(this.damageSources().drown(), 1.0F);
}

View file

@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
} // Paper end
} // Paper end - Call interact event
// Arm swing animation
- PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 24 Jun 2020 15:14:51 -0600
Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent
Subject: [PATCH] Add PlayerChangeBeaconEffectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
@ -12,29 +12,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public MobEffect getSecondaryEffect() {
return BeaconMenu.decodeEffect(this.beaconData.get(2));
}
+ // Paper start
+ // Paper start - Add PlayerChangeBeaconEffectEvent
+ private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional<MobEffect> effect) {
+ return effect.flatMap(net.minecraft.core.registries.BuiltInRegistries.MOB_EFFECT::getResourceKey).map(key -> {
+ return org.bukkit.potion.PotionEffectType.getByKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location()));
+ }).orElse(null);
+ }
+ // Paper end
+ // Paper end - Add PlayerChangeBeaconEffectEvent
public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) {
if (this.paymentSlot.hasItem()) {
- this.beaconData.set(1, BeaconMenu.encodeEffect((MobEffect) primary.orElse(null))); // CraftBukkit - decompile error
- this.beaconData.set(2, BeaconMenu.encodeEffect((MobEffect) secondary.orElse(null))); // CraftBukkit - decompile error
+ // Paper start
+ // Paper start - Add PlayerChangeBeaconEffectEvent
+ io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
+ if (event.callEvent()) {
+ this.beaconData.set(1, BeaconMenu.encodeEffect(event.getPrimary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getPrimary())));
+ this.beaconData.set(2, BeaconMenu.encodeEffect(event.getSecondary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getSecondary())));
+ if (event.willConsumeItem()) {
+ // Paper end
this.paymentSlot.remove(1);
+ }
this.access.execute(Level::blockEntityChanged);
+ } // Paper end
+ } // Paper end - Add PlayerChangeBeaconEffectEvent
}
}

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com>
Date: Tue, 13 Aug 2019 19:45:06 -0700
Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent
Subject: [PATCH] Add PlayerFlowerPotManipulateEvent
diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
boolean bl = blockState.is(Blocks.AIR);
boolean bl2 = this.isEmpty();
if (bl != bl2) {
+ // Paper start
+ // Paper start - Add PlayerFlowerPotManipulateEvent
+ org.bukkit.entity.Player player1 = (org.bukkit.entity.Player) player.getBukkitEntity();
+ boolean placing = bl2;
+ org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos);
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ return InteractionResult.PASS;
+ }
+ // Paper end
+ // Paper end - Add PlayerFlowerPotManipulateEvent
if (bl2) {
world.setBlock(pos, blockState, 3);
player.awardStat(Stats.POT_FLOWER);

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 23 Nov 2020 12:58:51 -0800
Subject: [PATCH] Added PlayerLecternPageChangeEvent
Subject: [PATCH] Add PlayerLecternPageChangeEvent
diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
int j;
+ io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper
+ io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper - Add PlayerLecternPageChangeEvent
if (id >= 100) {
j = id - 100;
@ -21,26 +21,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
case 1:
j = this.lecternData.get(0);
- this.setData(0, j - 1);
+ // Paper start
+ // Paper start - Add PlayerLecternPageChangeEvent
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
+ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1);
+ if (!playerLecternPageChangeEvent.callEvent()) {
+ return false;
+ }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end
+ // Paper end - Add PlayerLecternPageChangeEvent
return true;
case 2:
j = this.lecternData.get(0);
- this.setData(0, j + 1);
+ // Paper start
+ // Paper start - Add PlayerLecternPageChangeEvent
+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory();
+ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1);
+ if (!playerLecternPageChangeEvent.callEvent()) {
+ return false;
+ }
+ this.setData(0, playerLecternPageChangeEvent.getNewPage());
+ // Paper end
+ // Paper end - Add PlayerLecternPageChangeEvent
return true;
case 3:
if (!player.mayBuild()) {

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 25 Nov 2020 16:33:27 -0800
Subject: [PATCH] Added PlayerLoomPatternSelectEvent
Subject: [PATCH] Add PlayerLoomPatternSelectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (id >= 0 && id < this.selectablePatterns.size()) {
- this.selectedBannerPatternIndex.set(id);
- this.setupResultSlot((Holder) this.selectablePatterns.get(id));
+ // Paper start
+ // Paper start - Add PlayerLoomPatternSelectEvent
+ int selectablePatternIndex = id;
+ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(this.selectablePatterns.get(selectablePatternIndex).value().getHashname()));
+ if (!event.callEvent()) {
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ((Player) player.getBukkitEntity()).updateInventory();
+ this.selectedBannerPatternIndex.set(selectablePatternIndex);
+ this.setupResultSlot(java.util.Objects.requireNonNull(selectedPattern, "selectedPattern was null, this is unexpected"));
+ // Paper end
+ // Paper end - Add PlayerLoomPatternSelectEvent
return true;
} else {
return false;

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 5 Jul 2020 00:33:54 -0700
Subject: [PATCH] added PlayerNameEntityEvent
Subject: [PATCH] Add PlayerNameEntityEvent
diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/java/net/minecraft/world/item/NameTagItem.java
@ -15,14 +15,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- entity.setCustomName(stack.getHoverName());
- if (entity instanceof Mob) {
- ((Mob)entity).setPersistenceRequired();
+ // Paper start
+ // Paper start - Add PlayerNameEntityEvent
+ 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 ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null);
+ if (event.isPersistent() && newEntityLiving instanceof Mob) {
+ ((Mob) newEntityLiving).setPersistenceRequired();
+ // Paper end
+ // Paper end - Add PlayerNameEntityEvent
}
stack.shrink(1);

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Fri, 27 Nov 2020 17:14:27 -0800
Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent
Subject: [PATCH] Add PlayerStonecutterRecipeSelectEvent
Co-Authored-By: MiniDigger | Martin <admin@minidigger.dev>
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public StonecutterMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) {
super(MenuType.STONECUTTER, syncId);
- this.selectedRecipeIndex = DataSlot.standalone();
+ this.selectedRecipeIndex = DataSlot.shared(new int[1], 0); // Paper - allow replication
+ this.selectedRecipeIndex = DataSlot.shared(new int[1], 0); // Paper - Add PlayerStonecutterRecipeSelectEvent
this.recipes = Lists.newArrayList();
this.input = ItemStack.EMPTY;
this.slotUpdateListener = () -> {
@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) {
if (this.isValidRecipeIndex(id)) {
- this.selectedRecipeIndex.set(id);
+ // Paper start
+ // Paper start - Add PlayerStonecutterRecipeSelectEvent
+ int recipeIndex = id;
+ this.selectedRecipeIndex.set(recipeIndex);
+ this.selectedRecipeIndex.checkAndClearUpdateFlag(); // mark as changed
@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ ((Player) player.getBukkitEntity()).updateInventory();
+ this.selectedRecipeIndex.set(recipeIndex); // set new index, so that listeners can read it
+ // Paper end
+ // Paper end - Add PlayerStonecutterRecipeSelectEvent
this.setupResultSlot();
}

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 2 Dec 2020 20:04:01 -0800
Subject: [PATCH] Added ServerResourcesReloadedEvent
Subject: [PATCH] Add ServerResourcesReloadedEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.functionManager;
}
+ // Paper start - add cause
+ // Paper start - Add ServerResourcesReloadedEvent
+ @Deprecated @io.papermc.paper.annotation.DoNotUse
public CompletableFuture<Void> reloadResources(Collection<String> dataPacks) {
+ return this.reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN);
+ }
+ public CompletableFuture<Void> reloadResources(Collection<String> dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) {
+ // Paper end
+ // Paper end - Add ServerResourcesReloadedEvent
RegistryAccess.Frozen iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE);
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
Stream<String> stream = dataPacks.stream(); // CraftBukkit - decompile error
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings, they can be defined by datapacks so refresh it here
+ new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper - fire after everything has been reloaded
+ new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper - Add ServerResourcesReloadedEvent; fire after everything has been reloaded
}, this);
if (this.isSameThread()) {
@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static void reloadPacks(Collection<String> dataPacks, CommandSourceStack source) {
- source.getServer().reloadResources(dataPacks).exceptionally((throwable) -> {
+ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> {
+ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper - Add ServerResourcesReloadedEvent
ReloadCommand.LOGGER.warn("Failed to execute reload", throwable);
source.sendFailure(Component.translatable("commands.reload.failure"));
return null;
@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Collection<String> collection = resourcepackrepository.getSelectedIds();
Collection<String> collection1 = ReloadCommand.discoverNewPacks(resourcepackrepository, savedata, collection);
- minecraftserver.reloadResources(collection1);
+ minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper
+ minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper - Add ServerResourcesReloadedEvent
}
// CraftBukkit end

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 20 Dec 2020 16:41:44 -0800
Subject: [PATCH] Added WorldGameRuleChangeEvent
Subject: [PATCH] Add WorldGameRuleChangeEvent
diff --git a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit
- t0.setFromArgument(context, "value");
+ t0.setFromArgument(context, "value", key); // Paper
+ t0.setFromArgument(context, "value", key); // Paper - Add WorldGameRuleChangeEvent
commandlistenerwrapper.sendSuccess(() -> {
return Component.translatable("commands.gamerule.set", key.getId(), t0.toString());
}, true);
@ -26,12 +26,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name);
+ protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey); // Paper
+ protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey); // Paper - Add WorldGameRuleChangeEvent
- public void setFromArgument(CommandContext<CommandSourceStack> context, String name) {
- this.updateFromArgument(context, name);
+ public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper
+ this.updateFromArgument(context, name, gameRuleKey); // Paper
+ public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - Add WorldGameRuleChangeEvent
+ this.updateFromArgument(context, name, gameRuleKey); // Paper - Add WorldGameRuleChangeEvent
this.onChanged(((CommandSourceStack) context.getSource()).getServer());
}
@ -41,11 +41,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) {
- this.value = BoolArgumentType.getBool(context, name);
+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<BooleanValue> gameRuleKey) { // Paper start
+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<BooleanValue> gameRuleKey) { // Paper start - Add WorldGameRuleChangeEvent
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Boolean>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(BoolArgumentType.getBool(context, name)));
+ if (!event.callEvent()) return;
+ this.value = Boolean.parseBoolean(event.getValue());
+ // Paper end
+ // Paper end - Add WorldGameRuleChangeEvent
}
public boolean get() {
@ -55,11 +55,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
- protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) {
- this.value = IntegerArgumentType.getInteger(context, name);
+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<IntegerValue> gameRuleKey) { // Paper start
+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<IntegerValue> gameRuleKey) { // Paper start - Add WorldGameRuleChangeEvent
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Integer>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(IntegerArgumentType.getInteger(context, name)));
+ if (!event.callEvent()) return;
+ this.value = Integer.parseInt(event.getValue());
+ // Paper end
+ // Paper end - Add WorldGameRuleChangeEvent
}
public int get() {
@ -71,14 +71,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!this.isGameRule(rule)) return false;
+ // Paper start
+ // Paper start - Add WorldGameRuleChangeEvent
+ GameRule<?> gameRule = GameRule.getByName(rule);
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value);
+ if (!event.callEvent()) return false;
+ // Paper end
+ // Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule));
- handle.deserialize(value);
+ handle.deserialize(event.getValue()); // Paper
+ handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
handle.onChanged(this.getHandle().getServer());
return true;
}
@ -86,13 +86,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!this.isGameRule(rule.getName())) return false;
+ // Paper start
+ // Paper start - Add WorldGameRuleChangeEvent
+ io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, rule, String.valueOf(newValue));
+ if (!event.callEvent()) return false;
+ // Paper end
+ // Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName()));
- handle.deserialize(newValue.toString());
+ handle.deserialize(event.getValue()); // Paper
+ handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
handle.onChanged(this.getHandle().getServer());
return true;
}

View file

@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Replace rules for Height in Slime Chunks
+ final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum;
+ if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) {
+ // Paper end - Replace rules for Height in Swamp Biome
+ // Paper end - Replace rules for Height in Slime Chunks
return checkMobSpawnRules(type, world, spawnReason, pos, random);
}
}

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
- FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result);
+ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeholder.toBukkitRecipe()); // Paper
+ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeholder.toBukkitRecipe()); // Paper - Add recipe to cook events
world.getCraftServer().getPluginManager().callEvent(furnaceSmeltEvent);
if (furnaceSmeltEvent.isCancelled()) {
@ -26,20 +26,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) {
SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack});
- ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipeholder) -> {
- return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess());
+ Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor( inventorysubcontainer, world);
+ // Paper start - Add recipe to cook events; re-use recipeHolderOptional below
+ Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor(inventorysubcontainer, world);
+ ItemStack itemstack1 = (ItemStack) recipeHolderOptional.map((recipeholder) -> {
+ // Paper end
+ return recipeholder.value().assemble(inventorysubcontainer, world.registryAccess());
+ // Paper end - Add recipe to cook events
return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess());
}).orElse(itemstack);
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
@@ -0,0 +0,0 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
- BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result);
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeHolderOptional.map(RecipeHolder::toBukkitRecipe).orElse(null)); // Paper
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeHolderOptional.map(RecipeHolder::toBukkitRecipe).orElse(null)); // Paper - Add recipe to cook events
world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
if (blockCookEvent.isCancelled()) {

View file

@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
+ // Paper start - add recalculatePermissions parameter
+ // Paper start - Add sendOpLevel API
+ this.sendPlayerPermissionLevel(player, permissionLevel, true);
+ }
+ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) {
+ // Paper end
+ // Paper end - Add sendOpLevel API
if (player.connection != null) {
byte b0;
@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}
+ if (recalculatePermissions) { // Paper
+ if (recalculatePermissions) { // Paper - Add sendOpLevel API
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
this.server.getCommands().sendCommands(player);
+ } // Paper
+ } // Paper - Add sendOpLevel API
}
public boolean isWhiteListed(GameProfile profile) {
@ -39,14 +39,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// Paper end
+ // Paper start - sendOpLevel API
+ // Paper start - Add sendOpLevel API
+ @Override
+ public void sendOpLevel(byte level) {
+ Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]");
+
+ this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
+ }
+ // Paper end - sendOpLevel API
+ // Paper end - Add sendOpLevel API
+
@Override
public void setCompassTarget(Location loc) {

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.spawnExitPortal(true);
this.spawnNewGateway();
- if (!this.previouslyKilled) {
+ if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg
+ if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - Add toggle for always placing the dragon egg
this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
}

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 28 Nov 2020 18:43:52 -0800
Subject: [PATCH] Added world settings for mobs picking up loot
Subject: [PATCH] Add world settings for mobs picking up loot
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.populateDefaultEquipmentEnchantments(randomsource, difficulty);
this.reassessWeaponGoal();
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper - Add world settings for mobs picking up loot
if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
LocalDate localdate = LocalDate.now();
int i = localdate.get(ChronoField.DAY_OF_MONTH);
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
float f = difficulty.getSpecialMultiplier();
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f);
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper - Add world settings for mobs picking up loot
if (object == null) {
object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true);
}

View file

@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void setCenter(double x, double z) {
+ // Paper start
+ // Paper start - Add worldborder events
+ if (this.world != null) {
+ io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), new org.bukkit.Location(world.getWorld(), this.getCenterX(), 0, this.getCenterZ()), new org.bukkit.Location(world.getWorld(), x, 0, z));
+ if (!event.callEvent()) return;
+ x = event.getNewCenter().getX();
+ z = event.getNewCenter().getZ();
+ }
+ // Paper end
+ // Paper end - Add worldborder events
this.centerX = x;
this.centerZ = z;
this.extent.onCenterChange();
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void setSize(double size) {
+ // Paper start
+ // Paper start - Add worldborder events
+ if (this.world != null) {
+ io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE, getSize(), size, 0);
+ if (!event.callEvent()) return;
@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ size = event.getNewSize();
+ }
+ // Paper end
+ // Paper end - Add worldborder events
this.extent = new WorldBorder.StaticBorderExtent(size);
Iterator iterator = this.getListeners().iterator();
@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public void lerpSizeBetween(double fromSize, double toSize, long time) {
+ // Paper start
+ // Paper start - Add worldborder events
+ if (this.world != null) {
+ io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type type;
+ if (fromSize == toSize) { // new size = old size
@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ toSize = event.getNewSize();
+ time = event.getDuration();
+ }
+ // Paper end
+ // Paper end - Add worldborder events
this.extent = (WorldBorder.BorderExtent) (fromSize == toSize ? new WorldBorder.StaticBorderExtent(toSize) : new WorldBorder.MovingBorderExtent(fromSize, toSize, time));
Iterator iterator = this.getListeners().iterator();
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public WorldBorder.BorderExtent update() {
+ if (world != null && this.getLerpRemainingTime() <= 0L) new io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), this.from, this.to, this.lerpDuration).callEvent(); // Paper
+ if (world != null && this.getLerpRemainingTime() <= 0L) new io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), this.from, this.to, this.lerpDuration).callEvent(); // Paper - Add worldborder events
return (WorldBorder.BorderExtent) (this.getLerpRemainingTime() <= 0L ? WorldBorder.this.new StaticBorderExtent(this.to) : this);
}

View file

@ -211,7 +211,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+
+ // Paper End
+ // Paper end
+
@Nullable
public CompoundTag read(ChunkPos pos) throws IOException {

View file

@ -13,19 +13,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static void handleBlockDropItemEvent(Block block, BlockState state, ServerPlayer player, List<ItemEntity> items) {
- BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), Lists.transform(items, (item) -> (org.bukkit.entity.Item) item.getBukkitEntity()));
+ // Paper start
+ // Paper start - Allow adding items to BlockDropItemEvent
+ List<Item> list = new ArrayList<>();
+ for (ItemEntity item : items) {
+ list.add((Item) item.getBukkitEntity());
+ }
+ BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), list);
+ // Paper end
+ // Paper end - Allow adding items to BlockDropItemEvent
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- for (ItemEntity item : items) {
- item.level().addFreshEntity(item);
+ // Paper start
+ // Paper start - Allow adding items to BlockDropItemEvent
+ for (Item bukkit : list) {
+ if (!bukkit.isValid()) {
+ Entity item = ((org.bukkit.craftbukkit.entity.CraftItem) bukkit).getHandle();
@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ bukkit.remove();
+ }
}
+ // Paper end
+ // Paper end - Allow adding items to BlockDropItemEvent
}
}

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
EntityType entitytypes;
if (tileentity instanceof Spawner) {
+ if (world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper
+ if (world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper - Allow disabling mob spawner spawn egg transformation
+
Spawner spawner = (Spawner) tileentity;

View file

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if(cachedBurnDurations != null) {
+ return cachedBurnDurations;
+ }
+ // Paper end
+ // Paper end - cache burn durations
Map<Item, Integer> map = Maps.newLinkedHashMap();
AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000);
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - cache burn durations
+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map);
+ return cachedBurnDurations;
+ // Paper end
+ // Paper end - cache burn durations
}
// CraftBukkit start - add fields and methods

View file

@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed.
}
// Paper end
+ // Paper Start - Collision API
+ // Paper start - Collision API
+ @Override
+ public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) {
+ net.minecraft.world.phys.AABB aabb = this.getHandle().getBoundingBoxAt(location.getX(), location.getY(), location.getZ());
@ -43,5 +43,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ return !this.getHandle().level().noCollision(this.getHandle(), aabb);
+ }
+ // Paper End - Collision API
+ // Paper end - Collision API
}

View file

@ -2159,13 +2159,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public enum Direction implements StringRepresentable {
private final int adjY;
private final int adjZ;
// Paper end
// Paper end - Perf: Inline shift direction fields
+ // Paper start - optimise collisions
+ private static final int RANDOM_OFFSET = 2017601568;
+ private Direction opposite;
+ static {
+ for (final Direction direction : VALUES) {
+ direction.opposite = from3DDataValue(direction.oppositeIndex);;
+ direction.opposite = from3DDataValue(direction.oppositeIndex);
+ }
+ }
+

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void push(Entity entity) {
if (!this.isPassengerOfSameVehicle(entity)) {
if (!entity.noPhysics && !this.noPhysics) {
+ if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper
+ if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = Mth.absMax(d0, d1);
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void push(Entity entity) {
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.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant
if (!this.hasPassenger(entity)) {
// CraftBukkit start
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public void push(Entity entity) {
+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper
+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant
if (entity instanceof Boat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
// CraftBukkit start

View file

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
public VindicatorBreakDoorGoal(Mob mob) {
- super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE);
+ super(mob, 6, com.google.common.base.Predicates.in(mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(mob.getType(), mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.VINDICATOR)))); // Paper
+ super(mob, 6, com.google.common.base.Predicates.in(mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(mob.getType(), mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.VINDICATOR)))); // Paper - Configurable door breaking difficulty
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
}
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world);
- this.breakDoorGoal = new BreakDoorGoal(this, Zombie.DOOR_BREAKING_PREDICATE);
+ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper
+ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
}
public Zombie(Level world) {

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
- if (f > 10.0F) {
+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.dropLeash(true, true);
}
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.onLeashDistance(f);
- if (f > 10.0F) {
+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
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

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end - sendOpLevel API
// Paper end - Add sendOpLevel API
+ // Paper start - custom chat completions API
+ @Override

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private CompoundTag internalTag;
- final Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper
+ Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper // Paper - Deep clone unhandled nbt tags; remove final
+ Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper & Deep clone unhandled nbt tags; remove final
private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY);
private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only

View file

@ -222,7 +222,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
// Paper end - convert old users earlier after PlayerList creation but before file load/save
// Paper end - fix converting txt to json file
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
+ thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command

View file

@ -13,16 +13,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else if (this.getLeashHolder() == player) {
// CraftBukkit start - fire PlayerUnleashEntityEvent
- if (CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand).isCancelled()) {
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.getAbilities().instabuild);
+ if (event.isCancelled()) {
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder()));
return InteractionResult.PASS;
}
// CraftBukkit end
- this.dropLeash(true, !player.getAbilities().instabuild);
+ this.dropLeash(true, event.isDropLeash()); // Paper - drop leash variable
+ this.dropLeash(true, event.isDropLeash()); // Paper - Expand EntityUnleashEvent
this.gameEvent(GameEvent.ENTITY_INTERACT, player);
return InteractionResult.sidedSuccess(this.level().isClientSide);
} else {
@ -32,11 +32,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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.dropLeash(true, !this.leashHolder.pluginRemoved);// CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? EntityUnleashEvent.UnleashReason.PLAYER_UNLEASH : EntityUnleashEvent.UnleashReason.HOLDER_GONE, !this.leashHolder.pluginRemoved);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
}
}
@ -46,11 +46,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (flag1 && this.isLeashed()) {
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true);
+ if (!event.callEvent()) { return flag1; }
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
}
return flag1;
@ -60,11 +60,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.removeAfterChangingDimensions();
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
- this.dropLeash(true, false);
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false);
+ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
this.getAllSlots().forEach((itemstack) -> {
if (!itemstack.isEmpty()) {
itemstack.setCount(0);
@ -75,28 +75,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class PathfinderMob extends Mob {
if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) {
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ if (!event.callEvent()) return;
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
}
return;
@@ -0,0 +0,0 @@ public abstract class PathfinderMob extends Mob {
this.onLeashDistance(f);
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper
if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance
- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
- this.dropLeash(true, true);
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true);
+ if (!event.callEvent()) return;
+ this.dropLeash(true, event.isDropLeash());
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
this.goalSelector.disableControlFlag(Goal.Flag.MOVE);
} else if (f > 6.0F) {
double d0 = (entity.getX() - this.getX()) / (double) f;
@ -109,15 +109,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) {
// CraftBukkit start
- if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, player, hand).isCancelled()) {
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, player, hand, !player.getAbilities().instabuild);
+ if (event.isCancelled()) {
+ // Paper end
+ // Paper end - Expand EntityUnleashEvent
die = false;
continue;
}
- entityinsentient1.dropLeash(true, !player.getAbilities().instabuild); // false -> survival mode boolean
+ entityinsentient1.dropLeash(true, event.isDropLeash()); // false -> survival mode boolean // Paper - drop leash variable
+ entityinsentient1.dropLeash(true, event.isDropLeash()); // false -> survival mode boolean // Paper - Expand EntityUnleashEvent
// CraftBukkit end
flag1 = true;
}
@ -131,10 +131,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(Mob entity, net.minecraft.world.entity.player.Player player, InteractionHand enumhand) {
- PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand));
+ // Paper start - drop leash variable
+ // Paper start - Expand EntityUnleashEvent
+ 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
+ // Paper end - Expand EntityUnleashEvent
entity.level().getCraftServer().getPluginManager().callEvent(event);
return event;
}

View file

@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.setHurtEntities(true);
}
}
+ // Paper Start - Expand FallingBlock API
+ // Paper start - Expand FallingBlock API
+ @Override
+ public boolean doesAutoExpire() {
+ return this.getHandle().autoExpire;
@ -103,5 +103,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void shouldAutoExpire(boolean autoExpires) {
+ this.getHandle().autoExpire = autoExpires;
+ }
+ // Paper End - Expand FallingBlock API
+ // Paper end - Expand FallingBlock API
}

View file

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!world.isClientSide) {
// CraftBukkit start
- if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChange
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS;
}
// CraftBukkit end
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!world.isClientSide) {
// CraftBukkit start
- if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChange
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS;
}
// CraftBukkit end
@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!world.isClientSide) {
// CraftBukkit start
- if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChange
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS;
}
// CraftBukkit end
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!world.isClientSide) {
// CraftBukkit start
- if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChange
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent
return InteractionResult.SUCCESS;
}
// CraftBukkit end
@ -55,19 +55,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (CauldronBlock.shouldHandlePrecipitation(world, precipitation)) {
if (precipitation == Biome.Precipitation.RAIN) {
- world.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState());
+ // Paper start - Call CauldronLevelChange
+ // Paper start - Call CauldronLevelChangeEvent
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event
+ return;
+ }
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
} else if (precipitation == Biome.Precipitation.SNOW) {
- world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState());
+ // Paper start - Call CauldronLevelChange
+ // Paper start - Call CauldronLevelChangeEvent
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event
+ return;
+ }
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
}
@ -76,20 +76,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (fluid == Fluids.WATER) {
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();
- LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
+ // Paper start - Call CauldronLevelChange; don't send level event or game event if cancelled
+ // Paper start - Call CauldronLevelChangeEvent; don't send level event or game event if cancelled
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
+ return;
+ }
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
world.levelEvent(1047, pos, 0);
} else if (fluid == Fluids.LAVA) {
iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState();
- LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
+ // Paper start - Call CauldronLevelChange; don't send level event or game event if cancelled
+ // Paper start - Call CauldronLevelChangeEvent; don't send level event or game event if cancelled
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
+ return;
+ }
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
world.levelEvent(1046, pos, 0);
}
@ -102,13 +102,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit start
- public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
+ // Paper start - Call CauldronLevelChange
+ // Paper start - Call CauldronLevelChangeEvent
+ public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable
+ return changeLevel(iblockdata, world, blockposition, newBlock, entity, reason, true);
+ }
+
+ public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable
+ // Paper end - Call CauldronLevelChange
+ // Paper end - Call CauldronLevelChangeEvent
CraftBlockState newState = CraftBlockStates.getBlockState(world, blockposition);
newState.setData(newBlock);
@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
newState.update(true);
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock));
+ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChange
+ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChangeEvent
return true;
}
// CraftBukkit end

View file

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return to.setValue(BERRIES, from.getValue(BERRIES));
}
+ // Paper start - Fix Spigot growth modifiers
+ // Paper start - Fix Spigot growth modifiers
+ @Override
+ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) {
+ final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F);

View file

@ -67,9 +67,6 @@ https://bugs.mojang.com/browse/MC-200092
https://bugs.mojang.com/browse/MC-158900
Fix error when joining after tempban expired
https://bugs.mojang.com/browse/MC-259571
Fix last gamemode not being saved on death or reload
== AT ==
public net/minecraft/world/entity/Mob leashInfoTag
@ -379,7 +376,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java
@@ -0,0 +0,0 @@ public class BeaconMenu extends AbstractContainerMenu {
// Paper end
// Paper end - Add PlayerChangeBeaconEffectEvent
public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) {
+ // Paper start - fix MC-174630 - validate secondary power
@ -388,7 +385,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ // Paper end
if (this.paymentSlot.hasItem()) {
// Paper start
// Paper start - Add PlayerChangeBeaconEffectEvent
io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock());
diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.player.sendSystemMessage(ichatmutablecomponent, true);
- } else if (enuminteractionresult.shouldSwing()) {
+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper
+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper - Call interact event
this.player.swing(enumhand, true);
}
}
@ -28,21 +28,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
// SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities
- org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> {
+ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.0, entity -> { // Paper - change raySize from 0.1 to 0.0
+ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.0, entity -> { // Paper - Call interact event; change raySize from 0.1 to 0.0
Entity handle = ((CraftEntity) entity).getHandle();
return entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity) && !handle.isSpectator() && handle.isPickable() && !handle.isPassengerOfSameVehicle(this.player);
});
if (result == null) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
- }
+ } else { // Paper start - Fix interact event not being called sometimes
+ } else { // Paper start - Call interact event
+ GameType gameType = this.player.gameMode.getGameModeForPlayer();
+ if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, ((org.bukkit.craftbukkit.block.CraftBlock) result.getHitBlock()).getPosition(), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
+ } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND);
+ }
+ } // Paper end
+ } // Paper end - Call interact event
// Arm swing animation
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
entityslime.setPersistenceRequired();
}
+ entityslime.aware = this.aware; // Paper
+ entityslime.aware = this.aware; // Paper - Fix nerfed slime when splitting
entityslime.setCustomName(ichatbasecomponent);
entityslime.setNoAi(flag);
entityslime.setInvulnerable(this.isInvulnerable());

View file

@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- Thread.sleep(TimeUnit.SECONDS.toMillis(20));
+ //System.err.println("*** Server will start in 20 seconds ***");
+ //Thread.sleep(TimeUnit.SECONDS.toMillis(20));
+ // Paper End
+ // Paper end
}
}

View file

@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
PlayerList.LOGGER.debug("Removing player mount");
entityplayer.stopRiding();
entity.getPassengersAndSelf().forEach((entity1) -> {
+ // Paper start
+ // Paper start - Fix villager boat exploit
+ if (entity1 instanceof net.minecraft.world.entity.npc.AbstractVillager villager) {
+ final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer();
+ if (human != null) {
+ villager.setTradingPlayer(null);
+ }
+ }
+ // Paper end
+ // Paper end - Fix villager boat exploit
entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER);
});
}

View file

@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.getHandle().isFullyFrozen();
}
+ // Paper Start - Freeze Tick Lock API
+ // Paper start - Freeze Tick Lock API
+ @Override
+ public boolean isFreezeTickingLocked() {
+ return this.entity.freezeLocked;

View file

@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+ private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
+ // Paper End
+ // Paper end
// Spigot End
public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system

View file

@ -46,14 +46,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
jframe.pack();
jframe.setLocationRelativeTo((Component) null);
jframe.setVisible(true);
+ jframe.setName("Minecraft server"); // Paper
+ jframe.setName("Minecraft server"); // Paper - Improve ServerGUI
+
+ // Paper start - Add logo as frame image
+ // Paper start - Improve ServerGUI
+ try {
+ jframe.setIconImage(javax.imageio.ImageIO.read(Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png"))));
+ } catch (java.io.IOException ignore) {
+ }
+ // Paper end
+ // Paper end - Improve ServerGUI
+
jframe.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowevent) {
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void tick() {
long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
+ // Paper start - Add tps entry
+ // Paper start - Improve ServerGUI
+ double[] tps = org.bukkit.Bukkit.getTPS();
+ String[] tpsAvg = new String[tps.length];
+
@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms";
+ this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg);
+ // Paper end
+ // Paper end - Improve ServerGUI
this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory());
this.repaint();
}
@ -85,11 +85,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.timer.stop();
}
+
+ // Paper - start Add tps entry
+ // Paper - Improve ServerGUI
+ private static String format(double tps) {
+ return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
+ }
+ // Paper end
+ // Paper end - Improve ServerGUI
}
diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png
new file mode 100644

View file

@ -14,11 +14,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
})).toArray((i) -> {
return new Direction[i];
});
+ // Paper start
+ // Paper start - Perf: Inline shift direction fields
+ private final int adjX;
+ private final int adjY;
+ private final int adjZ;
+ // Paper end
+ // Paper end - Perf: Inline shift direction fields
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id;
@ -26,11 +26,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.axis = axis;
this.axisDirection = direction;
this.normal = vector;
+ // Paper start
+ // Paper start - Perf: Inline shift direction fields
+ this.adjX = vector.getX();
+ this.adjY = vector.getY();
+ this.adjZ = vector.getZ();
+ // Paper end
+ // Paper end - Perf: Inline shift direction fields
}
public static Direction[] orderedByNearest(Entity entity) {
@ -39,17 +39,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public int getStepX() {
- return this.normal.getX();
+ return this.adjX; // Paper
+ return this.adjX; // Paper - Perf: Inline shift direction fields
}
public int getStepY() {
- return this.normal.getY();
+ return this.adjY; // Paper
+ return this.adjY; // Paper - Perf: Inline shift direction fields
}
public int getStepZ() {
- return this.normal.getZ();
+ return this.adjZ; // Paper
+ return this.adjZ; // Paper - Perf: Inline shift direction fields
}
public Vector3f step() {

View file

@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ItemEntity entityitem = (ItemEntity) iterator.next();
if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) {
+ // Paper Start
+ // Paper start
+ if (!entityitem.canMobPickup) {
+ continue;
+ }
+ // Paper End
+ // Paper end
this.pickUpItem(entityitem);
}
}
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
+ // Paper Start
+ // Paper start
+ @Override
+ public boolean canMobPickup() {
+ return this.getHandle().canMobPickup;
@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void setCanMobPickup(boolean canMobPickup) {
+ this.getHandle().canMobPickup = canMobPickup;
+ }
+ // Paper End
+ // Paper end
+
@Override
public void setOwner(UUID uuid) {

View file

@ -44,6 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void setWillAge(boolean willAge) {
+ this.getHandle().age = willAge ? 0 : NO_AGE_TIME;
+ }
// Paper End
// Paper end
@Override

View file

@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ worldserver.updateLagCompensationTick(); // Paper - lag compensation
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (block != null) {
BlockState iblockdata2 = (BlockState) ((BlockState) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == Fluids.WATER);
+ // Paper Start - Have Amethyst throw both spread and grow events
+ // Paper start - Have Amethyst throw both spread and grow events
+ if (block == Blocks.SMALL_AMETHYST_BUD) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, iblockdata2); // CraftBukkit
+ } else {

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
});
private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> {
- return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder);
+ return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper
+ return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper - Make schedule command per-world
};
public ScheduleCommand() {}
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException {
- int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(eventName);
+ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper
+ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper - Make schedule command per-world
if (i == 0) {
throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName);

View file

@ -15,9 +15,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.setX(x);
- this.setY(y);
- this.setZ(z);
+ this.x = x; // Paper - force inline
+ this.y = y; // Paper - force inline
+ this.z = z; // Paper - force inline
+ this.x = x; // Paper - Perf: Manually inline methods in BlockPosition
+ this.y = y; // Paper - Perf: Manually inline methods in BlockPosition
+ this.z = z; // Paper - Perf: Manually inline methods in BlockPosition
return this;
}
@ -26,21 +26,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public BlockPos.MutableBlockPos setX(int i) {
- super.setX(i);
+ this.x = i; // Paper - force line
+ this.x = i; // Paper - Perf: Manually inline methods in BlockPosition
return this;
}
@Override
public BlockPos.MutableBlockPos setY(int i) {
- super.setY(i);
+ this.y = i; // Paper - force line
+ this.y = i; // Paper - Perf: Manually inline methods in BlockPosition
return this;
}
@Override
public BlockPos.MutableBlockPos setZ(int i) {
- super.setZ(i);
+ this.z = i; // Paper - force line
+ this.z = i; // Paper - Perf: Manually inline methods in BlockPosition
return this;
}
@ -55,9 +55,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private int x;
- private int y;
- private int z;
+ protected int x; // Paper - force line; protected
+ protected int y; // Paper - force line; protected
+ protected int z; // Paper - force line; protected
+ protected int x; // Paper - Perf: Manually inline methods in BlockPosition; protected
+ protected int y; // Paper - Perf: Manually inline methods in BlockPosition; protected
+ protected int z; // Paper - Perf: Manually inline methods in BlockPosition; protected
public static Codec<Vec3i> offsetCodec(int maxAbsValue) {
return ExtraCodecs.validate(CODEC, (vec) -> {

View file

@ -219,14 +219,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+ // Paper Start - Horse API
+ // Paper start - Horse API
+ public void setMouthOpen(boolean open) {
+ this.setFlag(FLAG_OPEN_MOUTH, open);
+ }
+ public boolean isMouthOpen() {
+ return this.getFlag(FLAG_OPEN_MOUTH);
+ }
+ // Paper End - Horse API
+ // Paper end - Horse API
+
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
@ -235,11 +235,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.setFlag(16, eatingGrass);
}
+ // Paper Start - Horse API
+ // Paper start - Horse API
+ public void setForceStanding(boolean standing) {
+ this.setFlag(FLAG_STANDING, standing);
+ }
+ // Paper End - Horse API
+ // Paper end - Horse API
public void setStanding(boolean angry) {
if (angry) {
this.setEating(false);
@ -519,7 +519,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
+
+ // Paper Start - More cat api
+ // Paper start - More cat api
+ @Override
+ public void setLyingDown(boolean lyingDown) {
+ this.getHandle().setLying(lyingDown);
@ -539,7 +539,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean isHeadUp() {
+ return this.getHandle().isRelaxStateOne();
+ }
+ // Paper End - More cat api
+ // Paper end - More cat api
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -239,7 +239,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (this.item.getType() != Material.FIREWORK_ROCKET) {
- this.item.setType(Material.FIREWORK_ROCKET);
- }
+// Paper Start - Expose firework item directly
+// Paper start - Expose firework item directly
+// ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM);
+//
+// if (item.isEmpty()) {
@ -253,7 +253,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+// if (this.item.getType() != Material.FIREWORK_ROCKET) {
+// this.item.setType(Material.FIREWORK_ROCKET);
+// }
+ // Paper End - Expose firework item directly
+ // Paper end - Expose firework item directly
}
@Override

View file

@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public BlockPos relative(Direction direction) {
+ // Paper Start - Optimize BlockPosition
+ // Paper start - Optimize BlockPosition
+ switch(direction) {
+ case UP:
+ return new BlockPos(this.getX(), this.getY() + 1, this.getZ());
@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ default:
return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ());
+ }
+ // Paper End
+ // Paper end
}
@Override

View file

@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
+ net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
this.profiler.push(() -> {
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java

View file

@ -97,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) {
+ super(key, result, template, base, addition, copyNbt);
+ }
+ // Paper endv
+ // Paper end - Option to prevent NBT copy
public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRecipe recipe) {
if (recipe instanceof CraftSmithingTransformRecipe) {

View file

@ -4984,7 +4984,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
.describedAs("Yml file");
// Spigot End
+
+ // Paper Start
+ // Paper start
+ acceptsAll(asList("paper-dir", "paper-settings-directory"), "Directory for Paper settings")
+ .withRequiredArg()
+ .ofType(File.class)

View file

@ -92,8 +92,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.callback = changeCallback;
@@ -0,0 +0,0 @@ public class GameRules {
public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper
this.updateFromArgument(context, name, gameRuleKey); // Paper
public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - Add WorldGameRuleChangeEvent
this.updateFromArgument(context, name, gameRuleKey); // Paper - Add WorldGameRuleChangeEvent
- this.onChanged(((CommandSourceStack) context.getSource()).getServer());
+ this.onChanged(((CommandSourceStack) context.getSource()).getLevel()); // Paper - Pass ServerLevel for gamerule callbacks
}
@ -171,18 +171,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper end
// Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule));
handle.deserialize(event.getValue()); // Paper
handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
- handle.onChanged(this.getHandle().getServer());
+ handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks
return true;
}
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper end
// Paper end - Add WorldGameRuleChangeEvent
GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName()));
handle.deserialize(event.getValue()); // Paper
handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent
- handle.onChanged(this.getHandle().getServer());
+ handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks
return true;

View file

@ -23,11 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper
if (playerEvent.isCancelled()) {
itemstack.setCount(i); // SPIGOT-5294 - restore count
+ // Paper Start
+ // Paper start
+ if (flyAtPlayer) {
+ player.take(this, i);
+ }
+ // Paper End
+ // Paper end
return;
}

View file

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- b0 = 2;
+ b0 = 2; // Paper - the problem line for above change, causing over-stacking
+ b0 = 2; // Paper - add max stack size check & config value; the problem line for above change, causing over-stacking
}
} else {
boolean flag3 = !itemstack.isEmpty();

View file

@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
});
optional1.ifPresent((holder) -> {
this.getServer().execute(() -> {
+ // Paper start
+ // Paper start - Remove stale POIs
+ if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) {
+ this.getPoiManager().remove(blockposition1);
+ }
+ // Paper end
+ // Paper end - Remove stale POIs
this.getPoiManager().add(blockposition1, holder);
DebugPackets.sendPoiAddedPacket(this, blockposition1);
});

View file

@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
// CraftBukkit end
}
+ // Paper start
+ // Paper start - Reset shield blocking on dimension change
+ if (this.isBlocking()) {
+ this.stopUsingItem();
+ }
+ // Paper end
+ // Paper end - Reset shield blocking on dimension change
return this;
}

View file

@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- Preconditions.checkState(this.title != null, "Title not set");
+ // Paper start - return chat component with empty text instead of throwing error
+ // Preconditions.checkState(this.title != null, "Title not set");
+ if(this.title == null){
+ if (this.title == null){
+ return Component.literal("");
+ }
+ // Paper end
+ // Paper end - return chat component with empty text instead of throwing error
return this.title;
}
public final void setTitle(Component title) {

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
// Paper end
}
+ // Paper Start - Bee Stinger API
+ // Paper start - Bee Stinger API
+ @Override
+ public int getBeeStingerCooldown() {
+ return getHandle().removeStingerTime;
@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ Preconditions.checkArgument(count >= 0, "New bee stinger amount must be >= 0");
+ getHandle().setStingerCount(count);
+ }
+ // Paper End - Bee Stinger API
+ // Paper end - Bee Stinger API
@Override
public void damage(double amount) {
this.damage(amount, null);

View file

@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
+ } // Paper
+ } // Paper - option to disable pathfinding updates
}
@Override

View file

@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.setViewDistance(dedicatedServerProperties.viewDistance);
this.setSimulationDistance(dedicatedServerProperties.simulationDistance);
super.setUsingWhiteList(dedicatedServerProperties.whiteList.get());
+ // Paper start - moved from constructor
+ // Paper start - fix converting txt to json file; moved from constructor
+ }
+ @Override
+ public void loadAndSaveFiles() {
+ // Paper end
+ // Paper end - fix converting txt to json file
this.loadUserBanList();
this.saveUserBanList();
this.loadIpBanList();
@ -28,12 +28,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration
+ // Paper start - convert old users earlier after PlayerList creation but before file load/save
+ // Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
+ if (this.convertOldUsers()) {
+ this.getProfileCache().save(false); // Paper
+ }
+ this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames
+ // Paper end - convert old users earlier after PlayerList creation but before file load/save
+ // Paper end - fix converting txt to json file
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.maxPlayers = maxPlayers;
this.playerIo = saveHandler;
}
+ abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor
+ abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
player.isRealPlayer = true; // Paper

View file

@ -13,12 +13,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
+
+ // Paper - start
+ // Paper - start - living entity allow attribute registration
+ public void registerAttribute(Attribute attributeBase) {
+ AttributeInstance attributeModifiable = new AttributeInstance(attributeBase, AttributeInstance::getAttribute);
+ attributes.put(attributeBase, attributeModifiable);
+ }
+ // Paper - end
+ // Paper - end - living entity allow attribute registration
+
}
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
@ -29,13 +29,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return (nms == null) ? null : new CraftAttributeInstance(nms, attribute);
}
+ // Paper start
+ // Paper start - living entity allow attribute registration
+ @Override
+ public void registerAttribute(Attribute attribute) {
+ Preconditions.checkArgument(attribute != null, "attribute");
+ handle.registerAttribute(CraftAttribute.bukkitToMinecraft(attribute));
+ }
+ // Paper end
+ // Paper end - living entity allow attribute registration
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -45,12 +45,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.getHandle().craftAttributes.getAttribute(attribute);
}
+ // Paper start
+ // Paper start - living entity allow attribute registration
+ @Override
+ public void registerAttribute(Attribute attribute) {
+ getHandle().craftAttributes.registerAttribute(attribute);
+ }
+ // Paper end
+ // Paper end - living entity allow attribute registration
+
@Override
public void setAI(boolean ai) {

View file

@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
-
- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
- if (this.keepAlivePending) {
+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
+ // This should effectively place the keepalive handling back to "as it was" before 1.12.2
+ long currentTime = Util.getMillis();
+ long elapsedTime = currentTime - this.keepAliveTime;