Initial 1.16.2 support

This update had major internal changes, which took us 8 hours to figure out and resolve all things untill we have a successful build.
YatopiaMC members wish you happy playing using Yatopia for your server software

MAKE A BACKUP OF YOUR WORLD BEFORE RUNNING IT ON YOUR SERVER. YOU HAVE BEEN WARNED.
People have reported to paper that after upgrading villagers are gone. There could be even more issues we are unknown of.
MAKE A BACKUP OF YOUR WORLD BEFORE RUNNING IT ON YOUR SERVER. YOU HAVE BEEN WARNED.

Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
Co-authored-by: Simon Gardling <Titaniumtown@gmail.com>
Co-authored-by: budgidiere <sgidiere@gmail.com>
This commit is contained in:
Ivan Pekov 2020-08-13 18:53:32 +03:00 committed by GitHub
parent 9b0439eda5
commit 5f55124016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 2461 additions and 21692 deletions

View File

@ -6,10 +6,12 @@ on:
- '*.md' - '*.md'
branches: branches:
- ver/1.16.2 - ver/1.16.2
- ver/1.16.1
pull_request: pull_request:
paths-ignore: paths-ignore:
- '*.md' - '*.md'
branches: branches:
- ver/1.16.1
- ver/1.16.2 - ver/1.16.2
jobs: jobs:

10
.gitmodules vendored
View File

@ -1,12 +1,12 @@
[submodule "Tuinity"] [submodule "Tuinity"]
path = Tuinity path = Tuinity
url = https://github.com/tsao-chi/Tuinity-autoupstreamupdate.git url = https://github.com/YatopiaMC/Yatopia-Tuninty.git
branch = ver/1.16 branch = 1.16.2tmp
update = merge update = merge
[submodule "Akarin"] [submodule "Akarin"]
path = Akarin path = Akarin
url = https://github.com/Akarin-project/Akarin url = https://github.com/Akarin-project/Akarin.git
branch = 1.16.1 branch = 1.16.2
update = merge update = merge
[submodule "Purpur"] [submodule "Purpur"]
path = Purpur path = Purpur
@ -16,7 +16,7 @@
[submodule "Empirecraft"] [submodule "Empirecraft"]
path = Empirecraft path = Empirecraft
url = https://github.com/starlis/empirecraft.git url = https://github.com/starlis/empirecraft.git
branch = master branch = ver/1.16.2
update = merge update = merge
[submodule "Origami"] [submodule "Origami"]
path = Origami path = Origami

View File

@ -42,11 +42,6 @@ # Patches
| server | Heavily optimize furnance fuel and recipe lookups | tr7zw | | | server | Heavily optimize furnance fuel and recipe lookups | tr7zw | |
| server | Hopper Optimizations | Phoenix616 | | | server | Hopper Optimizations | Phoenix616 | |
| server | Improve Hopper Performance | Aikar | | | server | Improve Hopper Performance | Aikar | |
| server | Incremental player saving | Aikar | MrIvanPlays |
| api | IntellaJ Code Clean Up | Bud Gidiere | |
| api | IntellaJ Optimize Imports | Bud Gidiere | |
| server | Intellij Code Clean Up | Bud Gidiere | |
| server | Intellij Optimize Imports. | Bud Gidiere | |
| server | Item stuck sleep config | tr7zw | | | server | Item stuck sleep config | tr7zw | |
| api | Kill AnnotationTest | tr7zw | | | api | Kill AnnotationTest | tr7zw | |
| server | Lagging threshold | William Blake Galbreath | | | server | Lagging threshold | William Blake Galbreath | |
@ -74,6 +69,7 @@ # Patches
| server | Skip events if there&#39;s no listeners | William Blake Galbreath | | | server | Skip events if there&#39;s no listeners | William Blake Galbreath | |
| server | Swaps the predicate order of collision | ㄗㄠˋ ㄑㄧˊ | | | server | Swaps the predicate order of collision | ㄗㄠˋ ㄑㄧˊ | |
| server | Tweak Explosions | Aikar | | | server | Tweak Explosions | Aikar | |
| server | Use block distance in portal search radius | Patrick Hemmer | |
| api | Yatopia API Bundle | Bud Gidiere | | | api | Yatopia API Bundle | Bud Gidiere | |
| server | Yatopia-Server-Fixes | Bud Gidiere | | | server | Yatopia-Server-Fixes | Bud Gidiere | |
| server | dont load chunks for physics | Aikar | | | server | dont load chunks for physics | Aikar | |

View File

