This commit is contained in:
Jake Potrebic 2024-04-23 23:44:48 -07:00
parent 9079c90d22
commit cc4614854a
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
58 changed files with 232 additions and 255 deletions

View file

@ -34,7 +34,7 @@ index ce89f04b74e579dedae05cfdf681827a92626f9a..e008b0b1b04dd8da118be6ee0bdd05c1
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f29cd4d7c528404ea8e77e82a5ae17a9d9d19ed5..7d4b2c499dfe449e6f7116ae140535450b95e6d1 100644
index f29cd4d7c528404ea8e77e82a5ae17a9d9d19ed5..24790ded773c8d041e7f43c9b8f8f8fe9fff3d74 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -223,6 +223,11 @@ public abstract class PlayerList {
@ -42,7 +42,7 @@ index f29cd4d7c528404ea8e77e82a5ae17a9d9d19ed5..7d4b2c499dfe449e6f7116ae14053545
}
+ // Paper start - Entity#getEntitySpawnReason
+ if (nbttagcompound == null) {
+ if (optional.isEmpty()) {
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ }
+ // Paper end - Entity#getEntitySpawnReason

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 7d4b2c499dfe449e6f7116ae140535450b95e6d1..03051e2252d7b871adc06dbbe48d2a90854c7adf 100644
index 24790ded773c8d041e7f43c9b8f8f8fe9fff3d74..403a07e5db1ccb252a396cdb7eee5b42305cf7cc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -751,9 +751,14 @@ public abstract class PlayerList {

View file

@ -35,12 +35,12 @@ index 74e8aef45702eef0dcabc7841a7c7125cc066cbe..618efe10752c968142fcc0f28a533d35
this.gameMode.setLevel((ServerLevel) world);
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 03051e2252d7b871adc06dbbe48d2a90854c7adf..86d518f7c7b638802c08c896d758541ac6ab6176 100644
index 403a07e5db1ccb252a396cdb7eee5b42305cf7cc..7ba8d31fe114f16c2fe558787bc3d033803f2cde 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -226,6 +226,7 @@ public abstract class PlayerList {
// Paper start - Entity#getEntitySpawnReason
if (nbttagcompound == null) {
if (optional.isEmpty()) {
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
}

View file

@ -55,7 +55,7 @@ index 62bdc3016120271da2ca3a1f6ac46757e2e1dab4..e3f73ccbc2d62eef386adc6c66428c60
// CraftBukkit end
public boolean isRealPlayer; // Paper
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 86d518f7c7b638802c08c896d758541ac6ab6176..e2e1ed794e4601b93cffb4ff7cc7a538f2d56cc9 100644
index 7ba8d31fe114f16c2fe558787bc3d033803f2cde..06926750f21fa9234bcc60b1e932a29a36831bdc 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -297,6 +297,12 @@ public abstract class PlayerList {

View file

@ -10,31 +10,31 @@ Co-authored-by: Wyatt Childers <wchilders@nearce.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c5614cc12789fdfad3519434e115a50c12844b3b..d0e158235915e4efc8bda99d552d029cd8680035 100644
index 06926750f21fa9234bcc60b1e932a29a36831bdc..48f3e51d8904a51f146e9b8c8fe195ef012fecd8 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -195,7 +195,7 @@ public abstract class PlayerList {
@@ -197,6 +197,7 @@ public abstract class PlayerList {
}
CompoundTag nbttagcompound = this.load(player);
- ResourceKey resourcekey;
Optional<CompoundTag> optional = this.load(player); // CraftBukkit - decompile error
+ ResourceKey<Level> resourcekey = null; // Paper
// CraftBukkit start - Better rename detection
if (nbttagcompound != null && nbttagcompound.contains("bukkit")) {
CompoundTag bukkit = nbttagcompound.getCompound("bukkit");
@@ -203,15 +203,42 @@ public abstract class PlayerList {
if (optional.isPresent()) {
CompoundTag nbttagcompound = optional.get();
@@ -206,19 +207,47 @@ public abstract class PlayerList {
}
}
// CraftBukkit end
- ResourceKey<Level> resourcekey = (ResourceKey) optional.flatMap((nbttagcompound) -> {
+ // Paper start - move logic in Entity to here, to use bukkit supplied world UUID & reset to main world spawn if no valid world is found
+ boolean invalidPlayerWorld = false;
+ bukkitData: if (nbttagcompound != null) {
+ boolean[] invalidPlayerWorld = {false};
+ bukkitData: if (optional.isPresent()) {
+ // The main way for bukkit worlds to store the world is the world UUID despite mojang adding custom worlds
+ final org.bukkit.World bWorld;
+ if (nbttagcompound.contains("WorldUUIDMost") && nbttagcompound.contains("WorldUUIDLeast")) {
+ bWorld = org.bukkit.Bukkit.getServer().getWorld(new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast")));
+ } else if (nbttagcompound.contains("world", net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - legacy bukkit world name
+ bWorld = org.bukkit.Bukkit.getServer().getWorld(nbttagcompound.getString("world"));
+ if (optional.get().contains("WorldUUIDMost") && optional.get().contains("WorldUUIDLeast")) {
+ bWorld = org.bukkit.Bukkit.getServer().getWorld(new UUID(optional.get().getLong("WorldUUIDMost"), optional.get().getLong("WorldUUIDLeast")));
+ } else if (optional.get().contains("world", net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - legacy bukkit world name
+ bWorld = org.bukkit.Bukkit.getServer().getWorld(optional.get().getString("world"));
+ } else {
+ break bukkitData; // if neither of the bukkit data points exist, proceed to the vanilla migration section
+ }
@ -42,55 +42,52 @@ index c5614cc12789fdfad3519434e115a50c12844b3b..d0e158235915e4efc8bda99d552d029c
+ resourcekey = ((CraftWorld) bWorld).getHandle().dimension();
+ } else {
+ resourcekey = Level.OVERWORLD;
+ invalidPlayerWorld = true;
+ invalidPlayerWorld[0] = true;
+ }
+ }
+ if (resourcekey == null) { // only run the vanilla logic if we haven't found a world from the bukkit data
+ // Below is the vanilla way of getting the dimension, this is for migration from vanilla servers
+ // Paper end
if (nbttagcompound != null) {
+ resourcekey = optional.flatMap((nbttagcompound) -> {
+ // Paper end
DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error
Logger logger = PlayerList.LOGGER;
Objects.requireNonNull(logger);
- resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(player.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
- return dataresult.resultOrPartial(logger::error);
- }).orElse(player.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
+ // Paper start - reset to main world spawn if no valid world is found
+ final Optional<ResourceKey<Level>> result = dataresult.resultOrPartial(logger::error);
+ invalidPlayerWorld = result.isEmpty();
+ resourcekey = result.orElse(Level.OVERWORLD);
+ // Paper end
} else {
- resourcekey = player.serverLevel().dimension(); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
+ resourcekey = Level.OVERWORLD; // Paper - revert to vanilla default main world, this isn't an "invalid world" since no player data existed
}
+ } // Paper
+ invalidPlayerWorld[0] = result.isEmpty();
+ return result;
+ }).orElse(Level.OVERWORLD); // Paper - revert to vanilla default main world, this isn't an "invalid world" since no player data existed
+ }
+ // Paper end
ServerLevel worldserver = this.server.getLevel(resourcekey);
ServerLevel worldserver1;
ResourceKey<Level> resourcekey1 = resourcekey;
ServerLevel worldserver = this.server.getLevel(resourcekey1);
@@ -220,6 +247,7 @@ public abstract class PlayerList {
if (worldserver == null) {
PlayerList.LOGGER.warn("Unknown respawn dimension {}, defaulting to overworld", resourcekey1);
PlayerList.LOGGER.warn("Unknown respawn dimension {}, defaulting to overworld", resourcekey);
worldserver1 = this.server.overworld();
+ invalidPlayerWorld = true; // Paper - reset to main world if no world with parsed value is found
+ invalidPlayerWorld[0] = true; // Paper - reset to main world if no world with parsed value is found
} else {
worldserver1 = worldserver;
}
@@ -227,6 +255,10 @@ public abstract class PlayerList {
@@ -226,6 +255,10 @@ public abstract class PlayerList {
// Paper start - Entity#getEntitySpawnReason
if (nbttagcompound == null) {
if (optional.isEmpty()) {
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ // Paper start - reset to main world spawn if first spawn or invalid world
+ }
+ if (nbttagcompound == null || invalidPlayerWorld) {
+ if (optional.isEmpty() || invalidPlayerWorld[0]) {
+ // Paper end - reset to main world spawn if first spawn or invalid world
player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
}
// Paper end - Entity#getEntitySpawnReason
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 537461e60366580bd18e3814113ef1f8b7009b39..5863d7118d9935735400cff4a09dd8546f67bac5 100644
index f1b8e3f06db9bef44319c6d53574b1e7188c5931..04bd6d6bc6af0e423f56329dc3554b04170932f9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2289,27 +2289,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2317,27 +2317,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
// CraftBukkit end

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e8410acb2f4be966177a0ec62fc93b8fe2cc0af3..1e5ffd48251c0727e662da4d9a59bc8c23eb95ff 100644
index bca65fe3b38da83ce5f8fe67867b7cf19d02adbb..10e337fc1fb23d9eaab54f92021a7d95a14468f8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2211,7 +2211,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2258,7 +2258,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {

View file

@ -5,12 +5,12 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
index da9cd2da60186b94f3b8a259c13b20f20e50fccb..65b2873ca8032a64a4968b7587637644df1aeca5 100644
index 886b8d2284e3ae85184c842b24869029b9ee4ebe..ceaa2a7048afc4955d3695af5291e83a79d83c5d 100644
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
@@ -108,6 +108,7 @@ public class FireBlock extends BaseFireBlock {
@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
// CraftBukkit start
+ if (!(world instanceof ServerLevel)) return this.canSurvive(state, world, pos) ? (BlockState) this.getStateWithAge(world, pos, (Integer) state.getValue(FireBlock.AGE)) : Blocks.AIR.defaultBlockState(); // Paper - don't fire events in world generation
if (!this.canSurvive(state, world, pos)) {

View file

@ -17,10 +17,10 @@ index 3207166061bf9c4d7bf3f38e5a9f7aff23ccd5c1..ee4495b67c46cf1282cdd6ad15b224b0
private EntitySelector() {}
// Paper start - Affects Spawning API
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 658393f451e46a93c5665fe3c580aa395ace68d1..ea980c2fdf01988ba25bffc7f8963d775101bee1 100644
index 4292a0fbab588a8cd58db36bc279f2991231aeec..ac119e2efff7ba3c32425783ffcf4b3c44156f27 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -568,6 +568,7 @@ public class Phantom extends FlyingMob implements Enemy {
@@ -549,6 +549,7 @@ public class Phantom extends FlyingMob implements Enemy {
Player entityhuman = (Player) iterator.next();
if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) {
@ -29,10 +29,10 @@ index 658393f451e46a93c5665fe3c580aa395ace68d1..ea980c2fdf01988ba25bffc7f8963d77
return true;
}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
index 5d84bd022714f9726131d2e37d648c444052af9b..76982e0dbab0ecb6f7d4cd8a748af940492a31e7 100644
index bb7f2d3ff7fc6f5cadb4ab24efb5a3a2f5bdc33f..f74d41e57570a40cd5ce4da3076f3210b6594a63 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -49,7 +49,7 @@ public class PhantomSpawner implements CustomSpawner {
@@ -48,7 +48,7 @@ public class PhantomSpawner implements CustomSpawner {
while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next();

View file

@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the
same item twice because the source was destroyed.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b214674e10 100644
index 04bd6d6bc6af0e423f56329dc3554b04170932f9..af49ff55865b327c167efedcb7413c270824efe3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2419,11 +2419,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2447,11 +2447,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} else {
// CraftBukkit start - Capture drops for death event
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
@ -34,7 +34,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2
entityitem.setDefaultPickUpDelay();
// CraftBukkit start
@@ -3222,6 +3223,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3238,6 +3239,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Nullable
public Entity teleportTo(ServerLevel worldserver, Vec3 location) {
// CraftBukkit end
@ -47,7 +47,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2
if (this.level() instanceof ServerLevel && !this.isRemoved()) {
this.level().getProfiler().push("changeDimension");
// CraftBukkit start
@@ -3248,6 +3255,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3264,6 +3271,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit end
this.level().getProfiler().popPush("reloading");
@ -59,7 +59,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2
Entity entity = this.getType().create(worldserver);
if (entity != null) {
@@ -3265,10 +3277,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3281,10 +3293,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit start - Forward the CraftEntity to the new entity
this.getBukkitEntity().setHandle(entity);
entity.bukkitEntity = this.getBukkitEntity();
@ -70,7 +70,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2
// CraftBukkit end
}
@@ -3387,7 +3395,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -3405,7 +3413,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean canChangeDimensions() {
@ -80,10 +80,10 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 1e5ffd48251c0727e662da4d9a59bc8c23eb95ff..685c0028032b60c025f825c55e975b08c97d86f2 100644
index 10e337fc1fb23d9eaab54f92021a7d95a14468f8..8daaadbc524ee8d7c4a4ddd1d2a822f3b697abd0 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1714,9 +1714,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1734,9 +1734,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
// Paper start
org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource);
if (deathEvent == null || !deathEvent.isCancelled()) {
@ -96,7 +96,7 @@ index 1e5ffd48251c0727e662da4d9a59bc8c23eb95ff..685c0028032b60c025f825c55e975b08
// Paper start - clear equipment if event is not cancelled
if (this instanceof Mob) {
for (EquipmentSlot slot : this.clearedEquipmentSlots) {
@@ -1817,8 +1817,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1837,8 +1837,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.dropCustomDeathLoot(source, i, flag);
this.clearEquipmentSlots = prev; // Paper
}
@ -113,10 +113,10 @@ index 1e5ffd48251c0727e662da4d9a59bc8c23eb95ff..685c0028032b60c025f825c55e975b08
this.drops = new ArrayList<>();
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 11555d1b771f93234098a3bc6a6eaacddeeeb4f6..bc1a95f466b700bb0530cf0bb61fcbcbe21f5bbb 100644
index cb3729509e50fed64b17f16797825c1d21f7bf5b..bf717b5bcd14291a99414eae5366c0b91ce68a68 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -625,7 +625,7 @@ public class ArmorStand extends LivingEntity {
@@ -628,7 +628,7 @@ public class ArmorStand extends LivingEntity {
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@ -125,7 +125,7 @@ index 11555d1b771f93234098a3bc6a6eaacddeeeb4f6..bc1a95f466b700bb0530cf0bb61fcbcb
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -633,7 +633,7 @@ public class ArmorStand extends LivingEntity {
@@ -636,7 +636,7 @@ public class ArmorStand extends LivingEntity {
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@ -135,10 +135,10 @@ index 11555d1b771f93234098a3bc6a6eaacddeeeb4f6..bc1a95f466b700bb0530cf0bb61fcbcb
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 15c9150b7e48781268babe5915dc0e906645b341..8866f1d4f19c935edb7eb3c9265a2b65383e5595 100644
index fae07957147ee22a91d5da925e834a0495021958..f39bfda4487114f5a0a720e328321485839dd790 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -895,6 +895,11 @@ public class CraftEventFactory {
@@ -894,6 +894,11 @@ public class CraftEventFactory {
}
public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, List<org.bukkit.inventory.ItemStack> drops) {
@ -150,7 +150,7 @@ index 15c9150b7e48781268babe5915dc0e906645b341..8866f1d4f19c935edb7eb3c9265a2b65
CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward());
populateFields(victim, event); // Paper - make cancellable
@@ -908,11 +913,13 @@ public class CraftEventFactory {
@@ -907,11 +912,13 @@ public class CraftEventFactory {
playDeathSound(victim, event);
// Paper end
victim.expToDrop = event.getDroppedExp();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 6d540917d0d4f4787e9abc8c80fd797b2ec1656f..f1f45ceed8454fc8c144a9abe96a431799d977a0 100644
index eae6e3aeaca1b567698eaa05ed02c6c45717d7f6..6a490ba55e5af694b68bf6bf1677afc7f4f3679f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -867,7 +867,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -898,7 +898,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handlePickItem(ServerboundPickItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ae424a5cbf8868aea9e11ffd565665c50aeb780e..356f737e4b224ed7d9692dcaf2a91617058e23ed 100644
index e06b2821d29217aa6e043009cfc843da6e478a44..87414dc4b6fc759a8d2b13f32207280551a215f4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -579,6 +579,13 @@ public final class CraftServer implements Server {

View file

@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache.
Set system properly at server startup if not set already to help protect from this.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index f21bff10aa56b418b1c3c3f1a40b88c4e992c26d..44f49cc8b7800eebda426a1a04a311979e4516b9 100644
index cc4f7f5bdb6b930af4130dc775e4ed754be87783..90911cd3ba86e02baf8684099f0762fab563581c 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -26,6 +26,7 @@ public class Main {

View file

@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9
+ }
+}
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 40ff3090fb17fb0f01a9b52639fb783ea57ce6b6..d39743d9626eb01c942194387dafb1106f13601b 100644
index 3b59f3d92d781c16825f6f67b725225256425d11..2fb4660147294de9e9dec70bc3527327f2d859ee 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -341,7 +341,7 @@ public class Commands {
@@ -344,7 +344,7 @@ public class Commands {
} catch (Exception exception) {
MutableComponent ichatmutablecomponent = Component.literal(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
@ -42,10 +42,10 @@ index 40ff3090fb17fb0f01a9b52639fb783ea57ce6b6..d39743d9626eb01c942194387dafb110
StackTraceElement[] astacktraceelement = exception.getStackTrace();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 746eeb22127d8633f1eeef1bb9c20edb7fd23e5a..4bb7f7ac1e05564ea36a7b0a4e89e6f0feb9c224 100644
index a39753296a70a404b45dcb668ff42c1d88429e8e..1a8cfdd7c95460c359447dc69fadca077688c65b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -904,6 +904,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -912,6 +912,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
@ -53,7 +53,7 @@ index 746eeb22127d8633f1eeef1bb9c20edb7fd23e5a..4bb7f7ac1e05564ea36a7b0a4e89e6f0
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -918,6 +919,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -926,6 +927,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return;
this.hasStopped = true;
}
@ -61,7 +61,7 @@ index 746eeb22127d8633f1eeef1bb9c20edb7fd23e5a..4bb7f7ac1e05564ea36a7b0a4e89e6f0
// CraftBukkit end
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -1021,6 +1023,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1030,6 +1032,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
this.isRestarting = isRestarting;
@ -71,10 +71,10 @@ index 746eeb22127d8633f1eeef1bb9c20edb7fd23e5a..4bb7f7ac1e05564ea36a7b0a4e89e6f0
this.running = false;
if (waitForShutdown) {
diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
index 04a728a16bb629adbae1cd8586764a6dbc22b5dc..e2537760becdd5b3f3561f7159ed7fc2755e6260 100644
index d13c57d5aa908e4c6ec835c78e6506a98033fb6d..318d28974b9b8b04f37bb80bbb37b67eef06b7e7 100644
--- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
@@ -57,6 +57,10 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
@@ -68,6 +68,10 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
@Override
public void onDisconnect(Component reason) {
@ -85,8 +85,8 @@ index 04a728a16bb629adbae1cd8586764a6dbc22b5dc..e2537760becdd5b3f3561f7159ed7fc2
ServerConfigurationPacketListenerImpl.LOGGER.info("{} lost connection: {}", this.gameProfile, reason.getString());
super.onDisconnect(reason);
}
@@ -131,6 +135,11 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
this.connection.resumeInboundAfterProtocolChange();
@@ -155,6 +159,11 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
playerlist.placeNewPlayer(this.connection, entityplayer, this.createCookie(this.clientInformation));
} catch (Exception exception) {
ServerConfigurationPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
+ // Paper start - Debugging
@ -98,7 +98,7 @@ index 04a728a16bb629adbae1cd8586764a6dbc22b5dc..e2537760becdd5b3f3561f7159ed7fc2
this.connection.disconnect(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 356f737e4b224ed7d9692dcaf2a91617058e23ed..0a6b283aee63adb09cf1466fb18406f941466cd0 100644
index 87414dc4b6fc759a8d2b13f32207280551a215f4..89749bd7f47afe9ddcb0f38d7d7a9fbd02077e30 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1018,6 +1018,7 @@ public final class CraftServer implements Server {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index f1f45ceed8454fc8c144a9abe96a431799d977a0..2f3f3dcfc08635435408d54b9ee89fb0584896d0 100644
index 6a490ba55e5af694b68bf6bf1677afc7f4f3679f..fba8a57d96487f90ff6bc2f8090682d9dc163217 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1545,6 +1545,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1546,6 +1546,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Implement Mob Goal API
diff --git a/build.gradle.kts b/build.gradle.kts
index 2b3da4b69e89a6b98ec98820e55044fefdafc061..d16c0311142e44ec1048818221796c09ab7a90d8 100644
index a668438780c5b77d6b8bcbcc52d24bd92c59b85f..d104cf1064630698035025acbfbbf1f5e3da142a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -44,6 +44,7 @@ dependencies {
@@ -42,6 +42,7 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
@ -18,7 +18,7 @@ index 2b3da4b69e89a6b98ec98820e55044fefdafc061..d16c0311142e44ec1048818221796c09
testImplementation("org.mockito:mockito-core:5.11.0")
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..8117578ced94aa6bf01871f6526a388385c4adf2
index 0000000000000000000000000000000000000000..e9683b5a76b2dd7fc90f1d2e4538b1abbbe27ef0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
@@ -0,0 +1,376 @@
@ -768,10 +768,10 @@ index 6667ecc4b7eded4e20a415cef1e1b1179e6710b8..16f9a98b8a939e5ca7e2dc04f87134a7
LOOK,
JUMP,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0a6b283aee63adb09cf1466fb18406f941466cd0..12b76fd9d3d5e8dcca31d7e82f6956e13447ff64 100644
index 89749bd7f47afe9ddcb0f38d7d7a9fbd02077e30..3f29c1ba155ab3b145d241efb3f9274ef7a279e2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2889,5 +2889,11 @@ public final class CraftServer implements Server {
@@ -2908,5 +2908,11 @@ public final class CraftServer implements Server {
public boolean isStopping() {
return net.minecraft.server.MinecraftServer.getServer().hasStopped();
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Option for maximum exp value when merging orbs
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 8866f1d4f19c935edb7eb3c9265a2b65383e5595..608829fa99a197a58505b1e7ca9898e8d6d19aa4 100644
index f39bfda4487114f5a0a720e328321485839dd790..13147a658bc9c254538632bad12cdc4f0ba67bff 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -704,16 +704,30 @@ public class CraftEventFactory {
@@ -703,16 +703,30 @@ public class CraftEventFactory {
if (entity instanceof net.minecraft.world.entity.ExperienceOrb xp) {
double radius = world.spigotConfig.expMerge;
if (radius > 0) {

View file

@ -9,10 +9,10 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
metadata such as spawn reason, or conditionally move data from source to target.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 608829fa99a197a58505b1e7ca9898e8d6d19aa4..b38212ceb8c375c9604eac36bee6d143ffbf3837 100644
index 13147a658bc9c254538632bad12cdc4f0ba67bff..36999a5c603aef1dc1e79adb2f2f6801899bfacc 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -713,7 +713,7 @@ public class CraftEventFactory {
@@ -712,7 +712,7 @@ public class CraftEventFactory {
for (Entity e : entities) {
if (e instanceof net.minecraft.world.entity.ExperienceOrb loopItem) {
// Paper start

View file

@ -6,50 +6,50 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 29fa2231cc5d9c3ac36d508f14408d6077b6594c..d84503ab329ebeb4c74f10f9897661ee6799e3d3 100644
index 539280a0265a4746ebc9ede6667df3699dfb8125..a5026d470b8651ddf4b79fc29cbc598ac55217ff 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -484,7 +484,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -483,7 +483,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {
- this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraft(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
- this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
+ this.getHandle().addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(effect), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
return true;
}
@@ -505,7 +505,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -504,7 +504,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public PotionEffect getPotionEffect(PotionEffectType type) {
MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraft(type));
- return (handle == null) ? null : new PotionEffect(CraftPotionEffectType.minecraftToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible());
MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraftHolder(type));
- return (handle == null) ? null : new PotionEffect(CraftPotionEffectType.minecraftHolderToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible());
+ return (handle == null) ? null : org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle); // Paper
}
@Override
@@ -517,7 +517,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -516,7 +516,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Collection<PotionEffect> getActivePotionEffects() {
List<PotionEffect> effects = new ArrayList<PotionEffect>();
for (MobEffectInstance handle : this.getHandle().activeEffects.values()) {
- effects.add(new PotionEffect(CraftPotionEffectType.minecraftToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()));
- effects.add(new PotionEffect(CraftPotionEffectType.minecraftHolderToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()));
+ effects.add(org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle)); // Paper
}
return effects;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
index e29679a92da5ec05e122bb972a5ee469059a7a0a..844fb8c662a409670f631228f687d85c5436d3dd 100644
index a91fd77d3a3aec302cb4a17e358d04bdf0cff6c3..068a9b2d7b6895f14077d9647a8c9fed3e3d3ade 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
@@ -73,7 +73,7 @@ public class CraftPotionUtil {
@@ -10,7 +10,7 @@ public class CraftPotionUtil {
public static MobEffectInstance fromBukkit(PotionEffect effect) {
MobEffect type = CraftPotionEffectType.bukkitToMinecraft(effect.getType());
Holder<MobEffect> type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType());
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
}
public static PotionEffect toBukkit(MobEffectInstance effect) {
@@ -82,7 +82,7 @@ public class CraftPotionUtil {
@@ -19,7 +19,7 @@ public class CraftPotionUtil {
int duration = effect.getDuration();
boolean ambient = effect.isAmbient();
boolean particles = effect.isVisible();
@ -57,4 +57,4 @@ index e29679a92da5ec05e122bb972a5ee469059a7a0a..844fb8c662a409670f631228f687d85c
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon()); // Paper
}
public static boolean equals(MobEffect mobEffect, PotionEffectType type) {
public static boolean equals(Holder<MobEffect> mobEffect, PotionEffectType type) {

View file

@ -8,7 +8,7 @@ Adds a new method to fetch the location of a player's bed without generating any
getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 35f03bea2b1206b420ac46dfd77811fb485c5319..3898d583a65e82711fd4415aed32ecf08f42100f 100644
index eb2d39d408e7f46a8f047a2b0d76981f24e1320a..bbd3f0981eb95348ef12c9af8fa1712c022ed869 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag;
@ -19,7 +19,7 @@ index 35f03bea2b1206b420ac46dfd77811fb485c5319..3898d583a65e82711fd4415aed32ecf0
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.Entity;
@@ -131,6 +132,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -129,6 +130,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return this.getHandle().sleepCounter;
}

View file

@ -10,22 +10,22 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4bb7f7ac1e05564ea36a7b0a4e89e6f0feb9c224..8922598a66aa184c314595fe9c8ec62797caa052 100644
index 1a8cfdd7c95460c359447dc69fadca077688c65b..777408fe6ad04abb32885e749ec6b7c39b81ca46 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -931,6 +931,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -939,6 +939,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
+ this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown
}
// CraftBukkit end
this.getConnection().stop();
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.shutdown(); // Paper - Plugin remapping
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 12b76fd9d3d5e8dcca31d7e82f6956e13447ff64..a5c84867708385ae78951872410914835ab3e7e5 100644
index 3f29c1ba155ab3b145d241efb3f9274ef7a279e2..11c41e2a0887a59b7b3328b28628ce5958fc06d2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1028,6 +1028,31 @@ public final class CraftServer implements Server {
@@ -1029,6 +1029,31 @@ public final class CraftServer implements Server {
org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload
}

View file

@ -6,14 +6,14 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index c34a055f85820d9be653b0effbd5345aa4bca9c2..f696ae53bf1192b2ebfcd6406adfdb494ab2521c 100644
index f81d5abedec0f2fa7ae81421edda8b3dfcb7690b..9f54e46b870e78d1d360ea79604708db08276ae3 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -315,6 +315,7 @@ public abstract class Raider extends PatrollingMonster {
@@ -334,6 +334,7 @@ public abstract class Raider extends PatrollingMonster {
@Override
public boolean canUse() {
+ if (!this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
Raid raid = this.mob.getCurrentRaid();
if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance())) {
if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance(this.mob.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) {

View file

@ -7,10 +7,10 @@ Subject: [PATCH] Ensure safe gateway teleport
public net.minecraft.world.entity.Entity teleportPassengers()V
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index a57743b21b6075ba01def0a41fecbf90b2df7f85..098fde8200a11f91f934ddab6b1486dac4014dfe 100644
index f8053b42fbf144d427cc4ed44b3b735358c58a20..93bd70c1dc2ba8b893a6087730071c81fb1132f4 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -220,6 +220,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
@@ -214,6 +214,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
entity1.setPortalCooldown();
((ServerPlayer) entity1).connection.teleport(teleEvent.getTo());

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Fix villager trading demand - MC-163962
Prevent demand from going negative and tending to negative infinity
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
index a580011cd3b2b7129f2d09f37a3c26cdaafeefe8..7da5c4a45f8fd46fedd4386e0faac57445475e3a 100644
index 44808589939afe50d8294269b7da12019acd2690..89982d25f60c8b60ba91e559ef88278f338fe215 100644
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
@@ -130,7 +130,7 @@ public class MerchantOffer {
@@ -124,7 +124,7 @@ public class MerchantOffer {
}
public void updateDemand() {

View file

@ -15,18 +15,17 @@ Previously maps would load all chunks in a certain radius depending on
five ticks that movement occur in anyways.
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 5fadfa65b7db07648d88e53893e091024d120bed..e46ceae916f6396d96226db6d8e90bd29088f765 100644
index 4e6d42051de14a1a62184fbb586ea38fb31261b3..36de7c63370c529579d31ba1d77ec12b754ef313 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -126,9 +126,9 @@ public class MapItem extends ComplexItem {
int j2 = (j / i + k1 - 64) * i;
int k2 = (k / i + l1 - 64) * i;
@@ -98,8 +98,8 @@ public class MapItem extends ComplexItem {
int r = (j / i + o - 64) * i;
int s = (k / i + p - 64) * i;
Multiset<MapColor> multiset = LinkedHashMultiset.create();
- LevelChunk chunk = world.getChunk(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2));
+ LevelChunk chunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2)); // Paper - Maps shouldn't load chunks
- if (!chunk.isEmpty()) {
+ if (chunk != null && !chunk.isEmpty()) { // Paper - Maps shouldn't load chunks
int l2 = 0;
double d1 = 0.0D;
int i3;
- LevelChunk levelChunk = world.getChunk(SectionPos.blockToSectionCoord(r), SectionPos.blockToSectionCoord(s));
- if (!levelChunk.isEmpty()) {
+ LevelChunk levelChunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(r), SectionPos.blockToSectionCoord(s)); // Paper - Maps shouldn't load chunks
+ if (levelChunk != null && !levelChunk.isEmpty()) { // Paper - Maps shouldn't load chunks
int t = 0;
double e = 0.0;
if (world.dimensionType().hasCeiling()) {

View file

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 7 Jun 2020 19:25:13 -0400
Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from
carto/sunken maps
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 36de7c63370c529579d31ba1d77ec12b754ef313..ce461b1a8d7fab87ae28e30205f6fab67f1808b6 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -206,7 +206,7 @@ public class MapItem extends ComplexItem {
for (int n = 0; n < 128; n++) {
for (int o = 0; o < 128; o++) {
- Holder<Biome> holder = world.getBiome(mutableBlockPos.set((l + o) * i, 0, (m + n) * i));
+ Holder<Biome> holder = world.getUncachedNoiseBiome((l + o) * i, 0, (m + n) * i); // Paper - Perf: Use seed based lookup for treasure maps
bls[n * 128 + o] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES);
}
}

View file

@ -32,10 +32,10 @@ This patch fixes https://bugs.mojang.com/browse/MC-188840
This patch also fixes rail duping and carpet duping.
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index b3732a6246a2b011e36c5c35fa2ac7749e75db16..3ae61e7b50bfc440c597f88843f92903f8a66801 100644
index 530b6af1ca2e0ac81c0a8a55dbc7cf5c796c93ce..4aa34b7df734bb755906b228e0df9eb629569ea0 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -413,14 +413,26 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -414,14 +414,26 @@ public class PistonBaseBlock extends DirectionalBlock {
}
for (j = list.size() - 1; j >= 0; --j) {
@ -66,10 +66,10 @@ index b3732a6246a2b011e36c5c35fa2ac7749e75db16..3ae61e7b50bfc440c597f88843f92903
}
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index 541f4ffd06509aa72cf26ea108f84160eac82bc3..0e15da7cae105196d444b924b8e0db190583ba30 100644
index 8ea7d7da26e7d5644a8ee1a8d9e4c828c6b70a00..d7b963571c900f0f68005d6954bcd9ef1d9e0b7c 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -296,7 +296,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
@@ -297,7 +297,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
BlockState blockState = Block.updateFromNeighbourShapes(blockEntity.movedState, world, pos);
if (blockState.isAir()) {

View file

@ -15,7 +15,7 @@ allows the distance calculation to avoid overflow and work as intended.
This issue is being tracked in Mojira ticket MC-159283
diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
index db1d0e5cec19059d14e1a7cd41f049d23600e3fe..92c2df6a6abd9c60e90b0b84ab66987557adb9c8 100644
index 6171d57a0e5d1aecadfb2c23a72a92d897ca41ee..b09bc1dac649ce9f4826edc1923c843804226993 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
@@ -521,7 +521,7 @@ public final class DensityFunctions {

View file

@ -13,10 +13,10 @@ behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2f3f3dcfc08635435408d54b9ee89fb0584896d0..e59c54b6bc42d577b81bb1cefffa33c77dd27dbe 100644
index fba8a57d96487f90ff6bc2f8090682d9dc163217..445d9c9a2c42c49388736a0b9b683a18fa5e9353 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1366,6 +1366,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1361,6 +1361,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move

View file

@ -5,10 +5,10 @@ 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 e59c54b6bc42d577b81bb1cefffa33c77dd27dbe..e40020e8fbfb2926c61c44f0a184bfc1868bdd0f 100644
index 445d9c9a2c42c49388736a0b9b683a18fa5e9353..d90b073294df56617febb6eb3edc65bf488e7e23 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2966,16 +2966,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3051,16 +3051,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 {

View file

@ -9,15 +9,15 @@ on harddrives.
-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
index 90fe26a546eeebf90ccf7f899103346cdb3ae702..bab2471616404821671264ccefd729cab8d0bf58 100644
index 502e5386ec4306de93148266f60810ec52ae5ab2..9d10cdacb3aed2c00dc60aeb6f2cbeb48905e21f 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -144,7 +144,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@@ -145,7 +145,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
this.maxWorldSize = this.get("max-world-size", (integer) -> {
return Mth.clamp(integer, 1, 29999984);
}, 29999984);
- this.syncChunkWrites = this.get("sync-chunk-writes", true);
+ this.syncChunkWrites = this.get("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - Hide sync chunk writes behind flag
this.regionFileComression = this.get("region-file-compression", "deflate");
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
this.enableStatus = this.get("enable-status", true);
this.hideOnlinePlayers = this.get("hide-online-players", false);

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
index e8b12b27e5ec74afb940f575e5ce78e5905d55f4..c3eb4b6372eed0b7eb636f495ce494b676767b6e 100644
index cd6f34ee326228036f8c025e4e6d04e0c15ba06f..2f0d56c78584abe27ef050258827103fb60d5785 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -397,7 +397,7 @@ public class ServerPlayerGameMode {
@@ -400,7 +400,7 @@ public class ServerPlayerGameMode {
BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock();
@ -18,10 +18,10 @@ index e8b12b27e5ec74afb940f575e5ce78e5905d55f4..c3eb4b6372eed0b7eb636f495ce494b6
return false;
} 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
index e40020e8fbfb2926c61c44f0a184bfc1868bdd0f..2abd6e356eba3eef021a447d1fc03fcec36846e8 100644
index d90b073294df56617febb6eb3edc65bf488e7e23..d8f1c46530f4fe52fa12fd9f876328aef39fc3eb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -778,7 +778,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -809,7 +809,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@ -30,7 +30,7 @@ index e40020e8fbfb2926c61c44f0a184bfc1868bdd0f..2abd6e356eba3eef021a447d1fc03fce
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock commandblocklistenerabstract = null;
@@ -845,7 +845,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -876,7 +876,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@ -40,10 +40,10 @@ index e40020e8fbfb2926c61c44f0a184bfc1868bdd0f..2abd6e356eba3eef021a447d1fc03fce
} else {
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
index ac0aeb53176069d0835b6b08c8d871edae846763..c56f5173fda6b38c2dcaea196217f2f5a7d7c641 100644
index 2d0eac7a8aa94ed6c4ec024bc6024440cbeac702..e40069d937de5fd00741ae6873abeecc46b93732 100644
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
@@ -198,7 +198,7 @@ public abstract class BaseCommandBlock implements CommandSource {
@@ -203,7 +203,7 @@ public abstract class BaseCommandBlock implements CommandSource {
}
public InteractionResult usedBy(Player player) {
@ -53,11 +53,11 @@ index ac0aeb53176069d0835b6b08c8d871edae846763..c56f5173fda6b38c2dcaea196217f2f5
} else {
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
index 840226771819024de2c6e84f08f6e354e96474ba..7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5 100644
index 0530b2a6324ec3ac0b3929aab7c0fa89de8bd9b9..ec1a8c60ccac50e5131f937c4262128fd2768331 100644
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
@@ -143,7 +143,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
@@ -141,7 +141,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
BlockEntity tileentity = world.getBlockEntity(pos);
- if (tileentity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) {

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>
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 23ee63119d55b40829c03a855ae0f8b214674e10..0c6680bf15b57cf314638ab70d849e033719c0e1 100644
index af49ff55865b327c167efedcb7413c270824efe3..e6422024dd4aa472156d9751dcdeb55b5e210f53 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -652,8 +652,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -665,8 +665,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void setPos(double x, double y, double z) {
@ -20,7 +20,7 @@ index 23ee63119d55b40829c03a855ae0f8b214674e10..0c6680bf15b57cf314638ab70d849e03
}
protected AABB makeBoundingBox() {
@@ -4149,7 +4149,29 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4175,7 +4175,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
}
@ -50,7 +50,7 @@ index 23ee63119d55b40829c03a855ae0f8b214674e10..0c6680bf15b57cf314638ab70d849e03
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);
@@ -4167,6 +4189,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4193,6 +4215,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.levelCallback.onMove();
}

View file

@ -8,11 +8,11 @@ makes it so that the server keeps the last difficulty used instead
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
index 8922598a66aa184c314595fe9c8ec62797caa052..adc93e0e7a57907e824bdd8bb7b3012f28b515f4 100644
index 777408fe6ad04abb32885e749ec6b7c39b81ca46..3ec35f0aff38e6cbd969ec3442b924bc51365f4a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -825,7 +825,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper - Configurable Keep Spawn Loaded range per world
@@ -833,7 +833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldloadlistener.stop();
// CraftBukkit start
// this.updateMobSpawningFlags();
- worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
@ -20,7 +20,7 @@ index 8922598a66aa184c314595fe9c8ec62797caa052..adc93e0e7a57907e824bdd8bb7b3012f
this.forceTicks = false;
// CraftBukkit end
@@ -1768,11 +1768,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1829,11 +1829,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@ -40,7 +40,7 @@ index 8922598a66aa184c314595fe9c8ec62797caa052..adc93e0e7a57907e824bdd8bb7b3012f
}
}
@@ -1786,7 +1789,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1847,7 +1850,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@ -63,10 +63,10 @@ index 997a96a21440ae72696d68f8031ece4ba487d3ef..3d8584929cee000ae7df10c5bd94f358
return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
}, true);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index c41c53ee3b1a8b5c2c41fc9846f557eeb4d10f9b..ebea8a827aad108dd6d4222e8dfd251d2cea657a 100644
index 3d33504eac6af17c8833de11226968d52f96232f..4d7c2832a9cd9a88b99c837a02df7fa91e572658 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -325,7 +325,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -346,7 +346,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public void forceDifficulty() {
@ -76,10 +76,10 @@ index c41c53ee3b1a8b5c2c41fc9846f557eeb4d10f9b..ebea8a827aad108dd6d4222e8dfd251d
@Override
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b64b20312396638b8fd596bca3794863601d2bb4..8729fb23a7d7700fbccba03d07382091134c6549 100644
index e3f73ccbc2d62eef386adc6c66428c6081a68b8b..0019e5313523521b4f1607dfc391d47c55961a48 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1161,7 +1161,7 @@ public class ServerPlayer extends Player {
@@ -1228,7 +1228,7 @@ public class ServerPlayer extends Player {
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(worldserver), (byte) 3));
@ -89,10 +89,10 @@ index b64b20312396638b8fd596bca3794863601d2bb4..8729fb23a7d7700fbccba03d07382091
playerlist.sendPlayerPermissionLevel(this);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2abd6e356eba3eef021a447d1fc03fcec36846e8..782ac9d9284bce9b91e03488756b31a255655edc 100644
index d8f1c46530f4fe52fa12fd9f876328aef39fc3eb..daa07712fe5e85612c30fc9b60f89fcf244a36bc 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3169,7 +3169,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3254,7 +3254,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {
@ -102,7 +102,7 @@ index 2abd6e356eba3eef021a447d1fc03fcec36846e8..782ac9d9284bce9b91e03488756b31a2
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a5c84867708385ae78951872410914835ab3e7e5..edbf53c69bf788c2ac3b7d1be258e37cb801a5f6 100644
index 11c41e2a0887a59b7b3328b28628ce5958fc06d2..946ad5418950daf13e449233eac94c1311f3d926 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -967,8 +967,8 @@ public final class CraftServer implements Server {
@ -117,10 +117,10 @@ index a5c84867708385ae78951872410914835ab3e7e5..edbf53c69bf788c2ac3b7d1be258e37c
for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index b39721208f8b66c1478e89553a592070cf90fb97..e4f7cc59ea5a3c703ada8ad3d096a7bf09950ed7 100644
index 2bea9911fe29244d9028e29b60d986f8db0e14b3..d5a9409ee45b6b0e0ec8380db041c1334aad994f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1154,7 +1154,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1163,7 +1163,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setDifficulty(Difficulty difficulty) {

View file

@ -7,10 +7,10 @@ Don't constantly send format: false for all formatting options when parent alrea
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
index 516b3fef4d388366df09f0dd88deadbcc0b7d344..753200057e74b8e2d5274894b982e6ee946a559e 100644
index f07234e19dc9f84ff4f4b5e5e811e2813184978b..ab539b8e0d70d0fbe160e031e165aca042a0693f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
@@ -46,6 +46,7 @@ public final class CraftChatMessage {
@@ -47,6 +47,7 @@ public final class CraftChatMessage {
// Separate pattern with no group 3, new lines are part of previous string
private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE);
// ChatColor.b does not explicitly reset, its more of empty
@ -18,7 +18,7 @@ index 516b3fef4d388366df09f0dd88deadbcc0b7d344..753200057e74b8e2d5274894b982e6ee
private static final Style RESET = Style.EMPTY.withBold(false).withItalic(false).withUnderlined(false).withStrikethrough(false).withObfuscated(false);
private final List<Component> list = new ArrayList<Component>();
@@ -67,6 +68,7 @@ public final class CraftChatMessage {
@@ -68,6 +69,7 @@ public final class CraftChatMessage {
Matcher matcher = (keepNewlines ? StringMessage.INCREMENTAL_PATTERN_KEEP_NEWLINES : StringMessage.INCREMENTAL_PATTERN).matcher(message);
String match = null;
boolean needsAdd = false;
@ -26,7 +26,7 @@ index 516b3fef4d388366df09f0dd88deadbcc0b7d344..753200057e74b8e2d5274894b982e6ee
while (matcher.find()) {
int groupId = 0;
while ((match = matcher.group(++groupId)) == null) {
@@ -112,7 +114,26 @@ public final class CraftChatMessage {
@@ -113,7 +115,26 @@ public final class CraftChatMessage {
throw new AssertionError("Unexpected message format");
}
} else { // Color resets formatting

View file

@ -22,7 +22,7 @@ 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.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index edbf53c69bf788c2ac3b7d1be258e37cb801a5f6..c05fd6a179e8d142b3f5a8977ae7afab8c609a4e 100644
index 946ad5418950daf13e449233eac94c1311f3d926..a22b146e2bfdeb66aca8abb5fb23ee5cd6306f4e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -379,7 +379,7 @@ public final class CraftServer implements Server {
@ -31,7 +31,7 @@ index edbf53c69bf788c2ac3b7d1be258e37cb801a5f6..c05fd6a179e8d142b3f5a8977ae7afab
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
- TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
+ TicketType.PLUGIN.timeout = Math.min(20, this.configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
this.minimumAPI = this.configuration.getString("settings.minimum-api");
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
this.loadIcon();
@@ -947,7 +947,7 @@ public final class CraftServer implements Server {
@ -40,11 +40,11 @@ index edbf53c69bf788c2ac3b7d1be258e37cb801a5f6..c05fd6a179e8d142b3f5a8977ae7afab
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
- TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
+ TicketType.PLUGIN.timeout = Math.min(20, configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
this.minimumAPI = this.configuration.getString("settings.minimum-api");
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
this.printSaveWarning = false;
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
index e4f7cc59ea5a3c703ada8ad3d096a7bf09950ed7..b437f582c36ab9a5b06129ef1b36dd14432c0c31 100644
index d5a9409ee45b6b0e0ec8380db041c1334aad994f..d4697f2f4c71001dba2cc3a69d54f27809766595 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -289,7 +289,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -93,7 +93,7 @@ index e4f7cc59ea5a3c703ada8ad3d096a7bf09950ed7..b437f582c36ab9a5b06129ef1b36dd14
return true;
}
@@ -2241,6 +2253,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2239,6 +2251,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockStateMeta#clearBlockState
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
index 0cbca0c37b3e6a34157906d44357286126cfe112..671a9b92da04c22cd3e6c3fd291a343e57397e72 100644
index 429f962fa16a6aedcd2a17d23b06de41c782417d..aef8708c38a0215241b110d4446a3c341a9912cb 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
@@ -257,6 +257,13 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
@@ -313,6 +313,13 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
return this.blockEntityTag != null;
}
@ -21,4 +21,4 @@ index 0cbca0c37b3e6a34157906d44357286126cfe112..671a9b92da04c22cd3e6c3fd291a343e
+
@Override
public BlockState getBlockState() {
Material stateMaterial = (this.material != Material.SHIELD) ? this.material : CraftMetaBlockState.shieldToBannerHack(this.blockEntityTag); // Only actually used for jigsaws
return (this.blockEntityTag != null) ? this.blockEntityTag.copy() : CraftMetaBlockState.getBlockState(this.material, null);

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Convert legacy attributes in Item Meta
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
index d4dba8c733c7560e5108b8d239b52e593f8debec..ea48f1119a940056c37d1d203437bfbfdf13663b 100644
index de40e522960469b98f987bd688489740446d9f85..a0a34f680e21007ebf2c2497d2e6505eedae6481 100644
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
@@ -9,6 +9,20 @@ import org.bukkit.attribute.AttributeInstance;
@ -30,10 +30,10 @@ index d4dba8c733c7560e5108b8d239b52e593f8debec..ea48f1119a940056c37d1d203437bfbf
public CraftAttributeMap(AttributeMap 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
index 7cf1153ae532a9d53ee85b05f77ed74b94cf5fbc..27be5da67801be6fd99c91576064e4be0b3f0d6c 100644
index 54e3059f405de2e6306cea16d045fb448bb5b099..b355663fe21510b8b15deefb28cdb0460c4d1baa 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -485,7 +485,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -607,7 +607,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
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
index 782ac9d9284bce9b91e03488756b31a255655edc..36ff9acf571d670fda225bce2f4ed16dc1d20fe3 100644
index daa07712fe5e85612c30fc9b60f89fcf244a36bc..51e97ca80f25cd1e49033cfbc41b595f3fa54d66 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3161,6 +3161,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3246,6 +3246,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View file

@ -8,10 +8,10 @@ public net.minecraft.world.entity.Entity isInRain()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
index 9ed122efb2b380bb2c1b50fdfe75bf3e679c9c6e..326978aedbd9cc81db2bf1d5398c1cd2ce68a866 100644
index 571b8352de4070622cdc47a50643beada0b16c36..40e4b8233e27b8ebd94a89bb43b5c14808edaa68 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -998,4 +998,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1008,4 +1008,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return getHandle().spawnReason;
}
// 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
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 878d3c3089635a515fa7f54c956159a1bb6ce29b..cab3e0ba471c93764b5949ad68a0f2cce4d00099 100644
index 4c766b879f935298ffa4249e9ce4045601cedb20..2bd91b48eaa06f85a5b9b1ae052c70e966ae8e4c 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -338,6 +338,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -327,6 +327,7 @@ public class AnvilMenu extends ItemCombinerMenu {
}
this.createResult();
@ -20,10 +20,10 @@ index 878d3c3089635a515fa7f54c956159a1bb6ce29b..cab3e0ba471c93764b5949ad68a0f2cc
} else {
return false;
diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
index fe1ce65b35e83ee0ada77e44b080729346bb3c2d..ca3c8b31967a6efd7b0caacb091ab2151e7c0bee 100644
index 11d7bf4f90083991cfc8c6c5f9a1e8ad6a162843..c52c4c4210bc6ae082443318d9795c48c816aba6 100644
--- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java
@@ -150,6 +150,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
@@ -152,6 +152,7 @@ public class CartographyTableMenu extends AbstractContainerMenu {
this.setupResultSlot(itemstack, itemstack1, itemstack2);
}
@ -32,7 +32,7 @@ index fe1ce65b35e83ee0ada77e44b080729346bb3c2d..ca3c8b31967a6efd7b0caacb091ab215
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
index 45242f0ed5a0f98953df5f27fb76874d2d9e3473..1783661f38a6f5fb655ea83953b9467bd91a1302 100644
index d41197db6bbf9e17b67bb1faa5d370eea0212bd3..ecf3cdc16d1ea830c4d45b57f69204118af3218a 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -159,6 +159,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
@ -44,7 +44,7 @@ index 45242f0ed5a0f98953df5f27fb76874d2d9e3473..1783661f38a6f5fb655ea83953b9467b
}
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
index 4087e381b2250be387b608d8742f6a6009a52879..eb36a69b8da492aec9609cc9ef80d7d68ff9af03 100644
index 62432c347b86fc79ab529a7dde66bef32d0424dd..be840717e180b6b5abd14db6cc9263349737f9a3 100644
--- a/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 {
@ -56,10 +56,10 @@ index 4087e381b2250be387b608d8742f6a6009a52879..eb36a69b8da492aec9609cc9ef80d7d6
}
diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
index 5c209a3d81db5326f63c506077fa0bfd241b4b12..a98157f600837898dd8ef12671c4bb713e30f30c 100644
index fb7027985c6442fc50573e96031a05a3c64f4426..4bd720a97da27c4fd97788d4c504c0174f0f6c25 100644
--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java
@@ -248,7 +248,8 @@ public class LoomMenu extends AbstractContainerMenu {
@@ -249,7 +249,8 @@ public class LoomMenu extends AbstractContainerMenu {
this.resultSlot.set(ItemStack.EMPTY);
}
@ -94,10 +94,10 @@ index 9c2fe69ced7a46bbd8b0fbe10fa67d0a39b0f375..e40d9dbdbe5359c38af6d764d01c9be4
private void setupRecipeList(Container input, ItemStack stack) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index b38212ceb8c375c9604eac36bee6d143ffbf3837..b72fba605ea2c2ea88fee90058fb2ccc30197c95 100644
index 36999a5c603aef1dc1e79adb2f2f6801899bfacc..a5253dc7fc611e599ab83c08bf4ce71afc4ee3c5 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1653,6 +1653,12 @@ public class CraftEventFactory {
@@ -1648,6 +1648,12 @@ public class CraftEventFactory {
}
public static PrepareAnvilEvent callPrepareAnvilEvent(InventoryView view, ItemStack item) {
@ -110,7 +110,7 @@ index b38212ceb8c375c9604eac36bee6d143ffbf3837..b72fba605ea2c2ea88fee90058fb2ccc
PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone());
event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
event.getInventory().setItem(2, event.getResult());
@@ -1660,6 +1666,12 @@ public class CraftEventFactory {
@@ -1655,6 +1661,12 @@ public class CraftEventFactory {
}
public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) {
@ -123,7 +123,7 @@ index b38212ceb8c375c9604eac36bee6d143ffbf3837..b72fba605ea2c2ea88fee90058fb2ccc
PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone());
event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
event.getInventory().setItem(2, event.getResult());
@@ -1667,12 +1679,39 @@ public class CraftEventFactory {
@@ -1662,12 +1674,39 @@ public class CraftEventFactory {
}
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
index 685c0028032b60c025f825c55e975b08c97d86f2..b98f82b619a1932e6d820a2c42120efdc03fc839 100644
index 8daaadbc524ee8d7c4a4ddd1d2a822f3b697abd0..914c6499eb94665f0e3c4654dd05fc10d93f87d4 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3531,7 +3531,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3618,7 +3618,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Entity entity = this.getVehicle();
super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation

View file

@ -9,10 +9,10 @@ instead of getting stuck in a never despawn state (bubble columns,
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
index f1d7f202b99b8ae4c16d10956d68d74efae8445b..913f0eb1d9081cd224b54df401ff4a0af2989f1f 100644
index 464ba41fd284e29374dbc81c984cf9486e51393e..047629405dc67e3bcb5e4b3d5afa0e821f8fde44 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -208,6 +208,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -214,6 +214,7 @@ public abstract class AbstractArrow extends Projectile {
++this.inGroundTime;
} else {

View file

@ -26,7 +26,7 @@ index d8142624f9f3a5909e7cc5665f1629a1a67dd302..b02fb15c98ab873fa78635d7a23706dd
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 0f98345f8adc6e9bf7fb2dc9ce4eba59a33ded61..907bc9d84dbc98427384cf529bfde4b09d8ce8ca 100644
index 2a22827f44dd0d524c22264447959a6979e9f0de..f3c83bb20a73b489f1fb6bacb69388902b1b6fe7 100644
--- a/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

View file

@ -10,10 +10,10 @@ This fixes that by checking if the modified spawn location is
still at a respawn anchor.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d0e158235915e4efc8bda99d552d029cd8680035..b43dd483d99a0021ccb0a2e690e19aec5f4da606 100644
index 48f3e51d8904a51f146e9b8c8fe195ef012fecd8..7af0239dbcaf46ee9f793072e832978400cdee0c 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -805,6 +805,7 @@ public abstract class PlayerList {
@@ -804,6 +804,7 @@ public abstract class PlayerList {
// Paper start - Add PlayerPostRespawnEvent
boolean isBedSpawn = false;
boolean isRespawn = false;
@ -21,7 +21,7 @@ index d0e158235915e4efc8bda99d552d029cd8680035..b43dd483d99a0021ccb0a2e690e19aec
// Paper end - Add PlayerPostRespawnEvent
// CraftBukkit start - fire PlayerRespawnEvent
@@ -815,7 +816,7 @@ public abstract class PlayerList {
@@ -814,7 +815,7 @@ public abstract class PlayerList {
Optional optional;
if (blockposition != null) {
@ -30,7 +30,7 @@ index d0e158235915e4efc8bda99d552d029cd8680035..b43dd483d99a0021ccb0a2e690e19aec
} else {
optional = Optional.empty();
}
@@ -859,7 +860,12 @@ public abstract class PlayerList {
@@ -858,7 +859,12 @@ public abstract class PlayerList {
}
// Spigot End
@ -44,7 +44,7 @@ index d0e158235915e4efc8bda99d552d029cd8680035..b43dd483d99a0021ccb0a2e690e19aec
if (!flag) entityplayer.reset(); // SPIGOT-4785
isRespawn = true; // Paper - Add PlayerPostRespawnEvent
} else {
@@ -897,8 +903,14 @@ public abstract class PlayerList {
@@ -896,8 +902,14 @@ public abstract class PlayerList {
}
// entityplayer1.initInventoryMenu();
entityplayer1.setHealth(entityplayer1.getHealth());

View file

@ -5,10 +5,10 @@ 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
index d46b7bff34b9b43e895f713d2e73071bc62de443..567ca2f09d7bf03ef1758459829a865e5b0f3edf 100644
index 993296f9c2457809bd6b844c309895f417eb42a5..7dfcb8c6583d1c13fe688b5e17edb9d1c6935547 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -164,8 +164,17 @@ public class Main {
@@ -167,8 +167,17 @@ public class Main {
return;
}

View file

@ -5,10 +5,10 @@ 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
index 567ca2f09d7bf03ef1758459829a865e5b0f3edf..4e3001d46340cc18108683c024f6ebe12266dd32 100644
index 7dfcb8c6583d1c13fe688b5e17edb9d1c6935547..ded1b7ab4ca1ae3a2d799fe31d05bd6a0c27dcb7 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -164,6 +164,7 @@ public class Main {
@@ -167,6 +167,7 @@ public class Main {
return;
}

View file

@ -52,7 +52,7 @@ index 9a387d5dc0925304d4163e3caa22206aaa68e3b7..f43053ba082f9772b6ec02828fa2d6f3
LootContext lootContext = EntityPredicate.createContext(player, player);
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
index c61789a2df774761feb79123d31eab75f9996bf2..6e0073a54f59621d8adb4e8a70e6c89c708eabba 100644
index 6e8ccafe8966970d1665be21266f2ffe95e1d3ed..f46fa0fbfec19904d21729847788c6c624a3e97f 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -63,6 +63,7 @@ public class PlayerAdvancements {

View file

@ -4,18 +4,6 @@ Date: Sun, 5 Jul 2020 22:38:18 -0400
Subject: [PATCH] Optimize NetworkManager Exception Handling
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
index 9d6dafb4855af9ccb7bc033ebf0fca5f75ceb9c6..347c4eff66ec1f3393494133ca59df2411dafa21 100644
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
@@ -590,6 +590,7 @@ public enum ConnectionProtocol {
@Nullable
public Packet<?> createPacket(int id, FriendlyByteBuf buf) {
+ if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper - Perf: Optimize exception handling
Function<FriendlyByteBuf, ? extends Packet<? super T>> function = this.idToDeserializer.get(id);
return (Packet<?>)(function != null ? function.apply(buf) : null);
}
diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
index 421dd76816063d56ea80339b77531729edd6aa55..1523d69b7b332f0085f40310a94d406da6513edc 100644
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java

View file

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 7 Jun 2020 19:25:13 -0400
Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from
carto/sunken maps
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index e46ceae916f6396d96226db6d8e90bd29088f765..f643d3c06bd8fc37f6c571a19d5691694b0ce8d3 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -242,14 +242,13 @@ public class MapItem extends ComplexItem {
boolean[] aboolean = new boolean[16384];
int l = j / i - 64;
int i1 = k / i - 64;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
int j1;
int k1;
for (j1 = 0; j1 < 128; ++j1) {
for (k1 = 0; k1 < 128; ++k1) {
- Holder<Biome> holder = world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i));
+ Holder<Biome> holder = world.getUncachedNoiseBiome((l + k1) * i, 0, (i1 + j1) * i); // Paper - Perf: Use seed based lookup for treasure maps
aboolean[j1 * 128 + k1] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES);
}