This commit is contained in:
Bjarne Koll 2024-10-23 16:55:24 +02:00
parent 6bfc6db99e
commit 09b625eccf
No known key found for this signature in database
GPG key ID: 27F6CCCF55D2EE62
42 changed files with 245 additions and 245 deletions

View file

@ -0,0 +1,65 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Fri, 5 Jun 2020 18:24:06 -0400
Subject: [PATCH] Add PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e329503681961566a76a383245303e88acef37a4..5b1c8fb2765407cab1ca41d8d2fce83df1cc5fe1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -200,6 +200,7 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
+import org.bukkit.NamespacedKey;
import org.slf4j.Logger;
// CraftBukkit start
@@ -3086,21 +3087,41 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
ServerGamePacketListenerImpl.LOGGER.debug("Player {} tried to place impossible recipe {}", this.player, recipeholder.id().location());
return;
}
+ // Paper start - Add PlayerRecipeBookClickEvent
+ NamespacedKey recipeName = org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(recipeholder.id().location());
+ boolean makeAll = packet.useMaxItems();
+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent paperEvent = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent(
+ this.player.getBukkitEntity(), recipeName, makeAll
+ );
+ if (!paperEvent.callEvent()) {
+ return;
+ }
+ recipeName = paperEvent.getRecipe();
+ makeAll = paperEvent.isMakeAll();
+ if (org.bukkit.event.player.PlayerRecipeBookClickEvent.getHandlerList().getRegisteredListeners().length > 0) {
+ // Paper end - Add PlayerRecipeBookClickEvent
// CraftBukkit start - implement PlayerRecipeBookClickEvent
- org.bukkit.inventory.Recipe recipe = recipeholder.toBukkitRecipe();
+ org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(recipeName); // Paper - Add PlayerRecipeBookClickEvent - forward to legacy event
if (recipe == null) {
return;
}
- org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, packet.useMaxItems());
+ // Paper start - Add PlayerRecipeBookClickEvent - forward to legacy event
+ org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, makeAll);
+ recipeName = ((org.bukkit.Keyed) event.getRecipe()).getKey();
+ makeAll = event.isShiftClick();
+ }
+ if (!(this.player.containerMenu instanceof RecipeBookMenu)) {
+ return;
+ }
+ // Paper end - Add PlayerRecipeBookClickEvent - forward to legacy event
// Cast to keyed should be safe as the recipe will never be a MerchantRecipe.
- recipeholder = this.server.getRecipeManager().byKey(CraftRecipe.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).orElse(null);
+ recipeholder = this.server.getRecipeManager().byKey(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.RECIPE, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(recipeName))).orElse(null); // Paper - Add PlayerRecipeBookClickEvent - forward to legacy event
if (recipeholder == null) {
return;
}
-
- RecipeBookMenu.PostPlaceAction containerrecipebook_a = containerrecipebook.handlePlacement(event.isShiftClick(), this.player.isCreative(), recipeholder, this.player.serverLevel(), this.player.getInventory());
+ RecipeBookMenu.PostPlaceAction containerrecipebook_a = containerrecipebook.handlePlacement(makeAll, this.player.isCreative(), recipeholder, this.player.serverLevel(), this.player.getInventory());
// CraftBukkit end
if (containerrecipebook_a == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) {

View file

@ -9,7 +9,7 @@ on harddrives.
-DPaper.enable-sync-chunk-writes=true to enable -DPaper.enable-sync-chunk-writes=true to enable
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index eb27ef574445e1311b763d84aa1b37128baa75f7..d6431376184e5650b370cbab204e28bc31f4dac6 100644 index 47835226b61b726c750fe192fd94d3f8ba47565c..52e61f75f922a075ccc745198f4ba6ad8fa58ea2 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -146,7 +146,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie @@ -146,7 +146,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for command blocks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index da9e864520150acd8027545672aa476be414bb4d..d4bd44210d58b30696feeea48e1909472a546702 100644 index 4623c8acd125dff4919c4e2045b848310d785da5..86e4559da2344f228ef4d1c4ac3c115fa0266d23 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -405,7 +405,7 @@ public class ServerPlayerGameMode { @@ -403,7 +403,7 @@ public class ServerPlayerGameMode {
BlockEntity tileentity = this.level.getBlockEntity(pos); BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
@ -18,10 +18,10 @@ index da9e864520150acd8027545672aa476be414bb4d..d4bd44210d58b30696feeea48e190947
return false; return false;
} else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) { } else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b4af560246c1fe102bae9ec9383cbef385bb1887..e242ca5ec8c50bfd81b8ab1429e6e4e441025a75 100644 index 5b1c8fb2765407cab1ca41d8d2fce83df1cc5fe1..fc595e04191ffe3434d54156e924cec0f4b19cee 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -806,7 +806,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -811,7 +811,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) { if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@ -30,7 +30,7 @@ index b4af560246c1fe102bae9ec9383cbef385bb1887..e242ca5ec8c50bfd81b8ab1429e6e4e4
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else { } else {
BaseCommandBlock commandblocklistenerabstract = null; BaseCommandBlock commandblocklistenerabstract = null;
@@ -873,7 +873,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -878,7 +878,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) { if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@ -40,7 +40,7 @@ index b4af560246c1fe102bae9ec9383cbef385bb1887..e242ca5ec8c50bfd81b8ab1429e6e4e4
} else { } else {
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level()); BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
index efd6fcb0528d3c903e720edeb2f704347b34c18d..8c2dcc4134d96351cee75773214f3f47e71533e9 100644 index 0898dfd42de0c25938d9a25c18f43d5b1a16aa6c..a0e59b236dff1f861a0e987764a77ee203504412 100644
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java --- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java +++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
@@ -204,7 +204,7 @@ public abstract class BaseCommandBlock implements CommandSource { @@ -204,7 +204,7 @@ public abstract class BaseCommandBlock implements CommandSource {
@ -53,17 +53,17 @@ index efd6fcb0528d3c903e720edeb2f704347b34c18d..8c2dcc4134d96351cee75773214f3f47
} else { } else {
if (player.getCommandSenderWorld().isClientSide) { if (player.getCommandSenderWorld().isClientSide) {
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
index 72165318bcbd680d8dc69f3467cb78a439c9672e..eb88b8b6d83482ce7144622f32923ebeafd1fb7b 100644 index 68b44cd7c115c0f42992815171197e6bff50f8c6..fb5777b6a729a465c2482c5f89ced2bc79b425bc 100644
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java --- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
@@ -141,7 +141,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { @@ -152,7 +152,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
BlockEntity tileentity = world.getBlockEntity(pos); BlockEntity tileentity = world.getBlockEntity(pos);
- if (tileentity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) { - if (tileentity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) {
+ if (tileentity instanceof CommandBlockEntity && (player.canUseGameMasterBlocks() || (player.isCreative() && player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission + if (tileentity instanceof CommandBlockEntity && (player.canUseGameMasterBlocks() || (player.isCreative() && player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission
player.openCommandBlock((CommandBlockEntity) tileentity); player.openCommandBlock((CommandBlockEntity) tileentity);
return InteractionResult.sidedSuccess(world.isClientSide); return InteractionResult.SUCCESS;
} else { } else {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
index 245ad120a36b6defca7e6889faae1ca5fc33d0c7..e0e61115ada9a49d4c528c5d4e02a1ca571d9531 100644 index 245ad120a36b6defca7e6889faae1ca5fc33d0c7..e0e61115ada9a49d4c528c5d4e02a1ca571d9531 100644

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Ensure Entity position and AABB are never invalid
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 10015beb7a2de890fe27bffde8f55c1dd78ce344..9d08d0610be1741b4cd18a1454e538f46928fd94 100644 index 4faba83eb73e0d313e9131794962b727f7628a50..7fdfe1dd09812df1d8d7e5f95bcaf1b48c814e22 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -669,8 +669,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -677,8 +677,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void setPos(double x, double y, double z) { public void setPos(double x, double y, double z) {
@ -20,7 +20,7 @@ index 10015beb7a2de890fe27bffde8f55c1dd78ce344..9d08d0610be1741b4cd18a1454e538f4
} }
protected AABB makeBoundingBox() { protected AABB makeBoundingBox() {
@@ -4223,7 +4223,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -4412,7 +4412,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale); return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
} }
@ -50,7 +50,7 @@ index 10015beb7a2de890fe27bffde8f55c1dd78ce344..9d08d0610be1741b4cd18a1454e538f4
if (this.position.x != x || this.position.y != y || this.position.z != z) { if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z); this.position = new Vec3(x, y, z);
int i = Mth.floor(x); int i = Mth.floor(x);
@@ -4241,6 +4263,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -4430,6 +4452,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.levelCallback.onMove(); this.levelCallback.onMove();
} }

View file

@ -8,19 +8,19 @@ makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load. of restoring the server.properties every single load.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0370d26bd1e1d2fe1d640b052aca8a9c05dcb9dc..dd5f74fe4c8ca81b1d1102805ea8acb9087ba91e 100644 index b4eff440e3d9489f99e10a73611421ef877aa871..9109628a48026ceca9dd53a3e75f79510e56c95c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -836,7 +836,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -852,7 +852,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldloadlistener.stop(); worldloadlistener.stop();
// CraftBukkit start // CraftBukkit start
// this.updateMobSpawningFlags(); // this.updateMobSpawningFlags();
- worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); - worldserver.setSpawnSettings(this.isSpawningMonsters());
+ worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters, this.isSpawningAnimals()); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean)) + worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean))
this.forceTicks = false; this.forceTicks = false;
// CraftBukkit end // CraftBukkit end
@@ -1846,11 +1846,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1933,11 +1933,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
} }
@ -40,12 +40,12 @@ index 0370d26bd1e1d2fe1d640b052aca8a9c05dcb9dc..dd5f74fe4c8ca81b1d1102805ea8acb9
} }
} }
@@ -1864,7 +1867,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1951,7 +1954,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
- worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); - worldserver.setSpawnSettings(this.isSpawningMonsters());
+ worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters, this.isSpawningAnimals()); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean)) + worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean))
} }
} }
@ -63,10 +63,10 @@ index 997a96a21440ae72696d68f8031ece4ba487d3ef..3d8584929cee000ae7df10c5bd94f358
return Component.translatable("commands.difficulty.success", difficulty.getDisplayName()); return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
}, true); }, true);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index d6dc8c983d26ce89f17a990be4284fdc78ad164b..2b1d7a2360a9ee7bca9d93a2dc8c61d1648a8348 100644 index 82d5f1235d158326ce6fb1eb6d481c00f57467d3..20a3138c6c2a6c8ada8b6008913abae0eea76f2d 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -350,7 +350,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -339,7 +339,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override @Override
public void forceDifficulty() { public void forceDifficulty() {
@ -76,10 +76,10 @@ index d6dc8c983d26ce89f17a990be4284fdc78ad164b..2b1d7a2360a9ee7bca9d93a2dc8c61d1
@Override @Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index e242ca5ec8c50bfd81b8ab1429e6e4e441025a75..d2eb8c619905d87a38820a4c1179ad93093c0ac3 100644 index fc595e04191ffe3434d54156e924cec0f4b19cee..510c97062d77541425aed6ddaaad58be4290967b 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3259,7 +3259,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3304,7 +3304,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {
@ -89,25 +89,25 @@ index e242ca5ec8c50bfd81b8ab1429e6e4e441025a75..d2eb8c619905d87a38820a4c1179ad93
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e56f4b254af45311acb0b55195dcbd9f372cae98..ac3931f7d992d3675403e3b525f3cd9928cf7ed4 100644 index f80164bf8fde13a8702f09e1e1d8aab3ba075e42..acf213f47aea597824e2301e422435fbb77098fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -998,8 +998,8 @@ public final class CraftServer implements Server { @@ -1001,8 +1001,8 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console); this.console.paperConfigurations.reloadConfigs(this.console);
for (ServerLevel world : this.console.getAllLevels()) { for (ServerLevel world : this.console.getAllLevels()) {
- world.serverLevelData.setDifficulty(config.difficulty); - world.serverLevelData.setDifficulty(config.difficulty);
- world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); - world.setSpawnSettings(config.spawnMonsters);
+ // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty + // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
+ world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) + world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
for (SpawnCategory spawnCategory : SpawnCategory.values()) { for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 2d6b24220057ea9a510dc86161cbaf909c061699..16e1ae8aaad143ee86f850e654de696dbbb84f30 100644 index d723486f1582b232fbf78898a56caa3a13954417..e558ce7fddf6835dd78391b2fbc05ee22af059bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1167,7 +1167,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1177,7 +1177,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public void setDifficulty(Difficulty difficulty) { public void setDifficulty(Difficulty difficulty) {

View file

@ -7,7 +7,7 @@ Don't constantly send format: false for all formatting options when parent alrea
has it false has it false
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
index 1b552b3f05ac7fc44450de4b1ec78907a0f62424..3a550f2bd1366ae89c69a0527404b0449e6d9cf7 100644 index 95444fd9fecc5bda5462ca8dfeca82c5318f0895..fd697475e2df1cef8260b47dabb491beb0bd1a8e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
@@ -48,6 +48,7 @@ public final class CraftChatMessage { @@ -48,6 +48,7 @@ public final class CraftChatMessage {

View file

@ -22,10 +22,10 @@ wants it to collect even faster, they can restore that setting back to 1 instead
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons. Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ac3931f7d992d3675403e3b525f3cd9928cf7ed4..42ec4aed187b41729a3c985ae440097db0388d3c 100644 index acf213f47aea597824e2301e422435fbb77098fb..dfe625f406ac323ede270d3773e71b09a3ba0054 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -380,7 +380,7 @@ public final class CraftServer implements Server { @@ -383,7 +383,7 @@ public final class CraftServer implements Server {
this.overrideSpawnLimits(); this.overrideSpawnLimits();
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
@ -34,7 +34,7 @@ index ac3931f7d992d3675403e3b525f3cd9928cf7ed4..42ec4aed187b41729a3c985ae440097d
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api")); this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
this.loadIcon(); this.loadIcon();
this.loadCompatibilities(); this.loadCompatibilities();
@@ -976,7 +976,7 @@ public final class CraftServer implements Server { @@ -979,7 +979,7 @@ public final class CraftServer implements Server {
this.console.setMotd(config.motd); this.console.setMotd(config.motd);
this.overrideSpawnLimits(); this.overrideSpawnLimits();
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
@ -44,10 +44,10 @@ index ac3931f7d992d3675403e3b525f3cd9928cf7ed4..42ec4aed187b41729a3c985ae440097d
this.printSaveWarning = false; this.printSaveWarning = false;
this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 16e1ae8aaad143ee86f850e654de696dbbb84f30..520867fa3d49e421ef5290976a9eed8f58ff7590 100644 index e558ce7fddf6835dd78391b2fbc05ee22af059bd..3ea157df3df6f590195191f2c24faead703a0bf8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -266,7 +266,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -270,7 +270,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public Chunk getChunkAt(int x, int z) { public Chunk getChunkAt(int x, int z) {
@ -62,7 +62,7 @@ index 16e1ae8aaad143ee86f850e654de696dbbb84f30..520867fa3d49e421ef5290976a9eed8f
return new CraftChunk(chunk); return new CraftChunk(chunk);
} }
@@ -280,6 +286,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -284,6 +290,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return new CraftChunk(this.getHandle(), x, z); return new CraftChunk(this.getHandle(), x, z);
} }
@ -75,7 +75,7 @@ index 16e1ae8aaad143ee86f850e654de696dbbb84f30..520867fa3d49e421ef5290976a9eed8f
@Override @Override
public Chunk getChunkAt(Block block) { public Chunk getChunkAt(Block block) {
Preconditions.checkArgument(block != null, "null block"); Preconditions.checkArgument(block != null, "null block");
@@ -331,7 +343,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -335,7 +347,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
public boolean unloadChunkRequest(int x, int z) { public boolean unloadChunkRequest(int x, int z) {
org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot
if (this.isChunkLoaded(x, z)) { if (this.isChunkLoaded(x, z)) {
@ -84,7 +84,7 @@ index 16e1ae8aaad143ee86f850e654de696dbbb84f30..520867fa3d49e421ef5290976a9eed8f
} }
return true; return true;
@@ -441,7 +453,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -447,7 +459,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
} }
if (chunk instanceof net.minecraft.world.level.chunk.LevelChunk) { if (chunk instanceof net.minecraft.world.level.chunk.LevelChunk) {
@ -93,7 +93,7 @@ index 16e1ae8aaad143ee86f850e654de696dbbb84f30..520867fa3d49e421ef5290976a9eed8f
return true; return true;
} }
@@ -2243,6 +2255,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2256,6 +2268,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
ca.spottedleaf.moonrise.common.util.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> { ca.spottedleaf.moonrise.common.util.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c; net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;

View file

@ -30,10 +30,10 @@ index de40e522960469b98f987bd688489740446d9f85..5678d2007d5adf45dec0638c5dd848b6
public CraftAttributeMap(AttributeMap handle) { public CraftAttributeMap(AttributeMap handle) {
this.handle = handle; this.handle = handle;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 97c40582bca095532fff9a81515f38ea4ac527e0..5c76ba7f9ceb285d27e18369172612205be96224 100644 index b2683d6efd53b03d7043098b19a1504885a5b3c7..af78e73755743fb2db7a99b834affc963b44bc10 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -702,7 +702,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -810,7 +810,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier); AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index d2eb8c619905d87a38820a4c1179ad93093c0ac3..90e5f263dcb8033dae3ca32cbf5dbd332a109282 100644 index 510c97062d77541425aed6ddaaad58be4290967b..09bb38460ab6fa7b6132e245d52b60244bd248eb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3251,6 +3251,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3296,6 +3296,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleClientInformation(ServerboundClientInformationPacket packet) { public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View file

@ -5,11 +5,11 @@ Subject: [PATCH] Improve/fix EntityTargetLivingEntityEvent
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
index cc7d161b53a2295fa1745254eafb8a70c7b6c7b2..508d4f391fe563453d7bf6782b3082741c358006 100644 index 70df68169b17fa5f732e4c73a86376ba6eb9ca13..b31f6ccc95132a7dd022b454d28814b684d99d4c 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java --- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java
@@ -47,9 +47,22 @@ public class StopAttackingIfTargetInvalid { @@ -46,9 +46,22 @@ public class StopAttackingIfTargetInvalid {
if (entityinsentient.canAttack(entityliving) && (!shouldForgetIfTargetUnreachable || !StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level() == entityinsentient.level() && !alternativeCondition.test(entityliving)) { if (entityinsentient.canAttack(entityliving) && (!shouldForgetIfTargetUnreachable || !StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level() == entityinsentient.level() && !condition.test(worldserver, entityliving)) {
return true; return true;
} else { } else {
+ // Paper start - better track target change reason + // Paper start - better track target change reason

View file

@ -8,10 +8,10 @@ public net.minecraft.world.entity.Entity isInRain()Z
public net.minecraft.world.entity.Entity isInBubbleColumn()Z public net.minecraft.world.entity.Entity isInBubbleColumn()Z
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index ce70c8fddbe63d0af2b1f988ce9a2b40c5d48066..34321f095e12ea0cca34ff1ec00819c6350205a8 100644 index 7fb04535b8c0744d0fa4b0c0a933234134486956..b001284e368f64871824c1f961999bb3f726de57 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1025,4 +1025,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1026,4 +1026,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return getHandle().spawnReason; return getHandle().spawnReason;
} }
// Paper end - entity spawn reason API // Paper end - entity spawn reason API

View file

@ -8,10 +8,10 @@ Adds a new event for all crafting stations that generate a result slot item
Anvil, Grindstone and Smithing now extend this event Anvil, Grindstone and Smithing now extend this event
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index ffda2c984c5683edb38a56f04c53b0ea339e08fc..d685511104ac552dfc9ae2111e1bfb60fa812102 100644 index 126565e673e94b9c66aa4547596bbf198c57c7ad..cc5aae32f34305965847ade8b530272b1126b5c9 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -327,6 +327,7 @@ public class AnvilMenu extends ItemCombinerMenu { @@ -333,6 +333,7 @@ public class AnvilMenu extends ItemCombinerMenu {
} }
this.createResult(); this.createResult();
@ -20,10 +20,10 @@ index ffda2c984c5683edb38a56f04c53b0ea339e08fc..d685511104ac552dfc9ae2111e1bfb60
} else { } else {
return false; return false;
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
index 11d7bf4f90083991cfc8c6c5f9a1e8ad6a162843..c52c4c4210bc6ae082443318d9795c48c816aba6 100644 index 5b31d09b158c694b3e54ab3a228817accaa00a0c..8b72d1fd551dcb113f4137aee441a9531c00288a 100644
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java --- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java +++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
@@ -152,6 +152,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { @@ -140,6 +140,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
this.setupResultSlot(itemstack, itemstack1, itemstack2); this.setupResultSlot(itemstack, itemstack1, itemstack2);
} }
@ -32,10 +32,10 @@ index 11d7bf4f90083991cfc8c6c5f9a1e8ad6a162843..c52c4c4210bc6ae082443318d9795c48
private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) { private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) {
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index 637d77d6b07ff9ee5ac1cb0470cbefcba5c7495e..15ec798e149d80aace186f84b9236ddeaba690c3 100644 index 13bc52bc856031c930370828b0381e43920aabd2..8e58dbb4b110338dfe8add26697d0b1c9ec5fa9c 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -160,6 +160,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -148,6 +148,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
super.slotsChanged(inventory); super.slotsChanged(inventory);
if (inventory == this.repairSlots) { if (inventory == this.repairSlots) {
this.createResult(); this.createResult();
@ -44,10 +44,10 @@ index 637d77d6b07ff9ee5ac1cb0470cbefcba5c7495e..15ec798e149d80aace186f84b9236dde
} }
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
index 62432c347b86fc79ab529a7dde66bef32d0424dd..be840717e180b6b5abd14db6cc9263349737f9a3 100644 index 594a387d7e3a67da02ea54b4f259426df2eb21a2..4734dd90f2a66e1ac7a64b35ecd62a630108cf07 100644
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java --- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
@@ -110,6 +110,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { @@ -96,6 +96,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
super.slotsChanged(inventory); super.slotsChanged(inventory);
if (inventory == this.inputSlots) { if (inventory == this.inputSlots) {
this.createResult(); this.createResult();
@ -56,10 +56,10 @@ index 62432c347b86fc79ab529a7dde66bef32d0424dd..be840717e180b6b5abd14db6cc926334
} }
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index 69ed0753c224cb7746762b4b94c4d79d608951b8..2de558dd205a1078fdcac1bce256d059b9bf5d5f 100644 index d988747ccb81ca74db8ce14fea49d13c9c1b4476..58470d8e9a4ceb1eca05b342481ed8260588e225 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java --- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -249,7 +249,8 @@ public class LoomMenu extends AbstractContainerMenu { @@ -237,7 +237,8 @@ public class LoomMenu extends AbstractContainerMenu {
this.resultSlot.set(ItemStack.EMPTY); this.resultSlot.set(ItemStack.EMPTY);
} }
@ -70,11 +70,11 @@ index 69ed0753c224cb7746762b4b94c4d79d608951b8..2de558dd205a1078fdcac1bce256d059
this.resultSlot.set(ItemStack.EMPTY); this.resultSlot.set(ItemStack.EMPTY);
this.selectablePatterns = List.of(); this.selectablePatterns = List.of();
diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
index 0735705def4f9505b7f16df2497cc78bbf5a8373..86e51fcce767d265ee0d3beb611be2119085830b 100644 index 4b0d07a22cb922aa5ef0c99279663158a5918f1f..89d2f26504bb072c2d75af4ec600ca123e10a600 100644
--- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java --- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java +++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
@@ -121,6 +121,7 @@ public class SmithingMenu extends ItemCombinerMenu { @@ -115,6 +115,7 @@ public class SmithingMenu extends ItemCombinerMenu {
} this.hasRecipeError.set(flag ? 1 : 0);
} }
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
@ -82,22 +82,22 @@ index 0735705def4f9505b7f16df2497cc78bbf5a8373..86e51fcce767d265ee0d3beb611be211
@Override @Override
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index 30ea1f9e97db86a2ad7baeea4f5a76c821874daa..5b4f03128499b0c1a4b8c5f5ccd17e4bdb391e81 100644 index 0fb0ee5b22dc96c48d68e4391fd71b03d4e799f0..97837d1baf6b929a50e5562ef466050e70c2c8b1 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java --- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java +++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -182,6 +182,7 @@ public class StonecutterMenu extends AbstractContainerMenu { @@ -170,6 +170,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
this.setupRecipeList(inventory, itemstack); this.setupRecipeList(itemstack);
} }
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
} }
private static SingleRecipeInput createRecipeInput(Container inventory) { private void setupRecipeList(ItemStack stack) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index f3ec3d14e66b9c1dff32088d4aef57e21265048c..f633d08b35bf9018367a449cc000c6c6ca5a44cd 100644 index b40117e9940ab493ea4a945dbd9754a38b1159b9..62f4fd6553ab0310e2c0dde1d917c63679365798 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1681,6 +1681,12 @@ public class CraftEventFactory { @@ -1679,6 +1679,12 @@ populateFields(victim, event); // Paper - make cancellable
} }
public static PrepareAnvilEvent callPrepareAnvilEvent(AnvilView view, ItemStack item) { public static PrepareAnvilEvent callPrepareAnvilEvent(AnvilView view, ItemStack item) {
@ -110,7 +110,7 @@ index f3ec3d14e66b9c1dff32088d4aef57e21265048c..f633d08b35bf9018367a449cc000c6c6
PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone()); PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone());
event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
event.getInventory().setItem(2, event.getResult()); event.getInventory().setItem(2, event.getResult());
@@ -1688,6 +1694,12 @@ public class CraftEventFactory { @@ -1686,6 +1692,12 @@ populateFields(victim, event); // Paper - make cancellable
} }
public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) { public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) {
@ -123,7 +123,7 @@ index f3ec3d14e66b9c1dff32088d4aef57e21265048c..f633d08b35bf9018367a449cc000c6c6
PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone()); PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone());
event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
event.getInventory().setItem(2, event.getResult()); event.getInventory().setItem(2, event.getResult());
@@ -1695,12 +1707,39 @@ public class CraftEventFactory { @@ -1693,12 +1705,39 @@ populateFields(victim, event); // Paper - make cancellable
} }
public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) { public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 8920099eb488c37b036b7bd97fbd4f7db505c77c..906e8589483b93bcdb55677f7f942f6c7a89caf8 100644 index 65909e0a8f8b68f9a4dacefda9069c8263a96ada..91a5166e69a03d846a1b396ba964003c12a0dcdb 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3659,7 +3659,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3798,7 +3798,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Entity entity = this.getVehicle(); Entity entity = this.getVehicle();
super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation

View file

@ -9,12 +9,12 @@ instead of getting stuck in a never despawn state (bubble columns,
etc). etc).
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 6c79997ba46e641de5aa12ff8a3d790d04a5a475..746bb8a36bd6c6ef953289576af499caad588d79 100644 index 78053060dbff7f8a859f9fecb356491f497eed7e..bc167c21f82ad09952f6cdbf1016523062890f8b 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -238,6 +238,7 @@ public abstract class AbstractArrow extends Projectile { @@ -242,6 +242,7 @@ public abstract class AbstractArrow extends Projectile {
}
++this.inGroundTime;
} else { } else {
+ if (tickCount > 200) this.tickDespawn(); // Paper - tick despawnCounter regardless after 10 seconds + if (tickCount > 200) this.tickDespawn(); // Paper - tick despawnCounter regardless after 10 seconds
this.inGroundTime = 0; this.inGroundTime = 0;

View file

@ -26,10 +26,10 @@ index 14ccd0c8f721e9be7dca8a5dcb8ef95b5cd82731..1f4963bf4681a771130abc1da1798196
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 2a22827f44dd0d524c22264447959a6979e9f0de..f3c83bb20a73b489f1fb6bacb69388902b1b6fe7 100644 index 5316f148f3f9128690f019d544e462b042d8d797..f31c5d665678c3163ed4469f8e9d395b890c1bbe 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -64,7 +64,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS @@ -66,7 +66,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
private final Vec2 rotation; private final Vec2 rotation;
private final CommandSigningContext signingContext; private final CommandSigningContext signingContext;
private final TaskChainer chatMessageChainer; private final TaskChainer chatMessageChainer;
@ -38,7 +38,7 @@ index 2a22827f44dd0d524c22264447959a6979e9f0de..f3c83bb20a73b489f1fb6bacb6938890
public boolean bypassSelectorPermissions = false; // Paper - add bypass for selector permissions public boolean bypassSelectorPermissions = false; // Paper - add bypass for selector permissions
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
@@ -193,9 +193,11 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS @@ -195,9 +195,11 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@Override @Override
public boolean hasPermission(int level) { public boolean hasPermission(int level) {
// CraftBukkit start // CraftBukkit start

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 993296f9c2457809bd6b844c309895f417eb42a5..7dfcb8c6583d1c13fe688b5e17edb9d1c6935547 100644 index a9dadd106ff0ac0f788c16048a73dfc3320b4944..f6020adb0e72b129be154a905941af923c5aadd0 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -167,8 +167,17 @@ public class Main { @@ -167,8 +167,17 @@ public class Main {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 7dfcb8c6583d1c13fe688b5e17edb9d1c6935547..ded1b7ab4ca1ae3a2d799fe31d05bd6a0c27dcb7 100644 index f6020adb0e72b129be154a905941af923c5aadd0..59d623dd45c395552ffd99e6fa744c0f71d94998 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -167,6 +167,7 @@ public class Main { @@ -167,6 +167,7 @@ public class Main {

View file

@ -52,7 +52,7 @@ index 9a387d5dc0925304d4163e3caa22206aaa68e3b7..f43053ba082f9772b6ec02828fa2d6f3
LootContext lootContext = EntityPredicate.createContext(player, player); LootContext lootContext = EntityPredicate.createContext(player, player);
List<CriterionTrigger.Listener<T>> list = null; List<CriterionTrigger.Listener<T>> list = null;
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 4c85abf29441645039b6a554a50e1d3274229de6..d85fb1e2ea0eaef81e9039b47d18f83507e05a59 100644 index 0542b61053ed7039e54856eab86ba5842403e4fc..0fe941b0802f2966ad55509baac124f56ecef999 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -63,6 +63,7 @@ public class PlayerAdvancements { @@ -63,6 +63,7 @@ public class PlayerAdvancements {

View file

@ -5,22 +5,22 @@ Subject: [PATCH] Fix some rails connecting improperly
diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
index f9b6db516fa0788a6d4d40fa7ea2039cd3282b24..0961f6f5e627debe0bf02670d922e6d3388ba631 100644 index 4a5badc4bb1e2c29016735e9df93c7ac4d3f363d..f9a55f76fed8609bca167b2ea37464e8079de0c0 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java --- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
@@ -68,6 +68,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl @@ -71,6 +71,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl
state = this.updateDir(world, pos, state, true); state = this.updateDir(world, pos, state, true);
if (this.isStraight) { if (this.isStraight) {
world.neighborChanged(state, pos, this, pos, notify); world.neighborChanged(state, pos, this, null, notify);
+ state = world.getBlockState(pos); // Paper - Fix some rails connecting improperly + state = world.getBlockState(pos); // Paper - Fix some rails connecting improperly
} }
return state; return state;
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
index e5534fd35a8f9736cc25471e9f0feaa8da88c85d..55a97da8786ec0ae98abe56876c00f4678ba0007 100644 index 3de30845aae143e5be5db921004142792522607d..1e2f56b5c40c3dc72bc38354160f8e7de1f4f5cf 100644
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -77,6 +77,7 @@ public class DetectorRailBlock extends BaseRailBlock { @@ -78,6 +78,7 @@ public class DetectorRailBlock extends BaseRailBlock {
private void checkPressed(Level world, BlockPos pos, BlockState state) { private void checkPressed(Level world, BlockPos pos, BlockState state) {
if (this.canSurvive(state, world, pos)) { if (this.canSurvive(state, world, pos)) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index e6e7dc17d1196a8211a565355f34b5dcfd478852..45181bc9c422507682d479e4d43177ecd3253971 100644 index 807068fc6065f71961d34cb4f18b6eb39ae49637..c468947990cf05e554006e51d87b72fad7c28e55 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -294,6 +294,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -322,6 +322,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
// CraftBukkit end // CraftBukkit end
public boolean isRealPlayer; // Paper public boolean isRealPlayer; // Paper
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
@ -17,10 +17,10 @@ index e6e7dc17d1196a8211a565355f34b5dcfd478852..45181bc9c422507682d479e4d43177ec
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) { public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 4f62abfe62c951b7a1df36ece34747100d6a4ff7..48085b2e7197dc44e76b812bdd514af729e21e83 100644 index b9fbaddcc8239bf737fdea51790f678306e511eb..9a8b08d4b70b8890961e4af7ce6e870aa1c7c810 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -83,6 +83,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -84,6 +84,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private volatile boolean suspendFlushingOnServerThread = false; private volatile boolean suspendFlushingOnServerThread = false;
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
@ -28,7 +28,7 @@ index 4f62abfe62c951b7a1df36ece34747100d6a4ff7..48085b2e7197dc44e76b812bdd514af7
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver; this.server = minecraftserver;
@@ -148,6 +149,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -155,6 +156,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override @Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
@ -40,7 +40,7 @@ index 4f62abfe62c951b7a1df36ece34747100d6a4ff7..48085b2e7197dc44e76b812bdd514af7
if (!(packet.payload() instanceof DiscardedPayload)) { if (!(packet.payload() instanceof DiscardedPayload)) {
return; return;
} }
@@ -179,6 +185,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -186,6 +192,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
try { try {
byte[] data = new byte[payload.readableBytes()]; byte[] data = new byte[payload.readableBytes()];
payload.readBytes(data); payload.readBytes(data);
@ -57,10 +57,10 @@ index 4f62abfe62c951b7a1df36ece34747100d6a4ff7..48085b2e7197dc44e76b812bdd514af7
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 068ff2c228308ec87fcc6d1352bd63b91bd34a93..854533854dfba24b59a15265ac759331e3ddfc74 100644 index f836a65db1028b51ebd425251ca37e0c439d4ad6..eb2954c9b51d4fd76cf5aec17899218f4de7076d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3139,6 +3139,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3152,6 +3152,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end // Paper end
}; };

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 733c69a2cfa60fb8c920400e3d9acfc2465090e5..fad7d8130f6db70c7bfca9d02027d8a41f5309c1 100644 index 35130dc4e20ef644b5764091fcbccda2e4da780b..5beee554567d36f2a3b871cf6ec3ecb3d2353592 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -990,4 +990,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -1009,4 +1009,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} }
} }
// Paper end - entity jump API // Paper end - entity jump API

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5b89d834a7c01530807e61ea25af2b01f004ce86..50d2e628590e8563d2ef5b987f764cf1785e3b50 100644 index 090d2fde891346ee634a8964b562715f4dd206d0..465b6a1bbdbb193c6ecf5fd1598e1e4a4f8dbbbc 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1668,7 +1668,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1730,7 +1730,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
float f1 = this.levelData.getSpawnAngle(); float f1 = this.levelData.getSpawnAngle();
if (!blockposition1.equals(pos) || f1 != angle) { if (!blockposition1.equals(pos) || f1 != angle) {
@ -19,10 +19,10 @@ index 5b89d834a7c01530807e61ea25af2b01f004ce86..50d2e628590e8563d2ef5b987f764cf1
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c35fd2fcb6ced6a16816637353d03c88f1d49d1b..99fccedaab2600881683140e10ee17377375b911 100644 index 3ea157df3df6f590195191f2c24faead703a0bf8..04ef1c3433d3ac8a58f0d460877e176668e0fc8f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -246,12 +246,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -250,12 +250,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean setSpawnLocation(int x, int y, int z, float angle) { public boolean setSpawnLocation(int x, int y, int z, float angle) {
try { try {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add moon phase API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 454f3a08c4d319f3d3fe2b1209c4d8b9fa9d4d08..1963e826548c5a8859c50f57654784c3aef50e44 100644 index 2b5e8d01a31de154faa18c55cdddd3bd7f462891..93dadbf659e41c923268d8ec782fcbdc8aaeff68 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java --- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -509,4 +509,11 @@ public abstract class CraftRegionAccessor implements RegionAccessor { @@ -509,4 +509,11 @@ public abstract class CraftRegionAccessor implements RegionAccessor {

View file

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Tue, 23 Jul 2019 20:44:47 -0500
Subject: [PATCH] Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
index 92ad7704a77c024afe090488764eaf59a4f7505f..d7a204216332ccbd6bece23bd507be0366ea4d61 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
@@ -104,11 +104,25 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun
}
// Paper end - guard against serializing mismatching coordinates
+ // Paper start - Do not let the server load chunks from newer versions
+ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion();
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
+ // Paper end - Do not let the server load chunks from newer versions
+
@Nullable
public static SerializableChunkData parse(LevelHeightAccessor world, RegistryAccess registryManager, CompoundTag nbt) {
if (!nbt.contains("Status", 8)) {
return null;
} else {
+ // Paper start - Do not let the server load chunks from newer versions
+ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ final int dataVersion = nbt.getInt("DataVersion");
+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) {
+ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace();
+ System.exit(1);
+ }
+ }
+ // Paper end - Do not let the server load chunks from newer versions
ChunkPos chunkcoordintpair = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate
long i = nbt.getLong("LastUpdate");
long j = nbt.getLong("InhabitedTime");

View file

@ -5,11 +5,11 @@ Subject: [PATCH] Prevent headless pistons from being created
Prevent headless pistons from being created by explosions or tree/mushroom growth. Prevent headless pistons from being created by explosions or tree/mushroom growth.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java
index d4fe425954d36f0baddb256e3c83009a84084b72..edcc9d53ad81e2b2444335ac79abde5a4e2d9d47 100644 index d3d74a7f306d88b0d5cd83893b3ee5e750fd4caf..86656de31b1e33381eddd3ef210122118b31e620 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/ServerExplosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java
@@ -208,6 +208,15 @@ public class Explosion { @@ -164,6 +164,15 @@ public class ServerExplosion implements Explosion {
if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) { if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
set.add(blockposition); set.add(blockposition);

View file

@ -7,10 +7,10 @@ Add a new event, BellRingEvent, to trigger whenever a player rings a
village bell. Passes along the bell block and the player who rang it. village bell. Passes along the bell block and the player who rang it.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index f633d08b35bf9018367a449cc000c6c6ca5a44cd..dbe7931dd7eb43f9381463d3a57ba1eb53820985 100644 index 62f4fd6553ab0310e2c0dde1d917c63679365798..c7d78f54694b464696c0f1edd0b135d1d5bcde3e 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -378,10 +378,11 @@ public class CraftEventFactory { @@ -377,10 +377,11 @@ public class CraftEventFactory {
return tradeSelectEvent; return tradeSelectEvent;
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add zombie targets turtle egg config
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index e2a3978899497b6622829d6577cfaa723092da9d..78254df3e5fbcb0a90c2f9eb9c9343792238f685 100644 index 2ed71c9a091bedea276f9043fb0c082dd250cdae..9adcaa646dff7f5415a467a2bfe5b817e17f5640 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -110,7 +110,7 @@ public class Zombie extends Monster { @@ -112,7 +112,7 @@ public class Zombie extends Monster {
@Override @Override
protected void registerGoals() { protected void registerGoals() {

View file

@ -29,7 +29,7 @@ index 946b423d2184f903dc29c923d7dbe05aaa469c09..0c1bdf2329936ce479a2cc53e8a46bd2
this.connection.disconnect((Component) ichatmutablecomponent); this.connection.disconnect((Component) ichatmutablecomponent);
} else { } else {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index de25b9ea8aa4b7d6fd3fed12cdd16be9ddfcbfff..d2d153e587e624025ef01fbe3dcfa4bf06f1a06b 100644 index fd9e6781a18d41ca3982788711749d11575566d0..9d5723cdfdbf6257a71e57842aea9ba317fc049a 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -133,7 +133,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @@ -133,7 +133,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,

View file

@ -11,7 +11,7 @@ public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/Fir
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com> Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index f041b5d80bff9c022b007e04ef1558e9116acc6b..a586442422a2b2c06b785af0d261d3e19eb1d59b 100644 index aae00320ab8003420bae5de7df47f553b62c5aab..3fa3de9a89550ec2fcb8ca663742826c0c3136b6 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -669,5 +669,10 @@ public class CraftBlock implements Block { @@ -669,5 +669,10 @@ public class CraftBlock implements Block {
@ -64,10 +64,10 @@ index f73017bff613bd62b86c974b29576e241c24c927..59c9c970b83f62245d860994c4ac0c21
public String getTranslationKey() { public String getTranslationKey() {
return Util.makeDescriptionId("enchantment", this.handle.unwrapKey().get().location()); return Util.makeDescriptionId("enchantment", this.handle.unwrapKey().get().location());
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
index d20fdd4f06faa09c7d9f9e04f379cf0fa68db9bb..66d773cadb74f9176e6cf68a565568034f52ec63 100644 index 0e9d3d823608a694ef1de5c4fec593951d678c1a..68756419ac6ee292db9569eab380a5c14d748002 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
@@ -240,4 +240,11 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han @@ -237,4 +237,11 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
public Material asMaterial() { public Material asMaterial() {
return Registry.MATERIAL.get(this.key); return Registry.MATERIAL.get(this.key);
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Create HoverEvent from ItemStack Entity
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index fd0df053cd5e8802991e665185e7f90f8001d80c..eabb8b42b890224dd19b879ff276e9908674310d 100644 index 685aa3c35dc593b1d923a31967649b468df8a238..19c1faecb398f5b91dd04827b66038c352e5b4e4 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -246,4 +246,44 @@ public final class CraftItemFactory implements ItemFactory { @@ -249,4 +249,44 @@ public final class CraftItemFactory implements ItemFactory {
return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId(nms)) : null; return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId(nms)) : null;
} }
// Paper end - add getI18NDisplayName // Paper end - add getI18NDisplayName

View file

@ -5,22 +5,22 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index dd5f74fe4c8ca81b1d1102805ea8acb9087ba91e..d2866b9f7e6c8f0ca30d451c93c56caefb2c1b5c 100644 index 9109628a48026ceca9dd53a3e75f79510e56c95c..b1447fb684f5cbdc9106363870f5551ee9e1342c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2145,6 +2145,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2227,6 +2227,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
this.fuelValues = FuelValues.vanillaBurnTimes(this.registries.compositeAccess(), this.worldData.enabledFeatures());
+ org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings; they can be defined by datapacks so refresh it here + org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings; they can be defined by datapacks so refresh it here
}, this); }, this);
if (this.isSameThread()) { if (this.isSameThread()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
index c1c5750dd2e4a9af1a115996a87eaaa1ea552c74..67ff2241aa8869b41abb0a93467b8694618264e2 100644 index c53dbcfde62ae8e2f019e854c336ce4a60346dc9..f73858663162cb594db382d584b6500bb03e74b1 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java
@@ -154,7 +154,7 @@ public class CraftBlockData implements BlockData { @@ -156,7 +156,7 @@ public class CraftBlockData implements BlockData {
return exactMatch; return exactMatch;
} }
@ -29,7 +29,7 @@ index c1c5750dd2e4a9af1a115996a87eaaa1ea552c74..67ff2241aa8869b41abb0a93467b8694
/** /**
* Convert an NMS Enum (usually a BlockStateEnum) to its appropriate Bukkit * Convert an NMS Enum (usually a BlockStateEnum) to its appropriate Bukkit
@@ -539,7 +539,38 @@ public class CraftBlockData implements BlockData { @@ -543,7 +543,38 @@ public class CraftBlockData implements BlockData {
Preconditions.checkState(CraftBlockData.MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit); Preconditions.checkState(CraftBlockData.MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit);
} }

View file

@ -9,10 +9,10 @@ as this is how Vanilla teleports entities.
Cancel any pending motion when teleported. Cancel any pending motion when teleported.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 90e5f263dcb8033dae3ca32cbf5dbd332a109282..82f49aad1d0ce2d62bf61aa634ebef3711d4d930 100644 index 09bb38460ab6fa7b6132e245d52b60244bd248eb..319717d5b67b9bc2a261bc69679c2e6634d7696c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -679,7 +679,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -678,7 +678,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return; return;
} }
@ -21,20 +21,11 @@ index 90e5f263dcb8033dae3ca32cbf5dbd332a109282..82f49aad1d0ce2d62bf61aa634ebef37
this.lastGoodX = this.awaitingPositionFromClient.x; this.lastGoodX = this.awaitingPositionFromClient.x;
this.lastGoodY = this.awaitingPositionFromClient.y; this.lastGoodY = this.awaitingPositionFromClient.y;
this.lastGoodZ = this.awaitingPositionFromClient.z; this.lastGoodZ = this.awaitingPositionFromClient.z;
@@ -1594,7 +1594,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// CraftBukkit end
this.awaitingTeleportTime = this.tickCount;
- this.player.absMoveTo(d0, d1, d2, f, f1);
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - Fix Entity Teleportation and cancel velocity if teleported
this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9d08d0610be1741b4cd18a1454e538f46928fd94..f1383906dbd16e088f57c9c77c051c8501b155cc 100644 index 7fdfe1dd09812df1d8d7e5f95bcaf1b48c814e22..f8fd729d53248c7598a118d89fedf340f82cdd61 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -171,6 +171,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -179,6 +179,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit start // CraftBukkit start
private static final int CURRENT_LEVEL = 2; private static final int CURRENT_LEVEL = 2;
@ -42,7 +33,7 @@ index 9d08d0610be1741b4cd18a1454e538f46928fd94..f1383906dbd16e088f57c9c77c051c85
static boolean isLevelAtLeast(CompoundTag tag, int level) { static boolean isLevelAtLeast(CompoundTag tag, int level) {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
} }
@@ -1873,6 +1874,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1943,6 +1944,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
public void moveTo(double x, double y, double z, float yaw, float pitch) { public void moveTo(double x, double y, double z, float yaw, float pitch) {
@ -57,19 +48,19 @@ index 9d08d0610be1741b4cd18a1454e538f46928fd94..f1383906dbd16e088f57c9c77c051c85
this.setYRot(yaw); this.setYRot(yaw);
this.setXRot(pitch); this.setXRot(pitch);
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
index a28e6b6a50cfd9191732ad2e4aca5f639a1fae75..244e328c6f67cfa543ee283715bb3b89dbaa0f0c 100644 index 2db75673e525708d04bda9f6c9af80e7f8d361e6..be2b5f56f6f29c82c4fa9df33287d0ddb589f383 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
@@ -78,6 +78,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { @@ -79,6 +79,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
} }
DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, vec34.normalize()); DragonFireball dragonFireball = new DragonFireball(world, this.dragon, vec34.normalize());
+ dragonFireball.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported + dragonFireball.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported
dragonFireball.moveTo(o, p, q, 0.0F, 0.0F); dragonFireball.moveTo(o, p, q, 0.0F, 0.0F);
if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events
this.dragon.level().addFreshEntity(dragonFireball); world.addFreshEntity(dragonFireball);
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index b90127f9f805fdb5bb43a4b8ad2b10499b0b6b78..8efc06d29c62fa2be8515ed3359d52a6d4b807d2 100644 index 56dbe701a93eb9f1309bec92e5d3b310860a4dc5..1b6ec72f59504d2f420d6d5dcbed4d3b9115e3d8 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -164,6 +164,7 @@ public abstract class BaseSpawner { @@ -164,6 +164,7 @@ public abstract class BaseSpawner {
@ -81,10 +72,10 @@ index b90127f9f805fdb5bb43a4b8ad2b10499b0b6b78..8efc06d29c62fa2be8515ed3359d52a6
if (entity instanceof Mob) { if (entity instanceof Mob) {
Mob entityinsentient = (Mob) entity; Mob entityinsentient = (Mob) entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 34321f095e12ea0cca34ff1ec00819c6350205a8..5f5788a502642463091fb76e98703aaec7a86836 100644 index b001284e368f64871824c1f961999bb3f726de57..abecb0235eee3e62a84f15f2ef100efcf3fcbf2a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -240,7 +240,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -241,7 +241,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
} }
// entity.setLocation() throws no event, and so cannot be cancelled // entity.setLocation() throws no event, and so cannot be cancelled
@ -94,10 +85,10 @@ index 34321f095e12ea0cca34ff1ec00819c6350205a8..5f5788a502642463091fb76e98703aae
this.entity.setYHeadRot(location.getYaw()); this.entity.setYHeadRot(location.getYaw());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index fad7d8130f6db70c7bfca9d02027d8a41f5309c1..8a8189e8f2f201880748eb79805bb0b33688e814 100644 index 5beee554567d36f2a3b871cf6ec3ecb3d2353592..db15382f35464de43a2fe0a41aca070a8c834777 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -596,6 +596,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -603,6 +603,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} }
((AbstractHurtingProjectile) launch).projectileSource = this; ((AbstractHurtingProjectile) launch).projectileSource = this;

View file

@ -1,55 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JRoy <joshroy126@gmail.com>
Date: Fri, 5 Jun 2020 18:24:06 -0400
Subject: [PATCH] Add PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 3455781a47fbececab33406e829ceb392c72a113..b4af560246c1fe102bae9ec9383cbef385bb1887 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3056,16 +3056,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!this.player.containerMenu.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else {
+ // Paper start - Add PlayerRecipeBookClickEvent
+ ResourceLocation recipeName = packet.getRecipe();
+ boolean makeAll = packet.isShiftDown();
+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent paperEvent = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent(
+ this.player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(recipeName), makeAll
+ );
+ if (!paperEvent.callEvent()) {
+ return;
+ }
+ recipeName = CraftNamespacedKey.toMinecraft(paperEvent.getRecipe());
+ makeAll = paperEvent.isMakeAll();
+ if (org.bukkit.event.player.PlayerRecipeBookClickEvent.getHandlerList().getRegisteredListeners().length > 0) {
+ // Paper end - Add PlayerRecipeBookClickEvent
// CraftBukkit start - implement PlayerRecipeBookClickEvent
- org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(packet.getRecipe()));
+ org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(recipeName)); // Paper
if (recipe == null) {
return;
}
- org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, packet.isShiftDown());
+ // Paper start - Add PlayerRecipeBookClickEvent
+ org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, makeAll);
+ recipeName = CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey());
+ makeAll = event.isShiftClick();
+ }
+ if (!(this.player.containerMenu instanceof RecipeBookMenu<?, ?> recipeBookMenu)) {
+ return;
+ }
+ // Paper end - Add PlayerRecipeBookClickEvent
// Cast to keyed should be safe as the recipe will never be a MerchantRecipe.
- this.server.getRecipeManager().byKey(CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).ifPresent((recipeholder) -> {
- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(event.isShiftClick(), recipeholder, this.player);
+ // Paper start - Add PlayerRecipeBookClickEvent
+ final boolean finalMakeAll = makeAll;
+ this.server.getRecipeManager().byKey(recipeName).ifPresent((recipeholder) -> {
+ recipeBookMenu.handlePlacement(finalMakeAll, recipeholder, this.player);
+ // Paper end - Add PlayerRecipeBookClickEvent
});
// CraftBukkit end
}

View file

@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Tue, 23 Jul 2019 20:44:47 -0500
Subject: [PATCH] Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril.
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 0dd6f1bce4913cb84ba21a20df5573bab3a64645..5e1a68e3a920aab10a459b9b54f6abd59e7855e0 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -86,6 +86,10 @@ public class ChunkSerializer {
public static final String BLOCK_LIGHT_TAG = "BlockLight";
public static final String SKY_LIGHT_TAG = "SkyLight";
+ // Paper start - Do not let the server load chunks from newer versions
+ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion();
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
+ // Paper end - Do not let the server load chunks from newer versions
public ChunkSerializer() {}
// Paper start - guard against serializing mismatching coordinates
@@ -102,6 +106,15 @@ public class ChunkSerializer {
// Paper end - guard against serializing mismatching coordinates
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, RegionStorageInfo key, ChunkPos chunkPos, CompoundTag nbt) {
+ // Paper start - Do not let the server load chunks from newer versions
+ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ final int dataVersion = nbt.getInt("DataVersion");
+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) {
+ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace();
+ System.exit(1);
+ }
+ }
+ // Paper end - Do not let the server load chunks from newer versions
ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate
if (!Objects.equals(chunkPos, chunkcoordintpair1)) {