diff --git a/patches/unapplied/server/Adventure.patch b/patches/server/Adventure.patch similarity index 98% rename from patches/unapplied/server/Adventure.patch rename to patches/server/Adventure.patch index 3a9fb05a87..cf4a829851 100644 --- a/patches/unapplied/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -1631,8 +1631,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -0,0 +0,0 @@ public class CommandSourceStack implements SharedSuggestionProvider { - private final CommandSigningContext signingContext; private final TaskChainer chatMessageChainer; + private final IntConsumer returnValueConsumer; public volatile CommandNode currentCommand; // CraftBukkit + public boolean bypassSelectorPermissions = false; // Paper @@ -2302,7 +2302,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (deathMessage != null && deathMessage != net.kyori.adventure.text.Component.empty() && flag) { // Paper - Adventure // TODO: allow plugins to override? + Component ichatbasecomponent = PaperAdventure.asVanilla(deathMessage); // Paper - Adventure - this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> { + this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> { boolean flag1 = true; @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { @@ -2491,44 +2491,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { this.chat(s, message, true); } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - return; - } - -- // CraftBukkit start -+ // CraftBukkit start // Paper start - Adventure - Player player = this.player.getBukkitEntity(); - int x = packet.getPos().getX(); - int y = packet.getPos().getY(); - int z = packet.getPos().getZ(); -- String[] lines = new String[4]; -+ List lines = new java.util.ArrayList<>(); - - for (int i = 0; i < signText.size(); ++i) { - FilteredText filteredtext = (FilteredText) signText.get(i); - - if (this.player.isTextFilteringEnabled()) { -- lines[i] = ChatFormatting.stripFormatting(filteredtext.filteredOrEmpty()); -+ lines.add(net.kyori.adventure.text.Component.text(filteredtext.filteredOrEmpty())); // Paper - adventure - } else { -- lines[i] = ChatFormatting.stripFormatting(filteredtext.raw()); -+ lines.add(net.kyori.adventure.text.Component.text(filteredtext.raw())); // Paper - adventure - } - } - SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines); - this.cserver.getPluginManager().callEvent(event); - - if (!event.isCancelled()) { -- Component[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines()); -- for (int i = 0; i < components.length; i++) { -- tileentitysign.setMessage(i, components[i]); -+ for (int i = 0; i < 4; i++) { -+ tileentitysign.setMessage(i, PaperAdventure.asVanilla(event.line(i))); - } -+ // Paper end - tileentitysign.isEditable = false; - } - // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -2616,15 +2578,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end -@@ -0,0 +0,0 @@ public abstract class PlayerList { - - } - -- public String remove(ServerPlayer entityplayer) { // CraftBukkit - return string -+ public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // Paper - return Component - ServerLevel worldserver = entityplayer.getLevel(); - - entityplayer.awardStat(Stats.LEAVE_GAME); @@ -0,0 +0,0 @@ public abstract class PlayerList { entityplayer.closeContainer(); } @@ -2830,6 +2783,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.createWorldFog; } +diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C + this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3); + } else { + SignBlockEntity.LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString()); ++ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper + ((ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit + } + } diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java @@ -3217,7 +3182,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockEntityState< - this.front = new CraftSignSide(this.getSnapshot()); + this.back = new CraftSignSide(this.getSnapshot().getBackText()); } + // Paper start @@ -3241,7 +3206,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public String[] getLines() { return this.front.getLines(); @@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockEntityState< - ((CraftPlayer) player).getHandle().openTextEdit(handle); + ((CraftPlayer) player).getHandle().openTextEdit(handle, true); } + // Paper start @@ -3275,9 +3240,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private java.util.ArrayList originalLines = null; // ArrayList for RandomAccess + private java.util.ArrayList lines = null; // ArrayList for RandomAccess + // Paper end - private final SignBlockEntity signText; + private final SignText signText; - public CraftSignSide(SignBlockEntity signText) { + public CraftSignSide(SignText signText) { this.signText = signText; } @@ -3305,7 +3270,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return; + } + // Lazy initialization: -+ this.lines = io.papermc.paper.adventure.PaperAdventure.asAdventure(com.google.common.collect.Lists.newArrayList(this.signText.messages)); ++ this.lines = io.papermc.paper.adventure.PaperAdventure.asAdventure(com.google.common.collect.Lists.newArrayList(this.signText.getMessages(false))); + this.originalLines = new java.util.ArrayList<>(this.lines); + } + // Paper end @@ -3315,8 +3280,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public String[] getLines() { - if (this.lines == null) { - // Lazy initialization: -- this.lines = new String[signText.messages.length]; -- System.arraycopy(CraftSign.revertComponents(signText.messages), 0, lines, 0, lines.length); +- Component[] messages = this.signText.getMessages(false); +- this.lines = new String[messages.length]; +- System.arraycopy(CraftSign.revertComponents(messages), 0, lines, 0, lines.length); - this.originalLines = new String[lines.length]; - System.arraycopy(lines, 0, originalLines, 0, originalLines.length); - } @@ -3775,10 +3741,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + private void sendSignChange0(Component[] components, Location loc, DyeColor dyeColor, boolean hasGlowingText) { SignBlockEntity sign = new SignBlockEntity(CraftLocation.toBlockPosition(loc), Blocks.OAK_SIGN.defaultBlockState()); - sign.setColor(net.minecraft.world.item.DyeColor.byId(dyeColor.getWoolData())); - sign.setHasGlowingText(hasGlowingText); + SignText text = sign.getFrontText(); + text.setColor(net.minecraft.world.item.DyeColor.byId(dyeColor.getWoolData())); @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - sign.setMessage(i, components[i]); + text.setMessage(i, components[i]); } - this.getHandle().connection.send(sign.getUpdatePacket()); diff --git a/patches/unapplied/server/Paper-Metrics.patch b/patches/server/Paper-Metrics.patch similarity index 100% rename from patches/unapplied/server/Paper-Metrics.patch rename to patches/server/Paper-Metrics.patch diff --git a/patches/unapplied/server/Paper-Plugins.patch b/patches/server/Paper-Plugins.patch similarity index 99% rename from patches/unapplied/server/Paper-Plugins.patch rename to patches/server/Paper-Plugins.patch index f460040272..d88d66a8d3 100644 --- a/patches/unapplied/server/Paper-Plugins.patch +++ b/patches/server/Paper-Plugins.patch @@ -6950,18 +6950,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java @@ -0,0 +0,0 @@ public class Bootstrap { - EntitySelectorOptions.bootStrap(); DispenseItemBehavior.bootStrap(); CauldronInteraction.bootStrap(); -- BuiltInRegistries.bootStrap(); + BuiltInRegistries.bootStrap(); + // Paper start + BuiltInRegistries.bootStrap(() -> { + io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping + }); + // Paper end + CreativeModeTabs.validate(); Bootstrap.wrapStreams(); - } - // CraftBukkit start - easier than fixing the decompile + Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis()); diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Main.java diff --git a/patches/unapplied/server/Paper-command.patch b/patches/server/Paper-command.patch similarity index 100% rename from patches/unapplied/server/Paper-command.patch rename to patches/server/Paper-command.patch diff --git a/patches/unapplied/server/Timings-v2.patch b/patches/server/Timings-v2.patch similarity index 98% rename from patches/unapplied/server/Timings-v2.patch rename to patches/server/Timings-v2.patch index e6fb378632..1b8326017e 100644 --- a/patches/unapplied/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -871,7 +871,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.tickCount % 20 == 0) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) { @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + try (Timing ignored = level.timings.chunkPostLoad.startTimingIfSync()) { // Paper @@ -1208,7 +1208,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timings.chunkTicksBlocks.startTiming(); // Paper if (randomTickSpeed > 0) { LevelChunkSection[] achunksection = chunk.getSections(); - int j1 = achunksection.length; + @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { } } @@ -1369,13 +1369,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - this.level.getProfiler().pop(); + this.level().getProfiler().pop(); } } - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) { + private boolean isStateClimbable(BlockState state) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java @@ -1461,35 +1461,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { this.setDeltaMovement(d4, d5, d6); - this.level.getProfiler().push("ai"); + this.level().getProfiler().push("ai"); - SpigotTimings.timerEntityAI.startTiming(); // Spigot if (this.isImmobile()) { this.jumping = false; this.xxa = 0.0F; @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { this.serverAiStep(); - this.level.getProfiler().pop(); + this.level().getProfiler().pop(); } - SpigotTimings.timerEntityAI.stopTiming(); // Spigot - this.level.getProfiler().pop(); - this.level.getProfiler().push("jump"); + this.level().getProfiler().pop(); + this.level().getProfiler().push("jump"); @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - LivingEntity entityliving = this.getControllingPassenger(); - Vec3 vec3d1 = new Vec3((double) this.xxa, (double) this.yya, (double) this.zza); + this.resetFallDistance(); + } - SpigotTimings.timerEntityAIMove.startTiming(); // Spigot -+ //SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper - if (entityliving != null && this.isAlive()) { - this.travelRidden(entityliving, vec3d1); - } else { + label104: + { + LivingEntity entityliving = this.getControllingPassenger(); +@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.travel(vec3d1); } - SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot -+ //SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper - this.level.getProfiler().pop(); - this.level.getProfiler().push("freezing"); + this.level().getProfiler().pop(); + this.level().getProfiler().push("freezing"); @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); } @@ -1497,8 +1497,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - SpigotTimings.timerEntityAICollision.startTiming(); // Spigot this.pushEntities(); - SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot - this.level.getProfiler().pop(); - if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { + this.level().getProfiler().pop(); + if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { this.hurt(this.damageSources().drown(), 1.0F); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644