diff --git a/paper-server/nms-patches/Advancement.patch b/paper-server/nms-patches/Advancement.patch index 1930cf5666..70b171c77a 100644 --- a/paper-server/nms-patches/Advancement.patch +++ b/paper-server/nms-patches/Advancement.patch @@ -1,13 +1,13 @@ --- a/net/minecraft/server/Advancement.java +++ b/net/minecraft/server/Advancement.java @@ -27,6 +27,7 @@ - private final String[][] f; - private final Set g = Sets.newLinkedHashSet(); - private final IChatBaseComponent h; + private final String[][] requirements; + private final Set children = Sets.newLinkedHashSet(); + private final IChatBaseComponent chatComponent; + public final org.bukkit.advancement.Advancement bukkit = new org.bukkit.craftbukkit.advancement.CraftAdvancement(this); // CraftBukkit public Advancement(MinecraftKey minecraftkey, @Nullable Advancement advancement, @Nullable AdvancementDisplay advancementdisplay, AdvancementRewards advancementrewards, Map map, String[][] astring) { - this.d = minecraftkey; + this.key = minecraftkey; @@ -210,7 +211,7 @@ } diff --git a/paper-server/nms-patches/BlockCauldron.patch b/paper-server/nms-patches/BlockCauldron.patch index 23e0a28a4e..e483e549bc 100644 --- a/paper-server/nms-patches/BlockCauldron.patch +++ b/paper-server/nms-patches/BlockCauldron.patch @@ -120,14 +120,14 @@ @@ -125,13 +157,18 @@ if (i > 0 && item instanceof ItemBanner) { - if (TileEntityBanner.a(itemstack) > 0 && !world.isClientSide) { + if (TileEntityBanner.b(itemstack) > 0 && !world.isClientSide) { + // CraftBukkit start + if (!this.changeLevel(world, blockposition, iblockdata, i - 1, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) { + return EnumInteractionResult.SUCCESS; + } itemstack1 = itemstack.cloneItemStack(); itemstack1.setCount(1); - TileEntityBanner.b(itemstack1); + TileEntityBanner.c(itemstack1); entityhuman.a(StatisticList.CLEAN_BANNER); if (!entityhuman.abilities.canInstantlyBuild) { itemstack.subtract(1); diff --git a/paper-server/nms-patches/BlockComposter.patch b/paper-server/nms-patches/BlockComposter.patch index b5fc538b14..8659e34465 100644 --- a/paper-server/nms-patches/BlockComposter.patch +++ b/paper-server/nms-patches/BlockComposter.patch @@ -35,9 +35,9 @@ this.b = generatoraccess; this.c = blockposition; @@ -282,6 +285,7 @@ - this.a = iblockdata; - this.b = generatoraccess; - this.c = blockposition; + this.blockData = iblockdata; + this.generatorAccess = generatoraccess; + this.blockPosition = blockposition; + this.bukkitOwner = new CraftBlockInventoryHolder(generatoraccess, blockposition, this); // CraftBukkit } @@ -46,15 +46,15 @@ @Override public void update() { -- BlockComposter.d(this.a, this.b, this.c); -- this.d = true; +- BlockComposter.d(this.blockData, this.generatorAccess, this.blockPosition); +- this.emptied = true; + // CraftBukkit start - allow putting items back (eg cancelled InventoryMoveItemEvent) -+ if (this.isNotEmpty()) { -+ BlockComposter.d(this.a, this.b, this.c); -+ this.d = true; ++ if (this.isEmpty()) { ++ BlockComposter.d(this.blockData, this.generatorAccess, this.blockPosition); ++ this.emptied = true; + } else { -+ this.b.setTypeAndData(this.c, this.a, 3); -+ this.d = false; ++ this.generatorAccess.setTypeAndData(this.blockPosition, this.blockData, 3); ++ this.emptied = false; + } + // CraftBukkit end } diff --git a/paper-server/nms-patches/BlockConcretePowder.patch b/paper-server/nms-patches/BlockConcretePowder.patch index c525720fd2..0918e65940 100644 --- a/paper-server/nms-patches/BlockConcretePowder.patch +++ b/paper-server/nms-patches/BlockConcretePowder.patch @@ -14,19 +14,19 @@ @@ -12,7 +17,7 @@ @Override public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) { - if (canHarden(iblockdata1)) { + if (canHarden(world, blockposition, iblockdata1)) { - world.setTypeAndData(blockposition, this.a, 3); + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.a, 3); // CraftBukkit } } -@@ -22,7 +27,24 @@ - World world = blockactioncontext.getWorld(); +@@ -23,7 +28,24 @@ BlockPosition blockposition = blockactioncontext.getClickPosition(); + IBlockData iblockdata = world.getType(blockposition); -- return !canHarden(world.getType(blockposition)) && !a((IBlockAccess) world, blockposition) ? super.getPlacedState(blockactioncontext) : this.a; +- return canHarden(world, blockposition, iblockdata) ? this.a : super.getPlacedState(blockactioncontext); + // CraftBukkit start -+ if (!canHarden(world.getType(blockposition)) && !a((IBlockAccess) world, blockposition)) { ++ if (!canHarden(world, blockposition, iblockdata)) { + return super.getPlacedState(blockactioncontext); + } + @@ -45,8 +45,8 @@ + // CraftBukkit end } - private static boolean a(IBlockAccess iblockaccess, BlockPosition blockposition) { -@@ -54,6 +76,20 @@ + private static boolean canHarden(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) { +@@ -59,6 +81,20 @@ @Override public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { diff --git a/paper-server/nms-patches/ChunkProviderServer.patch b/paper-server/nms-patches/ChunkProviderServer.patch index c1fbe506a6..d756cbda60 100644 --- a/paper-server/nms-patches/ChunkProviderServer.patch +++ b/paper-server/nms-patches/ChunkProviderServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ChunkProviderServer.java +++ b/net/minecraft/server/ChunkProviderServer.java -@@ -92,7 +92,7 @@ +@@ -95,7 +95,7 @@ for (int l = 0; l < 4; ++l) { if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) { ichunkaccess = this.cacheChunk[l]; @@ -9,7 +9,7 @@ return ichunkaccess; } } -@@ -136,12 +136,12 @@ +@@ -141,12 +141,12 @@ if (playerchunk == null) { return null; } else { @@ -24,7 +24,7 @@ if (ichunkaccess1 != null) { this.a(k, ichunkaccess1, ChunkStatus.FULL); -@@ -168,7 +168,15 @@ +@@ -173,7 +173,15 @@ int l = 33 + ChunkStatus.a(chunkstatus); PlayerChunk playerchunk = this.getChunk(k); @@ -41,7 +41,7 @@ this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); if (this.a(playerchunk, l)) { GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); -@@ -187,7 +195,7 @@ +@@ -192,7 +200,7 @@ } private boolean a(@Nullable PlayerChunk playerchunk, int i) { @@ -50,7 +50,7 @@ } public boolean isLoaded(int i, int j) { -@@ -289,11 +297,31 @@ +@@ -294,11 +302,31 @@ @Override public void close() throws IOException { @@ -83,7 +83,7 @@ public void tick(BooleanSupplier booleansupplier) { this.world.getMethodProfiler().enter("purge"); this.chunkMapDistance.purgeTickets(); -@@ -313,13 +341,13 @@ +@@ -318,13 +346,13 @@ this.lastTickTime = i; WorldData worlddata = this.world.getWorldData(); boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES; @@ -99,7 +99,7 @@ this.world.getMethodProfiler().enter("naturalSpawnCount"); int l = this.chunkMapDistance.b(); -@@ -348,8 +376,30 @@ +@@ -353,8 +381,30 @@ for (int j1 = 0; j1 < i1; ++j1) { EnumCreatureType enumcreaturetype = aenumcreaturetype1[j1]; @@ -131,7 +131,7 @@ if (object2intmap.getInt(enumcreaturetype) <= k1) { SpawnerCreature.a(enumcreaturetype, this.world, chunk, blockposition); -@@ -496,12 +546,18 @@ +@@ -507,12 +557,18 @@ @Override protected boolean executeNext() { diff --git a/paper-server/nms-patches/CommandDispatcher.patch b/paper-server/nms-patches/CommandDispatcher.patch index 82219d58cb..f199c5b4fb 100644 --- a/paper-server/nms-patches/CommandDispatcher.patch +++ b/paper-server/nms-patches/CommandDispatcher.patch @@ -84,109 +84,16 @@ StringReader stringreader = new StringReader(s); if (stringreader.canRead() && stringreader.peek() == '/') { -@@ -119,7 +173,6 @@ - byte b0; - - try { -- byte b1; - ChatComponentText chatcomponenttext; - - try { -@@ -128,58 +181,62 @@ - return i; - } catch (CommandException commandexception) { - commandlistenerwrapper.sendFailureMessage(commandexception.a()); -- b1 = 0; -- return b1; -+ b0 = 0; -+ return b0; - } catch (CommandSyntaxException commandsyntaxexception) { - commandlistenerwrapper.sendFailureMessage(ChatComponentUtils.a(commandsyntaxexception.getRawMessage())); +@@ -134,7 +188,7 @@ if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) { int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor()); -- IChatBaseComponent ichatbasecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).a((chatmodifier) -> { + IChatBaseComponent ichatbasecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).a((chatmodifier) -> { - chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, s)); -- }); ++ chatmodifier.setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit + }); -+ chatcomponenttext = new ChatComponentText(""); if (j > 10) { -- ichatbasecomponent.a("..."); -+ chatcomponenttext.a("..."); - } - -- ichatbasecomponent.a(commandsyntaxexception.getInput().substring(Math.max(0, j - 10), j)); -+ chatcomponenttext.a(commandsyntaxexception.getInput().substring(Math.max(0, j - 10), j)); - if (j < commandsyntaxexception.getInput().length()) { -- IChatBaseComponent ichatbasecomponent1 = (new ChatComponentText(commandsyntaxexception.getInput().substring(j))).a(new EnumChatFormat[]{EnumChatFormat.RED, EnumChatFormat.UNDERLINE}); -+ ChatComponentText chatcomponenttext1 = new ChatComponentText(commandsyntaxexception.getInput().substring(j)); - -- ichatbasecomponent.addSibling(ichatbasecomponent1); -+ chatcomponenttext1.getChatModifier().setColor(EnumChatFormat.RED); -+ chatcomponenttext1.getChatModifier().setUnderline(Boolean.valueOf(true)); -+ chatcomponenttext.addSibling(chatcomponenttext1); - } - -- ichatbasecomponent.addSibling((new ChatMessage("command.context.here", new Object[0])).a(new EnumChatFormat[]{EnumChatFormat.RED, EnumChatFormat.ITALIC})); -- commandlistenerwrapper.sendFailureMessage(ichatbasecomponent); -+ ChatMessage chatmessage = new ChatMessage("command.context.here", new Object[0]); -+ -+ chatmessage.getChatModifier().setItalic(Boolean.valueOf(true)); -+ chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -+ chatcomponenttext.addSibling(chatmessage); -+ chatcomponenttext.getChatModifier().setColor(EnumChatFormat.GRAY); -+ chatcomponenttext.getChatModifier().setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit -+ commandlistenerwrapper.sendFailureMessage(chatcomponenttext); - } - -- b1 = 0; -- return b1; -+ b0 = 0; - } catch (Exception exception) { -- chatcomponenttext = new ChatComponentText; -- } -+ ChatMessage chatmessage1 = new ChatMessage("command.failed", new Object[0]); - -- chatcomponenttext.(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); -- ChatComponentText chatcomponenttext1 = chatcomponenttext; -+ chatcomponenttext = new ChatComponentText(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); -+ if (CommandDispatcher.LOGGER.isDebugEnabled()) { -+ CommandDispatcher.LOGGER.error("Command exception: {}", s, exception); -+ StackTraceElement[] astacktraceelement = exception.getStackTrace(); - -- if (CommandDispatcher.LOGGER.isDebugEnabled()) { -- CommandDispatcher.LOGGER.error("Command exception: {}", s, exception); -- StackTraceElement[] astacktraceelement = exception.getStackTrace(); -+ for (int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) { -+ chatcomponenttext.a("\n\n" + astacktraceelement[k].getMethodName() + "\n " + astacktraceelement[k].getFileName() + ":" + astacktraceelement[k].getLineNumber()); -+ } -+ } - -- for(int k = 0; k < Math.min(astacktraceelement.length, 3); ++k) { -- chatcomponenttext1.a("\n\n").a(astacktraceelement[k].getMethodName()).a("\n ").a(astacktraceelement[k].getFileName()).a(":").a(String.valueOf(astacktraceelement[k].getLineNumber())); -+ chatmessage1.getChatModifier().setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext)); -+ commandlistenerwrapper.sendFailureMessage(chatmessage1); -+ if (SharedConstants.b) { -+ commandlistenerwrapper.sendFailureMessage(new ChatComponentText(SystemUtils.d(exception))); -+ CommandDispatcher.LOGGER.error("'" + s + "' threw an exception", exception); - } -- } - -- commandlistenerwrapper.sendFailureMessage((new ChatMessage("command.failed", new Object[0])).a((chatmodifier) -> { -- chatmodifier.setChatHoverable(new ChatHoverable(ChatHoverable.EnumHoverAction.SHOW_TEXT, chatcomponenttext1)); -- })); -- if (SharedConstants.b) { -- commandlistenerwrapper.sendFailureMessage(new ChatComponentText(SystemUtils.d(exception))); -- CommandDispatcher.LOGGER.error("'" + s + "' threw an exception", exception); -- } -+ byte b1 = 0; - -- b0 = 0; -+ return b1; -+ } - } finally { - commandlistenerwrapper.getServer().getMethodProfiler().exit(); - } -@@ -188,11 +245,36 @@ +@@ -184,11 +238,36 @@ } public void a(EntityPlayer entityplayer) { @@ -224,7 +131,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode)); } -@@ -203,7 +285,7 @@ +@@ -199,7 +278,7 @@ CommandNode commandnode2 = (CommandNode) iterator.next(); if (commandnode2.canUse(commandlistenerwrapper)) { @@ -233,7 +140,7 @@ argumentbuilder.requires((icompletionprovider) -> { return true; -@@ -226,7 +308,7 @@ +@@ -222,7 +301,7 @@ argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect())); } diff --git a/paper-server/nms-patches/CustomFunction.patch b/paper-server/nms-patches/CustomFunction.patch index baea3d9406..3f5c3a103b 100644 --- a/paper-server/nms-patches/CustomFunction.patch +++ b/paper-server/nms-patches/CustomFunction.patch @@ -4,8 +4,8 @@ } try { -- ParseResults parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(stringreader, customfunctiondata.g()); -+ ParseResults parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.g()); // CraftBukkit +- ParseResults parseresults = customfunctiondata.getServer().getCommandDispatcher().a().parse(stringreader, customfunctiondata.g()); ++ ParseResults parseresults = customfunctiondata.getCommandDispatcher().parse(stringreader, customfunctiondata.g()); // CraftBukkit if (parseresults.getReader().canRead()) { throw CommandDispatcher.a(parseresults); diff --git a/paper-server/nms-patches/CustomFunctionData.patch b/paper-server/nms-patches/CustomFunctionData.patch index 42d53929c3..4badabd4e1 100644 --- a/paper-server/nms-patches/CustomFunctionData.patch +++ b/paper-server/nms-patches/CustomFunctionData.patch @@ -3,7 +3,7 @@ @@ -54,7 +54,7 @@ } - public com.mojang.brigadier.CommandDispatcher d() { + public com.mojang.brigadier.CommandDispatcher getCommandDispatcher() { - return this.server.getCommandDispatcher().a(); + return this.server.vanillaCommandDispatcher.a(); // CraftBukkit } diff --git a/paper-server/nms-patches/DedicatedServer.patch b/paper-server/nms-patches/DedicatedServer.patch index 6f81366289..7fc447cc05 100644 --- a/paper-server/nms-patches/DedicatedServer.patch +++ b/paper-server/nms-patches/DedicatedServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/DedicatedServer.java +++ b/net/minecraft/server/DedicatedServer.java -@@ -25,6 +25,17 @@ +@@ -26,6 +26,17 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -18,7 +18,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer { private static final Logger LOGGER = LogManager.getLogger(); -@@ -38,8 +49,10 @@ +@@ -39,8 +50,10 @@ @Nullable private ServerGUI p; @@ -31,7 +31,7 @@ this.propertyManager = dedicatedserversettings; this.remoteControlCommandListener = new RemoteControlCommandListener(this); Thread thread = new Thread("Server Infinisleeper") { -@@ -65,13 +78,37 @@ +@@ -66,13 +79,37 @@ public boolean init() throws IOException { Thread thread = new Thread("Server console handler") { public void run() { @@ -72,7 +72,7 @@ } } catch (IOException ioexception) { DedicatedServer.LOGGER.error("Exception handling console input", ioexception); -@@ -80,6 +117,27 @@ +@@ -81,6 +118,27 @@ } }; @@ -100,7 +100,7 @@ thread.setDaemon(true); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER)); thread.start(); -@@ -133,6 +191,12 @@ +@@ -134,6 +192,12 @@ return false; } @@ -113,7 +113,7 @@ if (!this.getOnlineMode()) { DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); -@@ -147,7 +211,7 @@ +@@ -148,7 +212,7 @@ if (!NameReferencingFileConverter.e(this)) { return false; } else { @@ -122,7 +122,7 @@ long i = SystemUtils.getMonotonicNanos(); String s = dedicatedserverproperties.levelSeed; String s1 = dedicatedserverproperties.generatorSettings; -@@ -177,7 +241,13 @@ +@@ -178,7 +242,13 @@ if (worldtype == WorldType.FLAT) { jsonobject.addProperty("flat_world_options", s1); } else if (!s1.isEmpty()) { @@ -137,7 +137,7 @@ } this.a(this.getWorld(), this.getWorld(), j, worldtype, jsonobject); -@@ -199,6 +269,7 @@ +@@ -200,6 +270,7 @@ DedicatedServer.LOGGER.info("Starting remote control listener"); this.remoteControlListener = new RemoteControlListener(this); this.remoteControlListener.a(); @@ -145,7 +145,7 @@ } if (this.getMaxTickTime() > 0L) { -@@ -301,6 +372,7 @@ +@@ -307,6 +378,7 @@ this.remoteStatusListener.b(); } @@ -153,7 +153,7 @@ } @Override -@@ -334,7 +406,15 @@ +@@ -340,7 +412,15 @@ while (!this.serverCommandQueue.isEmpty()) { ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); @@ -170,7 +170,7 @@ } } -@@ -534,14 +614,45 @@ +@@ -540,14 +620,45 @@ @Override public String getPlugins() { @@ -218,7 +218,7 @@ }); return this.remoteControlCommandListener.getMessages(); } -@@ -562,4 +673,16 @@ +@@ -568,4 +679,16 @@ public boolean a(GameProfile gameprofile) { return false; } diff --git a/paper-server/nms-patches/EntityArmorStand.patch b/paper-server/nms-patches/EntityArmorStand.patch index 5137d1a208..9c57d1c5c9 100644 --- a/paper-server/nms-patches/EntityArmorStand.patch +++ b/paper-server/nms-patches/EntityArmorStand.patch @@ -28,9 +28,9 @@ + // CraftBukkit end + @Override - public boolean bt() { - return !this.isMarker() && super.bt(); -@@ -386,6 +402,21 @@ + public void updateSize() { + double d0 = this.locX(); +@@ -381,6 +397,21 @@ return false; } else { ItemStack itemstack2; @@ -52,7 +52,7 @@ if (entityhuman.abilities.canInstantlyBuild && itemstack1.isEmpty() && !itemstack.isEmpty()) { itemstack2 = itemstack.cloneItemStack(); -@@ -414,12 +445,22 @@ +@@ -409,12 +440,22 @@ public boolean damageEntity(DamageSource damagesource, float f) { if (!this.world.isClientSide && !this.dead) { if (DamageSource.OUT_OF_WORLD.equals(damagesource)) { @@ -78,7 +78,7 @@ return false; } else if (DamageSource.FIRE.equals(damagesource)) { if (this.isBurning()) { -@@ -444,7 +485,7 @@ +@@ -439,7 +480,7 @@ } else if (damagesource.v()) { this.F(); this.D(); @@ -87,7 +87,7 @@ return flag1; } else { long i = this.world.getTime(); -@@ -455,7 +496,7 @@ +@@ -450,7 +491,7 @@ } else { this.f(damagesource); this.D(); @@ -96,7 +96,7 @@ } return true; -@@ -482,7 +523,7 @@ +@@ -477,7 +518,7 @@ f1 -= f; if (f1 <= 0.5F) { this.g(damagesource); @@ -105,7 +105,7 @@ } else { this.setHealth(f1); } -@@ -490,13 +531,13 @@ +@@ -485,13 +526,13 @@ } private void f(DamageSource damagesource) { @@ -121,7 +121,7 @@ ItemStack itemstack; int i; -@@ -504,7 +545,7 @@ +@@ -499,7 +540,7 @@ for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); if (!itemstack.isEmpty()) { @@ -130,7 +130,7 @@ this.handItems.set(i, ItemStack.a); } } -@@ -512,10 +553,11 @@ +@@ -507,10 +548,11 @@ for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -143,7 +143,7 @@ } -@@ -616,8 +658,16 @@ +@@ -611,8 +653,16 @@ return this.isSmall(); } diff --git a/paper-server/nms-patches/EntityFallingBlock.patch b/paper-server/nms-patches/EntityFallingBlock.patch index 2429e73b4a..568aeb0d67 100644 --- a/paper-server/nms-patches/EntityFallingBlock.patch +++ b/paper-server/nms-patches/EntityFallingBlock.patch @@ -18,7 +18,7 @@ this.world.a(blockposition, false); } else if (!this.world.isClientSide) { this.die(); -@@ -121,6 +123,11 @@ +@@ -122,6 +124,11 @@ this.block = (IBlockData) this.block.set(BlockProperties.C, true); } @@ -30,7 +30,7 @@ if (this.world.setTypeAndData(blockposition, this.block, 3)) { if (block instanceof BlockFalling) { ((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata); -@@ -177,7 +184,9 @@ +@@ -178,7 +185,9 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); diff --git a/paper-server/nms-patches/EntityFox.patch b/paper-server/nms-patches/EntityFox.patch index d003fa640b..a3fc90cbf0 100644 --- a/paper-server/nms-patches/EntityFox.patch +++ b/paper-server/nms-patches/EntityFox.patch @@ -1,24 +1,13 @@ --- a/net/minecraft/server/EntityFox.java +++ b/net/minecraft/server/EntityFox.java -@@ -17,8 +17,8 @@ - - private static final DataWatcherObject bw = DataWatcher.a(EntityFox.class, DataWatcherRegistry.b); - private static final DataWatcherObject bx = DataWatcher.a(EntityFox.class, DataWatcherRegistry.a); -- private static final DataWatcherObject> by = DataWatcher.a(EntityFox.class, DataWatcherRegistry.o); -- private static final DataWatcherObject> bz = DataWatcher.a(EntityFox.class, DataWatcherRegistry.o); -+ public static final DataWatcherObject> by = DataWatcher.a(EntityFox.class, DataWatcherRegistry.o); -+ public static final DataWatcherObject> bz = DataWatcher.a(EntityFox.class, DataWatcherRegistry.o); - private static final Predicate bA = (entityitem) -> { - return !entityitem.p() && entityitem.isAlive(); - }; @@ -263,8 +263,8 @@ private List eE() { List list = Lists.newArrayList(); -- list.add(((Optional) this.datawatcher.get(EntityFox.by)).orElse((Object) null)); -- list.add(((Optional) this.datawatcher.get(EntityFox.bz)).orElse((Object) null)); -+ list.add(((Optional) this.datawatcher.get(EntityFox.by)).orElse(null)); // CraftBukkit - decompile error -+ list.add(((Optional) this.datawatcher.get(EntityFox.bz)).orElse(null)); // CraftBukkit - decompile error +- list.add(((Optional) this.datawatcher.get(EntityFox.FIRST_TRUSTED_PLAYER)).orElse((Object) null)); +- list.add(((Optional) this.datawatcher.get(EntityFox.SECOND_TRUSTED_PLAYER)).orElse((Object) null)); ++ list.add((this.datawatcher.get(EntityFox.FIRST_TRUSTED_PLAYER)).orElse(null)); // CraftBukkit - decompile error ++ list.add((this.datawatcher.get(EntityFox.SECOND_TRUSTED_PLAYER)).orElse(null)); // CraftBukkit - decompile error return list; } diff --git a/paper-server/nms-patches/EntityHanging.patch b/paper-server/nms-patches/EntityHanging.patch index 8a6b585cf4..8c33c4b107 100644 --- a/paper-server/nms-patches/EntityHanging.patch +++ b/paper-server/nms-patches/EntityHanging.patch @@ -104,7 +104,7 @@ this.die(); this.a((Entity) null); } -@@ -134,6 +170,22 @@ +@@ -140,6 +176,22 @@ return false; } else { if (!this.dead && !this.world.isClientSide) { @@ -127,7 +127,7 @@ this.die(); this.velocityChanged(); this.a(damagesource.getEntity()); -@@ -146,6 +198,18 @@ +@@ -152,6 +204,18 @@ @Override public void move(EnumMoveType enummovetype, Vec3D vec3d) { if (!this.world.isClientSide && !this.dead && vec3d.g() > 0.0D) { @@ -146,7 +146,7 @@ this.die(); this.a((Entity) null); } -@@ -154,7 +218,7 @@ +@@ -160,7 +224,7 @@ @Override public void h(double d0, double d1, double d2) { diff --git a/paper-server/nms-patches/EntityHuman.patch b/paper-server/nms-patches/EntityHuman.patch index 2f3e13db52..e4bbd98bf7 100644 --- a/paper-server/nms-patches/EntityHuman.patch +++ b/paper-server/nms-patches/EntityHuman.patch @@ -327,7 +327,7 @@ return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE); } -@@ -1176,6 +1306,34 @@ +@@ -1177,6 +1307,34 @@ } } } @@ -362,7 +362,7 @@ this.entitySleep(blockposition); this.sleepTicks = 0; -@@ -1210,11 +1368,28 @@ +@@ -1211,11 +1369,28 @@ } public void wakeup(boolean flag, boolean flag1) { @@ -391,7 +391,7 @@ this.sleepTicks = flag ? 0 : 100; } -@@ -1266,9 +1441,11 @@ +@@ -1267,9 +1442,11 @@ this.g = blockposition; this.bR = flag; @@ -403,7 +403,7 @@ } } -@@ -1340,7 +1517,11 @@ +@@ -1341,7 +1518,11 @@ this.setMot(vec3d2.x, d3 * 0.6D, vec3d2.z); this.aM = f; this.fallDistance = 0.0F; @@ -416,7 +416,7 @@ } else { super.e(vec3d); } -@@ -1466,12 +1647,17 @@ +@@ -1467,12 +1648,17 @@ } public void startGliding() { @@ -434,7 +434,7 @@ } @Override -@@ -1686,26 +1872,31 @@ +@@ -1687,26 +1873,31 @@ protected void releaseShoulderEntities() { if (this.e + 20L < this.world.getTime()) { diff --git a/paper-server/nms-patches/EntityLiving.patch b/paper-server/nms-patches/EntityLiving.patch index 5f9a40edd3..6419dbffe7 100644 --- a/paper-server/nms-patches/EntityLiving.patch +++ b/paper-server/nms-patches/EntityLiving.patch @@ -132,9 +132,9 @@ try { while (iterator.hasNext()) { MobEffectList mobeffectlist = (MobEffectList) iterator.next(); -@@ -511,6 +585,12 @@ - - if (!mobeffect.tick(this)) { +@@ -513,6 +587,12 @@ + this.a(mobeffect, true); + })) { if (!this.world.isClientSide) { + // CraftBukkit start + EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect, null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.EXPIRATION); @@ -145,7 +145,7 @@ iterator.remove(); this.b(mobeffect); } -@@ -521,6 +601,17 @@ +@@ -523,6 +603,17 @@ } catch (ConcurrentModificationException concurrentmodificationexception) { ; } @@ -163,7 +163,7 @@ if (this.updateEffects) { if (!this.world.isClientSide) { -@@ -630,7 +721,13 @@ +@@ -632,7 +723,13 @@ this.datawatcher.set(EntityLiving.e, 0); } @@ -177,7 +177,7 @@ if (this.world.isClientSide) { return false; } else { -@@ -639,7 +736,14 @@ +@@ -641,7 +738,14 @@ boolean flag; for (flag = false; iterator.hasNext(); flag = true) { @@ -193,7 +193,7 @@ iterator.remove(); } -@@ -664,18 +768,44 @@ +@@ -666,18 +770,44 @@ return (MobEffect) this.effects.get(mobeffectlist); } @@ -217,7 +217,7 @@ + // CraftBukkit start + boolean override = false; + if (mobeffect1 != null) { -+ override = new MobEffect(mobeffect1).a(mobeffect); ++ override = new MobEffect(mobeffect1).b(mobeffect); + } + + EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect1, mobeffect, cause, override); @@ -230,16 +230,16 @@ this.effects.put(mobeffect.getMobEffect(), mobeffect); this.a(mobeffect); return true; -- } else if (mobeffect1.a(mobeffect)) { +- } else if (mobeffect1.b(mobeffect)) { + // CraftBukkit start + } else if (event.isOverride()) { -+ mobeffect1.a(mobeffect); ++ mobeffect1.b(mobeffect); this.a(mobeffect1, true); + // CraftBukkit end return true; } else { return false; -@@ -699,13 +829,39 @@ +@@ -701,13 +831,39 @@ return this.getMonsterType() == EnumMonsterType.UNDEAD; } @@ -280,7 +280,7 @@ if (mobeffect != null) { this.b(mobeffect); -@@ -742,20 +898,55 @@ +@@ -744,20 +900,55 @@ } @@ -337,7 +337,7 @@ this.datawatcher.set(EntityLiving.HEALTH, MathHelper.a(f, 0.0F, this.getMaxHealth())); } -@@ -765,7 +956,7 @@ +@@ -767,7 +958,7 @@ return false; } else if (this.world.isClientSide) { return false; @@ -346,7 +346,7 @@ return false; } else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { return false; -@@ -777,17 +968,19 @@ +@@ -779,17 +970,19 @@ this.ticksFarFromPlayer = 0; float f1 = f; @@ -354,7 +354,7 @@ + // CraftBukkit - Moved into damageEntity0(DamageSource, float) + if (false && (damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) { this.getEquipment(EnumItemSlot.HEAD).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this, (entityliving) -> { - entityliving.c(EnumItemSlot.HEAD); + entityliving.broadcastItemBreak(EnumItemSlot.HEAD); }); f *= 0.75F; } @@ -369,7 +369,7 @@ this.damageShield(f); f2 = f; f = 0.0F; -@@ -807,20 +1000,39 @@ +@@ -809,20 +1002,39 @@ if ((float) this.noDamageTicks > 10.0F) { if (f <= this.lastDamage) { @@ -411,7 +411,7 @@ this.ax = 0.0F; Entity entity1 = damagesource.getEntity(); -@@ -941,19 +1153,29 @@ +@@ -943,19 +1155,29 @@ EnumHand[] aenumhand = EnumHand.values(); int i = aenumhand.length; @@ -445,7 +445,7 @@ EntityPlayer entityplayer = (EntityPlayer) this; entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING)); -@@ -961,13 +1183,15 @@ +@@ -963,13 +1185,15 @@ } this.setHealth(1.0F); @@ -465,7 +465,7 @@ } } -@@ -1084,28 +1308,48 @@ +@@ -1086,28 +1310,48 @@ boolean flag = this.lastDamageByPlayerTime > 0; @@ -516,7 +516,7 @@ } -@@ -1203,9 +1447,14 @@ +@@ -1205,9 +1449,14 @@ int i = this.e(f, f1); if (i > 0) { @@ -532,7 +532,7 @@ return true; } else { return flag; -@@ -1247,7 +1496,7 @@ +@@ -1249,7 +1498,7 @@ protected float applyArmorModifier(DamageSource damagesource, float f) { if (!damagesource.ignoresArmor()) { @@ -541,7 +541,7 @@ f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.ARMOR_TOUGHNESS).getValue()); } -@@ -1260,7 +1509,8 @@ +@@ -1262,7 +1511,8 @@ } else { int i; @@ -551,7 +551,7 @@ i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5; int j = 25 - i; float f1 = f * (float) j; -@@ -1291,28 +1541,170 @@ +@@ -1293,28 +1543,170 @@ } } @@ -650,7 +650,7 @@ + // Apply damage to helmet + if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(EnumItemSlot.HEAD) != null) { + this.getEquipment(EnumItemSlot.HEAD).damage((int) (event.getDamage() * 4.0F + this.random.nextFloat() * event.getDamage() * 2.0F), this, (entityliving) -> { -+ entityliving.c(EnumItemSlot.HEAD); ++ entityliving.broadcastItemBreak(EnumItemSlot.HEAD); + }); + } + @@ -732,7 +732,7 @@ } public CombatTracker getCombatTracker() { -@@ -1399,6 +1791,7 @@ +@@ -1401,6 +1793,7 @@ public AttributeMapBase getAttributeMap() { if (this.attributeMap == null) { this.attributeMap = new AttributeMapServer(); @@ -740,7 +740,7 @@ } return this.attributeMap; -@@ -1769,6 +2162,7 @@ +@@ -1771,6 +2164,7 @@ } if (this.onGround && !this.world.isClientSide) { @@ -748,7 +748,7 @@ this.setFlag(7, false); } } else { -@@ -2166,6 +2560,7 @@ +@@ -2168,6 +2562,7 @@ } if (!this.world.isClientSide) { @@ -756,7 +756,7 @@ this.setFlag(7, flag); } -@@ -2294,12 +2689,12 @@ +@@ -2296,12 +2691,12 @@ @Override public boolean isInteractable() { @@ -771,7 +771,7 @@ } @Override -@@ -2482,7 +2877,27 @@ +@@ -2484,7 +2879,27 @@ } else { if (!this.activeItem.isEmpty() && this.isHandRaised()) { this.b(this.activeItem, 16); @@ -800,7 +800,7 @@ this.dH(); } -@@ -2569,10 +2984,18 @@ +@@ -2571,10 +2986,18 @@ } if (flag2) { @@ -822,7 +822,7 @@ } } -@@ -2659,7 +3082,7 @@ +@@ -2661,7 +3084,7 @@ } public void entityWakeup() { @@ -831,7 +831,7 @@ World world = this.world; this.world.getClass(); -@@ -2723,7 +3146,7 @@ +@@ -2725,7 +3148,7 @@ Pair pair = (Pair) iterator.next(); if (!world.isClientSide && pair.getLeft() != null && world.random.nextFloat() < (Float) pair.getRight()) { diff --git a/paper-server/nms-patches/EntityPlayer.patch b/paper-server/nms-patches/EntityPlayer.patch index 79c0ff7081..b107062778 100644 --- a/paper-server/nms-patches/EntityPlayer.patch +++ b/paper-server/nms-patches/EntityPlayer.patch @@ -450,9 +450,9 @@ - this.setPositionRotation((double) i, (double) j, (double) k, f1, 0.0F); - this.setMot(Vec3D.a); -- } else if (!worldserver1.getTravelAgent().a(this, f2)) { -- worldserver1.getTravelAgent().a((Entity) this); -- worldserver1.getTravelAgent().a(this, f2); +- } else if (!worldserver1.getTravelAgent().findAndTeleport(this, f2)) { +- worldserver1.getTravelAgent().createPortal(this); +- worldserver1.getTravelAgent().findAndTeleport(this, f2); + // CraftBukkit start + org.bukkit.World bworld = worldserver1.getWorld(); + org.bukkit.event.world.PortalCreateEvent portalEvent = new org.bukkit.event.world.PortalCreateEvent((List) (List) blockList.getList(), bworld, this.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM); @@ -714,15 +714,6 @@ } @Override -@@ -1011,7 +1356,7 @@ - } - - @Override -- public void b(double d0, double d1, double d2) { -+ public void b(double d0, double d1, double d2) { // PAIL: rename to teleportAndSync - this.playerConnection.a(d0, d1, d2, this.yaw, this.pitch); - this.playerConnection.syncPosition(); - } @@ -1040,6 +1385,18 @@ @Override diff --git a/paper-server/nms-patches/EntitySnowman.patch b/paper-server/nms-patches/EntitySnowman.patch index 77e09b49e7..2fb1185cb9 100644 --- a/paper-server/nms-patches/EntitySnowman.patch +++ b/paper-server/nms-patches/EntitySnowman.patch @@ -43,4 +43,4 @@ + // CraftBukkit end this.setHasPumpkin(false); itemstack.damage(1, entityhuman, (entityhuman1) -> { - entityhuman1.d(enumhand); + entityhuman1.broadcastItemBreak(enumhand); diff --git a/paper-server/nms-patches/EntityTypes.patch b/paper-server/nms-patches/EntityTypes.patch index b0a0ec0155..dfcd60afc0 100644 --- a/paper-server/nms-patches/EntityTypes.patch +++ b/paper-server/nms-patches/EntityTypes.patch @@ -19,7 +19,7 @@ + + @Nullable + public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { - T t0 = this.b(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); + T t0 = this.createCreature(world, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); - world.addEntity(t0); - return t0; diff --git a/paper-server/nms-patches/GameRules.patch b/paper-server/nms-patches/GameRules.patch index 0aa582ee12..ca155e5893 100644 --- a/paper-server/nms-patches/GameRules.patch +++ b/paper-server/nms-patches/GameRules.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/server/GameRules.java +++ b/net/minecraft/server/GameRules.java -@@ -92,7 +92,7 @@ +@@ -94,7 +94,7 @@ } public > T get(GameRules.GameRuleKey gamerules_gamerulekey) { -- return (GameRules.GameRuleValue) this.F.get(gamerules_gamerulekey); -+ return (T) this.F.get(gamerules_gamerulekey); // CraftBukkit - decompile error +- return (GameRules.GameRuleValue) this.H.get(gamerules_gamerulekey); ++ return (T) this.H.get(gamerules_gamerulekey); // CraftBukkit - decompile error } public NBTTagCompound a() { -@@ -120,7 +120,7 @@ +@@ -122,7 +122,7 @@ } private static > void a(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey gamerules_gamerulekey, GameRules.GameRuleDefinition gamerules_gameruledefinition) { @@ -18,7 +18,7 @@ } public boolean getBoolean(GameRules.GameRuleKey gamerules_gamerulekey) { -@@ -171,7 +171,7 @@ +@@ -173,7 +173,7 @@ } @Override @@ -27,7 +27,7 @@ this.a = Boolean.parseBoolean(s); } -@@ -221,7 +221,7 @@ +@@ -223,7 +223,7 @@ } @Override @@ -36,7 +36,7 @@ this.a = b(s); } -@@ -270,7 +270,7 @@ +@@ -272,7 +272,7 @@ } @@ -45,7 +45,7 @@ protected abstract String getValue(); -@@ -300,7 +300,7 @@ +@@ -302,7 +302,7 @@ } public T getValue() { diff --git a/paper-server/nms-patches/ItemBoat.patch b/paper-server/nms-patches/ItemBoat.patch index 2839c87a25..4c3a6c26b3 100644 --- a/paper-server/nms-patches/ItemBoat.patch +++ b/paper-server/nms-patches/ItemBoat.patch @@ -16,13 +16,13 @@ entityboat.setType(this.b); @@ -49,7 +57,15 @@ - return InteractionResultWrapper.d(itemstack); + return InteractionResultWrapper.fail(itemstack); } else { if (!world.isClientSide) { - world.addEntity(entityboat); + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), entityhuman, entityboat).isCancelled()) { -+ return InteractionResultWrapper.d(itemstack); ++ return InteractionResultWrapper.fail(itemstack); + } + + if (!world.addEntity(entityboat)) { diff --git a/paper-server/nms-patches/ItemBow.patch b/paper-server/nms-patches/ItemBow.patch index d6e435e7f5..05df59f98b 100644 --- a/paper-server/nms-patches/ItemBow.patch +++ b/paper-server/nms-patches/ItemBow.patch @@ -30,7 +30,7 @@ + // CraftBukkit end itemstack.damage(1, entityhuman, (entityhuman1) -> { - entityhuman1.d(entityhuman.getRaisedHand()); + entityhuman1.broadcastItemBreak(entityhuman.getRaisedHand()); @@ -64,7 +75,16 @@ entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY; } diff --git a/paper-server/nms-patches/ItemCrossbow.patch b/paper-server/nms-patches/ItemCrossbow.patch index 637d09953b..8dcb5107a7 100644 --- a/paper-server/nms-patches/ItemCrossbow.patch +++ b/paper-server/nms-patches/ItemCrossbow.patch @@ -43,7 +43,7 @@ + // CraftBukkit end itemstack.damage(flag1 ? 3 : 1, entityliving, (entityliving1) -> { - entityliving1.d(enumhand); + entityliving1.broadcastItemBreak(enumhand); }); - world.addEntity((Entity) object); + // CraftBukkit start diff --git a/paper-server/nms-patches/ItemFlintAndSteel.patch b/paper-server/nms-patches/ItemFlintAndSteel.patch index 98842569f2..73c644ba6f 100644 --- a/paper-server/nms-patches/ItemFlintAndSteel.patch +++ b/paper-server/nms-patches/ItemFlintAndSteel.patch @@ -7,7 +7,7 @@ + // CraftBukkit start - Store the clicked block + if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition1, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) { + itemactioncontext.getItemStack().damage(1, entityhuman, (entityhuman1) -> { -+ entityhuman1.d(itemactioncontext.n()); ++ entityhuman1.broadcastItemBreak(itemactioncontext.getHand()); + }); + return EnumInteractionResult.PASS; + } diff --git a/paper-server/nms-patches/ItemSnowball.patch b/paper-server/nms-patches/ItemSnowball.patch index 376f560082..418d99fe7d 100644 --- a/paper-server/nms-patches/ItemSnowball.patch +++ b/paper-server/nms-patches/ItemSnowball.patch @@ -32,5 +32,5 @@ } + */ - return InteractionResultWrapper.a(itemstack); + return InteractionResultWrapper.success(itemstack); } diff --git a/paper-server/nms-patches/ItemTrident.patch b/paper-server/nms-patches/ItemTrident.patch index dcf285c1d5..312a20f611 100644 --- a/paper-server/nms-patches/ItemTrident.patch +++ b/paper-server/nms-patches/ItemTrident.patch @@ -21,7 +21,7 @@ + // CraftBukkit - moved down + /* itemstack.damage(1, entityhuman, (entityhuman1) -> { - entityhuman1.d(entityliving.getRaisedHand()); + entityhuman1.broadcastItemBreak(entityliving.getRaisedHand()); }); + */ if (k == 0) { @@ -41,7 +41,7 @@ + } + + itemstack.damage(1, entityhuman, (entityhuman1) -> { -+ entityhuman1.d(entityliving.getRaisedHand()); ++ entityhuman1.broadcastItemBreak(entityliving.getRaisedHand()); + }); + entitythrowntrident.trident = itemstack.cloneItemStack(); // SPIGOT-4511 update since damage call moved + // CraftBukkit end @@ -54,7 +54,7 @@ + // CraftBukkit start - SPIGOT-5458 also need in this branch :( + else { + itemstack.damage(1, entityhuman, (entityhuman1) -> { -+ entityhuman1.d(entityliving.getRaisedHand()); ++ entityhuman1.broadcastItemBreak(entityliving.getRaisedHand()); + }); + } + // CraftBukkkit end diff --git a/paper-server/nms-patches/LoginListener.patch b/paper-server/nms-patches/LoginListener.patch index 311b38504d..6cb0724920 100644 --- a/paper-server/nms-patches/LoginListener.patch +++ b/paper-server/nms-patches/LoginListener.patch @@ -57,7 +57,7 @@ + // CraftBukkit end } else { this.g = LoginListener.EnumProtocolState.ACCEPTED; - if (this.server.az() >= 0 && !this.networkManager.isLocal()) { + if (this.server.aA() >= 0 && !this.networkManager.isLocal()) { @@ -98,9 +121,9 @@ if (entityplayer != null) { diff --git a/paper-server/nms-patches/MinecraftServer.patch b/paper-server/nms-patches/MinecraftServer.patch index 3724ab19c3..6ea7109379 100644 --- a/paper-server/nms-patches/MinecraftServer.patch +++ b/paper-server/nms-patches/MinecraftServer.patch @@ -134,9 +134,9 @@ WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this); this.a(this.getWorld(), worldnbtstorage); -@@ -282,27 +329,137 @@ - } +@@ -283,27 +330,137 @@ + worlddata.a(this.getServerModName(), this.q().isPresent()); this.a(worldnbtstorage.getDirectory(), worlddata); - WorldLoadListener worldloadlistener = this.worldLoadListenerFactory.create(11); + */ @@ -287,7 +287,7 @@ if (!worlddata.u()) { try { -@@ -326,23 +483,8 @@ +@@ -327,23 +484,8 @@ worlddata.d(true); } @@ -312,7 +312,7 @@ private void a(WorldData worlddata) { worlddata.f(false); -@@ -361,6 +503,23 @@ +@@ -362,6 +504,23 @@ protected void a(File file, WorldData worlddata) { this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla())); this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks")); @@ -336,8 +336,8 @@ this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder); this.resourcePackRepository.a(); List list = Lists.newArrayList(); -@@ -382,11 +541,18 @@ - this.ba(); +@@ -383,11 +542,18 @@ + this.bb(); } - public void loadSpawn(WorldLoadListener worldloadlistener) { @@ -358,7 +358,7 @@ BlockPosition blockposition = worldserver.getSpawn(); worldloadlistener.a(new ChunkCoordIntPair(blockposition)); -@@ -397,17 +563,21 @@ +@@ -398,17 +564,21 @@ chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE); while (chunkproviderserver.b() != 441) { @@ -389,7 +389,7 @@ if (forcedchunk != null) { WorldServer worldserver1 = this.getWorldServer(dimensionmanager); -@@ -422,10 +592,16 @@ +@@ -423,10 +593,16 @@ } } @@ -408,7 +408,7 @@ } protected void a(String s, WorldNBTStorage worldnbtstorage) { -@@ -472,12 +648,16 @@ +@@ -473,12 +649,16 @@ } } @@ -425,7 +425,7 @@ return flag3; } -@@ -486,8 +666,29 @@ +@@ -487,8 +667,29 @@ this.stop(); } @@ -455,7 +455,7 @@ if (this.getServerConnection() != null) { this.getServerConnection().b(); } -@@ -496,6 +697,7 @@ +@@ -497,6 +698,7 @@ MinecraftServer.LOGGER.info("Saving players"); this.playerList.savePlayers(); this.playerList.shutdown(); @@ -463,7 +463,7 @@ } MinecraftServer.LOGGER.info("Saving worlds"); -@@ -565,14 +767,16 @@ +@@ -566,14 +768,16 @@ while (this.isRunning) { long i = SystemUtils.getMonotonicMillis() - this.nextTick; @@ -481,7 +481,7 @@ this.nextTick += 50L; if (this.T) { this.T = false; -@@ -619,6 +823,12 @@ +@@ -620,6 +824,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -494,7 +494,7 @@ this.exit(); } -@@ -627,8 +837,15 @@ +@@ -628,8 +838,15 @@ } private boolean canSleepForTick() { @@ -511,7 +511,7 @@ protected void sleepForTick() { this.executeAll(); -@@ -729,7 +946,7 @@ +@@ -735,7 +952,7 @@ this.serverPing.b().a(agameprofile); } @@ -520,7 +520,7 @@ MinecraftServer.LOGGER.debug("Autosave started"); this.methodProfiler.enter("save"); this.playerList.savePlayers(); -@@ -759,23 +976,40 @@ +@@ -765,23 +982,40 @@ } protected void b(BooleanSupplier booleansupplier) { @@ -562,7 +562,7 @@ this.methodProfiler.enter("tick"); -@@ -818,7 +1052,8 @@ +@@ -824,7 +1058,8 @@ this.tickables.add(runnable); } @@ -572,7 +572,7 @@ OptionParser optionparser = new OptionParser(); OptionSpec optionspec = optionparser.accepts("nogui"); OptionSpec optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); -@@ -841,15 +1076,17 @@ +@@ -847,15 +1082,17 @@ optionparser.printHelpOn(System.err); return; } @@ -592,26 +592,43 @@ MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'"); return; } -@@ -861,14 +1098,15 @@ - +@@ -868,14 +1105,16 @@ + CrashReport.h(); DispenserRegistry.init(); DispenserRegistry.c(); - String s = (String) optionset.valueOf(optionspec8); -+ String s = "."; // PAIL? ++ String s = (String) optionset.valueOf("universe"); // CraftBukkit YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); UserCache usercache = new UserCache(gameprofilerepository, new File(s, MinecraftServer.b.getName())); - String s1 = (String) Optional.ofNullable(optionset.valueOf(optionspec9)).orElse(dedicatedserversettings.getProperties().levelName); - final DedicatedServer dedicatedserver = new DedicatedServer(new File(s), dedicatedserversettings, DataConverterRegistry.a(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new, s1); ++ // CraftBukkit start + String s1 = (String) Optional.ofNullable(optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); + final DedicatedServer dedicatedserver = new DedicatedServer(optionset, dedicatedserversettings, DataConverterRegistry.a(), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new, s1); -+ /* CraftBukkit start ++ /* dedicatedserver.i((String) optionset.valueOf(optionspec7)); dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10)); dedicatedserver.e(optionset.has(optionspec2)); -@@ -891,6 +1129,29 @@ +@@ -883,12 +1122,14 @@ + dedicatedserver.setForceUpgrade(optionset.has(optionspec4)); + dedicatedserver.setEraseCache(optionset.has(optionspec5)); + dedicatedserver.c((String) optionset.valueOf(optionspec11)); +- boolean flag = !optionset.has(optionspec) && !optionset.valuesOf(nonoptionargumentspec).contains("nogui"); ++ */ ++ boolean flag = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); + + if (flag && !GraphicsEnvironment.isHeadless()) { + dedicatedserver.bc(); + } + ++ /* + dedicatedserver.startServerThread(); + Thread thread = new Thread("Server Shutdown Thread") { + public void run() { +@@ -898,6 +1139,29 @@ thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER)); Runtime.getRuntime().addShutdownHook(thread); @@ -641,7 +658,7 @@ } catch (Exception exception) { MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); } -@@ -910,7 +1171,9 @@ +@@ -917,7 +1181,9 @@ } public void startServerThread() { @@ -651,7 +668,7 @@ } public File d(String s) { -@@ -965,7 +1228,7 @@ +@@ -972,7 +1238,7 @@ } public String getServerModName() { @@ -660,17 +677,17 @@ } public CrashReport b(CrashReport crashreport) { -@@ -1004,7 +1267,7 @@ - } +@@ -1013,7 +1279,7 @@ + public abstract Optional q(); - public boolean J() { + public boolean K() { - return this.universe != null; + return true; // CraftBukkit } @Override -@@ -1720,4 +1983,16 @@ - private void ba() { +@@ -1729,4 +1995,16 @@ + private void bb() { Block.REGISTRY_ID.forEach(IBlockData::c); } + diff --git a/paper-server/nms-patches/MobSpawnerPatrol.patch b/paper-server/nms-patches/MobSpawnerPatrol.patch index 996a8ae579..b6dd3fe970 100644 --- a/paper-server/nms-patches/MobSpawnerPatrol.patch +++ b/paper-server/nms-patches/MobSpawnerPatrol.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MobSpawnerPatrol.java +++ b/net/minecraft/server/MobSpawnerPatrol.java -@@ -99,7 +99,7 @@ +@@ -101,7 +101,7 @@ entitymonsterpatrolling.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); entitymonsterpatrolling.prepare(world, world.getDamageScaler(blockposition), EnumMobSpawn.PATROL, (GroupDataEntity) null, (NBTTagCompound) null); diff --git a/paper-server/nms-patches/MobSpawnerTrader.patch b/paper-server/nms-patches/MobSpawnerTrader.patch index 7f0c3ef5be..ea2082bcd1 100644 --- a/paper-server/nms-patches/MobSpawnerTrader.patch +++ b/paper-server/nms-patches/MobSpawnerTrader.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MobSpawnerTrader.java +++ b/net/minecraft/server/MobSpawnerTrader.java -@@ -76,7 +76,7 @@ +@@ -78,7 +78,7 @@ return false; } @@ -9,7 +9,7 @@ if (entityvillagertrader != null) { for (int i = 0; i < 2; ++i) { -@@ -99,7 +99,7 @@ +@@ -101,7 +101,7 @@ BlockPosition blockposition = this.a(new BlockPosition(entityvillagertrader), i); if (blockposition != null) { diff --git a/paper-server/nms-patches/PlayerChunkMap.patch b/paper-server/nms-patches/PlayerChunkMap.patch index 34f403e0c4..224b382fb4 100644 --- a/paper-server/nms-patches/PlayerChunkMap.patch +++ b/paper-server/nms-patches/PlayerChunkMap.patch @@ -81,7 +81,7 @@ CompletableFuture completablefuture1 = playerchunk.getChunkSave(); if (completablefuture1 != completablefuture) { -@@ -496,7 +524,7 @@ +@@ -500,7 +528,7 @@ return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> { @@ -90,7 +90,7 @@ }); } -@@ -554,8 +582,15 @@ +@@ -558,8 +586,15 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -107,7 +107,7 @@ if (list == null) { list = Lists.newArrayList(new Entity[]{entity}); } else { -@@ -577,7 +612,7 @@ +@@ -581,7 +616,7 @@ long i = playerchunk.i().pair(); playerchunk.getClass(); @@ -116,7 +116,7 @@ }); } -@@ -594,7 +629,7 @@ +@@ -598,7 +633,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -125,7 +125,7 @@ }); completablefuture1.thenAcceptAsync((either) -> { -@@ -608,7 +643,7 @@ +@@ -612,7 +647,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -134,7 +134,7 @@ }); return completablefuture1; } -@@ -622,7 +657,7 @@ +@@ -626,7 +661,7 @@ return chunk; }); }, (runnable) -> { @@ -143,7 +143,7 @@ }); } -@@ -746,7 +781,8 @@ +@@ -751,7 +786,8 @@ return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty(); }); @@ -153,7 +153,7 @@ return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum(); }).orElse(0), optional1.map((chunk) -> { return chunk.getTileEntities().size(); -@@ -757,7 +793,7 @@ +@@ -762,7 +798,7 @@ private static String a(CompletableFuture> completablefuture) { try { @@ -162,7 +162,7 @@ return either != null ? (String) either.map((chunk) -> { return "done"; -@@ -775,7 +811,7 @@ +@@ -780,7 +816,7 @@ private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); @@ -171,7 +171,7 @@ } boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { -@@ -1109,7 +1145,7 @@ +@@ -1114,7 +1150,7 @@ public final Set trackedPlayers = Sets.newHashSet(); public EntityTracker(Entity entity, int i, int j, boolean flag) { @@ -180,7 +180,7 @@ this.tracker = entity; this.trackingDistance = i; this.e = SectionPosition.a(entity); -@@ -1162,7 +1198,7 @@ +@@ -1167,7 +1203,7 @@ public void updatePlayer(EntityPlayer entityplayer) { if (entityplayer != this.tracker) { @@ -189,7 +189,7 @@ int i = Math.min(this.b(), (PlayerChunkMap.this.viewDistance - 1) * 16); boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.tracker.a(entityplayer); -@@ -1178,6 +1214,17 @@ +@@ -1183,6 +1219,17 @@ } } diff --git a/paper-server/nms-patches/PlayerInventory.patch b/paper-server/nms-patches/PlayerInventory.patch index 3b85ccef86..5793968207 100644 --- a/paper-server/nms-patches/PlayerInventory.patch +++ b/paper-server/nms-patches/PlayerInventory.patch @@ -104,8 +104,8 @@ if (itemstack.getItem() instanceof ItemArmor) { + int finalI = i; // CraftBukkit - decompile error itemstack.damage((int) f, this.player, (entityhuman) -> { -- entityhuman.c(EnumItemSlot.a(EnumItemSlot.Function.ARMOR, i)); -+ entityhuman.c(EnumItemSlot.a(EnumItemSlot.Function.ARMOR, finalI)); // CraftBukkit - decompile error +- entityhuman.broadcastItemBreak(EnumItemSlot.a(EnumItemSlot.Function.ARMOR, i)); ++ entityhuman.broadcastItemBreak(EnumItemSlot.a(EnumItemSlot.Function.ARMOR, finalI)); // CraftBukkit - decompile error }); } } diff --git a/paper-server/nms-patches/PortalTravelAgent.patch b/paper-server/nms-patches/PortalTravelAgent.patch index 263b957471..6d1e7d0ba1 100644 --- a/paper-server/nms-patches/PortalTravelAgent.patch +++ b/paper-server/nms-patches/PortalTravelAgent.patch @@ -1,11 +1,9 @@ --- a/net/minecraft/server/PortalTravelAgent.java +++ b/net/minecraft/server/PortalTravelAgent.java -@@ -17,13 +17,20 @@ - this.b = new Random(worldserver.getSeed()); +@@ -18,12 +18,19 @@ } -- public boolean a(Entity entity, float f) { -+ public boolean a(Entity entity, float f) { // PAIL: rename to findAndTeleport + public boolean findAndTeleport(Entity entity, float f) { + // CraftBukkit start + return findAndTeleport(entity, new BlockPosition(entity), f, 128, false) != null; + } @@ -27,7 +25,7 @@ @@ -31,19 +38,26 @@ entity.setMot(vec3d2); entity.yaw = f + (float) shapedetector_shape.yaw; - entity.b(vec3d1.x, vec3d1.y, vec3d1.z); + entity.teleportAndSync(vec3d1.x, vec3d1.y, vec3d1.z); - return true; + return shapedetector_shape; // CraftBukkit - return shape } @@ -61,14 +59,13 @@ return shapedetector_shapedetectorcollection.a(enumdirection, blockposition1, d1, vec3d, d0); - }).orElse((Object) null); + }).orElse(null); // CraftBukkit - decompile error -+ } -+ -+ public boolean a(Entity entity) { // PAIL: rename to createPortal -+ // CraftBukkit start - providable position and creation radius -+ return createPortal(entity, new BlockPosition(entity), 16); } -- public boolean a(Entity entity) { + public boolean createPortal(Entity entity) { ++ // CraftBukkit start - providable position and creation radius ++ return createPortal(entity, new BlockPosition(entity), 16); ++ } ++ + public boolean createPortal(Entity entity, BlockPosition createPosition, int createRadius) { + // CraftBukkit end boolean flag = true; diff --git a/paper-server/nms-patches/ServerConnection.patch b/paper-server/nms-patches/ServerConnection.patch index 16c2e15d04..3a1503c725 100644 --- a/paper-server/nms-patches/ServerConnection.patch +++ b/paper-server/nms-patches/ServerConnection.patch @@ -11,9 +11,9 @@ + // CraftBukkit start + public void acceptConnections() { -+ synchronized (this.f) { // PAIL: listeningChannels -+ for (ChannelFuture f : this.f) { -+ f.channel().config().setAutoRead(true); ++ synchronized (this.listeningChannels) { ++ for (ChannelFuture future : this.listeningChannels) { ++ future.channel().config().setAutoRead(true); + } + } + } @@ -21,4 +21,4 @@ + public void b() { this.c = false; - Iterator iterator = this.f.iterator(); + Iterator iterator = this.listeningChannels.iterator(); diff --git a/paper-server/nms-patches/TileEntityBanner.patch b/paper-server/nms-patches/TileEntityBanner.patch index 89327c8a19..d0c2336787 100644 --- a/paper-server/nms-patches/TileEntityBanner.patch +++ b/paper-server/nms-patches/TileEntityBanner.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/TileEntityBanner.java +++ b/net/minecraft/server/TileEntityBanner.java -@@ -69,6 +69,11 @@ +@@ -70,6 +70,11 @@ } this.patterns = nbttagcompound.getList("Patterns", 10); @@ -10,5 +10,5 @@ + } + // CraftBukkit end this.h = null; - this.i = null; - this.j = null; + this.g = true; + } diff --git a/paper-server/nms-patches/TileEntityBeehive.patch b/paper-server/nms-patches/TileEntityBeehive.patch index 7a9f833bed..c37bcef098 100644 --- a/paper-server/nms-patches/TileEntityBeehive.patch +++ b/paper-server/nms-patches/TileEntityBeehive.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/TileEntityBeehive.java +++ b/net/minecraft/server/TileEntityBeehive.java -@@ -161,6 +161,7 @@ +@@ -163,6 +163,7 @@ if (!entity.getEntityType().a(TagsEntity.BEEHIVE_INHABITORS)) { return false; } else { @@ -8,7 +8,7 @@ if (entity instanceof EntityBee) { EntityBee entitybee = (EntityBee) entity; -@@ -194,7 +195,7 @@ +@@ -196,7 +197,7 @@ BlockPosition blockposition2 = this.getPosition(); this.world.playSound((EntityHuman) null, (double) blockposition2.getX(), (double) blockposition2.getY(), (double) blockposition2.getZ(), SoundEffects.BLOCK_BEEHIVE_EXIT, SoundCategory.BLOCKS, 1.0F, 1.0F); @@ -17,15 +17,15 @@ } } else { return false; -@@ -221,6 +222,11 @@ +@@ -223,6 +224,11 @@ if (this.a(iblockdata, nbttagcompound, (List) null, tileentitybeehive_releasestatus)) { iterator.remove(); } + // CraftBukkit start + else { -+ tileentitybeehive_a.b = tileentitybeehive_a.c / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable ++ tileentitybeehive_hivebee.ticksInHive = tileentitybeehive_hivebee.minOccupationTicks / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable + } + // CraftBukkit end } else { - tileentitybeehive_a.b++; + tileentitybeehive_hivebee.ticksInHive++; } diff --git a/paper-server/nms-patches/TileEntityStructure.patch b/paper-server/nms-patches/TileEntityStructure.patch deleted file mode 100644 index 9624af0d34..0000000000 --- a/paper-server/nms-patches/TileEntityStructure.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/server/TileEntityStructure.java -+++ b/net/minecraft/server/TileEntityStructure.java -@@ -18,7 +18,7 @@ - public BlockPosition size; - public EnumBlockMirror mirror; - public EnumBlockRotation rotation; -- private BlockPropertyStructureMode usageMode; -+ public BlockPropertyStructureMode usageMode; - public boolean ignoreEntities; - private boolean powered; - public boolean showAir; diff --git a/paper-server/nms-patches/World.patch b/paper-server/nms-patches/World.patch index a0fe2c98ce..0625ec541e 100644 --- a/paper-server/nms-patches/World.patch +++ b/paper-server/nms-patches/World.patch @@ -23,15 +23,6 @@ public abstract class World implements GeneratorAccess, AutoCloseable { protected static final Logger LOGGER = LogManager.getLogger(); -@@ -22,7 +38,7 @@ - public final List tileEntityListTick = Lists.newArrayList(); - protected final List tileEntityListPending = Lists.newArrayList(); - protected final List tileEntityListUnload = Lists.newArrayList(); -- private final Thread serverThread; -+ final Thread serverThread; // CraftBukkit - package private // PAIL - private int c; - protected int i = (new Random()).nextInt(); - protected final int j = 1013904223; @@ -40,7 +56,51 @@ private final WorldBorder worldBorder; private final BiomeManager biomeManager; diff --git a/paper-server/nms-patches/WorldData.patch b/paper-server/nms-patches/WorldData.patch index d6f6f2a872..fc6f6ffab1 100644 --- a/paper-server/nms-patches/WorldData.patch +++ b/paper-server/nms-patches/WorldData.patch @@ -12,15 +12,15 @@ public class WorldData { -@@ -68,6 +73,7 @@ - private UUID W; - private final GameRules X; - private final CustomFunctionCallbackTimerQueue Y; +@@ -70,6 +75,7 @@ + private boolean Y; + private final GameRules Z; + private final CustomFunctionCallbackTimerQueue aa; + public WorldServer world; // CraftBukkit protected WorldData() { this.f = WorldType.NORMAL; -@@ -419,6 +425,7 @@ +@@ -436,6 +442,7 @@ nbttagcompound.setString("WanderingTraderId", this.W.toString()); } @@ -28,7 +28,7 @@ } public long getSeed() { -@@ -511,6 +518,20 @@ +@@ -528,6 +535,20 @@ } public void setThundering(boolean flag) { @@ -49,7 +49,7 @@ this.thundering = flag; } -@@ -527,6 +548,20 @@ +@@ -544,6 +565,20 @@ } public void setStorm(boolean flag) { @@ -70,7 +70,7 @@ this.raining = flag; } -@@ -676,6 +711,12 @@ +@@ -693,6 +728,12 @@ public void setDifficulty(EnumDifficulty enumdifficulty) { this.F = enumdifficulty; @@ -83,14 +83,14 @@ } public boolean isDifficultyLocked() { -@@ -780,4 +821,12 @@ - public void a(UUID uuid) { - this.W = uuid; +@@ -808,4 +849,12 @@ + this.X.add(s); + this.Y |= flag; } + + // CraftBukkit start - Check if the name stored in NBT is the correct one -+ public void checkName( String name ) { -+ if ( !this.levelName.equals( name ) ) { ++ public void checkName(String name) { ++ if (!this.levelName.equals(name)) { + this.levelName = name; + } + } diff --git a/paper-server/nms-patches/WorldGenStronghold.patch b/paper-server/nms-patches/WorldGenStronghold.patch deleted file mode 100644 index 3c29071576..0000000000 --- a/paper-server/nms-patches/WorldGenStronghold.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/server/WorldGenStronghold.java -+++ b/net/minecraft/server/WorldGenStronghold.java -@@ -67,7 +67,7 @@ - - @Nullable - @Override -- public BlockPosition getNearestGeneratedFeature(World world, ChunkGenerator chunkgenerator, BlockPosition blockposition, int i, boolean flag) { -+ public synchronized BlockPosition getNearestGeneratedFeature(World world, ChunkGenerator chunkgenerator, BlockPosition blockposition, int i, boolean flag) { // CraftBukkit - synchronized - if (!chunkgenerator.getWorldChunkManager().a(this)) { - return null; - } else { diff --git a/paper-server/nms-patches/WorldGenTreeProvider.patch b/paper-server/nms-patches/WorldGenTreeProvider.patch index 9deab7676c..4dd6108737 100644 --- a/paper-server/nms-patches/WorldGenTreeProvider.patch +++ b/paper-server/nms-patches/WorldGenTreeProvider.patch @@ -1,14 +1,14 @@ --- a/net/minecraft/server/WorldGenTreeProvider.java +++ b/net/minecraft/server/WorldGenTreeProvider.java -@@ -2,6 +2,7 @@ - +@@ -3,6 +3,7 @@ + import java.util.Iterator; import java.util.Random; import javax.annotation.Nullable; +import org.bukkit.TreeType; // CraftBukkit public abstract class WorldGenTreeProvider { -@@ -16,6 +17,7 @@ +@@ -17,6 +18,7 @@ if (worldgenfeatureconfigured == null) { return false; } else { @@ -16,14 +16,14 @@ generatoraccess.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 4); ((WorldGenFeatureSmallTreeConfigurationConfiguration) worldgenfeatureconfigured.c).a(); if (worldgenfeatureconfigured.a(generatoraccess, chunkgenerator, random, blockposition)) { -@@ -26,4 +28,46 @@ - } - } +@@ -43,4 +45,46 @@ + + return true; } + + // CraftBukkit start + protected void setTreeType(WorldGenFeatureConfigured worldgentreeabstract) { -+ if (worldgentreeabstract.c == BiomeDecoratorGroups.NORMAL_TREE) { ++ if (worldgentreeabstract.c == BiomeDecoratorGroups.NORMAL_TREE || worldgentreeabstract.c == BiomeDecoratorGroups.NORMAL_TREE_BEES_005) { + BlockSapling.treeType = TreeType.TREE; + } else if (worldgentreeabstract.c == BiomeDecoratorGroups.HUGE_RED_MUSHROOM) { + BlockSapling.treeType = TreeType.RED_MUSHROOM; @@ -39,13 +39,13 @@ + BlockSapling.treeType = TreeType.REDWOOD; + } else if (worldgentreeabstract.c == BiomeDecoratorGroups.ACACIA_TREE) { + BlockSapling.treeType = TreeType.ACACIA; -+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.BIRCH_TREE) { ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.BIRCH_TREE || worldgentreeabstract.c == BiomeDecoratorGroups.BIRCH_TREE_BEES_005) { + BlockSapling.treeType = TreeType.BIRCH; -+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.TALL_BIRCH_TREE) { ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.TALL_BIRCH_TREE_BEES_0002) { + BlockSapling.treeType = TreeType.TALL_BIRCH; + } else if (worldgentreeabstract.c == BiomeDecoratorGroups.SWAMP_TREE) { + BlockSapling.treeType = TreeType.SWAMP; -+ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.FANCY_TREE) { ++ } else if (worldgentreeabstract.c == BiomeDecoratorGroups.FANCY_TREE || worldgentreeabstract.c == BiomeDecoratorGroups.FANCY_TREE_BEES_005) { + BlockSapling.treeType = TreeType.BIG_TREE; + } else if (worldgentreeabstract.c == BiomeDecoratorGroups.JUNGLE_BUSH) { + BlockSapling.treeType = TreeType.JUNGLE_BUSH; diff --git a/paper-server/nms-patches/WorldServer.patch b/paper-server/nms-patches/WorldServer.patch index 8334d76e04..fd0286bc06 100644 --- a/paper-server/nms-patches/WorldServer.patch +++ b/paper-server/nms-patches/WorldServer.patch @@ -134,11 +134,11 @@ this.getWorldData().setDifficulty(EnumDifficulty.HARD); } - if (this.C && this.players.stream().noneMatch((entityplayer) -> { + if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> { - return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping(); + return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit })) { -- this.C = false; +- this.everyoneSleeping = false; + // CraftBukkit start + long l = this.worldData.getDayTime() + 24000L; + TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime()); @@ -152,10 +152,10 @@ - this.setDayTime(l - l % 24000L); } -- this.ab(); +- this.wakeupPlayers(); + if (!event.isCancelled()) { -+ this.C = false; -+ this.ab(); ++ this.everyoneSleeping = false; ++ this.wakeupPlayers(); + } + // CraftBukkit end if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) { @@ -201,7 +201,7 @@ @@ -312,7 +412,7 @@ } - private void ab() { + private void wakeupPlayers() { - ((List) this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { + (this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { // CraftBukkit - decompile error entityplayer.wakeup(false, false); @@ -277,15 +277,15 @@ } public void resetEmptyTime() { -@@ -490,6 +602,7 @@ - return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString(); +@@ -493,6 +605,7 @@ }); + gameprofilerfiller.c("tickNonPassenger"); entity.tick(); + entity.postTick(); // CraftBukkit - this.getMethodProfiler().exit(); + gameprofilerfiller.exit(); } -@@ -573,6 +686,22 @@ +@@ -583,6 +696,22 @@ BlockPosition blockposition = worldchunkmanager.a(0, this.getSeaLevel(), 0, 256, list, random); ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); @@ -308,7 +308,7 @@ if (blockposition == null) { WorldServer.LOGGER.warn("Unable to find spawn biome"); } -@@ -625,7 +754,7 @@ +@@ -635,7 +764,7 @@ } protected void g() { @@ -317,7 +317,7 @@ worldgenfeatureconfigured.a(this, this.getChunkProvider().getChunkGenerator(), this.random, new BlockPosition(this.worldData.b(), this.worldData.c(), this.worldData.d())); } -@@ -639,6 +768,7 @@ +@@ -649,6 +778,7 @@ ChunkProviderServer chunkproviderserver = this.getChunkProvider(); if (!flag1) { @@ -325,7 +325,7 @@ if (iprogressupdate != null) { iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); } -@@ -650,6 +780,15 @@ +@@ -660,6 +790,15 @@ chunkproviderserver.save(flag); } @@ -341,7 +341,7 @@ } protected void m_() throws ExceptionWorldConflict { -@@ -721,7 +860,8 @@ +@@ -731,7 +870,8 @@ if (entity instanceof EntityInsentient) { EntityInsentient entityinsentient = (EntityInsentient) entity; @@ -351,7 +351,7 @@ continue; } } -@@ -738,11 +878,24 @@ +@@ -748,11 +888,24 @@ @Override public boolean addEntity(Entity entity) { @@ -378,7 +378,7 @@ } public void addEntityTeleport(Entity entity) { -@@ -792,13 +945,18 @@ +@@ -802,13 +955,18 @@ this.registerEntity(entityplayer); } @@ -399,7 +399,7 @@ IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer); if (!(ichunkaccess instanceof Chunk)) { -@@ -826,7 +984,7 @@ +@@ -836,7 +994,7 @@ if (entity1 == null) { return false; } else { @@ -408,7 +408,7 @@ return true; } } -@@ -877,10 +1035,17 @@ +@@ -887,10 +1045,17 @@ } this.getScoreboard().a(entity); @@ -426,7 +426,7 @@ } private void registerEntity(Entity entity) { -@@ -901,9 +1066,16 @@ +@@ -911,9 +1076,16 @@ this.entitiesByUUID.put(entity.getUniqueID(), entity); this.getChunkProvider().addEntity(entity); @@ -443,7 +443,7 @@ } } -@@ -934,6 +1106,18 @@ +@@ -944,6 +1116,18 @@ } public void strikeLightning(EntityLightning entitylightning) { @@ -462,7 +462,7 @@ this.globalEntityList.add(entitylightning); this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning)); } -@@ -942,6 +1126,12 @@ +@@ -952,6 +1136,12 @@ public void a(int i, BlockPosition blockposition, int j) { Iterator iterator = this.server.getPlayerList().getPlayers().iterator(); @@ -475,7 +475,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); -@@ -950,6 +1140,12 @@ +@@ -960,6 +1150,12 @@ double d1 = (double) blockposition.getY() - entityplayer.locY(); double d2 = (double) blockposition.getZ() - entityplayer.locZ(); @@ -488,7 +488,7 @@ if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); } -@@ -1010,6 +1206,14 @@ +@@ -1020,6 +1216,14 @@ @Override public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) { @@ -503,7 +503,7 @@ Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect); if (damagesource != null) { -@@ -1018,6 +1222,8 @@ +@@ -1028,6 +1232,8 @@ explosion.a(); explosion.a(false); @@ -512,7 +512,7 @@ if (explosion_effect == Explosion.Effect.NONE) { explosion.clearBlocks(); } -@@ -1082,13 +1288,20 @@ +@@ -1092,13 +1298,20 @@ } public int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { @@ -535,7 +535,7 @@ ++j; } } -@@ -1170,7 +1383,13 @@ +@@ -1180,7 +1393,13 @@ @Override public WorldMap a(String s) { return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> { diff --git a/paper-server/pom.xml b/paper-server/pom.xml index 99d738b70a..2d7d7a09e1 100644 --- a/paper-server/pom.xml +++ b/paper-server/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.15.1-R0.1-SNAPSHOT + 1.15.2-R0.1-SNAPSHOT CraftBukkit https://www.spigotmc.org/ @@ -12,7 +12,7 @@ true UTF-8 unknown - 1.15.1 + 1.15.2 1_15_R1 git-Bukkit- @@ -43,7 +43,7 @@ org.ow2.asm asm - 7.2 + 7.3.1 compile @@ -56,7 +56,7 @@ org.xerial sqlite-jdbc - 3.28.0 + 3.30.1 runtime @@ -69,7 +69,7 @@ junit junit - 4.12 + 4.13 test diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 5173c2d451..3b78900c15 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -718,7 +718,7 @@ public class CraftWorld implements World { break; case TALL_BIRCH: gen = WorldGenerator.NORMAL_TREE; - conf = BiomeDecoratorGroups.TALL_BIRCH_TREE; + conf = BiomeDecoratorGroups.TALL_BIRCH_TREE_BEES_0002; break; case CHORUS_PLANT: ((BlockChorusFlower) Blocks.CHORUS_FLOWER).a(world, pos, rand, 8); @@ -1886,7 +1886,7 @@ public class CraftWorld implements World { @Override public void setHardcore(boolean hardcore) { - world.getWorldData().g(hardcore); + world.getWorldData().setHardcore(hardcore); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java index c474e02f03..4101ced012 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java @@ -112,6 +112,7 @@ public class Main { acceptsAll(asList("forceUpgrade"), "Whether to force a world upgrade"); acceptsAll(asList("eraseCache"), "Whether to force cache erase during world upgrade"); + acceptsAll(asList("nogui"), "Disables the graphical console"); acceptsAll(asList("nojline"), "Disables jline and emulates the vanilla console"); @@ -177,7 +178,7 @@ public class Main { useConsole = false; } - if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { + if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { Date buildDate = new SimpleDateFormat("yyyyMMdd-HHmm").parse(Main.class.getPackage().getImplementationVendor()); Calendar deadline = Calendar.getInstance(); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java index b6b41dbeec..0b73a44860 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java @@ -69,7 +69,7 @@ public class CraftFox extends CraftAnimals implements Fox { @Override public AnimalTamer getFirstTrustedPlayer() { - UUID uuid = getHandle().getDataWatcher().get(EntityFox.by).orElse(null); + UUID uuid = getHandle().getDataWatcher().get(EntityFox.FIRST_TRUSTED_PLAYER).orElse(null); if (uuid == null) { return null; } @@ -84,16 +84,16 @@ public class CraftFox extends CraftAnimals implements Fox { @Override public void setFirstTrustedPlayer(AnimalTamer player) { - if (player == null && getHandle().getDataWatcher().get(EntityFox.bz).isPresent()) { + if (player == null && getHandle().getDataWatcher().get(EntityFox.SECOND_TRUSTED_PLAYER).isPresent()) { throw new IllegalStateException("Must remove second trusted player first"); } - getHandle().getDataWatcher().set(EntityFox.by, player == null ? Optional.empty() : Optional.of(player.getUniqueId())); + getHandle().getDataWatcher().set(EntityFox.FIRST_TRUSTED_PLAYER, player == null ? Optional.empty() : Optional.of(player.getUniqueId())); } @Override public AnimalTamer getSecondTrustedPlayer() { - UUID uuid = getHandle().getDataWatcher().get(EntityFox.bz).orElse(null); + UUID uuid = getHandle().getDataWatcher().get(EntityFox.SECOND_TRUSTED_PLAYER).orElse(null); if (uuid == null) { return null; } @@ -108,10 +108,10 @@ public class CraftFox extends CraftAnimals implements Fox { @Override public void setSecondTrustedPlayer(AnimalTamer player) { - if (player != null && !getHandle().getDataWatcher().get(EntityFox.by).isPresent()) { + if (player != null && !getHandle().getDataWatcher().get(EntityFox.FIRST_TRUSTED_PLAYER).isPresent()) { throw new IllegalStateException("Must add first trusted player first"); } - getHandle().getDataWatcher().set(EntityFox.bz, player == null ? Optional.empty() : Optional.of(player.getUniqueId())); + getHandle().getDataWatcher().set(EntityFox.SECOND_TRUSTED_PLAYER, player == null ? Optional.empty() : Optional.of(player.getUniqueId())); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java index b9529ec7a6..d68a84a17e 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java @@ -52,11 +52,11 @@ public abstract class CraftRaider extends CraftMonster implements Raider { @Override public boolean isCanJoinRaid() { - return getHandle().eD(); + return getHandle().isCanJoinRaid(); } @Override public void setCanJoinRaid(boolean join) { - getHandle().u(join); + getHandle().setCanJoinRaid(join); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java index c7f9424549..f3558c945a 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -188,7 +188,7 @@ public class CraftInventoryCustom extends CraftInventory { } @Override - public boolean isNotEmpty() { + public boolean isEmpty() { Iterator iterator = this.items.iterator(); ItemStack itemstack; diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java index adad3a0fa7..1860fbb1bb 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -188,7 +188,7 @@ public final class CraftMagicNumbers implements UnsafeValues { * @return string */ public String getMappingsVersion() { - return "d2fa25e37d6e69667dc7f4a33d7644e1"; + return "5684afcc1835d966e1b6eb0ed3f72edb"; } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java index 99564fed7c..12c9273e01 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java @@ -28,7 +28,7 @@ public class TerminalConsoleWriterThread extends Thread { // Using name from log4j config in vanilla jar while (true) { - message = QueueLogAppender.getNextLogEvent("TerminalConsole"); + message = QueueLogAppender.getNextLogEvent("ServerGuiConsole"); if (message == null) { continue; } diff --git a/paper-server/src/main/resources/log4j2.xml b/paper-server/src/main/resources/log4j2.xml index d997ef583f..3893c88495 100644 --- a/paper-server/src/main/resources/log4j2.xml +++ b/paper-server/src/main/resources/log4j2.xml @@ -1,9 +1,11 @@ - - + + + + @@ -19,10 +21,9 @@ - + - + -