@ -3,9 +3,8 @@
<h1>Yatopia (Formerly YAPFA)</h1> <h1>Yatopia (Formerly YAPFA)</h1>
<h3>The Most Powerful Minecraft Server Software</h3> <h3>The Most Powerful Minecraft Server Software</h3>
[![Github-CI](https://github.com/tr7zw/Yatopia/workflows/CI/badge.svg)](https://github.com/tr7zw/Yatopia/actions?query=workflow%3ACI) [![Github-CI](https://github.com/YatopiaMC/Yatopia/workflows/CI/badge.svg)](https://github.com/YatopiaMC/Yatopia/actions?query=workflow%3ACI)
[![Discord](https://img.shields.io/discord/342814924310970398?color=%237289DA&label=Discord&logo=discord&logoColor=white)](https://discordapp.com/invite/yk4caxM) [![Discord](https://img.shields.io/discord/342814924310970398?color=%237289DA&label=Discord&logo=discord&logoColor=white)](https://discord.gg/SajCVmp)
[![Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.herokuapp.com%2Ftr7zw%2Fpledges&style=for-the-badge)](https://www.patreon.com/tr7zw)
</div> </div>
## Introduction ## ## Introduction ##
@ -24,13 +23,12 @@ ## Give it a try ##
Available at the following options: Available at the following options:
* **[GitHub Releases](https://github.com/tr7zw/Yatopia/releases/tag/1.16.1)** - 1.16.1 * **[GitHub Releases](https://github.com/YatopiaMC/Yatopia/releases/tag/1.16.1)** - 1.16.1
* **[GitHub Actions](https://github.com/tr7zw/Yatopia/actions?query=branch%3Aver%2F1.15.2+is%3Asuccess+event%3Apush)** - 1.15.2 * **[GitHub Actions](https://github.com/YatopiaMC/Yatopia/actions?query=branch%3Aver%2F1.15.2+is%3Asuccess+event%3Apush)** - 1.15.2
* ~~**[CodeMC](https://ci.codemc.io/job/Tr7zw/job/YAPFA/)** - 1.15.2~~ (Not up-to-date)
## Documentation ## Documentation
You can find a full explanation of the Yatopia configuration file on the [Wiki](https://github.com/tr7zw/Yatopia/wiki) You can find a full explanation of the Yatopia configuration file on the [Wiki](https://github.com/YatopiaMC/Yatopia/wiki)
Also check out the list of patches included in this Project and who created them [here](PATCHES.md)! Also check out the list of patches included in this Project and who created them [here](PATCHES.md)!
@ -43,4 +41,4 @@ ## Building and setting up
## LICENSE ## LICENSE
License information can be found [here](https://github.com/tr7zw/Yatopia/blob/ver/1.16.1/Licensing/LICENSE.md). License information can be found [here](https://github.com/YatopiaMC/Yatopia/blob/ver/1.16.1/Licensing/LICENSE.md).

@ -1 +1 @@
Subproject commit 79807ed4c3e2e0a12fabb342dfaf3b5b953dfe0b Subproject commit 199edf5e8abfe30fd436548cb8f849eb4d2af8d4

View File

@ -26,10 +26,10 @@ index 62cc1c74c11f56dcbd1e24e9c5478497742e6351..59787c474f1a17dff156e74107f880ac
+ // Purpur end + // Purpur end
} }
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 46c4d98ce32a0b1d8cfd391f2c7a9566a045cb55..3d06d68f41328e18994dc20dc407f60f6b08ada8 100644 index 46c4d98ce32a0b1d8cfd391f2c7a9566a045cb55..e5170b299bb4252a7910c1aa5a607dbc3b30a0d1 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -1455,6 +1455,47 @@ public interface Server extends PluginMessageRecipient { @@ -1455,6 +1455,54 @@ public interface Server extends PluginMessageRecipient {
} }
// Tuinity end - add config to timings report // Tuinity end - add config to timings report
@ -73,11 +73,18 @@ index 46c4d98ce32a0b1d8cfd391f2c7a9566a045cb55..3d06d68f41328e18994dc20dc407f60f
+ throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException("Not supported yet.");
+ } + }
+ // Origami end + // Origami end
+ // Yatopia start - add config to timings report
+ @NotNull
+ public org.bukkit.configuration.file.YamlConfiguration getYatopiaConfig()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Yatopia end
+ +
/** /**
* Sends the component to the player * Sends the component to the player
* *
@@ -1555,4 +1596,13 @@ public interface Server extends PluginMessageRecipient { @@ -1555,4 +1603,13 @@ public interface Server extends PluginMessageRecipient {
@NotNull @NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
// Paper end // Paper end

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Modify POM
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 4004ff5d3b9285c737dffcfee5ab48a164de6fc9..d0a4f91ed6a50e71644ef99fbb31986547454853 100644 index 95a99b7b55a980b9ad81a0d536507cf890464260..f93316db543962fc63332a323b7fa1112116024c 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -3,18 +3,18 @@ @@ -3,18 +3,18 @@
@ -22,13 +22,13 @@ index 4004ff5d3b9285c737dffcfee5ab48a164de6fc9..d0a4f91ed6a50e71644ef99fbb319865
- <artifactId>tuinity-api</artifactId> - <artifactId>tuinity-api</artifactId>
+ <artifactId>yatopia-api</artifactId> + <artifactId>yatopia-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version> <version>1.16.2-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
- <name>Tuinity-API</name> - <name>Tuinity-API</name>
- <url>https://github.com/Spottedleaf/Tuinity</url> - <url>https://github.com/Spottedleaf/Tuinity</url>
+ <name>Yatopia-API</name> + <name>Yatopia-API</name>
+ <url>https://github.com/tr7zw/Yatopia</url> + <url>https://github.com/YatopiaMC/Yatopia</url>
<description>An enhanced plugin API for Minecraft servers.</description> <description>An enhanced plugin API for Minecraft servers.</description>
<properties> <properties>

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add GameProfileLookupEvent
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index d0a4f91ed6a50e71644ef99fbb31986547454853..3a49ca4b8af1c9715cda8efde3d09efef92354fe 100644 index f93316db543962fc63332a323b7fa1112116024c..85119ba76c0b5413d72ad1078b56f515b1075115 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -39,6 +39,10 @@ @@ -39,6 +39,10 @@

View File

@ -20,10 +20,10 @@ index 59787c474f1a17dff156e74107f880ac083a7cb3..74bb5aa790d072c130a05d0e59afdb1c
+ // Yatopia end + // Yatopia end
} }
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 3d06d68f41328e18994dc20dc407f60f6b08ada8..87174c63178ac2acd6dfd23d499e4c7efccaa981 100644 index e5170b299bb4252a7910c1aa5a607dbc3b30a0d1..bac4710b98f993875d52548b9fd1538f821fb866 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -1605,4 +1605,13 @@ public interface Server extends PluginMessageRecipient { @@ -1612,4 +1612,13 @@ public interface Server extends PluginMessageRecipient {
*/ */
boolean isLagging(); boolean isLagging();
// Purpur end // Purpur end

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add NBT API as a first class lib
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 3a49ca4b8af1c9715cda8efde3d09efef92354fe..9338a6a97d9ac2ce010928ffe330fc791030c0f6 100644 index 85119ba76c0b5413d72ad1078b56f515b1075115..3f0f08719bc677a1af03c73000d856df5fafa104 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -43,6 +43,11 @@ @@ -43,6 +43,11 @@

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Modify POM
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index 6fd59681784a5cc369f4903b4da0d11174b805f2..e7f20c5654caa038b92963c45fc79747bd49beb5 100644 index ee19a287443127e19db8f01a826490d506553964..09a72ed459cfb949ef59de7ad941698a5da80d3c 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
@ -15,11 +15,11 @@ index 6fd59681784a5cc369f4903b4da0d11174b805f2..e7f20c5654caa038b92963c45fc79747
- <artifactId>tuinity</artifactId> - <artifactId>tuinity</artifactId>
+ <artifactId>yatopia</artifactId> + <artifactId>yatopia</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.16.1-R0.1-SNAPSHOT</version> <version>1.16.2-R0.1-SNAPSHOT</version>
- <name>Tuinity-Server</name> - <name>Tuinity-Server</name>
- <url>https://github.com/Spottedleaf/Tuinity</url> - <url>https://github.com/Spottedleaf/Tuinity</url>
+ <name>Yatopia-Server</name> + <name>Yatopia-Server</name>
+ <url>https://github.com/tr7zw/Yatopia</url> + <url>https://github.com/YatopiaMC/Yatopia</url>
<properties> <properties>
<!-- <skipTests>true</skipTests> Paper - This [was] not going to end well --> <!-- <skipTests>true</skipTests> Paper - This [was] not going to end well -->
@ -44,10 +44,10 @@ index 6fd59681784a5cc369f4903b4da0d11174b805f2..e7f20c5654caa038b92963c45fc79747
<version>${project.version}</version> <version>${project.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@@ -149,6 +149,15 @@ @@ -153,6 +153,15 @@
<id>spigotmc-public</id>
Please see https://www.spigotmc.org/go/maven for more information. <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
--> </repository>
+ +
+ <repository> + <repository>
+ <id>destroystokyo-repo</id> + <id>destroystokyo-repo</id>
@ -57,9 +57,9 @@ index 6fd59681784a5cc369f4903b4da0d11174b805f2..e7f20c5654caa038b92963c45fc79747
+ <id>aikar</id> + <id>aikar</id>
+ <url>https://repo.aikar.co/nexus/content/repositories/aikar/</url> + <url>https://repo.aikar.co/nexus/content/repositories/aikar/</url>
+ </repository> + </repository>
<repository> </repositories>
<id>spigotmc-public</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url> <pluginRepositories>
@@ -164,15 +173,15 @@ @@ -164,15 +173,15 @@
<!-- This builds a completely 'ready to start' jar with all dependencies inside --> <!-- This builds a completely 'ready to start' jar with all dependencies inside -->
@ -67,7 +67,7 @@ index 6fd59681784a5cc369f4903b4da0d11174b805f2..e7f20c5654caa038b92963c45fc79747
- <finalName>tuinity-${minecraft.version}</finalName> - <finalName>tuinity-${minecraft.version}</finalName>
- <defaultGoal>install</defaultGoal> <!-- Paper --> - <defaultGoal>install</defaultGoal> <!-- Paper -->
+ <finalName>yatopia-${minecraft.version}</finalName> + <finalName>yatopia-${minecraft.version}</finalName>
+ <defaultGoal>clean install</defaultGoal> <!-- Paper --> + <defaultGoal>clean install</defaultGoal> <!-- Paper --> <!-- Yatopia -->
<plugins> <plugins>
<plugin> <plugin>
<groupId>com.lukegb.mojo</groupId> <groupId>com.lukegb.mojo</groupId>
@ -75,7 +75,7 @@ index 6fd59681784a5cc369f4903b4da0d11174b805f2..e7f20c5654caa038b92963c45fc79747
<version>1.3</version> <version>1.3</version>
<configuration> <configuration>
- <outputPrefix>git-Tuinity-</outputPrefix> <!-- Tuinity --> - <outputPrefix>git-Tuinity-</outputPrefix> <!-- Tuinity -->
+ <outputPrefix>git-Yatopia-</outputPrefix> + <outputPrefix>git-Yatopia-</outputPrefix> <!-- Tuinity --> <!-- Yatopia -->
<scmDirectory>..</scmDirectory> <scmDirectory>..</scmDirectory>
</configuration> </configuration>
<executions> <executions>

View File

@ -18,7 +18,7 @@ index 74ed02fa9296583977bb721014b10ff8b708b43c..a13c7b2b5bc79ecaea404779149ed02c
); );
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..dfa51d6f170ec4fb010dce909c3fccb6c726deb4 index 0000000000000000000000000000000000000000..84bc8f6586fdbb44b839a8963f721d8ff0792fcc
--- /dev/null --- /dev/null
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java
@@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..dfa51d6f170ec4fb010dce909c3fccb6
+ +
+public class YatopiaVersionFetcher implements VersionFetcher { +public class YatopiaVersionFetcher implements VersionFetcher {
+ +
+ private static final String GITHUB_BRANCH_NAME = "ver/1.16.1"; + private static final String GITHUB_BRANCH_NAME = "ver/1.16.2";
+ +
+ @Override + @Override
+ public long getCacheTime() { + public long getCacheTime() {
@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..dfa51d6f170ec4fb010dce909c3fccb6
+ @Override + @Override
+ public String getVersionMessage(@Nonnull String serverVersion) { + public String getVersionMessage(@Nonnull String serverVersion) {
+ String[] parts = serverVersion.substring("git-Yatopia-".length()).split("[-\\s]"); + String[] parts = serverVersion.substring("git-Yatopia-".length()).split("[-\\s]");
+ String updateMessage = getUpdateStatusMessage("tr7zw/Yatopia", GITHUB_BRANCH_NAME, parts[0]); + String updateMessage = getUpdateStatusMessage("YatopiaMC/Yatopia", GITHUB_BRANCH_NAME, parts[0]);
+ String history = getHistory(); + String history = getHistory();
+ return history != null ? history + "\n" + updateMessage : updateMessage; + return history != null ? history + "\n" + updateMessage : updateMessage;
+ } + }
@ -120,10 +120,10 @@ index 0000000000000000000000000000000000000000..dfa51d6f170ec4fb010dce909c3fccb6
+} +}
\ No newline at end of file \ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5960ed2e91008b363dad900c72064055413eafd9..ee6a2dbc1306871d9ba621f199054befb09744c2 100644 index fb5d581fa1ded44fb87fad8fcb4994955c2e4a94..26234861e38b4d724a46afeb5428272f14e9f700 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1515,7 +1515,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -1519,7 +1519,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} }
public String getServerModName() { public String getServerModName() {
@ -133,10 +133,10 @@ index 5960ed2e91008b363dad900c72064055413eafd9..ee6a2dbc1306871d9ba621f199054bef
public CrashReport b(CrashReport crashreport) { public CrashReport b(CrashReport crashreport) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8fab87414b78c2e9bbe6fe98c70bfa6a3ba5313b..65b4c4ac062600f7b671f8d4144af575d9f6facd 100644 index 2b664724a46a7b7221f93da62c6d87b9cac199f5..973d8969acec65e7b730cdf869a9687c86fde78b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -217,7 +217,7 @@ import javax.annotation.Nullable; // Paper @@ -216,7 +216,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server { public final class CraftServer implements Server {
@ -146,7 +146,7 @@ index 8fab87414b78c2e9bbe6fe98c70bfa6a3ba5313b..65b4c4ac062600f7b671f8d4144af575
private final String bukkitVersion = Versioning.getBukkitVersion(); private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft"); private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 90c1067ca23e566a96d71e06c273d44397928b64..60604e44911d4eb1b67f4a68f8ddad03bcaff95f 100644 index c1efe830dd0807d5f7bda10cb582556af6d23383..2b433f80abd9482291f3d722b2373f8e1f46cc70 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -326,7 +326,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -326,7 +326,7 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -5,19 +5,19 @@ Subject: [PATCH] Add getLastTickMs api
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ee6a2dbc1306871d9ba621f199054befb09744c2..26ee6e9219059c9f7175148e934d2adec2b336a0 100644 index 26234861e38b4d724a46afeb5428272f14e9f700..c3c5cfb74caf11e452ca061cf882ce70d18b0ec5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -930,6 +930,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -928,6 +928,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper End // Paper End
// Spigot End // Spigot End
+ public static long lastTickMs = 0; // Yatopia + public static long lastTickMs = 0; // Yatopia
+ +
protected void v() { protected void w() {
try { try {
long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper
@@ -998,7 +1000,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -996,7 +998,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(gameprofilertick); this.a(gameprofilertick);
//this.methodProfiler.a(); // Akarin - remove caller //this.methodProfiler.a(); // Akarin - remove caller
//this.methodProfiler.enter("tick"); // Akarin - remove caller //this.methodProfiler.enter("tick"); // Akarin - remove caller
@ -28,23 +28,23 @@ index ee6a2dbc1306871d9ba621f199054befb09744c2..26ee6e9219059c9f7175148e934d2ade
this.X = true; this.X = true;
// Purpur start - tps catchup // Purpur start - tps catchup
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 65b4c4ac062600f7b671f8d4144af575d9f6facd..856e0ba3cfe6225d9928cb99b2d7a00a8fcd6a03 100644 index 973d8969acec65e7b730cdf869a9687c86fde78b..7a2b16aaf70cefa00beeacf2d6fcd8878bd7f6de 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2410,4 +2410,11 @@ public final class CraftServer implements Server { @@ -2413,4 +2413,11 @@ public final class CraftServer implements Server {
return getServer().lagging; return getServer().lagging;
} }
// Purpur end // Purpur end
+ +
+ // Yatopia start + // Yatopia start
+ @Override + @Override
+ public long getLastTickMs() { + public long getLastTickMs() {
+ return net.minecraft.server.MinecraftServer.lastTickMs; + return net.minecraft.server.MinecraftServer.lastTickMs;
+ } + }
+ // Yatopia end + // Yatopia end
} }
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..87812ace9e1327f31693bdfb3fa45ac38766799b 100644 index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..85f588ce9d0e3ce4696f2d4918e7b242bf99a1de 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java --- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java +++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -33,7 +33,7 @@ public class TicksPerSecondCommand extends Command @@ -33,7 +33,7 @@ public class TicksPerSecondCommand extends Command
@ -52,7 +52,20 @@ index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..87812ace9e1327f31693bdfb3fa45ac3
tpsAvg[i] = format( tps[i] ); tpsAvg[i] = format( tps[i] );
} }
- sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Purpur - sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Purpur
+ sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ") + " Last tick time: " + org.bukkit.Bukkit.getLastTickMs() + "ms"); // Yatopia // Purpur + sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ") + ChatColor.GOLD + " Last tick time: " + format( org.bukkit.Bukkit.getLastTickMs() )); // Purpur // Yatopia
if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) { if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) {
sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)"); sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)");
if (!hasShownMemoryWarning) { if (!hasShownMemoryWarning) {
@@ -52,4 +52,12 @@ public class TicksPerSecondCommand extends Command
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
+ ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
}
+
+ // Yatopia start
+ private static String format(long ms)
+ {
+ ChatColor startingColor = ms < 40 ? ChatColor.GREEN : ( ms < 50 ) ? ChatColor.YELLOW : ChatColor.RED;
+ return startingColor.toString() + Long.toString( ms ) + ChatColor.GOLD + "ms";
+ }
+ // Yatopia end
}

View File

@ -5,37 +5,39 @@ Subject: [PATCH] Add config Yatopia command and basic settings
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index 88513b8830ea666ddf831771680b6e76e7cf95f0..6a110318441a16cc3ff7dfa2364768279b16358f 100644 index b67f05f290db653cf75a89e85bd3decb5044a1e0..11758b6b158d971b9beb1b609d7513dab46be525 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java --- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -232,6 +232,7 @@ public class TimingsExport extends Thread { @@ -232,6 +232,7 @@ public class TimingsExport extends Thread {
pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Tuinity - add config to timings report pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)), // Tuinity - add config to timings report
pair("tuinity", mapAsJSON(Bukkit.spigot().getTuinityConfig(), null)) // Tuinity - add config to timings report pair("tuinity", mapAsJSON(Bukkit.spigot().getTuinityConfig(), null)) // Tuinity - add config to timings report
, pair("purpur", mapAsJSON(Bukkit.spigot().getPurpurConfig(), null)) // Yatopia - add config to timings report , pair("purpur", mapAsJSON(Bukkit.spigot().getPurpurConfig(), null)) // Purpur - add config to timings report
+ //, pair("yatopia", mapAsJSON(Bukkit.spigot().getYatopiaConfig(), null)) // Yatopia - add config to timings report + , pair("yatopia", mapAsJSON(Bukkit.spigot().getYatopiaConfig(), null)) // Yatopia - add config to timings report
)); ));
new TimingsExport(listeners, parent, history).start(); new TimingsExport(listeners, parent, history).start();
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..119c3b693370ab8753791a0396789c8971a05c9b index 0000000000000000000000000000000000000000..567dd8839173ac74b7dc122c1b677998afe0db5f
--- /dev/null --- /dev/null
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java
@@ -0,0 +1,126 @@ @@ -0,0 +1,128 @@
+package dev.tr7zw.yatopia; +package dev.tr7zw.yatopia;
+ +
+import com.google.common.base.Preconditions; +import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+
+import net.minecraft.server.MinecraftKey;
+import net.minecraft.server.MinecraftServer;
+
+import java.io.File; +import java.io.File;
+import java.util.Arrays; +import java.util.Arrays;
+import java.util.Collection; +import java.util.Collection;
+import java.util.Collections; +import java.util.Collections;
+import java.util.List; +import java.util.List;
+import java.util.Locale; +import java.util.Locale;
+
+import java.util.function.Function; +import java.util.function.Function;
+import com.google.common.collect.Lists; +
+import net.minecraft.server.MinecraftKey;
+import net.minecraft.server.MinecraftServer;
+import org.bukkit.Bukkit; +import org.bukkit.Bukkit;
+import org.bukkit.ChatColor; +import org.bukkit.ChatColor;
+import org.bukkit.Location; +import org.bukkit.Location;
@ -109,7 +111,7 @@ index 0000000000000000000000000000000000000000..119c3b693370ab8753791a0396789c89
+ return false; + return false;
+ } + }
+ +
+ switch (args[0].toLowerCase(Locale.ENGLISH)) { + switch (args[0].toLowerCase(Locale.ENGLISH)) {
+ case "info": + case "info":
+ doInfo(sender); + doInfo(sender);
+ break; + break;
@ -148,13 +150,12 @@ index 0000000000000000000000000000000000000000..119c3b693370ab8753791a0396789c89
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Yatopia config reload complete."); + Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Yatopia config reload complete.");
+ } + }
+} +}
\ No newline at end of file
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..5cffd84ed9842bb7d7e56df8ac841b467f6293cc index 0000000000000000000000000000000000000000..0e5f090e4160d08bce0b46ac4cb6d3d3510128bf
--- /dev/null --- /dev/null
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -0,0 +1,210 @@ @@ -0,0 +1,218 @@
+package dev.tr7zw.yatopia; +package dev.tr7zw.yatopia;
+ +
+import com.google.common.base.Throwables; +import com.google.common.base.Throwables;
@ -173,7 +174,6 @@ index 0000000000000000000000000000000000000000..5cffd84ed9842bb7d7e56df8ac841b46
+import java.util.logging.Level; +import java.util.logging.Level;
+import java.util.regex.Pattern; +import java.util.regex.Pattern;
+ +
+import net.minecraft.server.MinecraftServer;
+import org.bukkit.Bukkit; +import org.bukkit.Bukkit;
+import org.bukkit.command.Command; +import org.bukkit.command.Command;
+import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.configuration.InvalidConfigurationException;
@ -183,8 +183,8 @@ index 0000000000000000000000000000000000000000..5cffd84ed9842bb7d7e56df8ac841b46
+ +
+ public static File CONFIG_FILE; + public static File CONFIG_FILE;
+ private static final String HEADER = "This is the main configuration file for Yatopia.\n" + private static final String HEADER = "This is the main configuration file for Yatopia.\n"
+ + "Yatopia contains many breaking changes and settings, so know what you are doing!\n" + + "Yatopia contains many breaking changes and settings, so know what you are doing!\n"
+ + "You have been warned!\n"; + + "You have been warned!\n";
+ /*========================================================================*/ + /*========================================================================*/
+ public static YamlConfiguration config; + public static YamlConfiguration config;
+ public static int version; // since we're remapping sidestreams' configs we need this public + public static int version; // since we're remapping sidestreams' configs we need this public
@ -282,6 +282,7 @@ index 0000000000000000000000000000000000000000..5cffd84ed9842bb7d7e56df8ac841b46
+ +
+ private static final Pattern SPACE = Pattern.compile(" "); + private static final Pattern SPACE = Pattern.compile(" ");
+ private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]"); + private static final Pattern NOT_NUMERIC = Pattern.compile("[^-\\d.]");
+
+ public static int getSeconds(String str) { + public static int getSeconds(String str) {
+ str = SPACE.matcher(str).replaceAll(""); + str = SPACE.matcher(str).replaceAll("");
+ final char unit = str.charAt(str.length() - 1); + final char unit = str.charAt(str.length() - 1);
@ -293,10 +294,18 @@ index 0000000000000000000000000000000000000000..5cffd84ed9842bb7d7e56df8ac841b46
+ num = 0D; + num = 0D;
+ } + }
+ switch (unit) { + switch (unit) {
+ case 'd': num *= (double) 60*60*24; break; + case 'd':
+ case 'h': num *= (double) 60*60; break; + num *= (double) 60 * 60 * 24;
+ case 'm': num *= 60; break; + break;
+ default: case 's': break; + case 'h':
+ num *= (double) 60 * 60;
+ break;
+ case 'm':
+ num *= 60;
+ break;
+ default:
+ case 's':
+ break;
+ } + }
+ return (int) num; + return (int) num;
+ } + }
@ -305,17 +314,17 @@ index 0000000000000000000000000000000000000000..5cffd84ed9842bb7d7e56df8ac841b46
+ String time = ""; + String time = "";
+ +
+ if (seconds > 60 * 60 * 24) { + if (seconds > 60 * 60 * 24) {
+ time += TimeUnit.SECONDS.toDays(seconds) + "d"; + time += TimeUnit.SECONDS.toDays(seconds) + "d";
+ seconds %= 60 * 60 * 24; + seconds %= 60 * 60 * 24;
+ } + }
+ +
+ if (seconds > 60 * 60) { + if (seconds > 60 * 60) {
+ time += TimeUnit.SECONDS.toHours(seconds) + "h"; + time += TimeUnit.SECONDS.toHours(seconds) + "h";
+ seconds %= 60 * 60; + seconds %= 60 * 60;
+ } + }
+ +
+ if (seconds > 0) { + if (seconds > 0) {
+ time += TimeUnit.SECONDS.toMinutes(seconds) + "m"; + time += TimeUnit.SECONDS.toMinutes(seconds) + "m";
+ } + }
+ return time; + return time;
+ } + }
@ -356,18 +365,17 @@ index 0000000000000000000000000000000000000000..5cffd84ed9842bb7d7e56df8ac841b46
+ +
+ public static boolean disableEntityStuckChecks = false; + public static boolean disableEntityStuckChecks = false;
+ private static void disableEntityStuckChecks() { + private static void disableEntityStuckChecks() {
+ disableEntityStuckChecks = getBoolean("settings.disableEntityStuckChecks", false); + disableEntityStuckChecks = getBoolean("settings.disableEntityStuckChecks", false);
+ } + }
+ +
+ public static boolean disableEntityCollisionboxes = false; + public static boolean disableEntityCollisionboxes = false;
+ private static void disableEntityCollisionboxes() { + private static void disableEntityCollisionboxes() {
+ disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false); + disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false);
+ } + }
+ +
+} +}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 21dc3b9a638c7ca5e2da56c954088f2f367f05e4..c3becefce8143f34ed2b1093dd22227b7309629c 100644 index a60634fc455e8a59399020689b70eb64b6824d12..cb4a89940cf02de5c3eefc5c746397a931c96b7a 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java --- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -181,6 +181,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -181,6 +181,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@ -385,12 +393,12 @@ index 21dc3b9a638c7ca5e2da56c954088f2f367f05e4..c3becefce8143f34ed2b1093dd22227b
+ // Yatopia end + // Yatopia end
this.setPVP(dedicatedserverproperties.pvp); this.setPVP(dedicatedserverproperties.pvp);
this.setAllowFlight(dedicatedserverproperties.allowFlight); this.setAllowFlight(dedicatedserverproperties.allowFlight);
this.setResourcePack(dedicatedserverproperties.resourcePack, this.aY()); this.setResourcePack(dedicatedserverproperties.resourcePack, this.aZ());
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index dd093e3e624158ff87bad59785ed2496f161f64c..fe0689f6be466d1a2a1ed2b76331272199a0aa0c 100644 index 6f24467f5d790cbc5726e8ccabe7b0197f7beb21..724aab2cc747940e31c01a52a258e3519e6bda79 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1035,7 +1035,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -1033,7 +1033,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this);
VoxelShape voxelshape = this.world.getWorldBorder().c(); VoxelShape voxelshape = this.world.getWorldBorder().c();
Stream<VoxelShape> stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(voxelshape); // Paper Stream<VoxelShape> stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(voxelshape); // Paper
@ -400,14 +408,14 @@ index dd093e3e624158ff87bad59785ed2496f161f64c..fe0689f6be466d1a2a1ed2b763312721
}); });
StreamAccumulator<VoxelShape> streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream)); StreamAccumulator<VoxelShape> streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream));
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 732a7747fd0360deec8237c80bc93fb9f06b5320..c30fee13723cef0f03eb5a87851158cf347fae3c 100644 index 730a0262f400a9974f89ecdf8b208e54cf7952f6..99c6e562b310e7268eabee0ddd7ec9e6960edd4f 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -266,6 +266,7 @@ public abstract class EntityLiving extends Entity { @@ -266,6 +266,7 @@ public abstract class EntityLiving extends Entity {
//this.world.getMethodProfiler().enter("livingEntityBaseTick"); // Akarin - remove caller //this.world.getMethodProfiler().enter("livingEntityBaseTick"); // Akarin - remove caller
boolean flag = this instanceof EntityHuman; boolean flag = this instanceof EntityHuman;
+ if(!dev.tr7zw.yatopia.YatopiaConfig.disableEntityStuckChecks) { // Yatopia start + if (!dev.tr7zw.yatopia.YatopiaConfig.disableEntityStuckChecks) { // Yatopia
if (this.isAlive()) { if (this.isAlive()) {
if (this.inBlock()) { if (this.inBlock()) {
this.damageEntity(DamageSource.STUCK, 1.0F); this.damageEntity(DamageSource.STUCK, 1.0F);
@ -415,15 +423,15 @@ index 732a7747fd0360deec8237c80bc93fb9f06b5320..c30fee13723cef0f03eb5a87851158cf
} }
} }
} }
+ } // Yatopia end + } // Yatopia
if (this.isFireProof() || this.world.isClientSide) { if (this.isFireProof() || this.world.isClientSide) {
this.extinguish(); this.extinguish();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 856e0ba3cfe6225d9928cb99b2d7a00a8fcd6a03..6f4c1bbf39af205ad15318eac667117dd332bb12 100644 index 7a2b16aaf70cefa00beeacf2d6fcd8878bd7f6de..21ce618d91cde3beec4767f89221d0ed14778501 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -838,6 +838,7 @@ public final class CraftServer implements Server { @@ -837,6 +837,7 @@ public final class CraftServer implements Server {
net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
de.minebench.origami.OrigamiConfig.init((File) console.options.valueOf("origami-settings")); // Origami - Server Config de.minebench.origami.OrigamiConfig.init((File) console.options.valueOf("origami-settings")); // Origami - Server Config
com.proximyst.rainforest.RainforestConfig.init((File) console.options.valueOf("rainforest-settings")); // Rainforest com.proximyst.rainforest.RainforestConfig.init((File) console.options.valueOf("rainforest-settings")); // Rainforest
@ -431,11 +439,25 @@ index 856e0ba3cfe6225d9928cb99b2d7a00a8fcd6a03..6f4c1bbf39af205ad15318eac667117d
for (WorldServer world : console.getWorlds()) { for (WorldServer world : console.getWorlds()) {
world.worldDataServer.setDifficulty(config.difficulty); world.worldDataServer.setDifficulty(config.difficulty);
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals); world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
@@ -2267,6 +2268,13 @@ public final class CraftServer implements Server {
}
// Origami end
+ // Yatopia start
+ @Override
+ public YamlConfiguration getYatopiaConfig() {
+ return dev.tr7zw.yatopia.YatopiaConfig.config;
+ }
+ // Yatopia end
+
@Override
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 diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 73a36683e386d9e8e917b6ac04262aae3e3d3b69..60b4c2337e6fdeddfb785e90fa501149af45756c 100644 index d6c82bd0afa43a4afcbc7029622c3915fa39bcc9..2ba0d89ae1b5d52eec3bd91328088ea2c7249d07 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -178,6 +178,14 @@ public class Main { @@ -170,6 +170,14 @@ public class Main {
.describedAs("Yml file"); .describedAs("Yml file");
// Rainforest end // Rainforest end

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrIvanPlays <ivan@mrivanplays.com> From: MrIvanPlays <ivan@mrivanplays.com>
Date: Tue, 11 Aug 2020 10:28:04 +0300 Date: Thu, 13 Aug 2020 15:14:36 +0300
Subject: [PATCH] Per entity (type) collision settings Subject: [PATCH] Per entity (type) collision settings
Base patch was the only player collisions patch, the original author of was tr7zw <tr7zw@live.de> Base patch was the only player collisions patch, the original author of was tr7zw <tr7zw@live.de>
@ -14,12 +14,12 @@ The whole code is based around 1 class, the EntityFilter class. Whole filtering
Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: tr7zw <tr7zw@live.de>
diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java
index e2bbbfeb7e2505479e6a457294aaa550b97319ca..a89209347418b3006745c50043d0abdf2b91babc 100644 index be8daf986eb9c83bd5974eca78a00f717e4f5061..3d71ee447b0d45c50ed6f2f17ad5184d28d3bc08 100644
--- a/src/main/java/de/minebench/origami/OrigamiConfig.java --- a/src/main/java/de/minebench/origami/OrigamiConfig.java
+++ b/src/main/java/de/minebench/origami/OrigamiConfig.java +++ b/src/main/java/de/minebench/origami/OrigamiConfig.java
@@ -125,6 +125,37 @@ public final class OrigamiConfig { @@ -125,6 +125,38 @@ public final class OrigamiConfig {
private void fastFeatureSearchDontLoad() { private void fastFeatureSearchDontLoad() {
fastFeatureSearchDontLoad = getBoolean("fast-feature-search-dont-load", false); fastFeatureSearchDontLoad = getBoolean("fast-feature-search-dont-load", false);
} }
+ +
+ public boolean playerCollisions = true; + public boolean playerCollisions = true;
@ -34,6 +34,7 @@ index e2bbbfeb7e2505479e6a457294aaa550b97319ca..a89209347418b3006745c50043d0abdf
+ public boolean waterCreatureCollisions = true; + public boolean waterCreatureCollisions = true;
+ public boolean waterAmbientCollisions = true; + public boolean waterAmbientCollisions = true;
+ public boolean allCollisionsEnabled = false; + public boolean allCollisionsEnabled = false;
+
+ private void specificCollisionSettings() { + private void specificCollisionSettings() {
+ playerCollisions = getBoolean("collisions.players", playerCollisions); + playerCollisions = getBoolean("collisions.players", playerCollisions);
+ animalCollisions = getBoolean("collisions.animals", animalCollisions); + animalCollisions = getBoolean("collisions.animals", animalCollisions);
@ -57,10 +58,10 @@ index e2bbbfeb7e2505479e6a457294aaa550b97319ca..a89209347418b3006745c50043d0abdf
diff --git a/src/main/java/dev/tr7zw/yatopia/EntityFilter.java b/src/main/java/dev/tr7zw/yatopia/EntityFilter.java diff --git a/src/main/java/dev/tr7zw/yatopia/EntityFilter.java b/src/main/java/dev/tr7zw/yatopia/EntityFilter.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..e6617833a7aea4803b78bc55b633fac9698688bd index 0000000000000000000000000000000000000000..3c6dc395dd26b995f63a15e3f9a0a86abe0a5647
--- /dev/null --- /dev/null
+++ b/src/main/java/dev/tr7zw/yatopia/EntityFilter.java +++ b/src/main/java/dev/tr7zw/yatopia/EntityFilter.java
@@ -0,0 +1,131 @@ @@ -0,0 +1,130 @@
+package dev.tr7zw.yatopia; +package dev.tr7zw.yatopia;
+ +
+import com.google.common.base.Predicates; +import com.google.common.base.Predicates;
@ -72,7 +73,6 @@ index 0000000000000000000000000000000000000000..e6617833a7aea4803b78bc55b633fac9
+import net.minecraft.server.EnumCreatureType; +import net.minecraft.server.EnumCreatureType;
+import net.minecraft.server.IEntitySelector; +import net.minecraft.server.IEntitySelector;
+import net.minecraft.server.ScoreboardTeamBase; +import net.minecraft.server.ScoreboardTeamBase;
+import net.minecraft.server.World;
+ +
+import java.util.function.Predicate; +import java.util.function.Predicate;
+ +
@ -193,10 +193,10 @@ index 0000000000000000000000000000000000000000..e6617833a7aea4803b78bc55b633fac9
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index c30fee13723cef0f03eb5a87851158cf347fae3c..a4123c2c7dc84803194459895f29d35643b71d04 100644 index 99c6e562b310e7268eabee0ddd7ec9e6960edd4f..ef9958e3922bc306e38c76eb67ddbd1f38f4c547 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2846,7 +2846,7 @@ public abstract class EntityLiving extends Entity { @@ -2849,7 +2849,7 @@ public abstract class EntityLiving extends Entity {
// Paper - end don't run getEntities if we're not going to use its result // Paper - end don't run getEntities if we're not going to use its result
// Tuinity start - reduce memory allocation from collideNearby // Tuinity start - reduce memory allocation from collideNearby
List<Entity> list = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList(); List<Entity> list = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList();

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Allow to change the piston push limit
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index 5cffd84ed9842bb7d7e56df8ac841b467f6293cc..57820ad632a253c93436a77c5811c1bc44e3f06a 100644 index 0e5f090e4160d08bce0b46ac4cb6d3d3510128bf..c0965eb0b6ef615ab89ffc5942d6a4e92a0d4a67 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -207,4 +207,8 @@ public class YatopiaConfig { @@ -215,4 +215,8 @@ public class YatopiaConfig {
disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false); disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false);
} }
+ public static int pistonPushLimit = 12; + public static int pistonPushLimit = 12;
@ -17,7 +17,6 @@ index 5cffd84ed9842bb7d7e56df8ac841b467f6293cc..57820ad632a253c93436a77c5811c1bc
+ pistonPushLimit = getInt("settings.pistonPushLimit", 12); + pistonPushLimit = getInt("settings.pistonPushLimit", 12);
+ } + }
} }
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
index 95aeaaf0bb07c5ecf7117dae3382b0f0aac6426f..89385896af6f6088a9749a13ad5c1d0c581fa502 100644 index 95aeaaf0bb07c5ecf7117dae3382b0f0aac6426f..89385896af6f6088a9749a13ad5c1d0c581fa502 100644
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java --- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add NBT-API as first-class lib
diff --git a/pom.xml b/pom.xml diff --git a/pom.xml b/pom.xml
index e7f20c5654caa038b92963c45fc79747bd49beb5..170a0506c15e9a6d0069cce16a89bdc70d6fc4fd 100644 index 09a72ed459cfb949ef59de7ad941698a5da80d3c..7a1de791e38507bc53ab232d42712217d0845754 100644
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -311,6 +311,10 @@ @@ -311,6 +311,10 @@

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Player-saving-async-FileIO
diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
index cf539c98073b475eb5b769c8cc11d48a7e6d58f1..93b14f01fd7094175968918f0dcd7c3c921f156a 100644 index cf539c98073b475eb5b769c8cc11d48a7e6d58f1..b19c702bae3e750bee13c8b1b3eaa62f0d3ba1ae 100644
--- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
@@ -50,6 +50,7 @@ public class AdvancementDataPlayer { @@ -50,6 +50,7 @@ public class AdvancementDataPlayer {
@ -32,17 +32,17 @@ index cf539c98073b475eb5b769c8cc11d48a7e6d58f1..93b14f01fd7094175968918f0dcd7c3c
try { try {
FileOutputStream fileoutputstream = new FileOutputStream(this.f); FileOutputStream fileoutputstream = new FileOutputStream(this.f);
Throwable throwable = null; Throwable throwable = null;
@@ -275,6 +285,8 @@ public class AdvancementDataPlayer { @@ -275,7 +285,7 @@ public class AdvancementDataPlayer {
} catch (IOException ioexception) { } catch (IOException ioexception) {
AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, ioexception); AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, ioexception);
} }
+ */ -
+ // Yatopia end + */ // Yatopia end
} }
public boolean grantCriteria(Advancement advancement, String s) {
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index e411f6280d07e3f6a953e1fcaffaaa49f85dc7cc..68c033e2b8542c5656d5b9534a4953a370999097 100644 index ce4ebc96c01f3dacf4e4d0569d86f52140440d43..a52c0391b171c8a57de75f87c534ce1e0e78c44a 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -700,11 +700,20 @@ public abstract class EntityHuman extends EntityLiving { @@ -700,11 +700,20 @@ public abstract class EntityHuman extends EntityLiving {
@ -52,7 +52,7 @@ index e411f6280d07e3f6a953e1fcaffaaa49f85dc7cc..68c033e2b8542c5656d5b9534a4953a3
+ // Yatopia start + // Yatopia start
+ private NBTTagList inventorySnapshot = null; + private NBTTagList inventorySnapshot = null;
+ private NBTTagList enderchestSnapshot = null; + private NBTTagList enderchestSnapshot = null;
+ public void takeInventorySnapshot() { + public void takeSnapshot() {
+ inventorySnapshot = this.inventory.a(new NBTTagList()); + inventorySnapshot = this.inventory.a(new NBTTagList());
+ enderchestSnapshot = this.enderChest.g(); + enderchestSnapshot = this.enderChest.g();
+ } + }
@ -63,7 +63,7 @@ index e411f6280d07e3f6a953e1fcaffaaa49f85dc7cc..68c033e2b8542c5656d5b9534a4953a3
super.saveData(nbttagcompound); super.saveData(nbttagcompound);
nbttagcompound.setInt("DataVersion", SharedConstants.getGameVersion().getWorldVersion()); nbttagcompound.setInt("DataVersion", SharedConstants.getGameVersion().getWorldVersion());
- nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList())); - nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList()));
+ nbttagcompound.set("Inventory", inventorySnapshot != null ? inventorySnapshot : this.inventory.a(new NBTTagList())); inventorySnapshot = null;// Yatopia + nbttagcompound.set("Inventory", inventorySnapshot != null ? inventorySnapshot : this.inventory.a(new NBTTagList())); inventorySnapshot = null; // Yatopia
nbttagcompound.setInt("SelectedItemSlot", this.inventory.itemInHandIndex); nbttagcompound.setInt("SelectedItemSlot", this.inventory.itemInHandIndex);
nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks); nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks);
nbttagcompound.setFloat("XpP", this.exp); nbttagcompound.setFloat("XpP", this.exp);
@ -72,15 +72,15 @@ index e411f6280d07e3f6a953e1fcaffaaa49f85dc7cc..68c033e2b8542c5656d5b9534a4953a3
this.foodData.b(nbttagcompound); this.foodData.b(nbttagcompound);
this.abilities.a(nbttagcompound); this.abilities.a(nbttagcompound);
- nbttagcompound.set("EnderItems", this.enderChest.g()); - nbttagcompound.set("EnderItems", this.enderChest.g());
+ nbttagcompound.set("EnderItems", enderchestSnapshot != null ? enderchestSnapshot : this.enderChest.g()); enderchestSnapshot = null;// Yatopia + nbttagcompound.set("EnderItems", enderchestSnapshot != null ? enderchestSnapshot : this.enderChest.g()); enderchestSnapshot = null; // Yatopia
if (!this.getShoulderEntityLeft().isEmpty()) { if (!this.getShoulderEntityLeft().isEmpty()) {
nbttagcompound.set("ShoulderEntityLeft", this.getShoulderEntityLeft()); nbttagcompound.set("ShoulderEntityLeft", this.getShoulderEntityLeft());
} }
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 33c40bf94e74d1ee268fb8ffb809f45b31621df9..0b6c62ff0ac75c7ec11de9f8e9745b07ee12664e 100644 index 4c6e708b6d6af45159315dc6ab5fdf72320d9825..2b7fb65942f5d22737cbbf0f8e7ef2194fc607a2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1260,6 +1260,28 @@ public abstract class PlayerList { @@ -1284,6 +1284,28 @@ public abstract class PlayerList {
if (team != null) scoreboard.removeTeam(team); if (team != null) scoreboard.removeTeam(team);
} }
// Paper end // Paper end
@ -88,56 +88,48 @@ index 33c40bf94e74d1ee268fb8ffb809f45b31621df9..0b6c62ff0ac75c7ec11de9f8e9745b07
+ // Yatopia start - make sure all saves are done + // Yatopia start - make sure all saves are done
+ try { + try {
+ playerFileData.saveThread.shutdown(); + playerFileData.saveThread.shutdown();
+ boolean done = playerFileData.saveThread.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS); + boolean done = playerFileData.saveThread.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS);
+ if (!done) { + if (!done) {
+ LOGGER.error("Players did not save completly!"); + LOGGER.error("Players did not save completely!");
+ } + }
+ ServerStatisticManager.saveThread.shutdown(); + ServerStatisticManager.saveThread.shutdown();
+ done = ServerStatisticManager.saveThread.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS); + done = ServerStatisticManager.saveThread.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS);
+ if (!done) { + if (!done) {
+ LOGGER.error("Stats did not save completly!"); + LOGGER.error("Stats did not save completely!");
+ } + }
+ AdvancementDataPlayer.saveThread.shutdown(); + AdvancementDataPlayer.saveThread.shutdown();
+ done = AdvancementDataPlayer.saveThread.awaitTermination(60, java.util.concurrent.TimeUnit.SECONDS); + done = AdvancementDataPlayer.saveThread.awaitTermination(30, java.util.concurrent.TimeUnit.SECONDS);
+ if (!done) { + if (!done) {
+ LOGGER.error("Advancements did not save completly!"); + LOGGER.error("Advancements did not save completely!");
+ } + }
+ } catch (InterruptedException e) { + } catch (InterruptedException e) {
+ e.printStackTrace(); + e.printStackTrace();
+ } + }
+ // Yatopia end + // Yatopia end
} }
// Paper end // Paper end
@@ -1297,13 +1319,13 @@ public abstract class PlayerList { @@ -1321,13 +1343,13 @@ public abstract class PlayerList {
File file = this.server.a(SavedFile.STATS).toFile(); File file = this.server.a(SavedFile.STATS).toFile();
File file1 = new File(file, uuid + ".json"); File file1 = new File(file, uuid + ".json");
- if (!file1.exists()) { - if (!file1.exists()) {
+ /*if (!file1.exists()) { // Yatopia dont check for old stats files with sync File IO + /*if (!file1.exists()) { // Yatopia - don't check for old stats files with sync file IO
File file2 = new File(file, displayName + ".json"); // CraftBukkit File file2 = new File(file, displayName + ".json"); // CraftBukkit
if (file2.exists() && file2.isFile()) { if (file2.exists() && file2.isFile()) {
file2.renameTo(file1); file2.renameTo(file1);
} }
- } - }
+ }*/ + }*/ // Yatopia
serverstatisticmanager = new ServerStatisticManager(this.server, file1); serverstatisticmanager = new ServerStatisticManager(this.server, file1);
// this.o.put(uuid, serverstatisticmanager); // CraftBukkit // this.o.put(uuid, serverstatisticmanager); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java
index 18725272f920eafb655de8b923a8a85dbdc704cf..a734cb47df9cffaee52a5c798bb3324212a004ba 100644 index 3c3b87e37cbf69c223da007e8b7eb646ec83691e..e2d12750bce9cb5ef087412b03809632a678bc04 100644
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java --- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java +++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
@@ -20,6 +20,7 @@ import java.util.Map; @@ -30,6 +30,7 @@ public class ServerStatisticManager extends StatisticManager {
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
+
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -30,6 +31,7 @@ public class ServerStatisticManager extends StatisticManager {
private final File d; private final File d;
private final Set<Statistic<?>> e = Sets.newHashSet(); private final Set<Statistic<?>> e = Sets.newHashSet();
private int f = -300; private int f = -300;
@ -145,7 +137,7 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..a734cb47df9cffaee52a5c798bb33242
public ServerStatisticManager(MinecraftServer minecraftserver, File file) { public ServerStatisticManager(MinecraftServer minecraftserver, File file) {
this.c = minecraftserver; this.c = minecraftserver;
@@ -41,6 +43,7 @@ public class ServerStatisticManager extends StatisticManager { @@ -41,6 +42,7 @@ public class ServerStatisticManager extends StatisticManager {
this.a.put( wrapper, entry.getValue().intValue() ); this.a.put( wrapper, entry.getValue().intValue() );
} }
// Spigot end // Spigot end
@ -153,7 +145,7 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..a734cb47df9cffaee52a5c798bb33242
if (file.isFile()) { if (file.isFile()) {
try { try {
this.a(minecraftserver.getDataFixer(), org.apache.commons.io.FileUtils.readFileToString(file)); this.a(minecraftserver.getDataFixer(), org.apache.commons.io.FileUtils.readFileToString(file));
@@ -50,17 +53,21 @@ public class ServerStatisticManager extends StatisticManager { @@ -50,17 +52,20 @@ public class ServerStatisticManager extends StatisticManager {
ServerStatisticManager.LOGGER.error("Couldn't parse statistics file {}", file, jsonparseexception); ServerStatisticManager.LOGGER.error("Couldn't parse statistics file {}", file, jsonparseexception);
} }
} }
@ -173,34 +165,24 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..a734cb47df9cffaee52a5c798bb33242
ServerStatisticManager.LOGGER.error("Couldn't save stats", ioexception); ServerStatisticManager.LOGGER.error("Couldn't save stats", ioexception);
} }
- -
+ }); + }); // Yatopia end
+ // Yatopia end
} }
@Override @Override
@@ -111,7 +118,7 @@ public class ServerStatisticManager extends StatisticManager { @@ -111,7 +116,7 @@ public class ServerStatisticManager extends StatisticManager {
if (nbttagcompound2.hasKeyOfType(s2, 99)) { if (nbttagcompound2.hasKeyOfType(s2, 99)) {
SystemUtils.a(this.a(statisticwrapper, s2), (statistic) -> { SystemUtils.a(this.a(statisticwrapper, s2), (statistic) -> {
- this.a.put(statistic, nbttagcompound2.getInt(s2)); - this.a.put(statistic, nbttagcompound2.getInt(s2));
+ this.a.put(statistic, nbttagcompound2.getInt(s2) + this.a.getOrDefault(statistic, 0)); // Yatopia fix async load + this.a.put(statistic, nbttagcompound2.getInt(s2) + this.a.getOrDefault(statistic, 0)); // Yatopia
}, () -> { }, () -> {
ServerStatisticManager.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.d, s2); ServerStatisticManager.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.d, s2);
}); });
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index be060f602f53344cf51c22eafacb4dc9219c8856..12ffee96cfbd135f107b1dff7a058177e2649964 100644 index a959672f5857b987001252c3fd7ace9e83e07c9b..bcae104ac104d6dcdf8653f291b24601247b5a55 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -9,8 +9,6 @@ import java.io.OutputStream; @@ -17,6 +17,7 @@ public class WorldNBTStorage {
import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-
-// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftPlayer;
// CraftBukkit end
@@ -19,6 +17,7 @@ public class WorldNBTStorage {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
private final File playerDir; private final File playerDir;
protected final DataFixer a; protected final DataFixer a;
@ -208,26 +190,21 @@ index be060f602f53344cf51c22eafacb4dc9219c8856..12ffee96cfbd135f107b1dff7a058177
public WorldNBTStorage(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer) { public WorldNBTStorage(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer) {
this.a = datafixer; this.a = datafixer;
@@ -28,11 +27,13 @@ public class WorldNBTStorage { @@ -26,6 +27,8 @@ public class WorldNBTStorage {
public void save(EntityHuman entityhuman) { public void save(EntityHuman entityhuman) {
if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable
+ entityhuman.takeInventorySnapshot(); // Yatopia + entityhuman.takeSnapshot(); // Yatopia
+ saveThread.submit(() -> { // Yatopia + saveThread.submit(() -> { // Yatopia
try { try {
NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound()); NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir); File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir);
@@ -38,7 +41,7 @@ public class WorldNBTStorage {
- NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file)));
+ NBTCompressedStreamTools.a(nbttagcompound, new FileOutputStream(file));
File file1 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
File file2 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat_old");
@@ -40,6 +41,7 @@ public class WorldNBTStorage {
} catch (Exception exception) { } catch (Exception exception) {
WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
} }
-
+ }); // Yatopia + }); // Yatopia
} }
@Nullable

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Modify default configs
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 29200d223cf7c5948ebd0907ef5a1d9ea8114c81..1febe2aff4eab2f15e9bc4b21e6d0c350f122c87 100644 index cac599c1e90b261b673acecad7517d91ccd0516a..f6b2d54ae47510714573f06b074bc2b799859b2f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -201,7 +201,7 @@ public class PaperConfig { @@ -201,7 +201,7 @@ public class PaperConfig {
@ -18,10 +18,10 @@ index 29200d223cf7c5948ebd0907ef5a1d9ea8114c81..1febe2aff4eab2f15e9bc4b21e6d0c35
TimingsManager.privacy = getBoolean("timings.server-name-privacy", false); TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses")); TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses"));
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 8cc8134f701d2517d134077b2fcd223106c09478..c2d5f7d22beb4c4829dfcb55fa842eaf727e906c 100644 index 9b96b1b326169e7963d828eb9d0612c3c8cb428a..dd9e0cfd92114c28eefd3ae77951376f93165a51 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -600,7 +600,7 @@ public class PaperWorldConfig { @@ -589,7 +589,7 @@ public class PaperWorldConfig {
} }
public boolean cooldownHopperWhenFull = true; public boolean cooldownHopperWhenFull = true;

View File

@ -7,7 +7,7 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java
index 5a04654657fa47cfce0709ee75c5ff0dbe07ec8c..1aa9d9fd074c186b209696ee46e0dda181372f4b 100644 index 36aafc3b71013bcec0f4d956761fc2710848b3fd..259af9622e91b784a0a5de254304a9eab9a09d15 100644
--- a/src/main/java/net/minecraft/server/EnumDirection.java --- a/src/main/java/net/minecraft/server/EnumDirection.java
+++ b/src/main/java/net/minecraft/server/EnumDirection.java +++ b/src/main/java/net/minecraft/server/EnumDirection.java
@@ -20,13 +20,13 @@ public enum EnumDirection implements INamable { @@ -20,13 +20,13 @@ public enum EnumDirection implements INamable {

View File

@ -7,64 +7,66 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 4f10ca5ada741b4f5ef941bb9d92a2fa6a7c44ff..3d6f8d948d293ca57bf158bcd1f58e289d937fb5 100644 index 5d3bb5f393a1e0e4a2e8b9a466530a91279697a9..7f084e7f11a829c10d113c7fb39eec0b8ad77080 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java --- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java +++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -127,9 +127,9 @@ public class BlockPiston extends BlockDirectional { @@ -127,9 +127,10 @@ public class BlockPiston extends BlockDirectional {
} }
} }
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia - don't recreate + private static final EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia
private boolean a(World world, BlockPosition blockposition, EnumDirection enumdirection) { private boolean a(World world, BlockPosition blockposition, EnumDirection enumdirection) {
- EnumDirection[] aenumdirection = EnumDirection.values(); - EnumDirection[] aenumdirection = EnumDirection.values();
+ //EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia
int i = aenumdirection.length; int i = aenumdirection.length;
int j; int j;
@@ -146,12 +146,11 @@ public class BlockPiston extends BlockDirectional { @@ -146,12 +147,12 @@ public class BlockPiston extends BlockDirectional {
return true; return true;
} else { } else {
BlockPosition blockposition1 = blockposition.up(); BlockPosition blockposition1 = blockposition.up();
- EnumDirection[] aenumdirection1 = EnumDirection.values(); - EnumDirection[] aenumdirection1 = EnumDirection.values();
+ //EnumDirection[] aenumdirection1 = EnumDirection.values(); // Yatopia
- j = aenumdirection1.length; - j = aenumdirection1.length;
+ j = aenumdirection.length; + j = aenumdirection.length; // Yatopia
for (int k = 0; k < j; ++k) { for (int k = 0; k < j; ++k) {
- EnumDirection enumdirection2 = aenumdirection1[k]; - EnumDirection enumdirection2 = aenumdirection1[k];
+ EnumDirection enumdirection2 = aenumdirection[k]; + EnumDirection enumdirection2 = aenumdirection[k]; // Yatopia
if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) { if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) {
return true; return true;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index a4123c2c7dc84803194459895f29d35643b71d04..173d04df808d9ed1fdd4767c25c2ebe130303d7f 100644 index ef9958e3922bc306e38c76eb67ddbd1f38f4c547..2fee8f65bdf782e150bc277108d72d93320e5ac2 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2566,11 +2566,14 @@ public abstract class EntityLiving extends Entity { @@ -2568,10 +2568,12 @@ public abstract class EntityLiving extends Entity {
}
} }
+ /**
+ * @reason Avoid cloning enum values
+ */
+ private final static EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
+ private static final EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); // Yatopia
+
@Nullable @Nullable
private Map<EnumItemSlot, ItemStack> r() { private Map<EnumItemSlot, ItemStack> q() {
Map<EnumItemSlot, ItemStack> map = null; Map<EnumItemSlot, ItemStack> map = null;
- EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); - EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
+ //EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); // Yatopia
int i = aenumitemslot.length; int i = aenumitemslot.length;
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/server/EnumAxisCycle.java b/src/main/java/net/minecraft/server/EnumAxisCycle.java diff --git a/src/main/java/net/minecraft/server/EnumAxisCycle.java b/src/main/java/net/minecraft/server/EnumAxisCycle.java
index a7c2543fdd4d5f6a04c45ec42472837ccaea9619..ccfa23af36f66618f4ef18b0d86c86a73de9ea9f 100644 index a7c2543fdd4d5f6a04c45ec42472837ccaea9619..92ab79532d29341e8840341ff5ee8f5203cb4aad 100644
--- a/src/main/java/net/minecraft/server/EnumAxisCycle.java --- a/src/main/java/net/minecraft/server/EnumAxisCycle.java
+++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java +++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java
@@ -26,12 +26,21 @@ public enum EnumAxisCycle { @@ -26,12 +26,24 @@ public enum EnumAxisCycle {
@Override @Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) { public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() + 1, 3)]; - return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() + 1, 3)];
+ // Yatopia start - replace logic
+ //return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() + 1, 3)];
+ switch (enumdirection_enumaxis) { + switch (enumdirection_enumaxis) {
+ case X: + case X:
+ return EnumDirection.EnumAxis.Y; + return EnumDirection.EnumAxis.Y;
@ -75,20 +77,23 @@ index a7c2543fdd4d5f6a04c45ec42472837ccaea9619..ccfa23af36f66618f4ef18b0d86c86a7
+ } + }
+ +
+ throw new IllegalArgumentException(); + throw new IllegalArgumentException();
+ // Yatopia end
} }
@Override @Override
public EnumAxisCycle a() { public EnumAxisCycle a() {
- return null.BACKWARD; - return null.BACKWARD;
+ return BACKWARD; + return BACKWARD; // Yatopia
} }
}, },
BACKWARD { BACKWARD {
@@ -42,12 +51,21 @@ public enum EnumAxisCycle { @@ -42,12 +54,24 @@ public enum EnumAxisCycle {
@Override @Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) { public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() - 1, 3)]; - return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() - 1, 3)];
+ // Yatopia start - replaced logic
+ //return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() - 1, 3)];
+ switch (enumdirection_enumaxis) { + switch (enumdirection_enumaxis) {
+ case X: + case X:
+ return EnumDirection.EnumAxis.Z; + return EnumDirection.EnumAxis.Z;
@ -99,28 +104,30 @@ index a7c2543fdd4d5f6a04c45ec42472837ccaea9619..ccfa23af36f66618f4ef18b0d86c86a7
+ } + }
+ +
+ throw new IllegalArgumentException(); + throw new IllegalArgumentException();
+ // Yatopia end
} }
@Override @Override
public EnumAxisCycle a() { public EnumAxisCycle a() {
- return null.FORWARD; - return null.FORWARD;
+ return FORWARD; + return FORWARD; // Yatopia
} }
}; };
diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
index 89385896af6f6088a9749a13ad5c1d0c581fa502..4fd1a98e8309bec2ef270ac70c4d79d143002b86 100644 index 89385896af6f6088a9749a13ad5c1d0c581fa502..0da231cb2d33608714c5f45f995a043a4293cafc 100644
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java --- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java +++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
@@ -166,10 +166,10 @@ public class PistonExtendsChecker { @@ -166,10 +166,11 @@ public class PistonExtendsChecker {
this.f.addAll(list1); this.f.addAll(list1);
this.f.addAll(list2); this.f.addAll(list2);
} }
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia - don't recreate + private static final EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia
private boolean a(BlockPosition blockposition) { private boolean a(BlockPosition blockposition) {
IBlockData iblockdata = this.a.getType(blockposition); IBlockData iblockdata = this.a.getType(blockposition);
- EnumDirection[] aenumdirection = EnumDirection.values(); - EnumDirection[] aenumdirection = EnumDirection.values();
+ //EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia
int i = aenumdirection.length; int i = aenumdirection.length;
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {

View File

@ -9,15 +9,23 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index b783028e5526df722d98e4760ffb214d5d2f83dd..0ad38a7b426b8b1e0ae8a98a2cb5b28878ae1249 100644 index b783028e5526df722d98e4760ffb214d5d2f83dd..9be854ebef1eb23ee4cc5d733e43dfca7d6439f7 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -27,7 +27,7 @@ public class PathfinderGoalSelector { @@ -11,6 +11,7 @@ import java.util.function.Supplier;
import java.util.stream.Stream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; // Yatopia
public class PathfinderGoalSelector {
@@ -27,7 +28,7 @@ public class PathfinderGoalSelector {
} }
}; };
private final Map<PathfinderGoal.Type, PathfinderGoalWrapped> c = new EnumMap(PathfinderGoal.Type.class); private final Map<PathfinderGoal.Type, PathfinderGoalWrapped> c = new EnumMap(PathfinderGoal.Type.class);
- private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet(); public final Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public - private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet(); public final Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public
+ private final Set<PathfinderGoalWrapped> d = new it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet<>();/* Yatopia better set */ public final Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public + private final Set<PathfinderGoalWrapped> d = new ObjectLinkedOpenHashSet<>();/* Yatopia better set */ public final Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public
private final Supplier<GameProfilerFiller> e; private final Supplier<GameProfilerFiller> e;
private final EnumSet<PathfinderGoal.Type> f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final EnumSet<PathfinderGoal.Type> f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be.
private final OptimizedSmallEnumSet<PathfinderGoal.Type> goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector private final OptimizedSmallEnumSet<PathfinderGoal.Type> goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector

View File

@ -7,80 +7,86 @@ Original code by JellySquid, licensed under GNU Lesser General Public License v3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings) you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
index ec55785af2b432b692d3a3bf4298ffb32489bf3b..4f59e4b31300009f5e7ef8767be6c89d7b449af0 100644 index 9caf6598f8a267ce057e863a32ee29fa5fdb0641..56da391b4d415630b881cccbaa50507eb2c23cc0 100644
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java --- a/src/main/java/net/minecraft/server/PathfinderNormal.java
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java +++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
@@ -10,6 +10,11 @@ import javax.annotation.Nullable; @@ -7,9 +7,15 @@ import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
import java.util.EnumSet;
import java.util.Iterator;
import javax.annotation.Nullable;
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; // Yatopia
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; // Yatopia
public class PathfinderNormal extends PathfinderAbstract { public class PathfinderNormal extends PathfinderAbstract {
+ // Yatopia start - this is not thread safe! + // Yatopia start - this is not thread safe!
+ private static final it.unimi.dsi.fastutil.objects.Reference2ReferenceMap<IBlockData, PathType> commonTypes = + private static final Reference2ReferenceMap<IBlockData, PathType> commonTypes = new Reference2ReferenceOpenHashMap<>();
+ new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(); + // Yatopia end
+ // Yatopia end
+ +
protected float j; protected float j;
private final Long2ObjectMap<PathType> k = new Long2ObjectOpenHashMap(); private final Long2ObjectMap<PathType> k = new Long2ObjectOpenHashMap();
private final Object2BooleanMap<AxisAlignedBB> l = new Object2BooleanOpenHashMap(); private final Object2BooleanMap<AxisAlignedBB> l = new Object2BooleanOpenHashMap();
@@ -508,13 +513,44 @@ public class PathfinderNormal extends PathfinderAbstract { @@ -490,9 +496,22 @@ public class PathfinderNormal extends PathfinderAbstract {
protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) { protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) {
IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
if (iblockdata == null) return PathType.BLOCKED; // Paper if (iblockdata == null) return PathType.BLOCKED; // Paper
- Block block = iblockdata.getBlock(); - Block block = iblockdata.getBlock();
- Material material = iblockdata.getMaterial(); - Material material = iblockdata.getMaterial();
+ // Check early if the block is air as it will always be open regardless of other conditions + // Yatopia start - replaced logic
+ if(iblockdata.isAir())return PathType.OPEN; + //Block block = iblockdata.getBlock();
+ + //Material material = iblockdata.getMaterial();
+ // Get the cached type for this block state + if (iblockdata.isAir()) return PathType.OPEN;
+ PathType type = commonTypes.get(iblockdata); + PathType type = commonTypes.get(iblockdata);
+
+ // No result has been cached for this block state yet, so calculate and cache it
+ if (type == null) { + if (type == null) {
+ commonTypes.put(iblockdata, type = getPathType(iblockaccess, blockposition, iblockdata)); + commonTypes.put(iblockdata, type = getPathType(iblockdata));
+ } + }
+ // If the node type is open, it means that we were unable to determine a more specific type, so we need
+ // to check the fallback path.
+ if (type == PathType.OPEN) { + if (type == PathType.OPEN) {
+ // This is only ever called in vanilla after all other possibilities are exhausted, but before fluid checks
+ // It should be safe to perform it last in actuality and take advantage of the cache for fluid types as well
+ // since fluids will always pass this check.
+ if (!iblockdata.a(iblockaccess, blockposition, PathMode.LAND)) { + if (!iblockdata.a(iblockaccess, blockposition, PathMode.LAND)) {
+ return PathType.BLOCKED; + return PathType.BLOCKED;
+ } + }
- if (iblockdata.isAir()) {
+ // All checks succeed, this path node really is open!
return PathType.OPEN;
- } else if (!iblockdata.a((Tag) TagsBlock.TRAPDOORS) && !iblockdata.a(Blocks.LILY_PAD)) {
- if (iblockdata.a(Blocks.CACTUS)) {
+ } + }
+ +
+ // Return the cached value since we found an obstacle earlier + /*
if (iblockdata.isAir()) {
return PathType.OPEN;
} else if (!iblockdata.a((Tag) TagsBlock.TRAPDOORS) && !iblockdata.a(Blocks.LILY_PAD)) {
@@ -512,7 +531,38 @@ public class PathfinderNormal extends PathfinderAbstract {
} else {
return PathType.TRAPDOOR;
}
+ */
+ return type; + return type;
+ + // Yatopia end
+ } + }
+ +
+ private static PathType getPathType(IBlockAccess iblockaccess, BlockPosition blockposition, + // Yatopia start
+ IBlockData iblockdata) { + private static PathType getPathType(IBlockData iblockdata) {
+ Block block = iblockdata.getBlock(); + Block block = iblockdata.getBlock();
+ Material material = iblockdata.getMaterial();
+
+ if (!block.a(TagsBlock.TRAPDOORS) && block != Blocks.LILY_PAD) { + if (!block.a(TagsBlock.TRAPDOORS) && block != Blocks.LILY_PAD) {
+ if (block == Blocks.FIRE) { + if (block == Blocks.FIRE) {
+ return PathType.DAMAGE_FIRE; + return PathType.DAMAGE_FIRE;
+ } else if (block == Blocks.CACTUS) { + } else if (block == Blocks.CACTUS) {
return PathType.DAMAGE_CACTUS; + return PathType.DAMAGE_CACTUS;
} else if (iblockdata.a(Blocks.SWEET_BERRY_BUSH)) { + } else if (iblockdata.a(Blocks.SWEET_BERRY_BUSH)) {
return PathType.DAMAGE_OTHER; + return PathType.DAMAGE_OTHER;
@@ -540,7 +576,10 @@ public class PathfinderNormal extends PathfinderAbstract { + } else if (iblockdata.a(Blocks.HONEY_BLOCK)) {
} else { + return PathType.STICKY_HONEY;
Fluid fluid = iblockdata.getFluid(); // Tuinity - remove another getType call + } else if (iblockdata.a(Blocks.COCOA)) {
+ return PathType.COCOA;
- return fluid.a((Tag) TagsFluid.WATER) ? PathType.WATER : (fluid.a((Tag) TagsFluid.LAVA) ? PathType.LAVA : PathType.OPEN); + } else {
+ if(fluid.a(TagsFluid.WATER))return PathType.WATER; + Fluid fluid = iblockdata.getFluid(); // Tuinity - remove another get type call
+ if(fluid.a(TagsFluid.LAVA))return PathType.LAVA;
+ +
+ return PathType.OPEN; + if (fluid.a(TagsFluid.WATER)) return PathType.WATER;
} + if (fluid.a(TagsFluid.LAVA)) return PathType.LAVA;
} else { +
return PathType.FENCE; + return PathType.OPEN;
+ }
+ } else {
+ return PathType.TRAPDOOR;
+ }
}
+ // Yatopia end
private static boolean a(IBlockData iblockdata) {
return iblockdata.a((Tag) TagsBlock.FIRE) || iblockdata.a(Blocks.LAVA) || iblockdata.a(Blocks.MAGMA_BLOCK) || BlockCampfire.g(iblockdata);

View File

@ -8,7 +8,7 @@ you can find the original code on https://github.com/jellysquid3/lithium-fabric/
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..3079549f466a350223c3ee11466432bf3dc4c5b6 index 0000000000000000000000000000000000000000..15cc7232e4edf6803e4b831ff094a748f95e1f9a
--- /dev/null --- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java +++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
@@ -0,0 +1,171 @@ @@ -0,0 +1,171 @@
@ -183,17 +183,16 @@ index 0000000000000000000000000000000000000000..3079549f466a350223c3ee11466432bf
+ return new HashedList<>(list, new HashSet<>(list)); // Yatopia - use hashset + return new HashedList<>(list, new HashSet<>(list)); // Yatopia - use hashset
+ } + }
+} +}
\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java index a18ca3f0001a771f21012bd39711f581efb2fef0..0f88b7b38b6191c3adbebdee82427275640c4197 100644
index b2b654218382cc2cf1649067cd140b539235e3d2..f7f082c80442cd352e14daa4b199b2f3ad75c22f 100644 --- a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java
--- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java @@ -113,7 +113,7 @@ public class BiomeSettingsMobs {
@@ -139,7 +139,7 @@ public class BiomeBase { private final Map<EnumCreatureType, List<BiomeSettingsMobs.c>> a = (Map) Stream.of(EnumCreatureType.values()).collect(Maps.toImmutableEnumMap((enumcreaturetype) -> {
for (j = 0; j < i; ++j) { return enumcreaturetype;
EnumCreatureType enumcreaturetype = aenumcreaturetype[j]; }, (enumcreaturetype) -> {
- return new MobList(); // Use MobList instead of ArrayList
- this.v.put(enumcreaturetype, new MobList()); // Paper + return me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(new MobList()); // Use MobList instead of ArrayList // Yatopia - hashedlist
+ this.v.put(enumcreaturetype, me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(new MobList())); // Paper // Yatopia - lithium change }));
} // Paper end
private final Map<EntityTypes<?>, BiomeSettingsMobs.b> b = Maps.newLinkedHashMap();
} else {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Item stuck sleep config
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index 57820ad632a253c93436a77c5811c1bc44e3f06a..c7ef8b2cd84d66b955bdbabdecfc18c1d4cc4444 100644 index c0965eb0b6ef615ab89ffc5942d6a4e92a0d4a67..fb7551f79f3e2e7e834359ef701ff7e568882a7f 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -211,4 +211,9 @@ public class YatopiaConfig { @@ -219,4 +219,9 @@ public class YatopiaConfig {
private static void pistonPushLimit() { private static void pistonPushLimit() {
pistonPushLimit = getInt("settings.pistonPushLimit", 12); pistonPushLimit = getInt("settings.pistonPushLimit", 12);
} }
@ -18,17 +18,16 @@ index 57820ad632a253c93436a77c5811c1bc44e3f06a..c7ef8b2cd84d66b955bdbabdecfc18c1
+ itemStuckSleepTicks = getInt("settings.itemStuckSleepTicks", 1); + itemStuckSleepTicks = getInt("settings.itemStuckSleepTicks", 1);
+ } + }
} }
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index ca9c12151b193c05e42bbb99733f6e3ed2bae221..6869b688810cc72da01f164db1f0853d59752597 100644 index 732f09319a309b92d74e6536e29d30be917be455..4ba28ab7f96dd83edc552a9c81d79b3c0061dc2c 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java --- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -81,7 +81,7 @@ public class EntityItem extends Entity { @@ -82,7 +82,7 @@ public class EntityItem extends Entity {
if (this.world.isClientSide) { if (this.world.isClientSide) {
this.noclip = false; this.noclip = false;
- } else { - } else {
+ } else if(!this.onGround || this.noclip || this.ticksLived % dev.tr7zw.yatopia.YatopiaConfig.itemStuckSleepTicks == 0) { // Yatopia + } else if (!this.onGround || this.noclip || this.ticksLived % dev.tr7zw.yatopia.YatopiaConfig.itemStuckSleepTicks == 0) { // Yatopia
this.noclip = !this.world.getCubes(this); this.noclip = !this.world.getCubes(this);
if (this.noclip) { if (this.noclip) {
this.k(this.locX(), (this.getBoundingBox().minY + this.getBoundingBox().maxY) / 2.0D, this.locZ()); this.l(this.locX(), (this.getBoundingBox().minY + this.getBoundingBox().maxY) / 2.0D, this.locZ());

View File

@ -5,64 +5,55 @@ Subject: [PATCH] Option for simpler Villagers
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index c7ef8b2cd84d66b955bdbabdecfc18c1d4cc4444..d8e3bbb2ffbf20a111af3fd7a019daf1d5a7dead 100644 index fb7551f79f3e2e7e834359ef701ff7e568882a7f..0566088538c2b99ff74a408b67a9edee4751f904 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -216,4 +216,13 @@ public class YatopiaConfig { @@ -224,4 +224,11 @@ public class YatopiaConfig {
private static void itemStuckSleepTicks() { private static void itemStuckSleepTicks() {
itemStuckSleepTicks = getInt("settings.itemStuckSleepTicks", 1); itemStuckSleepTicks = getInt("settings.itemStuckSleepTicks", 1);
} }
+ public static boolean simplerVillagerBehavior = false;
+ private static void simplerVillagerBehavior() {
+ simplerVillagerBehavior = getBoolean("settings.villager.simplerVillagerBehavior", false);
+ }
+ +
+ public static boolean simplerVillagerBehavior = false;
+ public static boolean villagersHideAtNight = false; + public static boolean villagersHideAtNight = false;
+ private static void villagersHideAtNight() { + private static void villagerSettings() {
+ simplerVillagerBehavior = getBoolean("settings.villager.simplerVillagerBehavior", false);
+ villagersHideAtNight = getBoolean("settings.villager.villagersHideAtNight", false); + villagersHideAtNight = getBoolean("settings.villager.villagersHideAtNight", false);
+ } + }
} }
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index d906c5e530c2e7f779df079223aee619a73b5d51..1ecb19c1c81456148af4a9edd59059356c3c0b94 100644 index 1b2e395cc141bf700e1f7c24fe8ee7dc68b25513..416d421c3ff49125cd540a6e360523775f034689 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java --- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -7,6 +7,8 @@ import com.mojang.datafixers.util.Pair; @@ -27,6 +27,7 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent;
import com.mojang.serialization.DataResult;
import com.mojang.serialization.Dynamic;
import com.mojang.serialization.DynamicOps;
+
+import dev.tr7zw.yatopia.YatopiaConfig;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import java.util.*;
@@ -27,6 +29,7 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent;
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder { public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
+ private boolean simplerVillagerBehavior = dev.tr7zw.yatopia.YatopiaConfig.simplerVillagerBehavior; // Yatopia - get this during villager creation so a reloaded config doesn't get them into an invalid state + private boolean simplerVillagerBehavior = dev.tr7zw.yatopia.YatopiaConfig.simplerVillagerBehavior; // Yatopia - so we don't make them bork upon reload
private static final DataWatcherObject<VillagerData> by = DataWatcher.a(EntityVillager.class, DataWatcherRegistry.q); private static final DataWatcherObject<VillagerData> br = DataWatcher.a(EntityVillager.class, DataWatcherRegistry.q);
public static final Map<Item, Integer> bw = ImmutableMap.of(Items.BREAD, 4, Items.POTATO, 1, Items.CARROT, 1, Items.BEETROOT, 1); public static final Map<Item, Integer> bp = ImmutableMap.of(Items.BREAD, 4, Items.POTATO, 1, Items.CARROT, 1, Items.BEETROOT, 1);
private static final Set<Item> bz = ImmutableSet.of(Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, new Item[]{Items.BEETROOT_SEEDS}); private static final Set<Item> bs = ImmutableSet.of(Items.BREAD, Items.POTATO, Items.CARROT, Items.WHEAT, Items.WHEAT_SEEDS, Items.BEETROOT, new Item[]{Items.BEETROOT_SEEDS});
@@ -63,12 +66,49 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -64,12 +65,52 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
public EntityVillager(EntityTypes<? extends EntityVillager> entitytypes, World world, VillagerType villagertype) {
super(entitytypes, world); super(entitytypes, world);
this.bF = new Reputation(); this.by = new Reputation();
+ if (!simplerVillagerBehavior) {
((Navigation) this.getNavigation()).a(true); ((Navigation) this.getNavigation()).a(true);
+ if (!simplerVillagerBehavior) { // Yatopia
this.getNavigation().d(true); this.getNavigation().d(true);
+ } else { this.setCanPickupLoot(true);
+ } else { // Yatopia start
+ initPathfinder(); + initPathfinder();
+ } + }
this.setCanPickupLoot(true); + // Yatopia end
this.setVillagerData(this.getVillagerData().withType(villagertype).withProfession(VillagerProfession.NONE)); this.setVillagerData(this.getVillagerData().withType(villagertype).withProfession(VillagerProfession.NONE));
this.brainTickOffset = getRandom().nextInt(100); // Purpur this.brainTickOffset = getRandom().nextInt(100); // Purpur
} }
+ //Yatopia start
+ + // Yatopia start
+ @Override + @Override
+ protected void initPathfinder() { + protected void initPathfinder() {
+ if (!simplerVillagerBehavior) return; + if (!simplerVillagerBehavior) {
+ // safety
+ return;
+ }
+ this.goalSelector.a(0, new PathfinderGoalFloat(this)); + this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ if(dev.tr7zw.yatopia.YatopiaConfig.villagersHideAtNight) { + if(dev.tr7zw.yatopia.YatopiaConfig.villagersHideAtNight) {
+ this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, PotionUtil.a(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEffects.ENTITY_WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> { + this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, PotionUtil.a(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEffects.ENTITY_WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> {
@ -90,19 +81,19 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..1ecb19c1c81456148af4a9edd5905935
+ this.goalSelector.a(9, new PathfinderGoalInteract(this, EntityHuman.class, 3.0F, 1.0F)); + this.goalSelector.a(9, new PathfinderGoalInteract(this, EntityHuman.class, 3.0F, 1.0F));
+ this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F)); + this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
+ } + }
+ //Yatopia end +
@Override @Override
public BehaviorController<EntityVillager> getBehaviorController() { public BehaviorController<EntityVillager> getBehaviorController() {
@@ -82,6 +122,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation return (BehaviorController<EntityVillager>) super.getBehaviorController(); // CraftBukkit - decompile error
@@ -82,6 +123,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@Override @Override
protected BehaviorController<?> a(Dynamic<?> dynamic) { protected BehaviorController<?> a(Dynamic<?> dynamic) {
+ if(simplerVillagerBehavior)return super.a(dynamic); //Yatopia Don't use behaviorcontroller for simple Villagers + if (simplerVillagerBehavior) return super.a(dynamic); // Yatopia
BehaviorController<EntityVillager> behaviorcontroller = this.cJ().a(dynamic); BehaviorController<EntityVillager> behaviorcontroller = this.cJ().a(dynamic);
this.a(behaviorcontroller); this.a(behaviorcontroller);
@@ -159,15 +200,47 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -159,6 +201,27 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
super.inactiveTick(); super.inactiveTick();
} }
// Spigot End // Spigot End
@ -130,57 +121,49 @@ index d906c5e530c2e7f779df079223aee619a73b5d51..1ecb19c1c81456148af4a9edd5905935
@Override @Override
protected void mobTick() { mobTick(false); } protected void mobTick() { mobTick(false); }
protected void mobTick(boolean inactive) { @@ -168,6 +231,13 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
boolean tick = (world.getTime() + brainTickOffset) % world.purpurConfig.villagerBrainTicks == 0;
if (world.getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick)
// Purpur end
+ // Yatopia start + // Yatopia start
+ if (simplerVillagerBehavior && this.getVillagerData().getProfession() == VillagerProfession.NONE) { + if (simplerVillagerBehavior && this.getVillagerData().getProfession() == VillagerProfession.NONE) {
+ this.setVillagerData(this.getVillagerData().withProfession(getRandomProfession())); + this.setVillagerData(this.getVillagerData().withProfession(getRandomProfession()));
+ } + }
+ if (simplerVillagerBehavior) { + if (simplerVillagerBehavior && canRefresh()) restUses();
+ if (canRefresh()) { + if (simplerVillagerBehavior) return;
+ restUses();
+ }
+ }
+ // Yatopia end + // Yatopia end
//this.world.getMethodProfiler().enter("villagerBrain"); // Akarin - remove caller
// Purpur start
boolean tick = (world.getTime() + brainTickOffset) % world.purpurConfig.villagerBrainTicks == 0;
if (((WorldServer) world).getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick)
// Purpur end
+ if(!simplerVillagerBehavior) // Yatopia
if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper
if (this.bM) { //this.world.getMethodProfiler().exit(); // Akarin - remove caller
this.bM = false; if (this.bF) {
@@ -298,6 +371,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -333,6 +403,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
return true; return this.bD == 0 || this.bD < 2 && this.world.getTime() > this.bC + 2400L;
} }
+ public void restUses() {fb();} // Yatopia obf helper + public final boolean canRefresh() { return fc(); } // Yatopia - OBFHELPER
+
public void fb() {
this.fp();
Iterator iterator = this.getOffers().iterator();
@@ -332,6 +407,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
return this.bK == 0 || this.bK < 2 && this.world.getTime() > this.bJ + 2400L;
}
+ public boolean canRefresh() {return fc();} // Yatopia obf helper
+
public boolean fc() { public boolean fc() {
long i = this.bJ + 12000L; long i = this.bC + 12000L;
long j = this.world.getTime(); long j = this.world.getTime();
@@ -579,6 +656,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -355,6 +426,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
return this.fn() && this.fm();
}
+ public final void restUses() { fo(); } // Yatopia - OBFHELPER
private void fo() {
int i = 2 - this.bD;
@@ -585,6 +657,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
} }
private void a(Entity entity) { private void a(Entity entity) {
+ if (simplerVillagerBehavior)return; // Yatopia + if (simplerVillagerBehavior) return; // Yatopia
if (this.world instanceof WorldServer) { if (this.world instanceof WorldServer) {
Optional<List<EntityLiving>> optional = this.bn.getMemory(MemoryModuleType.VISIBLE_MOBS); Optional<List<EntityLiving>> optional = this.bg.getMemory(MemoryModuleType.VISIBLE_MOBS);
@@ -604,6 +682,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -610,6 +683,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
} }
public void a(MemoryModuleType<GlobalPos> memorymoduletype) { public void a(MemoryModuleType<GlobalPos> memorymoduletype) {
+ if (simplerVillagerBehavior)return; // Yatopia + if (simplerVillagerBehavior) return; // Yatopia
if (this.world instanceof WorldServer) { if (this.world instanceof WorldServer) {
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer(); MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Heavily optimize furnance fuel and recipe lookups
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index c2af174e639396ac70eb7b520fdd641b1d2c67e6..da718601eb77330ff3e5eb25924d2820e3f8acaa 100644 index 66586a0799d669ed860880862173c6ebd0fa76ef..018f926b71b65dc0bbe56070ba2d83af48e40383 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java --- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java +++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -83,7 +83,22 @@ public class CraftingManager extends ResourceDataJson { @@ -83,7 +83,22 @@ public class CraftingManager extends ResourceDataJson {
@ -33,10 +33,10 @@ index c2af174e639396ac70eb7b520fdd641b1d2c67e6..da718601eb77330ff3e5eb25924d2820
public <C extends IInventory, T extends IRecipe<C>> List<T> a(Recipes<T> recipes) { public <C extends IInventory, T extends IRecipe<C>> List<T> a(Recipes<T> recipes) {
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index acc533ca8ad612cc439208f4adf6e3d3289c92c7..7637d86ccafbf323f4edaab758fa9fc3cf657841 100644 index 99bd8626b28a837f0da2268d89fddb6d28b2a944..cee623e5711565703fb16e7ad057e3950fb49e79 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -99,7 +99,14 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I @@ -83,7 +83,14 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
this.c = recipes; this.c = recipes;
} }
@ -51,7 +51,7 @@ index acc533ca8ad612cc439208f4adf6e3d3289c92c7..7637d86ccafbf323f4edaab758fa9fc3
Map<Item, Integer> map = Maps.newLinkedHashMap(); Map<Item, Integer> map = Maps.newLinkedHashMap();
a(map, (IMaterial) Items.LAVA_BUCKET, 20000); a(map, (IMaterial) Items.LAVA_BUCKET, 20000);
@@ -162,6 +169,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I @@ -146,6 +153,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
a(map, (IMaterial) Blocks.FLETCHING_TABLE, 300); a(map, (IMaterial) Blocks.FLETCHING_TABLE, 300);
a(map, (IMaterial) Blocks.SMITHING_TABLE, 300); a(map, (IMaterial) Blocks.SMITHING_TABLE, 300);
a(map, (IMaterial) Blocks.COMPOSTER, 300); a(map, (IMaterial) Blocks.COMPOSTER, 300);
@ -59,7 +59,7 @@ index acc533ca8ad612cc439208f4adf6e3d3289c92c7..7637d86ccafbf323f4edaab758fa9fc3
return map; return map;
} }
@@ -615,4 +623,17 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I @@ -599,4 +607,17 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
} }
} }

View File

@ -5,131 +5,121 @@ Subject: [PATCH] Optimize Hopper logic
diff --git a/src/main/java/net/minecraft/server/BlockDropper.java b/src/main/java/net/minecraft/server/BlockDropper.java diff --git a/src/main/java/net/minecraft/server/BlockDropper.java b/src/main/java/net/minecraft/server/BlockDropper.java
index 1ce89c28c2b54278dc8f1c17f2d0ccb743a27b34..9c0817d03f88af4c267cd91cd750e861febac4b9 100644 index 65c212690d8ba7c8ea55d4d3b6af1ba3d9f4a7f6..da8c0ee5184a234f485c2f05e2c6edd965576cbe 100644
--- a/src/main/java/net/minecraft/server/BlockDropper.java --- a/src/main/java/net/minecraft/server/BlockDropper.java
+++ b/src/main/java/net/minecraft/server/BlockDropper.java +++ b/src/main/java/net/minecraft/server/BlockDropper.java
@@ -36,7 +36,7 @@ public class BlockDropper extends BlockDispenser { @@ -36,7 +36,7 @@ public class BlockDropper extends BlockDispenser {
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
EnumDirection enumdirection = (EnumDirection) world.getType(blockposition).get(BlockDropper.FACING); EnumDirection enumdirection = (EnumDirection) worldserver.getType(blockposition).get(BlockDropper.FACING);
- IInventory iinventory = TileEntityHopper.b(world, blockposition.shift(enumdirection)); - IInventory iinventory = TileEntityHopper.b((World) worldserver, blockposition.shift(enumdirection));
+ IInventory iinventory = TileEntityHopper.b(world, blockposition.shift(enumdirection), false); // Yatopia + IInventory iinventory = TileEntityHopper.b((World) worldserver, blockposition.shift(enumdirection), false); // Yatopia
ItemStack itemstack1; ItemStack itemstack1;
if (iinventory == null) { if (iinventory == null) {
diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java
index a29294fbc7cd6fcfff0df9eadd11de3bd7f1405e..77f279fc29955ba6d78271f71df2ac12b7186d60 100644 index a29294fbc7cd6fcfff0df9eadd11de3bd7f1405e..2f66740de68667e5c0054a0bc7990256163087cd 100644
--- a/src/main/java/net/minecraft/server/BlockHopper.java --- a/src/main/java/net/minecraft/server/BlockHopper.java
+++ b/src/main/java/net/minecraft/server/BlockHopper.java +++ b/src/main/java/net/minecraft/server/BlockHopper.java
@@ -110,6 +110,12 @@ public class BlockHopper extends BlockTileEntity { @@ -110,6 +110,12 @@ public class BlockHopper extends BlockTileEntity {
@Override @Override
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) { public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
this.a(world, blockposition, iblockdata); this.a(world, blockposition, iblockdata);
+ // Yatopia start + // Yatopia start
+ TileEntity tileEntity = world.getTileEntity(blockposition); + TileEntity tileEntity = world.getTileEntity(blockposition);
+ if (tileEntity instanceof TileEntityHopper) { + if (tileEntity instanceof TileEntityHopper) {
+ ((TileEntityHopper)tileEntity).flushCaches(); + ((TileEntityHopper) tileEntity).flushCaches();
+ } + }
+ // Yatopia end + // Yatopia end
} }
private void a(World world, BlockPosition blockposition, IBlockData iblockdata) { private void a(World world, BlockPosition blockposition, IBlockData iblockdata) {
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index 3ff61141aede4b5a09bf83153222de0d14db5ad0..e386ffda975b8a0adc218fd47a02e5b38d12e79d 100644 index 95bede605c6401af10f18b641cd12c9d8ec2f207..b4ec6fb407f86bd03d003d9b555df0c58cd6ced5 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java --- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -2,6 +2,7 @@ package net.minecraft.server; @@ -661,14 +661,47 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
import java.util.Iterator;
import java.util.List;
+import java.util.Optional;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@@ -661,14 +662,48 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
@Nullable @Nullable
private IInventory l() { private IInventory l() {
+ // Yatopia start + // Yatopia start
+ if(this.cachedPush != null) { + if (cachedPush != null) {
+ return this.cachedPush; + return cachedPush;
+ } + }
+ // Yatopia end + // Yatopia end
EnumDirection enumdirection = (EnumDirection) this.getBlock().get(BlockHopper.FACING); EnumDirection enumdirection = (EnumDirection) this.getBlock().get(BlockHopper.FACING);
- return b(this.getWorld(), this.position.shift(enumdirection)); - return b(this.getWorld(), this.position.shift(enumdirection));
+ IInventory tmp = b(this.getWorld(), this.position.shift(enumdirection), this.cachedPushAir); + // Yatopia start - replace logic
+ // Yatopia start + //return b(this.getWorld(), this.position.shift(enumdirection));
+ IInventory tmp = b(this.getWorld(), this.position.shift(enumdirection), cachedPushAir);
+ if (tmp != null && !(tmp instanceof IWorldInventory) && !(tmp instanceof Entity)) { + if (tmp != null && !(tmp instanceof IWorldInventory) && !(tmp instanceof Entity)) {
+ this.cachedPush = tmp; + this.cachedPush = tmp;
+ } else { + } else {
+ if(tmp == null) { + cachedPushAir = true;
+ this.cachedPushAir = true; + return tmp;
+ }
+ return tmp;
+ } + }
+ if (this.cachedPush == null) { + if (this.cachedPush == null) {
+ this.cachedPushAir = true; + this.cachedPushAir = true;
+ } + }
+ // Yatopia end
+ return this.cachedPush; + return this.cachedPush;
+ // Yatopia end
} }
@Nullable @Nullable
public static IInventory b(IHopper ihopper) { public static IInventory b(IHopper ihopper) {
- return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A()); + // Yatopia start - replaced logic
+ // Yatopia start + if (ihopper instanceof TileEntityHopper) {
+ if (ihopper instanceof TileEntityHopper) { + TileEntityHopper hopper = (TileEntityHopper) ihopper;
+ TileEntityHopper hopper = (TileEntityHopper) ihopper; + if (hopper.cachedAbove != null) {
+ if (hopper.cachedAbove != null) { + return hopper.cachedAbove;
+ return hopper.cachedAbove; + }
+ } + IInventory inv = a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), hopper.cachedPullAir);
+ IInventory inv = a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), hopper.cachedPullAir); + hopper.cachedAbove = inv;
+ hopper.cachedAbove = inv; + if (hopper.cachedAbove == null) {
+ if (hopper.cachedAbove == null) { + hopper.cachedPullAir = true;
+ hopper.cachedPullAir = true; + }
+ }
+ return inv; + return inv;
+ } else { + } else {
+ return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), false); return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A());
+ } + }
+ // Yatopia end + // Yatopia end
} }
public static List<EntityItem> c(IHopper ihopper) { public static List<EntityItem> c(IHopper ihopper) {
@@ -683,14 +718,15 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi @@ -683,14 +716,16 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
} }
@Nullable @Nullable
- public static IInventory b(World world, BlockPosition blockposition) { - public static IInventory b(World world, BlockPosition blockposition) {
- return a(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, true); // Paper - return a(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, true); // Paper
+ public static IInventory b(World world, BlockPosition blockposition, boolean skipBlockCheck) { + public static IInventory b(World world, BlockPosition blockposition, boolean skipBlockCheck) { // Yatopia
+ return a(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, true, skipBlockCheck); // Yatopia // Paper + return a(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, true, skipBlockCheck); // Paper // Yatopia
} }
@Nullable @Nullable
- public static IInventory a(World world, double d0, double d1, double d2) { return a(world, d0, d1, d2, false); } // Paper - overload to default false - public static IInventory a(World world, double d0, double d1, double d2) { return a(world, d0, d1, d2, false); } // Paper - overload to default false
- public static IInventory a(World world, double d0, double d1, double d2, boolean optimizeEntities) { // Paper - public static IInventory a(World world, double d0, double d1, double d2, boolean optimizeEntities) { // Paper
- Object object = null; + public static IInventory a(World world, double d0, double d1, double d2) { return a(world, d0, d1, d2, false); } // Yatopia
+ public static IInventory a(World world, double d0, double d1, double d2, boolean skipBlockCheck) { return a(world, d0, d1, d2, false, skipBlockCheck); } // Yatopia // Paper - overload to default false + public static IInventory a(World world, double d0, double d1, double d2, boolean skipBlockCheck) { return a(world, d0, d1, d2, false, skipBlockCheck); } // Paper - overload to default false // Yatopia
+ public static IInventory a(World world, double d0, double d1, double d2, boolean optimizeEntities, boolean skipBlockCheck) { // Yatopia // Paper + public static IInventory a(World world, double d0, double d1, double d2, boolean optimizeEntities, boolean skipBlockCheck) { // Paper // Yatopia
+ Object object = null; // Yatopia Object object = null;
+ if(!skipBlockCheck) { // Yatopia + if (!skipBlockCheck) { // Yatopia
BlockPosition blockposition = new BlockPosition(d0, d1, d2); BlockPosition blockposition = new BlockPosition(d0, d1, d2);
if ( !world.isLoaded( blockposition ) ) return null; // Spigot if ( !world.isLoaded( blockposition ) ) return null; // Spigot
IBlockData iblockdata = world.getType(blockposition); IBlockData iblockdata = world.getType(blockposition);
@@ -708,8 +744,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi @@ -708,8 +743,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
} }
} }
} }
+ } // Yatopia + } // Yatopia
- if (object == null && (!optimizeEntities || !org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding())) { // Paper - if (object == null && (!optimizeEntities || !org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding())) { // Paper
+ if (object == null && (!optimizeEntities || true/*!org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding()*/)) { // Yatopia // Paper + if (object == null && !optimizeEntities) { // Paper // Yatopia
List<Entity> list = world.getEntities((Entity) null, new AxisAlignedBB(d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D), IEntitySelector.d); List<Entity> list = world.getEntities((Entity) null, new AxisAlignedBB(d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D), IEntitySelector.d);
if (!list.isEmpty()) { if (!list.isEmpty()) {
@@ -779,4 +816,19 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi @@ -779,4 +815,16 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
protected Container createContainer(int i, PlayerInventory playerinventory) { protected Container createContainer(int i, PlayerInventory playerinventory) {
return new ContainerHopper(i, playerinventory, this); return new ContainerHopper(i, playerinventory, this);
} }
@ -139,13 +129,10 @@ index 3ff61141aede4b5a09bf83153222de0d14db5ad0..e386ffda975b8a0adc218fd47a02e5b3
+ private IInventory cachedPush = null; + private IInventory cachedPush = null;
+ private boolean cachedPushAir = false; + private boolean cachedPushAir = false;
+ private boolean cachedPullAir = false; + private boolean cachedPullAir = false;
+
+ public void flushCaches() { + public void flushCaches() {
+ cachedAbove = null; + cachedAbove = null;
+ cachedPush = null; + cachedPush = null;
+ cachedPushAir = false; + cachedPushAir = false;
+ cachedPullAir = false; + cachedPullAir = false;
+ } + }
+ // Yatopia end
+
} }

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Optimize TileEntity loading
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 29ffa302fa5b3d7d0ece23e2e0eda79d46747c3b..8beda792cc67e5c789574076f5a06214614a6031 100644 index 5c67881cb9258b839e713b8bb0b4b380691d3fdd..ccad720e3c11d85c10822cbca1b1eeb6cb71df9a 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -43,8 +43,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -43,8 +43,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public static final ResourceKey<World> THE_END = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_end")); public static final ResourceKey<World> THE_END = ResourceKey.a(IRegistry.L, new MinecraftKey("the_end"));
private static final EnumDirection[] a = EnumDirection.values(); private static final EnumDirection[] a = EnumDirection.values();
//public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
- public final List<TileEntity> tileEntityListTick = Lists.newArrayList(); - public final List<TileEntity> tileEntityListTick = Lists.newArrayList();

View File

@ -46,7 +46,7 @@ index 22d920686418e86aec8be37f125123682af023a3..081a5344b86e300ae7aa722b9b0ca84c
private void set(String path, Object val) { private void set(String path, Object val) {
diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java
index a89209347418b3006745c50043d0abdf2b91babc..e0bd3efb0a856774600b8b5487ec7e2b5b81f41d 100644 index 3d71ee447b0d45c50ed6f2f17ad5184d28d3bc08..965cc06a826c7d827e6b9a9e586738bfddc974d8 100644
--- a/src/main/java/de/minebench/origami/OrigamiConfig.java --- a/src/main/java/de/minebench/origami/OrigamiConfig.java
+++ b/src/main/java/de/minebench/origami/OrigamiConfig.java +++ b/src/main/java/de/minebench/origami/OrigamiConfig.java
@@ -20,6 +20,8 @@ public final class OrigamiConfig { @@ -20,6 +20,8 @@ public final class OrigamiConfig {
@ -80,7 +80,7 @@ index a89209347418b3006745c50043d0abdf2b91babc..e0bd3efb0a856774600b8b5487ec7e2b
for (final Method method : clazz.getDeclaredMethods()) { for (final Method method : clazz.getDeclaredMethods()) {
if (method.getReturnType() != void.class || method.getParameterCount() != 0 || if (method.getReturnType() != void.class || method.getParameterCount() != 0 ||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index c3becefce8143f34ed2b1093dd22227b7309629c..b045cfc0e8ade9632cfde5cffe8fe93b5ee08b27 100644 index cb4a89940cf02de5c3eefc5c746397a931c96b7a..7e053bc9bbd8abc1a6c060c1b4166ff27c7043d2 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java --- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -189,6 +189,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @@ -189,6 +189,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@ -93,10 +93,10 @@ index c3becefce8143f34ed2b1093dd22227b7309629c..b045cfc0e8ade9632cfde5cffe8fe93b
this.setPVP(dedicatedserverproperties.pvp); this.setPVP(dedicatedserverproperties.pvp);
this.setAllowFlight(dedicatedserverproperties.allowFlight); this.setAllowFlight(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 60b4c2337e6fdeddfb785e90fa501149af45756c..f27214eba0aedfceb770a39e444c46f9df19dcf6 100644 index 2ba0d89ae1b5d52eec3bd91328088ea2c7249d07..5c2dec887a41351b1d3288c391dfa899cc7e2a03 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -319,7 +319,7 @@ public class Main { @@ -311,7 +311,7 @@ public class Main {
} }
// Paper end // Paper end
System.setProperty( "library.jansi.version", "Paper" ); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows System.setProperty( "library.jansi.version", "Paper" ); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows

View File

@ -10,19 +10,20 @@ Co-authored-by: tr7zw <tr7zw@live.de>
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java b/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java b/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..167498cfab7aed0deb32232082ae06a123b7a039 index 0000000000000000000000000000000000000000..e6cd19e75a88f4dbf38d3cc63883068d95aa67d4
--- /dev/null --- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java +++ b/src/main/java/me/jellysquid/mods/lithium/common/world/noise/SimplexNoiseCache.java
@@ -0,0 +1,133 @@ @@ -0,0 +1,135 @@
+package me.jellysquid.mods.lithium.common.world.noise; +package me.jellysquid.mods.lithium.common.world.noise;
+ +
+import java.util.Arrays;
+
+import it.unimi.dsi.fastutil.HashCommon; +import it.unimi.dsi.fastutil.HashCommon;
+
+import net.minecraft.server.ChunkCoordIntPair; +import net.minecraft.server.ChunkCoordIntPair;
+import net.minecraft.server.MathHelper; +import net.minecraft.server.MathHelper;
+import net.minecraft.server.NoiseGenerator3Handler; +import net.minecraft.server.NoiseGenerator3Handler;
+ +
+import java.util.Arrays;
+
+/** +/**
+ * A cache for the End's noise generator that caches computed values. Through the caching, we can eliminate a large + * A cache for the End's noise generator that caches computed values. Through the caching, we can eliminate a large
+ * amount of overhead in computing the noise values several hundred thousand times per chunk. This code uses the same + * amount of overhead in computing the noise values several hundred thousand times per chunk. This code uses the same
@ -73,14 +74,14 @@ index 0000000000000000000000000000000000000000..167498cfab7aed0deb32232082ae06a1
+ +
+ long lx = x; + long lx = x;
+ long lz = z; + long lz = z;
+ long distanceFromOriginSq = lx * lx + lz * lz; + long distanceFromOriginSq = lx * lx + lz * lz;
+ +
+ // Ensure we are 64 grid cells away from the origin. + // Ensure we are 64 grid cells away from the origin.
+ if (distanceFromOriginSq > 64 * 64) { + if (distanceFromOriginSq > 64 * 64) {
+ // Reduce the number of island-forming grid cells by sampling noise with a threshold + // Reduce the number of island-forming grid cells by sampling noise with a threshold
+ if (this.sampler.a(x, z) < -0.9) { + if (this.sampler.a(x, z) < -0.9) {
+ // Generate a pseudo-random value from 9 to 21 + // Generate a pseudo-random value from 9 to 21
+ value = (Math.abs(x) * 3439.0F + Math.abs(z) * 147.0F) % 13.0F + 9.0F; + value = (Math.abs(x) * 3439.0F + Math.abs(z) * 147.0F) %13.0F + 9.0F;
+ } + }
+ } + }
+ +
@ -92,7 +93,8 @@ index 0000000000000000000000000000000000000000..167498cfab7aed0deb32232082ae06a1
+ } + }
+ +
+ /** + /**
+ * Mapped and cleaned up implementation of the End biome source's sampler. Tries to use cached values wherever possible. + * Mapped and cleaned up implementation of the End biome source's sampler. Tries to use cached values wherever
+ * possible.
+ */ + */
+ public float getNoiseAt(int x, int z) { + public float getNoiseAt(int x, int z) {
+ // [VanillaCopy] TheEndBiomeSource#getNoiseAt + // [VanillaCopy] TheEndBiomeSource#getNoiseAt
@ -105,16 +107,16 @@ index 0000000000000000000000000000000000000000..167498cfab7aed0deb32232082ae06a1
+ int gridOriginZ = z % GRID_SIZE; + int gridOriginZ = z % GRID_SIZE;
+ +
+ // Initialize density for the central island + // Initialize density for the central island
+ float density = ISLAND_RADIUS - MathHelper.sqrt(x * x + z * z) * 8.0F; + float density = ISLAND_RADIUS - MathHelper.sqrt(x * x + z * z) * 8.0F;
+ if (density >= MAX) { + if (density >= MAX) {
+ return MAX; + return MAX;
+ } + }
+ +
+ // Iterate through 25x25 grid cells + // Iterate through 25x25 grid cells
+ for (int offsetX = -12; offsetX <= 12; ++offsetX) { + for (int offsetX = -12; offsetX <= 12; offsetX++) {
+ for (int offsetZ = -12; offsetZ <= 12; ++offsetZ) { + for (int offsetZ = -12; offsetZ <= 12; offsetZ++) {
+ int globalGridX = gridX + offsetX; + int globalGridX = gridX + offsetX;
+ int globalGridZ = gridZ + offsetZ; + int globalGridZ = gridZ + offsetZ;
+ +
+ // Try to retrieve values from cache + // Try to retrieve values from cache
+ float distanceFactor = getDistanceFactor(globalGridX, globalGridZ); + float distanceFactor = getDistanceFactor(globalGridX, globalGridZ);
@ -124,7 +126,7 @@ index 0000000000000000000000000000000000000000..167498cfab7aed0deb32232082ae06a1
+ float deltaZ = gridOriginZ - offsetZ * GRID_SIZE; + float deltaZ = gridOriginZ - offsetZ * GRID_SIZE;
+ +
+ // Calculate the density at this grid cell + // Calculate the density at this grid cell
+ float scaledDistance = MathHelper.sqrt(deltaX * deltaX + deltaZ * deltaZ) * distanceFactor; + float scaledDistance = MathHelper.sqrt(deltaX * deltaX + deltaZ * deltaZ) * distanceFactor;
+ float densityHere = ISLAND_RADIUS - scaledDistance; + float densityHere = ISLAND_RADIUS - scaledDistance;
+ +
+ // Try to return early if we're over the max + // Try to return early if we're over the max
@ -147,41 +149,41 @@ index 0000000000000000000000000000000000000000..167498cfab7aed0deb32232082ae06a1
+ return density; + return density;
+ } + }
+} +}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
index 45b771e4121f2ef27c67d5a5ba2dadcfc0f944e0..b15ed711d8236e9835ffa013f8252aec03e9bb57 100644 index 321ebe8891defb46f3ad3dfea37c9bb6e2025ad7..119804e5c12aca3f4fbfeaf424f46152f43b3941 100644
--- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java --- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
@@ -56,12 +56,13 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { @@ -57,12 +57,13 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
private final NoiseGenerator t; private final NoiseGenerator t;
private final NoiseGeneratorOctaves u; private final NoiseGeneratorOctaves u;
@Nullable @Nullable
- private final NoiseGenerator3Handler v; - private final NoiseGenerator3Handler v;
+ private final NoiseGenerator3Handler v; // Yatopia Note: yarn "SimplexNoiseSampler" + private final NoiseGenerator3Handler v; // Yatopia - yarn "SimplexNoiseSampler"
protected final IBlockData f; protected final IBlockData f;
protected final IBlockData g; protected final IBlockData g;
private final long w; private final long w;
protected final GeneratorSettingBase h; protected final Supplier<GeneratorSettingBase> h;
private final int x; private final int x;
+ private ThreadLocal<me.jellysquid.mods.lithium.common.world.noise.SimplexNoiseCache> tlCache; // Yatopia: lithium + private ThreadLocal<me.jellysquid.mods.lithium.common.world.noise.SimplexNoiseCache> tlCache; // Yatopia
public ChunkGeneratorAbstract(WorldChunkManager worldchunkmanager, long i, GeneratorSettingBase generatorsettingbase) { public ChunkGeneratorAbstract(WorldChunkManager worldchunkmanager, long i, Supplier<GeneratorSettingBase> supplier) {
this(worldchunkmanager, worldchunkmanager, i, generatorsettingbase); this(worldchunkmanager, worldchunkmanager, i, supplier);
@@ -96,7 +97,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { @@ -99,7 +100,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
} else { } else {
this.v = null; this.v = null;
} }
- -
+ this.tlCache = ThreadLocal.withInitial(() -> new me.jellysquid.mods.lithium.common.world.noise.SimplexNoiseCache(v)); // Yatopia: lithium + this.tlCache = ThreadLocal.withInitial(() -> new me.jellysquid.mods.lithium.common.world.noise.SimplexNoiseCache(v)); // Yatopia
} }
@Override @Override
@@ -161,7 +162,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { @@ -164,7 +165,8 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
double d3; double d3;
if (this.v != null) { if (this.v != null) {
- d0 = (double) (WorldChunkManagerTheEnd.a(this.v, i, j) - 8.0F); - d0 = (double) (WorldChunkManagerTheEnd.a(this.v, i, j) - 8.0F);
+ d0 = (double) (/*WorldChunkManagerTheEnd.a(this.v, i, j) Yatopia lithium*/tlCache.get().getNoiseAt(i, j) - 8.0F); + //d0 = (double) (WorldChunkManagerTheEnd.a(this.v, i, j) - 8.0F); // Yatopia
+ d0 = tlCache.get().getNoiseAt(i, j) - 8.0F; // Yatopia
if (d0 > 0.0D) { if (d0 > 0.0D) {
d1 = 0.25D; d1 = 0.25D;
} else { } else {

View File

@ -9,10 +9,10 @@ you can find the original code on https://github.com/jellysquid3/lithium-fabric/
Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: tr7zw <tr7zw@live.de>
diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java
index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..23fdd7c7d0368cc88e467a890cea8aa9b495fa11 100644 index e69093b411f76ea4090789576f8fb6635bd02ca5..4a14431b198c227eb6f0f68eaac14f5c09fc3036 100644
--- a/src/main/java/net/minecraft/server/DataWatcher.java --- a/src/main/java/net/minecraft/server/DataWatcher.java
+++ b/src/main/java/net/minecraft/server/DataWatcher.java +++ b/src/main/java/net/minecraft/server/DataWatcher.java
@@ -26,6 +26,77 @@ public class DataWatcher { @@ -27,6 +27,77 @@ public class DataWatcher {
private boolean f = true; private boolean f = true;
private boolean g; private boolean g;
@ -26,7 +26,7 @@ index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..23fdd7c7d0368cc88e467a890cea8aa9
+ * should only ever occur during entity initialization. Type-erasure is a bit of a pain here since we must redirect + * should only ever occur during entity initialization. Type-erasure is a bit of a pain here since we must redirect
+ * a calls to the generic Map interface. + * a calls to the generic Map interface.
+ */ + */
+ private Object onAddTrackedDataInsertMap(it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<DataWatcher.Item<?>> map, int keyRaw, DataWatcher.Item<?> valueRaw) { + private Object onAddTrackedDataInsertMap(Int2ObjectOpenHashMap<DataWatcher.Item<?>> map, int keyRaw, DataWatcher.Item<?> valueRaw) {
+ int k = keyRaw; + int k = keyRaw;
+ DataWatcher.Item<?> v = (DataWatcher.Item<?>) valueRaw; + DataWatcher.Item<?> v = (DataWatcher.Item<?>) valueRaw;
+ +
@ -90,7 +90,7 @@ index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..23fdd7c7d0368cc88e467a890cea8aa9
public DataWatcher(Entity entity) { public DataWatcher(Entity entity) {
this.entity = entity; this.entity = entity;
} }
@@ -90,7 +161,8 @@ public class DataWatcher { @@ -91,7 +162,8 @@ public class DataWatcher {
DataWatcher.Item<T> datawatcher_item = new DataWatcher.Item<>(datawatcherobject, t0); DataWatcher.Item<T> datawatcher_item = new DataWatcher.Item<>(datawatcherobject, t0);
// this.lock.writeLock().lock(); // Spigot - not required // this.lock.writeLock().lock(); // Spigot - not required
@ -100,7 +100,7 @@ index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..23fdd7c7d0368cc88e467a890cea8aa9
this.f = false; this.f = false;
// this.lock.writeLock().unlock(); // Spigot - not required // this.lock.writeLock().unlock(); // Spigot - not required
} }
@@ -121,7 +193,8 @@ public class DataWatcher { @@ -122,7 +194,8 @@ public class DataWatcher {
} }
public <T> T get(DataWatcherObject<T> datawatcherobject) { public <T> T get(DataWatcherObject<T> datawatcherobject) {

View File

@ -5,31 +5,29 @@ Subject: [PATCH] Fix lead fall dmg config
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index d8e3bbb2ffbf20a111af3fd7a019daf1d5a7dead..325d1fe8f91bdfa82a53a5f1f86804d04f973090 100644 index 0566088538c2b99ff74a408b67a9edee4751f904..db5e7cb183682f5cf7049190ae49a835738a065e 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java --- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java +++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -225,4 +225,10 @@ public class YatopiaConfig { @@ -231,4 +231,9 @@ public class YatopiaConfig {
private static void villagersHideAtNight() { simplerVillagerBehavior = getBoolean("settings.villager.simplerVillagerBehavior", false);
villagersHideAtNight = getBoolean("settings.villager.villagersHideAtNight", false); villagersHideAtNight = getBoolean("settings.villager.villagersHideAtNight", false);
} }
+ +
+ public static boolean fixFallDistance = false; + public static boolean fixFallDistance = false;
+ private static void fixFallDistance() { + private static void fixFallDistance() {
+ fixFallDistance = getBoolean("settings.fixFallDistance", false); + fixFallDistance = getBoolean("settings.fixFallDistance", false);
+ } + }
+
} }
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index fe0689f6be466d1a2a1ed2b76331272199a0aa0c..eef7128a81b58089a2ea2495264a7e94104668a8 100644 index 724aab2cc747940e31c01a52a258e3519e6bda79..e19d363e76158335acbabaee2bae295dfee38cf8 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1266,6 +1266,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -1264,6 +1264,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
} else if (d0 < 0.0D) { } else if (d0 < 0.0D) {
this.fallDistance = (float) ((double) this.fallDistance - d0); this.fallDistance = (float) ((double) this.fallDistance - d0);
+ } else if (d0 > 0.0D && dev.tr7zw.yatopia.YatopiaConfig.fixFallDistance) { // Yatopia + } else if (d0 > 0.0D && dev.tr7zw.yatopia.YatopiaConfig.fixFallDistance) { // Yatopia
+ this.fallDistance = 0.0F; // Yatopia + this.fallDistance = 0.0F; // Yatopia
} }
} }

View File

@ -5,37 +5,8 @@ Subject: [PATCH] Akarin updated Async Path Finding
Co-authored-by: Bud Gidiere <sgidiere@gmail.com> Co-authored-by: Bud Gidiere <sgidiere@gmail.com>
diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java
index e6868e2b65e3c2bde7696272b242a47e7394e27f..dcd99ae6cb244c819c68dfafa681adf63a34622a 100644
--- a/src/main/java/net/minecraft/server/EntityBee.java
+++ b/src/main/java/net/minecraft/server/EntityBee.java
@@ -445,9 +445,9 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB
}
@Override
- public void c() {
+ public void tickAsync() { // Akarin - async pathfinding
if (!EntityBee.this.bJ.k()) {
- super.c();
+ super.tickAsync(); // Akarin - async pathfinding
}
}
};
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 691a4ebc3f267bab375fb2bc83deac9ea825a232..7c9bb358c9967e6c7c02b96e17764f2418df7979 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -757,7 +757,7 @@ public abstract class EntityInsentient extends EntityLiving {
this.goalSelector.doTick();
//this.world.getMethodProfiler().exit(); // Akarin - remove caller
//this.world.getMethodProfiler().enter("navigation"); // Akarin - remove caller
- this.navigation.c();
+ this.navigation.tickAsync(); // Akarin - Async pathfinder
//this.world.getMethodProfiler().exit(); // Akarin - remove caller
//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 diff --git a/src/main/java/net/minecraft/server/Navigation.java b/src/main/java/net/minecraft/server/Navigation.java
index 681465d8a74831461dce4615d2d19c7ed46bc299..f04411a2a295d2a982dca5851ae76a80a6a83585 100644 index 0ed01f40edfdbeeeea9db55fcba7501ee597c1fb..795fd9308dcd9edce4ef12da2e8bc5a65f358abc 100644
--- a/src/main/java/net/minecraft/server/Navigation.java --- a/src/main/java/net/minecraft/server/Navigation.java
+++ b/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 { @@ -183,7 +183,7 @@ public class Navigation extends NavigationAbstract {
@ -48,7 +19,7 @@ index 681465d8a74831461dce4615d2d19c7ed46bc299..f04411a2a295d2a982dca5851ae76a80
if (!this.a(pathtype)) { if (!this.a(pathtype)) {
return false; return false;
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..78d1d96aeaf8c8b79f5f5bdf74178816c8bc8973 100644 index ed37caf036ef9ae4c39622caf9b582678fecdccf..666ac7227e273aabb3f8e5ca78b5ac9652486229 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java --- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -28,6 +28,15 @@ public abstract class NavigationAbstract { @@ -28,6 +28,15 @@ public abstract class NavigationAbstract {
@ -59,102 +30,69 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..78d1d96aeaf8c8b79f5f5bdf74178816
+ private long lastPathfindAsync; + private long lastPathfindAsync;
+ private static final java.util.concurrent.ExecutorService pathfindExecutor = + private static final java.util.concurrent.ExecutorService pathfindExecutor =
+ java.util.concurrent.Executors.newSingleThreadExecutor( + java.util.concurrent.Executors.newSingleThreadExecutor(
+ new com.google.common.util.concurrent.ThreadFactoryBuilder() + new com.google.common.util.concurrent.ThreadFactoryBuilder()
+ .setDaemon(true) + .setDaemon(true)
+ .setNameFormat("StarLink Pathfinder - %d") + .setNameFormat("StarLink Pathfinder - %d")
+ .build()); + .build());
+ // Akarin end + // Akarin end
// Tuinity start // Tuinity start
public boolean isViableForPathRecalculationChecking() { public boolean isViableForPathRecalculationChecking() {
@@ -83,7 +92,40 @@ public abstract class NavigationAbstract { @@ -36,6 +45,128 @@ public abstract class NavigationAbstract {
}
} }
// Tuinity end
+ // Akarin start - Async pathfinder, copied from above with modification + // Akarin start - Async pathfinder, copied from above with modification
+ public void doPathfindAsync() { + public void doPathfindAsync() {
+ if (this.b.getTime() - this.lastPathfindAsync > 20L) { + if (this.b.getTime() - this.lastPathfindAsync > 20L) {
+ if (this.p != null) { + if (this.p != null) {
+ this.lastPathfindAsync = this.b.getTime(); + this.lastPathfindAsync = this.b.getTime();
+ +
+ // Bake chunk cache + // Baeke chunk cache
+ float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);; + float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);
+ BlockPosition blockposition = this.a.getChunkCoordinates(); + BlockPosition blockposition = this.a.getChunkCoordinates();
+ int k = (int) (f + (float) 8); + int k = (int) (f + (float) 8);
+ ChunkCache cache = new ChunkCache(this.b, blockposition.b(-k, -k, -k), blockposition.b(k, k, k)); + ChunkCache chunkCache = new ChunkCache(this.b, blockposition.b(-k, -k, -k), blockposition.b(k, k, k));
+ +
+ // Execute directly if we already have a path entity, or compute one
+ if (this.c != null && !this.c.b()) { + if (this.c != null && !this.c.b()) {
+ doTickAsync(this.c); + doTickAsync(this.c);
+ return; + return;
+ } + }
+
+ pathfindExecutor.execute(() -> { + pathfindExecutor.execute(() -> {
+ PathEntity result = findPathAsync(cache, java.util.Collections.singleton(this.p), this.q); + PathEntity result = findPathAsync(chunkCache, java.util.Collections.singleton(this.p), this.q);
+ NavigationAbstract.this.b.getMinecraftServer().processQueue.add(() -> { + NavigationAbstract.this.b.getMinecraftServer().processQueue.add(() -> {
+ if (result != null && result.m() != null) + if (result != null && result.m() != null) {
+ this.p = result.m(); + this.p = result.m();
+ }
+ +
+ NavigationAbstract.this.c = result; + NavigationAbstract.this.c = result;
+ }); + });
+ }); + });
+ } + }
+ } else { + } else {
+ // Execute directly, keep behaviour with vanilla, see the original doTick method
+ doTickAsync(this.c); + doTickAsync(this.c);
+ } + }
+ } + }
+ // Akarin end +
@Nullable + protected PathEntity findPathAsync(ChunkCache cache, Set<BlockPosition> set, int j) {
public final PathEntity calculateDestination(double d0, double d1, double d2) { return a(d0, d1, d2, 0); } public final PathEntity a(double d0, double d1, double d2, int i) { // Paper - OBFHELPER + if (this.a.locY() < 0.0D) {
return this.a(new BlockPosition(d0, d1, d2), i); + return null;
@@ -164,7 +206,17 @@ public abstract class NavigationAbstract { + } else if (!this.a()) {
return pathentity; + return null;
} + } else {
} + return this.s.a(cache, this.a, set, f, j, this.r);
- + }
+ // Akarin start - Async pathfinder, copied and edited from above with only pathfinding
+ protected PathEntity findPathAsync(ChunkCache cache, Set<BlockPosition> set, int j) {
+ if (this.a.locY() < 0.0D) {
+ return null;
+ } else if (!this.a()) {
+ return null;
+ } else {
+ return this.s.a(cache, this.a, set, f, j, this.r);
+ }
+ }
+ // Akarin end
public boolean a(double d0, double d1, double d2, double d3) {
return this.a(this.a(d0, d1, d2, 1), d3);
}
@@ -228,7 +280,7 @@ public abstract class NavigationAbstract {
return this.c;
}
- public void c() {
+/* public void c() { // Yatopia
++this.e;
if (this.m) {
this.j();
@@ -256,9 +308,43 @@ public abstract class NavigationAbstract {
this.a.getControllerMove().a(vec3d.x, this.b.getType(blockposition.down()).isAir() ? vec3d.y : PathfinderNormal.a((IBlockAccess) this.b, blockposition), vec3d.z, this.d);
}
}
+ }*/ // Yatopia
+ // Yatopia start
+ public void c() {
+ this.tickAsync();
}
+ // Yatopia end
+ // Akarin start - Async pathfinder, copied from above
+ public void tickAsync() {
+ ++this.e;
+ this.doPathfindAsync();
+ } + }
+ // This was copied from above partly with param +
+ public static boolean shouldContinuePathfind(PathEntity pathEntity) {
+ return pathEntity == null || pathEntity.b();
+ }
+
+ public void doTickAsync(PathEntity pathEntity) { + public void doTickAsync(PathEntity pathEntity) {
+ if (shouldContinuePathfind(pathEntity)) + if (shouldContinuePathfind(pathEntity)) {
+ return; + return;
+ }
+ +
+ Vec3D vec3d; + Vec3D vec3d;
+ if (this.a()) { + if (this.a()) {
@ -162,58 +100,37 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..78d1d96aeaf8c8b79f5f5bdf74178816
+ } else if (pathEntity.f() < pathEntity.e()) { + } else if (pathEntity.f() < pathEntity.e()) {
+ vec3d = this.b(); + vec3d = this.b();
+ Vec3D vec3d1 = pathEntity.a(this.a, pathEntity.f()); + Vec3D vec3d1 = pathEntity.a(this.a, pathEntity.f());
+
+ if (vec3d.y > vec3d1.y && !this.a.isOnGround() && MathHelper.floor(vec3d.x) == MathHelper.floor(vec3d1.x) && MathHelper.floor(vec3d.z) == MathHelper.floor(vec3d1.z)) { + if (vec3d.y > vec3d1.y && !this.a.isOnGround() && MathHelper.floor(vec3d.x) == MathHelper.floor(vec3d1.x) && MathHelper.floor(vec3d.z) == MathHelper.floor(vec3d1.z)) {
+ pathEntity.c(pathEntity.f() + 1); + pathEntity.c(pathEntity.f() + 1);
+ } + }
+ } + }
+
- protected void l() { + if (shouldContinuePathfind(pathEntity)) {
+ if (shouldContinuePathfind(pathEntity))
+ return; + return;
+ //PacketDebug.a(this.b, this.a, pathEntity, this.l); + }
+ vec3d = pathEntity.a((Entity) this.a); + vec3d = pathEntity.a(this.a);
+ BlockPosition blockposition = new BlockPosition(vec3d); + BlockPosition blockposition = new BlockPosition(vec3d);
+ +
+ this.a.getControllerMove().a(vec3d.x, this.b.getType(blockposition.down()).isAir() ? vec3d.y : PathfinderNormal.a((IBlockAccess) this.b, blockposition), vec3d.z, this.d); + this.a.getControllerMove().a(vec3d.x, this.b.getType(blockposition.down()).isAir() ? vec3d.y : PathfinderNormal.a((IBlockAccess) this.b, blockposition), vec3d.z, this.d);
+ } + }
+/* protected void l() {
Vec3D vec3d = this.b();
this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F;
@@ -273,8 +359,26 @@ public abstract class NavigationAbstract {
}
this.a(vec3d);
- }
+ }*/ // Akarin end
+ +
+ // Akarin start - Async pathfinder, copied from above with param
+ protected void applyPath(PathEntity pathEntity) { + protected void applyPath(PathEntity pathEntity) {
+ Vec3D vec3d = this.b(); + Vec3D vec3d = this.b();
+ +
+ this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F; + this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F;
+ BaseBlockPosition baseblockposition = pathEntity.g(); + BaseBlockPosition baseBlockPosition = pathEntity.g();
+ double d0 = Math.abs(this.a.locX() - ((double) baseblockposition.getX() + 0.5D)); + double d0 = Math.abs(this.a.locX() - ((double) baseBlockPosition.getX() + 0.5));
+ double d1 = Math.abs(this.a.locY() - (double) baseblockposition.getY()); + double d1 = Math.abs(this.a.locY() - ((double) baseBlockPosition.getY()));
+ double d2 = Math.abs(this.a.locZ() - ((double) baseblockposition.getZ() + 0.5D)); + double d2 = Math.abs(this.a.locZ() - ((double) baseBlockPosition.getZ() + 0.5));
+ boolean flag = d0 < (double) this.l && d2 < (double) this.l && d1 < 1.0D; + boolean flag = d0 < (double) this.l && d2 < (double) this.l && d1 < 1.0D;
+ +
+ if (flag || this.a.b(pathEntity.h().l) && this.b(vec3d)) { + if (flag || this.a.b(pathEntity.h().l) && this.b(vec3d)) {
+ pathEntity.c(pathEntity.f() + 1); + pathEntity.c(pathEntity.f() + 1);
+ } + }
+
+ this.applyPath0(pathEntity, vec3d); + this.applyPath0(pathEntity, vec3d);
+ } + }
+ // Akarin end +
private boolean b(Vec3D vec3d) {
if (this.c.e() <= this.c.f() + 1) {
return false;
@@ -324,7 +428,39 @@ public abstract class NavigationAbstract {
}
}
+ // Akarin start - Async pathfinder, copied from above with param
+ protected void applyPath0(PathEntity pathEntity, Vec3D vec3d) { + protected void applyPath0(PathEntity pathEntity, Vec3D vec3d) {
+ if (this.e - this.f > 100) { + if (this.e - this.f > 100) {
+ if (vec3d.distanceSquared(this.g) < 2.25D) { + if (vec3d.distanceSquared(this.g) < 2.25D) {
@ -228,14 +145,14 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..78d1d96aeaf8c8b79f5f5bdf74178816
+ BaseBlockPosition baseblockposition = pathEntity.g(); + BaseBlockPosition baseblockposition = pathEntity.g();
+ +
+ if (baseblockposition.equals(this.h)) { + if (baseblockposition.equals(this.h)) {
+ this.i += SystemUtils.getMonotonicMillis() - this.j; + this.i = SystemUtils.getMonotonicMillis() - this.j;
+ } else { + } else {
+ this.h = baseblockposition; + this.h = baseblockposition;
+ double d0 = vec3d.f(Vec3D.c(this.h)); + double d0 = vec3d.f(Vec3D.c(this.h));
+ +
+ this.k = this.a.dM() > 0.0F ? d0 / (double) this.a.dM() * 1000.0D : 0.0D; + this.k = this.a.dM() > 0.0F ? d0 / (double) this.a.dM() * 1000.0D : 0.0D;
+ } + }
+
+ if (this.k > 0.0D && (double) this.i > this.k * 3.0D) { + if (this.k > 0.0D && (double) this.i > this.k * 3.0D) {
+ this.e(); + this.e();
+ this.o(); + this.o();
@ -246,67 +163,47 @@ index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..78d1d96aeaf8c8b79f5f5bdf74178816
+ +
+ } + }
+ // Akarin end + // Akarin end
private void e() { +
public NavigationAbstract(EntityInsentient entityinsentient, World world) {
this.g = Vec3D.a;
this.h = BaseBlockPosition.ZERO; this.h = BaseBlockPosition.ZERO;
this.i = 0L; @@ -230,6 +361,8 @@ public abstract class NavigationAbstract {
@@ -389,7 +525,11 @@ public abstract class NavigationAbstract {
public boolean r() { public void c() {
return this.o.e(); ++this.e;
+ this.doPathfindAsync(); // Akarin
+ /* // Akarin
if (this.m) {
this.j();
}
@@ -256,6 +389,7 @@ public abstract class NavigationAbstract {
this.a.getControllerMove().a(vec3d.x, this.b.getType(blockposition.down()).isAir() ? vec3d.y : PathfinderNormal.a((IBlockAccess) this.b, blockposition), vec3d.z, this.d);
}
}
+ */ // Akarin
} }
-
+ // Akarin start - Async pathfinder, copied from above with param protected void l() {
+ public static boolean shouldContinuePathfind(PathEntity pathEntity) {
+ return pathEntity == null || pathEntity.b();
+ }
+ // Akarin end
public void b(BlockPosition blockposition) {
if (this.c != null && !this.c.b() && this.c.e() != 0) { // Tuinity - diff on change - needed for isViableForPathRecalculationChecking()
PathPoint pathpoint = this.c.c();
diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java
index 0c33a0c9d59d79a39826b5ee14144604717ffebe..14b77c7f8ee54bb2189fbb17814dce9aaa7db3eb 100644 index 013bdfe5540ae594a7f9cbe3ef8dc54dfb25afd4..d9460cdb87a87450269c468857f0e87947de8861 100644
--- a/src/main/java/net/minecraft/server/NavigationFlying.java --- a/src/main/java/net/minecraft/server/NavigationFlying.java
+++ b/src/main/java/net/minecraft/server/NavigationFlying.java +++ b/src/main/java/net/minecraft/server/NavigationFlying.java
@@ -28,7 +28,7 @@ public class NavigationFlying extends NavigationAbstract { @@ -28,6 +28,7 @@ public class NavigationFlying extends NavigationAbstract {
return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
} }
- @Override + /* // Akarin
+/* @Override // Yatopia @Override
public void c() { public void c() {
++this.e; ++this.e;
if (this.m) { @@ -54,6 +55,7 @@ public class NavigationFlying extends NavigationAbstract {
@@ -53,6 +53,31 @@ public class NavigationFlying extends NavigationAbstract {
this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d);
} }
} }
+ }*/ // Yatopia
+
+ // This was copied from above partly with param
+ @Override
+ public void doTickAsync(PathEntity pathEntity) {
+ if (shouldContinuePathfind(pathEntity))
+ return;
+
+ Vec3D vec3d;
+ if (this.a()) {
+ this.applyPath(pathEntity);
+ } else if (pathEntity != null && pathEntity.f() < pathEntity.e()) {
+ vec3d = pathEntity.a(this.a, pathEntity.f());
+ if (MathHelper.floor(this.a.locX()) == MathHelper.floor(vec3d.x) && MathHelper.floor(this.a.locY()) == MathHelper.floor(vec3d.y) && MathHelper.floor(this.a.locZ()) == MathHelper.floor(vec3d.z)) {
+ pathEntity.c(pathEntity.f() + 1);
+ }
+ }
+
+ if (shouldContinuePathfind(pathEntity))
+ return;
+ //PacketDebug.a(this.b, this.a, pathEntity, this.l);
+ vec3d = pathEntity.a((Entity) this.a);
+ BlockPosition blockposition = new BlockPosition(vec3d);
+
+ this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d);
} }
+ */ // Akarin
@Override @Override
protected boolean a(Vec3D vec3d, Vec3D vec3d1, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java
index 997982136cdd2a0d922e501473e0d4d1aabf567a..9b2d23ef1c9369cf15f9f12161c28199fbf4f373 100644 index 997982136cdd2a0d922e501473e0d4d1aabf567a..9b2d23ef1c9369cf15f9f12161c28199fbf4f373 100644
--- a/src/main/java/net/minecraft/server/Pathfinder.java --- a/src/main/java/net/minecraft/server/Pathfinder.java
@ -321,7 +218,7 @@ index 997982136cdd2a0d922e501473e0d4d1aabf567a..9b2d23ef1c9369cf15f9f12161c28199
this.c.a(chunkcache, entityinsentient); this.c.a(chunkcache, entityinsentient);
PathPoint pathpoint = this.c.b(); PathPoint pathpoint = this.c.b();
diff --git a/src/main/java/net/minecraft/server/PathfinderTurtle.java b/src/main/java/net/minecraft/server/PathfinderTurtle.java diff --git a/src/main/java/net/minecraft/server/PathfinderTurtle.java b/src/main/java/net/minecraft/server/PathfinderTurtle.java
index cea160885783e8666b616375eac44ba6d1880e1f..9598563b4f97500fd3fba0165813d564d9c96c4f 100644 index e8aca88284dff6055de6d45e2a50bb28b7a64297..d8dd3aeedee76eaa828bb751dbcdff4c290c66da 100644
--- a/src/main/java/net/minecraft/server/PathfinderTurtle.java --- a/src/main/java/net/minecraft/server/PathfinderTurtle.java
+++ b/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 { @@ -148,7 +148,7 @@ public class PathfinderTurtle extends PathfinderNormal {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Optimize player loops around weather
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 3782d329dc62a9e834f16a9009f4102b5b4aad6f..2a681afff2e8b9f7b7e106dcb780ecac27d14353 100644 index 11ac68333a97c21607bd4ce6dd936a69003f2bea..8ba9a5ef645dcebf12894c3bd236aef006e473bf 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -833,12 +833,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -814,12 +814,17 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
} }
// */ // */
@ -29,7 +29,7 @@ index 3782d329dc62a9e834f16a9009f4102b5b4aad6f..2a681afff2e8b9f7b7e106dcb780ecac
if (flag != this.isRaining()) { if (flag != this.isRaining()) {
// Only send weather packets to those affected // Only send weather packets to those affected
for (int idx = 0; idx < this.players.size(); ++idx) { for (int idx = 0; idx < this.players.size(); ++idx) {
@@ -852,6 +857,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { @@ -833,6 +838,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
((EntityPlayer) this.players.get(idx)).updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel); ((EntityPlayer) this.players.get(idx)).updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
} }
} }

View File

@ -42,25 +42,25 @@ Ported to Yatopia and 1.16.1 by MrIvanPlays
Co-authored-by: MrIvanPlays <ivan@mrivanplays.com> Co-authored-by: MrIvanPlays <ivan@mrivanplays.com>
diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
index 84a872dfd35249972129130083d51d71d75bff1e..15ea264e49609de61be131d41ae68e65957d002b 100644 index 63a761ebef80d4af09cdc2682e496d78492c4a3a..db72d203ebfdfcd27f2dae240ccb998d746d518d 100644
--- a/src/main/java/net/minecraft/server/BehaviorFindPosition.java --- a/src/main/java/net/minecraft/server/BehaviorFindPosition.java
+++ b/src/main/java/net/minecraft/server/BehaviorFindPosition.java +++ b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
@@ -45,7 +45,7 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> { @@ -48,7 +48,7 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
if (this.d && entitycreature.isBaby()) { if (this.d && entitycreature.isBaby()) {
return false; return false;
} else if (this.e == 0L) { } else if (this.f == 0L) {
- this.e = entitycreature.world.getTime() + (long) worldserver.random.nextInt(20); - this.f = entitycreature.world.getTime() + (long) worldserver.random.nextInt(20);
+ this.e = entitycreature.world.getTime() + (long) java.util.concurrent.ThreadLocalRandom.current().nextInt(20); // Yatopia + this.f = entitycreature.world.getTime() + (long) java.util.concurrent.ThreadLocalRandom.current().nextInt(20); // Yatopia
return false; return false;
} else { } else {
return worldserver.getTime() >= this.e; return worldserver.getTime() >= this.f;
@@ -53,12 +53,57 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> { @@ -56,12 +56,57 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
} }
protected void a(WorldServer worldserver, EntityCreature entitycreature, long i) { protected void a(WorldServer worldserver, EntityCreature entitycreature, long i) {
- this.e = i + 20L + (long) worldserver.getRandom().nextInt(20); - this.f = i + 20L + (long) worldserver.getRandom().nextInt(20);
+ this.e = i + 20L + (long) java.util.concurrent.ThreadLocalRandom.current().nextInt(20); // Yatopia + this.f = i + 20L + (long) java.util.concurrent.ThreadLocalRandom.current().nextInt(20); // Yatopia
VillagePlace villageplace = worldserver.x(); VillagePlace villageplace = worldserver.y();
+ // Yatopia start - replace implementation completely + // Yatopia start - replace implementation completely
+ BlockPosition blockposition2 = new BlockPosition(entitycreature.locX(), entitycreature.locY(), entitycreature.locZ()); + BlockPosition blockposition2 = new BlockPosition(entitycreature.locX(), entitycreature.locY(), entitycreature.locZ());
@ -78,21 +78,21 @@ index 84a872dfd35249972129130083d51d71d75bff1e..15ea264e49609de61be131d41ae68e65
+ for (java.util.Map.Entry<VillagePlaceType, java.util.Set<VillagePlaceRecord>> e : section.get().getRecords().entrySet()) { + for (java.util.Map.Entry<VillagePlaceType, java.util.Set<VillagePlaceRecord>> e : section.get().getRecords().entrySet()) {
+ if (!predicate.test(e.getKey())) continue; + if (!predicate.test(e.getKey())) continue;
+ for (VillagePlaceRecord record : e.getValue()) { + for (VillagePlaceRecord record : e.getValue()) {
+ if (!record.hasVacany()) continue; + if (!record.hasVacancy()) continue;
+ +
+ BlockPosition pos = record.getPosition(); + BlockPosition pos = record.getPosition();
+ long key = pos.asLong(); + long key = pos.asLong();
+ if (this.f.containsKey(key)) { + if (this.g.containsKey(key)) {
+ continue; + continue;
+ } + }
+ double poiDist = pos.distanceSquared(blockposition2); + double poiDist = pos.distanceSquared(blockposition2);
+ if (poiDist <= (double) requiredDist) { + if (poiDist <= (double) requiredDist) {
+ this.f.put(key, new BehaviorFindPosition.a(java.util.concurrent.ThreadLocalRandom.current(), (long) (this.e + Math.sqrt(poiDist) * 4))); // use dist instead of 40 to blacklist longer if farther distance + this.g.put(key, new BehaviorFindPosition.a(java.util.concurrent.ThreadLocalRandom.current(), (long) (this.f + Math.sqrt(poiDist) * 4)))
+ ; // use dist instead of 40 to blacklist longer if farther distance
+ ++poiAttempts; + ++poiAttempts;
+ PathEntity pathentity = entitycreature.getNavigation().a(com.google.common.collect.ImmutableSet.of(pos), 8, false, this.b.getValidRange()); + PathEntity pathentity = entitycreature.getNavigation().a(com.google.common.collect.ImmutableSet.of(pos), 8, false, this.b.getValidRange());
+ +
+ if (pathentity != null && pathentity.canReach()) { + if (pathentity != null && pathentity.canReach()) {
+ record.decreaseVacany();
+ GlobalPos globalPos = GlobalPos.create(worldserver.getDimensionKey(), pos); + GlobalPos globalPos = GlobalPos.create(worldserver.getDimensionKey(), pos);
+ entitycreature.getBehaviorController().setMemory(c, globalPos); + entitycreature.getBehaviorController().setMemory(c, globalPos);
+ break OUT; + break OUT;
@ -106,39 +106,40 @@ index 84a872dfd35249972129130083d51d71d75bff1e..15ea264e49609de61be131d41ae68e65
+ } + }
+ } + }
+ +
this.f.long2ObjectEntrySet().removeIf((entry) -> { this.g.long2ObjectEntrySet().removeIf((entry) -> {
- return !((BehaviorFindPosition.a) entry.getValue()).b(i); - return !((BehaviorFindPosition.a) entry.getValue()).b(i);
+ return entry.getValue().b < e; + return entry.getValue().b < f;
}); });
+ /* + /*
Predicate<BlockPosition> predicate = (blockposition) -> { Predicate<BlockPosition> predicate = (blockposition) -> {
BehaviorFindPosition.a behaviorfindposition_a = (BehaviorFindPosition.a) this.f.get(blockposition.asLong()); BehaviorFindPosition.a behaviorfindposition_a = (BehaviorFindPosition.a) this.g.get(blockposition.asLong());
@@ -96,6 +141,7 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> { @@ -102,7 +147,7 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
}); });
} }
} }
-
+ */ // Yatopia end + */ // Yatopia end
} }
static class a {
diff --git a/src/main/java/net/minecraft/server/PathEntity.java b/src/main/java/net/minecraft/server/PathEntity.java diff --git a/src/main/java/net/minecraft/server/PathEntity.java b/src/main/java/net/minecraft/server/PathEntity.java
index 9154c01a22bc7b6d2dd390bb7b6e21ef52c8006c..e86e09be4990bc6b7a36ab1ad74dba7022f49428 100644 index c81a5d50c480b064ab60ed6f25f9e2c0bedb6ece..a86ad4c8a28b9aacdb1e99320fddf2344b08bd7e 100644
--- a/src/main/java/net/minecraft/server/PathEntity.java --- a/src/main/java/net/minecraft/server/PathEntity.java
+++ b/src/main/java/net/minecraft/server/PathEntity.java +++ b/src/main/java/net/minecraft/server/PathEntity.java
@@ -106,6 +106,7 @@ public class PathEntity { @@ -114,6 +114,7 @@ public class PathEntity {
} }
} }
+ public final boolean canReach() { return i(); } // Yatopia - OBFHELPER + public final boolean canReach() { return j(); } // Yatopia - OBFHELPER
public boolean i() { public boolean j() {
return this.h; return this.h;
} }
diff --git a/src/main/java/net/minecraft/server/RegionFileSection.java b/src/main/java/net/minecraft/server/RegionFileSection.java diff --git a/src/main/java/net/minecraft/server/RegionFileSection.java b/src/main/java/net/minecraft/server/RegionFileSection.java
index bd0ff1e43a07a3332f9ade49fec2f76275a25c7f..f99be13169cfbca05cc440e7abef2197036b3d7d 100644 index 04256a95108b8182e8f808e856e0d2b62165e242..69cc2d1a0642029793827f4195723c380e01c821 100644
--- a/src/main/java/net/minecraft/server/RegionFileSection.java --- a/src/main/java/net/minecraft/server/RegionFileSection.java
+++ b/src/main/java/net/minecraft/server/RegionFileSection.java +++ b/src/main/java/net/minecraft/server/RegionFileSection.java
@@ -52,10 +52,12 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab @@ -52,10 +52,13 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab
@Nullable @Nullable
protected Optional<R> c(long i) { protected Optional<R> c(long i) {
@ -148,43 +149,41 @@ index bd0ff1e43a07a3332f9ade49fec2f76275a25c7f..f99be13169cfbca05cc440e7abef2197
+ protected final Optional<R> getSection(long i) { return d(i); } // Yatopia - OBFHELPER + protected final Optional<R> getSection(long i) { return d(i); } // Yatopia - OBFHELPER
protected Optional<R> d(long i) { protected Optional<R> d(long i) {
+ /* // Yatopia start - replaced logic + // Yatopia start - replace method - never load POI data sync, we load this in chunk load already, reduce ops
+ /*
SectionPosition sectionposition = SectionPosition.a(i); SectionPosition sectionposition = SectionPosition.a(i);
if (this.b(sectionposition)) { if (this.b(sectionposition)) {
@@ -75,6 +77,10 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab @@ -75,6 +78,10 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab
} }
} }
} }
+ */ + */
+ // Never load POI data sync, we load this in chunk load already, reduce ops
+ // If it's an unloaded chunk, well too bad. + // If it's an unloaded chunk, well too bad.
+ return c(i); + return this.c(i);
+ // Yatopia end
} }
protected boolean b(SectionPosition sectionposition) { protected boolean b(SectionPosition sectionposition) {
@@ -117,9 +123,11 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab @@ -118,7 +125,7 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab
private <T> void a(ChunkCoordIntPair chunkcoordintpair, DynamicOps<T> dynamicops, @Nullable T t0) { private <T> void a(ChunkCoordIntPair chunkcoordintpair, DynamicOps<T> dynamicops, @Nullable T t0) {
if (t0 == null) { if (t0 == null) {
+ /* // Yatopia start - NO!!!
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
this.c.put(SectionPosition.a(chunkcoordintpair, i).s(), Optional.empty()); - this.c.put(SectionPosition.a(chunkcoordintpair, i).s(), Optional.empty());
+ //this.c.put(SectionPosition.a(chunkcoordintpair, i).s(), Optional.empty()); // Yatopia - NO!!!
} }
+ */ // Yatopia end
} else { } else {
Dynamic<T> dynamic = new Dynamic(dynamicops, t0); Dynamic<T> dynamic = new Dynamic(dynamicops, t0);
int j = a(dynamic); @@ -140,7 +147,7 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab
@@ -140,7 +148,7 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab
return dataresult.resultOrPartial(logger::error); return dataresult.resultOrPartial(logger::error);
}); });
- this.c.put(i1, optional); - this.c.put(i1, optional);
+ if (optional.isPresent()) this.c.put(i1, optional); // Yatopia - NO!!! + if (optional.isPresent()) this.c.put(i1, optional); // Yatopia
optional.ifPresent((object) -> { optional.ifPresent((object) -> {
this.b(i1); this.b(i1);
if (flag) { if (flag) {
@@ -213,7 +221,7 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab @@ -213,7 +220,7 @@ public class RegionFileSection<R> extends RegionFileCache implements AutoCloseab
if (optional != null && optional.isPresent()) { if (optional != null && optional.isPresent()) {
this.d.add(i); this.d.add(i);
} else { } else {
@ -194,10 +193,10 @@ index bd0ff1e43a07a3332f9ade49fec2f76275a25c7f..f99be13169cfbca05cc440e7abef2197
} }
diff --git a/src/main/java/net/minecraft/server/SectionPosition.java b/src/main/java/net/minecraft/server/SectionPosition.java diff --git a/src/main/java/net/minecraft/server/SectionPosition.java b/src/main/java/net/minecraft/server/SectionPosition.java
index 7806f3c351cba3f0388da11888f900c48004dadf..6556533acb04f57284f7493c7683232e9dddbd48 100644 index f95925f1c5d091f1a129d0437bb6e175c6ac080f..cf5b25d9375724ea2afcf5cd59e0ccd302cdf45e 100644
--- a/src/main/java/net/minecraft/server/SectionPosition.java --- a/src/main/java/net/minecraft/server/SectionPosition.java
+++ b/src/main/java/net/minecraft/server/SectionPosition.java +++ b/src/main/java/net/minecraft/server/SectionPosition.java
@@ -145,6 +145,7 @@ public class SectionPosition extends BaseBlockPosition { @@ -173,6 +173,7 @@ public class SectionPosition extends BaseBlockPosition {
return (((long) i & 4194303L) << 42) | (((long) j & 1048575L)) | (((long) k & 4194303L) << 20); // Paper - Simplify to reduce instruction count return (((long) i & 4194303L) << 42) | (((long) j & 1048575L)) | (((long) k & 4194303L) << 20); // Paper - Simplify to reduce instruction count
} }
@ -206,30 +205,22 @@ index 7806f3c351cba3f0388da11888f900c48004dadf..6556533acb04f57284f7493c7683232e
return (((long) getX() & 4194303L) << 42) | (((long) getY() & 1048575L)) | (((long) getZ() & 4194303L) << 20); // Paper - Simplify to reduce instruction count return (((long) getX() & 4194303L) << 42) | (((long) getY() & 1048575L)) | (((long) getZ() & 4194303L) << 20); // Paper - Simplify to reduce instruction count
} }
diff --git a/src/main/java/net/minecraft/server/VillagePlaceRecord.java b/src/main/java/net/minecraft/server/VillagePlaceRecord.java diff --git a/src/main/java/net/minecraft/server/VillagePlaceRecord.java b/src/main/java/net/minecraft/server/VillagePlaceRecord.java
index e5d2304808b2bb93041523968f0b88e020c61c1e..2647dc3646e332189a88d17e08831882e40f2910 100644 index 0b40c2f4dada7d8432e3f91e9cf206c2bda3b24b..1b956d973ebef2345755201dec3449545c458a60 100644
--- a/src/main/java/net/minecraft/server/VillagePlaceRecord.java --- a/src/main/java/net/minecraft/server/VillagePlaceRecord.java
+++ b/src/main/java/net/minecraft/server/VillagePlaceRecord.java +++ b/src/main/java/net/minecraft/server/VillagePlaceRecord.java
@@ -34,6 +34,7 @@ public class VillagePlaceRecord { @@ -44,6 +44,7 @@ public class VillagePlaceRecord {
this(blockposition, villageplacetype, villageplacetype.b(), runnable);
}
+ public final boolean decreaseVacany() { return b(); } // Yatopia - OBFHELPER
protected boolean b() {
if (this.c <= 0) {
return false;
@@ -44,6 +45,7 @@ public class VillagePlaceRecord {
} }
} }
+ public final boolean increaseVacany() { return c(); } // Yatopia - OBFHELPER + protected final boolean increaseVacancy() { return c(); } // Yatopia - OBFHELPER
protected boolean c() { protected boolean c() {
if (this.c >= this.b.b()) { if (this.c >= this.b.b()) {
return false; return false;
@@ -54,14 +56,17 @@ public class VillagePlaceRecord { @@ -54,14 +55,17 @@ public class VillagePlaceRecord {
} }
} }
+ public final boolean hasVacany() { return d(); } // Yatopia - OBFHELPER + public final boolean hasVacancy() { return d(); } // Yatopia - OBFHELPER
public boolean d() { public boolean d() {
return this.c > 0; return this.c > 0;
} }
@ -244,7 +235,7 @@ index e5d2304808b2bb93041523968f0b88e020c61c1e..2647dc3646e332189a88d17e08831882
return this.a; return this.a;
} }
diff --git a/src/main/java/net/minecraft/server/VillagePlaceSection.java b/src/main/java/net/minecraft/server/VillagePlaceSection.java diff --git a/src/main/java/net/minecraft/server/VillagePlaceSection.java b/src/main/java/net/minecraft/server/VillagePlaceSection.java
index e82dcdbce698e2e9bc449fa639b7219821844e14..3aaba7fcaf83a491b9da60d156b7f2379f5a6aeb 100644 index 77c66bc9952542d2444b402896a3d9f622ca2ff9..d4018b9b615dae2b9e30517be51322656601b171 100644
--- a/src/main/java/net/minecraft/server/VillagePlaceSection.java --- a/src/main/java/net/minecraft/server/VillagePlaceSection.java
+++ b/src/main/java/net/minecraft/server/VillagePlaceSection.java +++ b/src/main/java/net/minecraft/server/VillagePlaceSection.java
@@ -23,12 +23,12 @@ public class VillagePlaceSection { @@ -23,12 +23,12 @@ public class VillagePlaceSection {
@ -263,7 +254,7 @@ index e82dcdbce698e2e9bc449fa639b7219821844e14..3aaba7fcaf83a491b9da60d156b7f237
return villageplacesection.e; return villageplacesection.e;
}), VillagePlaceRecord.a(runnable).listOf().fieldOf("Records").forGetter((villageplacesection) -> { }), VillagePlaceRecord.a(runnable).listOf().fieldOf("Records").forGetter((villageplacesection) -> {
diff --git a/src/main/java/net/minecraft/server/VillagePlaceType.java b/src/main/java/net/minecraft/server/VillagePlaceType.java diff --git a/src/main/java/net/minecraft/server/VillagePlaceType.java b/src/main/java/net/minecraft/server/VillagePlaceType.java
index 5bd3bcc2b96f7da21d363809a547b0567407ee75..1fb87bf395ced15bc3ef383dae46a42c5e4d2547 100644 index a5718af9b614ae505067131f04ebb490617d6aa4..142b47df08991a3e72c9f7927af6933a72f7b4cb 100644
--- a/src/main/java/net/minecraft/server/VillagePlaceType.java --- a/src/main/java/net/minecraft/server/VillagePlaceType.java
+++ b/src/main/java/net/minecraft/server/VillagePlaceType.java +++ b/src/main/java/net/minecraft/server/VillagePlaceType.java
@@ -14,11 +14,20 @@ import java.util.stream.Collectors; @@ -14,11 +14,20 @@ import java.util.stream.Collectors;
@ -272,7 +263,7 @@ index 5bd3bcc2b96f7da21d363809a547b0567407ee75..1fb87bf395ced15bc3ef383dae46a42c
+ static Set<VillagePlaceType> professionCache; // Yatopia + static Set<VillagePlaceType> professionCache; // Yatopia
private static final Supplier<Set<VillagePlaceType>> y = Suppliers.memoize(() -> { private static final Supplier<Set<VillagePlaceType>> y = Suppliers.memoize(() -> {
return (Set) IRegistry.VILLAGER_PROFESSION.e().map(VillagerProfession::b).collect(Collectors.toSet()); return (Set) IRegistry.VILLAGER_PROFESSION.g().map(VillagerProfession::b).collect(Collectors.toSet());
}); });
public static final Predicate<VillagePlaceType> a = (villageplacetype) -> { public static final Predicate<VillagePlaceType> a = (villageplacetype) -> {
- return ((Set) VillagePlaceType.y.get()).contains(villageplacetype); - return ((Set) VillagePlaceType.y.get()).contains(villageplacetype);

View File

@ -12,10 +12,10 @@ This changes it so that the portal list is filtered to only include portals with
Ported to Yatopia and added per world config option by MrIvanPlays <ivan@mrivanplays.com> Ported to Yatopia and added per world config option by MrIvanPlays <ivan@mrivanplays.com>
diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java diff --git a/src/main/java/de/minebench/origami/OrigamiConfig.java b/src/main/java/de/minebench/origami/OrigamiConfig.java
index e0bd3efb0a856774600b8b5487ec7e2b5b81f41d..bac1314a698a07a90f7d577911dc3d20a9047bd9 100644 index 965cc06a826c7d827e6b9a9e586738bfddc974d8..8d6b24c92df72921e5cc81f4892cc9607a33db52 100644
--- a/src/main/java/de/minebench/origami/OrigamiConfig.java --- a/src/main/java/de/minebench/origami/OrigamiConfig.java
+++ b/src/main/java/de/minebench/origami/OrigamiConfig.java +++ b/src/main/java/de/minebench/origami/OrigamiConfig.java
@@ -161,6 +161,11 @@ public final class OrigamiConfig { @@ -162,6 +162,11 @@ public final class OrigamiConfig {
&& pillagerCollisions && ironGolemCollisions && miscCollisions && itemCollisions && pillagerCollisions && ironGolemCollisions && miscCollisions && itemCollisions
&& waterCreatureCollisions && waterAmbientCollisions; && waterCreatureCollisions && waterAmbientCollisions;
} }
@ -28,30 +28,31 @@ index e0bd3efb0a856774600b8b5487ec7e2b5b81f41d..bac1314a698a07a90f7d577911dc3d20
} }
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 68f693de5eaa5eaa8dc65230ffa95556530c2368..d98cef12e1ad78026bc6cdeeedcb3b724fca8b0b 100644 index 934ac7fdfa040f1e00fb78b525b801ed525dae7e..7f510d56eacdb4432fb4576de3184f67e4353170 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -59,6 +59,15 @@ public class PortalTravelAgent { @@ -30,13 +30,23 @@ public class PortalTravelAgent {
}, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius }).thenComparingInt((villageplacerecord) -> {
boolean seen = false; return villageplacerecord.f().getY();
VillagePlaceRecord best = null; });
- List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY);
+ java.util.List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY).collect(java.util.stream.Collectors.toList());
+ // Yatopia start - fix portal bug + // Yatopia start - fix portal bug
+ if (world.origamiConfig.useBlockDistanceInPortalSearchRadius) { + if (world.origamiConfig.useBlockDistanceInPortalSearchRadius) {
+ list.removeIf(villagePlaceRecord -> { + list.removeIf(villagePlaceRecord -> {
+ BlockPosition portalPosition = villagePlaceRecord.getPosition(); + BlockPosition portalPosition = villagePlaceRecord.getPosition();
+ return Math.abs(portalPosition.getX() - blockposition.getX()) > searchRadius + return Math.abs(portalPosition.getX() - blockposition.getX()) > world.paperConfig.portalSearchRadius
+ || Math.abs(portalPosition.getZ() - blockposition.getZ()) > searchRadius; + || Math.abs(portalPosition.getZ() - blockposition.getZ()) > world.paperConfig.portalSearchRadius;
+ }); + });
+ } + }
+ if (!list.isEmpty()) { + if (!list.isEmpty()) {
Comparator<VillagePlaceRecord> comparator = Comparator.<VillagePlaceRecord>comparingDouble((villageplacerecord) -> { // CraftBukkit - decompile error for (VillagePlaceRecord villagePlaceRecord : list) {
return villageplacerecord.f().j(blockposition); if (!seen || comparator.compare(villagePlaceRecord, best) < 0) {
}).thenComparingInt((villageplacerecord) -> { seen = true;
@@ -70,6 +79,7 @@ public class PortalTravelAgent {
best = villagePlaceRecord; best = villagePlaceRecord;
} }
} }
+ } // Yatopia end + } // Yatopia end
Optional<VillagePlaceRecord> optional = seen ? Optional.of(best) : Optional.empty(); Optional<VillagePlaceRecord> optional = seen ? Optional.of(best) : Optional.empty();
return (ShapeDetector.Shape) optional.map((villageplacerecord) -> { return optional.map((villageplacerecord) -> {

File diff suppressed because it is too large Load Diff

View File

@ -5,5 +5,5 @@ cd Tuinity
git clean -fx git clean -fx
git clean -fd git clean -fd
git fetch git fetch
git reset --hard origin/ver/1.16 git reset --hard origin/1.16.2tmp
git submodule update --init --recursive -f git submodule update --init --recursive -f