From 667cb321150d7233fab8ad0bf1b2ee60ae491a53 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 11 Dec 2021 00:11:02 +1100 Subject: [PATCH] Update to Minecraft 1.18.1 By: md_5 --- .../net/minecraft/server/Main.patch | 2 +- .../server/level/PlayerChunkMap.patch | 18 ++-- .../minecraft/server/level/WorldServer.patch | 68 ++++++------ .../server/network/PlayerConnection.patch | 100 +++++++++--------- .../world/inventory/ContainerBeacon.patch | 12 +-- .../net/minecraft/world/item/ItemStack.patch | 20 ++-- .../block/entity/TileEntityBeehive.patch | 24 ++--- paper-server/pom.xml | 2 +- .../java/org/bukkit/craftbukkit/Main.java | 4 +- .../craftbukkit/util/CraftMagicNumbers.java | 2 +- 10 files changed, 125 insertions(+), 127 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/server/Main.patch b/paper-server/nms-patches/net/minecraft/server/Main.patch index 1ce8885029..676a92a49b 100644 --- a/paper-server/nms-patches/net/minecraft/server/Main.patch +++ b/paper-server/nms-patches/net/minecraft/server/Main.patch @@ -12,7 +12,7 @@ + public class Main { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOGGER; @@ -63,8 +69,9 @@ public Main() {} diff --git a/paper-server/nms-patches/net/minecraft/server/level/PlayerChunkMap.patch b/paper-server/nms-patches/net/minecraft/server/level/PlayerChunkMap.patch index 7de381724a..f91a56caed 100644 --- a/paper-server/nms-patches/net/minecraft/server/level/PlayerChunkMap.patch +++ b/paper-server/nms-patches/net/minecraft/server/level/PlayerChunkMap.patch @@ -40,7 +40,7 @@ public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier supplier, int i, boolean flag) { super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag); this.visibleChunkMap = this.updatingChunkMap.clone(); -@@ -329,9 +355,12 @@ +@@ -291,9 +317,12 @@ CompletableFuture>> completablefuture1 = SystemUtils.sequence(list); CompletableFuture, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> { List list3 = Lists.newArrayList(); @@ -55,7 +55,7 @@ final Either either = (Either) iterator.next(); Optional optional = either.left(); -@@ -501,7 +530,7 @@ +@@ -463,7 +492,7 @@ private void scheduleUnload(long i, PlayerChunk playerchunk) { CompletableFuture completablefuture = playerchunk.getChunkToSave(); @@ -64,7 +64,7 @@ CompletableFuture completablefuture1 = playerchunk.getChunkToSave(); if (completablefuture1 != completablefuture) { -@@ -680,7 +709,21 @@ +@@ -642,7 +671,21 @@ private static void postLoadProtoChunk(WorldServer worldserver, List list) { if (!list.isEmpty()) { @@ -87,7 +87,7 @@ } } -@@ -778,7 +821,7 @@ +@@ -740,7 +783,7 @@ if (!playerchunk.wasAccessibleSinceLastSave()) { return false; } else { @@ -96,7 +96,7 @@ if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) { return false; -@@ -927,7 +970,8 @@ +@@ -890,7 +933,8 @@ return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty(); }); @@ -106,7 +106,7 @@ return chunk.getBlockEntities().size(); }).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> { return chunk.getBlockTicks().count(); -@@ -940,7 +984,7 @@ +@@ -903,7 +947,7 @@ private static String printFuture(CompletableFuture> completablefuture) { try { @@ -115,7 +115,7 @@ return either != null ? (String) either.map((chunk) -> { return "done"; -@@ -958,7 +1002,7 @@ +@@ -921,7 +965,7 @@ private NBTTagCompound readChunk(ChunkCoordIntPair chunkcoordintpair) throws IOException { NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); @@ -124,7 +124,7 @@ } boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) { -@@ -1382,7 +1426,7 @@ +@@ -1342,7 +1386,7 @@ public final Set seenBy = Sets.newIdentityHashSet(); public EntityTracker(Entity entity, int i, int j, boolean flag) { @@ -133,7 +133,7 @@ this.entity = entity; this.range = i; this.lastSectionPos = SectionPosition.of(entity); -@@ -1435,12 +1479,17 @@ +@@ -1395,12 +1439,17 @@ public void updatePlayer(EntityPlayer entityplayer) { if (entityplayer != this.entity) { diff --git a/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch b/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch index 241087a92a..cd644c49f6 100644 --- a/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch +++ b/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/WorldServer.java +++ b/net/minecraft/server/level/WorldServer.java -@@ -147,6 +147,20 @@ +@@ -149,6 +149,20 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -21,7 +21,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0); -@@ -164,7 +178,7 @@ +@@ -166,7 +180,7 @@ final List players; private final ChunkProviderServer chunkSource; private final MinecraftServer server; @@ -30,7 +30,7 @@ final EntityTickList entityTickList; public final PersistentEntitySectionManager entityManager; public boolean noSave; -@@ -186,9 +200,29 @@ +@@ -189,9 +203,29 @@ private final StructureCheck structureCheck; private final boolean tickTime; @@ -63,7 +63,7 @@ this.players = Lists.newArrayList(); this.entityTickList = new EntityTickList(); this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier()); -@@ -200,7 +234,13 @@ +@@ -203,7 +237,13 @@ this.tickTime = flag1; this.server = minecraftserver; this.customSpawners = list; @@ -78,7 +78,7 @@ boolean flag2 = minecraftserver.forceSynchronousWrites(); DataFixer datafixer = minecraftserver.getFixerUpper(); EntityPersistentStorage entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver); -@@ -231,14 +271,15 @@ +@@ -234,14 +274,15 @@ long l = minecraftserver.getWorldData().worldGenSettings().seed(); this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer); @@ -96,7 +96,7 @@ } public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) { -@@ -270,12 +311,20 @@ +@@ -273,12 +314,20 @@ long j; if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { @@ -120,7 +120,7 @@ if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) { this.resetWeatherCycle(); } -@@ -301,7 +350,7 @@ +@@ -304,7 +353,7 @@ this.runBlockEvents(); this.handlingTick = false; gameprofilerfiller.pop(); @@ -129,7 +129,7 @@ if (flag) { this.resetEmptyTime(); -@@ -317,7 +366,7 @@ +@@ -320,7 +369,7 @@ this.entityTickList.forEach((entity) -> { if (!entity.isRemoved()) { @@ -138,7 +138,7 @@ entity.discard(); } else { gameprofilerfiller.push("checkDespawn"); -@@ -389,7 +438,7 @@ +@@ -392,7 +441,7 @@ private void wakeUpAllPlayers() { this.sleepStatus.removeAllSleepers(); @@ -147,7 +147,7 @@ entityplayer.stopSleepInBed(false, false); }); } -@@ -416,14 +465,14 @@ +@@ -419,14 +468,14 @@ entityhorseskeleton.setTrap(true); entityhorseskeleton.setAge(0); entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); @@ -164,7 +164,7 @@ } } -@@ -434,12 +483,12 @@ +@@ -437,12 +486,12 @@ BiomeBase biomebase = this.getBiome(blockposition); if (biomebase.shouldFreeze(this, blockposition1)) { @@ -179,7 +179,7 @@ } IBlockData iblockdata = this.getBlockState(blockposition1); -@@ -635,6 +684,7 @@ +@@ -638,6 +687,7 @@ this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F); } @@ -187,7 +187,7 @@ if (this.oRainLevel != this.rainLevel) { this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension()); } -@@ -653,14 +703,47 @@ +@@ -656,14 +706,47 @@ this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel)); this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel)); } @@ -237,7 +237,7 @@ } public void resetEmptyTime() { -@@ -695,6 +778,7 @@ +@@ -698,6 +781,7 @@ }); gameprofilerfiller.incrementCounter("tickNonPassenger"); entity.tick(); @@ -245,7 +245,7 @@ this.getProfiler().pop(); Iterator iterator = entity.getPassengers().iterator(); -@@ -718,6 +802,7 @@ +@@ -721,6 +805,7 @@ }); gameprofilerfiller.incrementCounter("tickPassenger"); entity1.rideTick(); @@ -253,7 +253,7 @@ gameprofilerfiller.pop(); Iterator iterator = entity1.getPassengers().iterator(); -@@ -742,6 +827,7 @@ +@@ -745,6 +830,7 @@ ChunkProviderServer chunkproviderserver = this.getChunkSource(); if (!flag1) { @@ -261,7 +261,7 @@ if (iprogressupdate != null) { iprogressupdate.progressStartNoAbort(new ChatMessage("menu.savingLevel")); } -@@ -759,11 +845,19 @@ +@@ -762,11 +848,19 @@ } } @@ -282,7 +282,7 @@ } this.getChunkSource().getDataStorage().save(); -@@ -809,15 +903,34 @@ +@@ -812,15 +906,34 @@ @Override public boolean addFreshEntity(Entity entity) { @@ -320,7 +320,7 @@ } public void addDuringCommandTeleport(EntityPlayer entityplayer) { -@@ -848,24 +961,36 @@ +@@ -851,24 +964,36 @@ this.entityManager.addNewEntity(entityplayer); } @@ -361,7 +361,7 @@ return true; } } -@@ -879,10 +1004,32 @@ +@@ -882,10 +1007,32 @@ entityplayer.remove(entity_removalreason); } @@ -394,7 +394,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); -@@ -891,6 +1038,12 @@ +@@ -894,6 +1041,12 @@ double d1 = (double) blockposition.getY() - entityplayer.getY(); double d2 = (double) blockposition.getZ() - entityplayer.getZ(); @@ -407,7 +407,7 @@ if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); } -@@ -938,7 +1091,18 @@ +@@ -948,7 +1101,18 @@ Iterator iterator = this.navigatingMobs.iterator(); while (iterator.hasNext()) { @@ -426,8 +426,8 @@ + // CraftBukkit end NavigationAbstract navigationabstract = entityinsentient.getNavigation(); - if (!navigationabstract.hasDelayedRecomputation()) { -@@ -961,10 +1125,20 @@ + if (navigationabstract.shouldRecomputePath(blockposition)) { +@@ -984,10 +1148,20 @@ @Override public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) { @@ -448,7 +448,7 @@ if (explosion_effect == Explosion.Effect.NONE) { explosion.clearToBlow(); } -@@ -1045,13 +1219,20 @@ +@@ -1068,13 +1242,20 @@ } public int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { @@ -471,7 +471,7 @@ ++j; } } -@@ -1102,7 +1283,7 @@ +@@ -1125,7 +1306,7 @@ @Nullable public BlockPosition findNearestMapFeature(StructureGenerator structuregenerator, BlockPosition blockposition, int i, boolean flag) { @@ -480,7 +480,7 @@ } @Nullable -@@ -1139,11 +1320,21 @@ +@@ -1162,11 +1343,21 @@ @Nullable @Override public WorldMap getMapData(String s) { @@ -503,7 +503,7 @@ this.getServer().overworld().getDataStorage().set(s, worldmap); } -@@ -1455,6 +1646,11 @@ +@@ -1478,6 +1669,11 @@ @Override public void blockUpdated(BlockPosition blockposition, Block block) { if (!this.isDebug()) { @@ -515,7 +515,7 @@ this.updateNeighborsAt(blockposition, block); } -@@ -1474,12 +1670,12 @@ +@@ -1497,12 +1693,12 @@ } public boolean isFlat() { @@ -530,7 +530,7 @@ } @Nullable -@@ -1507,7 +1703,7 @@ +@@ -1530,7 +1726,7 @@ private static String getTypeCount(Iterable iterable, Function function) { try { Object2IntOpenHashMap object2intopenhashmap = new Object2IntOpenHashMap(); @@ -539,7 +539,7 @@ while (iterator.hasNext()) { T t0 = iterator.next(); -@@ -1516,7 +1712,7 @@ +@@ -1539,7 +1735,7 @@ object2intopenhashmap.addTo(s, 1); } @@ -548,7 +548,7 @@ String s1 = (String) entry.getKey(); return s1 + ":" + entry.getIntValue(); -@@ -1527,17 +1723,33 @@ +@@ -1550,17 +1746,33 @@ } public static void makeObsidianPlatform(WorldServer worldserver) { @@ -584,7 +584,7 @@ } @Override -@@ -1632,6 +1844,7 @@ +@@ -1666,6 +1878,7 @@ } } @@ -592,7 +592,7 @@ } public void onTrackingEnd(Entity entity) { -@@ -1664,6 +1877,14 @@ +@@ -1707,6 +1920,14 @@ gameeventlistenerregistrar.onListenerRemoved(entity.level); } diff --git a/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch b/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch index db3d23e078..c7a5af96c0 100644 --- a/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch +++ b/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch @@ -74,9 +74,9 @@ private int dropSpamTickCount; private double firstGoodX; private double firstGoodY; -@@ -201,7 +259,33 @@ - this.player = entityplayer; +@@ -202,7 +260,33 @@ entityplayer.connection = this; + this.keepAliveTime = SystemUtils.getMillis(); entityplayer.getTextFilter().join(); + + // CraftBukkit start - add fields and methods @@ -108,7 +108,7 @@ public void tick() { this.resetPosition(); -@@ -250,7 +334,7 @@ +@@ -251,7 +335,7 @@ this.server.getProfiler().push("keepAlive"); long i = SystemUtils.getMillis(); @@ -117,7 +117,7 @@ if (this.keepAlivePending) { this.disconnect(new ChatMessage("disconnect.timeout")); } else { -@@ -262,15 +346,21 @@ +@@ -263,15 +347,21 @@ } this.server.getProfiler().pop(); @@ -139,7 +139,7 @@ this.disconnect(new ChatMessage("multiplayer.disconnect.idling")); } -@@ -294,16 +384,46 @@ +@@ -295,16 +385,46 @@ return this.server.isSingleplayerOwner(this.player.getGameProfile()); } @@ -187,7 +187,7 @@ } private void filterTextPacket(T t0, Consumer consumer, BiFunction> bifunction) { -@@ -370,7 +490,34 @@ +@@ -371,7 +491,34 @@ double d9 = entity.getDeltaMovement().lengthSqr(); double d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -223,7 +223,7 @@ PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName().getString(), this.player.getName().getString(), d6, d7, d8); this.connection.send(new PacketPlayOutVehicleMove(entity)); return; -@@ -400,14 +547,72 @@ +@@ -401,14 +548,72 @@ } entity.absMoveTo(d3, d4, d5, f, f1); @@ -296,7 +296,7 @@ this.player.getLevel().getChunkSource().move(this.player); this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2); this.clientVehicleIsFloating = d11 >= -0.03125D && !this.server.isFlightAllowed() && this.noBlocksAround(entity); -@@ -426,7 +631,7 @@ +@@ -427,7 +632,7 @@ @Override public void handleAcceptTeleportPacket(PacketPlayInTeleportAccept packetplayinteleportaccept) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinteleportaccept, this, this.player.getLevel()); @@ -305,7 +305,7 @@ this.player.absMoveTo(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); this.lastGoodX = this.awaitingPositionFromClient.x; this.lastGoodY = this.awaitingPositionFromClient.y; -@@ -436,6 +641,7 @@ +@@ -437,6 +642,7 @@ } this.awaitingPositionFromClient = null; @@ -313,7 +313,7 @@ } } -@@ -443,7 +649,7 @@ +@@ -444,7 +650,7 @@ @Override public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.getLevel()); @@ -322,7 +322,7 @@ RecipeBookServer recipebookserver = this.player.getRecipeBook(); Objects.requireNonNull(recipebookserver); -@@ -473,6 +679,12 @@ +@@ -474,6 +680,12 @@ @Override public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.getLevel()); @@ -335,7 +335,7 @@ StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand()); if (stringreader.canRead() && stringreader.peek() == '/') { -@@ -482,6 +694,7 @@ +@@ -483,6 +695,7 @@ ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -343,7 +343,7 @@ this.connection.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions)); }); } -@@ -714,6 +927,7 @@ +@@ -715,6 +928,7 @@ if (container instanceof ContainerMerchant) { ContainerMerchant containermerchant = (ContainerMerchant) container; @@ -351,7 +351,7 @@ containermerchant.setSelectionHint(i); containermerchant.tryMoveItems(i); -@@ -723,6 +937,13 @@ +@@ -724,6 +938,13 @@ @Override public void handleEditBook(PacketPlayInBEdit packetplayinbedit) { @@ -365,7 +365,7 @@ int i = packetplayinbedit.getSlot(); if (PlayerInventory.isHotbarSlot(i) || i == 40) { -@@ -731,7 +952,7 @@ +@@ -732,7 +953,7 @@ Objects.requireNonNull(list); optional.ifPresent(list::add); @@ -374,7 +374,7 @@ Objects.requireNonNull(list); stream.forEach(list::add); -@@ -747,7 +968,7 @@ +@@ -748,7 +969,7 @@ ItemStack itemstack = this.player.getInventory().getItem(i); if (itemstack.is(Items.WRITABLE_BOOK)) { @@ -383,7 +383,7 @@ } } -@@ -772,16 +993,16 @@ +@@ -773,16 +994,16 @@ this.updateBookPages(list, (s) -> { return IChatBaseComponent.ChatSerializer.toJson(new ChatComponentText(s)); @@ -404,7 +404,7 @@ return NBTTagString.valueOf((String) unaryoperator.apply(itextfilter_a.getFiltered())); }); -@@ -809,6 +1030,7 @@ +@@ -810,6 +1031,7 @@ } itemstack.addTagElement("pages", nbttaglist); @@ -412,7 +412,7 @@ } @Override -@@ -845,7 +1067,7 @@ +@@ -846,7 +1068,7 @@ } else { WorldServer worldserver = this.player.getLevel(); @@ -421,7 +421,7 @@ if (this.tickCount == 0) { this.resetPosition(); } -@@ -855,7 +1077,7 @@ +@@ -856,7 +1078,7 @@ this.awaitingTeleportTime = this.tickCount; this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); } @@ -430,7 +430,7 @@ } else { this.awaitingTeleportTime = this.tickCount; double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX())); -@@ -867,7 +1089,15 @@ +@@ -868,7 +1090,15 @@ if (this.player.isPassenger()) { this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1); this.player.getLevel().getChunkSource().move(this.player); @@ -446,7 +446,7 @@ double d3 = this.player.getX(); double d4 = this.player.getY(); double d5 = this.player.getZ(); -@@ -887,15 +1117,33 @@ +@@ -888,15 +1118,33 @@ ++this.receivedMovePacketCount; int i = this.receivedMovePacketCount - this.knownMovePacketCount; @@ -482,7 +482,7 @@ PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d7, d8, d9); this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot()); return; -@@ -914,6 +1162,7 @@ +@@ -915,6 +1163,7 @@ } this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); @@ -490,7 +490,7 @@ double d12 = d8; d7 = d0 - this.player.getX(); -@@ -935,7 +1184,71 @@ +@@ -936,7 +1185,71 @@ if (!this.player.noPhysics && !this.player.isSleeping() && (flag1 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb))) { this.teleport(d3, d4, d5, f, f1); } else { @@ -563,7 +563,7 @@ this.player.getLevel().getChunkSource().move(this.player); this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround()); this.player.setOnGround(packetplayinflying.isOnGround()); -@@ -973,19 +1286,80 @@ +@@ -974,19 +1287,80 @@ return true; } @@ -648,7 +648,7 @@ double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.getX() : 0.0D; double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.getY() : 0.0D; double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.getZ() : 0.0D; -@@ -997,6 +1371,14 @@ +@@ -998,6 +1372,14 @@ this.awaitingTeleport = 0; } @@ -663,7 +663,7 @@ this.awaitingTeleportTime = this.tickCount; this.player.absMoveTo(d0, d1, d2, f, f1); this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag)); -@@ -1005,6 +1387,7 @@ +@@ -1006,6 +1388,7 @@ @Override public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.getLevel()); @@ -671,7 +671,7 @@ BlockPosition blockposition = packetplayinblockdig.getPos(); this.player.resetLastActionTime(); -@@ -1015,14 +1398,46 @@ +@@ -1016,14 +1399,46 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND); @@ -720,7 +720,7 @@ this.player.drop(false); } -@@ -1059,6 +1474,7 @@ +@@ -1060,6 +1475,7 @@ @Override public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.getLevel()); @@ -728,7 +728,7 @@ WorldServer worldserver = this.player.getLevel(); EnumHand enumhand = packetplayinuseitem.getHand(); ItemStack itemstack = this.player.getItemInHand(enumhand); -@@ -1071,6 +1487,14 @@ +@@ -1072,6 +1488,14 @@ if (blockposition.getY() < i) { if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) { @@ -743,7 +743,7 @@ EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) { -@@ -1094,12 +1518,51 @@ +@@ -1095,12 +1519,51 @@ @Override public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.getLevel()); @@ -795,7 +795,7 @@ EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand); if (enuminteractionresult.shouldSwing()) { -@@ -1120,7 +1583,7 @@ +@@ -1121,7 +1584,7 @@ Entity entity = packetplayinspectate.getEntity(worldserver); if (entity != null) { @@ -804,7 +804,7 @@ return; } } -@@ -1135,6 +1598,7 @@ +@@ -1136,6 +1599,7 @@ PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); this.disconnect(new ChatMessage("multiplayer.requiredTexturePrompt.disconnect")); } @@ -812,7 +812,7 @@ } -@@ -1154,11 +1618,26 @@ +@@ -1155,11 +1619,26 @@ @Override public void onDisconnect(IChatBaseComponent ichatbasecomponent) { @@ -840,7 +840,7 @@ this.player.getTextFilter().leave(); if (this.isSingleplayerOwner()) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); -@@ -1173,6 +1652,15 @@ +@@ -1174,6 +1653,15 @@ } public void send(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { @@ -856,7 +856,7 @@ try { this.connection.send(packet, genericfuturelistener); } catch (Throwable throwable) { -@@ -1189,7 +1677,16 @@ +@@ -1190,7 +1678,16 @@ @Override public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.getLevel()); @@ -873,7 +873,7 @@ if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) { this.player.stopUsingItem(); } -@@ -1198,11 +1695,18 @@ +@@ -1199,11 +1696,18 @@ this.player.resetLastActionTime(); } else { PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -892,7 +892,7 @@ String s = StringUtils.normalizeSpace(packetplayinchat.getMessage()); for (int i = 0; i < s.length(); ++i) { -@@ -1216,20 +1720,42 @@ +@@ -1217,20 +1721,42 @@ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinchat, this, this.player.getLevel()); this.handleChat(ITextFilter.a.passThrough(s)); } else { @@ -939,7 +939,7 @@ } else { String s1 = itextfilter_a.getFiltered(); ChatMessage chatmessage = s1.isEmpty() ? null : new ChatMessage("chat.type.text", new Object[]{this.player.getDisplayName(), s1}); -@@ -1240,28 +1766,198 @@ +@@ -1241,28 +1767,198 @@ }, ChatMessageType.CHAT, this.player.getUUID()); } @@ -1142,7 +1142,7 @@ this.player.resetLastActionTime(); IJumpable ijumpable; -@@ -1319,6 +2015,7 @@ +@@ -1320,6 +2016,7 @@ @Override public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.getLevel()); @@ -1150,7 +1150,7 @@ WorldServer worldserver = this.player.getLevel(); final Entity entity = packetplayinuseentity.getTarget(worldserver); -@@ -1333,10 +2030,44 @@ +@@ -1334,10 +2031,44 @@ if (this.player.distanceToSqr(entity) < 36.0D) { packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() { @@ -1196,7 +1196,7 @@ if (enuminteractionresult.consumesAction()) { CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack, entity); if (enuminteractionresult.shouldSwing()) { -@@ -1348,20 +2079,27 @@ +@@ -1349,20 +2080,27 @@ @Override public void onInteraction(EnumHand enumhand) { @@ -1227,7 +1227,7 @@ } else { PlayerConnection.this.disconnect(new ChatMessage("multiplayer.disconnect.invalid_entity_attacked")); PlayerConnection.LOGGER.warn("Player {} tried to attack an invalid entity", PlayerConnection.this.player.getName().getString()); -@@ -1406,21 +2144,304 @@ +@@ -1407,21 +2145,304 @@ @Override public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel()); @@ -1535,7 +1535,7 @@ ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator(); while (objectiterator.hasNext()) { -@@ -1455,6 +2476,7 @@ +@@ -1456,6 +2477,7 @@ @Override public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.getLevel()); @@ -1543,7 +1543,7 @@ this.player.resetLastActionTime(); if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) { this.player.containerMenu.clickMenuButton(this.player, packetplayinenchantitem.getButtonId()); -@@ -1482,6 +2504,43 @@ +@@ -1483,6 +2505,43 @@ boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45; boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); @@ -1587,7 +1587,7 @@ if (flag1 && flag2) { this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).set(itemstack); -@@ -1504,6 +2563,7 @@ +@@ -1505,6 +2564,7 @@ } private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List list) { @@ -1595,7 +1595,7 @@ this.player.resetLastActionTime(); WorldServer worldserver = this.player.getLevel(); BlockPosition blockposition = packetplayinupdatesign.getPos(); -@@ -1520,18 +2580,37 @@ +@@ -1521,18 +2581,37 @@ if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) { PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString()); @@ -1635,7 +1635,7 @@ tileentitysign.setChanged(); worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3); -@@ -1541,6 +2620,7 @@ +@@ -1542,6 +2621,7 @@ @Override public void handleKeepAlive(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -1643,7 +1643,7 @@ if (this.keepAlivePending && packetplayinkeepalive.getId() == this.keepAliveChallenge) { int i = (int) (SystemUtils.getMillis() - this.keepAliveTime); -@@ -1555,7 +2635,17 @@ +@@ -1556,7 +2636,17 @@ @Override public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.getLevel()); @@ -1662,7 +1662,7 @@ } @Override -@@ -1564,8 +2654,50 @@ +@@ -1565,8 +2655,50 @@ this.player.updateOptions(packetplayinsettings); } diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerBeacon.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerBeacon.patch index 343984bf4f..a44cfc0692 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerBeacon.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerBeacon.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/world/inventory/ContainerBeacon.java +++ b/net/minecraft/world/inventory/ContainerBeacon.java -@@ -10,6 +10,11 @@ - import net.minecraft.world.item.ItemStack; +@@ -11,6 +11,11 @@ + import net.minecraft.world.level.World; import net.minecraft.world.level.block.Blocks; +// CraftBukkit start @@ -12,7 +12,7 @@ public class ContainerBeacon extends Container { private static final int PAYMENT_SLOT = 0; -@@ -23,6 +28,10 @@ +@@ -24,6 +29,10 @@ private final ContainerBeacon.SlotBeacon paymentSlot; private final ContainerAccess access; private final IContainerProperties beaconData; @@ -23,7 +23,7 @@ public ContainerBeacon(int i, IInventory iinventory) { this(i, iinventory, new ContainerProperties(3), ContainerAccess.NULL); -@@ -30,6 +39,7 @@ +@@ -31,6 +40,7 @@ public ContainerBeacon(int i, IInventory iinventory, IContainerProperties icontainerproperties, ContainerAccess containeraccess) { super(Containers.BEACON, i); @@ -31,7 +31,7 @@ this.beacon = new InventorySubcontainer(1) { @Override public boolean canPlaceItem(int j, ItemStack itemstack) { -@@ -79,6 +89,7 @@ +@@ -80,6 +90,7 @@ @Override public boolean stillValid(EntityHuman entityhuman) { @@ -39,7 +39,7 @@ return stillValid(this.access, entityhuman, Blocks.BEACON); } -@@ -178,4 +189,17 @@ +@@ -180,4 +191,17 @@ return 1; } } diff --git a/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch b/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch index c19407f85a..3146ffa4cd 100644 --- a/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch +++ b/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -73,6 +73,40 @@ +@@ -72,6 +72,40 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -41,7 +41,7 @@ public final class ItemStack { public static final Codec CODEC = RecordCodecBuilder.create((instance) -> { -@@ -140,16 +174,30 @@ +@@ -139,16 +173,30 @@ this.updateEmptyCacheFlag(); } @@ -74,7 +74,7 @@ this.getItem().verifyTagAfterLoad(this.tag); } -@@ -157,6 +205,11 @@ +@@ -156,6 +204,11 @@ this.setDamageValue(this.getDamageValue()); } @@ -86,7 +86,7 @@ this.updateEmptyCacheFlag(); } -@@ -194,7 +247,7 @@ +@@ -193,7 +246,7 @@ return this.getItem() == item; } @@ -95,7 +95,7 @@ EntityHuman entityhuman = itemactioncontext.getPlayer(); BlockPosition blockposition = itemactioncontext.getClickedPos(); ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false); -@@ -202,12 +255,157 @@ +@@ -201,12 +254,157 @@ if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().getTagManager(), shapedetectorblock)) { return EnumInteractionResult.PASS; } else { @@ -254,7 +254,7 @@ return enuminteractionresult; } -@@ -288,6 +486,21 @@ +@@ -287,6 +485,21 @@ } i -= k; @@ -276,7 +276,7 @@ if (i <= 0) { return false; } -@@ -309,6 +522,11 @@ +@@ -308,6 +521,11 @@ if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) { consumer.accept(t0); Item item = this.getItem(); @@ -288,7 +288,7 @@ this.shrink(1); if (t0 instanceof EntityHuman) { -@@ -464,6 +682,17 @@ +@@ -463,6 +681,17 @@ return this.tag; } @@ -306,7 +306,7 @@ public NBTTagCompound getOrCreateTag() { if (this.tag == null) { this.setTag(new NBTTagCompound()); -@@ -844,6 +1073,12 @@ +@@ -843,6 +1072,12 @@ } public void setRepairCost(int i) { @@ -319,7 +319,7 @@ this.getOrCreateTag().putInt("RepairCost", i); } -@@ -893,6 +1128,13 @@ +@@ -892,6 +1127,13 @@ nbttaglist.add(nbttagcompound); } diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntityBeehive.patch b/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntityBeehive.patch index 0ee9c212a7..f948cd89e6 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntityBeehive.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntityBeehive.patch @@ -42,9 +42,9 @@ + return releaseBee(this.level, this.worldPosition, iblockdata, tileentitybeehive_hivebee, list, tileentitybeehive_releasestatus, this.savedFlowerPos, force); + // CraftBukkit end }); - return list; - } -@@ -138,7 +145,19 @@ + if (!list.isEmpty()) { + super.setChanged(); +@@ -142,7 +149,19 @@ } public void addOccupantWithPresetTicks(Entity entity, boolean flag, int i) { @@ -65,7 +65,7 @@ entity.stopRiding(); entity.ejectPassengers(); NBTTagCompound nbttagcompound = new NBTTagCompound(); -@@ -168,7 +187,13 @@ +@@ -173,7 +192,13 @@ } private static boolean releaseOccupant(World world, BlockPosition blockposition, IBlockData iblockdata, TileEntityBeehive.HiveBee tileentitybeehive_hivebee, @Nullable List list, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPosition blockposition1) { @@ -79,8 +79,8 @@ + // CraftBukkit end return false; } else { - NBTTagCompound nbttagcompound = tileentitybeehive_hivebee.entityData; -@@ -191,6 +216,18 @@ + NBTTagCompound nbttagcompound = tileentitybeehive_hivebee.entityData.copy(); +@@ -196,6 +221,18 @@ if (!entity.getType().is(TagsEntity.BEEHIVE_INHABITORS)) { return false; } else { @@ -99,7 +99,7 @@ if (entity instanceof EntityBee) { EntityBee entitybee = (EntityBee) entity; -@@ -220,6 +257,7 @@ +@@ -225,6 +262,7 @@ list.add(entitybee); } @@ -107,7 +107,7 @@ float f = entity.getBbWidth(); double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F); double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getStepX(); -@@ -227,10 +265,11 @@ +@@ -232,10 +270,11 @@ double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ(); entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot()); @@ -120,9 +120,9 @@ } } else { return false; -@@ -276,6 +315,10 @@ - +@@ -284,6 +323,10 @@ if (releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus, blockposition1)) { + flag = true; iterator.remove(); + // CraftBukkit start + } else { @@ -131,7 +131,7 @@ } } } -@@ -313,6 +356,11 @@ +@@ -325,6 +368,11 @@ this.savedFlowerPos = GameProfileSerializer.readBlockPos(nbttagcompound.getCompound("FlowerPos")); } @@ -143,7 +143,7 @@ } @Override -@@ -322,6 +370,7 @@ +@@ -334,6 +382,7 @@ if (this.hasSavedFlowerPos()) { nbttagcompound.put("FlowerPos", GameProfileSerializer.writeBlockPos(this.savedFlowerPos)); } diff --git a/paper-server/pom.xml b/paper-server/pom.xml index 7aa34f5906..3238b2f89c 100644 --- a/paper-server/pom.xml +++ b/paper-server/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.18-R0.1-SNAPSHOT + 1.18.1-R0.1-SNAPSHOT CraftBukkit https://www.spigotmc.org/ 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 37f60d3fb5..e947065001 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java @@ -19,8 +19,6 @@ public class Main { public static boolean useConsole = true; public static void main(String[] args) { - System.setProperty("log4j2.formatMsgNoLookups", "true"); - // Todo: Installation script OptionParser parser = new OptionParser() { { @@ -183,7 +181,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 Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L); Calendar deadline = Calendar.getInstance(); 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 8d296963e9..2a2829d33c 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 @@ -224,7 +224,7 @@ public final class CraftMagicNumbers implements UnsafeValues { * @return string */ public String getMappingsVersion() { - return "9e9fe6961a80f3e586c25601590b51ec"; + return "20b026e774dbf715e40a0b2afe114792"; } @Override