diff --git a/paper-server/nms-patches/net/minecraft/CrashReport.patch b/paper-server/nms-patches/net/minecraft/CrashReport.patch index 7b223b64cc..d8cab27ec6 100644 --- a/paper-server/nms-patches/net/minecraft/CrashReport.patch +++ b/paper-server/nms-patches/net/minecraft/CrashReport.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/CrashReport.java +++ b/net/minecraft/CrashReport.java -@@ -31,6 +31,7 @@ +@@ -32,6 +32,7 @@ public CrashReport(String s, Throwable throwable) { this.title = s; this.exception = throwable; diff --git a/paper-server/nms-patches/net/minecraft/network/PacketDataSerializer.patch b/paper-server/nms-patches/net/minecraft/network/PacketDataSerializer.patch index a8354ab446..ca017d22ba 100644 --- a/paper-server/nms-patches/net/minecraft/network/PacketDataSerializer.patch +++ b/paper-server/nms-patches/net/minecraft/network/PacketDataSerializer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/network/PacketDataSerializer.java +++ b/net/minecraft/network/PacketDataSerializer.java -@@ -54,6 +54,8 @@ +@@ -55,6 +55,8 @@ import net.minecraft.world.phys.MovingObjectPositionBlock; import net.minecraft.world.phys.Vec3D; @@ -9,7 +9,7 @@ public class PacketDataSerializer extends ByteBuf { private static final int MAX_VARINT_SIZE = 5; -@@ -112,7 +114,7 @@ +@@ -123,7 +125,7 @@ public > C a(IntFunction intfunction, Function function) { int i = this.j(); @@ -18,7 +18,7 @@ for (int j = 0; j < i; ++j) { c0.add(function.apply(this)); -@@ -123,7 +125,7 @@ +@@ -134,7 +136,7 @@ public void a(Collection collection, BiConsumer biconsumer) { this.d(collection.size()); @@ -27,7 +27,7 @@ while (iterator.hasNext()) { T t0 = iterator.next(); -@@ -134,7 +136,7 @@ +@@ -145,7 +147,7 @@ } public List a(Function function) { @@ -36,7 +36,7 @@ } public IntList a() { -@@ -150,12 +152,12 @@ +@@ -161,12 +163,12 @@ public void a(IntList intlist) { this.d(intlist.size()); @@ -51,7 +51,7 @@ for (int j = 0; j < i; ++j) { K k0 = function.apply(this); -@@ -330,7 +332,7 @@ +@@ -355,7 +357,7 @@ } public > T a(Class oclass) { @@ -60,7 +60,7 @@ } public PacketDataSerializer a(Enum oenum) { -@@ -407,7 +409,7 @@ +@@ -432,7 +434,7 @@ } else { try { NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this))); @@ -69,7 +69,7 @@ throw new EncoderException(ioexception); } } -@@ -444,7 +446,7 @@ +@@ -469,7 +471,7 @@ } public PacketDataSerializer a(ItemStack itemstack) { @@ -78,7 +78,7 @@ this.writeBoolean(false); } else { this.writeBoolean(true); -@@ -473,6 +475,11 @@ +@@ -498,6 +500,11 @@ ItemStack itemstack = new ItemStack(Item.getById(i), b0); itemstack.setTag(this.m()); diff --git a/paper-server/nms-patches/net/minecraft/server/Main.patch b/paper-server/nms-patches/net/minecraft/server/Main.patch index 8c50896490..b0107760ee 100644 --- a/paper-server/nms-patches/net/minecraft/server/Main.patch +++ b/paper-server/nms-patches/net/minecraft/server/Main.patch @@ -127,7 +127,7 @@ + boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); if (flag1 && !GraphicsEnvironment.isHeadless()) { - dedicatedserver1.bi(); + dedicatedserver1.bh(); } + if (optionset.has("port")) { diff --git a/paper-server/nms-patches/net/minecraft/server/MinecraftServer.patch b/paper-server/nms-patches/net/minecraft/server/MinecraftServer.patch index 7ad753e843..9c96cad328 100644 --- a/paper-server/nms-patches/net/minecraft/server/MinecraftServer.patch +++ b/paper-server/nms-patches/net/minecraft/server/MinecraftServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -166,6 +166,25 @@ +@@ -163,6 +163,25 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -26,7 +26,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { public static final Logger LOGGER = LogManager.getLogger(); -@@ -258,6 +277,20 @@ +@@ -254,6 +273,20 @@ private final DefinedStructureManager structureManager; protected SaveData worldData; @@ -47,7 +47,7 @@ public static S a(Function function) { AtomicReference atomicreference = new AtomicReference(); Thread thread = new Thread(() -> { -@@ -267,14 +300,14 @@ +@@ -263,14 +296,14 @@ thread.setUncaughtExceptionHandler((thread1, throwable) -> { MinecraftServer.LOGGER.error(throwable); }); @@ -64,7 +64,7 @@ super("Server"); this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; this.profiler = this.metricsRecorder.e(); -@@ -286,7 +319,7 @@ +@@ -282,7 +315,7 @@ this.status = new ServerPing(); this.random = new Random(); this.port = -1; @@ -73,7 +73,7 @@ this.running = true; this.tickTimes = new long[100]; this.resourcePack = ""; -@@ -316,13 +349,40 @@ +@@ -312,13 +345,40 @@ this.structureManager = new DefinedStructureManager(datapackresources.i(), convertable_conversionsession, datafixer); this.serverThread = thread; this.executor = SystemUtils.f(); @@ -115,7 +115,7 @@ ScoreboardServer scoreboardserver1 = this.getScoreboard(); Objects.requireNonNull(scoreboardserver1); -@@ -333,7 +393,7 @@ +@@ -329,7 +389,7 @@ public static void convertWorld(Convertable.ConversionSession convertable_conversionsession) { if (convertable_conversionsession.isConvertable()) { @@ -124,7 +124,7 @@ convertable_conversionsession.convert(new IProgressUpdate() { private long timeStamp = SystemUtils.getMonotonicMillis(); -@@ -362,48 +422,198 @@ +@@ -358,48 +418,198 @@ } @@ -303,7 +303,7 @@ - this.loadSpawn(worldloadlistener); + for (WorldServer worldserver : this.getWorlds()) { + this.loadSpawn(worldserver.getChunkProvider().chunkMap.progressListener, worldserver); -+ worldserver.entityManager.a(); // SPIGOT-6526: Load pending entities so they are available to the API ++ worldserver.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API + this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld())); + } + @@ -354,7 +354,7 @@ if (!iworlddataserver.p()) { try { a(worldserver, iworlddataserver, generatorsettings.c(), flag); -@@ -425,31 +635,8 @@ +@@ -421,31 +631,8 @@ iworlddataserver.c(true); } @@ -387,7 +387,7 @@ private static void a(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) { if (flag1) { -@@ -462,6 +649,21 @@ +@@ -458,6 +645,21 @@ return biomebase.b().b(); }, random); ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); @@ -409,25 +409,25 @@ if (blockposition == null) { MinecraftServer.LOGGER.warn("Unable to find spawn biome"); -@@ -536,8 +738,15 @@ +@@ -532,8 +734,15 @@ iworlddataserver.setGameType(EnumGamemode.SPECTATOR); } - public void loadSpawn(WorldLoadListener worldloadlistener) { -- WorldServer worldserver = this.F(); +- WorldServer worldserver = this.E(); + // CraftBukkit start + public void loadSpawn(WorldLoadListener worldloadlistener, WorldServer worldserver) { + if (!worldserver.getWorld().getKeepSpawnInMemory()) { + return; + } + -+ // WorldServer worldserver = this.F(); ++ // WorldServer worldserver = this.E(); + this.forceTicks = true; + // CraftBukkit end MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a()); BlockPosition blockposition = worldserver.getSpawn(); -@@ -550,16 +759,20 @@ +@@ -546,16 +755,20 @@ chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE); while (chunkproviderserver.b() != 441) { @@ -456,7 +456,7 @@ ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getWorldPersistentData().a(ForcedChunk::b, "chunks"); if (forcedchunk != null) { -@@ -574,11 +787,18 @@ +@@ -570,11 +783,18 @@ } } @@ -478,13 +478,13 @@ } protected void loadResourcesZip() { -@@ -623,12 +843,16 @@ +@@ -619,12 +839,16 @@ worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2); } + // CraftBukkit start - moved to WorldServer.save + /* - WorldServer worldserver1 = this.F(); + WorldServer worldserver1 = this.E(); IWorldDataServer iworlddataserver = this.worldData.H(); iworlddataserver.a(worldserver1.getWorldBorder().t()); @@ -492,10 +492,10 @@ this.storageSource.a(this.registryHolder, this.worldData, this.getPlayerList().save()); + */ + // CraftBukkit end - return flag3; - } + if (flag1) { + Iterator iterator1 = this.getWorlds().iterator(); -@@ -637,8 +861,29 @@ +@@ -645,8 +869,29 @@ this.stop(); } @@ -525,7 +525,7 @@ if (this.getServerConnection() != null) { this.getServerConnection().b(); } -@@ -647,6 +892,7 @@ +@@ -655,6 +900,7 @@ MinecraftServer.LOGGER.info("Saving players"); this.playerList.savePlayers(); this.playerList.shutdown(); @@ -533,7 +533,7 @@ } MinecraftServer.LOGGER.info("Saving worlds"); -@@ -724,9 +970,10 @@ +@@ -732,9 +978,10 @@ while (this.running) { long i = SystemUtils.getMonotonicMillis() - this.nextTickTime; @@ -545,15 +545,15 @@ MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j); this.nextTickTime += j * 50L; this.lastOverloadWarning = this.nextTickTime; -@@ -737,6 +984,7 @@ +@@ -745,6 +992,7 @@ this.debugCommandProfiler = new MinecraftServer.a(SystemUtils.getMonotonicNanos(), this.tickCount); } + MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit this.nextTickTime += 50L; - this.bi(); + this.bh(); this.profiler.enter("tick"); -@@ -782,6 +1030,12 @@ +@@ -790,6 +1038,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -566,7 +566,7 @@ this.exit(); } -@@ -790,8 +1044,15 @@ +@@ -798,8 +1052,15 @@ } private boolean canSleepForTick() { @@ -583,7 +583,7 @@ protected void sleepForTick() { this.executeAll(); -@@ -906,7 +1167,7 @@ +@@ -908,7 +1169,7 @@ this.status.b().a(agameprofile); } @@ -592,7 +592,7 @@ MinecraftServer.LOGGER.debug("Autosave started"); this.profiler.enter("save"); this.playerList.savePlayers(); -@@ -936,22 +1197,39 @@ +@@ -938,22 +1199,39 @@ } public void b(BooleanSupplier booleansupplier) { @@ -632,7 +632,7 @@ this.profiler.enter("tick"); -@@ -1040,7 +1318,7 @@ +@@ -1042,7 +1320,7 @@ @DontObfuscate public String getServerModName() { @@ -641,7 +641,7 @@ } public SystemReport b(SystemReport systemreport) { -@@ -1412,16 +1690,17 @@ +@@ -1414,16 +1692,17 @@ public CompletableFuture a(Collection collection) { CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { @@ -661,7 +661,7 @@ this.packRepository.a(collection); this.worldData.a(a(this.packRepository)); datapackresources.j(); -@@ -1766,6 +2045,22 @@ +@@ -1768,6 +2047,22 @@ } @@ -681,6 +681,6 @@ + } + // CraftBukkit end + - private void bi() { + private void bh() { if (this.willStartRecordingMetrics) { this.metricsRecorder = ActiveMetricsRecorder.a(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.k()), SystemUtils.timeSource, SystemUtils.g(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> { diff --git a/paper-server/nms-patches/net/minecraft/server/dedicated/DedicatedServer.patch b/paper-server/nms-patches/net/minecraft/server/dedicated/DedicatedServer.patch index 6dea57681b..1b772ca86a 100644 --- a/paper-server/nms-patches/net/minecraft/server/dedicated/DedicatedServer.patch +++ b/paper-server/nms-patches/net/minecraft/server/dedicated/DedicatedServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -64,6 +64,15 @@ +@@ -65,6 +65,15 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -16,7 +16,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer { static final Logger LOGGER = LogManager.getLogger(); -@@ -82,8 +91,10 @@ +@@ -83,8 +92,10 @@ @Nullable private final IChatBaseComponent resourcePackPrompt; @@ -29,7 +29,7 @@ this.settings = dedicatedserversettings; this.rconConsoleSource = new RemoteControlCommandListener(this); this.textFilterClient = TextFilter.a(dedicatedserversettings.getProperties().textFilteringConfig); -@@ -94,13 +105,44 @@ +@@ -95,13 +106,44 @@ public boolean init() throws IOException { Thread thread = new Thread("Server console handler") { public void run() { @@ -77,7 +77,7 @@ } } catch (IOException ioexception) { DedicatedServer.LOGGER.error("Exception handling console input", ioexception); -@@ -109,6 +151,27 @@ +@@ -110,6 +152,27 @@ } }; @@ -105,16 +105,16 @@ thread.setDaemon(true); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER)); thread.start(); -@@ -134,7 +197,7 @@ +@@ -135,7 +198,7 @@ this.setMotd(dedicatedserverproperties.motd); super.setIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get()); - this.h(dedicatedserverproperties.enforceWhitelist); + this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist); - this.worldData.setGameType(dedicatedserverproperties.gamemode); + // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode); InetAddress inetaddress = null; -@@ -158,6 +221,12 @@ +@@ -159,6 +222,12 @@ return false; } @@ -127,7 +127,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."); -@@ -172,14 +241,14 @@ +@@ -173,7 +242,7 @@ if (!NameReferencingFileConverter.e(this)) { return false; } else { @@ -136,7 +136,8 @@ long i = SystemUtils.getMonotonicNanos(); TileEntitySkull.a(this.getUserCache()); - TileEntitySkull.a(this.getMinecraftSessionService()); +@@ -181,7 +250,7 @@ + TileEntitySkull.a((Executor) this); UserCache.a(this.getOnlineMode()); DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getWorld()); - this.loadWorld(); @@ -144,7 +145,7 @@ long j = SystemUtils.getMonotonicNanos() - i; String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D); -@@ -196,6 +265,7 @@ +@@ -198,6 +267,7 @@ if (dedicatedserverproperties.enableRcon) { DedicatedServer.LOGGER.info("Starting remote control listener"); this.rconThread = RemoteControlListener.a((IMinecraftServer) this); @@ -152,7 +153,7 @@ } if (this.getMaxTickTime() > 0L) { -@@ -345,6 +415,7 @@ +@@ -347,6 +417,7 @@ this.queryThreadGs4.b(); } @@ -160,7 +161,7 @@ } @Override -@@ -378,7 +449,15 @@ +@@ -380,7 +451,15 @@ while (!this.consoleInput.isEmpty()) { ServerCommand servercommand = (ServerCommand) this.consoleInput.remove(0); @@ -177,7 +178,7 @@ } } -@@ -583,14 +662,45 @@ +@@ -585,14 +664,45 @@ @Override public String getPlugins() { @@ -225,8 +226,8 @@ }); return this.rconConsoleSource.getMessages(); } -@@ -663,4 +773,15 @@ - public IChatBaseComponent bb() { +@@ -665,4 +775,15 @@ + public IChatBaseComponent ba() { return this.resourcePackPrompt; } + diff --git a/paper-server/nms-patches/net/minecraft/server/dedicated/DedicatedServerProperties.patch b/paper-server/nms-patches/net/minecraft/server/dedicated/DedicatedServerProperties.patch index ebc4dd43c3..920c7c9b6b 100644 --- a/paper-server/nms-patches/net/minecraft/server/dedicated/DedicatedServerProperties.patch +++ b/paper-server/nms-patches/net/minecraft/server/dedicated/DedicatedServerProperties.patch @@ -17,7 +17,7 @@ public final String serverIp = this.getString("server-ip", ""); @@ -64,8 +70,10 @@ @Nullable - public GeneratorSettings worldGenSettings; + private GeneratorSettings worldGenSettings; - public DedicatedServerProperties(Properties properties) { - super(properties); diff --git a/paper-server/nms-patches/net/minecraft/server/level/ChunkProviderServer.patch b/paper-server/nms-patches/net/minecraft/server/level/ChunkProviderServer.patch index 755f5f31bc..58bf8544bc 100644 --- a/paper-server/nms-patches/net/minecraft/server/level/ChunkProviderServer.patch +++ b/paper-server/nms-patches/net/minecraft/server/level/ChunkProviderServer.patch @@ -132,7 +132,16 @@ this.level.getMethodProfiler().enter("naturalSpawnCount"); int l = this.distanceManager.b(); -@@ -548,13 +594,19 @@ +@@ -394,7 +440,7 @@ + + this.level.getMethodProfiler().exitEnter("broadcast"); + list.forEach((playerchunk) -> { +- Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_LEVEL_CHUNK)).left(); ++ Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error + + Objects.requireNonNull(playerchunk); + optional.ifPresent(playerchunk::a); +@@ -551,13 +597,19 @@ } @Override diff --git a/paper-server/nms-patches/net/minecraft/server/level/EntityPlayer.patch b/paper-server/nms-patches/net/minecraft/server/level/EntityPlayer.patch index b1a2a0da90..449c2d7bf4 100644 --- a/paper-server/nms-patches/net/minecraft/server/level/EntityPlayer.patch +++ b/paper-server/nms-patches/net/minecraft/server/level/EntityPlayer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/EntityPlayer.java +++ b/net/minecraft/server/level/EntityPlayer.java -@@ -140,6 +140,36 @@ +@@ -141,6 +141,36 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -37,7 +37,7 @@ public class EntityPlayer extends EntityHuman { private static final Logger LOGGER = LogManager.getLogger(); -@@ -187,6 +217,20 @@ +@@ -188,6 +218,20 @@ public int latency; public boolean wonGame; @@ -58,7 +58,7 @@ public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) { super(worldserver, worldserver.getSpawn(), worldserver.x(), gameprofile); this.chatVisibility = EnumChatVisibility.FULL; -@@ -253,12 +297,56 @@ +@@ -249,12 +293,56 @@ this.advancements = minecraftserver.getPlayerList().f(this); this.maxUpStep = 1.0F; this.d(worldserver); @@ -116,7 +116,7 @@ int i = Math.max(0, this.server.a(worldserver)); int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ())); -@@ -316,11 +404,20 @@ +@@ -312,11 +400,20 @@ if (nbttagcompound.hasKeyOfType("recipeBook", 10)) { this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager()); } @@ -137,7 +137,7 @@ if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { this.respawnPosition = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); this.respawnForced = nbttagcompound.getBoolean("SpawnForced"); -@@ -353,7 +450,20 @@ +@@ -349,7 +446,20 @@ Entity entity = this.getRootVehicle(); Entity entity1 = this.getVehicle(); @@ -159,7 +159,7 @@ NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound3 = new NBTTagCompound(); -@@ -371,7 +481,7 @@ +@@ -367,7 +477,7 @@ nbttagcompound.setInt("SpawnZ", this.respawnPosition.getZ()); nbttagcompound.setBoolean("SpawnForced", this.respawnForced); nbttagcompound.setFloat("SpawnAngle", this.respawnAngle); @@ -168,7 +168,7 @@ Logger logger = EntityPlayer.LOGGER; Objects.requireNonNull(logger); -@@ -379,9 +489,33 @@ +@@ -375,9 +485,33 @@ nbttagcompound.set("SpawnDimension", nbtbase); }); } @@ -202,7 +202,7 @@ public void a(int i) { float f = (float) this.getExpToLevel(); float f1 = (f - 1.0F) / f; -@@ -440,6 +574,11 @@ +@@ -436,6 +570,11 @@ @Override public void tick() { @@ -214,7 +214,7 @@ this.gameMode.a(); --this.spawnInvulnerableTime; if (this.invulnerableTime > 0) { -@@ -493,7 +632,7 @@ +@@ -489,7 +628,7 @@ } if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) { @@ -223,7 +223,7 @@ this.lastSentHealth = this.getHealth(); this.lastSentFood = this.foodData.getFoodLevel(); this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F; -@@ -524,6 +663,12 @@ +@@ -520,6 +659,12 @@ this.a(IScoreboardCriteria.EXPERIENCE, MathHelper.f((float) this.lastRecordedExperience)); } @@ -236,7 +236,7 @@ if (this.experienceLevel != this.lastRecordedLevel) { this.lastRecordedLevel = this.experienceLevel; this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastRecordedLevel)); -@@ -538,6 +683,16 @@ +@@ -534,6 +679,16 @@ CriterionTriggers.LOCATION.a(this); } @@ -253,7 +253,7 @@ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Ticking player"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked"); -@@ -548,7 +703,8 @@ +@@ -544,7 +699,8 @@ } private void a(IScoreboardCriteria iscoreboardcriteria, int i) { @@ -263,7 +263,7 @@ scoreboardscore.setScore(i); }); } -@@ -556,9 +712,46 @@ +@@ -552,9 +708,46 @@ @Override public void die(DamageSource damagesource) { boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); @@ -312,9 +312,9 @@ this.connection.a((Packet) (new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent)), (future) -> { if (!future.isSuccess()) { -@@ -592,12 +785,18 @@ +@@ -588,12 +781,18 @@ if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) { - this.fH(); + this.fI(); } - - if (!this.isSpectator()) { @@ -335,7 +335,7 @@ EntityLiving entityliving = this.getKillingEntity(); if (entityliving != null) { -@@ -634,10 +833,12 @@ +@@ -630,10 +829,12 @@ String s = this.getName(); String s1 = entity.getName(); @@ -350,7 +350,7 @@ } else { this.a(StatisticList.MOB_KILLS); } -@@ -655,7 +856,8 @@ +@@ -651,7 +852,8 @@ int i = scoreboardteam.getColor().b(); if (i >= 0 && i < aiscoreboardcriteria.length) { @@ -360,7 +360,7 @@ } } -@@ -699,18 +901,20 @@ +@@ -695,18 +897,20 @@ } private boolean canPvP() { @@ -384,7 +384,7 @@ } else { return shapedetectorshape; } -@@ -719,11 +923,20 @@ +@@ -715,11 +919,20 @@ @Nullable @Override public Entity b(WorldServer worldserver) { @@ -408,7 +408,7 @@ this.decouple(); this.getWorldServer().a(this, Entity.RemovalReason.CHANGED_DIMENSION); if (!this.wonGame) { -@@ -734,6 +947,8 @@ +@@ -730,6 +943,8 @@ return this; } else { @@ -417,7 +417,7 @@ WorldData worlddata = worldserver.getWorldData(); this.connection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.gameMode.getGameMode(), this.gameMode.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); -@@ -743,22 +958,52 @@ +@@ -739,22 +954,52 @@ playerlist.d(this); worldserver1.a(this, Entity.RemovalReason.CHANGED_DIMENSION); this.unsetRemoved(); @@ -476,7 +476,7 @@ worldserver1.getMethodProfiler().exit(); this.triggerDimensionAdvancements(worldserver1); this.connection.sendPacket(new PacketPlayOutAbilities(this.getAbilities())); -@@ -776,12 +1021,31 @@ +@@ -772,12 +1017,31 @@ this.lastSentExp = -1; this.lastSentHealth = -1.0F; this.lastSentFood = -1; @@ -508,7 +508,7 @@ private void a(WorldServer worldserver, BlockPosition blockposition) { BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i(); -@@ -798,17 +1062,17 @@ +@@ -794,17 +1058,17 @@ } @Override @@ -531,7 +531,7 @@ } return optional1; -@@ -818,13 +1082,21 @@ +@@ -814,13 +1078,21 @@ public void triggerDimensionAdvancements(WorldServer worldserver) { ResourceKey resourcekey = worldserver.getDimensionKey(); ResourceKey resourcekey1 = this.level.getDimensionKey(); @@ -556,7 +556,7 @@ this.enteredNetherPosition = null; } -@@ -852,10 +1124,8 @@ +@@ -848,10 +1120,8 @@ this.containerMenu.d(); } @@ -569,7 +569,7 @@ if (!this.isSleeping() && this.isAlive()) { if (!this.level.getDimensionManager().isNatural()) { return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE); -@@ -881,7 +1151,36 @@ +@@ -877,7 +1147,36 @@ } } @@ -607,7 +607,7 @@ this.a(StatisticList.SLEEP_IN_BED); CriterionTriggers.SLEPT_IN_BED.a(this); }); -@@ -894,9 +1193,8 @@ +@@ -890,9 +1189,8 @@ return either; } } @@ -618,7 +618,7 @@ } @Override -@@ -923,6 +1221,24 @@ +@@ -919,6 +1217,24 @@ @Override public void wakeup(boolean flag, boolean flag1) { @@ -643,7 +643,7 @@ if (this.isSleeping()) { this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2)); } -@@ -1004,8 +1320,9 @@ +@@ -1000,8 +1316,9 @@ this.connection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition())); } @@ -654,7 +654,7 @@ } @Override -@@ -1020,6 +1337,24 @@ +@@ -1016,6 +1333,24 @@ this.nextContainerCounter(); Container container = itileinventory.createMenu(this.containerCounter, this.getInventory(), this); @@ -679,7 +679,7 @@ if (container == null) { if (this.isSpectator()) { this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true); -@@ -1027,9 +1362,11 @@ +@@ -1023,9 +1358,11 @@ return OptionalInt.empty(); } else { @@ -693,7 +693,7 @@ return OptionalInt.of(this.containerCounter); } } -@@ -1042,13 +1379,24 @@ +@@ -1038,13 +1375,24 @@ @Override public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) { @@ -720,7 +720,7 @@ this.initMenu(this.containerMenu); } -@@ -1072,6 +1420,7 @@ +@@ -1068,6 +1416,7 @@ @Override public void closeInventory() { @@ -728,7 +728,7 @@ this.connection.sendPacket(new PacketPlayOutCloseWindow(this.containerMenu.containerId)); this.o(); } -@@ -1101,7 +1450,7 @@ +@@ -1097,7 +1446,7 @@ @Override public void a(Statistic statistic, int i) { this.stats.b(this, statistic, i); @@ -737,7 +737,7 @@ scoreboardscore.addScore(i); }); } -@@ -1109,7 +1458,7 @@ +@@ -1105,7 +1454,7 @@ @Override public void a(Statistic statistic) { this.stats.setStatistic(this, statistic, 0); @@ -746,7 +746,7 @@ } @Override -@@ -1125,7 +1474,7 @@ +@@ -1121,7 +1470,7 @@ for (int j = 0; j < i; ++j) { MinecraftKey minecraftkey = aminecraftkey1[j]; @@ -755,7 +755,7 @@ Objects.requireNonNull(list); optional.ifPresent(list::add); -@@ -1160,7 +1509,16 @@ +@@ -1156,7 +1505,16 @@ public void triggerHealthUpdate() { this.lastSentHealth = -1.0E8F; @@ -772,7 +772,7 @@ @Override public void a(IChatBaseComponent ichatbasecomponent, boolean flag) { -@@ -1215,11 +1573,12 @@ +@@ -1211,11 +1569,12 @@ this.lastSentExp = -1; this.lastSentHealth = -1.0F; this.lastSentFood = -1; @@ -786,7 +786,7 @@ } @Override -@@ -1341,7 +1700,20 @@ +@@ -1337,7 +1696,20 @@ return s; } @@ -807,7 +807,7 @@ this.chatVisibility = packetplayinsettings.d(); this.canChatColor = packetplayinsettings.e(); this.textFilteringEnabled = packetplayinsettings.h(); -@@ -1411,7 +1783,7 @@ +@@ -1407,7 +1779,7 @@ this.camera = (Entity) (entity == null ? this : entity); if (entity1 != this.camera) { this.connection.sendPacket(new PacketPlayOutCamera(this.camera)); @@ -816,7 +816,7 @@ } } -@@ -1440,7 +1812,7 @@ +@@ -1436,7 +1808,7 @@ @Nullable public IChatBaseComponent getPlayerListName() { @@ -825,7 +825,7 @@ } @Override -@@ -1461,9 +1833,16 @@ +@@ -1457,9 +1829,16 @@ return this.advancements; } @@ -842,7 +842,7 @@ if (worldserver == this.level) { this.connection.b(d0, d1, d2, f, f1); } else { -@@ -1483,6 +1862,9 @@ +@@ -1479,6 +1858,9 @@ this.server.getPlayerList().a(this, worldserver); this.server.getPlayerList().updateClient(this); } @@ -852,9 +852,9 @@ } -@@ -1628,4 +2010,144 @@ - CriterionTriggers.USING_ITEM.a(this, itemstack); - super.a(itemstack); +@@ -1634,4 +2016,144 @@ + }); + return this.a(itemstack, false, true) != null; } + + // CraftBukkit start - Add per-player time and weather. 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 95b7b21c21..835e4594bc 100644 --- a/paper-server/nms-patches/net/minecraft/server/level/PlayerChunkMap.patch +++ b/paper-server/nms-patches/net/minecraft/server/level/PlayerChunkMap.patch @@ -37,7 +37,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(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag); this.visibleChunkMap = this.updatingChunkMap.clone(); -@@ -279,9 +302,12 @@ +@@ -281,9 +304,12 @@ return completablefuture1.thenApply((list1) -> { List list2 = Lists.newArrayList(); @@ -52,8 +52,8 @@ final Either either = (Either) iterator.next(); Optional optional = either.left(); -@@ -389,7 +415,7 @@ - PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName()); +@@ -390,7 +416,7 @@ + this.j(); } else { this.visibleChunkMap.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> { - IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow((Object) null); @@ -61,7 +61,7 @@ if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) { this.saveChunk(ichunkaccess); -@@ -400,7 +426,6 @@ +@@ -401,7 +427,6 @@ } } @@ -69,7 +69,7 @@ protected void unloadChunks(BooleanSupplier booleansupplier) { GameProfilerFiller gameprofilerfiller = this.level.getMethodProfiler(); -@@ -439,7 +464,7 @@ +@@ -440,7 +465,7 @@ private void a(long i, PlayerChunk playerchunk) { CompletableFuture completablefuture = playerchunk.getChunkSave(); @@ -78,7 +78,7 @@ CompletableFuture completablefuture1 = playerchunk.getChunkSave(); if (completablefuture1 != completablefuture) { -@@ -615,7 +640,21 @@ +@@ -616,7 +641,21 @@ private static void a(WorldServer worldserver, List list) { if (!list.isEmpty()) { @@ -101,7 +101,7 @@ } } -@@ -843,7 +882,8 @@ +@@ -844,7 +883,8 @@ return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty(); }); @@ -111,7 +111,7 @@ return chunk.getTileEntities().size(); }).orElse(0)); } -@@ -852,7 +892,7 @@ +@@ -853,7 +893,7 @@ private static String a(CompletableFuture> completablefuture) { try { @@ -120,7 +120,7 @@ return either != null ? (String) either.map((chunk) -> { return "done"; -@@ -870,7 +910,7 @@ +@@ -871,7 +911,7 @@ private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); @@ -129,7 +129,7 @@ } boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { -@@ -1233,7 +1273,7 @@ +@@ -1238,7 +1278,7 @@ public final Set seenBy = Sets.newIdentityHashSet(); public EntityTracker(Entity entity, int i, int j, boolean flag) { @@ -138,7 +138,7 @@ this.entity = entity; this.range = i; this.lastSectionPos = SectionPosition.a(entity); -@@ -1286,10 +1326,18 @@ +@@ -1291,10 +1331,18 @@ 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 6e01262337..188a67d06d 100644 --- a/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch +++ b/paper-server/nms-patches/net/minecraft/server/level/WorldServer.patch @@ -23,18 +23,15 @@ public class WorldServer extends World implements GeneratorAccessSeed { public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0); -@@ -160,9 +176,9 @@ +@@ -160,7 +176,7 @@ final List players; private final ChunkProviderServer chunkSource; private final MinecraftServer server; - public final IWorldDataServer serverLevelData; + public final WorldDataServer serverLevelData; // CraftBukkit - type final EntityTickList entityTickList; -- private final PersistentEntitySectionManager entityManager; -+ public final PersistentEntitySectionManager entityManager; + public final PersistentEntitySectionManager entityManager; public boolean noSave; - private final SleepStatus sleepStatus; - private int emptyTime; @@ -180,31 +196,52 @@ private final StructureManager structureFeatureManager; private final boolean tickTime; @@ -543,8 +540,8 @@ @Nullable @Override public WorldMap a(String s) { -- return (WorldMap) this.getMinecraftServer().F().getWorldPersistentData().a(WorldMap::b, s); -+ return (WorldMap) this.getMinecraftServer().F().getWorldPersistentData().a((nbttagcompound) -> { +- return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().a(WorldMap::b, s); ++ return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().a((nbttagcompound) -> { + // CraftBukkit start + // We only get here when the data file exists, but is not a valid map + WorldMap newMap = WorldMap.b(nbttagcompound); @@ -559,7 +556,7 @@ @Override public void a(String s, WorldMap worldmap) { + worldmap.id = s; // CraftBukkit - this.getMinecraftServer().F().getWorldPersistentData().a(s, (PersistentBase) worldmap); + this.getMinecraftServer().E().getWorldPersistentData().a(s, (PersistentBase) worldmap); } @@ -1432,6 +1655,11 @@ diff --git a/paper-server/nms-patches/net/minecraft/server/network/LoginListener.patch b/paper-server/nms-patches/net/minecraft/server/network/LoginListener.patch index dd690f47a0..2b7f7ade4d 100644 --- a/paper-server/nms-patches/net/minecraft/server/network/LoginListener.patch +++ b/paper-server/nms-patches/net/minecraft/server/network/LoginListener.patch @@ -58,7 +58,7 @@ + // CraftBukkit end } else { this.state = LoginListener.EnumProtocolState.ACCEPTED; - if (this.server.aw() >= 0 && !this.connection.isLocal()) { + if (this.server.av() >= 0 && !this.connection.isLocal()) { @@ -117,7 +141,7 @@ EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.gameProfile.getId()); 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 18d26dc4cf..21ece93251 100644 --- a/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch +++ b/paper-server/nms-patches/net/minecraft/server/network/PlayerConnection.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/PlayerConnection.java +++ b/net/minecraft/server/network/PlayerConnection.java -@@ -158,6 +158,62 @@ +@@ -157,6 +157,62 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -63,7 +63,7 @@ public class PlayerConnection implements ServerPlayerConnection, PacketListenerPlayIn { static final Logger LOGGER = LogManager.getLogger(); -@@ -169,7 +225,9 @@ +@@ -168,7 +224,9 @@ private long keepAliveTime; private boolean keepAlivePending; private long keepAliveChallenge; @@ -74,7 +74,7 @@ private int dropSpamTickCount; private double firstGoodX; private double firstGoodY; -@@ -203,7 +261,33 @@ +@@ -202,7 +260,33 @@ this.player = entityplayer; entityplayer.connection = this; entityplayer.Q().a(); @@ -108,7 +108,7 @@ public void tick() { this.syncPosition(); -@@ -252,7 +336,7 @@ +@@ -251,7 +335,7 @@ this.server.getMethodProfiler().enter("keepAlive"); long i = SystemUtils.getMonotonicMillis(); @@ -117,7 +117,7 @@ if (this.keepAlivePending) { this.disconnect(new ChatMessage("disconnect.timeout")); } else { -@@ -264,15 +348,21 @@ +@@ -263,15 +347,21 @@ } this.server.getMethodProfiler().exit(); @@ -139,7 +139,7 @@ this.disconnect(new ChatMessage("multiplayer.disconnect.idling")); } -@@ -296,16 +386,46 @@ +@@ -295,16 +385,46 @@ return this.server.a(this.player.getProfile()); } @@ -187,7 +187,7 @@ } private void a(T t0, Consumer consumer, BiFunction> bifunction) { -@@ -323,11 +443,11 @@ +@@ -322,11 +442,11 @@ } private void a(String s, Consumer consumer) { @@ -201,7 +201,7 @@ } @Override -@@ -372,7 +492,34 @@ +@@ -371,7 +491,34 @@ double d9 = entity.getMot().g(); double d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -237,7 +237,7 @@ PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8); this.connection.sendPacket(new PacketPlayOutVehicleMove(entity)); return; -@@ -402,14 +549,72 @@ +@@ -401,14 +548,72 @@ } entity.setLocation(d3, d4, d5, f, f1); @@ -310,7 +310,7 @@ this.player.getWorldServer().getChunkProvider().movePlayer(this.player); this.player.checkMovement(this.player.locX() - d0, this.player.locY() - d1, this.player.locZ() - d2); this.clientVehicleIsFloating = d11 >= -0.03125D && !this.server.getAllowFlight() && this.a(entity); -@@ -428,7 +633,7 @@ +@@ -427,7 +632,7 @@ @Override public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer()); @@ -319,7 +319,7 @@ this.player.setLocation(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; -@@ -438,6 +643,7 @@ +@@ -437,6 +642,7 @@ } this.awaitingPositionFromClient = null; @@ -327,7 +327,7 @@ } } -@@ -445,7 +651,7 @@ +@@ -444,7 +650,7 @@ @Override public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) { PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer()); @@ -336,7 +336,7 @@ RecipeBookServer recipebookserver = this.player.getRecipeBook(); Objects.requireNonNull(recipebookserver); -@@ -475,6 +681,12 @@ +@@ -474,6 +680,12 @@ @Override public void a(PacketPlayInTabComplete packetplayintabcomplete) { PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); @@ -349,7 +349,7 @@ StringReader stringreader = new StringReader(packetplayintabcomplete.c()); if (stringreader.canRead() && stringreader.peek() == '/') { -@@ -484,6 +696,7 @@ +@@ -483,6 +695,7 @@ ParseResults parseresults = this.server.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); this.server.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -357,7 +357,7 @@ this.connection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions)); }); } -@@ -716,6 +929,7 @@ +@@ -715,6 +928,7 @@ if (container instanceof ContainerMerchant) { ContainerMerchant containermerchant = (ContainerMerchant) container; @@ -365,7 +365,7 @@ containermerchant.d(i); containermerchant.g(i); -@@ -725,6 +939,13 @@ +@@ -724,6 +938,13 @@ @Override public void a(PacketPlayInBEdit packetplayinbedit) { @@ -379,7 +379,16 @@ int i = packetplayinbedit.d(); if (PlayerInventory.d(i) || i == 40) { -@@ -761,7 +982,7 @@ +@@ -732,7 +953,7 @@ + + Objects.requireNonNull(list); + optional.ifPresent(list::add); +- Stream stream = packetplayinbedit.b().stream().limit(100L); ++ Stream stream = packetplayinbedit.b().stream().limit(100L); // CraftBukkit - decompile error + + Objects.requireNonNull(list); + stream.forEach(list::add); +@@ -748,7 +969,7 @@ ItemStack itemstack = this.player.getInventory().getItem(i); if (itemstack.a(Items.WRITABLE_BOOK)) { @@ -388,7 +397,7 @@ } } -@@ -786,16 +1007,16 @@ +@@ -773,16 +994,16 @@ this.a(list, (s) -> { return IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) (new ChatComponentText(s))); @@ -409,7 +418,7 @@ return NBTTagString.a((String) unaryoperator.apply(itextfilter_a.b())); }); -@@ -823,6 +1044,7 @@ +@@ -810,6 +1031,7 @@ } itemstack.a("pages", (NBTBase) nbttaglist); @@ -417,7 +426,7 @@ } @Override -@@ -859,7 +1081,7 @@ +@@ -846,7 +1068,7 @@ } else { WorldServer worldserver = this.player.getWorldServer(); @@ -426,7 +435,7 @@ if (this.tickCount == 0) { this.syncPosition(); } -@@ -869,7 +1091,7 @@ +@@ -856,7 +1078,7 @@ this.awaitingTeleportTime = this.tickCount; this.b(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); } @@ -435,7 +444,7 @@ } else { this.awaitingTeleportTime = this.tickCount; double d0 = a(packetplayinflying.a(this.player.locX())); -@@ -881,7 +1103,15 @@ +@@ -868,7 +1090,15 @@ if (this.player.isPassenger()) { this.player.setLocation(this.player.locX(), this.player.locY(), this.player.locZ(), f, f1); this.player.getWorldServer().getChunkProvider().movePlayer(this.player); @@ -451,7 +460,7 @@ double d3 = this.player.locX(); double d4 = this.player.locY(); double d5 = this.player.locZ(); -@@ -901,15 +1131,33 @@ +@@ -888,15 +1118,33 @@ ++this.receivedMovePacketCount; int i = this.receivedMovePacketCount - this.knownMovePacketCount; @@ -487,7 +496,7 @@ PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9); this.b(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.getYRot(), this.player.getXRot()); return; -@@ -928,6 +1176,7 @@ +@@ -915,6 +1163,7 @@ } this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); @@ -495,7 +504,7 @@ double d12 = d8; d7 = d0 - this.player.locX(); -@@ -949,10 +1198,74 @@ +@@ -936,10 +1185,74 @@ if (!this.player.noPhysics && !this.player.isSleeping() && (flag1 && worldserver.getCubes(this.player, axisalignedbb) || this.a((IWorldReader) worldserver, axisalignedbb))) { this.b(d3, d4, d5, f, f1); } else { @@ -572,7 +581,7 @@ if (flag) { this.player.fallDistance = 0.0F; } -@@ -980,19 +1293,80 @@ +@@ -967,19 +1280,80 @@ }); } @@ -657,7 +666,7 @@ double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX() : 0.0D; double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY() : 0.0D; double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ() : 0.0D; -@@ -1004,6 +1378,14 @@ +@@ -991,6 +1365,14 @@ this.awaitingTeleport = 0; } @@ -672,7 +681,7 @@ this.awaitingTeleportTime = this.tickCount; this.player.setLocation(d0, d1, d2, f, f1); this.player.connection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag)); -@@ -1012,6 +1394,7 @@ +@@ -999,6 +1381,7 @@ @Override public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer()); @@ -680,7 +689,7 @@ BlockPosition blockposition = packetplayinblockdig.b(); this.player.resetIdleTimer(); -@@ -1022,14 +1405,46 @@ +@@ -1009,14 +1392,46 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -729,7 +738,7 @@ this.player.dropItem(false); } -@@ -1066,6 +1481,7 @@ +@@ -1053,6 +1468,7 @@ @Override public void a(PacketPlayInUseItem packetplayinuseitem) { PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer()); @@ -737,7 +746,7 @@ WorldServer worldserver = this.player.getWorldServer(); EnumHand enumhand = packetplayinuseitem.b(); ItemStack itemstack = this.player.b(enumhand); -@@ -1078,6 +1494,14 @@ +@@ -1065,6 +1481,14 @@ if (blockposition.getY() < i) { if (this.awaitingPositionFromClient == null && this.player.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) { @@ -752,7 +761,7 @@ EnumInteractionResult enuminteractionresult = this.player.gameMode.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); if (enumdirection == EnumDirection.UP && !enuminteractionresult.a() && blockposition.getY() >= i - 1 && a(this.player, itemstack)) { -@@ -1101,12 +1525,51 @@ +@@ -1088,12 +1512,51 @@ @Override public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer()); @@ -804,7 +813,7 @@ EnumInteractionResult enuminteractionresult = this.player.gameMode.a(this.player, worldserver, itemstack, enumhand); if (enuminteractionresult.b()) { -@@ -1127,7 +1590,7 @@ +@@ -1114,7 +1577,7 @@ Entity entity = packetplayinspectate.a(worldserver); if (entity != null) { @@ -813,7 +822,7 @@ return; } } -@@ -1142,6 +1605,7 @@ +@@ -1129,6 +1592,7 @@ PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getDisplayName()); this.disconnect(new ChatMessage("multiplayer.requiredTexturePrompt.disconnect")); } @@ -821,7 +830,7 @@ } -@@ -1161,11 +1625,26 @@ +@@ -1148,11 +1612,26 @@ @Override public void a(IChatBaseComponent ichatbasecomponent) { @@ -849,7 +858,7 @@ this.player.Q().b(); if (this.isExemptPlayer()) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); -@@ -1180,6 +1659,15 @@ +@@ -1167,6 +1646,15 @@ } public void a(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { @@ -865,7 +874,7 @@ try { this.connection.sendPacket(packet, genericfuturelistener); } catch (Throwable throwable) { -@@ -1196,7 +1684,16 @@ +@@ -1183,7 +1671,16 @@ @Override public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer()); @@ -882,7 +891,7 @@ if (this.player.getInventory().selected != packetplayinhelditemslot.b() && this.player.getRaisedHand() == EnumHand.MAIN_HAND) { this.player.clearActiveItem(); } -@@ -1205,11 +1702,18 @@ +@@ -1192,11 +1689,18 @@ this.player.resetIdleTimer(); } else { PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getDisplayName().getString()); @@ -901,7 +910,7 @@ String s = StringUtils.normalizeSpace(packetplayinchat.b()); for (int i = 0; i < s.length(); ++i) { -@@ -1223,20 +1727,42 @@ +@@ -1210,20 +1714,42 @@ PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.getWorldServer()); this.a(ITextFilter.a.a(s)); } else { @@ -948,7 +957,7 @@ } else { String s1 = itextfilter_a.b(); ChatMessage chatmessage = s1.isEmpty() ? null : new ChatMessage("chat.type.text", new Object[]{this.player.getScoreboardDisplayName(), s1}); -@@ -1247,28 +1773,198 @@ +@@ -1234,28 +1760,198 @@ }, ChatMessageType.CHAT, this.player.getUniqueID()); } @@ -1151,7 +1160,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -1326,6 +2022,7 @@ +@@ -1313,6 +2009,7 @@ @Override public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer()); @@ -1159,7 +1168,7 @@ WorldServer worldserver = this.player.getWorldServer(); final Entity entity = packetplayinuseentity.a(worldserver); -@@ -1336,10 +2033,44 @@ +@@ -1323,10 +2020,44 @@ if (this.player.f(entity) < 36.0D) { packetplayinuseentity.a(new PacketPlayInUseEntity.c() { @@ -1205,7 +1214,7 @@ if (enuminteractionresult.a()) { CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.a(PlayerConnection.this.player, itemstack, entity); if (enuminteractionresult.b()) { -@@ -1351,20 +2082,27 @@ +@@ -1338,20 +2069,27 @@ @Override public void a(EnumHand enumhand) { @@ -1236,7 +1245,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.getDisplayName().getString()); -@@ -1409,19 +2147,302 @@ +@@ -1396,21 +2134,304 @@ @Override public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer()); @@ -1259,7 +1268,9 @@ + if (false/*this.player.isSpectator()*/) { // CraftBukkit this.player.containerMenu.updateInventory(); } else { - this.player.containerMenu.g(); + boolean flag = packetplayinwindowclick.h() != this.player.containerMenu.getStateId(); + + this.player.containerMenu.h(); - this.player.containerMenu.a(packetplayinwindowclick.c(), packetplayinwindowclick.d(), packetplayinwindowclick.g(), this.player); + // CraftBukkit start - Call InventoryClickEvent + if (packetplayinwindowclick.c() < -1 && packetplayinwindowclick.c() != -999) { @@ -1512,19 +1523,19 @@ + case PLACE_SOME: + case PLACE_ONE: + case SWAP_WITH_CURSOR: -+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.containerMenu.getCarried())); -+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem())); ++ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventoryMenu.incrementStateId(), this.player.containerMenu.getCarried())); ++ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem())); + break; + // Modified clicked only + case DROP_ALL_SLOT: + case DROP_ONE_SLOT: -+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem())); ++ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem())); + break; + // Modified cursor only + case DROP_ALL_CURSOR: + case DROP_ONE_CURSOR: + case CLONE_STACK: -+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.containerMenu.getCarried())); ++ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventoryMenu.incrementStateId(), this.player.containerMenu.getCarried())); + break; + // Nothing + case NOTHING: @@ -1542,7 +1553,7 @@ ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.f()).iterator(); while (objectiterator.hasNext()) { -@@ -1452,6 +2473,7 @@ +@@ -1445,6 +2466,7 @@ @Override public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer()); @@ -1550,7 +1561,7 @@ this.player.resetIdleTimer(); if (this.player.containerMenu.containerId == packetplayinenchantitem.b() && !this.player.isSpectator()) { this.player.containerMenu.a((EntityHuman) this.player, packetplayinenchantitem.c()); -@@ -1484,6 +2506,43 @@ +@@ -1477,6 +2499,43 @@ boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45; boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); @@ -1584,8 +1595,8 @@ + case DENY: + // Reset the slot + if (packetplayinsetcreativeslot.b() >= 0) { -+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.inventoryMenu.containerId, packetplayinsetcreativeslot.b(), this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.b()).getItem())); -+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, ItemStack.EMPTY)); ++ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.inventoryMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinsetcreativeslot.b(), this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.b()).getItem())); ++ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, this.player.inventoryMenu.incrementStateId(), -1, ItemStack.EMPTY)); + } + return; + } @@ -1593,8 +1604,8 @@ + // CraftBukkit end if (flag1 && flag2) { - if (itemstack.isEmpty()) { -@@ -1511,6 +2570,7 @@ + this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.b()).set(itemstack); +@@ -1499,6 +2558,7 @@ } private void a(PacketPlayInUpdateSign packetplayinupdatesign, List list) { @@ -1602,7 +1613,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.player.getWorldServer(); BlockPosition blockposition = packetplayinupdatesign.b(); -@@ -1527,18 +2587,37 @@ +@@ -1515,18 +2575,37 @@ if (!tileentitysign.d() || !this.player.getUniqueID().equals(tileentitysign.f())) { PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString()); @@ -1642,7 +1653,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1548,6 +2627,7 @@ +@@ -1536,6 +2615,7 @@ @Override public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -1650,7 +1661,7 @@ if (this.keepAlivePending && packetplayinkeepalive.b() == this.keepAliveChallenge) { int i = (int) (SystemUtils.getMonotonicMillis() - this.keepAliveTime); -@@ -1562,7 +2642,17 @@ +@@ -1550,7 +2630,17 @@ @Override public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer()); @@ -1669,7 +1680,7 @@ } @Override -@@ -1571,8 +2661,50 @@ +@@ -1559,8 +2649,50 @@ this.player.a(packetplayinsettings); } diff --git a/paper-server/nms-patches/net/minecraft/server/players/NameReferencingFileConverter.patch b/paper-server/nms-patches/net/minecraft/server/players/NameReferencingFileConverter.patch index 932e11dfa4..6e385decf1 100644 --- a/paper-server/nms-patches/net/minecraft/server/players/NameReferencingFileConverter.patch +++ b/paper-server/nms-patches/net/minecraft/server/players/NameReferencingFileConverter.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/players/NameReferencingFileConverter.java +++ b/net/minecraft/server/players/NameReferencingFileConverter.java -@@ -27,6 +27,11 @@ +@@ -28,6 +28,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -12,7 +12,7 @@ public class NameReferencingFileConverter { static final Logger LOGGER = LogManager.getLogger(); -@@ -87,7 +92,7 @@ +@@ -88,7 +93,7 @@ try { gameprofilebanlist.load(); } catch (IOException ioexception) { @@ -21,7 +21,7 @@ } } -@@ -145,7 +150,7 @@ +@@ -146,7 +151,7 @@ try { ipbanlist.load(); } catch (IOException ioexception) { @@ -30,7 +30,7 @@ } } -@@ -186,7 +191,7 @@ +@@ -187,7 +192,7 @@ try { oplist.load(); } catch (IOException ioexception) { @@ -39,7 +39,7 @@ } } -@@ -230,7 +235,7 @@ +@@ -231,7 +236,7 @@ try { whitelist.load(); } catch (IOException ioexception) { @@ -48,7 +48,7 @@ } } -@@ -353,6 +358,30 @@ +@@ -354,6 +359,30 @@ File file5 = new File(file, s2 + ".dat"); File file6 = new File(file4, s3 + ".dat"); diff --git a/paper-server/nms-patches/net/minecraft/server/players/PlayerList.patch b/paper-server/nms-patches/net/minecraft/server/players/PlayerList.patch index bdb577f33b..523d087f6f 100644 --- a/paper-server/nms-patches/net/minecraft/server/players/PlayerList.patch +++ b/paper-server/nms-patches/net/minecraft/server/players/PlayerList.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -93,6 +93,26 @@ +@@ -95,6 +95,26 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -27,7 +27,7 @@ public abstract class PlayerList { public static final File USERBANLIST_FILE = new File("banned-players.json"); -@@ -103,14 +123,16 @@ +@@ -105,14 +125,16 @@ private static final int SEND_PLAYER_INFO_INTERVAL = 600; private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private final MinecraftServer server; @@ -47,7 +47,7 @@ public final WorldNBTStorage playerIo; private boolean doWhiteList; private final IRegistryCustom.Dimension registryHolder; -@@ -120,13 +142,23 @@ +@@ -122,13 +144,23 @@ private static final boolean ALLOW_LOGOUTIVATOR = false; private int sendAllPlayerInfoIn; @@ -73,7 +73,7 @@ this.server = minecraftserver; this.registryHolder = iregistrycustom_dimension; this.maxPlayers = i; -@@ -142,6 +174,12 @@ +@@ -144,6 +176,12 @@ usercache.a(gameprofile); NBTTagCompound nbttagcompound = this.a(entityplayer); ResourceKey resourcekey; @@ -86,7 +86,7 @@ if (nbttagcompound != null) { DataResult dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension"))); -@@ -171,7 +209,8 @@ +@@ -173,7 +211,8 @@ s1 = networkmanager.getSocketAddress().toString(); } @@ -96,15 +96,15 @@ WorldData worlddata = worldserver1.getWorldData(); entityplayer.c(nbttagcompound); -@@ -181,6 +220,7 @@ +@@ -183,6 +222,7 @@ boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO); - playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.gameMode.getGameMode(), entityplayer.gameMode.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.G(), this.registryHolder, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), this.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); + playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.gameMode.getGameMode(), entityplayer.gameMode.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.F(), this.registryHolder, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), this.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); + entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName()))); playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.getAbilities())); -@@ -199,19 +239,66 @@ +@@ -201,19 +241,66 @@ } else { chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[]{entityplayer.getScoreboardDisplayName(), s}); } @@ -175,8 +175,8 @@ + // CraftBukkit end this.a(entityplayer, worldserver1); if (!this.server.getResourcePack().isEmpty()) { - entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash(), this.server.aY(), this.server.bb()); -@@ -227,8 +314,11 @@ + entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash(), this.server.aX(), this.server.ba()); +@@ -229,8 +316,11 @@ if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); @@ -190,7 +190,7 @@ }); if (entity != null) { -@@ -271,6 +361,8 @@ +@@ -273,6 +363,8 @@ } entityplayer.syncInventory(); @@ -199,7 +199,7 @@ } public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { -@@ -303,30 +395,31 @@ +@@ -305,30 +397,31 @@ } public void setPlayerFileData(WorldServer worldserver) { @@ -236,7 +236,7 @@ } @Override -@@ -354,14 +447,15 @@ +@@ -356,14 +449,15 @@ } protected void savePlayerFile(EntityPlayer entityplayer) { @@ -254,7 +254,7 @@ if (advancementdataplayer != null) { advancementdataplayer.b(); -@@ -369,10 +463,24 @@ +@@ -371,10 +465,24 @@ } @@ -280,7 +280,7 @@ this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -396,18 +504,66 @@ +@@ -398,18 +506,66 @@ if (entityplayer1 == entityplayer) { this.playersByUUID.remove(uuid); @@ -353,7 +353,7 @@ GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile); chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()}); -@@ -415,10 +571,12 @@ +@@ -417,10 +573,12 @@ chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())})); } @@ -369,7 +369,7 @@ IpBanEntry ipbanentry = this.ipBans.get(socketaddress); chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[]{ipbanentry.getReason()}); -@@ -426,13 +584,25 @@ +@@ -428,13 +586,25 @@ chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())})); } @@ -398,10 +398,10 @@ UUID uuid = EntityHuman.a(gameprofile); List list = Lists.newArrayList(); -@@ -459,14 +629,24 @@ +@@ -461,14 +631,24 @@ } - return new EntityPlayer(this.server, this.server.F(), gameprofile); + return new EntityPlayer(this.server, this.server.E(), gameprofile); + */ + return player; + // CraftBukkit end @@ -423,9 +423,9 @@ WorldServer worldserver = this.server.getWorldServer(entityplayer.getSpawnDimension()); Optional optional; -@@ -478,6 +658,11 @@ +@@ -480,6 +660,11 @@ - WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.F(); + WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.E(); EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getProfile()); + // */ + EntityPlayer entityplayer1 = entityplayer; @@ -435,7 +435,7 @@ entityplayer1.connection = entityplayer.connection; entityplayer1.copyFrom(entityplayer, flag); -@@ -493,49 +678,110 @@ +@@ -495,49 +680,110 @@ boolean flag2 = false; @@ -570,7 +570,7 @@ return entityplayer1; } -@@ -548,7 +794,18 @@ +@@ -550,7 +796,18 @@ public void tick() { if (++this.sendAllPlayerInfoIn > 600) { @@ -590,7 +590,7 @@ this.sendAllPlayerInfoIn = 0; } -@@ -565,6 +822,25 @@ +@@ -567,6 +824,25 @@ } @@ -616,7 +616,7 @@ public void a(Packet packet, ResourceKey resourcekey) { Iterator iterator = this.players.iterator(); -@@ -667,6 +943,7 @@ +@@ -669,6 +945,7 @@ entityplayer.connection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0)); } @@ -624,7 +624,7 @@ this.server.getCommandDispatcher().a(entityplayer); } -@@ -699,6 +976,12 @@ +@@ -701,6 +978,12 @@ for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); @@ -637,11 +637,11 @@ if (entityplayer != entityhuman && entityplayer.level.getDimensionKey() == resourcekey) { double d4 = d0 - entityplayer.locX(); double d5 = d1 - entityplayer.locY(); -@@ -738,23 +1021,34 @@ +@@ -740,23 +1023,34 @@ public void reloadWhitelist() {} public void a(EntityPlayer entityplayer, WorldServer worldserver) { -- WorldBorder worldborder = this.server.F().getWorldBorder(); +- WorldBorder worldborder = this.server.E().getWorldBorder(); + WorldBorder worldborder = entityplayer.level.getWorldBorder(); // CraftBukkit entityplayer.connection.sendPacket(new ClientboundInitializeBorderPacket(worldborder)); @@ -677,7 +677,7 @@ } public int getPlayerCount() { -@@ -805,12 +1099,22 @@ +@@ -807,12 +1101,22 @@ } public void shutdown() { @@ -702,7 +702,7 @@ public void sendMessage(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) { this.server.sendMessage(ichatbasecomponent, uuid); Iterator iterator = this.players.iterator(); -@@ -838,24 +1142,32 @@ +@@ -840,16 +1144,23 @@ } @@ -727,12 +727,10 @@ if (!file1.exists()) { - File file2 = new File(file, entityhuman.getDisplayName().getString() + ".json"); + File file2 = new File(file, displayName + ".json"); // CraftBukkit -+ java.nio.file.Path path = file2.toPath(); + Path path = file2.toPath(); -- if (file2.exists() && file2.isFile()) { -+ if (net.minecraft.FileUtils.a(path) && net.minecraft.FileUtils.b(path) && path.startsWith(file.getPath()) && file2.isFile()) { - file2.renameTo(file1); - } + if (FileUtils.a(path) && FileUtils.b(path) && path.startsWith(file.getPath()) && file2.isFile()) { +@@ -858,7 +1169,7 @@ } serverstatisticmanager = new ServerStatisticManager(this.server, file1); @@ -741,7 +739,7 @@ } return serverstatisticmanager; -@@ -863,14 +1175,14 @@ +@@ -866,14 +1177,14 @@ public AdvancementDataPlayer f(EntityPlayer entityplayer) { UUID uuid = entityplayer.getUniqueID(); @@ -758,7 +756,7 @@ } advancementdataplayer.a(entityplayer); -@@ -906,13 +1218,20 @@ +@@ -909,13 +1220,20 @@ } public void reload() { diff --git a/paper-server/nms-patches/net/minecraft/server/players/UserCache.patch b/paper-server/nms-patches/net/minecraft/server/players/UserCache.patch index b2bf0ef54f..fbcc8d4af5 100644 --- a/paper-server/nms-patches/net/minecraft/server/players/UserCache.patch +++ b/paper-server/nms-patches/net/minecraft/server/players/UserCache.patch @@ -5,7 +5,7 @@ package net.minecraft.server.players; import com.google.common.collect.ImmutableList; -@@ -92,7 +93,7 @@ +@@ -93,7 +94,7 @@ } public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/EntityInsentient.patch b/paper-server/nms-patches/net/minecraft/world/entity/EntityInsentient.patch index f1be01090a..982d5e95c4 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/EntityInsentient.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/EntityInsentient.patch @@ -20,7 +20,7 @@ public abstract class EntityInsentient extends EntityLiving { private static final DataWatcherObject DATA_MOB_FLAGS_ID = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.BYTE); -@@ -112,6 +125,8 @@ +@@ -113,6 +126,8 @@ private BlockPosition restrictCenter; private float restrictRadius; @@ -29,7 +29,7 @@ protected EntityInsentient(EntityTypes entitytypes, World world) { super(entitytypes, world); this.handItems = NonNullList.a(2, ItemStack.EMPTY); -@@ -135,6 +150,9 @@ +@@ -136,6 +151,9 @@ this.initPathfinder(); } @@ -39,7 +39,7 @@ } protected void initPathfinder() {} -@@ -215,7 +233,38 @@ +@@ -216,7 +234,38 @@ } public void setGoalTarget(@Nullable EntityLiving entityliving) { @@ -78,7 +78,7 @@ } @Override -@@ -442,16 +491,26 @@ +@@ -443,16 +492,26 @@ nbttagcompound.setBoolean("NoAI", this.isNoAI()); } @@ -107,7 +107,7 @@ NBTTagList nbttaglist; int i; -@@ -498,6 +557,11 @@ +@@ -499,6 +558,11 @@ } this.setNoAI(nbttagcompound.getBoolean("NoAI")); @@ -119,7 +119,7 @@ } @Override -@@ -561,7 +625,7 @@ +@@ -562,7 +626,7 @@ protected void b(EntityItem entityitem) { ItemStack itemstack = entityitem.getItemStack(); @@ -128,7 +128,7 @@ this.a(entityitem); this.receive(entityitem, itemstack.getCount()); entityitem.die(); -@@ -570,15 +634,29 @@ +@@ -571,15 +635,29 @@ } public boolean j(ItemStack itemstack) { @@ -159,7 +159,7 @@ } this.b(enumitemslot, itemstack); -@@ -691,18 +769,18 @@ +@@ -692,18 +770,18 @@ EntityHuman entityhuman = this.level.findNearbyPlayer(this, -1.0D); if (entityhuman != null) { @@ -181,7 +181,7 @@ this.die(); } else if (d0 < (double) l) { this.noActionTime = 0; -@@ -717,6 +795,7 @@ +@@ -718,6 +796,7 @@ @Override protected final void doTick() { ++this.noActionTime; @@ -189,7 +189,7 @@ this.level.getMethodProfiler().enter("sensing"); this.sensing.a(); this.level.getMethodProfiler().exit(); -@@ -1100,6 +1179,12 @@ +@@ -1101,6 +1180,12 @@ if (!this.isAlive()) { return EnumInteractionResult.PASS; } else if (this.getLeashHolder() == entityhuman) { @@ -202,7 +202,7 @@ this.unleash(true, !entityhuman.getAbilities().instabuild); return EnumInteractionResult.a(this.level.isClientSide); } else { -@@ -1118,6 +1203,12 @@ +@@ -1119,6 +1204,12 @@ ItemStack itemstack = entityhuman.b(enumhand); if (itemstack.a(Items.LEAD) && this.a(entityhuman)) { @@ -215,7 +215,7 @@ this.setLeashHolder(entityhuman, true); itemstack.subtract(1); return EnumInteractionResult.a(this.level.isClientSide); -@@ -1133,7 +1224,7 @@ +@@ -1134,7 +1225,7 @@ if (itemstack.getItem() instanceof ItemMonsterEgg) { if (this.level instanceof WorldServer) { ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem(); @@ -224,7 +224,7 @@ optional.ifPresent((entityinsentient) -> { this.a(entityhuman, entityinsentient); -@@ -1183,12 +1274,19 @@ +@@ -1184,12 +1275,19 @@ return this.restrictRadius != -1.0F; } @@ -245,7 +245,7 @@ t0.s(this); t0.setBaby(this.isBaby()); -@@ -1220,7 +1318,12 @@ +@@ -1221,7 +1319,12 @@ } } @@ -259,7 +259,7 @@ if (this.isPassenger()) { Entity entity = this.getVehicle(); -@@ -1240,6 +1343,7 @@ +@@ -1241,6 +1344,7 @@ if (this.leashHolder != null) { if (!this.isAlive() || !this.leashHolder.isAlive()) { @@ -267,7 +267,7 @@ this.unleash(true, true); } -@@ -1251,7 +1355,9 @@ +@@ -1252,7 +1356,9 @@ this.leashHolder = null; this.leashInfoTag = null; if (!this.level.isClientSide && flag1) { @@ -277,7 +277,7 @@ } if (!this.level.isClientSide && flag && this.level instanceof WorldServer) { -@@ -1301,6 +1407,7 @@ +@@ -1302,6 +1408,7 @@ boolean flag1 = super.a(entity, flag); if (flag1 && this.isLeashed()) { @@ -285,7 +285,7 @@ this.unleash(true, true); } -@@ -1396,7 +1503,14 @@ +@@ -1397,7 +1504,14 @@ int i = EnchantmentManager.getFireAspectEnchantmentLevel(this); if (i > 0) { @@ -301,7 +301,7 @@ } boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f); -@@ -1464,9 +1578,10 @@ +@@ -1465,9 +1579,10 @@ @Override protected void cc() { super.cc(); diff --git a/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch b/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch index 0f30a3173b..a01fa40f38 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch @@ -497,7 +497,7 @@ } } -@@ -1374,6 +1615,13 @@ +@@ -1378,6 +1619,13 @@ if (!flag) { EntityItem entityitem = new EntityItem(this.level, this.locX(), this.locY(), this.locZ(), new ItemStack(Items.WITHER_ROSE)); @@ -511,7 +511,7 @@ this.level.addEntity(entityitem); } } -@@ -1393,21 +1641,40 @@ +@@ -1397,21 +1645,40 @@ boolean flag = this.lastHurtByPlayerTime > 0; @@ -555,7 +555,7 @@ } -@@ -1523,9 +1790,14 @@ +@@ -1527,9 +1794,14 @@ int i = this.d(f, f1); if (i > 0) { @@ -571,7 +571,7 @@ return true; } else { return flag; -@@ -1574,7 +1846,7 @@ +@@ -1578,7 +1850,7 @@ protected float applyArmorModifier(DamageSource damagesource, float f) { if (!damagesource.ignoresArmor()) { @@ -580,7 +580,7 @@ f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.b(GenericAttributes.ARMOR_TOUGHNESS)); } -@@ -1587,7 +1859,8 @@ +@@ -1591,7 +1863,8 @@ } else { int i; @@ -590,7 +590,7 @@ i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5; int j = 25 - i; float f1 = f * (float) j; -@@ -1618,29 +1891,172 @@ +@@ -1622,29 +1895,172 @@ } } @@ -773,7 +773,7 @@ } public CombatTracker getCombatTracker() { -@@ -1661,8 +2077,18 @@ +@@ -1665,8 +2081,18 @@ } public final void setArrowCount(int i) { @@ -793,7 +793,7 @@ public final int eh() { return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID); -@@ -1958,6 +2384,12 @@ +@@ -1962,6 +2388,12 @@ public abstract ItemStack getEquipment(EnumItemSlot enumitemslot); @@ -806,7 +806,7 @@ @Override public abstract void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack); -@@ -2202,6 +2634,7 @@ +@@ -2205,6 +2637,7 @@ } if (this.onGround && !this.level.isClientSide) { @@ -814,7 +814,7 @@ this.setFlag(7, false); } } else { -@@ -2732,6 +3165,7 @@ +@@ -2735,6 +3168,7 @@ } if (!this.level.isClientSide) { @@ -822,7 +822,7 @@ this.setFlag(7, flag); } -@@ -2899,14 +3333,21 @@ +@@ -2902,14 +3336,21 @@ @Override public boolean isInteractable() { @@ -846,7 +846,7 @@ @Override protected void velocityChanged() { this.hurtMarked = this.random.nextDouble() >= this.b(GenericAttributes.KNOCKBACK_RESISTANCE); -@@ -3104,7 +3545,25 @@ +@@ -3107,7 +3548,25 @@ } else { if (!this.useItem.isEmpty() && this.isHandRaised()) { this.b(this.useItem, 16); @@ -873,7 +873,7 @@ if (itemstack != this.useItem) { this.a(enumhand, itemstack); -@@ -3176,6 +3635,12 @@ +@@ -3179,6 +3638,12 @@ } public boolean a(double d0, double d1, double d2, boolean flag) { @@ -886,7 +886,7 @@ double d3 = this.locX(); double d4 = this.locY(); double d5 = this.locZ(); -@@ -3200,16 +3665,41 @@ +@@ -3203,16 +3668,41 @@ } if (flag2) { @@ -931,7 +931,7 @@ } else { if (flag) { world.broadcastEntityEffect(this, (byte) 46); -@@ -3219,7 +3709,7 @@ +@@ -3222,7 +3712,7 @@ ((EntityCreature) this).getNavigation().o(); } @@ -940,7 +940,7 @@ } } -@@ -3302,7 +3792,7 @@ +@@ -3305,7 +3795,7 @@ } public void entityWakeup() { @@ -949,16 +949,16 @@ World world = this.level; java.util.Objects.requireNonNull(this.level); -@@ -3334,7 +3824,7 @@ +@@ -3337,7 +3827,7 @@ @Nullable - public EnumDirection eW() { + public EnumDirection eX() { - BlockPosition blockposition = (BlockPosition) this.getBedPosition().orElse((Object) null); + BlockPosition blockposition = (BlockPosition) this.getBedPosition().orElse(null); // CraftBukkit - decompile error return blockposition != null ? BlockBed.a((IBlockAccess) this.level, blockposition) : null; } -@@ -3383,7 +3873,7 @@ +@@ -3386,7 +3876,7 @@ Pair pair = (Pair) iterator.next(); if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/IEntitySelector.patch b/paper-server/nms-patches/net/minecraft/world/entity/IEntitySelector.patch index 0595c7678b..0b5e7c7d47 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/IEntitySelector.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/IEntitySelector.patch @@ -7,5 +7,5 @@ - if (!entity1.isCollidable()) { + if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API return false; - } else if (entity.level.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).fh())) { + } else if (entity.level.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).fi())) { return false; diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/Bucketable.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/Bucketable.patch index 9c848029a3..82e73ce5d3 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/Bucketable.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/Bucketable.patch @@ -15,7 +15,7 @@ public interface Bucketable { boolean isFromBucket(); -@@ -90,10 +98,22 @@ +@@ -92,10 +100,22 @@ ItemStack itemstack = entityhuman.b(enumhand); if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityBee.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityBee.patch index c49aaf24bd..e368ac9425 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityBee.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityBee.patch @@ -35,7 +35,7 @@ + if (flag && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata.set(blockstateinteger, (Integer) iblockdata.get(blockstateinteger) + 1)).isCancelled()) { // Spigot EntityBee.this.level.triggerEffect(2005, blockposition, 0); EntityBee.this.level.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(blockstateinteger, (Integer) iblockdata.get(blockstateinteger) + 1)); - EntityBee.this.fR(); + EntityBee.this.fS(); @@ -1289,7 +1293,7 @@ @Override protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityCat.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityCat.patch index 10907ebef7..94a223939d 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityCat.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityCat.patch @@ -11,7 +11,7 @@ hashmap.put(2, new MinecraftKey("textures/entity/cat/red.png")); @@ -433,7 +433,7 @@ } - } else if (this.n(itemstack)) { + } else if (this.isBreedItem(itemstack)) { this.a(entityhuman, enumhand, itemstack); - if (this.random.nextInt(3) == 0) { + if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityDolphin.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityDolphin.patch index e15e3634d3..261becc4e3 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityDolphin.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityDolphin.patch @@ -8,7 +8,7 @@ + this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityGuardian.class})).a(new Class[0])); // CraftBukkit - decompile error } - public static AttributeProvider.Builder fv() { + public static AttributeProvider.Builder fw() { @@ -243,6 +243,12 @@ ItemStack itemstack = entityitem.getItemStack(); diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityOcelot.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityOcelot.patch index 9e40c65db0..ec51ccbf15 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityOcelot.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityOcelot.patch @@ -1,19 +1,5 @@ --- a/net/minecraft/world/entity/animal/EntityOcelot.java +++ b/net/minecraft/world/entity/animal/EntityOcelot.java -@@ -68,11 +68,11 @@ - this.t(); - } - -- boolean isTrusting() { -+ public boolean isTrusting() { - return (Boolean) this.entityData.get(EntityOcelot.DATA_TRUSTING); - } - -- private void setTrusting(boolean flag) { -+ public void setTrusting(boolean flag) { - this.entityData.set(EntityOcelot.DATA_TRUSTING, flag); - this.t(); - } @@ -133,7 +133,7 @@ @Override @@ -24,7 +10,7 @@ public static AttributeProvider.Builder p() { @@ -182,7 +182,8 @@ - if ((this.temptGoal == null || this.temptGoal.h()) && !this.isTrusting() && this.n(itemstack) && entityhuman.f((Entity) this) < 9.0D) { + if ((this.temptGoal == null || this.temptGoal.h()) && !this.isTrusting() && this.isBreedItem(itemstack) && entityhuman.f((Entity) this) < 9.0D) { this.a(entityhuman, enumhand, itemstack); if (!this.level.isClientSide) { - if (this.random.nextInt(3) == 0) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/axolotl/Axolotl.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/axolotl/Axolotl.patch index c962c86665..dfafa20885 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/axolotl/Axolotl.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/axolotl/Axolotl.patch @@ -10,7 +10,7 @@ private static final DataWatcherObject DATA_VARIANT = DataWatcher.a(Axolotl.class, DataWatcherRegistry.INT); private static final DataWatcherObject DATA_PLAYING_DEAD = DataWatcher.a(Axolotl.class, DataWatcherRegistry.BOOLEAN); private static final DataWatcherObject FROM_BUCKET = DataWatcher.a(Axolotl.class, DataWatcherRegistry.BOOLEAN); -@@ -239,6 +240,7 @@ +@@ -235,6 +236,7 @@ @Override public void setFromBucket(boolean flag) { this.entityData.set(Axolotl.FROM_BUCKET, flag); @@ -18,7 +18,7 @@ } @Nullable -@@ -280,7 +282,7 @@ +@@ -276,7 +278,7 @@ @Override protected void mobTick() { this.level.getMethodProfiler().enter("axolotlBrain"); @@ -27,7 +27,7 @@ this.level.getMethodProfiler().exit(); this.level.getMethodProfiler().enter("axolotlActivityUpdate"); AxolotlAi.a(this); -@@ -422,7 +424,7 @@ +@@ -418,7 +420,7 @@ if (i < 2400) { i = Math.min(2400, 100 + i); @@ -36,7 +36,7 @@ } entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN); -@@ -472,7 +474,7 @@ +@@ -468,7 +470,7 @@ @Override public BehaviorController getBehaviorController() { @@ -45,7 +45,7 @@ } @Override -@@ -505,7 +507,7 @@ +@@ -501,7 +503,7 @@ @Override public boolean isTypeNotPersistent(double d0) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/goat/Goat.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/goat/Goat.patch index b7949ad7e7..a3d950aca7 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/goat/Goat.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/goat/Goat.patch @@ -12,7 +12,7 @@ public class Goat extends EntityAnimal { public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.b(0.9F, 1.3F).a(0.7F); -@@ -123,13 +128,13 @@ +@@ -137,13 +142,13 @@ @Override public BehaviorController getBehaviorController() { @@ -28,7 +28,7 @@ this.level.getMethodProfiler().exit(); this.level.getMethodProfiler().enter("goatActivityUpdate"); GoatAi.b(this); -@@ -161,8 +166,15 @@ +@@ -175,8 +180,15 @@ ItemStack itemstack = entityhuman.b(enumhand); if (itemstack.a(Items.BUCKET) && !this.isBaby()) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.patch index 2a02fb3c29..b80880a423 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java -@@ -70,6 +70,8 @@ +@@ -69,6 +69,8 @@ import net.minecraft.world.phys.AxisAlignedBB; import net.minecraft.world.phys.Vec3D; @@ -9,7 +9,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable, ISaddleable { public static final int EQUIPMENT_SLOT_OFFSET = 400; -@@ -109,6 +111,7 @@ +@@ -108,6 +110,7 @@ private float mouthAnimO; protected boolean canGallop = true; protected int gallopSoundCounter; @@ -17,7 +17,7 @@ protected EntityHorseAbstract(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -293,7 +296,7 @@ +@@ -292,7 +295,7 @@ public void loadChest() { InventorySubcontainer inventorysubcontainer = this.inventory; @@ -26,7 +26,7 @@ if (inventorysubcontainer != null) { inventorysubcontainer.b((IInventoryListener) this); int i = Math.min(inventorysubcontainer.getSize(), this.inventory.getSize()); -@@ -409,7 +412,7 @@ +@@ -408,7 +411,7 @@ } public int getMaxDomestication() { @@ -35,7 +35,7 @@ } @Override -@@ -479,7 +482,7 @@ +@@ -478,7 +481,7 @@ } if (this.getHealth() < this.getMaxHealth() && f > 0.0F) { @@ -44,7 +44,7 @@ flag = true; } -@@ -556,7 +559,7 @@ +@@ -555,7 +558,7 @@ super.movementTick(); if (!this.level.isClientSide && this.isAlive()) { if (this.random.nextInt(900) == 0 && this.deathTime == 0) { @@ -52,8 +52,8 @@ + this.heal(1.0F, RegainReason.REGEN); // CraftBukkit } - if (this.fU()) { -@@ -794,6 +797,7 @@ + if (this.fV()) { +@@ -786,6 +789,7 @@ if (this.getOwnerUUID() != null) { nbttagcompound.a("Owner", this.getOwnerUUID()); } @@ -61,7 +61,7 @@ if (!this.inventory.getItem(0).isEmpty()) { nbttagcompound.set("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound())); -@@ -821,6 +825,11 @@ +@@ -813,6 +817,11 @@ if (uuid != null) { this.setOwnerUUID(uuid); } @@ -73,7 +73,7 @@ if (nbttagcompound.hasKeyOfType("SaddleItem", 10)) { ItemStack itemstack = ItemStack.a(nbttagcompound.getCompound("SaddleItem")); -@@ -903,6 +912,18 @@ +@@ -895,6 +904,18 @@ @Override public void b(int i) { @@ -90,5 +90,5 @@ + } + // CraftBukkit end this.allowStandSliding = true; - this.fD(); - this.fW(); + this.fE(); + this.fX(); diff --git a/paper-server/nms-patches/net/minecraft/world/entity/monster/EntitySkeleton.patch b/paper-server/nms-patches/net/minecraft/world/entity/monster/EntitySkeleton.patch deleted file mode 100644 index d82aa533e8..0000000000 --- a/paper-server/nms-patches/net/minecraft/world/entity/monster/EntitySkeleton.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/net/minecraft/world/entity/monster/EntitySkeleton.java -+++ b/net/minecraft/world/entity/monster/EntitySkeleton.java -@@ -16,10 +16,10 @@ - - public class EntitySkeleton extends EntitySkeletonAbstract { - -- private static final DataWatcherObject DATA_STRAY_CONVERSION_ID = DataWatcher.a(EntitySkeleton.class, DataWatcherRegistry.BOOLEAN); -+ public static final DataWatcherObject DATA_STRAY_CONVERSION_ID = DataWatcher.a(EntitySkeleton.class, DataWatcherRegistry.BOOLEAN); // PAIL private -> public - public static final String CONVERSION_TAG = "StrayConversionTime"; - private int inPowderSnowTime; -- private int conversionTime; -+ public int conversionTime; // PAIL private -> public - - public EntitySkeleton(EntityTypes entitytypes, World world) { - super(entitytypes, world); -@@ -80,7 +80,7 @@ - - } - -- private void a(int i) { -+ public void a(int i) { // PAIL private -> public // PAIL rename startStrayConversion - this.conversionTime = i; - this.entityData.set(EntitySkeleton.DATA_STRAY_CONVERSION_ID, true); - } diff --git a/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityStrider.patch b/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityStrider.patch index 2a48c8d852..2239f229b8 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityStrider.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityStrider.patch @@ -13,5 +13,5 @@ + } + // CraftBukkit end super.tick(); - this.fD(); + this.fE(); this.checkBlockCollisions(); diff --git a/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityZombie.patch b/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityZombie.patch index 81890ff8e1..9c329e17dc 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityZombie.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/monster/EntityZombie.patch @@ -34,7 +34,7 @@ + this.conversionTime -= elapsedTicks; + // CraftBukkit end if (this.conversionTime < 0) { - this.fy(); + this.fz(); } @@ -222,6 +235,7 @@ } @@ -61,7 +61,7 @@ if (entityzombie != null) { entityzombie.z(entityzombie.level.getDamageScaler(entityzombie.getChunkCoordinates()).d()); - entityzombie.w(entityzombie.p() && this.fD()); + entityzombie.w(entityzombie.p() && this.fE()); + // CraftBukkit start - SPIGOT-5208: End conversion to stop event spam + } else { + ((Zombie) getBukkitEntity()).setConversionTime(-1); @@ -111,7 +111,7 @@ entityzombievillager.prepare(worldserver, worldserver.getDamageScaler(entityzombievillager.getChunkCoordinates()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null); entityzombievillager.setVillagerData(entityvillager.getVillagerData()); -@@ -472,7 +503,7 @@ +@@ -477,7 +508,7 @@ entitychicken1.prepare(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null); entitychicken1.setChickenJockey(true); this.startRiding(entitychicken1); diff --git a/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/EntityPiglin.patch b/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/EntityPiglin.patch index ad4d4e9df1..ea2f76decd 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/EntityPiglin.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/EntityPiglin.patch @@ -92,7 +92,7 @@ + boolean flag = PiglinAI.isLovedByPiglin(itemstack, this) || itemstack.a(Items.CROSSBOW); // CraftBukkit + boolean flag1 = PiglinAI.isLovedByPiglin(itemstack1, this) || itemstack1.a(Items.CROSSBOW); // CraftBukkit - return flag && !flag1 ? true : (!flag && flag1 ? false : (this.fv() && !itemstack.a(Items.CROSSBOW) && itemstack1.a(Items.CROSSBOW) ? false : super.a(itemstack, itemstack1))); + return flag && !flag1 ? true : (!flag && flag1 ? false : (this.fw() && !itemstack.a(Items.CROSSBOW) && itemstack1.a(Items.CROSSBOW) ? false : super.a(itemstack, itemstack1))); } @@ -405,7 +433,7 @@ diff --git a/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.patch b/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.patch index 44d7ebae59..96777935b5 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.patch @@ -17,4 +17,4 @@ + return (EntityLiving) this.brain.getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error } - protected boolean fx() { + protected boolean fy() { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/PiglinAI.patch b/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/PiglinAI.patch index 9644c9c3d1..19afcd90db 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/PiglinAI.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/monster/piglin/PiglinAI.patch @@ -96,7 +96,7 @@ @@ -278,9 +292,14 @@ boolean flag1; - if (entitypiglin.fv()) { + if (entitypiglin.fw()) { - flag1 = b(itemstack); + flag1 = isBarterItem(itemstack, entitypiglin); // CraftBukkit - Changes to allow custom payment for bartering if (flag && flag1) { @@ -154,8 +154,8 @@ } protected static boolean b(EntityPiglin entitypiglin, ItemStack itemstack) { -- return !x(entitypiglin) && !v(entitypiglin) && entitypiglin.fv() && b(itemstack); -+ return !x(entitypiglin) && !v(entitypiglin) && entitypiglin.fv() && isBarterItem(itemstack, entitypiglin); // CraftBukkit +- return !x(entitypiglin) && !v(entitypiglin) && entitypiglin.fw() && b(itemstack); ++ return !x(entitypiglin) && !v(entitypiglin) && entitypiglin.fw() && isBarterItem(itemstack, entitypiglin); // CraftBukkit } protected static void a(EntityPiglin entitypiglin, EntityLiving entityliving) { diff --git a/paper-server/nms-patches/net/minecraft/world/entity/npc/EntityVillager.patch b/paper-server/nms-patches/net/minecraft/world/entity/npc/EntityVillager.patch index 181a4174de..e9262ba6f0 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/npc/EntityVillager.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/npc/EntityVillager.patch @@ -51,15 +51,6 @@ } } -@@ -302,7 +310,7 @@ - } - } - -- private void fT() { -+ public void fT() { - this.t(40); - if (!this.level.isClientSide()) { - this.playSound(SoundEffects.VILLAGER_NO, this.getSoundVolume(), this.ep()); @@ -444,7 +452,14 @@ while (iterator.hasNext()) { MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); @@ -96,7 +87,7 @@ + } + worldserver.addAllEntities(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); + // CraftBukkit end - this.fZ(); + this.ga(); this.die(); } else { @@ -834,6 +854,13 @@ diff --git a/paper-server/nms-patches/net/minecraft/world/entity/player/EntityHuman.patch b/paper-server/nms-patches/net/minecraft/world/entity/player/EntityHuman.patch index 9d0c56f598..965c597305 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/player/EntityHuman.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/player/EntityHuman.patch @@ -88,7 +88,7 @@ } } -@@ -688,6 +713,30 @@ +@@ -684,6 +709,30 @@ entityitem.setMot((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6); } @@ -119,7 +119,7 @@ return entityitem; } } -@@ -814,16 +863,17 @@ +@@ -810,16 +859,17 @@ if (this.isInvulnerable(damagesource)) { return false; } else if (this.abilities.invulnerable && !damagesource.ignoresInvulnerability()) { @@ -139,7 +139,7 @@ } if (this.level.getDifficulty() == EnumDifficulty.EASY) { -@@ -835,7 +885,13 @@ +@@ -831,7 +881,13 @@ } } @@ -154,7 +154,7 @@ } } } -@@ -855,10 +911,29 @@ +@@ -851,10 +907,29 @@ } public boolean a(EntityHuman entityhuman) { @@ -187,7 +187,7 @@ } @Override -@@ -900,8 +975,13 @@ +@@ -896,8 +971,13 @@ } } @@ -202,7 +202,7 @@ if (!this.isInvulnerable(damagesource)) { f = this.applyArmorModifier(damagesource, f); f = this.applyMagicModifier(damagesource, f); -@@ -916,7 +996,7 @@ +@@ -912,7 +992,7 @@ } if (f != 0.0F) { @@ -211,7 +211,7 @@ float f3 = this.getHealth(); this.setHealth(this.getHealth() - f); -@@ -927,6 +1007,7 @@ +@@ -923,6 +1003,7 @@ } } @@ -219,7 +219,7 @@ } @Override -@@ -1086,7 +1167,7 @@ +@@ -1082,7 +1163,7 @@ f *= 0.2F + f2 * f2 * 0.8F; f1 *= f2; @@ -228,7 +228,7 @@ if (f > 0.0F || f1 > 0.0F) { boolean flag = f2 > 0.9F; boolean flag1 = false; -@@ -1125,8 +1206,15 @@ +@@ -1121,8 +1202,15 @@ if (entity instanceof EntityLiving) { f3 = ((EntityLiving) entity).getHealth(); if (j > 0 && !entity.isBurning()) { @@ -246,7 +246,7 @@ } } -@@ -1154,8 +1242,11 @@ +@@ -1150,8 +1238,11 @@ EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving != this && entityliving != entity && !this.p(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.f((Entity) entityliving) < 9.0D) { @@ -259,7 +259,7 @@ } } -@@ -1164,9 +1255,26 @@ +@@ -1160,9 +1251,26 @@ } if (entity instanceof EntityPlayer && entity.hurtMarked) { @@ -286,7 +286,7 @@ } if (flag2) { -@@ -1211,7 +1319,14 @@ +@@ -1207,7 +1315,14 @@ this.a(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F)); if (j > 0) { @@ -302,7 +302,7 @@ } if (this.level instanceof WorldServer && f5 > 2.0F) { -@@ -1221,12 +1336,17 @@ +@@ -1217,12 +1332,17 @@ } } @@ -321,7 +321,7 @@ } } -@@ -1299,6 +1419,12 @@ +@@ -1295,6 +1415,12 @@ public void a(ItemStack itemstack, ItemStack itemstack1, ClickAction clickaction) {} public Either sleep(BlockPosition blockposition) { @@ -334,7 +334,7 @@ this.entitySleep(blockposition); this.sleepCounter = 0; return Either.right(Unit.INSTANCE); -@@ -1383,9 +1509,9 @@ +@@ -1379,9 +1505,9 @@ super.jump(); this.a(StatisticList.JUMP); if (this.isSprinting()) { @@ -346,7 +346,7 @@ } } -@@ -1419,7 +1545,11 @@ +@@ -1415,7 +1541,11 @@ this.setMot(vec3d2.x, d3 * 0.6D, vec3d2.z); this.flyingSpeed = f; this.fallDistance = 0.0F; @@ -359,7 +359,7 @@ } else { super.g(vec3d); } -@@ -1454,19 +1584,19 @@ +@@ -1450,19 +1580,19 @@ i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); if (i > 0) { this.a(StatisticList.SWIM_ONE_CM, i); @@ -382,7 +382,7 @@ } } else if (this.isClimbing()) { if (d1 > 0.0D) { -@@ -1477,13 +1607,13 @@ +@@ -1473,13 +1603,13 @@ if (i > 0) { if (this.isSprinting()) { this.a(StatisticList.SPRINT_ONE_CM, i); @@ -399,7 +399,7 @@ } } } else if (this.isGliding()) { -@@ -1549,12 +1679,24 @@ +@@ -1545,12 +1675,24 @@ } public void startGliding() { @@ -425,7 +425,7 @@ } @Override -@@ -1644,10 +1786,21 @@ +@@ -1640,10 +1782,21 @@ return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); } @@ -448,7 +448,7 @@ } } -@@ -1724,15 +1877,22 @@ +@@ -1720,15 +1873,22 @@ @Override public void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack) { @@ -474,7 +474,7 @@ this.inventory.armor.set(enumitemslot.b(), itemstack); } -@@ -1773,26 +1933,31 @@ +@@ -1769,26 +1929,31 @@ protected void releaseShoulderEntities() { if (this.timeEntitySatOnShoulder + 20L < this.level.getTime()) { diff --git a/paper-server/nms-patches/net/minecraft/world/food/FoodMetaData.patch b/paper-server/nms-patches/net/minecraft/world/food/FoodMetaData.patch index 6634432918..81911a86ce 100644 --- a/paper-server/nms-patches/net/minecraft/world/food/FoodMetaData.patch +++ b/paper-server/nms-patches/net/minecraft/world/food/FoodMetaData.patch @@ -73,7 +73,7 @@ @@ -49,23 +84,25 @@ - if (flag && this.saturationLevel > 0.0F && entityhuman.ft() && this.foodLevel >= 20) { + if (flag && this.saturationLevel > 0.0F && entityhuman.fu() && this.foodLevel >= 20) { ++this.tickTimer; - if (this.tickTimer >= 10) { + if (this.tickTimer >= this.saturatedRegenRate) { // CraftBukkit @@ -86,7 +86,7 @@ + entityhuman.applyExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent this.tickTimer = 0; } - } else if (flag && this.foodLevel >= 18 && entityhuman.ft()) { + } else if (flag && this.foodLevel >= 18 && entityhuman.fu()) { ++this.tickTimer; - if (this.tickTimer >= 80) { - entityhuman.heal(1.0F); diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/Container.patch b/paper-server/nms-patches/net/minecraft/world/inventory/Container.patch index 49454f40d7..79a2a921ac 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/Container.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/Container.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/inventory/Container.java +++ b/net/minecraft/world/inventory/Container.java -@@ -29,6 +29,20 @@ +@@ -30,6 +30,20 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.TileEntity; @@ -21,16 +21,7 @@ public abstract class Container { public static final int SLOT_CLICKED_OUTSIDE = -999; -@@ -43,7 +57,7 @@ - public NonNullList slots = NonNullList.a(); - private final List dataSlots = Lists.newArrayList(); - private ItemStack carried; -- private final NonNullList remoteSlots; -+ public NonNullList remoteSlots; - private final IntList remoteDataSlots; - private ItemStack remoteCarried; - @Nullable -@@ -57,6 +71,27 @@ +@@ -59,6 +73,27 @@ private ContainerSynchronizer synchronizer; private boolean suppressRemoteUpdates; @@ -58,7 +49,7 @@ protected Container(@Nullable Containers containers, int i) { this.carried = ItemStack.EMPTY; this.remoteSlots = NonNullList.a(); -@@ -154,6 +189,15 @@ +@@ -156,6 +191,15 @@ } @@ -74,16 +65,16 @@ public void b(ICrafting icrafting) { this.containerListeners.remove(icrafting); } -@@ -338,7 +382,7 @@ +@@ -370,7 +414,7 @@ } } else if (this.quickcraftStatus == 2) { if (!this.quickcraftSlots.isEmpty()) { - if (this.quickcraftSlots.size() == 1) { + if (false && this.quickcraftSlots.size() == 1) { // CraftBukkit - treat everything as a drag since we are unable to easily call InventoryClickEvent instead k = ((Slot) this.quickcraftSlots.iterator().next()).index; - this.e(); + this.f(); this.b(k, this.quickcraftType, InventoryClickType.PICKUP, entityhuman); -@@ -349,6 +393,7 @@ +@@ -381,6 +425,7 @@ l = this.getCarried().getCount(); Iterator iterator = this.quickcraftSlots.iterator(); @@ -91,16 +82,18 @@ while (iterator.hasNext()) { Slot slot1 = (Slot) iterator.next(); ItemStack itemstack2 = this.getCarried(); -@@ -365,12 +410,48 @@ +@@ -397,12 +442,48 @@ } l -= itemstack3.getCount() - j1; - slot1.set(itemstack3); + // slot1.set(itemstack3); + draggedSlots.put(slot1.index, itemstack3); // CraftBukkit - Put in map instead of setting -+ } -+ } -+ + } + } + +- itemstack1.setCount(l); +- this.setCarried(itemstack1); + // CraftBukkit start - InventoryDragEvent + InventoryView view = getBukkitView(); + org.bukkit.inventory.ItemStack newcursor = CraftItemStack.asCraftMirror(itemstack1); @@ -129,21 +122,19 @@ + if (this.getCarried() != null) { + this.setCarried(CraftItemStack.asNMSCopy(event.getCursor())); + needsUpdate = true; - } ++ } + } else { + this.setCarried(oldCursor); - } - -- itemstack1.setCount(l); -- this.setCarried(itemstack1); ++ } ++ + if (needsUpdate && entityhuman instanceof EntityPlayer) { + this.updateInventory(); + } + // CraftBukkit end } - this.e(); -@@ -388,8 +469,11 @@ + this.f(); +@@ -420,8 +501,11 @@ if (i == -999) { if (!this.getCarried().isEmpty()) { if (clickaction == ClickAction.PRIMARY) { @@ -156,36 +147,39 @@ } else { entityhuman.drop(this.getCarried().cloneAndSubtract(1), true); } -@@ -452,6 +536,15 @@ +@@ -484,6 +568,15 @@ } slot.d(); + // CraftBukkit start - Make sure the client has the right slot contents + if (entityhuman instanceof EntityPlayer && slot.getMaxStackSize() != 64) { -+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutSetSlot(this.containerId, slot.index, slot.getItem())); ++ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutSetSlot(this.containerId, this.incrementStateId(), slot.index, slot.getItem())); + // Updating a crafting inventory makes the client reset the result slot, have to send it again + if (this.getBukkitView().getType() == InventoryType.WORKBENCH || this.getBukkitView().getType() == InventoryType.CRAFTING) { -+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutSetSlot(this.containerId, 0, this.getSlot(0).getItem())); ++ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutSetSlot(this.containerId, this.incrementStateId(), 0, this.getSlot(0).getItem())); + } + } + // CraftBukkit end } } else { Slot slot2; -@@ -556,8 +649,11 @@ +@@ -591,13 +684,14 @@ + ItemStack itemstack = this.getCarried(); - public void b(EntityHuman entityhuman) { - if (!this.getCarried().isEmpty()) { -- entityhuman.drop(this.getCarried(), false); -+ // CraftBukkit start - SPIGOT-4556 -+ ItemStack carried = this.getCarried(); - this.setCarried(ItemStack.EMPTY); -+ entityhuman.drop(carried, false); -+ // CraftBukkit end + if (!itemstack.isEmpty()) { ++ this.setCarried(ItemStack.EMPTY); // CraftBukkit - SPIGOT-4556 - from below + if (entityhuman.isAlive() && !((EntityPlayer) entityhuman).q()) { + entityhuman.getInventory().f(itemstack); + } else { + entityhuman.drop(itemstack, false); + } + +- this.setCarried(ItemStack.EMPTY); ++ // this.setCarried(ItemStack.EMPTY); // CraftBukkit - moved up + } } - } -@@ -767,6 +863,11 @@ +@@ -811,6 +905,11 @@ } public ItemStack getCarried() { diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvil.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvil.patch index 8b93104d13..2335847f8a 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvil.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerAnvil.patch @@ -22,15 +22,7 @@ public ContainerAnvil(int i, PlayerInventory playerinventory) { this(i, playerinventory, ContainerAccess.NULL); -@@ -85,7 +93,6 @@ - if (iblockdata1 == null) { - world.a(blockposition, false); - world.triggerEffect(1029, blockposition, 0); -- entityhuman.getInventory().f(itemstack); - } else { - world.setTypeAndData(blockposition, iblockdata1, 2); - world.triggerEffect(1030, blockposition, 0); -@@ -107,7 +114,7 @@ +@@ -106,7 +114,7 @@ byte b1 = 0; if (itemstack.isEmpty()) { @@ -39,7 +31,7 @@ this.cost.set(0); } else { ItemStack itemstack1 = itemstack.cloneItemStack(); -@@ -125,7 +132,7 @@ +@@ -124,7 +132,7 @@ if (itemstack1.f() && itemstack1.getItem().a(itemstack, itemstack2)) { k = Math.min(itemstack1.getDamage(), itemstack1.i() / 4); if (k <= 0) { @@ -48,7 +40,7 @@ this.cost.set(0); return; } -@@ -140,7 +147,7 @@ +@@ -139,7 +147,7 @@ this.repairItemCountCost = i1; } else { if (!flag && (!itemstack1.a(itemstack2.getItem()) || !itemstack1.f())) { @@ -57,7 +49,7 @@ this.cost.set(0); return; } -@@ -230,7 +237,7 @@ +@@ -229,7 +237,7 @@ } if (flag2 && !flag1) { @@ -66,7 +58,7 @@ this.cost.set(0); return; } -@@ -254,11 +261,11 @@ +@@ -253,11 +261,11 @@ itemstack1 = ItemStack.EMPTY; } @@ -81,7 +73,7 @@ itemstack1 = ItemStack.EMPTY; } -@@ -277,7 +284,7 @@ +@@ -276,7 +284,7 @@ EnchantmentManager.a(map, itemstack1); } @@ -90,8 +82,8 @@ this.d(); } } -@@ -304,4 +311,18 @@ - public int j() { +@@ -303,4 +311,18 @@ + public int m() { return this.cost.get(); } + diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerLoom.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerLoom.patch index 86599ad7f6..c3271ac1bd 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerLoom.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerLoom.patch @@ -66,7 +66,7 @@ + player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit } - public int i() { + public int l() { @@ -124,6 +161,7 @@ @Override diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerMerchant.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerMerchant.patch index 9a5707312b..c60de9ef25 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerMerchant.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerMerchant.patch @@ -40,7 +40,7 @@ @@ -154,7 +170,7 @@ } - private void o() { + private void r() { - if (!this.trader.getWorld().isClientSide) { + if (!this.trader.getWorld().isClientSide && this.trader instanceof Entity) { // CraftBukkit - SPIGOT-5035 Entity entity = (Entity) this.trader; diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerPlayer.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerPlayer.patch index 260908f348..c700e007c0 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerPlayer.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerPlayer.patch @@ -46,7 +46,7 @@ int i; @@ -242,4 +261,17 @@ public boolean d(int i) { - return i != this.j(); + return i != this.m(); } + + // CraftBukkit start diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerStonecutter.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerStonecutter.patch index 48f7644a22..1bf0611059 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerStonecutter.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerStonecutter.patch @@ -57,7 +57,7 @@ + player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit } - public int i() { + public int l() { @@ -120,6 +150,7 @@ @Override diff --git a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerWorkbench.patch b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerWorkbench.patch index 1750fc4c34..f7918e469e 100644 --- a/paper-server/nms-patches/net/minecraft/world/inventory/ContainerWorkbench.patch +++ b/paper-server/nms-patches/net/minecraft/world/inventory/ContainerWorkbench.patch @@ -58,7 +58,7 @@ @@ -202,4 +216,17 @@ public boolean d(int i) { - return i != this.j(); + return i != this.m(); } + + // CraftBukkit start 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 e4db80236a..e827176ac4 100644 --- a/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch +++ b/paper-server/nms-patches/net/minecraft/world/item/ItemStack.patch @@ -49,7 +49,7 @@ decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); }); public static final String TAG_ENCH = "Enchantments"; -@@ -142,16 +175,30 @@ +@@ -140,16 +173,30 @@ this.checkEmpty(); } @@ -82,7 +82,7 @@ this.getItem().b(this.tag); } -@@ -159,6 +206,11 @@ +@@ -157,6 +204,11 @@ this.setDamage(this.getDamage()); } @@ -94,7 +94,7 @@ this.checkEmpty(); } -@@ -196,7 +248,7 @@ +@@ -194,7 +246,7 @@ return this.getItem() == item; } @@ -103,7 +103,7 @@ EntityHuman entityhuman = itemactioncontext.getEntity(); BlockPosition blockposition = itemactioncontext.getClickPosition(); ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getWorld(), blockposition, false); -@@ -204,12 +256,155 @@ +@@ -202,12 +254,155 @@ if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.b(itemactioncontext.getWorld().r(), shapedetectorblock)) { return EnumInteractionResult.PASS; } else { @@ -260,7 +260,7 @@ return enuminteractionresult; } -@@ -290,6 +485,21 @@ +@@ -288,6 +483,21 @@ } i -= k; @@ -282,7 +282,7 @@ if (i <= 0) { return false; } -@@ -311,6 +521,11 @@ +@@ -309,6 +519,11 @@ if (this.isDamaged(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) { consumer.accept(t0); Item item = this.getItem(); @@ -294,7 +294,7 @@ this.subtract(1); if (t0 instanceof EntityHuman) { -@@ -466,6 +681,17 @@ +@@ -464,6 +679,17 @@ return this.tag; } @@ -312,7 +312,7 @@ public NBTTagCompound getOrCreateTag() { if (this.tag == null) { this.setTag(new NBTTagCompound()); -@@ -849,6 +1075,12 @@ +@@ -844,6 +1070,12 @@ } public void setRepairCost(int i) { @@ -325,7 +325,7 @@ this.getOrCreateTag().setInt("RepairCost", i); } -@@ -898,6 +1130,13 @@ +@@ -893,6 +1125,13 @@ nbttaglist.add(nbttagcompound); } diff --git a/paper-server/nms-patches/net/minecraft/world/item/ItemWorldMap.patch b/paper-server/nms-patches/net/minecraft/world/item/ItemWorldMap.patch index 4190db0205..7c79815a78 100644 --- a/paper-server/nms-patches/net/minecraft/world/item/ItemWorldMap.patch +++ b/paper-server/nms-patches/net/minecraft/world/item/ItemWorldMap.patch @@ -12,7 +12,7 @@ public class ItemWorldMap extends ItemWorldMapBase { public static final int IMAGE_WIDTH = 128; -@@ -68,14 +73,18 @@ +@@ -68,7 +73,7 @@ public static Integer d(ItemStack itemstack) { NBTTagCompound nbttagcompound = itemstack.getTag(); @@ -20,9 +20,8 @@ + return nbttagcompound != null && nbttagcompound.hasKeyOfType("map", 99) ? nbttagcompound.getInt("map") : -1; // CraftBukkit - make new maps for no tag } -- private static int a(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey resourcekey) { -+ public static int a(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey resourcekey) { // PAIL private -> public - WorldMap worldmap = WorldMap.a((double) i, (double) j, (byte) k, flag, flag1, resourcekey); + public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey resourcekey) { +@@ -76,6 +81,10 @@ int l = world.getWorldMapCount(); world.a(a(l), worldmap); diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/BlockComposter.patch b/paper-server/nms-patches/net/minecraft/world/level/block/BlockComposter.patch index 17f64ba329..d2c7eb2e00 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/BlockComposter.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/BlockComposter.patch @@ -86,7 +86,7 @@ return iblockdata; } else { int j = i + 1; -@@ -322,10 +349,11 @@ +@@ -322,7 +349,8 @@ public IWorldInventory a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) { int i = (Integer) iblockdata.get(BlockComposter.LEVEL); @@ -95,11 +95,7 @@ + return (IWorldInventory) (i == 8 ? new BlockComposter.ContainerOutput(iblockdata, generatoraccess, blockposition, new ItemStack(Items.BONE_MEAL)) : (i < 7 ? new BlockComposter.ContainerInput(iblockdata, generatoraccess, blockposition) : new BlockComposter.ContainerEmpty(generatoraccess, blockposition))); } -- private static class ContainerOutput extends InventorySubcontainer implements IWorldInventory { -+ public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory { - - private final IBlockData state; - private final GeneratorAccess level; + public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory { @@ -337,6 +365,7 @@ this.state = iblockdata; this.level = generatoraccess; @@ -108,7 +104,7 @@ } @Override -@@ -361,12 +390,19 @@ +@@ -361,8 +390,15 @@ @Override public void update() { @@ -126,11 +122,6 @@ } } -- private static class ContainerInput extends InventorySubcontainer implements IWorldInventory { -+ public static class ContainerInput extends InventorySubcontainer implements IWorldInventory { - - private final IBlockData state; - private final GeneratorAccess level; @@ -375,6 +411,7 @@ public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) { @@ -139,12 +130,9 @@ this.state = iblockdata; this.level = generatoraccess; this.pos = blockposition; -@@ -415,10 +452,11 @@ - } - } +@@ -417,8 +454,9 @@ -- private static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory { -+ public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory { + public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory { - public ContainerEmpty() { + public ContainerEmpty(GeneratorAccess generatoraccess, BlockPosition blockposition) { // CraftBukkit diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/BlockTallPlant.patch b/paper-server/nms-patches/net/minecraft/world/level/block/BlockTallPlant.patch index f0eaee3680..425b550426 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/BlockTallPlant.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/BlockTallPlant.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/BlockTallPlant.java +++ b/net/minecraft/world/level/block/BlockTallPlant.java -@@ -84,6 +84,11 @@ +@@ -92,6 +92,11 @@ } protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/LayeredCauldronBlock.patch b/paper-server/nms-patches/net/minecraft/world/level/block/LayeredCauldronBlock.patch index d4676a267f..09c93f6292 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/block/LayeredCauldronBlock.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/block/LayeredCauldronBlock.patch @@ -64,7 +64,7 @@ + @Override public void a(IBlockData iblockdata, World world, BlockPosition blockposition, BiomeBase.Precipitation biomebase_precipitation) { - if (BlockCauldron.a(world) && (Integer) iblockdata.get(LayeredCauldronBlock.LEVEL) != 3 && this.fillPredicate.test(biomebase_precipitation)) { + if (BlockCauldron.a(world, biomebase_precipitation) && (Integer) iblockdata.get(LayeredCauldronBlock.LEVEL) != 3 && this.fillPredicate.test(biomebase_precipitation)) { - world.setTypeUpdate(blockposition, (IBlockData) iblockdata.a((IBlockState) LayeredCauldronBlock.LEVEL)); + changeLevel(iblockdata, world, blockposition, (IBlockData) iblockdata.a((IBlockState) LayeredCauldronBlock.LEVEL), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit } diff --git a/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntitySkull.patch b/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntitySkull.patch deleted file mode 100644 index 8b1853c7b5..0000000000 --- a/paper-server/nms-patches/net/minecraft/world/level/block/entity/TileEntitySkull.patch +++ /dev/null @@ -1,7 +0,0 @@ ---- a/net/minecraft/world/level/block/entity/TileEntitySkull.java -+++ b/net/minecraft/world/level/block/entity/TileEntitySkull.java -@@ -1,3 +1,4 @@ -+// mc-dev import - package net.minecraft.world.level.block.entity; - - import com.google.common.collect.Iterables; diff --git a/paper-server/nms-patches/net/minecraft/world/level/storage/Convertable.patch b/paper-server/nms-patches/net/minecraft/world/level/storage/Convertable.patch index 48a2d3fa1b..ce0584df92 100644 --- a/paper-server/nms-patches/net/minecraft/world/level/storage/Convertable.patch +++ b/paper-server/nms-patches/net/minecraft/world/level/storage/Convertable.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/storage/Convertable.java +++ b/net/minecraft/world/level/storage/Convertable.java -@@ -60,6 +60,10 @@ +@@ -61,6 +61,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -11,7 +11,7 @@ public class Convertable { static final Logger LOGGER = LogManager.getLogger(); -@@ -105,26 +109,26 @@ +@@ -106,26 +110,26 @@ Logger logger = Convertable.LOGGER; Objects.requireNonNull(logger); @@ -42,7 +42,7 @@ return new IllegalStateException("Failed to get noise settings registry"); }); -@@ -294,9 +298,23 @@ +@@ -302,9 +306,23 @@ return this.backupDir; } @@ -68,7 +68,7 @@ public class ConversionSession implements AutoCloseable { -@@ -304,8 +322,12 @@ +@@ -312,8 +330,12 @@ public final Path levelPath; private final String levelId; private final Map resources = Maps.newHashMap(); @@ -82,7 +82,7 @@ this.levelId = s; this.levelPath = Convertable.this.baseDir.resolve(s); this.lock = SessionLock.a(this.levelPath); -@@ -322,7 +344,7 @@ +@@ -330,7 +352,7 @@ } public File a(ResourceKey resourcekey) { diff --git a/paper-server/pom.xml b/paper-server/pom.xml index 5f1bee794e..1a65c62624 100644 --- a/paper-server/pom.xml +++ b/paper-server/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.17-R0.1-SNAPSHOT + 1.17.1-R0.1-SNAPSHOT CraftBukkit https://www.spigotmc.org/ diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftProfileBanList.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftProfileBanList.java index b6143d474b..250df57007 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftProfileBanList.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftProfileBanList.java @@ -104,6 +104,6 @@ public class CraftProfileBanList implements org.bukkit.BanList { // } - return (uuid != null) ? MinecraftServer.getServer().getUserCache().getProfile(uuid) : MinecraftServer.getServer().getUserCache().getProfile(target); + return ((uuid != null) ? MinecraftServer.getServer().getUserCache().getProfile(uuid) : MinecraftServer.getServer().getUserCache().getProfile(target)).orElse(null); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 997c596656..73bb34b63c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1051,7 +1051,7 @@ public final class CraftServer implements Server { console.levels.put(internal.getDimensionKey(), internal); getServer().loadSpawn(internal.getChunkProvider().chunkMap.progressListener, internal); - internal.entityManager.a(); // SPIGOT-6526: Load pending entities so they are available to the API + internal.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API pluginManager.callEvent(new WorldLoadEvent(internal.getWorld())); return internal.getWorld(); @@ -1362,7 +1362,7 @@ public final class CraftServer implements Server { net.minecraft.world.level.World minecraftWorld = ((CraftWorld) world).getHandle(); // creates a new map at world spawn with the scale of 3, with out tracking position and unlimited tracking - int newId = ItemWorldMap.a(minecraftWorld, minecraftWorld.getWorldData().a(), minecraftWorld.getWorldData().c(), 3, false, false, minecraftWorld.getDimensionKey()); + int newId = ItemWorldMap.createNewSavedData(minecraftWorld, minecraftWorld.getWorldData().a(), minecraftWorld.getWorldData().c(), 3, false, false, minecraftWorld.getDimensionKey()); return minecraftWorld.a(ItemWorldMap.a(newId)).mapView; } @@ -1429,7 +1429,7 @@ public final class CraftServer implements Server { OfflinePlayer result = getPlayerExact(name); if (result == null) { // This is potentially blocking :( - GameProfile profile = console.getUserCache().getProfile(name); + GameProfile profile = console.getUserCache().getProfile(name).orElse(null); if (profile == null) { // Make an OfflinePlayer using an offline mode UUID since the name has no profile result = getOfflinePlayer(new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name)); @@ -1520,12 +1520,12 @@ public final class CraftServer implements Server { @Override public boolean isWhitelistEnforced() { - return console.aN(); + return console.isEnforceWhitelist(); } @Override public void setWhitelistEnforced(boolean value) { - console.h(value); + console.setEnforceWhitelist(value); } @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 8ade9efa7b..e14685a8d7 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java @@ -181,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/block/CraftSkull.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java index 22aa6479c9..46a968f83c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java @@ -70,7 +70,7 @@ public class CraftSkull extends CraftBlockEntityState implement return false; } - GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name); + GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name).orElse(null); if (profile == null) { return false; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java index e612b9bf18..9aa0cbb7fc 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java @@ -53,7 +53,7 @@ public class CraftAnimals extends CraftAgeable implements Animals { @Override public boolean isBreedItem(ItemStack itemStack) { - return getHandle().n(CraftItemStack.asNMSCopy(itemStack)); + return getHandle().isBreedItem(CraftItemStack.asNMSCopy(itemStack)); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 952f2d5119..3b9604f6f9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -580,7 +580,8 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @Override public boolean dropItem(boolean dropAll) { - return getHandle().dropItem(dropAll); + if (!(getHandle() instanceof EntityPlayer)) return false; + return ((EntityPlayer) getHandle()).dropItem(dropAll); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java index 17b867212a..fb38e69293 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -110,7 +110,7 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i } else if (index > 35) { index = 8 - (index - 36); } - player.connection.sendPacket(new PacketPlayOutSetSlot(player.inventoryMenu.containerId, index, CraftItemStack.asNMSCopy(item))); + player.connection.sendPacket(new PacketPlayOutSetSlot(player.inventoryMenu.containerId, player.inventoryMenu.incrementStateId(), index, CraftItemStack.asNMSCopy(item))); } @Override 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 defaec7869..0a50db0876 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 "acd6e6c27e5a0a9440afba70a96c27c9"; + return "f0e3dfc7390de285a4693518dd5bd126"; } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftVoxelShape.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftVoxelShape.java index 6f29fcca03..cef9490dda 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftVoxelShape.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftVoxelShape.java @@ -18,7 +18,7 @@ public final class CraftVoxelShape implements org.bukkit.util.VoxelShape { @Override public Collection getBoundingBoxes() { - List boxes = shape.d(); // PAIL rename toList + List boxes = shape.toList(); List craftBoxes = new ArrayList<>(boxes.size()); for (AxisAlignedBB aabb : boxes) { craftBoxes.add(new BoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ));