diff --git a/.gitignore b/.gitignore index e27c347df..66c10a78d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,10 @@ Akarin-Server Akarin-API mc-dev -.idea testserver run -/akarin-paperclip.jar +gradle +*.jar # Compiled class file *.class @@ -19,11 +19,16 @@ run # Mobile Tools for Java (J2ME) .mtj.tmp/ +# Eclipse +.settings/ +.project + # IntelliJ *.iml *.ipr *.iws .idea/ +.idea out/ # Maven diff --git a/README.md b/README.md index 796c94f8c..c487d2fc7 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Demo Servers --- * [Fair Server](https://fairserver.ru) +* [LoyaltyMC](https://www.loyaltymc.net/) *Open an [Issue](https://github.com/Akarin-project/Akarin/issues) or a [Pull Request](https://github.com/Akarin-project/Akarin/pulls) if you want to add your website here* diff --git a/patches/api/0001-POM-Changes.patch b/patches/api/0001-POM-Changes.patch index a8441d252..571208a83 100644 --- a/patches/api/0001-POM-Changes.patch +++ b/patches/api/0001-POM-Changes.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From 7c3f22c070e5d9027dace7cf295292444472579f Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Fri, 14 Dec 2018 21:52:29 -0800 Subject: [PATCH] POM Changes diff --git a/pom.xml b/pom.xml -index 2cb9714084c8a7aa1b20d445edd5be4cc206672f..d167304be5ca4d067886a9740230b25b9fa21b56 100644 +index 2cb97140..d167304b 100644 --- a/pom.xml +++ b/pom.xml @@ -3,18 +3,18 @@ @@ -34,3 +34,6 @@ index 2cb9714084c8a7aa1b20d445edd5be4cc206672f..d167304be5ca4d067886a9740230b25b An enhanced plugin API for Minecraft servers. +-- +2.25.1.windows.1 + diff --git a/patches/api/0002-Server-Config.patch b/patches/api/0002-Server-Config.patch index 1ca421696..c0c5d38d7 100644 --- a/patches/api/0002-Server-Config.patch +++ b/patches/api/0002-Server-Config.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From 5d805daa7d4b42c7700a065a98678a0d58b80947 Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Fri, 3 Apr 2020 15:18:38 +0800 Subject: [PATCH] Server Config diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java -index 93d5a3f97a1b2b3a1cd2731d48e8ebd01d29aa91..08e428bd3aafa1aa9c601da832766906b070190e 100644 +index 93d5a3f9..08e428bd 100644 --- a/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java @@ -206,7 +206,8 @@ class TimingsExport extends Thread { @@ -20,7 +20,7 @@ index 93d5a3f97a1b2b3a1cd2731d48e8ebd01d29aa91..08e428bd3aafa1aa9c601da832766906 new TimingsExport(listeners, parent, history).start(); diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 9ceaac0e859e347b07fa9f4c6507a73deb280670..7444b41592b143fe886e2a3df95442e4bdc5c6f1 100644 +index 9ceaac0e..7444b415 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1386,6 +1386,14 @@ public interface Server extends PluginMessageRecipient { @@ -38,3 +38,6 @@ index 9ceaac0e859e347b07fa9f4c6507a73deb280670..7444b41592b143fe886e2a3df95442e4 /** * Sends the component to the player * +-- +2.25.1.windows.1 + diff --git a/patches/server/0001-POM-Changes.patch b/patches/server/0001-POM-Changes.patch index bf69c049f..41329cf3e 100644 --- a/patches/server/0001-POM-Changes.patch +++ b/patches/server/0001-POM-Changes.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From e9f7cd8c44e8e9fa8fa6091cfc231f0a2425737f Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Fri, 14 Dec 2018 21:53:58 -0800 Subject: [PATCH] POM Changes diff --git a/pom.xml b/pom.xml -index 55679af926485eca6bb0b9ed368a4c91c8a7e37e..19f87edb55a48b151f81f899cedbc573aec66405 100644 +index 55679af92..19f87edb5 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,11 @@ @@ -67,7 +67,7 @@ index 55679af926485eca6bb0b9ed368a4c91c8a7e37e..19f87edb55a48b151f81f899cedbc573 diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java -index 674096cab190d62622f9947853b056f57d43a2a5..9a7235b8e525fbc52ff7ce53156816f9bbdb5d6f 100644 +index 674096cab..9a7235b8e 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java @@ -11,7 +11,7 @@ public final class Versioning { @@ -79,3 +79,6 @@ index 674096cab190d62622f9947853b056f57d43a2a5..9a7235b8e525fbc52ff7ce53156816f9 Properties properties = new Properties(); if (stream != null) { +-- +2.25.1.windows.1 + diff --git a/patches/server/0002-Brand-changes.patch b/patches/server/0002-Brand-changes.patch index 8f65dacd6..7cc9a3b97 100644 --- a/patches/server/0002-Brand-changes.patch +++ b/patches/server/0002-Brand-changes.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From 075ad41da85158264b2df37852138991654cb26e Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Tue, 18 Dec 2018 06:27:02 -0800 Subject: [PATCH] Brand changes diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index cf00f35a5b7c2d2f6b6989e0855de8b882dcef50..a45e63a02759305e119a41eac55a7f40488dd12c 100644 +index cf00f35a5..a45e63a02 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java @@ -70,7 +70,7 @@ public class EULA { @@ -19,7 +19,7 @@ index cf00f35a5b7c2d2f6b6989e0855de8b882dcef50..a45e63a02759305e119a41eac55a7f40 throwable = throwable1; throw throwable1; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2686874f26b7319c50201e62af68aca92edb69b3..c8b10a039f0592d03cc4c0de90da2b62c9aeaeba 100644 +index 2686874f2..c8b10a039 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1510,7 +1510,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Thu, 2 Apr 2020 11:29:08 +0800 Subject: [PATCH] Avoid double I/O operation on load player file diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 350ac42d6b45a1023f6254de7706818775b7957b..65cc7b2052fcb6f349dad9177ba975d75d720462 100644 +index 350ac42d6..65cc7b205 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java @@ -165,7 +165,8 @@ public class WorldNBTStorage implements IPlayerFileData { @@ -28,3 +28,6 @@ index 350ac42d6b45a1023f6254de7706818775b7957b..65cc7b2052fcb6f349dad9177ba975d7 nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file))); } // Spigot Start +-- +2.25.1.windows.1 + diff --git a/patches/server/0004-Don-t-trigger-Lootable-Refresh-for-non-player-intera.patch b/patches/server/0004-Don-t-trigger-Lootable-Refresh-for-non-player-intera.patch index c391f5647..6a4b5b86f 100644 --- a/patches/server/0004-Don-t-trigger-Lootable-Refresh-for-non-player-intera.patch +++ b/patches/server/0004-Don-t-trigger-Lootable-Refresh-for-non-player-intera.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From 996bc6f14593ca3bf46438e00027064d799a9eb9 Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Thu, 2 Apr 2020 11:43:20 +0800 Subject: [PATCH] Don't trigger Lootable Refresh for non player interaction diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index d4cbce3243fe1f4973c9c0ae0dbdab10e3390897..0ff6ebbf971651fff0d3504a458e81df8e915389 100644 +index d4cbce324..0ff6ebbf9 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java @@ -49,6 +49,7 @@ public abstract class TileEntityLootable extends TileEntityContainer { @@ -17,3 +17,6 @@ index d4cbce3243fe1f4973c9c0ae0dbdab10e3390897..0ff6ebbf971651fff0d3504a458e81df if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable); +-- +2.25.1.windows.1 + diff --git a/patches/server/0005-never-drop-items-on-command-give.patch b/patches/server/0005-never-drop-items-on-command-give.patch index 09dd83e94..8800bc748 100644 --- a/patches/server/0005-never-drop-items-on-command-give.patch +++ b/patches/server/0005-never-drop-items-on-command-give.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From a2a2cbe3ed2d3397e61c0e335ddd019834f8c1ec Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Thu, 2 Apr 2020 11:35:19 +0800 Subject: [PATCH] never drop items on command "/give" diff --git a/src/main/java/net/minecraft/server/CommandGive.java b/src/main/java/net/minecraft/server/CommandGive.java -index 81b26bb4d094f8aede9d5432671936ab3ee42c84..1f3097c9450b5903c35d3b36fd642ddd131786d7 100644 +index 81b26bb4d..1f3097c94 100644 --- a/src/main/java/net/minecraft/server/CommandGive.java +++ b/src/main/java/net/minecraft/server/CommandGive.java @@ -36,6 +36,7 @@ public class CommandGive { @@ -17,3 +17,6 @@ index 81b26bb4d094f8aede9d5432671936ab3ee42c84..1f3097c9450b5903c35d3b36fd642ddd if (flag && itemstack.isEmpty()) { itemstack.setCount(1); entityitem = entityplayer.drop(itemstack, false); +-- +2.25.1.windows.1 + diff --git a/patches/server/0006-Save-json-list-async.patch b/patches/server/0006-Save-json-list-async.patch index 0b586523e..a21c2387a 100644 --- a/patches/server/0006-Save-json-list-async.patch +++ b/patches/server/0006-Save-json-list-async.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From dd729a9d2c43e67dc5481fadb05c0328426c66d1 Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Thu, 2 Apr 2020 11:16:18 +0800 Subject: [PATCH] Save json list async diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index c97be42dd7b4c6ea2cadcc97f47185c7f02e2cce..370841cad06121651d0c981c23f3a5e268dc3f59 100644 +index c97be42dd..370841cad 100644 --- a/src/main/java/net/minecraft/server/JsonList.java +++ b/src/main/java/net/minecraft/server/JsonList.java @@ -168,6 +168,7 @@ public class JsonList> { @@ -32,3 +32,6 @@ index c97be42dd7b4c6ea2cadcc97f47185c7f02e2cce..370841cad06121651d0c981c23f3a5e2 } public void load() throws FileNotFoundException { +-- +2.25.1.windows.1 + diff --git a/patches/server/0007-Remove-method-profiler-callers.patch b/patches/server/0007-Remove-method-profiler-callers.patch index d821bbdd8..1185515ad 100644 --- a/patches/server/0007-Remove-method-profiler-callers.patch +++ b/patches/server/0007-Remove-method-profiler-callers.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From 3ba075eaca355647259518afff4ffa3e9425d385 Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Thu, 2 Apr 2020 12:30:35 +0800 Subject: [PATCH] Remove method profiler callers diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index f741a034e8eae0a250aa16b26e56f173c88a9769..ae40078d0ffa13c71337d9422eb0524de08a1458 100644 +index f741a034e..ae40078d0 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -602,33 +602,33 @@ public class ChunkProviderServer extends IChunkProvider { @@ -128,7 +128,7 @@ index f741a034e8eae0a250aa16b26e56f173c88a9769..ae40078d0ffa13c71337d9422eb0524d this.playerChunkMap.g(); diff --git a/src/main/java/net/minecraft/server/CustomFunctionData.java b/src/main/java/net/minecraft/server/CustomFunctionData.java -index ee42e1dfa493c3d7f5af8cc7b8e17e80fcb32b71..bd9684c4ed0d8e71278fbf8547b34899c62c108e 100644 +index ee42e1dfa..bd9684c4e 100644 --- a/src/main/java/net/minecraft/server/CustomFunctionData.java +++ b/src/main/java/net/minecraft/server/CustomFunctionData.java @@ -70,7 +70,7 @@ public class CustomFunctionData implements IResourcePackListener { @@ -159,7 +159,7 @@ index ee42e1dfa493c3d7f5af8cc7b8e17e80fcb32b71..bd9684c4ed0d8e71278fbf8547b34899 ++k; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 6571cf1eee3ba1c064e064a84a5d3135759b58e7..147c5288a567bd7e4a262cc67dbae9c4164b23b8 100644 +index 6571cf1ee..147c5288a 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -395,7 +395,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -268,7 +268,7 @@ index 6571cf1eee3ba1c064e064a84a5d3135759b58e7..147c5288a567bd7e4a262cc67dbae9c4 } else { return null; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 1991cee43d429574f2c0889f807e7cd090f7d7dd..e9f00a1e131faa42d280cab255bc61cd1dcddf2a 100644 +index 1991cee43..e9f00a1e1 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -223,13 +223,13 @@ public abstract class EntityInsentient extends EntityLiving { @@ -353,7 +353,7 @@ index 1991cee43d429574f2c0889f807e7cd090f7d7dd..e9f00a1e131faa42d280cab255bc61cd } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index ad474500e2f6fd6ad6db7bf2436b74c2d9d6136a..e93b7b280968ad1620a24fb06f2e5a503bdecad0 100644 +index ad474500e..e93b7b280 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -242,7 +242,7 @@ public abstract class EntityLiving extends Entity { @@ -452,7 +452,7 @@ index ad474500e2f6fd6ad6db7bf2436b74c2d9d6136a..e93b7b280968ad1620a24fb06f2e5a50 private void n() { diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 6e0020ae0b4d2f2597843129b83fff0d194de337..9d94aa135e1374112c5282e009a8407e2f0e1d37 100644 +index 6e0020ae0..9d94aa135 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -144,9 +144,9 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -468,7 +468,7 @@ index 6e0020ae0b4d2f2597843129b83fff0d194de337..9d94aa135e1374112c5282e009a8407e --this.bB; if (this.bB <= 0) { diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index a353f3d5fa5a5f54335f73584589de3f5cb20d3e..81e699b404c3c93a2a0b50d8960c1276067c6580 100644 +index a353f3d5f..81e699b40 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -285,7 +285,7 @@ public class Explosion { @@ -490,7 +490,7 @@ index a353f3d5fa5a5f54335f73584589de3f5cb20d3e..81e699b404c3c93a2a0b50d8960c1276 } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c8b10a039f0592d03cc4c0de90da2b62c9aeaeba..36e11bb25fce4b63b1a476ccd1b8a3a8e8aab5e8 100644 +index c8b10a039..36e11bb25 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -936,13 +936,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant iterator = this.d.iterator(); iterator.hasNext();) { PathfinderGoalWrapped wrappedGoal = iterator.next(); @@ -664,8 +664,8 @@ index 90319909e55e70dab3999534d836b64c7b5d3df8..cccdf759a4d23d9ec3e2e38e23b257d2 }); - this.e.exit(); - this.e.enter("goalUpdate"); -+ //this.e.exit(); // Akarin - remove caller -+ //this.e.enter("goalUpdate"); // Akarin - remove caller ++ // this.e.exit(); // Akarin - remove caller ++ // this.e.enter("goalUpdate"); // Akarin - remove caller // Paper start - remove streams from pathfindergoalselector goal_update_loop: for (Iterator iterator = this.d.iterator(); iterator.hasNext();) { PathfinderGoalWrapped wrappedGoal = iterator.next(); @@ -675,8 +675,8 @@ index 90319909e55e70dab3999534d836b64c7b5d3df8..cccdf759a4d23d9ec3e2e38e23b257d2 // Paper end - remove streams from pathfindergoalselector - this.e.exit(); - this.e.enter("goalTick"); -+ //this.e.exit(); // Akarin - remove caller -+ //this.e.enter("goalTick"); // Akarin - remove caller ++ // this.e.exit(); // Akarin - remove caller ++ // this.e.enter("goalTick"); // Akarin - remove caller // Paper start - remove streams from pathfindergoalselector for (Iterator iterator = this.d.iterator(); iterator.hasNext();) { PathfinderGoalWrapped wrappedGoal = iterator.next(); @@ -685,12 +685,404 @@ index 90319909e55e70dab3999534d836b64c7b5d3df8..cccdf759a4d23d9ec3e2e38e23b257d2 } // Paper end - remove streams from pathfindergoalselector - this.e.exit(); -+ //this.e.exit(); // Akarin - remove caller ++ // this.e.exit(); // Akarin - remove caller } public Stream c() { +diff --git a/src/main/java/net/minecraft/server/PathfinderTurtle.java~Async pathfinder b/src/main/java/net/minecraft/server/PathfinderTurtle.java~Async pathfinder +new file mode 100644 +index 000000000..1790878ae +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PathfinderTurtle.java~Async pathfinder +@@ -0,0 +1,271 @@ ++package net.minecraft.server; ++ ++import javax.annotation.Nullable; ++ ++public class PathfinderTurtle extends PathfinderNormal { ++ ++ private float k; ++ private float l; ++ ++ public PathfinderTurtle() {} ++ ++ @Override ++ public void a(ChunkCache chunkcache, EntityInsentient entityinsentient) { ++ super.a(chunkcache, entityinsentient); ++ entityinsentient.a(PathType.WATER, 0.0F); ++ this.k = entityinsentient.a(PathType.WALKABLE); ++ entityinsentient.a(PathType.WALKABLE, 6.0F); ++ this.l = entityinsentient.a(PathType.WATER_BORDER); ++ entityinsentient.a(PathType.WATER_BORDER, 4.0F); ++ } ++ ++ @Override ++ public void a() { ++ this.b.a(PathType.WALKABLE, this.k); ++ this.b.a(PathType.WATER_BORDER, this.l); ++ super.a(); ++ } ++ ++ @Override ++ public PathPoint b() { ++ return this.a(MathHelper.floor(this.b.getBoundingBox().minX), MathHelper.floor(this.b.getBoundingBox().minY + 0.5D), MathHelper.floor(this.b.getBoundingBox().minZ)); ++ } ++ ++ @Override ++ public PathDestination a(double d0, double d1, double d2) { ++ return new PathDestination(this.a(MathHelper.floor(d0), MathHelper.floor(d1 + 0.5D), MathHelper.floor(d2))); ++ } ++ ++ @Override ++ public int a(PathPoint[] apathpoint, PathPoint pathpoint) { ++ int i = 0; ++ boolean flag = true; ++ BlockPosition blockposition = new BlockPosition(pathpoint.a, pathpoint.b, pathpoint.c); ++ double d0 = this.a(blockposition); ++ PathPoint pathpoint1 = this.a(pathpoint.a, pathpoint.b, pathpoint.c + 1, 1, d0); ++ PathPoint pathpoint2 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c, 1, d0); ++ PathPoint pathpoint3 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c, 1, d0); ++ PathPoint pathpoint4 = this.a(pathpoint.a, pathpoint.b, pathpoint.c - 1, 1, d0); ++ PathPoint pathpoint5 = this.a(pathpoint.a, pathpoint.b + 1, pathpoint.c, 0, d0); ++ PathPoint pathpoint6 = this.a(pathpoint.a, pathpoint.b - 1, pathpoint.c, 1, d0); ++ ++ if (pathpoint1 != null && !pathpoint1.i) { ++ apathpoint[i++] = pathpoint1; ++ } ++ ++ if (pathpoint2 != null && !pathpoint2.i) { ++ apathpoint[i++] = pathpoint2; ++ } ++ ++ if (pathpoint3 != null && !pathpoint3.i) { ++ apathpoint[i++] = pathpoint3; ++ } ++ ++ if (pathpoint4 != null && !pathpoint4.i) { ++ apathpoint[i++] = pathpoint4; ++ } ++ ++ if (pathpoint5 != null && !pathpoint5.i) { ++ apathpoint[i++] = pathpoint5; ++ } ++ ++ if (pathpoint6 != null && !pathpoint6.i) { ++ apathpoint[i++] = pathpoint6; ++ } ++ ++ boolean flag1 = pathpoint4 == null || pathpoint4.l == PathType.OPEN || pathpoint4.k != 0.0F; ++ boolean flag2 = pathpoint1 == null || pathpoint1.l == PathType.OPEN || pathpoint1.k != 0.0F; ++ boolean flag3 = pathpoint3 == null || pathpoint3.l == PathType.OPEN || pathpoint3.k != 0.0F; ++ boolean flag4 = pathpoint2 == null || pathpoint2.l == PathType.OPEN || pathpoint2.k != 0.0F; ++ PathPoint pathpoint7; ++ ++ if (flag1 && flag4) { ++ pathpoint7 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c - 1, 1, d0); ++ if (pathpoint7 != null && !pathpoint7.i) { ++ apathpoint[i++] = pathpoint7; ++ } ++ } ++ ++ if (flag1 && flag3) { ++ pathpoint7 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c - 1, 1, d0); ++ if (pathpoint7 != null && !pathpoint7.i) { ++ apathpoint[i++] = pathpoint7; ++ } ++ } ++ ++ if (flag2 && flag4) { ++ pathpoint7 = this.a(pathpoint.a - 1, pathpoint.b, pathpoint.c + 1, 1, d0); ++ if (pathpoint7 != null && !pathpoint7.i) { ++ apathpoint[i++] = pathpoint7; ++ } ++ } ++ ++ if (flag2 && flag3) { ++ pathpoint7 = this.a(pathpoint.a + 1, pathpoint.b, pathpoint.c + 1, 1, d0); ++ if (pathpoint7 != null && !pathpoint7.i) { ++ apathpoint[i++] = pathpoint7; ++ } ++ } ++ ++ return i; ++ } ++ ++ private double a(BlockPosition blockposition) { ++ if (!this.b.isInWater()) { ++ BlockPosition blockposition1 = blockposition.down(); ++ VoxelShape voxelshape = this.a.getType(blockposition1).getCollisionShape(this.a, blockposition1); ++ ++ return (double) blockposition1.getY() + (voxelshape.isEmpty() ? 0.0D : voxelshape.c(EnumDirection.EnumAxis.Y)); ++ } else { ++ return (double) blockposition.getY() + 0.5D; ++ } ++ } ++ ++ @Nullable ++ private PathPoint a(int i, int j, int k, int l, double d0) { ++ PathPoint pathpoint = null; ++ BlockPosition blockposition = new BlockPosition(i, j, k); ++ double d1 = this.a(blockposition); ++ ++ if (d1 - d0 > 1.125D) { ++ return null; ++ } else { ++ PathType pathtype = this.a(this.a, i, j, k, this.b, this.d, this.e, this.f, false, false); ++ float f = this.b.a(pathtype); ++ double d2 = (double) this.b.getWidth() / 2.0D; ++ ++ if (f >= 0.0F) { ++ pathpoint = this.a(i, j, k); ++ pathpoint.l = pathtype; ++ pathpoint.k = Math.max(pathpoint.k, f); ++ } ++ ++ if (pathtype != PathType.WATER && pathtype != PathType.WALKABLE) { ++ if (pathpoint == null && l > 0 && pathtype != PathType.FENCE && pathtype != PathType.TRAPDOOR) { ++ pathpoint = this.a(i, j + 1, k, l - 1, d0); ++ } ++ ++ if (pathtype == PathType.OPEN) { ++ AxisAlignedBB axisalignedbb = new AxisAlignedBB((double) i - d2 + 0.5D, (double) j + 0.001D, (double) k - d2 + 0.5D, (double) i + d2 + 0.5D, (double) ((float) j + this.b.getHeight()), (double) k + d2 + 0.5D); ++ ++ if (!this.a.getCubes(this.b, axisalignedbb)) { // Akarin - use chunk cache ++ return null; ++ } ++ ++ PathType pathtype1 = this.a(this.a, i, j - 1, k, this.b, this.d, this.e, this.f, false, false); ++ ++ if (pathtype1 == PathType.BLOCKED) { ++ pathpoint = this.a(i, j, k); ++ pathpoint.l = PathType.WALKABLE; ++ pathpoint.k = Math.max(pathpoint.k, f); ++ return pathpoint; ++ } ++ ++ if (pathtype1 == PathType.WATER) { ++ pathpoint = this.a(i, j, k); ++ pathpoint.l = PathType.WATER; ++ pathpoint.k = Math.max(pathpoint.k, f); ++ return pathpoint; ++ } ++ ++ int i1 = 0; ++ ++ while (j > 0 && pathtype == PathType.OPEN) { ++ --j; ++ if (i1++ >= this.b.bD()) { ++ return null; ++ } ++ ++ pathtype = this.a(this.a, i, j, k, this.b, this.d, this.e, this.f, false, false); ++ f = this.b.a(pathtype); ++ if (pathtype != PathType.OPEN && f >= 0.0F) { ++ pathpoint = this.a(i, j, k); ++ pathpoint.l = pathtype; ++ pathpoint.k = Math.max(pathpoint.k, f); ++ break; ++ } ++ ++ if (f < 0.0F) { ++ return null; ++ } ++ } ++ } ++ ++ return pathpoint; ++ } else { ++ if (j < this.b.world.getSeaLevel() - 10 && pathpoint != null) { ++ ++pathpoint.k; ++ } ++ ++ return pathpoint; ++ } ++ } ++ } ++ ++ @Override ++ protected PathType a(IBlockAccess iblockaccess, boolean flag, boolean flag1, BlockPosition blockposition, PathType pathtype) { ++ if (pathtype == PathType.RAIL && !(iblockaccess.getType(blockposition).getBlock() instanceof BlockMinecartTrackAbstract) && !(iblockaccess.getType(blockposition.down()).getBlock() instanceof BlockMinecartTrackAbstract)) { ++ pathtype = PathType.FENCE; ++ } ++ ++ if (pathtype == PathType.DOOR_OPEN || pathtype == PathType.DOOR_WOOD_CLOSED || pathtype == PathType.DOOR_IRON_CLOSED) { ++ pathtype = PathType.BLOCKED; ++ } ++ ++ if (pathtype == PathType.LEAVES) { ++ pathtype = PathType.BLOCKED; ++ } ++ ++ return pathtype; ++ } ++ ++ @Override ++ public PathType a(IBlockAccess iblockaccess, int i, int j, int k) { ++ PathType pathtype = c(iblockaccess, i, j, k); ++ ++ if (pathtype == PathType.WATER) { ++ EnumDirection[] aenumdirection = EnumDirection.values(); ++ int l = aenumdirection.length; ++ ++ for (int i1 = 0; i1 < l; ++i1) { ++ EnumDirection enumdirection = aenumdirection[i1]; ++ PathType pathtype1 = c(iblockaccess, i + enumdirection.getAdjacentX(), j + enumdirection.getAdjacentY(), k + enumdirection.getAdjacentZ()); ++ ++ if (pathtype1 == PathType.BLOCKED) { ++ return PathType.WATER_BORDER; ++ } ++ } ++ ++ return PathType.WATER; ++ } else { ++ if (pathtype == PathType.OPEN && j >= 1) { ++ Block block = iblockaccess.getType(new BlockPosition(i, j - 1, k)).getBlock(); ++ PathType pathtype2 = c(iblockaccess, i, j - 1, k); ++ ++ if (pathtype2 != PathType.WALKABLE && pathtype2 != PathType.OPEN && pathtype2 != PathType.LAVA) { ++ pathtype = PathType.WALKABLE; ++ } else { ++ pathtype = PathType.OPEN; ++ } ++ ++ if (pathtype2 == PathType.DAMAGE_FIRE || block == Blocks.MAGMA_BLOCK || block == Blocks.CAMPFIRE) { ++ pathtype = PathType.DAMAGE_FIRE; ++ } ++ ++ if (pathtype2 == PathType.DAMAGE_CACTUS) { ++ pathtype = PathType.DAMAGE_CACTUS; ++ } ++ ++ if (pathtype2 == PathType.DAMAGE_OTHER) { ++ pathtype = PathType.DAMAGE_OTHER; ++ } ++ } ++ ++ if (pathtype == PathType.WALKABLE) { ++ pathtype = a(iblockaccess, i, j, k, pathtype); ++ } ++ ++ return pathtype; ++ } ++ } ++} +diff --git a/src/main/java/net/minecraft/server/PathfinderWater.java~Async pathfinder b/src/main/java/net/minecraft/server/PathfinderWater.java~Async pathfinder +new file mode 100644 +index 000000000..a3473ddcf +--- /dev/null ++++ b/src/main/java/net/minecraft/server/PathfinderWater.java~Async pathfinder +@@ -0,0 +1,109 @@ ++package net.minecraft.server; ++ ++import javax.annotation.Nullable; ++ ++public class PathfinderWater extends PathfinderAbstract { ++ ++ private final boolean j; ++ ++ public PathfinderWater(boolean flag) { ++ this.j = flag; ++ } ++ ++ @Override ++ public PathPoint b() { ++ return super.a(MathHelper.floor(this.b.getBoundingBox().minX), MathHelper.floor(this.b.getBoundingBox().minY + 0.5D), MathHelper.floor(this.b.getBoundingBox().minZ)); ++ } ++ ++ @Override ++ public PathDestination a(double d0, double d1, double d2) { ++ return new PathDestination(super.a(MathHelper.floor(d0 - (double) (this.b.getWidth() / 2.0F)), MathHelper.floor(d1 + 0.5D), MathHelper.floor(d2 - (double) (this.b.getWidth() / 2.0F)))); ++ } ++ ++ @Override ++ public int a(PathPoint[] apathpoint, PathPoint pathpoint) { ++ int i = 0; ++ EnumDirection[] aenumdirection = EnumDirection.values(); ++ int j = aenumdirection.length; ++ ++ for (int k = 0; k < j; ++k) { ++ EnumDirection enumdirection = aenumdirection[k]; ++ PathPoint pathpoint1 = this.b(pathpoint.a + enumdirection.getAdjacentX(), pathpoint.b + enumdirection.getAdjacentY(), pathpoint.c + enumdirection.getAdjacentZ()); ++ ++ if (pathpoint1 != null && !pathpoint1.i) { ++ apathpoint[i++] = pathpoint1; ++ } ++ } ++ ++ return i; ++ } ++ ++ @Override ++ public PathType a(IBlockAccess iblockaccess, int i, int j, int k, EntityInsentient entityinsentient, int l, int i1, int j1, boolean flag, boolean flag1) { ++ return this.a(iblockaccess, i, j, k); ++ } ++ ++ @Override ++ public PathType a(IBlockAccess iblockaccess, int i, int j, int k) { ++ BlockPosition blockposition = new BlockPosition(i, j, k); ++ Fluid fluid = iblockaccess.getFluid(blockposition); ++ IBlockData iblockdata = iblockaccess.getType(blockposition); ++ ++ return fluid.isEmpty() && iblockdata.a(iblockaccess, blockposition.down(), PathMode.WATER) && iblockdata.isAir() ? PathType.BREACH : (fluid.a(TagsFluid.WATER) && iblockdata.a(iblockaccess, blockposition, PathMode.WATER) ? PathType.WATER : PathType.BLOCKED); ++ } ++ ++ @Nullable ++ private PathPoint b(int i, int j, int k) { ++ PathType pathtype = this.c(i, j, k); ++ ++ return (!this.j || pathtype != PathType.BREACH) && pathtype != PathType.WATER ? null : this.a(i, j, k); ++ } ++ ++ @Nullable ++ @Override ++ protected PathPoint a(int i, int j, int k) { ++ PathPoint pathpoint = null; ++ PathType pathtype = this.a(this.a, i, j, k); // Akarin - use chunk cache ++ float f = this.b.a(pathtype); ++ ++ if (f >= 0.0F) { ++ pathpoint = super.a(i, j, k); ++ pathpoint.l = pathtype; ++ pathpoint.k = Math.max(pathpoint.k, f); ++ if (this.a.getFluid(new BlockPosition(i, j, k)).isEmpty()) { ++ pathpoint.k += 8.0F; ++ } ++ } ++ ++ return pathtype == PathType.OPEN ? pathpoint : pathpoint; ++ } ++ ++ private PathType c(int i, int j, int k) { ++ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); ++ ++ for (int l = i; l < i + this.d; ++l) { ++ for (int i1 = j; i1 < j + this.e; ++i1) { ++ for (int j1 = k; j1 < k + this.f; ++j1) { ++ Fluid fluid = this.a.getFluid(blockposition_mutableblockposition.d(l, i1, j1)); ++ IBlockData iblockdata = this.a.getType(blockposition_mutableblockposition.d(l, i1, j1)); ++ ++ if (fluid.isEmpty() && iblockdata.a((IBlockAccess) this.a, blockposition_mutableblockposition.down(), PathMode.WATER) && iblockdata.isAir()) { ++ return PathType.BREACH; ++ } ++ ++ if (!fluid.a(TagsFluid.WATER)) { ++ return PathType.BLOCKED; ++ } ++ } ++ } ++ } ++ ++ IBlockData iblockdata1 = this.a.getType(blockposition_mutableblockposition); ++ ++ if (iblockdata1.a((IBlockAccess) this.a, blockposition_mutableblockposition, PathMode.WATER)) { ++ return PathType.WATER; ++ } else { ++ return PathType.BLOCKED; ++ } ++ } ++} diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 7929fcc800064fa23b260c3ecbed75f846bb375a..e1225d5017cc0b65a4fd5ac753a705a11679cf2b 100644 +index 7929fcc80..e1225d501 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -185,7 +185,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -712,7 +1104,7 @@ index 7929fcc800064fa23b260c3ecbed75f846bb375a..e1225d5017cc0b65a4fd5ac753a705a1 for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index 3f1aa5ced697490b5481ba992cf5af5dc98b8166..af705e6c650b529c18bdd8f0c063a71c750783f6 100644 +index 3f1aa5ced..af705e6c6 100644 --- a/src/main/java/net/minecraft/server/TickListServer.java +++ b/src/main/java/net/minecraft/server/TickListServer.java @@ -65,7 +65,7 @@ public class TickListServer implements TickList { @@ -743,7 +1135,7 @@ index 3f1aa5ced697490b5481ba992cf5af5dc98b8166..af705e6c650b529c18bdd8f0c063a71c this.h.clear(); this.g.clear(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d554d4cf0f0a13b598c6b14d618ba463c9895f35..ef632a5f9cb480e77026f2f1123f76896f12478c 100644 +index d554d4cf0..ef632a5f9 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -375,9 +375,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -759,7 +1151,7 @@ index d554d4cf0f0a13b598c6b14d618ba463c9895f35..ef632a5f9cb480e77026f2f1123f7689 /* diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 84a3367b87a77cfba50c4f28a4e3e70d5b91d330..2da0cb6c963d2e1b609c79c83778f8e5e95967b5 100644 +index 84a3367b8..2da0cb6c9 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -849,7 +849,7 @@ public class WorldServer extends World { @@ -780,3 +1172,6 @@ index 84a3367b87a77cfba50c4f28a4e3e70d5b91d330..2da0cb6c963d2e1b609c79c83778f8e5 } @Override +-- +2.25.1.windows.1 + diff --git a/patches/server/0008-Disable-Snooper.patch b/patches/server/0008-Disable-Snooper.patch index c0cb5e5fe..585c68056 100644 --- a/patches/server/0008-Disable-Snooper.patch +++ b/patches/server/0008-Disable-Snooper.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From e170e06ca265bf64491b3962bc333c636db669a1 Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Thu, 2 Apr 2020 14:03:29 +0800 Subject: [PATCH] Disable Snooper diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 36e11bb25fce4b63b1a476ccd1b8a3a8e8aab5e8..4740e6e187e345c848a1f54e1f54bb208ecfeb2b 100644 +index 36e11bb25..4740e6e18 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1168,6 +1168,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant Date: Fri, 3 Apr 2020 14:59:22 +0800 Subject: [PATCH] Server Config @@ -7,7 +7,7 @@ Subject: [PATCH] Server Config diff --git a/src/main/java/io/akarin/server/Config.java b/src/main/java/io/akarin/server/Config.java new file mode 100644 -index 0000000000000000000000000000000000000000..2ac8f02a97429f04f3e5c9206ec228edccaf24c9 +index 000000000..2ac8f02a9 --- /dev/null +++ b/src/main/java/io/akarin/server/Config.java @@ -0,0 +1,183 @@ @@ -195,7 +195,7 @@ index 0000000000000000000000000000000000000000..2ac8f02a97429f04f3e5c9206ec228ed + +} diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 1ef7890da599d13e784861035e7891efcc4cd504..9d82885dcf5bb9309bbf136180551ed12930f59b 100644 +index 1ef7890da..9d82885dc 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -194,6 +194,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -207,7 +207,7 @@ index 1ef7890da599d13e784861035e7891efcc4cd504..9d82885dcf5bb9309bbf136180551ed1 this.setSpawnAnimals(dedicatedserverproperties.spawnAnimals); this.setSpawnNPCs(dedicatedserverproperties.spawnNpcs); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ef632a5f9cb480e77026f2f1123f76896f12478c..9708d61fd3795e8b69f27ecea92abe000f4bca1c 100644 +index ef632a5f9..9708d61fd 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -82,6 +82,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -228,7 +228,7 @@ index ef632a5f9cb480e77026f2f1123f76896f12478c..9708d61fd3795e8b69f27ecea92abe00 this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b381514d9ff59ddff515930e2e41e529c42ea206..765b865b85ba39d6446cfde4fd838d6b72bcfcdd 100644 +index b381514d9..765b865b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -806,6 +806,7 @@ public final class CraftServer implements Server { @@ -263,7 +263,7 @@ index b381514d9ff59ddff515930e2e41e529c42ea206..765b865b85ba39d6446cfde4fd838d6b public void restart() { org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index cb60310e63ce0f55f5e706edf9e1ef61a3732600..04694464b105aba007718e7b5933df8709d98b33 100644 +index cb60310e6..04694464b 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -138,6 +138,14 @@ public class Main { @@ -281,3 +281,6 @@ index cb60310e63ce0f55f5e706edf9e1ef61a3732600..04694464b105aba007718e7b5933df87 // Paper start acceptsAll(asList("server-name"), "Name of the server") .withRequiredArg() +-- +2.25.1.windows.1 + diff --git a/patches/server/0010-Async-pathfinder.patch b/patches/server/0010-Async-pathfinder.patch index 9fc81400a..c6f9ab113 100644 --- a/patches/server/0010-Async-pathfinder.patch +++ b/patches/server/0010-Async-pathfinder.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From 8620d79bc05a58236de15884c5d8d06443b6ccf3 Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Sun, 5 Apr 2020 13:01:13 +0800 Subject: [PATCH] Async pathfinder diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index e9f00a1e131faa42d280cab255bc61cd1dcddf2a..72fa93d75f335dadac514362f9367edeb089f45f 100644 +index e9f00a1e1..72fa93d75 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -686,7 +686,7 @@ public abstract class EntityInsentient extends EntityLiving { @@ -19,7 +19,7 @@ index e9f00a1e131faa42d280cab255bc61cd1dcddf2a..72fa93d75f335dadac514362f9367ede //this.world.getMethodProfiler().enter("mob tick"); // Akarin - remove caller this.mobTick(); diff --git a/src/main/java/net/minecraft/server/Navigation.java b/src/main/java/net/minecraft/server/Navigation.java -index abf450917e605972d84cb603b966feb013ae0002..4f7f40d5e7050d9b2da29c6e6efe7c5bef560d55 100644 +index abf450917..4f7f40d5e 100644 --- a/src/main/java/net/minecraft/server/Navigation.java +++ b/src/main/java/net/minecraft/server/Navigation.java @@ -183,7 +183,7 @@ public class Navigation extends NavigationAbstract { @@ -32,7 +32,7 @@ index abf450917e605972d84cb603b966feb013ae0002..4f7f40d5e7050d9b2da29c6e6efe7c5b if (pathtype == PathType.WATER) { return false; diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 1e6b3931a3d2781c122dfc0fef1c61dcbe28fa69..9859b0c000da8acee248339cd0e6755fbd375d99 100644 +index 1e6b3931a..9859b0c00 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -22,13 +22,15 @@ public abstract class NavigationAbstract { @@ -250,7 +250,7 @@ index 1e6b3931a3d2781c122dfc0fef1c61dcbe28fa69..9859b0c000da8acee248339cd0e6755f protected boolean p() { return this.a.az() || this.a.aH(); diff --git a/src/main/java/net/minecraft/server/PathEntity.java b/src/main/java/net/minecraft/server/PathEntity.java -index dcb4e250803b8605f9bfb6d590c4e316dfee97d1..265b6df4f67910c4b396a593575628b50aa527c1 100644 +index dcb4e2508..265b6df4f 100644 --- a/src/main/java/net/minecraft/server/PathEntity.java +++ b/src/main/java/net/minecraft/server/PathEntity.java @@ -110,7 +110,7 @@ public class PathEntity { @@ -263,7 +263,7 @@ index dcb4e250803b8605f9bfb6d590c4e316dfee97d1..265b6df4f67910c4b396a593575628b5 } diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java -index 67c63cfe333e328cbd00ada970bd81efebfe30b6..00bd2327f24ea7c8ee4c92b51f18abb273b2bb83 100644 +index 67c63cfe3..00bd2327f 100644 --- a/src/main/java/net/minecraft/server/Pathfinder.java +++ b/src/main/java/net/minecraft/server/Pathfinder.java @@ -15,9 +15,9 @@ import javax.annotation.Nullable; @@ -315,7 +315,7 @@ index 67c63cfe333e328cbd00ada970bd81efebfe30b6..00bd2327f24ea7c8ee4c92b51f18abb2 List list = Lists.newArrayList(); PathPoint pathpoint1 = pathpoint; diff --git a/src/main/java/net/minecraft/server/PathfinderTurtle.java b/src/main/java/net/minecraft/server/PathfinderTurtle.java -index 59b1fe289c57b9e9f21b74c26cc1836255dad78b..1790878ae9ac33be86bed0b962b8171bf666d119 100644 +index 59b1fe289..1790878ae 100644 --- a/src/main/java/net/minecraft/server/PathfinderTurtle.java +++ b/src/main/java/net/minecraft/server/PathfinderTurtle.java @@ -148,7 +148,7 @@ public class PathfinderTurtle extends PathfinderNormal { @@ -328,7 +328,7 @@ index 59b1fe289c57b9e9f21b74c26cc1836255dad78b..1790878ae9ac33be86bed0b962b8171b } diff --git a/src/main/java/net/minecraft/server/PathfinderWater.java b/src/main/java/net/minecraft/server/PathfinderWater.java -index 075b63ef57a1528118f03a00c7156b3cb7744969..a3473ddcfe15d329eba78bbd60c00541cb1b88bb 100644 +index 075b63ef5..a3473ddcf 100644 --- a/src/main/java/net/minecraft/server/PathfinderWater.java +++ b/src/main/java/net/minecraft/server/PathfinderWater.java @@ -63,7 +63,7 @@ public class PathfinderWater extends PathfinderAbstract { @@ -340,3 +340,6 @@ index 075b63ef57a1528118f03a00c7156b3cb7744969..a3473ddcfe15d329eba78bbd60c00541 float f = this.b.a(pathtype); if (f >= 0.0F) { +-- +2.25.1.windows.1 + diff --git a/patches/server/0011-Optimizations-for-network.patch b/patches/server/0011-Optimizations-for-network.patch index b80ffbe73..7c7b3b219 100644 --- a/patches/server/0011-Optimizations-for-network.patch +++ b/patches/server/0011-Optimizations-for-network.patch @@ -1,12 +1,12 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= +From 8a2e2f2278a88e99a1f122d096bb9737e71c3a2c Mon Sep 17 00:00:00 2001 +From: =?GB2312?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?= Date: Sun, 5 Apr 2020 14:59:10 +0800 Subject: [PATCH] Optimizations for network diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java -index a85466bc7e0a8aa54b9eff14077fe6c992ae2902..324af1a12a5780170f8cd6e060ff2f2f9d152c3d 100644 +index a85466bc7..324af1a12 100644 --- a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java +++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java @@ -106,7 +106,7 @@ public final class StandardPaperServerListPingEventImpl extends PaperServerListP @@ -19,7 +19,7 @@ index a85466bc7e0a8aa54b9eff14077fe6c992ae2902..324af1a12a5780170f8cd6e060ff2f2f } diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 0532f975b7af5b3f2916c26141221cd3701765d0..e7be1074b1b8fde3590b1323508965961824e671 100644 +index 0532f975b..e7be1074b 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java @@ -39,7 +39,7 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -46,7 +46,7 @@ index 0532f975b7af5b3f2916c26141221cd3701765d0..e7be1074b1b8fde3590b132350896596 } else { this.b.setPacketListener(new LoginListener(this.a, this.b)); diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index f1222fcb2bd52b8781d0f92c94e1472fa7b1e493..522cfed4cb09bc9ecc48b6313da47f9af7a5e1d8 100644 +index f1222fcb2..522cfed4c 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java @@ -111,6 +111,19 @@ public class LoginListener implements PacketLoginInListener { @@ -106,7 +106,7 @@ index f1222fcb2bd52b8781d0f92c94e1472fa7b1e493..522cfed4cb09bc9ecc48b6313da47f9a protected GameProfile a(GameProfile gameprofile) { diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 96a785af27e1924b0cc1959254d4ae3cdd0385a1..c5e32e42465aece552f09bc5c73d6e0d51735c91 100644 +index 96a785af2..c5e32e424 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -43,6 +43,8 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -221,7 +221,7 @@ index 96a785af27e1924b0cc1959254d4ae3cdd0385a1..c5e32e42465aece552f09bc5c73d6e0d if (this.t++ % 20 == 0) { this.s = this.s * 0.75F + (float) this.q * 0.25F; diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java -index 8d0965a0535b16f19eda21b97a44464b85b05460..7e27cd280fa889f6178d46aa9f9d3a613d9702e6 100644 +index 8d0965a05..7e27cd280 100644 --- a/src/main/java/net/minecraft/server/Packet.java +++ b/src/main/java/net/minecraft/server/Packet.java @@ -20,4 +20,10 @@ public interface Packet { @@ -236,7 +236,7 @@ index 8d0965a0535b16f19eda21b97a44464b85b05460..7e27cd280fa889f6178d46aa9f9d3a61 + // Akarin end } diff --git a/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java -index 7eb230f1b27eddf48f1b12fc78877a3678d802df..d01cac0bd40a11d82fa0d6874d87ad3f576a4e20 100644 +index 7eb230f1b..d01cac0bd 100644 --- a/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java +++ b/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java @@ -41,4 +41,11 @@ public class PacketLoginOutCustomPayload implements Packet @@ -268,7 +268,7 @@ index e5094f55f1472c9b74f7f9394aec448237e87149..a5d9b6d94c386f05659f10d69cb84b15 + // Akarin end } diff --git a/src/main/java/net/minecraft/server/PacketLoginOutEncryptionBegin.java b/src/main/java/net/minecraft/server/PacketLoginOutEncryptionBegin.java -index b0d6342c319a48290fd8bf6aa07a16d108feae18..eeabb54c44d39197f34a7171884cc7e885bce453 100644 +index b0d6342c3..eeabb54c4 100644 --- a/src/main/java/net/minecraft/server/PacketLoginOutEncryptionBegin.java +++ b/src/main/java/net/minecraft/server/PacketLoginOutEncryptionBegin.java @@ -34,4 +34,11 @@ public class PacketLoginOutEncryptionBegin implements Packet { @@ -316,7 +316,7 @@ index 54c29047180794a9802b4f1d79fbd35478870226..75d7bc19683a6c411af5f381a4809267 + // Akarin end } diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 4bb21c48bd50353370ec3c3546a00a5d20e4b9d8..06af567fc1fb3a2053eb4e8af6d93dbb2391616a 100644 +index 4bb21c48b..06af567fc 100644 --- a/src/main/java/net/minecraft/server/PacketStatusListener.java +++ b/src/main/java/net/minecraft/server/PacketStatusListener.java @@ -143,7 +143,7 @@ public class PacketStatusListener implements PacketStatusInListener { @@ -329,7 +329,7 @@ index 4bb21c48bd50353370ec3c3546a00a5d20e4b9d8..06af567fc1fb3a2053eb4e8af6d93dbb } } diff --git a/src/main/java/net/minecraft/server/PacketStatusOutPong.java b/src/main/java/net/minecraft/server/PacketStatusOutPong.java -index 94a0da87db34ee5131686e4fa813500794ffc30d..577c6ef9cfe26d38783cd38353720b0fe457d7f5 100644 +index 94a0da87d..577c6ef9c 100644 --- a/src/main/java/net/minecraft/server/PacketStatusOutPong.java +++ b/src/main/java/net/minecraft/server/PacketStatusOutPong.java @@ -25,4 +25,11 @@ public class PacketStatusOutPong implements Packet { @@ -345,7 +345,7 @@ index 94a0da87db34ee5131686e4fa813500794ffc30d..577c6ef9cfe26d38783cd38353720b0f + // Akarin end } diff --git a/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java b/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java -index 50d5fb62efa7c89c7a73ccf072a0e7e433bcc650..4da7a2c1a4f84661e1018c7233b7a52449532d5b 100644 +index 50d5fb62e..4da7a2c1a 100644 --- a/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java +++ b/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java @@ -28,4 +28,11 @@ public class PacketStatusOutServerInfo implements Packet Date: Fri, 10 Apr 2020 15:47:15 +0800 Subject: [PATCH] Swaps the predicate order of collision diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 147c5288a567bd7e4a262cc67dbae9c4164b23b8..6cf3eb12b07e32344ac975eaecfcfdbbff786233 100644 +index 147c5288a..6cf3eb12b 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -1402,38 +1402,38 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -76,3 +76,6 @@ index 147c5288a567bd7e4a262cc67dbae9c4164b23b8..6cf3eb12b07e32344ac975eaecfcfdbb } } +-- +2.25.1.windows.1 + diff --git a/scripts/apply.sh b/scripts/apply.sh deleted file mode 100755 index d5ba0167e..000000000 --- a/scripts/apply.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash - -# get base dir regardless of execution location -basedir=$1 - -source "$basedir/scripts/functions.sh" - -paperVer=$(cat current-paper) -gpgsign="$(git config commit.gpgsign || echo "false")" -echo "Rebuilding Forked projects.... " -function applyPatch { - what=$1 - what_name=$(basename $what) - target=$2 - branch=$3 - patch_folder=$4 - - cd "$basedir/$what" - git fetch --all - git branch -f upstream "$branch" >/dev/null - - cd "$basedir" - if [ ! -d "$basedir/$target" ]; then - mkdir "$basedir/$target" - cd "$basedir/$target" - git init - git remote add origin "$5" - cd "$basedir" - fi - cd "$basedir/$target" - - # Disable GPG signing before AM, slows things down and doesn't play nicely. - # There is also zero rational or logical reason to do so for these sub-repo AMs. - # Calm down kids, it's re-enabled (if needed) immediately after, pass or fail. - git config commit.gpgsign false - - echo "Resetting $target to $what_name..." - git remote rm upstream > /dev/null 2>&1 - git remote add upstream "$basedir/$what" >/dev/null 2>&1 - git checkout master 2>/dev/null || git checkout -b master - git fetch upstream >/dev/null 2>&1 - git reset --hard upstream/upstream - echo " Applying patches to $target..." - git am --abort >/dev/null 2>&1 - git am --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch - if [ "$?" != "0" ]; then - echo " Something did not apply cleanly to $target." - echo " Please review above details and finish the apply then" - echo " save the changes with rebuildPatches.sh" - exit 1 - else - echo " Patches applied cleanly to $target" - fi -} - -function enableCommitSigningIfNeeded { - if [[ "$gpgsign" == "true" ]]; then - git config commit.gpgsign true - fi -} - - echo "Importing MC-DEV" - ./scripts/importmcdev.sh "$basedir" || exit 1 -( - (applyPatch Paper/Paper-API ${FORK_NAME}-API HEAD api $API_REPO && - applyPatch Paper/Paper-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO) || exit 1 - enableCommitSigningIfNeeded -) || ( - echo "Failed to apply patches" - enableCommitSigningIfNeeded - exit 1 -) || exit 1 diff --git a/scripts/applyPatches.sh b/scripts/applyPatches.sh new file mode 100644 index 000000000..c7c5ee96c --- /dev/null +++ b/scripts/applyPatches.sh @@ -0,0 +1,112 @@ +#!/usr/bin/env bash + +# SCRIPT HEADER start +echo "----------------------------------------" +echo " $(bashcolor 1 32)Task$(bashcolorend) - Apply Patches" +echo " This will apply all of Akarin patches on top of the Paper." +echo " " +echo " $(bashcolor 1 32)Subtask:$(bashcolorend)" +echo " - Import Sources" +echo " " +echo " $(bashcolor 1 32)Modules:$(bashcolorend)" +echo " - $(bashcolor 1 32)1$(bashcolorend) : API" +echo " - $(bashcolor 1 32)2$(bashcolorend) : Server" +echo "----------------------------------------" +# SCRIPT HEADER end + +# get base dir regardless of execution location +basedir=$1 + +source "$basedir/scripts/functions.sh" + +gpgsign="$(git config commit.gpgsign || echo "false")" + +function applyPatch { + baseproject=$1 + basename=$(basename $baseproject) + target=$2 + branch=$3 + patch_folder=$4 + + # Skip if that software have no patch + haspatch=-f "$basedir/patches/$patch_folder/"*.patch >/dev/null 2>&1 # too many files + if [ ! haspatch ]; then + echo " $(bashcolor 1 33)($5/$6) Skipped$(bashcolorend) - No patch found for $target under patches/$patch_folder" + return + fi + + echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Setup upstream project.." + cd "$basedir/$baseproject" + $gitcmd fetch --all &> /dev/null + # Create the upstream branch in Paper project with current state + $gitcmd checkout master >/dev/null # possibly already in + $gitcmd branch -D upstream >/dev/null &> /dev/null + $gitcmd branch -f upstream "$branch" &> /dev/null && $gitcmd checkout upstream &> /dev/null + + if [ $baseproject != "Paper/Paper-API" ]; then + echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Import new introduced NMS files.." + basedir && $scriptdir/importSources.sh $basedir 1 + fi + + basedir + # Create source project dirs + if [ ! -d "$basedir/$target" ]; then + mkdir "$basedir/$target" + cd "$basedir/$target" + # $gitcmd remote add origin "$5" + fi + cd "$basedir/$target" + $gitcmd init > /dev/null 2>&1 + + # Disable GPG signing before AM, slows things down and doesn't play nicely. + # There is also zero rational or logical reason to do so for these sub-repo AMs. + # Calm down kids, it's re-enabled (if needed) immediately after, pass or fail. + $gitcmd config commit.gpgsign false + + echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Reset $target to $basename.." + # Add the generated Paper project as the upstream remote of subproject + $gitcmd remote rm upstream >/dev/null 2>&1 + $gitcmd remote add upstream "$basedir/$baseproject" >/dev/null 2>&1 + # Ensure that we are in the branch we want so not overriding things + $gitcmd checkout master 2>/dev/null || $gitcmd checkout -b master + $gitcmd fetch upstream >/dev/null 2>&1 + # Reset our source project to Paper + cd "$basedir/$target" && $gitcmd reset --hard upstream/upstream + + echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Apply patches to $target.." + # Abort previous applying operation + $gitcmd am --abort >/dev/null 2>&1 + # Apply our patches on top Paper in our dirs + $gitcmd am --no-utf8 --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch + + if [ "$?" != "0" ]; then + echo " Something did not apply cleanly to $target." + echo " Please review above details and finish the apply then" + echo " save the changes with rebuildPatches.sh" + echo " or use 'git am --abort' to cancel this applying." + echo " $(bashcolor 1 33)($5/$6) Suspended$(bashcolorend) - Resolve the conflict or abort the apply" + echo " " + cd "$basedir/$target" + exit 1 + else + echo " $(bashcolor 1 32)($6/$6) Succeed$(bashcolorend) - Patches applied cleanly to $target" + echo " " + fi +} + +function enableCommitSigningIfNeeded { + if [[ "$gpgsign" == "true" ]]; then + git config commit.gpgsign true + fi +} + + # echo "Importing MC-DEV" + # ./scripts/importSources.sh "$basedir" || exit 1 +( + (applyPatch Paper/Paper-API ${FORK_NAME}-API HEAD api $API_REPO 0 2 && + applyPatch Paper/Paper-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO 1 2) || exit 1 + enableCommitSigningIfNeeded +) || ( + enableCommitSigningIfNeeded + exit 1 +) || exit 1 diff --git a/scripts/upstreamCommit.sh b/scripts/commitUpstream.sh old mode 100755 new mode 100644 similarity index 76% rename from scripts/upstreamCommit.sh rename to scripts/commitUpstream.sh index c68788ffa..a1333381f --- a/scripts/upstreamCommit.sh +++ b/scripts/commitUpstream.sh @@ -1,13 +1,15 @@ #!/usr/bin/env bash + +echo "[Akarin] State: Commit Upstream" + ( set -e -PS1="$" -function changelog() { +function changeLog() { base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1) cd $1 && git log --oneline ${base}...HEAD } -paper=$(changelog Paper) +paper=$(changeLog Paper) updated="" logsuffix="" @@ -21,7 +23,7 @@ if [ ! -z "$1" ]; then disclaimer="$@" fi -log="${UP_LOG_PREFIX}Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}" +log="Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}" echo -e "$log" | git commit -F - diff --git a/scripts/functions.sh b/scripts/functions.sh index 190729307..5f007f7a7 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -14,15 +14,26 @@ gitcmd="git -c commit.gpgsign=false" case "$(echo "$SHELL" | sed -E 's|/usr(/local)?||g')" in "/bin/zsh") RCPATH="$HOME/.zshrc" + SOURCE="${BASH_SOURCE[0]:-${(%):-%N}}" ;; *) RCPATH="$HOME/.bashrc" if [[ -f "$HOME/.bash_aliases" ]]; then RCPATH="$HOME/.bash_aliases" fi + SOURCE="${BASH_SOURCE[0]}" ;; esac +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}") +scriptdir=$(dirname "$SOURCE") +basedir=$(dirname "$scriptdir") + function basedir { cd "$basedir" } @@ -48,6 +59,18 @@ colorend() { echo -e "\e[m" } +function bashcolor { + if [ $2 ]; then + echo -e "\e[$1;$2m" + else + echo -e "\e[$1m" + fi +} + +function bashcolorend { + echo -e "\e[m" +} + # GIT functions gitstash() { STASHED=$($gitcmd stash 2>/dev/null|| return 0) # errors are ok @@ -60,7 +83,7 @@ gitunstash() { } function gethead { - cd "$1" + basedir git log -1 --oneline } @@ -68,7 +91,7 @@ function gitpush { if [ "$(git config minecraft.push-${FORK_NAME})" == "1" ]; then echo "Push - $1 ($3) to $2" ( - cd "$1" + basedir git remote rm script-push > /dev/null 2>&1 git remote add script-push $2 >/dev/null 2>&1 git push script-push $3 -f @@ -101,16 +124,4 @@ function containsElement { [[ "$e" == "$1" ]] && return 0; done return 1 -} - -function bashColor { -if [ $2 ]; then - echo -e "\e[$1;$2m" -else - echo -e "\e[$1m" -fi -} -function bashColorReset { - echo -e "\e[m" -} - +} \ No newline at end of file diff --git a/scripts/generateImports.sh b/scripts/generateImports.sh index 3014fd025..1eb2ff7cc 100755 --- a/scripts/generateImports.sh +++ b/scripts/generateImports.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +echo "[Akarin] State: Generate Imports" + +# For a description of this script, see updateUpstream.sh. + # get base dir regardless of execution location basedir=$1 @@ -21,7 +25,7 @@ if [ ! -d ".git" ]; then $gitcmd init fi -# reset dev files to spigot +# reset dev files to raw nms in spigot naming rm src/net/minecraft/server/*.java cp $decompile/net/minecraft/server/*.java src/net/minecraft/server @@ -38,7 +42,7 @@ done # push the dev project cd $basedir/mc-dev -gitcmd add . -A -gitcmd commit --allow-empty . -m "$paperVer" -gitcmd tag -a "$paperVer" -m "$paperVer" 2>/dev/null -gitpush . $MCDEV_REPO $paperVer +$gitcmd add . -A +$gitcmd commit . -m "$paperVer" +$gitcmd tag -a "$paperVer" -m "$paperVer" 2>/dev/null +# gitpush . $MCDEV_REPO $paperVer diff --git a/scripts/importSources.sh b/scripts/importSources.sh new file mode 100644 index 000000000..89828c2bb --- /dev/null +++ b/scripts/importSources.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +maintask=$2 +tasktitle=maintask && "Import Sources" || "Import Sources (Subtask)" + +# SCRIPT HEADER start +echo "----------------------------------------" +echo " $(bashcolor 1 32)Task$(bashcolorend) - " +echo " This will import unimported sources newly added/mod by Akarin to Paper workspace" +echo " " +echo "----------------------------------------" +# SCRIPT HEADER end + +# For a description of this script, see updateUpstream.sh. + +# get base dir regardless of execution location +basedir=$1 + +source "$basedir/scripts/functions.sh" + +paperworkdir="$basedir/Paper/work" + +paperserverdir="$basedir/Paper/Paper-Server" +papersrcdir="$paperserverdir/src/main/java" +papernmsdir="$papersrcdir/net/minecraft/server" + +( + # fast-fail if Paper not set + if [ ! -f "$papernmsdir" ]; then + echo "$(bashcolor 1 31) Exception $(bashcolorend) - Paper sources not generated, run updateUpstream.sh to setup." + exit 1 + fi +} + +minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4) +decompiledir=$paperworkdir/Minecraft/$minecraftversion/spigot + +nms="net/minecraft/server" +export IMPORT_LOG="" # for commit message, list all files and source for libs +basedir + +function importToPaperWorkspace { + if [ -f "$papernmsdir/$1.java" ]; then + echo "$(bashcolor 1 33) Skipped $(bashcolorend) - Already imported $1.java" + return 0 + fi + + file="$1.java" + target="$papernmsdir/$file" + base="$decompiledir/$nms/$file" + + if [[ ! -f "$target" ]]; then + export IMPORT_LOG="$IMPORT_LOG Import: $file\n"; + echo "Import: $file" + cp "$base" "$target" + fi +} + +function importLibraryToPaperWorkspace { + group=$1 + lib=$2 + prefix=$3 + shift 3 + for file in "$@"; do + file="$prefix/$file" + target="$papersrcdir/$file" + targetdir=$(dirname "$target") + mkdir -p "${targetdir}" + + base="$paperworkdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file" + if [ ! -f "$base" ]; then + echo "$(bashcolor 1 31) Exception $(bashcolorend) - Cannot find file $file.java of lib $lib in group $group to import, re-decomplie or remove the import." + exit 1 + fi + + export IMPORT_LOG="$IMPORT_LOG Import: $file from lib $lib\n"; + echo "Import: $file ($lib)" + sed 's/\r$//' "$base" > "$target" || exit 1 + done +} + +( + cd "$paperserverdir" + lastcommit=$(git log -1 --pretty=oneline --abbrev-commit) + if [[ "$lastcommit" = *"Extra dev imports of Akarin"* ]]; then + git reset --hard HEAD^ + fi +) + +# Filter and import every files which have patch to modify +patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g') + +patchedFilesNonNMS=$(cat patches/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g') + +for f in $patchedFiles; do + containsElement "$f" ${patchedFilesNonNMS[@]} + if [ "$?" == "1" ]; then + if [ ! -f "$papersrcdir/$nms/$f.java" ]; then + if [ ! -f "$decompiledir/$nms/$f.java" ]; then + echo "$(bashcolor 1 31) ERROR!!! Missing NMS$(bashcolor 1 34) $f $(bashcolorend)"; + echo "$(bashcolor 1 31) Exception $(bashcolorend) - Cannot find NMS file $f.java to import, re-decomplie or remove the import." + exit 1 + else + importToPaperWorkspace $f + fi + fi + fi +done + +# NMS import format: +# importToPaperWorkspace MinecraftServer.java + +# Library import format (multiple files are supported): +# importLibraryToPaperWorkspace com.mojang datafixerupper com/mojang/datafixers/util Either.java + +# Submit imports by commit with file descriptions +( + cd "$paperserverdir" + # rm -rf nms-patches + git add . &> /dev/null + echo -e "Extra dev imports of Akarin:\n\n$IMPORT_LOG" | git commit src -F - &> /dev/null + echo " $(bashcolor 1 32) Succeed$(bashcolorend) - Sources have been imported to the current branch/state of Paper/Paper-Server" +) \ No newline at end of file diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh deleted file mode 100755 index 05ef554b5..000000000 --- a/scripts/importmcdev.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env bash - -# get base dir regardless of execution location -basedir=$1 - -source "$basedir/scripts/functions.sh" - -paperworkdir="$basedir/Paper/work" -minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4) -decompiledir=$paperworkdir/Minecraft/$minecraftversion/spigot - -nms="net/minecraft/server" -export MODLOG="" -basedir - -export importedmcdev="" -function import { - if [ -f "$basedir/Paper/Paper-Server/src/main/java/net/minecraft/server/$1.java" ]; then - echo "ALREADY IMPORTED $1" - return 0 - fi - export importedmcdev="$importedmcdev $1" - file="${1}.java" - target="$basedir/Paper/Paper-Server/src/main/java/$nms/$file" - base="$decompiledir/$nms/$file" - - if [[ ! -f "$target" ]]; then - export MODLOG="$MODLOG Imported $file from mc-dev\n"; - echo "$(bashColor 1 32) Copying $(bashColor 1 34)$base $(bashColor 1 32)to$(bashColor 1 34) $target $(bashColorReset)" - cp "$base" "$target" - else - echo "$(bashColor 1 33) UN-NEEDED IMPORT STATEMENT:$(bashColor 1 34) $file $(bashColorReset)" - fi -} - -function importLibrary { - group=$1 - lib=$2 - prefix=$3 - shift 3 - for file in "$@"; do - file="$prefix/$file" - target="$basedir/Paper/Paper-Server/src/main/java/$file" - targetdir=$(dirname "$target") - mkdir -p "${targetdir}" - base="$paperworkdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file" - if [ ! -f "$base" ]; then - echo "Missing $base" - exit 1 - fi - export MODLOG="$MODLOG Imported $file from $lib\n"; - sed 's/\r$//' "$base" > "$target" || exit 1 - done -} - -( - cd Paper/Paper-Server/ - lastlog=$(git log -1 --oneline) - if [[ "$lastlog" = *"Akarin extra mc-dev Imports"* ]]; then - git reset --hard HEAD^ - fi -) - - -files=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g') - -nonnms=$(cat patches/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g') - -for f in $files; do - containsElement "$f" ${nonnms[@]} - if [ "$?" == "1" ]; then - if [ ! -f "$basedir/Paper/Paper-Server/src/main/java/net/minecraft/server/$f.java" ]; then - if [ ! -f "$decompiledir/$nms/$f.java" ]; then - echo "$(bashColor 1 31) ERROR!!! Missing NMS$(bashColor 1 34) $f $(bashColorReset)"; - else - import $f - fi - fi - fi -done - -############################################################################################### -############################################################################################### -#################### ADD TEMPORARY ADDITIONS HERE ############################################# -############################################################################################### -############################################################################################### - -# import Foo - -######################################################## -######################################################## -######################################################## -# LIBRARY IMPORTS -# These must always be mapped manually, no automatic stuff -# -# # group # lib # prefix # many files - -importLibrary com.mojang datafixerupper com/mojang/datafixers/util Either.java - -################ -( - cd Paper/Paper-Server/ - rm -rf nms-patches - git add src -A - echo -e "Akarin extra mc-dev Imports\n\n$MODLOG" | git commit --allow-empty src -F - - exit 0 -) diff --git a/scripts/makeAkarinclip.sh b/scripts/makeAkarinclip.sh new file mode 100644 index 000000000..8cab5b1a5 --- /dev/null +++ b/scripts/makeAkarinclip.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +echo "[Akarin] State: Make Akarinclip" + +# Copied from https://github.com/PaperMC/Paper/blob/d54ce6c17fb7a35238d6b9f734d30a4289886773/scripts/paperclip.sh +# License from Paper applies to this file + +set -e +basedir="$(cd "$1" && pwd -P)" +paperworkdir="$basedir/Paper/work" +mcver=$(cat "$paperworkdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) +serverjar="$basedir/Akarin-Server/target/akarin-$mcver.jar" +vanillajar="$paperworkdir/Minecraft/$mcver/$mcver.jar" + +( + cd "$paperworkdir/Paperclip" + mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$serverjar" "-Dvanillajar=$vanillajar" +) +cp "$paperworkdir/Paperclip/assembly/target/paperclip-${mcver}.jar" "$basedir/akarinclip-${mcver}.jar" + +echo "" +echo "" +echo "" +echo "Build success!" +echo "Copied final jar to $(cd "$basedir" && pwd -P)/akarinclip-${mcver}.jar" diff --git a/scripts/paperclip.sh b/scripts/paperclip.sh deleted file mode 100755 index 2ee1d4b6f..000000000 --- a/scripts/paperclip.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -# Copied from https://github.com/PaperMC/Paper/blob/d54ce6c17fb7a35238d6b9f734d30a4289886773/scripts/paperclip.sh -# License from Paper applies to this file - -set -e -basedir="$(cd "$1" && pwd -P)" -workdir="$basedir/Paper/work" -mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) -paperjar="$basedir/Akarin-Server/target/akarin-$mcver.jar" -vanillajar="$workdir/Minecraft/$mcver/$mcver.jar" - -( - cd "$workdir/Paperclip" - mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$paperjar" "-Dvanillajar=$vanillajar" -) -cp "$workdir/Paperclip/assembly/target/paperclip-${mcver}.jar" "$basedir/akarin-paperclip.jar" - -echo "" -echo "" -echo "" -echo "Build success!" -echo "Copied final jar to $(cd "$basedir" && pwd -P)/akarin-paperclip.jar" diff --git a/scripts/push.sh b/scripts/push.sh deleted file mode 100755 index 6099dceff..000000000 --- a/scripts/push.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -# get base dir regardless of execution location -basedir=$1 - -source "$basedir/scripts/functions.sh" - -minecraftversion=$(cat $basedir/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4) - -basedir -gitpush ${FORK_NAME}-API $API_REPO master:$minecraftversion -gitpush ${FORK_NAME}-Server $SERVER_REPO master:$minecraftversion diff --git a/scripts/rebuildpatches.sh b/scripts/rebuildpatches.sh index 0e023e1d7..ed24b8019 100755 --- a/scripts/rebuildpatches.sh +++ b/scripts/rebuildpatches.sh @@ -1,15 +1,16 @@ #!/usr/bin/env bash +echo "[Akarin] State: Rebuild Patches" + # get base dir regardless of execution location basedir=$1 source "$basedir/scripts/functions.sh" +gitcmd="git -c commit.gpgsign=false -c core.safecrlf=false" -echo "Rebuilding patch files from current fork state..." +echo "Rebuild patch files from local sources.." function savePatches { - what=$1 - cd $basedir/$what/ - + basedir mkdir -p $basedir/patches/$2 if [ -d ".git/rebase-apply" ]; then # in middle of a rebase, be smarter @@ -24,16 +25,16 @@ function savePatches { fi done else - rm $basedir/patches/$2/*.patch + rm -rf $basedir/patches/$2/*.patch fi - git format-patch --no-signature --zero-commit --full-index --no-stat -N -o $basedir/patches/$2 upstream/upstream - cd $basedir - git add -A $basedir/patches/$2 - echo " Patches saved for $what to patches/$2" + cd "$basedir/$1" + $gitcmd format-patch --no-stat -N -o "$basedir/patches/$2" upstream/upstream >/dev/null + basedir + $gitcmd add -A "$basedir/patches/$2" + echo " Patches saved for $basedir to patches/$2" } savePatches ${FORK_NAME}-API api savePatches ${FORK_NAME}-Server server - -$basedir/scripts/push.sh "$basedir" +# gitpushproject \ No newline at end of file diff --git a/scripts/updateUpstream.sh b/scripts/updateUpstream.sh new file mode 100644 index 000000000..00075387c --- /dev/null +++ b/scripts/updateUpstream.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# SCRIPT HEADER start +echo "----------------------------------------" +echo " $(bashcolor 1 32)Task$(bashcolorend) - Update Upstream" +echo " This will update and patch Paper, then importing necessary sources for patching." +echo " " +echo " $(bashcolor 1 32)Subtask:$(bashcolorend)" +echo " - Import Sources" +echo " " +echo " $(bashcolor 1 32)Projects:$(bashcolorend)" +echo " - $(bashcolor 1 32)1$(bashcolorend) : Paper" +echo " - $(bashcolor 1 32)2$(bashcolorend) : Akarin" +echo "----------------------------------------" +# SCRIPT HEADER end + +# This script are capable of patching paper which have the same effect with renewing the source codes of paper to its corresponding remote/official state, and also are able to reset the patches of paper to its head commit to override dirty changes which needs a argument with --resetPaper. + +# After the patching, it will copying sources that do no exist in the akarin workspace but referenced in akarin patches into our workspace, depending on the content of our patches, this will be addressed by calling importSources.sh. + +# Following by invoking generateImports.sh, it will generate new added/imported files of paper compared to the original decompiled sources into mc-dev folder under the root dir of the project, whose intention is unclear yet. + +# exit immediately if a command exits with a non-zero status +set -e + +# get base dir regardless of execution location +basedir=$1 + +source "$basedir/scripts/functions.sh" +subtasks=2 + +echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Update Git submodules.." +git submodule update --init --recursive + +if [[ "$2" == "--resetPaper" ]]; then + echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Reset Paper submodule.." + paperdir + $gitcmd fetch && $gitcmd reset --hard origin/master + basedir + $gitcmd add Paper +fi + +# patch paper +echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Apply patches of Paper.." +paperVer=$(gethead Paper) +paperdir +./paper patch + +cd "Paper-Server" +mcVer=$(mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=minecraft_version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }') + +echo " $(bashcolor 1 32)(1/$subtasks)$(bashcolorend) - Update Git submodule.." +basedir +"$basedir"/scripts/importSources.sh $1 + +#minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4) +#version=$(echo -e "Paper: $paperVer\nmc-dev:$importedmcdev") +#tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $2}')" +#echo "$tag" > "$basedir"/current-paper + +# "$basedir"/scripts/generateImports.sh $1 # unused + +#echo " $(bashcolor 1 32)(1/$subtasks)$(bashcolorend) - Tagging Paper submodules.." +#function tag { +# paperdir && cd $1 +# if [ "$3" == "1" ]; then +# git tag -d "$tag" 2>/dev/null +# fi +# echo -e "$(date)\n\n$version" | git tag -a "$tag" -F - 2>/dev/null +#} + +#echo -e "$version" + +#forcetag=0 +#if [ "$(cat "$basedir"/current-paper)" != "$tag" ]; then +# forcetag=1 +#fi + +#tag Paper-API $forcetag +#tag Paper-Server $forcetag + +echo " $(bashcolor 1 32)($subtasks/$subtasks) Succeed$(bashcolorend) - Submodules have been updated, regenerated and imported, run 'akarin patch' to test/fix patches, and by 'akarin rbp' to rebuild patches that fixed with the updated upstream." +echo " " + +# gitpush Paper-API $PAPER_API_REPO $tag +# gitpush Paper-Server $PAPER_SERVER_REPO $tag \ No newline at end of file diff --git a/scripts/upstream.sh b/scripts/upstream.sh deleted file mode 100755 index c4078d59a..000000000 --- a/scripts/upstream.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash - -# exit immediately if a command exits with a non-zero status -set -e - -# get base dir regardless of execution location -basedir=$1 - -source "$basedir/scripts/functions.sh" - -git submodule update --init --recursive - -if [[ "$2" == reset* ]]; then - paperdir - gitcmd fetch && gitcmd reset --hard origin/master - basedir - gitcmd add Paper -fi - -# patch paper -paperVer=$(gethead Paper) -paperdir -./paper patch - -cd "Paper-Server" -mcVer=$(mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=minecraft_version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }') - -basedir -"$basedir"/scripts/importmcdev.sh $1 - -minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4) -version=$(echo -e "Paper: $paperVer\nmc-dev:$importedmcdev") -tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $2}')" -echo "$tag" > "$basedir"/current-paper - -"$basedir"/scripts/generateImports.sh $1 - -function tag { - cd $1 - echo -e "$(date)\n\n$version" | git tag -f -a "$tag" -F - 2>/dev/null -} - -echo "Tagging as $tag" -echo -e "$version" - -tag "$basedir"/Paper/Paper-API -tag "$basedir"/Paper/Paper-Server - -gitpush "$basedir"/Paper/Paper-API $PAPER_API_REPO $tag -gitpush "$basedir"/Paper/Paper-Server $PAPER_SERVER_REPO $tag