[WIP] Better Patch System (#18)

* Update build.yml

* Remove 3rd party patches

* Add Upsteam Submodules

* Fix patches

* ?

* Fix patches

* Add Fast Init script

* Lots of stuff

also it's broke

* more broken

* fixes

* mor stuff

* gfhfgh

hg

* fix patch

* fix up script

* update submodule

* add papercut

* update tuinity

* update gitmodules

* fix var name

* fix more var stuff

* some how it's not deleting shit anymore

* should now use the branch it just made

why are we doing this again?

* now it does thing thing

* return previous so YAPFA can use it

* ok now it really does the thing

* for REAL it does the thing

* don't do the thing because it causes too many problems

* fix api

* work

* use better patching for YAPFA patches

* fix better patching

* more fixes

* new patches stuff

* remove old 3rd parry patches add removed akarin patches

* make new branch for making patches

* hopefully build patches correctly

* fix gitignore and add config patches

* remove papercut files

* fix some weirdness

* fix bug

* time to do some fixin' 👀

* New Patch System Rebased Patches

* fix full build

* exit 1

* fix

* Remove patch

* Hopefully fix compile errors

* fixes

* this might work

* don't use rej for our patches

* tmp disable cache

* some times case sensitivity is dumb

* my sanity is at an all time low :)

* dfg

* readd cahce

* fix?

* Update Upstream

* fix perms

* fix

* fix api

* Redo API

* rm folders

* fix villager brain patch

* emc explosion pref

* fixed aikar's shit

* betterfix

* fix lagggg

* Origami

* Origami Fixes

* Update readme

* test async path finding

* WIP Async Path Finding

* WIP fix async path finding

* same as bellow

* same

* update to newer funcs

* fix newer funcs

* fix author

* Updates, Fixes, and new patches

* fixes

* possibly async flying path finding

* minor asnyc pathfinding fix

* test remove non asnyc path finder

* WIP make all path finding async

* Rename everything

* Exec flag

* Rebuild hashes

* remove dupe patch

* fix?

* Fix packages, redirect config

* old nav class is now async and back

* add getchatcolor.getbyid and handle patches with a . in them better

Co-authored-by: tr7zw <tr7zw@live.de>
Co-authored-by: Unknown <unknown@example.com>
Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
This commit is contained in:
budgidiere 2020-08-03 11:48:42 -05:00 committed by GitHub
parent a448ac5ebf
commit ff560e687c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
78 changed files with 2503 additions and 1162 deletions

View File

@ -44,10 +44,10 @@ jobs:
properties: '[{"maven.compiler.target": "${{ matrix.java }}"}]'
- name: Setup Yatopia Project
run: |
git submodule update --init --recursive -f
git config --global user.email "ci@github.com"
git config --global user.name "Github CI"
sudo chmod -R -f 777 scripts
sudo chmod -R -f 777 scripts
./yatopia init
- name: Build Maven Depends
if: steps.maven-cache.outputs.cache-hit != 'true'
run: |
@ -56,7 +56,7 @@ jobs:
cd ..//
- name: Build Yatopia
run: |
./yapfa full
./yatopia full
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:

View File

@ -19,7 +19,7 @@ jobs:
git submodule update --init --recursive
git config --global user.email "ci@github.com"
git config --global user.name "Github CI"
yapfaDir=`pwd`
yatopiaDir=`pwd`
cd Tuinity
pwd
git status

24
.gitignore vendored
View File

@ -1,11 +1,29 @@
Spigot
YAPFA-Server
YAPFA-API
Yatopia-Server
Yatopia-API
mc-dev
*.iml
.settings/org.eclipse.m2e.core.prefs
.project
.idea
yapfa-paperclip.jar
yatopia-paperclip.jar
target
target/site/surefire-report.html
/patches/Akarin/**
/patches/Purpur/**
/patches/Empirecraft/**
/patches/Papercut/**
/patches/Origami/**
!/patches/Purpur/server.txt
!/patches/Purpur/api.txt
!/patches/Empirecraft/server.txt
!/patches/Empirecraft/api.txt
!/patches/Akarin/server.txt
!/patches/Akarin/api.txt
!/patches/Papercut/server.txt
!/patches/Papercut/api.txt
!/patches/Origami/server.txt
!/patches/Origami/api.txt
yatopia-1.16.1-paperclip.jar

26
.gitmodules vendored
View File

@ -2,3 +2,29 @@
path = Tuinity
url = https://github.com/tsao-chi/Tuinity-autoupstreamupdate.git
branch = ver/1.16
update = merge
[submodule "Akarin"]
path = Akarin
url = https://github.com/Akarin-project/Akarin
branch = 1.16.1
update = merge
[submodule "Purpur"]
path = Purpur
url = https://github.com/pl3xgaming/Purpur.git
branch = ver/1.16
update = merge
[submodule "Empirecraft"]
path = Empirecraft
url = https://github.com/starlis/empirecraft.git
branch = master
update = merge
[submodule "Papercut"]
path = Papercut
url = https://github.com/Minevictus/Papercut.git
branch = ver/1.16
update = merge
[submodule "Origami"]
path = Origami
url = https://github.com/MrIvanPlays/Origami/
branch = master
update = merge

1
Akarin Submodule

@ -0,0 +1 @@
Subproject commit 3cd947fb6ea6678dc160c33907b5dcb8bb5d5f16

1
Empirecraft Submodule

@ -0,0 +1 @@
Subproject commit 27b18f0d50df76e7bd56e11a985dd4d9ec43e961

1
Origami Submodule

@ -0,0 +1 @@
Subproject commit 7510dd6fb0bacf10d86de38599b24b3bee4771fa

1
Papercut Submodule

@ -0,0 +1 @@
Subproject commit f521235dc2dd5deaf57631fe4aa52cbe4d06d64a

1
Purpur Submodule

@ -0,0 +1 @@
Subproject commit e486798b7df7394bcdf8143b6c96cc0f8f8d4ec2

View File

@ -5,7 +5,7 @@ # Yatopia (formerly YAPFA)
## What ##
This Fork tries to import universal/performance patches from [EMC](https://github.com/starlis/empirecraft), [Lithium](https://github.com/jellysquid3/lithium-fabric), [Akarin](https://github.com/Akarin-project/Akarin), [Papercut](https://github.com/Minevictus/Papercut/) and [Purpur](https://github.com/pl3xgaming/Purpur) while adding a few more (optional via config) "extreme" patches that modify the vanilla Minecraft gameplay for more performance (notable killing entity pushing/collision boxes). This fork was based on [Paper](https://github.com/PaperMC/Paper) but is now based on [Tuinity](https://github.com/Spottedleaf/Tuinity).
This Fork tries to import universal/performance patches from [EMC](https://github.com/starlis/empirecraft), [Lithium](https://github.com/jellysquid3/lithium-fabric), [Akarin](https://github.com/Akarin-project/Akarin), [Papercut](https://github.com/Minevictus/Papercut/), [Origami](https://github.com/MrIvanPlays/Origami) and [Purpur](https://github.com/pl3xgaming/Purpur) while adding a few more (optional via config) "extreme" patches that modify the vanilla Minecraft gameplay for more performance (notable killing entity pushing/collision boxes). This fork is based on [Tuinity](https://github.com/Spottedleaf/Tuinity).
## Config entries
@ -41,14 +41,14 @@ ## Building and setting up
```
git submodule update --init --recursive --force
./yapfa jar
./yatopia full
```
## LICENSE
Everything is licensed under the MIT license and is free to be used in your own fork.
See [EMC](https://github.com/starlis/empirecraft), [Lithium](https://github.com/jellysquid3/lithium-fabric), [Akarin](https://github.com/Akarin-project/Akarin), [Purpur](https://github.com/pl3xgaming/Purpur), [Papercut](https://github.com/Minevictus/Papercut/) and [Tuinity](https://github.com/Spottedleaf/Tuinity)
See [EMC](https://github.com/starlis/empirecraft), [Lithium](https://github.com/jellysquid3/lithium-fabric), [Akarin](https://github.com/Akarin-project/Akarin), [Purpur](https://github.com/pl3xgaming/Purpur), [Papercut](https://github.com/Minevictus/Papercut/), [Origami](https://github.com/MrIvanPlays/Origami) and [Tuinity](https://github.com/Spottedleaf/Tuinity)
for the license of material used/modified by this project.
**To use this project you'll have to accept the Mojang EULA!**

2
api
View File

@ -1 +1 @@
YAPFA-API/
Yatopia-API/

1
patches/Akarin/api.txt Normal file
View File

@ -0,0 +1 @@
Add-server-configuration&Remove-Streams-using-IntelliJ-IDEA

View File

@ -0,0 +1 @@
Akarin-configuration&Disable-the-Snooper&Avoid-double-I-O-operation-on-load-player-file&Remove-vanilla-profiler-callers&Swaps-the-predicate-order-of-collision&Remove-stream-for-ender-teleport&Remove-a-few-more-streams&Remove-Streams-using-IntelliJ-IDEA

View File

@ -0,0 +1 @@
Fix-PlayerInteractEvent-for-Armor-Stands&Add-ChatColor.getById

View File

@ -0,0 +1 @@
Improved-BungeeCord-support&Improve-Hopper-Performance&Don-t-trigger-Lootable-Refresh-for-non-player-intera&Tweak-Explosions&dont-load-chunks-for-physics

1
patches/Origami/api.txt Normal file
View File

@ -0,0 +1 @@
Remove-reload-command

View File

@ -0,0 +1 @@
Origami-config&Port-optimized-redstone-algorithm&Optimize-Pathfinder&Optimize-BehaviorController&Better-handling-of-tracker-timings-in-PlayerChunkMap

1
patches/Papercut/api.txt Normal file
View File

@ -0,0 +1 @@
Ban-EntityTrackerFixer

View File

@ -0,0 +1 @@
Add-Papercut-config&Apply-advancements-async

1
patches/Purpur/api.txt Normal file
View File

@ -0,0 +1 @@
Default-permissions

View File

@ -0,0 +1 @@
Purpur-config-files&Lagging-threshold&Configurable-villager-brain-ticks&Alternative-Keepalive-Handling&Fix-outdated-server-showing-in-ping-before-server-fu&Dont-send-useless-entity-packets&Fix-the-dead-lagging-the-server&Skip-events-if-there-s-no-listeners&Add-permission-for-F3-N-debug&Configurable-TPS-Catchup&Add-option-to-disable-saving-projectiles-to-disk&Add-5-second-tps-average-in-tps

View File

@ -0,0 +1,77 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bud Gidiere <sgidiere@gmail.com>
Date: Sat, 1 Aug 2020 15:51:06 -0500
Subject: [PATCH] Yatopia API Bundle
Lagging threshold + Purpur & Papercut & Origami config
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 62cc1c74c11f56dcbd1e24e9c5478497742e6351..0770736b4b52f325027671b43f74ad038c97ce7f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1776,4 +1776,15 @@ public final class Bukkit {
public static Server.Spigot spigot() {
return server.spigot();
}
+
+ // Purpur start
+ /**
+ * Check if server is lagging according to laggy threshold setting
+ *
+ * @return True if lagging
+ */
+ public static boolean isLagging() {
+ return server.isLagging();
+ }
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1f916988bd54e8386011b0d7e82fc9219939a881..6ff5c73f607d1c1a3bc392fda2c0e8b492aab579 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1463,6 +1463,31 @@ public interface Server extends PluginMessageRecipient {
}
// Akarin end - Server config
+ // Papercut start
+ @NotNull
+ public org.bukkit.configuration.file.YamlConfiguration getPapercutConfig()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Purpur start
+ @NotNull
+ public org.bukkit.configuration.file.YamlConfiguration getPurpurConfig() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @NotNull
+ public java.util.Properties getServerProperties() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Purpur end
+ // Origami start - add config to timings report
+ @NotNull
+ public org.bukkit.configuration.file.YamlConfiguration getOrigamiConfig()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ // Origami end
+
/**
* Sends the component to the player
*
@@ -1563,4 +1588,13 @@ public interface Server extends PluginMessageRecipient {
@NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
// Paper end
+
+ // Purpur start
+ /**
+ * Check if server is lagging according to laggy threshold setting
+ *
+ * @return True if lagging
+ */
+ boolean isLagging();
+ // Purpur end
}

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 17:03:06 +0100
From: Bud Gidiere <sgidiere@gmail.com>
Date: Sat, 1 Aug 2020 15:51:49 -0500
Subject: [PATCH] Modify POM
diff --git a/pom.xml b/pom.xml
index 4004ff5d3b9285c737dffcfee5ab48a164de6fc9..2659ac2ae914807a9f3eff0244d3f7601e22f1cc 100644
index 4004ff5d3b9285c737dffcfee5ab48a164de6fc9..d0a4f91ed6a50e71644ef99fbb31986547454853 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,18 +3,18 @@
@ -14,21 +14,21 @@ index 4004ff5d3b9285c737dffcfee5ab48a164de6fc9..2659ac2ae914807a9f3eff0244d3f760
<parent>
- <groupId>com.tuinity</groupId>
- <artifactId>tuinity-parent</artifactId>
+ <groupId>de.tr7zw.yapfa</groupId>
+ <artifactId>yapfa-parent</artifactId>
+ <groupId>dev.tr7zw.yatopia</groupId>
+ <artifactId>yatopia-parent</artifactId>
<version>dev-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>tuinity-api</artifactId>
+ <artifactId>yapfa-api</artifactId>
+ <artifactId>yatopia-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Tuinity-API</name>
- <url>https://github.com/Spottedleaf/Tuinity</url>
+ <name>YAPFA-API</name>
+ <url>https://github.com/tr7zw/YAPFA</url>
+ <name>Yatopia-API</name>
+ <url>https://github.com/tr7zw/Yatopia</url>
<description>An enhanced plugin API for Minecraft servers.</description>
<properties>

View File

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 20:10:31 +0100
From: Bud Gidiere <sgidiere@gmail.com>
Date: Sat, 1 Aug 2020 15:52:19 -0500
Subject: [PATCH] Kill AnnotationTest

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 22:21:14 +0100
From: Bud Gidiere <sgidiere@gmail.com>
Date: Sat, 1 Aug 2020 15:52:50 -0500
Subject: [PATCH] Add GameProfileLookupEvent
diff --git a/pom.xml b/pom.xml
index 2659ac2ae914807a9f3eff0244d3f7601e22f1cc..1d705769fb9d7764c1b9e4a16e791cd7764dcc50 100644
index d0a4f91ed6a50e71644ef99fbb31986547454853..3a49ca4b8af1c9715cda8efde3d09efef92354fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,6 +39,10 @@
@ -23,7 +23,7 @@ index 2659ac2ae914807a9f3eff0244d3f7601e22f1cc..1d705769fb9d7764c1b9e4a16e791cd7
</pluginRepositories>
<dependencies>
+ <!-- Authlib for Gameprofiles -->
+ <!-- Authlib for Gameprofiles -->
+ <dependency>
+ <groupId>com.mojang</groupId>
+ <artifactId>authlib</artifactId>
@ -33,13 +33,13 @@ index 2659ac2ae914807a9f3eff0244d3f7601e22f1cc..1d705769fb9d7764c1b9e4a16e791cd7
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
diff --git a/src/main/java/de/tr7zw/yapfa/events/GameProfileLookupEvent.java b/src/main/java/de/tr7zw/yapfa/events/GameProfileLookupEvent.java
diff --git a/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java b/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..4ab5fd191b74bcce59ea700f6bcc7b1bab65f13e
index 0000000000000000000000000000000000000000..ff58b8875a07b34de02b9b479ff3e6daf66d7832
--- /dev/null
+++ b/src/main/java/de/tr7zw/yapfa/events/GameProfileLookupEvent.java
+++ b/src/main/java/dev/tr7zw/yatopia/events/GameProfileLookupEvent.java
@@ -0,0 +1,45 @@
+package de.tr7zw.yapfa.events;
+package dev.tr7zw.yatopia.events;
+
+import java.util.UUID;
+

View File

@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Thu, 5 Mar 2020 21:13:14 +0100
Subject: [PATCH] Add getLastTickMs() api
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 62cc1c74c11f56dcbd1e24e9c5478497742e6351..c5d497cb33ecc65c256a39b72453a135bb67d205 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1771,6 +1771,14 @@ public final class Bukkit {
return server.getMobGoals();
}
// Paper end
+
+ // YAPFA start
+
+ public static long getLastTickMs() {
+ return server.getLastTickMs();
+ }
+
+ // YAPFA end
@NotNull
public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 46c4d98ce32a0b1d8cfd391f2c7a9566a045cb55..eec88dfd1f7d2c9a46dc6d623f87c01420b94212 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1555,4 +1555,15 @@ public interface Server extends PluginMessageRecipient {
@NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
// Paper end
+
+ // YAPFA start
+
+ /**
+ * Get the ms the last servertick took
+ *
+ * @return Last ticks ms
+ */
+ long getLastTickMs();
+
+ // YAPFA end
}

View File

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bud Gidiere <sgidiere@gmail.com>
Date: Sat, 1 Aug 2020 15:54:43 -0500
Subject: [PATCH] Add getLastTickMs api
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0770736b4b52f325027671b43f74ad038c97ce7f..537e7fc9273b7e4ecc88eaad5b1a69d3864740d0 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1787,4 +1787,10 @@ public final class Bukkit {
return server.isLagging();
}
// Purpur end
+
+ // Yatopia start
+ public static long getLastTickMs() {
+ return server.getLastTickMs();
+ }
+ // Yatopia end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 6ff5c73f607d1c1a3bc392fda2c0e8b492aab579..09a710dd500e404b382e75b62f1f2533da270ff3 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1597,4 +1597,13 @@ public interface Server extends PluginMessageRecipient {
*/
boolean isLagging();
// Purpur end
+
+ // Yatopia start
+ /**
+ * Get the ms the last servertick took
+ *
+ * @return Last ticks ms
+ */
+ long getLastTickMs();
+ // Yatopia end
}

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Thu, 2 Apr 2020 18:49:56 +0200
Subject: [PATCH] Add NBT-API as first-class lib
From: Bud Gidiere <sgidiere@gmail.com>
Date: Sat, 1 Aug 2020 15:55:15 -0500
Subject: [PATCH] Add NBT API as first class lib
diff --git a/pom.xml b/pom.xml
index 1d705769fb9d7764c1b9e4a16e791cd7764dcc50..897f536837bd33e25c7a1a0f7a2c6bc8575291c9 100644
index 3a49ca4b8af1c9715cda8efde3d09efef92354fe..9338a6a97d9ac2ce010928ffe330fc791030c0f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,6 +43,11 @@
@ -46,7 +46,7 @@ index 1d705769fb9d7764c1b9e4a16e791cd7764dcc50..897f536837bd33e25c7a1a0f7a2c6bc8
</plugin>
<plugin>
diff --git a/src/main/java/org/bukkit/block/TileState.java b/src/main/java/org/bukkit/block/TileState.java
index 3b10fcc13893403b29f0260b8605144679e89b82..acb13596874191f9356a25befa49af73dab3dc58 100644
index 3b10fcc13893403b29f0260b8605144679e89b82..8e56171795cb9110fa10f5cd98083abc30e67b41 100644
--- a/src/main/java/org/bukkit/block/TileState.java
+++ b/src/main/java/org/bukkit/block/TileState.java
@@ -4,6 +4,8 @@ import org.bukkit.persistence.PersistentDataContainer;
@ -62,17 +62,17 @@ index 3b10fcc13893403b29f0260b8605144679e89b82..acb13596874191f9356a25befa49af73
@NotNull
@Override
PersistentDataContainer getPersistentDataContainer();
+
+ // YAPFA start
+
+
+ // Yatopia start
+
+ public default NBTTileEntity getNBT() {
+ return new NBTTileEntity(this);
+ return new NBTTileEntity(this);
+ }
+
+ // YAPFA end
+
+ // Yatopia end
}
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 7808ade92ccd3553056c57cdf77464fb8bdf9312..54c213b6e9c4046fdadb93a650ca5976c83c5643 100644
index 7808ade92ccd3553056c57cdf77464fb8bdf9312..7ee13b985d1e408593a84825531e457e9fbcc4b0 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -23,6 +23,9 @@ import org.jetbrains.annotations.Contract;
@ -89,21 +89,21 @@ index 7808ade92ccd3553056c57cdf77464fb8bdf9312..54c213b6e9c4046fdadb93a650ca5976
*/
public boolean isInLava();
// Paper end
+
+ // YAPFA start
+
+
+ // Yatopia start
+
+ public default NBTEntity getNBT() {
+ return new NBTEntity(this);
+ return new NBTEntity(this);
+ }
+
+
+ public default NBTCompound getNBTC() {
+ return getNBT().getPersistentDataContainer();
+ return getNBT().getPersistentDataContainer();
+ }
+
+ // YAPFA end
+
+ // Yatopia end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index ccd81fca25233c2a9c2a8c3f4dda3053d7b2e723..433d29ba0efd9782f556266fed33492c195c13c2 100644
index ccd81fca25233c2a9c2a8c3f4dda3053d7b2e723..802e6c620c831a7187fc52841c110c2934ab8d1b 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -1,6 +1,10 @@
@ -121,20 +121,20 @@ index ccd81fca25233c2a9c2a8c3f4dda3053d7b2e723..433d29ba0efd9782f556266fed33492c
return itemMeta.hasItemFlag(flag);
}
// Paper end
+
+ // YAPFA start
+
+
+ // Yatopia start
+
+ public NBTItem getNBT() {
+ return new NBTItem(this);
+ return new NBTItem(this);
+ }
+
+
+ public void setNBT(NBTItem nbt) {
+ ItemStack nbtItem = nbt.getItem();
+ setType(nbtItem.getType());
+ setAmount(nbtItem.getAmount());
+ setData(nbtItem.getData());
+ setItemMeta(nbtItem.getItemMeta());
+ ItemStack nbtItem = nbt.getItem();
+ setType(nbtItem.getType());
+ setAmount(nbtItem.getAmount());
+ setData(nbtItem.getData());
+ setItemMeta(nbtItem.getItemMeta());
+ }
+
+ // YAPFA end
+
+ // Yatopia end
}

View File

@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 24 Apr 2017 20:27:23 -0400
Subject: [PATCH] EMC Add ChatColor.getById
Bukkit has had a map of this for years and it was totally unused...
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
index 4594701d77c5d0f744bece871b98d9f6f73eb5a7..06bdfddb7b1acb7bb7b347ad1aa13bff0c823ab1 100644
--- a/src/main/java/org/bukkit/ChatColor.java
+++ b/src/main/java/org/bukkit/ChatColor.java
@@ -263,6 +263,15 @@ public enum ChatColor {
return net.md_5.bungee.api.ChatColor.RESET;
};
+ /**
+ * Gets the numeric ID associated with this color
+ *
+ * @return An int value of this color code
+ */
+ public int getId() {
+ return intCode;
+ }
+
/**
* Gets the char value associated with this color
*
@@ -296,6 +305,17 @@ public enum ChatColor {
return !isFormat && this != RESET;
}
+ /**
+ * Gets the color represented by the specified color ID
+ *
+ * @param id Code to check
+ * @return Associative {@link org.bukkit.ChatColor} with the given id,
+ * or null if it doesn't exist
+ */
+ public static ChatColor getById(int id) {
+ return BY_ID.get(id);
+ }
+
/**
* Gets the color represented by the specified color code
*

View File

@ -0,0 +1,724 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bud Gidiere <sgidiere@gmail.com>
Date: Fri, 31 Jul 2020 22:39:43 -0500
Subject: [PATCH] Yatopia Server Fixes
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index 841a8d2b392acdcef90592b841cbbcb2237c6901..c9cd3f6e6bb779ecaf0412c21e0dc654321eb44f 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -232,6 +232,8 @@ public class TimingsExport extends Thread {
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("akarin", mapAsJSON(Bukkit.spigot().getAkarinConfig(), null)) // Akarin - Server config
+ , pair("papercut", mapAsJSON(Bukkit.spigot().getPapercutConfig(), null)) // Papercut
+ , pair("origami", mapAsJSON(Bukkit.spigot().getOrigamiConfig(), null)) // Origami
));
new TimingsExport(listeners, parent, history).start();
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java.rej b/src/main/java/co/aikar/timings/TimingsExport.java.rej
deleted file mode 100644
index aad8019b2c23b72bfad58a507671cd750bdc1a20..0000000000000000000000000000000000000000
--- a/src/main/java/co/aikar/timings/TimingsExport.java.rej
+++ /dev/null
@@ -1,9 +0,0 @@
-diff a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java (rejected hunks)
-@@ -231,6 +231,7 @@ public class TimingsExport extends Thread {
- pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
- 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("papercut", mapAsJSON(Bukkit.spigot().getPapercutConfig(), null)) // Papercut
- ));
-
- new TimingsExport(listeners, parent, history).start();
diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
index dee9655b89d061ec8218ea2c54660c6003e8548f..253b73cfc597d4c7106d969be7b18c68166128ae 100644
--- a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
+++ b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java
@@ -295,7 +295,7 @@ public final class PaperTickList<T> extends TickListServer<T> { // extend to avo
this.shortScheduledIndex = getNextIndex(this.shortScheduledIndex, SHORT_SCHEDULE_TICK_THRESHOLD);
this.timingCleanup.stopTiming();
- this.world.getMethodProfiler().exitEnter("ticking");
+ //this.world.getMethodProfiler().exitEnter("ticking"); // Akarin - remove caller
this.timingTicking.startTiming();
for (final NextTickListEntry<T> toTick : this.toTickThisTick) {
diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java.rej b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java.rej
deleted file mode 100644
index c9fa39c5b4b013b56720e339463ffcb5fd3c13f9..0000000000000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java.rej
+++ /dev/null
@@ -1,10 +0,0 @@
-diff a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java (rejected hunks)
-@@ -283,7 +283,7 @@ public final class PaperTickList<T> extends TickListServer<T> { // extend to avo
- this.nextTick = this.world.getTime() + 1;
-
- this.timingCleanup.stopTiming();
-- this.world.getMethodProfiler().exitEnter("ticking");
-+ //this.world.getMethodProfiler().exitEnter("ticking"); // Akarin - remove caller
- this.timingTicking.startTiming();
-
- for (final NextTickListEntry<T> toTick : this.toTickThisTick) {
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index ee10abb6bc4d957676e7eef377cdc68dc3f43370..c12f4326f68020fbb140e97f0ef43ddcf5a71072 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -974,11 +974,11 @@ public class ChunkProviderServer extends IChunkProvider {
player.playerNaturallySpawnedEvent = event;
}
// Paper end - optimize isOutisdeRange
- this.world.getMethodProfiler().enter("pollingChunks");
+ //this.world.getMethodProfiler().enter("pollingChunks"); // Akarin - remove caller
int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED);
boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
- this.world.getMethodProfiler().enter("naturalSpawnCount");
+ //this.world.getMethodProfiler().enter("naturalSpawnCount"); // Akarin - remove caller
this.world.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.chunkMapDistance.b();
// Paper start - per player mob spawning
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java.rej b/src/main/java/net/minecraft/server/ChunkProviderServer.java.rej
deleted file mode 100644
index d1152585c5f482e554966f965561626c78ac4d3a..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java.rej
+++ /dev/null
@@ -1,15 +0,0 @@
-diff a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java (rejected hunks)
-@@ -971,11 +971,11 @@ public class ChunkProviderServer extends IChunkProvider {
- player.lastEntitySpawnRadiusSquared = (double)((range << 4) * (range << 4)); // used in isOutsideRange
- }
- // Paper end - optimize isOutisdeRange
-- this.world.getMethodProfiler().enter("pollingChunks");
-+ //this.world.getMethodProfiler().enter("pollingChunks"); // Akarin - remove caller
- int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED);
- boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
-
-- this.world.getMethodProfiler().enter("naturalSpawnCount");
-+ //this.world.getMethodProfiler().enter("naturalSpawnCount"); // Akarin - remove caller
- this.world.timings.countNaturalMobs.startTiming(); // Paper - timings
- int l = this.chunkMapDistance.b();
- // Paper start - per player mob spawning
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 77b6e4dd34893f0959574f95078bc3fa6896e69c..ad1af2905e4f3e3d05a0dc63859a6e2f3bc43327 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -181,6 +181,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
// Paper end
com.tuinity.tuinity.config.TuinityConfig.init((java.io.File) options.valueOf("tuinity-settings")); // Tuinity - Server Config
app.akarin.server.Config.init((java.io.File) options.valueOf("akarin-settings")); // Akarin - Server Config
+ us.minevict.papercut.PapercutConfig.init((java.io.File) options.valueOf("papercut-settings")); // Papercut
+ com.mrivanplays.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - server config
this.setPVP(dedicatedserverproperties.pvp);
this.setAllowFlight(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java.rej b/src/main/java/net/minecraft/server/DedicatedServer.java.rej
deleted file mode 100644
index 6b1dd973eb1e44e530d525981fbe4c698088b9b8..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/DedicatedServer.java.rej
+++ /dev/null
@@ -1,9 +0,0 @@
-diff a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java (rejected hunks)
-@@ -171,6 +171,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
- com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
- // Paper end
- com.tuinity.tuinity.config.TuinityConfig.init((java.io.File) options.valueOf("tuinity-settings")); // Tuinity - Server Config
-+ us.minevict.papercut.PapercutConfig.init((java.io.File) options.valueOf("papercut-settings")); // Papercut
-
- this.setPVP(dedicatedserverproperties.pvp);
- this.setAllowFlight(dedicatedserverproperties.allowFlight);
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 70ae2923e21d7a0312e629a903ca9e380d6c6114..d906c5e530c2e7f779df079223aee619a73b5d51 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -164,6 +164,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
protected void mobTick() { mobTick(false); }
protected void mobTick(boolean inactive) {
//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 (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper
if (this.bM) {
this.bM = false;
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java.rej b/src/main/java/net/minecraft/server/EntityVillager.java.rej
deleted file mode 100644
index 68f0fc0230a4148ab9fc4181736ce93297c7e1b9..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityVillager.java.rej
+++ /dev/null
@@ -1,12 +0,0 @@
-diff a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java (rejected hunks)
-@@ -166,6 +168,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
- protected void mobTick() { mobTick(false); }
- protected void mobTick(boolean inactive) {
- this.world.getMethodProfiler().enter("villagerBrain");
-+ // Purpur start
-+ boolean tick = (world.getTime() + brainTickOffset) % world.purpurConfig.villagerBrainTicks == 0;
-+ if (((WorldServer) world).getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick)
-+ // Purpur end
- if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper
- if (this.bM) {
- this.bM = false;
diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java
index 9d6d882ad1479771b2a9e7c3a14c71dd00b63172..cc22d89d540a4f86e11d7d09ad2be7fcf070f43d 100644
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java
@@ -334,10 +334,14 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
private final java.util.List<Runnable> post = new java.util.ArrayList<>();
private void b() {
if (queue.poll(pre, post)) {
- pre.forEach(Runnable::run);
+ for (Runnable runnable1 : pre) {
+ runnable1.run();
+ }
pre.clear();
super.a(Integer.MAX_VALUE, true, true);
- post.forEach(Runnable::run);
+ for (Runnable runnable : post) {
+ runnable.run();
+ }
post.clear();
} else {
// might have level updates to go still
diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java.rej b/src/main/java/net/minecraft/server/LightEngineThreaded.java.rej
deleted file mode 100644
index 74d10212e547adf96762155adb03c0158df00a16..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java.rej
+++ /dev/null
@@ -1,18 +0,0 @@
-diff a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java (rejected hunks)
-@@ -288,10 +288,14 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
- int i = Math.min(queue.size(), 4);
- boolean ran = false;
- while (i-- > 0 && queue.poll(pre, post)) {
-- pre.forEach(Runnable::run);
-+ for (Runnable runnable1 : pre) {
-+ runnable1.run();
-+ }
- pre.clear();
- super.a(Integer.MAX_VALUE, true, true);
-- post.forEach(Runnable::run);
-+ for (Runnable runnable : post) {
-+ runnable.run();
-+ }
- post.clear();
- ran = true;
- }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index de1845b3585d7cf96bf26f5859e1cb4820ad2d56..e17119d37577de42f8d52afcfdfee64c33996941 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1001,7 +1001,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(this::canSleepForTick);
//this.methodProfiler.exitEnter("nextTickWait"); // Akarin - remove caller
this.X = true;
- this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
+ // Purpur start - tps catchup
+ if (net.pl3x.purpur.PurpurConfig.tpsCatchup) {
+ this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
+ } else {
+ this.W = this.nextTick = curTime / 1000000L + 50L;
+ }
+ // Purpur end - tps catchup
this.sleepForTick();
//this.methodProfiler.exit(); // Akarin - remove caller
//this.methodProfiler.b(); // Akarin - remove caller
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java.rej b/src/main/java/net/minecraft/server/MinecraftServer.java.rej
deleted file mode 100644
index b005dd817e9ecffcf2172b4a807b0ecc632570b0..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/MinecraftServer.java.rej
+++ /dev/null
@@ -1,16 +0,0 @@
-diff a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java (rejected hunks)
-@@ -1003,7 +1003,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
- this.a(this::canSleepForTick);
- this.methodProfiler.exitEnter("nextTickWait");
- this.X = true;
-- this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
-+ // Purpur start - tps catchup
-+ if (net.pl3x.purpur.PurpurConfig.tpsCatchup) {
-+ this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
-+ } else {
-+ this.W = this.nextTick = curTime / 1000000L + 50L;
-+ }
-+ // Purpur end - tps catchup
- this.sleepForTick();
- this.methodProfiler.exit();
- this.methodProfiler.b();
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index a91b540a9e35efc8746f74f039a8ab6cfbd37206..546f4c942b047a39e0aec10cc2009b90573484dd 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1169,7 +1169,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
this.getVillagePlace().loadInData(chunkcoordintpair, chunkHolder.poiData);
- chunkHolder.tasks.forEach(Runnable::run);
+ for (Runnable task : chunkHolder.tasks) {
+ task.run();
+ }
// Paper end
if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java.rej b/src/main/java/net/minecraft/server/PlayerChunkMap.java.rej
deleted file mode 100644
index 06b502a43f0e89b1b2cef8c3adb0a4229511846f..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java.rej
+++ /dev/null
@@ -1,12 +0,0 @@
-diff a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java (rejected hunks)
-@@ -1122,7 +1131,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
- if (ioThrowable != null) {
- com.destroystokyo.paper.util.SneakyThrow.sneaky(ioThrowable);
- }
-- chunkHolder.tasks.forEach(Runnable::run);
-+ for (Runnable task : chunkHolder.tasks) {
-+ task.run();
-+ }
- // Paper end
-
- if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async
diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
index 7fe085e48b6ad625a510edf33b112bef24f7d7ad..9459efde54d507231b4aacb7cba14e9905ebb4d7 100644
--- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
+++ b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
@@ -11,7 +11,18 @@ import org.bukkit.entity.HumanEntity;
public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable {
- private static final int[] a = IntStream.range(0, 27).toArray();
+ private static final int[] a;
+
+ static {
+ int[] arr = new int[10];
+ int count = 0;
+ for (int i1 = 0; i1 < 27; i1++) {
+ if (arr.length == count) arr = Arrays.copyOf(arr, count * 2);
+ arr[count++] = i1;
+ }
+ arr = Arrays.copyOfRange(arr, 0, count);
+ a = arr;
+ }
private NonNullList<ItemStack> contents;
public int c; // PAIL private -> public, rename viewerCount
private TileEntityShulkerBox.AnimationPhase i;
diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej
deleted file mode 100644
index bada470cba41cce9beb9eb04227b42c1d489d731..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej
+++ /dev/null
@@ -1,22 +0,0 @@
-diff a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java (rejected hunks)
-@@ -10,7 +11,19 @@ import org.bukkit.entity.HumanEntity;
-
- public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable {
-
-- private static final int[] a = IntStream.range(0, 27).toArray();
-+ private static final int[] a;
-+
-+ static {
-+ int[] arr = new int[10];
-+ int count = 0;
-+ for (int i1 = 0; i1 < 27; i1++) {
-+ if (arr.length == count) arr = Arrays.copyOf(arr, count * 2);
-+ arr[count++] = i1;
-+ }
-+ arr = Arrays.copyOfRange(arr, 0, count);
-+ a = arr;
-+ }
-+
- private NonNullList<ItemStack> contents;
- private int c;
- private TileEntityShulkerBox.AnimationPhase i;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index ce7a742f2a3b5c169b956c1a91819882b9b57955..2ab8412f20a77547c8bb12b927d23b2acb84965b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -96,6 +96,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public final com.tuinity.tuinity.config.TuinityConfig.WorldConfig tuinityConfig; // Tuinity - Server Config
public final app.akarin.server.Config.WorldConfig akarinConfig; // Akarin - Server Config
+ public final us.minevict.papercut.PapercutConfig.WorldConfig papercutConfig; // Papercut
+ public final net.pl3x.purpur.PurpurWorldConfig purpurConfig; // Purpur
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPosition lastPhysicsProblem; // Spigot
@@ -126,6 +128,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config
this.akarinConfig = new app.akarin.server.Config.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Akarin - Server Config
+ this.papercutConfig = new us.minevict.papercut.PapercutConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Papercut
+ this.purpurConfig = new net.pl3x.purpur.PurpurWorldConfig((((WorldDataServer)worlddatamutable).getName())); // Purpur
+
this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -646,6 +651,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.a(blockposition.south(), block, blockposition);
}
+ public void neighborChanged(BlockPosition pos, Block block, BlockPosition parent) { a(pos, block, parent); } // Origami - OBFHELPER
public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) {
if (enumdirection != EnumDirection.WEST) {
this.a(blockposition.west(), block, blockposition);
diff --git a/src/main/java/net/minecraft/server/World.java.rej b/src/main/java/net/minecraft/server/World.java.rej
deleted file mode 100644
index 6f7cf093021998e6ae0178fa851e82437d4f7f86..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/World.java.rej
+++ /dev/null
@@ -1,17 +0,0 @@
-diff a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java (rejected hunks)
-@@ -95,6 +95,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
- public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
-
- public final com.tuinity.tuinity.config.TuinityConfig.WorldConfig tuinityConfig; // Tuinity - Server Config
-+ public final net.pl3x.purpur.PurpurWorldConfig purpurConfig; // Purpur
-
- public final co.aikar.timings.WorldTimingsHandler timings; // Paper
- public static BlockPosition lastPhysicsProblem; // Spigot
-@@ -124,6 +125,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
- this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper
- this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
- this.tuinityConfig = new com.tuinity.tuinity.config.TuinityConfig.WorldConfig(((WorldDataServer)worlddatamutable).getName()); // Tuinity - Server Config
-+ this.purpurConfig = new net.pl3x.purpur.PurpurWorldConfig((((WorldDataServer)worlddatamutable).getName())); // Purpur
- this.generator = gen;
- this.world = new CraftWorld((WorldServer) this, gen, env);
- this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 64f7fc40a6847ebc6c84b3c179614e186f861e1f..3782d329dc62a9e834f16a9009f4102b5b4aad6f 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -943,7 +943,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
// CraftBukkit end */
- gameprofilerfiller.enter("checkDespawn");
+ //gameprofilerfiller.enter("checkDespawn"); // Akarin - remove caller
if (!entity.dead) {
entity.checkDespawn();
// Tuinity start - optimise notify()
@@ -955,7 +955,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// Tuinity end - optimise notify()
}
- gameprofilerfiller.exit();
+ //gameprofilerfiller.exit(); // Akarin - remove caller
if (entity1 != null) {
if (!entity1.dead && entity1.w(entity)) {
continue;
@@ -964,13 +964,13 @@ public class WorldServer extends World implements GeneratorAccessSeed {
entity.stopRiding();
}
- gameprofilerfiller.enter("tick");
+ //gameprofilerfiller.enter("tick"); // Akarin - remove caller
if (!entity.dead && !(entity instanceof EntityComplexPart)) {
this.a(this::entityJoinedWorld, entity);
}
- gameprofilerfiller.exit();
- gameprofilerfiller.enter("remove");
+ //gameprofilerfiller.exit(); // Akarin - remove caller
+ //gameprofilerfiller.enter("remove"); // Akarin - remove caller
if (entity.dead) {
this.removeEntityFromChunk(entity);
this.entitiesById.remove(entity.getId()); // Tuinity
@@ -982,7 +982,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
// Tuinity end - optimise notify()
- gameprofilerfiller.exit();
+ //gameprofilerfiller.exit(); // Akarin - remove caller
}
timings.entityTick.stopTiming(); // Spigot
@@ -1414,7 +1414,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// Tuinity end
}
- this.getMethodProfiler().exit();
+ // this.getMethodProfiler().exit(); // Akarin - remove caller
}
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java.rej b/src/main/java/net/minecraft/server/WorldServer.java.rej
deleted file mode 100644
index 87367c60dd036f8623d6593e73dd2412a477f6a4..0000000000000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/WorldServer.java.rej
+++ /dev/null
@@ -1,50 +0,0 @@
-diff a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java (rejected hunks)
-@@ -943,12 +943,12 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- }
- // CraftBukkit end */
-
-- gameprofilerfiller.enter("checkDespawn");
-+ //gameprofilerfiller.enter("checkDespawn"); // Akarin - remove caller
- if (!entity.dead) {
- entity.checkDespawn();
- }
-
-- gameprofilerfiller.exit();
-+ //gameprofilerfiller.exit(); // Akarin - remove caller
- if (entity1 != null) {
- if (!entity1.dead && entity1.w(entity)) {
- continue;
-@@ -957,20 +957,20 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- entity.stopRiding();
- }
-
-- gameprofilerfiller.enter("tick");
-+ //gameprofilerfiller.enter("tick"); // Akarin - remove caller
- if (!entity.dead && !(entity instanceof EntityComplexPart)) {
- this.a(this::entityJoinedWorld, entity);
- }
-
-- gameprofilerfiller.exit();
-- gameprofilerfiller.enter("remove");
-+ //gameprofilerfiller.exit(); // Akarin - remove caller
-+ //gameprofilerfiller.enter("remove"); // Akarin - remove caller
- if (entity.dead) {
- this.removeEntityFromChunk(entity);
- this.entitiesById.remove(entity.getId()); // Tuinity
- this.unregisterEntity(entity);
- }
-
-- gameprofilerfiller.exit();
-+ //gameprofilerfiller.exit(); // Akarin - remove caller
- }
- timings.entityTick.stopTiming(); // Spigot
-
-@@ -1377,7 +1377,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
- }
- }
-
-- this.getMethodProfiler().exit();
-+ //this.getMethodProfiler().exit(); // Akarin - remove caller
- }
- }
-
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 1d00832bffc2b6bcc6153b9065a92035ba974138..b3d6e713c2bfa1a0432b4afc3e8c31d4d7ca5844 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -127,4 +127,23 @@ public class PurpurConfig {
config.addDefault(path, def);
return config.getString(path, config.getString(path));
}
+
+ public static double laggingThreshold = 19.0D;
+ private static void tickLoopSettings() {
+ laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
+ }
+
+ public static boolean useAlternateKeepAlive = false;
+ private static void useAlternateKeepAlive() {
+ useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
+ }
+ public static boolean dontSendUselessEntityPackets = false;
+ private static void dontSendUselessEntityPackets() {
+ dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
+ }
+
+ public static boolean tpsCatchup = true;
+ private static void tpsCatchup() {
+ tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup);
+ }
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java.rej b/src/main/java/net/pl3x/purpur/PurpurConfig.java.rej
deleted file mode 100644
index ff05ff6aef1e0f61eb4437253020632745ee2bd2..0000000000000000000000000000000000000000
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java.rej
+++ /dev/null
@@ -1,11 +0,0 @@
-diff a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java (rejected hunks)
-@@ -194,4 +194,9 @@ public class PurpurConfig {
- loggerSuppressInitLegacyMaterialError = getBoolean("settings.logger.suppress-init-legacy-material-errors", loggerSuppressInitLegacyMaterialError);
- loggerSuppressIgnoredAdvancementWarnings = getBoolean("settings.logger.suppress-ignored-advancement-warnings", loggerSuppressIgnoredAdvancementWarnings);
- }
-+
-+ public static boolean tpsCatchup = true;
-+ private static void tpsCatchup() {
-+ tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup);
-+ }
- }
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 361f7857e461578e90cb71e15027dadaf794cb69..7cde55ae407012b3445f11b07a0ebc9d00e031e3 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -56,4 +56,16 @@ public class PurpurWorldConfig {
PurpurConfig.config.addDefault("world-settings.default." + path, def);
return PurpurConfig.config.getString("world-settings." + worldName + "." + path, PurpurConfig.config.getString("world-settings.default." + path));
}
+
+ public int villagerBrainTicks = 1;
+ public boolean villagerUseBrainTicksOnlyWhenLagging = true;
+ private void villagerSettings() {
+ villagerBrainTicks = getInt("mobs.villager.brain-ticks", villagerBrainTicks);
+ villagerUseBrainTicksOnlyWhenLagging = getBoolean("mobs.villager.use-brain-ticks-only-when-lagging", villagerUseBrainTicksOnlyWhenLagging);
+ }
+
+ public boolean saveProjectilesToDisk = true;
+ private void miscGameplayMechanicsSettings() {
+ saveProjectilesToDisk = getBoolean("gameplay-mechanics.save-projectiles-to-disk", saveProjectilesToDisk);
+ }
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java.rej b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java.rej
deleted file mode 100644
index 120d0df27e76c9beef9f09e6cdc0972454fdd4ca..0000000000000000000000000000000000000000
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java.rej
+++ /dev/null
@@ -1,15 +0,0 @@
-diff a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java (rejected hunks)
-@@ -113,11 +113,13 @@ public class PurpurWorldConfig {
- public boolean disableDropsOnCrammingDeath = false;
- public boolean entitiesPickUpLootBypassMobGriefing = false;
- public boolean milkCuresBadOmen = true;
-+ public boolean saveProjectilesToDisk = true;
- public double tridentLoyaltyVoidReturnHeight = 0.0D;
- private void miscGameplayMechanicsSettings() {
- disableDropsOnCrammingDeath = getBoolean("gameplay-mechanics.disable-drops-on-cramming-death", disableDropsOnCrammingDeath);
- entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
- milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
-+ saveProjectilesToDisk = getBoolean("gameplay-mechanics.save-projectiles-to-disk", saveProjectilesToDisk);
- tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
- }
-
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index afaa6ab4744190b134aeb616a1355cefd1333e37..d3cda38b5e87d433b18b2c28e4fb467a079160d3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -836,6 +836,9 @@ public final class CraftServer implements Server {
com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper
com.tuinity.tuinity.config.TuinityConfig.init((File) console.options.valueOf("tuinity-settings")); // Tuinity - Server Config
app.akarin.server.Config.init((File) console.options.valueOf("akarin-settings")); // Akarin - Server Config
+ us.minevict.papercut.PapercutConfig.init((File) console.options.valueOf("papercut-settings")); // Papercut
+ net.pl3x.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
+ com.mrivanplays.origami.OrigamiConfig.init((File) console.options.valueOf("origami-settings")); // Origami
for (WorldServer world : console.getWorlds()) {
world.worldDataServer.setDifficulty(config.difficulty);
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
@@ -872,6 +875,8 @@ public final class CraftServer implements Server {
world.paperConfig.init(); // Paper
world.tuinityConfig.init(); // Tuinity - Server Config
world.akarinConfig.init(); // Akarin - Server Config
+ world.papercutConfig.init(); // Papercut
+ world.purpurConfig.init(); // Purpur
}
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
@@ -2249,6 +2254,25 @@ public final class CraftServer implements Server {
}
// Akarin End - Server Config
+ // Papercut start - add config to timings report
+ @Override
+ public YamlConfiguration getPapercutConfig() { return us.minevict.papercut.PapercutConfig.config; }
+ // Papercut end - add config to timings report
+
+ // Purpur start
+ @Override
+ public YamlConfiguration getPurpurConfig() {
+ return net.pl3x.purpur.PurpurConfig.config;
+ }
+ /*@Override
+ public java.util.Properties getServerProperties() {
+ return getProperties().properties;
+ }*/
+ // Purpur end
+
+ @Override
+ public YamlConfiguration getOrigamiConfig() { return com.mrivanplays.origami.OrigamiConfig.config; } // Origami - add config to timings report
+
@Override
public void restart() {
org.spigotmc.RestartCommand.restart();
@@ -2388,4 +2412,11 @@ public final class CraftServer implements Server {
return mobGoals;
}
// Paper end
+
+ // Purpur start
+ @Override
+ public boolean isLagging() {
+ return getServer().lagging;
+ }
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java.rej b/src/main/java/org/bukkit/craftbukkit/CraftServer.java.rej
deleted file mode 100644
index b9d3fb83434a48b328cf0a0ae1ec29d93e87aa3e..0000000000000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java.rej
+++ /dev/null
@@ -1,12 +0,0 @@
-diff a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java (rejected hunks)
-@@ -2409,5 +2409,10 @@ public final class CraftServer implements Server {
- public String getServerName() {
- return getProperties().serverName;
- }
-+
-+ @Override
-+ public boolean isLagging() {
-+ return getServer().lagging;
-+ }
- // Purpur end
- }
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 2b1e0782df017078a742c206e437f61405f026f6..1df56d1e0b51b6ccd1794ffa83a8750d9731597c 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -138,6 +138,7 @@ public class Main {
.defaultsTo(new File("paper.yml"))
.describedAs("Yml file");
// Paper end
+
// Tuinity Start - Server Config
acceptsAll(asList("tuinity", "tuinity-settings"), "File for tuinity settings")
.withRequiredArg()
@@ -154,6 +155,22 @@ public class Main {
.describedAs("Yml file");
// Akarin End - Server Config
+ // Papercut start
+ acceptsAll(asList("papercut", "papercut-settings"), "File for papercut settings")
+ .withRequiredArg()
+ .ofType(File.class)
+ .defaultsTo(new File("papercut.yml"))
+ .describedAs("Yml file");
+ // Papercut end
+
+ // Purpur Start
+ acceptsAll(asList("purpur", "purpur-settings"), "File for purpur settings")
+ .withRequiredArg()
+ .ofType(File.class)
+ .defaultsTo(new File("purpur.yml"))
+ .describedAs("Yml file");
+ // Purpur end
+
// Paper start
acceptsAll(asList("server-name"), "Name of the server")
.withRequiredArg()
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java.rej b/src/main/java/org/bukkit/craftbukkit/Main.java.rej
deleted file mode 100644
index 5d35899d1bedbb8643a601a2e1731a9bc66c7b61..0000000000000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/Main.java.rej
+++ /dev/null
@@ -1,16 +0,0 @@
-diff a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java (rejected hunks)
-@@ -146,6 +146,14 @@ public class Main {
- .describedAs("Yml file");
- /* Conctete End - Server Config */
-
-+ // Purpur Start
-+ acceptsAll(asList("purpur", "purpur-settings"), "File for purpur settings")
-+ .withRequiredArg()
-+ .ofType(File.class)
-+ .defaultsTo(new File("purpur.yml"))
-+ .describedAs("Yml file");
-+ // Purpur end
-+
- // Paper start
- acceptsAll(asList("server-name"), "Name of the server")
- .withRequiredArg()

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Modify POM
diff --git a/pom.xml b/pom.xml
index 6fd59681784a5cc369f4903b4da0d11174b805f2..9152dbe177a3847a409d8985f8615f9f5f00506a 100644
index 6fd59681784a5cc369f4903b4da0d11174b805f2..e7f20c5654caa038b92963c45fc79747bd49beb5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,11 +1,11 @@
@ -13,13 +13,13 @@ index 6fd59681784a5cc369f4903b4da0d11174b805f2..9152dbe177a3847a409d8985f8615f9f
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>tuinity</artifactId>
+ <artifactId>yapfa</artifactId>
+ <artifactId>yatopia</artifactId>
<packaging>jar</packaging>
<version>1.16.1-R0.1-SNAPSHOT</version>
- <name>Tuinity-Server</name>
- <url>https://github.com/Spottedleaf/Tuinity</url>
+ <name>YAPFA-Server</name>
+ <url>https://github.com/tr7zw/YAPFA</url>
+ <name>Yatopia-Server</name>
+ <url>https://github.com/tr7zw/Yatopia</url>
<properties>
<!-- <skipTests>true</skipTests> Paper - This [was] not going to end well -->
@ -29,8 +29,8 @@ index 6fd59681784a5cc369f4903b4da0d11174b805f2..9152dbe177a3847a409d8985f8615f9f
<parent>
- <groupId>com.tuinity</groupId>
- <artifactId>tuinity-parent</artifactId>
+ <groupId>de.tr7zw.yapfa</groupId>
+ <artifactId>yapfa-parent</artifactId>
+ <groupId>dev.tr7zw.yatopia</groupId>
+ <artifactId>yatopia-parent</artifactId>
<version>dev-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -39,23 +39,28 @@ index 6fd59681784a5cc369f4903b4da0d11174b805f2..9152dbe177a3847a409d8985f8615f9f
<dependency>
- <groupId>com.tuinity</groupId>
- <artifactId>tuinity-api</artifactId>
+ <groupId>de.tr7zw.yapfa</groupId>
+ <artifactId>yapfa-api</artifactId>
+ <groupId>dev.tr7zw.yatopia</groupId>
+ <artifactId>yatopia-api</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
@@ -149,6 +149,10 @@
@@ -149,6 +149,15 @@
Please see https://www.spigotmc.org/go/maven for more information.
-->
+
+ <repository>
+ <id>destroystokyo-repo</id>
+ <url>https://papermc.io/repo/repository/maven-public/</url>
+ </repository>
+ <repository>
+ <id>aikar</id>
+ <url>https://repo.aikar.co/nexus/content/repositories/aikar/</url>
+ </repository>
<repository>
<id>spigotmc-public</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
@@ -164,15 +168,15 @@
@@ -164,15 +173,15 @@
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
<build>

View File

@ -16,19 +16,19 @@ index 74ed02fa9296583977bb721014b10ff8b708b43c..a13c7b2b5bc79ecaea404779149ed02c
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
.completer(new ConsoleCommandCompleter(this.server))
);
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaVersionFetcher.java b/src/main/java/de/tr7zw/yapfa/YapfaVersionFetcher.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
index 0000000000000000000000000000000000000000..b7a73408ea6a1e66aa97a0d924d26fac307fe673
index 0000000000000000000000000000000000000000..523e3b50d535e91afe8b14fdb53966da030963dc
--- /dev/null
+++ b/src/main/java/de/tr7zw/yapfa/YapfaVersionFetcher.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaVersionFetcher.java
@@ -0,0 +1,20 @@
+package de.tr7zw.yapfa;
+package dev.tr7zw.yatopia;
+
+import javax.annotation.Nonnull;
+
+import com.destroystokyo.paper.util.VersionFetcher;
+
+public class YapfaVersionFetcher implements VersionFetcher {
+public class YatopiaVersionFetcher implements VersionFetcher {
+
+ @Override
+ public long getCacheTime() {
@ -44,10 +44,10 @@ index 0000000000000000000000000000000000000000..b7a73408ea6a1e66aa97a0d924d26fac
+}
\ 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
index bb54a4aa718360ce38308ab23bde3669376bf595..b02f380271b3a658caa59615f77de6b684a174e8 100644
index e17119d37577de42f8d52afcfdfee64c33996941..7cc402a4dfaa2a4bb123c897b05c09190cbdd489 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1506,7 +1506,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1515,7 +1515,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
public String getServerModName() {
@ -57,10 +57,10 @@ index bb54a4aa718360ce38308ab23bde3669376bf595..b02f380271b3a658caa59615f77de6b6
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
index d434bd93bc26840129274f45a303fe2c1a44f132..a83fdf36fa5a47814e244810b688ea31ad7f8abc 100644
index d3cda38b5e87d433b18b2c28e4fb467a079160d3..4302ed03920773c2d097d0a0c3a853d1914e8032 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -231,7 +231,7 @@ import javax.annotation.Nullable; // Paper
@@ -217,7 +217,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
@ -70,7 +70,7 @@ index d434bd93bc26840129274f45a303fe2c1a44f132..a83fdf36fa5a47814e244810b688ea31
private final String bukkitVersion = Versioning.getBukkitVersion();
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
index 90c1067ca23e566a96d71e06c273d44397928b64..3f09cf5e98e3bd7ebf2bd4ecad85d77c5e229c80 100644
index 90c1067ca23e566a96d71e06c273d44397928b64..60604e44911d4eb1b67f4a68f8ddad03bcaff95f 100644
--- a/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 {
@ -78,12 +78,12 @@ index 90c1067ca23e566a96d71e06c273d44397928b64..3f09cf5e98e3bd7ebf2bd4ecad85d77c
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
- return new com.destroystokyo.paper.PaperVersionFetcher();
+ return new de.tr7zw.yapfa.YapfaVersionFetcher(); //Yatopia
+ return new dev.tr7zw.yatopia.YatopiaVersionFetcher(); //Yatopia
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 001b1e5197eaa51bfff9031aa6c69876c9a47960..d80dce74ec1a5b5b504281eda3d2c2b188278909 100644
index 001b1e5197eaa51bfff9031aa6c69876c9a47960..2e6cd1780d759a9f94dc4d740fa1b81faad2a1ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
@ -91,7 +91,7 @@ index 001b1e5197eaa51bfff9031aa6c69876c9a47960..d80dce74ec1a5b5b504281eda3d2c2b1
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.tuinity/tuinity-api/pom.properties"); // Tuinity
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/de.tr7zw.yapfa/yapfa-api/pom.properties"); // Yatopia
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/dev.tr7zw.yatopia/yatopia-api/pom.properties"); // Yatopia
Properties properties = new Properties();
if (stream != null) {

View File

@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 21:39:58 +0100
Subject: [PATCH] Don't save Fireworks and Arrows
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3db19a9bab8ffdc42f280a27c867bf7d1a1ab9e7..9430cda80517b736aa07b8e57a1ae0f9f895f32d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1714,7 +1714,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public boolean a_(NBTTagCompound nbttagcompound) {
- String s = this.getSaveID();
+ if(this instanceof EntityFireworks || this instanceof EntityArrow)return false; // YAPFA
+ String s = this.getSaveID();
if (this.persist && !this.dead && s != null) { // CraftBukkit - persist flag
nbttagcompound.setString("id", s);

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add GameProfileLookupEvent
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
index 293b73f4747f48dbf8b6a8453d3fc777de11588d..d79472569d5d8fea2bf7faee2b7d8a6c2a6b17cc 100644
index 8a18dfcda3c785e9c8bd134f88515e077dbef7dc..f0ccfce3bc7a2308a479fecd6d751bcaa88a0861 100644
--- a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -5,9 +5,13 @@ import com.google.common.base.Charsets;
@ -13,7 +13,7 @@ index 293b73f4747f48dbf8b6a8453d3fc777de11588d..d79472569d5d8fea2bf7faee2b7d8a6c
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap;
+
+import de.tr7zw.yapfa.events.GameProfileLookupEvent;
+import dev.tr7zw.yatopia.events.GameProfileLookupEvent;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.UserCache;
import org.apache.commons.lang3.Validate;
@ -22,7 +22,7 @@ index 293b73f4747f48dbf8b6a8453d3fc777de11588d..d79472569d5d8fea2bf7faee2b7d8a6c
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.spigotmc.SpigotConfig;
@@ -183,13 +187,21 @@ public class CraftPlayerProfile implements PlayerProfile {
@@ -185,13 +189,21 @@ public class CraftPlayerProfile implements PlayerProfile {
boolean isCompleteFromCache = this.completeFromCache(true, onlineMode);
if (onlineMode && (!isCompleteFromCache || textures && !hasTextures())) {
@ -33,26 +33,26 @@ index 293b73f4747f48dbf8b6a8453d3fc777de11588d..d79472569d5d8fea2bf7faee2b7d8a6c
- if (this.profile.isComplete()) {
- server.getUserCache().saveProfile(this.profile);
- }
+ // YAPFA start
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.getGameProfile() != null) {
+ this.profile = event.getGameProfile();
+ } else {
+ GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
+ if (result != null) {
+ copyProfileProperties(result, this.profile, true);
+ }
+ // Yatopia start
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.getGameProfile() != null) {
+ this.profile = event.getGameProfile();
+ } else {
+ GameProfile result = server.getSessionService().fillProfileProperties(profile, true);
+ if (result != null) {
+ copyProfileProperties(result, this.profile, true);
+ }
+ if (this.profile.isComplete()) {
+ server.getUserCache().saveProfile(this.profile);
+ }
+ }
+ // YAPFA end
+ }
+ // Yatopia end
}
return profile.isComplete() && (!onlineMode || !textures || hasTextures());
}
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index 579a81e521fdfabfa0318d06c6760a8ab7a88c1e..e572aaaf366709fabfce556c750ba0388ab757ac 100644
index 579a81e521fdfabfa0318d06c6760a8ab7a88c1e..ceb1f18a49ebc8fbac270d9f221fa44f9baea216 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
@@ -4,9 +4,14 @@ import com.google.common.collect.Iterables;
@ -60,7 +60,7 @@ index 579a81e521fdfabfa0318d06c6760a8ab7a88c1e..e572aaaf366709fabfce556c750ba038
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.properties.Property;
+
+import de.tr7zw.yapfa.events.GameProfileLookupEvent;
+import dev.tr7zw.yatopia.events.GameProfileLookupEvent;
+
import java.util.UUID;
import javax.annotation.Nullable;
@ -75,15 +75,15 @@ index 579a81e521fdfabfa0318d06c6760a8ab7a88c1e..e572aaaf366709fabfce556c750ba038
if ( property == null )
{
- profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true );
+ // YAPFA start
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.getGameProfile() != null) {
+ profile = event.getGameProfile();
+ } else {
+ profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true );
+ }
+ // YAPFA end
+ // Yatopia start
+ GameProfileLookupEvent event = new GameProfileLookupEvent(!Bukkit.isPrimaryThread(), profile.getId(), profile.getName());
+ Bukkit.getServer().getPluginManager().callEvent(event);
+ if (event.getGameProfile() != null) {
+ profile = event.getGameProfile();
+ } else {
+ profile = TileEntitySkull.sessionService.fillProfileProperties( profile, true );
+ }
+ // Yatopia end
}
}

View File

@ -1,68 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Thu, 5 Mar 2020 21:13:33 +0100
Subject: [PATCH] Add getLastTickMs() api
Date: Fri, 31 Jul 2020 21:19:26 -0500
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
index b02f380271b3a658caa59615f77de6b684a174e8..ff02688f7b9f6b58c0006d4ba23c38d73869bac0 100644
index 7cc402a4dfaa2a4bb123c897b05c09190cbdd489..8e5284fd39be45055bec1609f6b8dd05229e6b35 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -934,6 +934,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
@@ -930,6 +930,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper End
// Spigot End
+
+ public static long lastTickMs = 0; // YAPFA
+ public static long lastTickMs = 0; // Yatopia
+
protected void v() {
try {
long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper
@@ -998,7 +1000,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(gameprofilertick);
this.methodProfiler.a();
this.methodProfiler.enter("tick");
+ long tickStart = System.currentTimeMillis(); // YAPFA
//this.methodProfiler.a(); // Akarin - remove caller
//this.methodProfiler.enter("tick"); // Akarin - remove caller
+ long tickStart = System.currentTimeMillis(); // Yatopia
this.a(this::canSleepForTick);
+ lastTickMs = System.currentTimeMillis() - tickStart; // YAPFA
this.methodProfiler.exitEnter("nextTickWait");
+ lastTickMs = System.currentTimeMillis() - tickStart; // Yatopia
//this.methodProfiler.exitEnter("nextTickWait"); // Akarin - remove caller
this.X = true;
this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
@@ -1007,6 +1011,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.b();
this.b(gameprofilertick);
this.hasTicked = true;
+
}
} else {
this.a((CrashReport) null);
// Purpur start - tps catchup
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a83fdf36fa5a47814e244810b688ea31ad7f8abc..a35c516b6d2e3535e4455d7f65f71988a75d1df8 100644
index 4302ed03920773c2d097d0a0c3a853d1914e8032..a933d651dfd54912249387934cd2da53ac17d616 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2388,4 +2388,13 @@ public final class CraftServer implements Server {
return mobGoals;
@@ -2419,4 +2419,11 @@ public final class CraftServer implements Server {
return getServer().lagging;
}
// Paper end
// Purpur end
+
+ // YAPFA start
+
+ @Override
+ // Yatopia start
+ @Override
+ public long getLastTickMs() {
+ return net.minecraft.server.MinecraftServer.lastTickMs;
+ }
+
+ // YAPFA end
+ return net.minecraft.server.MinecraftServer.lastTickMs;
+ }
+ // Yatopia end
}
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 7218f23df4d06ff1ca612286e4a404246389ab18..a4f6df8606b0a96803f9917dc831148ea6f5bb0c 100644
index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..87812ace9e1327f31693bdfb3fa45ac38766799b 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -33,7 +33,7 @@ public class TicksPerSecondCommand extends Command
for ( int i = 0; i < tps.length; i++) {
tpsAvg[i] = format( tps[i] );
}
- sender.sendMessage(ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", "));
+ sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ") + " Last tick time: " + org.bukkit.Bukkit.getLastTickMs() + "ms"); // YAPFA
- 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
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)");
if (!hasShownMemoryWarning) {

View File

@ -1,16 +1,16 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Thu, 5 Mar 2020 22:31:50 +0100
Subject: [PATCH] Add config, yapfa command and basic settings
Date: Sun, 2 Aug 2020 11:17:08 -0500
Subject: [PATCH] Add config Yatopia command and basic settings
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaCommand.java b/src/main/java/de/tr7zw/yapfa/YapfaCommand.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
index 0000000000000000000000000000000000000000..76d83f3db4d7a18c44fccc68fb5620c84217b80b
index 0000000000000000000000000000000000000000..1e88bc1a89eada5008ffe88f7ed32e107b2fb10c
--- /dev/null
+++ b/src/main/java/de/tr7zw/yapfa/YapfaCommand.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaCommand.java
@@ -0,0 +1,129 @@
+package de.tr7zw.yapfa;
+package dev.tr7zw.yatopia;
+
+import java.io.File;
+import java.util.ArrayList;
@ -34,13 +34,13 @@ index 0000000000000000000000000000000000000000..76d83f3db4d7a18c44fccc68fb5620c8
+import net.minecraft.server.MinecraftKey;
+import net.minecraft.server.MinecraftServer;
+
+public class YapfaCommand extends Command {
+public class YatopiaCommand extends Command {
+
+ public YapfaCommand(String name) {
+ public YatopiaCommand(String name) {
+ super(name);
+ this.description = "YAPFA related commands";
+ this.usageMessage = "/yapfa [help | reload | info | version]";
+ this.setPermission("bukkit.command.yapfa");
+ this.description = "Yatopia related commands";
+ this.usageMessage = "/yatopia [help | reload | info | version]";
+ this.setPermission("bukkit.command.yatopia");
+ }
+
+ @Override
@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..76d83f3db4d7a18c44fccc68fb5620c8
+
+ switch (args[0].toLowerCase(Locale.ENGLISH)) {
+ case "info":
+ doInfo(sender);
+ doInfo(sender);
+ break;
+ case "reload":
+ doReload(sender);
@ -133,20 +133,20 @@ index 0000000000000000000000000000000000000000..76d83f3db4d7a18c44fccc68fb5620c8
+ Command.broadcastCommandMessage(sender, ChatColor.RED + "If you encounter any issues please use the /stop command to restart your server.");
+
+ MinecraftServer console = MinecraftServer.getServer();
+ de.tr7zw.yapfa.YapfaConfig.init(new File("yapfa.yml"));
+ dev.tr7zw.yatopia.YatopiaConfig.init(new File("yatopia.yml"));
+ console.server.reloadCount++;
+
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "YAPFA config reload complete.");
+ Command.broadcastCommandMessage(sender, ChatColor.GREEN + "Yatopia config reload complete.");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.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
index 0000000000000000000000000000000000000000..35ac0206c9a5481191752e78f61ccf4582a86f10
index 0000000000000000000000000000000000000000..19bea6ee83d8b25da022662253328fb6384f40d9
--- /dev/null
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -0,0 +1,209 @@
+package de.tr7zw.yapfa;
+package dev.tr7zw.yatopia;
+
+import com.destroystokyo.paper.io.chunk.ChunkTaskManager;
+import com.google.common.base.Strings;
@ -179,11 +179,11 @@ index 0000000000000000000000000000000000000000..35ac0206c9a5481191752e78f61ccf45
+import org.spigotmc.SpigotConfig;
+import org.spigotmc.WatchdogThread;
+
+public class YapfaConfig {
+public class YatopiaConfig {
+
+ private static File CONFIG_FILE;
+ private static final String HEADER = "This is the main configuration file for YAPFA.\n"
+ + "YAPFA contains many breaking changes and settings, so know what you are doing!\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"
+ + "You have been warned!\n";
+ /*========================================================================*/
+ public static YamlConfiguration config;
@ -201,7 +201,7 @@ index 0000000000000000000000000000000000000000..35ac0206c9a5481191752e78f61ccf45
+ config.load(CONFIG_FILE);
+ } catch (IOException ex) {
+ } catch (InvalidConfigurationException ex) {
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load yapfa.yml, please correct your syntax errors", ex);
+ Bukkit.getLogger().log(Level.SEVERE, "Could not load yatopia.yml, please correct your syntax errors", ex);
+ throw Throwables.propagate(ex);
+ }
+ config.options().header(HEADER);
@ -209,11 +209,11 @@ index 0000000000000000000000000000000000000000..35ac0206c9a5481191752e78f61ccf45
+ verbose = getBoolean("verbose", false);
+
+ commands = new HashMap<String, Command>();
+ commands.put("yapfa", new YapfaCommand("yapfa"));
+ commands.put("yatopia", new YatopiaCommand("yatopia"));
+
+ version = getInt("config-version", 1);
+ set("config-version", 1);
+ readConfig(YapfaConfig.class, null);
+ readConfig(YatopiaConfig.class, null);
+ }
+
+ protected static void logError(String s) {
@ -222,7 +222,7 @@ index 0000000000000000000000000000000000000000..35ac0206c9a5481191752e78f61ccf45
+
+ protected static void fatal(String s) {
+ fatalError = true;
+ throw new RuntimeException("Fatal yapfa.yml config error: " + s);
+ throw new RuntimeException("Fatal yatopia.yml config error: " + s);
+ }
+
+ protected static void log(String s) {
@ -233,7 +233,7 @@ index 0000000000000000000000000000000000000000..35ac0206c9a5481191752e78f61ccf45
+
+ public static void registerCommands() {
+ for (Map.Entry<String, Command> entry : commands.entrySet()) {
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Yapfa", entry.getValue());
+ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Yatopia", entry.getValue());
+ }
+ }
+
@ -336,28 +336,28 @@ index 0000000000000000000000000000000000000000..35ac0206c9a5481191752e78f61ccf45
+
+ public static boolean disableEntityStuckChecks = false;
+ private static void disableEntityStuckChecks() {
+ disableEntityStuckChecks = getBoolean("settings.disableEntityStuckChecks", false);
+ disableEntityStuckChecks = getBoolean("settings.disableEntityStuckChecks", false);
+ }
+
+
+ public static boolean disablePlayerOutOfWorldBorderCheck = false;
+ private static void disablePlayerOutOfWorldBorderCheck() {
+ disablePlayerOutOfWorldBorderCheck = getBoolean("settings.disablePlayerOutOfWorldBorderCheck", false);
+ disablePlayerOutOfWorldBorderCheck = getBoolean("settings.disablePlayerOutOfWorldBorderCheck", false);
+ }
+
+ public static boolean disableEntityCollisions = false;
+ private static void disableEntityCollisions() {
+ disableEntityCollisions = getBoolean("settings.disableEntityCollisions", false);
+ disableEntityCollisions = getBoolean("settings.disableEntityCollisions", false);
+ }
+
+ public static boolean disableEntityCollisionboxes = false;
+ 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
index 578f7809cb09e746778d05b153e02c569f0d1d90..d697ccc4279a6e50f86255356c7d1b6ee9656bfe 100644
index ad1af2905e4f3e3d05a0dc63859a6e2f3bc43327..9ba65a7528755f54b9a1c4b1323b6e75de867f14 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -7,6 +7,7 @@ import com.mojang.authlib.GameProfileRepository;
@ -368,44 +368,44 @@ index 578f7809cb09e746778d05b153e02c569f0d1d90..d697ccc4279a6e50f86255356c7d1b6e
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
@@ -170,6 +171,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
com.destroystokyo.paper.PaperConfig.registerCommands();
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
// Paper end
+ // YAPFA start
@@ -184,6 +185,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
us.minevict.papercut.PapercutConfig.init((java.io.File) options.valueOf("papercut-settings")); // Papercut
com.mrivanplays.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - server config
+ // Yatopia start
+ try {
+ de.tr7zw.yapfa.YapfaConfig.init(new File("yapfa.yml"));
+ } catch (Exception e) {
+ dev.tr7zw.yatopia.YatopiaConfig.init(new File("yatopia.yml"));
+ } catch (Exception e) {
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
+ return false;
+ }
+ de.tr7zw.yapfa.YapfaConfig.registerCommands();
+ // YAPFA end
com.tuinity.tuinity.config.TuinityConfig.init((java.io.File) options.valueOf("tuinity-settings")); // Tuinity - Server Config
+ }
+ dev.tr7zw.yatopia.YatopiaConfig.registerCommands();
+ // Yatopia end
this.setPVP(dedicatedserverproperties.pvp);
this.setAllowFlight(dedicatedserverproperties.allowFlight);
this.setResourcePack(dedicatedserverproperties.resourcePack, this.aY());
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9430cda80517b736aa07b8e57a1ae0f9f895f32d..0ad2d20eb188c8db40157f1e68d280f902eadf7f 100644
index 98c5ecdf8b59670c872cb43593054f5a91d5e9fe..c77bb0b092cf4198edb6334520fd57042b4e171c 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1029,7 +1029,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -1035,7 +1035,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this);
VoxelShape voxelshape = this.world.getWorldBorder().c();
Stream<VoxelShape> stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(voxelshape); // Paper
- Stream<VoxelShape> stream1 = this.world.c(this, axisalignedbb.b(vec3d), (entity) -> {
+ Stream<VoxelShape> stream1 = de.tr7zw.yapfa.YapfaConfig.disableEntityCollisionboxes ? Stream.empty() : this.world.c(this, axisalignedbb.b(vec3d), (entity) -> {
+ Stream<VoxelShape> stream1 = dev.tr7zw.yatopia.YatopiaConfig.disableEntityCollisionboxes ? Stream.empty() : this.world.c(this, axisalignedbb.b(vec3d), (entity) -> {
return true;
});
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
index 8a773d7de4b8eb2f6846ca277e1ef0af2a86abec..4c9b82284c529088fc977e7bd55c1f0f9dc7bbc5 100644
index d3b4726d37e900fa270d47dfb11c67f4738c687f..9e79187d29957204194b0543f7346cf3a51ed5ce 100644
--- a/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 {
this.world.getMethodProfiler().enter("livingEntityBaseTick");
//this.world.getMethodProfiler().enter("livingEntityBaseTick"); // Akarin - remove caller
boolean flag = this instanceof EntityHuman;
+ if(!de.tr7zw.yapfa.YapfaConfig.disableEntityStuckChecks) { // YAPFA start
+ if(!dev.tr7zw.yatopia.YatopiaConfig.disableEntityStuckChecks) { // Yatopia start
if (this.isAlive()) {
if (this.inBlock()) {
this.damageEntity(DamageSource.STUCK, 1.0F);
@ -413,7 +413,7 @@ index 8a773d7de4b8eb2f6846ca277e1ef0af2a86abec..4c9b82284c529088fc977e7bd55c1f0f
}
}
}
+ } // YAPFA end
+ } // Yatopia end
if (this.isFireProof() || this.world.isClientSide) {
this.extinguish();

View File

@ -1,36 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Mon, 23 Mar 2020 23:11:10 +0100
Subject: [PATCH] Add option for only players to have collisions with Entities
Date: Fri, 31 Jul 2020 21:25:13 -0500
Subject: [PATCH] Add option for only players to have collisions with
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
index 35ac0206c9a5481191752e78f61ccf4582a86f10..071e9f9a5447c7ff4fb15d9c5a6fced4c22739b7 100644
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
@@ -206,4 +206,10 @@ public class YapfaConfig {
disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false);
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index 19bea6ee83d8b25da022662253328fb6384f40d9..2cee6e02a7dcbacb5f002f9c5917a2e26bcf2c82 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -206,4 +206,8 @@ public class YatopiaConfig {
disableEntityCollisionboxes = getBoolean("settings.disableEntityCollisionboxes", false);
}
+ public static boolean onlyPlayerCollisions = false;
+ private static void onlyPlayerCollisions() {
+ onlyPlayerCollisions = getBoolean("settings.onlyPlayerCollisions", false);
+ }
+
+
+ onlyPlayerCollisions = getBoolean("settings.onlyPlayerCollisions", false);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 4c9b82284c529088fc977e7bd55c1f0f9dc7bbc5..0170b2e877d4ef0b24a9c1e48da061e02cda2653 100644
index 9e79187d29957204194b0543f7346cf3a51ed5ce..1ee23408b493eb707791bd23b474e03510993fb3 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2833,40 +2833,46 @@ public abstract class EntityLiving extends Entity {
@@ -2835,40 +2835,46 @@ public abstract class EntityLiving extends Entity {
if (i <= 0 && world.paperConfig.maxCollisionsPerEntity <= 0) {
return;
}
- // Paper - end don't run getEntities if we're not going to use its result
+ // Tuinity - end don't run getEntities if we're not going to use its result
+ // YAPFA start
+ // Yatopia start
// Tuinity start - reduce memory allocation from collideNearby
List<Entity> list = com.tuinity.tuinity.util.CachedLists.getTempGetEntitiesList();
- this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this), list);
@ -64,38 +62,38 @@ index 4c9b82284c529088fc977e7bd55c1f0f9dc7bbc5..0170b2e877d4ef0b24a9c1e48da061e0
- this.C(entity);
- }
- }
+ if(de.tr7zw.yapfa.YapfaConfig.onlyPlayerCollisions) {
+ if(dev.tr7zw.yatopia.YatopiaConfig.onlyPlayerCollisions) {
+ this.world.getEntities(this, this.getBoundingBox(), entity -> entity.getEntityType() == EntityTypes.PLAYER, list);
+ } else {
+ this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this), list);
+ }
+ // Tuinity end - reduce memory allocation from collideNearby
+ // YAPFA end
+
+ // Yatopia end
+
+ if (!list.isEmpty()) {
+ // Paper - move up
+ int j;
+
+
+ if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) {
+ j = 0;
+
+
+ for (int k = 0; k < list.size(); ++k) {
+ if (!((Entity) list.get(k)).isPassenger()) {
+ ++j;
+ }
+ }
+
+
+ if (j > i - 1) {
+ this.damageEntity(DamageSource.CRAMMING, 6.0F);
+ }
+ }
+
+
+ numCollisions = Math.max(0, numCollisions - world.paperConfig.maxCollisionsPerEntity); // Paper
+ for (j = 0; j < list.size() && numCollisions < world.paperConfig.maxCollisionsPerEntity; ++j) { // Paper
+ Entity entity = (Entity) list.get(j);
+ entity.numCollisions++; // Paper
+ numCollisions++; // Paper
+
+
+ this.C(entity);
+ }
+ }

View File

@ -1,26 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Sun, 29 Mar 2020 00:35:03 +0100
Date: Fri, 31 Jul 2020 21:28:00 -0500
Subject: [PATCH] Allow to change the piston push limit
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
index 071e9f9a5447c7ff4fb15d9c5a6fced4c22739b7..716b2dea9b6e8d9d446e0e793b1c6f9ec16816ab 100644
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
@@ -211,5 +211,9 @@ public class YapfaConfig {
onlyPlayerCollisions = getBoolean("settings.onlyPlayerCollisions", false);
}
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index 2cee6e02a7dcbacb5f002f9c5917a2e26bcf2c82..3c654db72bf0a8b56dafd73df8a59f76d27360ae 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -209,5 +209,10 @@ public class YatopiaConfig {
public static boolean onlyPlayerCollisions = false;
private static void onlyPlayerCollisions() {
onlyPlayerCollisions = getBoolean("settings.onlyPlayerCollisions", false);
- }
+ }
+
+ public static int pistonPushLimit = 12;
+ private static void pistonPushLimit() {
+ 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
index 95aeaaf0bb07c5ecf7117dae3382b0f0aac6426f..dd64aad1ed6c2acf360e757bf0369da5fcf6be41 100644
index 95aeaaf0bb07c5ecf7117dae3382b0f0aac6426f..89385896af6f6088a9749a13ad5c1d0c581fa502 100644
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
@@ -79,7 +79,7 @@ public class PistonExtendsChecker {
@ -28,7 +30,7 @@ index 95aeaaf0bb07c5ecf7117dae3382b0f0aac6426f..dd64aad1ed6c2acf360e757bf0369da5
int i = 1;
- if (i + this.f.size() > 12) {
+ if (i + this.f.size() > de.tr7zw.yapfa.YapfaConfig.pistonPushLimit) { // YAPFA
+ if (i + this.f.size() > dev.tr7zw.yatopia.YatopiaConfig.pistonPushLimit) { // Yatopia
return false;
} else {
while (a(block)) {
@ -37,7 +39,7 @@ index 95aeaaf0bb07c5ecf7117dae3382b0f0aac6426f..dd64aad1ed6c2acf360e757bf0369da5
++i;
- if (i + this.f.size() > 12) {
+ if (i + this.f.size() > de.tr7zw.yapfa.YapfaConfig.pistonPushLimit) { // YAPFA
+ if (i + this.f.size() > dev.tr7zw.yatopia.YatopiaConfig.pistonPushLimit) { // Yatopia
return false;
}
}
@ -46,7 +48,7 @@ index 95aeaaf0bb07c5ecf7117dae3382b0f0aac6426f..dd64aad1ed6c2acf360e757bf0369da5
}
- if (this.f.size() >= 12) {
+ if (this.f.size() >= de.tr7zw.yapfa.YapfaConfig.pistonPushLimit) { // YAPFA
+ if (this.f.size() >= dev.tr7zw.yatopia.YatopiaConfig.pistonPushLimit) { // Yatopia
return false;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add NBT-API as first-class lib
diff --git a/pom.xml b/pom.xml
index 9152dbe177a3847a409d8985f8615f9f5f00506a..f653ca995aabb73fb5cad56c3d39aeb8bc7b23d9 100644
index e7f20c5654caa038b92963c45fc79747bd49beb5..170a0506c15e9a6d0069cce16a89bdc70d6fc4fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -306,6 +306,10 @@
@@ -311,6 +311,10 @@
<pattern>net.minecraft.server</pattern>
<shadedPattern>net.minecraft.server.v${minecraft_version}</shadedPattern>
</relocation>

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Sat, 4 Apr 2020 23:23:04 +0200
Subject: [PATCH] Player saving async FileIO
Date: Fri, 31 Jul 2020 22:39:45 -0500
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
index 17789407b9e86896a963a305a13357286aa5f319..030e76685d8111a4feec3a91791ab06ef339604a 100644
index 2e88442e13546e9005e3783b09feaddbed7cea16..0f05c8887f5ecd639021e90389e53891b6ad80fc 100644
--- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java
@@ -27,6 +27,8 @@ import java.util.List;
@ -21,15 +21,15 @@ index 17789407b9e86896a963a305a13357286aa5f319..030e76685d8111a4feec3a91791ab06e
@Nullable
private Advancement l;
private boolean m = true;
+ public static ExecutorService saveThread = Executors.newSingleThreadExecutor(); // YAPFA
+ public static ExecutorService saveThread = Executors.newSingleThreadExecutor(); // Yatopia
// Paper start - fix advancement data player leakage
final Map<CriterionTriggerAbstract, Set<CriterionTrigger.a>> criterionData = Maps.newIdentityHashMap();
@@ -227,53 +230,66 @@ public class AdvancementDataPlayer {
@@ -228,53 +231,66 @@ public class AdvancementDataPlayer {
jsonelement.getAsJsonObject().addProperty("DataVersion", SharedConstants.getGameVersion().getWorldVersion());
+ // YAPFA start
+ // Yatopia start
+ String gson = null;
try {
- FileOutputStream fileoutputstream = new FileOutputStream(this.f);
@ -77,23 +77,23 @@ index 17789407b9e86896a963a305a13357286aa5f319..030e76685d8111a4feec3a91791ab06e
- }
- } catch (IOException ioexception) {
- AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, ioexception);
+ gson = AdvancementDataPlayer.b.toJson(jsonelement);
+ gson = AdvancementDataPlayer.b.toJson(jsonelement);
+ } catch (Throwable throwable) {
+ throw throwable;
+ }
+ if(gson != null) {
+ final String fGson = gson;
+ saveThread.submit(() -> {
+ try {
+ final String fGson = gson;
+ saveThread.submit(() -> {
+ try {
+ FileOutputStream fileoutputstream = new FileOutputStream(this.f);
+ Throwable throwable = null;
+
+
+ try {
+ OutputStreamWriter outputstreamwriter = new OutputStreamWriter(fileoutputstream, Charsets.UTF_8.newEncoder());
+ Throwable throwable1 = null;
+
+
+ try {
+ outputstreamwriter.write(fGson);
+ outputstreamwriter.write(fGson);
+ } catch (Throwable throwable2) {
+ throwable1 = throwable2;
+ throw throwable2;
@ -109,7 +109,7 @@ index 17789407b9e86896a963a305a13357286aa5f319..030e76685d8111a4feec3a91791ab06e
+ outputstreamwriter.close();
+ }
+ }
+
+
+ }
+ } catch (Throwable throwable4) {
+ throwable = throwable4;
@ -126,43 +126,43 @@ index 17789407b9e86896a963a305a13357286aa5f319..030e76685d8111a4feec3a91791ab06e
+ fileoutputstream.close();
+ }
+ }
+
+
+ }
+ } catch (IOException ioexception) {
+ AdvancementDataPlayer.LOGGER.error("Couldn't save player advancements to {}", this.f, ioexception);
+ }
+ });
+ });
}
+ // YAPFA end
+ // Yatopia end
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 2cada09ced1660526e9c112c2c8d92bbf9d6ea98..321726139df8b10bf264a4cabdc55423b544ad50 100644
index 2cada09ced1660526e9c112c2c8d92bbf9d6ea98..767ecf5fe63d86522ef8de4c0b4cda2803a5145c 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -700,11 +700,23 @@ public abstract class EntityHuman extends EntityLiving {
}
+ // YAPFA start
+ // Yatopia start
+ private NBTTagList inventorySnapshot = null;
+ private NBTTagList enderchestSnapshot = null;
+
+
+
+
+ public void takeInventorySnapshot() {
+ inventorySnapshot = this.inventory.a(new NBTTagList());
+ enderchestSnapshot = this.enderChest.g();
+ inventorySnapshot = this.inventory.a(new NBTTagList());
+ enderchestSnapshot = this.enderChest.g();
+ }
+
+ // YAPFA end
+
+
+ // Yatopia end
+
@Override
public void saveData(NBTTagCompound nbttagcompound) {
super.saveData(nbttagcompound);
nbttagcompound.setInt("DataVersion", SharedConstants.getGameVersion().getWorldVersion());
- nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList()));
+ nbttagcompound.set("Inventory", inventorySnapshot != null ? inventorySnapshot : this.inventory.a(new NBTTagList())); inventorySnapshot = null;// YAPFA
+ nbttagcompound.set("Inventory", inventorySnapshot != null ? inventorySnapshot : this.inventory.a(new NBTTagList())); inventorySnapshot = null;// Yatopia
nbttagcompound.setInt("SelectedItemSlot", this.inventory.itemInHandIndex);
nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks);
nbttagcompound.setFloat("XpP", this.exp);
@ -171,30 +171,28 @@ index 2cada09ced1660526e9c112c2c8d92bbf9d6ea98..321726139df8b10bf264a4cabdc55423
this.foodData.b(nbttagcompound);
this.abilities.a(nbttagcompound);
- nbttagcompound.set("EnderItems", this.enderChest.g());
+ nbttagcompound.set("EnderItems", enderchestSnapshot != null ? enderchestSnapshot : this.enderChest.g()); enderchestSnapshot = null;// YAPFA
+ nbttagcompound.set("EnderItems", enderchestSnapshot != null ? enderchestSnapshot : this.enderChest.g()); enderchestSnapshot = null;// Yatopia
if (!this.getShoulderEntityLeft().isEmpty()) {
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
index 9382e8f79e8edec8885c629a36e230fbec50e1fb..871b104b60d03a7abbff80130c4b2ea3254676e2 100644
index 8b64720f4acf5deb341074cd75f99ca7816f1e41..2e24e2210f91e69ead4f21f2426e5230fb887e53 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -18,6 +18,9 @@ import java.util.Map;
import java.util.Optional;
@@ -20,6 +20,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+
import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -1258,6 +1261,28 @@ public abstract class PlayerList {
@@ -1262,6 +1263,28 @@ public abstract class PlayerList {
if (team != null) scoreboard.removeTeam(team);
}
// Paper end
+
+ // YAPFA start - make sure all saves are done
+
+ // Yatopia start - make sure all saves are done
+ try {
+ ((WorldNBTStorage)playerFileData).saveThread.shutdown();
+ boolean done = ((WorldNBTStorage)playerFileData).saveThread.awaitTermination(60, TimeUnit.SECONDS);
@ -214,16 +212,16 @@ index 9382e8f79e8edec8885c629a36e230fbec50e1fb..871b104b60d03a7abbff80130c4b2ea3
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // YAPFA end
+ // Yatopia end
}
// Paper end
@@ -1295,13 +1320,13 @@ public abstract class PlayerList {
@@ -1299,13 +1322,13 @@ public abstract class PlayerList {
File file = this.server.a(SavedFile.STATS).toFile();
File file1 = new File(file, uuid + ".json");
- if (!file1.exists()) {
+ /*if (!file1.exists()) { // YAPFA dont check for old stats files with sync File IO
+ /*if (!file1.exists()) { // Yatopia dont check for old stats files with sync File IO
File file2 = new File(file, displayName + ".json"); // CraftBukkit
if (file2.exists() && file2.isFile()) {
@ -235,7 +233,7 @@ index 9382e8f79e8edec8885c629a36e230fbec50e1fb..871b104b60d03a7abbff80130c4b2ea3
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
// 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
index 18725272f920eafb655de8b923a8a85dbdc704cf..5033db43e3df5e92c45f87d6ff2ee8a5e3aeec35 100644
index 18725272f920eafb655de8b923a8a85dbdc704cf..5f222d8b90951c61e77ab7032f8728772ba8ab9d 100644
--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java
+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java
@@ -20,6 +20,10 @@ import java.util.Map;
@ -253,7 +251,7 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..5033db43e3df5e92c45f87d6ff2ee8a5
private final File d;
private final Set<Statistic<?>> e = Sets.newHashSet();
private int f = -300;
+ public static ExecutorService saveThread = Executors.newSingleThreadExecutor(); // YAPFA
+ public static ExecutorService saveThread = Executors.newSingleThreadExecutor(); // Yatopia
public ServerStatisticManager(MinecraftServer minecraftserver, File file) {
this.c = minecraftserver;
@ -263,7 +261,7 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..5033db43e3df5e92c45f87d6ff2ee8a5
}
- // Spigot end
+ // Spigot ends
+ // YAPFA start
+ // Yatopia start
+ saveThread.submit(() -> {
if (file.isFile()) {
try {
@ -278,7 +276,7 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..5033db43e3df5e92c45f87d6ff2ee8a5
public void save() {
if ( org.spigotmc.SpigotConfig.disableStatSaving ) return; // Spigot
+ // YAPFA start
+ // Yatopia start
+ String str = this.b();
+ saveThread.submit(() -> {
try {
@ -289,7 +287,7 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..5033db43e3df5e92c45f87d6ff2ee8a5
}
-
+ });
+ // YAPFA end
+ // Yatopia end
}
@Override
@ -298,12 +296,12 @@ index 18725272f920eafb655de8b923a8a85dbdc704cf..5033db43e3df5e92c45f87d6ff2ee8a5
if (nbttagcompound2.hasKeyOfType(s2, 99)) {
SystemUtils.a(this.a(statisticwrapper, s2), (statistic) -> {
- this.a.put(statistic, nbttagcompound2.getInt(s2));
+ this.a.put(statistic, nbttagcompound2.getInt(s2) + this.a.getOrDefault(statistic, 0)); // YAPFA fix async load
+ this.a.put(statistic, nbttagcompound2.getInt(s2) + this.a.getOrDefault(statistic, 0)); // Yatopia fix async load
}, () -> {
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
index 41a1b93a9e0f16ed9415dfeccd490496650163cb..9517fb0465da55d140c36967891b3e476c47bdf0 100644
index be060f602f53344cf51c22eafacb4dc9219c8856..b14f3d44a76ccac791b7be353bb2899fc59f70ec 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -11,6 +11,10 @@ import org.apache.logging.log4j.LogManager;
@ -321,7 +319,7 @@ index 41a1b93a9e0f16ed9415dfeccd490496650163cb..9517fb0465da55d140c36967891b3e47
private static final Logger LOGGER = LogManager.getLogger();
private final File playerDir;
protected final DataFixer a;
+ public ExecutorService saveThread = Executors.newSingleThreadExecutor(); // YAPFA
+ public ExecutorService saveThread = Executors.newSingleThreadExecutor(); // Yatopia
public WorldNBTStorage(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer) {
this.a = datafixer;
@ -337,22 +335,22 @@ index 41a1b93a9e0f16ed9415dfeccd490496650163cb..9517fb0465da55d140c36967891b3e47
- File file2 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat_old");
-
- SystemUtils.a(file1, file, file2);
+ // YAPFA start
+ entityhuman.takeInventorySnapshot(); // Take a sync inventory/enderchest snapshot to prevent duping
+ // Yatopia start
+ entityhuman.takeInventorySnapshot(); // Take a sync inventory/enderchest snapshot to prevent duping
+ saveThread.submit(() -> { // Save the tag async
+ try {
+ NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
+ try {
+ NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
+ File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir);
+ File file1 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
+ File file2 = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat_old");
+
+
+ NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file)));
+ SystemUtils.a(file1, file, file2);
+ } catch (Exception exception) {
+ } catch (Exception exception) {
+ WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
+ }
+ });
+ // YAPFA end
+ // Yatopia end
} catch (Exception exception) {
WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper
}

View File

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
<tsao-chi@the-lingo.org>
Date: Thu, 2 Apr 2020 11:29:08 +0800
Subject: [PATCH] Akarin Avoid double I/O operation on load player file
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index 9517fb0465da55d140c36967891b3e476c47bdf0..c182246917d838db504286313a9426267e607e45 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -64,7 +64,8 @@ public class WorldNBTStorage {
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
// Spigot Start
boolean usingWrongFile = false;
- if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
+ boolean normalFile = file.exists() && file.isFile(); // Akarin - ensures normal file
+ if ( org.bukkit.Bukkit.getOnlineMode() && !normalFile ) // Paper - Check online mode first // Akarin - ensures normal file
{
file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
if ( file.exists() )
@@ -75,7 +76,7 @@ public class WorldNBTStorage {
}
// Spigot End
- if (file.exists() && file.isFile()) {
+ if (normalFile) { // Akarin - avoid double I/O operation
nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file)));
}
// Spigot Start

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
index 56e4359ba32339e1bef58061585ff3e12e4215f3..8b607a76ab5cb6beadff3dc5e6832a394982063e 100644
index 56e4359ba32339e1bef58061585ff3e12e4215f3..5465f13cdedcf71310838e8505e94e975180919b 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -201,7 +201,7 @@ public class PaperConfig {
@ -13,12 +13,12 @@ index 56e4359ba32339e1bef58061585ff3e12e4215f3..8b607a76ab5cb6beadff3dc5e6832a39
public static String timingsServerName;
private static void timings() {
- boolean timings = getBoolean("timings.enabled", true);
+ boolean timings = getBoolean("timings.enabled", false); // YAPFA don't profile by default
+ boolean timings = getBoolean("timings.enabled", false); // Yatopia don't profile by default
boolean verboseTimings = getBoolean("timings.verbose", true);
TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
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
index e471e764935e2a89560de56959a782b02e5e8fe1..b0b497c8cdddb155722c89e69051b8c7519cd4d4 100644
index e471e764935e2a89560de56959a782b02e5e8fe1..5b9fef2b47b752897ea9153fe818a9c476e689ea 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -600,7 +600,7 @@ public class PaperWorldConfig {
@ -26,7 +26,7 @@ index e471e764935e2a89560de56959a782b02e5e8fe1..b0b497c8cdddb155722c89e69051b8c7
public boolean cooldownHopperWhenFull = true;
- public boolean disableHopperMoveEvents = false;
+ public boolean disableHopperMoveEvents = true; // YAPFA disable by default
+ public boolean disableHopperMoveEvents = true; // Yatopia disable by default
private void hopperOptimizations() {
cooldownHopperWhenFull = getBoolean("hopper.cooldown-when-full", cooldownHopperWhenFull);
log("Cooldown Hoppers when Full: " + (cooldownHopperWhenFull ? "enabled" : "disabled"));

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Mon, 11 May 2020 21:00:44 +0200
Subject: [PATCH] lithium MixinDirection
diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java
index 5a04654657fa47cfce0709ee75c5ff0dbe07ec8c..e60310a5358e23fdf3969f5a422d66280eb465a9 100644
index 5a04654657fa47cfce0709ee75c5ff0dbe07ec8c..1aa9d9fd074c186b209696ee46e0dda181372f4b 100644
--- a/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 {
@ -13,14 +13,14 @@ index 5a04654657fa47cfce0709ee75c5ff0dbe07ec8c..e60310a5358e23fdf3969f5a422d6628
private final int g;
- private final int h;
+ private final int h; // YAPFA this is idOpposit(yarn)
+ private final int h; // Yatopia this is idOpposit(yarn)
private final int i;
private final String j;
private final EnumDirection.EnumAxis k;
private final EnumDirection.EnumAxisDirection l;
private final BaseBlockPosition m;
- private static final EnumDirection[] n = values();
+ private static final EnumDirection[] n = values(); private static final EnumDirection[] ALL = n;// YAPFA OBF HELPER
+ private static final EnumDirection[] n = values(); private static final EnumDirection[] ALL = n;// Yatopia OBF HELPER
private static final Map<String, EnumDirection> o = (Map) Arrays.stream(EnumDirection.n).collect(Collectors.toMap(EnumDirection::m, (enumdirection) -> {
return enumdirection;
}));

View File

@ -1,26 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 4 Apr 2020 03:07:59 -0500
Subject: [PATCH] Purpur Skip events if there's no listeners
diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java
index e59151d01b4710b750366a395e1e5d18caa4726f..4ace0e79c9c0110c794a345fb27203b566b4788b 100644
--- a/src/main/java/net/minecraft/server/CommandDispatcher.java
+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java
@@ -275,6 +275,7 @@ public class CommandDispatcher {
}
private void runSync(EntityPlayer entityplayer, Collection<String> bukkit, RootCommandNode<ICompletionProvider> rootcommandnode) {
+ if (PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Purpur - skip all this crap if there's nothing listening
// Paper end - Async command map building
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandListenerWrapper>(entityplayer.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper
PlayerCommandSendEvent event = new PlayerCommandSendEvent(entityplayer.getBukkitEntity(), new LinkedHashSet<>(bukkit));
@@ -287,6 +288,7 @@ public class CommandDispatcher {
}
}
// CraftBukkit end
+ } // Purpur - skip event
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
}

View File

@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Mon, 11 May 2020 21:02:57 +0200
Subject: [PATCH] lithium MixinBox

View File

@ -1,211 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Tue, 21 Apr 2020 15:49:52 +0200
Subject: [PATCH] Purpur Add more timings timers
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
index 85b25eace786fa0d7694afa405f9d2bdf4937b6e..b81eeea483e1313a3b4a329bf09ac6e40a7b267f 100644
--- a/src/main/java/co/aikar/timings/MinecraftTimings.java
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -46,6 +46,28 @@ public final class MinecraftTimings {
public static final Timing scoreboardScoreSearch = Timings.ofSafe("Scoreboard score search"); // Tuinity - add timings for scoreboard search
public static final Timing distanceManagerTick = Timings.ofSafe("Distance Manager Tick"); // Tuinity - add timings for distance manager
+ // Purpur start
+ public static final Timing goalCleanup = Timings.ofSafe("PathfinderGoal - Cleanup");
+ public static final Timing goalUpdate = Timings.ofSafe("PathfinderGoal - Update");
+ public static final Timing goalTick = Timings.ofSafe("PathfinderGoal - Tick");
+
+ public static final Timing entityMovementTick = Timings.ofSafe("Entity Movement");
+ public static final Timing entityMovementTickAI = Timings.ofSafe("Entity Movement - AI");
+ public static final Timing entityMovementTickNewAI = Timings.ofSafe("Entity Movement - New AI");
+ public static final Timing entityMovementTickJump = Timings.ofSafe("Entity Movement - Jump");
+ public static final Timing entityMovementTickTravel = Timings.ofSafe("Entity Movement - Travel");
+ public static final Timing entityMovementTickPush = Timings.ofSafe("Entity Movement - Push");
+
+ public static final Timing entityInsentientSensing = Timings.ofSafe("Entity Insentient - Sensing");
+ public static final Timing entityInsentientTargetSelector = Timings.ofSafe("Entity Insentient - TargetSelector");
+ public static final Timing entityInsentientGoalSelector = Timings.ofSafe("Entity Insentient - GoalSelector");
+ public static final Timing entityInsentientNavigation = Timings.ofSafe("Entity Insentient - Navigation");
+ public static final Timing entityInsentientMobTick = Timings.ofSafe("Entity Insentient - MobTick");
+ public static final Timing entityInsentientControls = Timings.ofSafe("Entity Insentient - Controls");
+
+ public static final Timing passengerTick = Timings.ofSafe("Passenger Tick");
+ // Purpur end
+
private static final Map<Class<?>, String> taskNameCache = new MapMaker().weakKeys().makeMap();
private MinecraftTimings() {}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 605bbf0174e60f795e445193a0284739ea452946..9a937623aaf59d3159038f06c1ede1a1d9bc1916 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -748,21 +748,32 @@ public abstract class EntityInsentient extends EntityLiving {
}
// Paper end
this.world.getMethodProfiler().enter("sensing");
+ co.aikar.timings.MinecraftTimings.entityInsentientSensing.startTiming(); // Purpur
this.bv.a();
+ co.aikar.timings.MinecraftTimings.entityInsentientSensing.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("targetSelector");
+ co.aikar.timings.MinecraftTimings.entityInsentientTargetSelector.startTiming(); // Purpur
this.targetSelector.doTick();
+ co.aikar.timings.MinecraftTimings.entityInsentientTargetSelector.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("goalSelector");
+ co.aikar.timings.MinecraftTimings.entityInsentientGoalSelector.startTiming(); // Purpur
this.goalSelector.doTick();
+ co.aikar.timings.MinecraftTimings.entityInsentientGoalSelector.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("navigation");
+ co.aikar.timings.MinecraftTimings.entityInsentientNavigation.startTiming(); // Purpur
this.navigation.c();
+ co.aikar.timings.MinecraftTimings.entityInsentientNavigation.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("mob tick");
+ co.aikar.timings.MinecraftTimings.entityInsentientMobTick.startTiming(); // Purpur
this.mobTick();
+ co.aikar.timings.MinecraftTimings.entityInsentientMobTick.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("controls");
+ co.aikar.timings.MinecraftTimings.entityInsentientControls.startTiming(); // Purpur
this.world.getMethodProfiler().enter("move");
this.moveController.a();
this.world.getMethodProfiler().exitEnter("look");
@@ -770,6 +781,7 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.getMethodProfiler().exitEnter("jump");
this.bp.b();
this.world.getMethodProfiler().exit();
+ co.aikar.timings.MinecraftTimings.entityInsentientControls.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.M();
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0170b2e877d4ef0b24a9c1e48da061e02cda2653..a1819225ea0c3ceb677877586c7b9176ffd36a4d 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2464,7 +2464,11 @@ public abstract class EntityLiving extends Entity {
}
}
- this.movementTick();
+
+ MinecraftTimings.entityMovementTick.startTiming(); // Purpur
+ if (!dead) this.movementTick(); // Purpur
+ MinecraftTimings.entityMovementTick.stopTiming(); // Purpur
+
double d0 = this.locX() - this.lastX;
double d1 = this.locZ() - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1);
@@ -2733,18 +2737,23 @@ public abstract class EntityLiving extends Entity {
this.setMot(d4, d5, d6);
this.world.getMethodProfiler().enter("ai");
+ co.aikar.timings.MinecraftTimings.entityMovementTickAI.startTiming(); // Purpur
if (this.isFrozen()) {
this.jumping = false;
this.aY = 0.0F;
this.ba = 0.0F;
} else if (this.doAITick()) {
this.world.getMethodProfiler().enter("newAi");
+ co.aikar.timings.MinecraftTimings.entityMovementTickNewAI.startTiming(); // Purpur
this.doTick();
+ co.aikar.timings.MinecraftTimings.entityMovementTickNewAI.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
}
+ co.aikar.timings.MinecraftTimings.entityMovementTickAI.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("jump");
+ co.aikar.timings.MinecraftTimings.entityMovementTickJump.startTiming(); // Purpur
if (this.jumping && this.cS()) {
double d7;
@@ -2770,21 +2779,26 @@ public abstract class EntityLiving extends Entity {
} else {
this.jumpTicks = 0;
}
+ co.aikar.timings.MinecraftTimings.entityMovementTickJump.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("travel");
- this.aY *= 0.98F;
- this.ba *= 0.98F;
+ co.aikar.timings.MinecraftTimings.entityMovementTickTravel.startTiming(); // Purpur
+ this.aZ *= 0.98F;
+ this.bb *= 0.98F;
this.t();
AxisAlignedBB axisalignedbb = this.getBoundingBox();
this.f(new Vec3D((double) this.aY, (double) this.aZ, (double) this.ba));
+ co.aikar.timings.MinecraftTimings.entityMovementTickTravel.stopTiming(); // Purpur
this.world.getMethodProfiler().exit();
this.world.getMethodProfiler().enter("push");
+ co.aikar.timings.MinecraftTimings.entityMovementTickPush.startTiming(); // Purpur
if (this.bm > 0) {
--this.bm;
this.a(axisalignedbb, this.getBoundingBox());
}
+ co.aikar.timings.MinecraftTimings.entityMovementTickPush.stopTiming(); // Purpur
this.collideNearby();
this.world.getMethodProfiler().exit();
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index d3f0327a2a7cdedf3fe8d10df981a9f1cb378d26..cce7cac92b3256576fb35d5d03719b15826f6ebc 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -80,7 +80,7 @@ public class PathfinderGoalSelector {
public void doTick() {
GameProfilerFiller gameprofilerfiller = (GameProfilerFiller) this.e.get();
-
+ co.aikar.timings.MinecraftTimings.goalCleanup.startTiming();
gameprofilerfiller.enter("goalCleanup");
// Paper start - remove streams from pathfindergoalselector
for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
@@ -100,8 +100,10 @@ public class PathfinderGoalSelector {
}
});
+ co.aikar.timings.MinecraftTimings.goalCleanup.stopTiming();
gameprofilerfiller.exit();
gameprofilerfiller.enter("goalUpdate");
+ co.aikar.timings.MinecraftTimings.goalUpdate.startTiming();
// Paper start - remove streams from pathfindergoalselector
goal_update_loop: for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
PathfinderGoalWrapped wrappedGoal = iterator.next();
@@ -144,8 +146,10 @@ public class PathfinderGoalSelector {
wrappedGoal.c();
}
// Paper end - remove streams from pathfindergoalselector
+ co.aikar.timings.MinecraftTimings.goalUpdate.stopTiming();
gameprofilerfiller.exit();
gameprofilerfiller.enter("goalTick");
+ co.aikar.timings.MinecraftTimings.goalTick.startTiming();
// Paper start - remove streams from pathfindergoalselector
for (Iterator<PathfinderGoalWrapped> iterator = this.d.iterator(); iterator.hasNext();) {
PathfinderGoalWrapped wrappedGoal = iterator.next();
@@ -155,6 +159,7 @@ public class PathfinderGoalSelector {
}
// Paper end - remove streams from pathfindergoalselector
gameprofilerfiller.exit();
+ co.aikar.timings.MinecraftTimings.goalTick.stopTiming();
}
public final Stream<PathfinderGoalWrapped> getExecutingGoals() { return d(); } // Paper - OBFHELPER
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 2bee2dab9f19899c491bd381063b9185adcb5b2e..1a3972a786dc9fb131e88adf00bd1b345bda06ef 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1339,7 +1339,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return IRegistry.ENTITY_TYPE.getKey(entity1.getEntityType()).toString();
});
gameprofilerfiller.c("tickPassenger");
+ co.aikar.timings.MinecraftTimings.passengerTick.startTiming(); // Purpur
entity1.passengerTick();
+ co.aikar.timings.MinecraftTimings.passengerTick.stopTiming(); // Purpur
gameprofilerfiller.exit();
}

View File

@ -0,0 +1,124 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Fri, 31 Jul 2020 21:44:22 -0500
Subject: [PATCH] lithium enum_values
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 4f10ca5ada741b4f5ef941bb9d92a2fa6a7c44ff..3d6f8d948d293ca57bf158bcd1f58e289d937fb5 100644
--- a/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 {
}
}
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia - don't recreate
private boolean a(World world, BlockPosition blockposition, EnumDirection enumdirection) {
- EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
int j;
@@ -146,12 +146,11 @@ public class BlockPiston extends BlockDirectional {
return true;
} else {
BlockPosition blockposition1 = blockposition.up();
- EnumDirection[] aenumdirection1 = EnumDirection.values();
- j = aenumdirection1.length;
+ j = aenumdirection.length;
for (int k = 0; k < j; ++k) {
- EnumDirection enumdirection2 = aenumdirection1[k];
+ EnumDirection enumdirection2 = aenumdirection[k];
if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) {
return true;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 1ee23408b493eb707791bd23b474e03510993fb3..ed4ec5e7b38083c7f5f3839eca129622dcd160a2 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2558,11 +2558,14 @@ public abstract class EntityLiving extends Entity {
}
}
+ /**
+ * @reason Avoid cloning enum values
+ */
+ private final static EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
@Nullable
private Map<EnumItemSlot, ItemStack> r() {
Map<EnumItemSlot, ItemStack> map = null;
- EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
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
index a7c2543fdd4d5f6a04c45ec42472837ccaea9619..ccfa23af36f66618f4ef18b0d86c86a73de9ea9f 100644
--- a/src/main/java/net/minecraft/server/EnumAxisCycle.java
+++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java
@@ -26,12 +26,21 @@ public enum EnumAxisCycle {
@Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() + 1, 3)];
+ switch (enumdirection_enumaxis) {
+ case X:
+ return EnumDirection.EnumAxis.Y;
+ case Y:
+ return EnumDirection.EnumAxis.Z;
+ case Z:
+ return EnumDirection.EnumAxis.X;
+ }
+
+ throw new IllegalArgumentException();
}
@Override
public EnumAxisCycle a() {
- return null.BACKWARD;
+ return BACKWARD;
}
},
BACKWARD {
@@ -42,12 +51,21 @@ public enum EnumAxisCycle {
@Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() - 1, 3)];
+ switch (enumdirection_enumaxis) {
+ case X:
+ return EnumDirection.EnumAxis.Z;
+ case Y:
+ return EnumDirection.EnumAxis.X;
+ case Z:
+ return EnumDirection.EnumAxis.Y;
+ }
+
+ throw new IllegalArgumentException();
}
@Override
public EnumAxisCycle a() {
- return null.FORWARD;
+ return FORWARD;
}
};
diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
index 89385896af6f6088a9749a13ad5c1d0c581fa502..4fd1a98e8309bec2ef270ac70c4d79d143002b86 100644
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
@@ -166,10 +166,10 @@ public class PistonExtendsChecker {
this.f.addAll(list1);
this.f.addAll(list2);
}
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia - don't recreate
private boolean a(BlockPosition blockposition) {
IBlockData iblockdata = this.a.getType(blockposition);
- EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {

View File

@ -1,12 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Mon, 11 May 2020 22:07:17 +0200
Subject: [PATCH] lithium MixinGoalSelector
Only replaces the set type, might want to also port the logic rewrite in the future
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index cce7cac92b3256576fb35d5d03719b15826f6ebc..3bfbb169f3fdac2405a5bddc76a3c1f0e80dbf5c 100644
index b783028e5526df722d98e4760ffb214d5d2f83dd..2378a833cd31d703db462dd6f55a5cb858796b8d 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -1,7 +1,8 @@
@ -24,7 +24,7 @@ index cce7cac92b3256576fb35d5d03719b15826f6ebc..3bfbb169f3fdac2405a5bddc76a3c1f0
};
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 = new ObjectLinkedOpenHashSet<PathfinderGoalWrapped>();/* YAPFA better set */ public final Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public
+ private final Set<PathfinderGoalWrapped> d = new ObjectLinkedOpenHashSet<PathfinderGoalWrapped>();/* Yatopia better set */ public final Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public
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 OptimizedSmallEnumSet<PathfinderGoal.Type> goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector

View File

@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Mon, 11 May 2020 22:56:27 +0200
Subject: [PATCH] lithium MixinLandPathNodeMaker
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
index ec55785af2b432b692d3a3bf4298ffb32489bf3b..87d6caa404f96f7aae586302d2a46420d0662f64 100644
index 49fc87b6e196d4bde8b99929a4a42f00d2f462e8..97d2b88570037ad9f4efe037ae7410598b031c40 100644
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
@@ -4,12 +4,23 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
@ -23,12 +23,12 @@ index ec55785af2b432b692d3a3bf4298ffb32489bf3b..87d6caa404f96f7aae586302d2a46420
public class PathfinderNormal extends PathfinderAbstract {
+ // YAPFA start
+ // Yatopia start
+
+ // This is not thread-safe!
+ private static final Reference2ReferenceMap<IBlockData, PathType> commonTypes = new Reference2ReferenceOpenHashMap<>();
+ // YAPFA end
+
+ // Yatopia end
+
protected float j;
private final Long2ObjectMap<PathType> k = new Long2ObjectOpenHashMap();
private final Object2BooleanMap<AxisAlignedBB> l = new Object2BooleanOpenHashMap();
@ -40,7 +40,7 @@ index ec55785af2b432b692d3a3bf4298ffb32489bf3b..87d6caa404f96f7aae586302d2a46420
- Material material = iblockdata.getMaterial();
+ // Check early if the block is air as it will always be open regardless of other conditions
+ if(iblockdata.isAir())return PathType.OPEN;
+
+
+ // Get the cached type for this block state
+ PathType type = commonTypes.get(iblockdata);
+

View File

@ -1,12 +1,12 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Tue, 12 May 2020 00:38:31 +0200
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Fri, 31 Jul 2020 21:46:32 -0500
Subject: [PATCH] lithium MixinBiome
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
index 0000000000000000000000000000000000000000..a2e3e96e1e96c152de820283c1f8cb6248321f54
index 0000000000000000000000000000000000000000..c2c19a6fbfa2a4aba21aa71789071c69a6246556
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
@@ -0,0 +1,168 @@
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..a2e3e96e1e96c152de820283c1f8cb62
+
+/**
+ * Wraps a {@link List} with a hash table which provides O(1) lookups for {@link Collection#contains(Object)}.
+ *
+ *
+ * @see https://github.com/jellysquid3/lithium-fabric/blob/1.16.x/fabric/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
+ */
+public class HashedList<T> implements List<T> {
@ -180,24 +180,23 @@ index 0000000000000000000000000000000000000000..a2e3e96e1e96c152de820283c1f8cb62
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index 52ebdfcc03ae2d8576a98566e7a99c617f87e19e..82dc2a16c657c1562f2c84232e69f9aa3f191f51 100644
index b2b654218382cc2cf1649067cd140b539235e3d2..bfaba96eb56dd98a67d2c2179335ae48dcbe3849 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -7,6 +7,8 @@ import com.google.common.collect.Sets;
@@ -7,6 +7,7 @@ import com.google.common.collect.Sets;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import it.unimi.dsi.fastutil.longs.Long2FloatLinkedOpenHashMap;
+import me.jellysquid.mods.lithium.common.util.collections.HashedList;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
@@ -139,7 +141,7 @@ public class BiomeBase {
import java.util.*;
import java.util.function.Function;
@@ -139,7 +140,7 @@ public class BiomeBase {
for (j = 0; j < i; ++j) {
EnumCreatureType enumcreaturetype = aenumcreaturetype[j];
- this.v.put(enumcreaturetype, new MobList()); // Paper
+ this.v.put(enumcreaturetype, HashedList.wrapper(new MobList())); // Paper // YAPFA lithium change
+ this.v.put(enumcreaturetype, HashedList.wrapper(new MobList())); // Paper // Yatopia lithium change
}
} else {

View File

@ -1,26 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Tue, 16 Jun 2020 17:29:20 +0200
Date: Fri, 31 Jul 2020 21:48:14 -0500
Subject: [PATCH] Item stuck sleep config
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
index 716b2dea9b6e8d9d446e0e793b1c6f9ec16816ab..a158e9dc8b295f13c7ab73747cecd4c8dccce66f 100644
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
@@ -216,4 +216,9 @@ public class YapfaConfig {
pistonPushLimit = getInt("settings.pistonPushLimit", 12);
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index 3c654db72bf0a8b56dafd73df8a59f76d27360ae..0273d800eb75ba83edb36dff9e76f4d34031d600 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -215,4 +215,9 @@ public class YatopiaConfig {
private static void pistonPushLimit() {
pistonPushLimit = getInt("settings.pistonPushLimit", 12);
}
+
+ public static int itemStuckSleepTicks = 1;
+ private static void itemStuckSleepTicks() {
+ 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
index a7860cb4ded3e9f949e6e1a7a2afacd738da756e..6c320dca0c11452f3c98c318bb1e5a635222f5ff 100644
index 0a16ede769751678e4aabb4f0337e3142b373f78..ba01aa5ae0f0f0d8d0d3244daba5ae08580f37df 100644
--- a/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 {
@ -28,7 +28,7 @@ index a7860cb4ded3e9f949e6e1a7a2afacd738da756e..6c320dca0c11452f3c98c318bb1e5a63
if (this.world.isClientSide) {
this.noclip = false;
- } else {
+ } else if(!this.onGround || this.noclip || this.ticksLived % de.tr7zw.yapfa.YapfaConfig.itemStuckSleepTicks == 0) { // YAPFA
+ } else if(!this.onGround || this.noclip || this.ticksLived % dev.tr7zw.yatopia.YatopiaConfig.itemStuckSleepTicks == 0) { // Yatopia
this.noclip = !this.world.getCubes(this);
if (this.noclip) {
this.k(this.locX(), (this.getBoundingBox().minY + this.getBoundingBox().maxY) / 2.0D, this.locZ());

View File

@ -1,73 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Mon, 11 May 2020 21:37:44 +0200
Subject: [PATCH] lithium enum_values
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 4f10ca5ada741b4f5ef941bb9d92a2fa6a7c44ff..7f2ee293a0206d01e44dfffe2a0714719c86712a 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -128,8 +128,9 @@ public class BlockPiston extends BlockDirectional {
}
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // YAPFA - don't recreate
+
private boolean a(World world, BlockPosition blockposition, EnumDirection enumdirection) {
- EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
int j;
@@ -146,12 +147,11 @@ public class BlockPiston extends BlockDirectional {
return true;
} else {
BlockPosition blockposition1 = blockposition.up();
- EnumDirection[] aenumdirection1 = EnumDirection.values();
- j = aenumdirection1.length;
+ j = aenumdirection.length;
for (int k = 0; k < j; ++k) {
- EnumDirection enumdirection2 = aenumdirection1[k];
+ EnumDirection enumdirection2 = aenumdirection[k];
if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) {
return true;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index a1819225ea0c3ceb677877586c7b9176ffd36a4d..2e879c7f95f2db5dd44e3e1c6879d4f12bf3d408 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2563,10 +2563,14 @@ public abstract class EntityLiving extends Entity {
}
+ /**
+ * @reason Avoid cloning enum values
+ */
+ private final static EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
+
@Nullable
private Map<EnumItemSlot, ItemStack> r() {
Map<EnumItemSlot, ItemStack> map = null;
- EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
index dd64aad1ed6c2acf360e757bf0369da5fcf6be41..18a136213565794addf35511de23e078065af5f2 100644
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
@@ -167,9 +167,11 @@ public class PistonExtendsChecker {
this.f.addAll(list2);
}
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // YAPFA - don't recreate
+
private boolean a(BlockPosition blockposition) {
IBlockData iblockdata = this.a.getType(blockposition);
- EnumDirection[] aenumdirection = EnumDirection.values();
+
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {

View File

@ -1,32 +1,30 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Fri, 19 Jun 2020 19:21:35 +0200
Date: Fri, 31 Jul 2020 21:58:24 -0500
Subject: [PATCH] Option for simpler Villagers
Option to extremly simplefy the villager AI.
diff --git a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
index a158e9dc8b295f13c7ab73747cecd4c8dccce66f..aea46527b5be9ea4d06d7d68c6b9a8aec0b7e4c9 100644
--- a/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
+++ b/src/main/java/de/tr7zw/yapfa/YapfaConfig.java
@@ -221,4 +221,14 @@ public class YapfaConfig {
itemStuckSleepTicks = getInt("settings.itemStuckSleepTicks", 1);
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index 0273d800eb75ba83edb36dff9e76f4d34031d600..9f04500e167b8403c7487044a4ae03a6be61062a 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -220,4 +220,13 @@ public class YatopiaConfig {
private static void itemStuckSleepTicks() {
itemStuckSleepTicks = getInt("settings.itemStuckSleepTicks", 1);
}
+ public static boolean simplerVillagerBehavior = false;
+ private static void simplerVillagerBehavior() {
+ simplerVillagerBehavior = getBoolean("settings.villager.simplerVillagerBehavior", false);
+ simplerVillagerBehavior = getBoolean("settings.villager.simplerVillagerBehavior", false);
+ }
+
+
+ public static boolean villagersHideAtNight = false;
+ private static void villagersHideAtNight() {
+ 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
index bf019043a9338aca8d91da809f1d5520531386e7..5db697b66d813ef63a8aed8d12667c3e710cd2df 100644
index d906c5e530c2e7f779df079223aee619a73b5d51..2fb7f23275acad54d2f5e2ecd57d5bbb333facbe 100644
--- a/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;
@ -34,22 +32,20 @@ index bf019043a9338aca8d91da809f1d5520531386e7..5db697b66d813ef63a8aed8d12667c3e
import com.mojang.serialization.Dynamic;
import com.mojang.serialization.DynamicOps;
+
+import de.tr7zw.yapfa.YapfaConfig;
+import dev.tr7zw.yatopia.YatopiaConfig;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import java.util.Collection;
import java.util.Iterator;
@@ -30,7 +32,9 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent;
// CraftBukkit end
import java.util.*;
@@ -27,6 +29,8 @@ import org.bukkit.event.entity.VillagerReplenishTradeEvent;
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
-
+
+ //YAPFA
+ private boolean simplerVillagerBehavior = YapfaConfig.simplerVillagerBehavior; //get this during villager creation so a reloaded config doesn't get them into an invalid state
+ //Yatopia
+ private boolean simplerVillagerBehavior = YatopiaConfig.simplerVillagerBehavior; //get this during villager creation so a reloaded config doesn't get them into an invalid state
private static final DataWatcherObject<VillagerData> by = 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);
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});
@@ -66,12 +70,49 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@@ -63,12 +67,49 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
public EntityVillager(EntityTypes<? extends EntityVillager> entitytypes, World world, VillagerType villagertype) {
super(entitytypes, world);
this.bF = new Reputation();
@ -57,18 +53,19 @@ index bf019043a9338aca8d91da809f1d5520531386e7..5db697b66d813ef63a8aed8d12667c3e
((Navigation) this.getNavigation()).a(true);
this.getNavigation().d(true);
+ }else {
+ initPathfinder();
+ initPathfinder();
+ }
this.setCanPickupLoot(true);
this.setVillagerData(this.getVillagerData().withType(villagertype).withProfession(VillagerProfession.NONE));
this.brainTickOffset = getRandom().nextInt(100); // Purpur
}
+ //YAPFA start
+ //Yatopia start
+
+ @Override
+ protected void initPathfinder() {
+ if(!simplerVillagerBehavior)return;
+ if(!simplerVillagerBehavior)return;
+ this.goalSelector.a(0, new PathfinderGoalFloat(this));
+ if(YapfaConfig.villagersHideAtNight) {
+ if(YatopiaConfig.villagersHideAtNight) {
+ this.goalSelector.a(0, new PathfinderGoalUseItem<>(this, PotionUtil.a(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEffects.ENTITY_WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> {
+ return !this.world.isDay() && !entityvillagertrader.isInvisible();
+ }));
@ -94,94 +91,97 @@ index bf019043a9338aca8d91da809f1d5520531386e7..5db697b66d813ef63a8aed8d12667c3e
+ this.goalSelector.a(9, new PathfinderGoalInteract(this, EntityHuman.class, 3.0F, 1.0F));
+ this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F));
+ }
+ //YAPFA end
+
+ //Yatopia end
@Override
public BehaviorController<EntityVillager> getBehaviorController() {
return (BehaviorController<EntityVillager>) super.getBehaviorController(); // CraftBukkit - decompile error
@@ -84,6 +125,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@@ -82,6 +123,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@Override
protected BehaviorController<?> a(Dynamic<?> dynamic) {
+ if(simplerVillagerBehavior)return super.a(dynamic); //YAPFA Don't use behaviorcontroller for simple Villagers
+ if(simplerVillagerBehavior)return super.a(dynamic); //Yatopia Don't use behaviorcontroller for simple Villagers
BehaviorController<EntityVillager> behaviorcontroller = this.cJ().a(dynamic);
this.a(behaviorcontroller);
@@ -162,10 +204,43 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@@ -159,15 +201,47 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
super.inactiveTick();
}
// Spigot End
+ // YAPFA start
+ // Yatopia start
+ private VillagerProfession getRandomProfession() {
+ int type = random.nextInt(13);
+ switch(type) {
+ case 0: return VillagerProfession.ARMORER;
+ case 1: return VillagerProfession.BUTCHER;
+ case 2: return VillagerProfession.CARTOGRAPHER;
+ case 3: return VillagerProfession.CLERIC;
+ case 4: return VillagerProfession.FARMER;
+ case 5: return VillagerProfession.FISHERMAN;
+ case 6: return VillagerProfession.FLETCHER;
+ case 7: return VillagerProfession.LEATHERWORKER;
+ case 8: return VillagerProfession.LIBRARIAN;
+ case 9: return VillagerProfession.MASON;
+ case 10: return VillagerProfession.SHEPHERD;
+ case 11: return VillagerProfession.TOOLSMITH;
+ case 12: return VillagerProfession.WEAPONSMITH;
+ default: return VillagerProfession.FARMER;
+ }
+ int type = random.nextInt(13);
+ switch(type) {
+ case 0: return VillagerProfession.ARMORER;
+ case 1: return VillagerProfession.BUTCHER;
+ case 2: return VillagerProfession.CARTOGRAPHER;
+ case 3: return VillagerProfession.CLERIC;
+ case 4: return VillagerProfession.FARMER;
+ case 5: return VillagerProfession.FISHERMAN;
+ case 6: return VillagerProfession.FLETCHER;
+ case 7: return VillagerProfession.LEATHERWORKER;
+ case 8: return VillagerProfession.LIBRARIAN;
+ case 9: return VillagerProfession.MASON;
+ case 10: return VillagerProfession.SHEPHERD;
+ case 11: return VillagerProfession.TOOLSMITH;
+ case 12: return VillagerProfession.WEAPONSMITH;
+ default: return VillagerProfession.FARMER;
+ }
+ }
+
+ // YAPFA end
+
+
+// Yatopia end
@Override
protected void mobTick() { mobTick(false); }
protected void mobTick(boolean inactive) {
+ // YAPFA start
+ if(simplerVillagerBehavior && this.getVillagerData().getProfession() == VillagerProfession.NONE)
+ this.setVillagerData(this.getVillagerData().withProfession(getRandomProfession()));
+ if(simplerVillagerBehavior) {
+ if (canRefresh()) {
+ restUses();
+ }
+ }
+ // YAPFA end
this.world.getMethodProfiler().enter("villagerBrain");
+ if(!simplerVillagerBehavior) // YAPFA
+ // Yatopia start
+ if(simplerVillagerBehavior && this.getVillagerData().getProfession() == VillagerProfession.NONE)
+ this.setVillagerData(this.getVillagerData().withProfession(getRandomProfession()));
+ if(simplerVillagerBehavior) {
+ if (canRefresh()) {
+ restUses();
+ }
+ }
+ // 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 (this.bM) {
this.bM = false;
@@ -296,6 +371,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@@ -298,6 +372,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
return true;
}
+ public void restUses() {fb();} // YAPFA obf helper
+
+ public void restUses() {fb();} // Yatopia obf helper
+
public void fb() {
this.fp();
Iterator iterator = this.getOffers().iterator();
@@ -330,6 +407,8 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@@ -332,6 +408,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();} // YAPFA obf helper
+
+ public boolean canRefresh() {return fc();} // Yatopia obf helper
+
public boolean fc() {
long i = this.bJ + 12000L;
long j = this.world.getTime();
@@ -577,6 +656,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@@ -579,6 +657,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
}
private void a(Entity entity) {
+ if(simplerVillagerBehavior)return; // YAPFA
+ if(simplerVillagerBehavior)return; // Yatopia
if (this.world instanceof WorldServer) {
Optional<List<EntityLiving>> optional = this.bn.getMemory(MemoryModuleType.VISIBLE_MOBS);
@@ -593,6 +673,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
@@ -604,6 +683,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
}
public void a(MemoryModuleType<GlobalPos> memorymoduletype) {
+ if(simplerVillagerBehavior)return; // YAPFA
+ if(simplerVillagerBehavior)return; // Yatopia
if (this.world instanceof WorldServer) {
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();

View File

@ -1,64 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Mon, 11 May 2020 21:50:18 +0200
Subject: [PATCH] lithium MixinAxisCycleDirection
diff --git a/src/main/java/net/minecraft/server/EnumAxisCycle.java b/src/main/java/net/minecraft/server/EnumAxisCycle.java
index a7c2543fdd4d5f6a04c45ec42472837ccaea9619..d05cddcc90e220c42548b2eb7b190fc63e9d51f5 100644
--- a/src/main/java/net/minecraft/server/EnumAxisCycle.java
+++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java
@@ -24,14 +24,27 @@ public enum EnumAxisCycle {
return enumdirection_enumaxis.a(k, i, j);
}
+ /**
+ * The JVM has difficulty optimizing these functions due to the use of dynamic dispatch. They can trivially be
+ * implemented as a simple switch lookup table.
+ */
@Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() + 1, 3)];
+ switch (enumdirection_enumaxis) {
+ case X:
+ return EnumDirection.EnumAxis.Y;
+ case Y:
+ return EnumDirection.EnumAxis.Z;
+ case Z:
+ return EnumDirection.EnumAxis.X;
+ }
+
+ throw new IllegalArgumentException();
}
@Override
public EnumAxisCycle a() {
- return null.BACKWARD;
+ return BACKWARD;
}
},
BACKWARD {
@@ -42,12 +55,21 @@ public enum EnumAxisCycle {
@Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() - 1, 3)];
+ switch (enumdirection_enumaxis) {
+ case X:
+ return EnumDirection.EnumAxis.Z;
+ case Y:
+ return EnumDirection.EnumAxis.X;
+ case Z:
+ return EnumDirection.EnumAxis.Y;
+ }
+
+ throw new IllegalArgumentException();
}
@Override
public EnumAxisCycle a() {
- return null.FORWARD;
+ return FORWARD;
}
};

View File

@ -5,50 +5,50 @@ 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
index f27c7041cdc2f062f0abb222b02026194ab33c60..384cb3c62a3fb0972cf6058b219d1e0731a8dc0d 100644
index c2af174e639396ac70eb7b520fdd641b1d2c67e6..7de6e116a7e301754c637b68be39c30f610a04d7 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -89,7 +89,24 @@ public class CraftingManager extends ResourceDataJson {
@@ -83,7 +83,24 @@ public class CraftingManager extends ResourceDataJson {
}).findFirst();
c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
// CraftBukkit end
- return recipe;
+ // YAPFA start
+ if(c0.getCurrentRecipe() != null) {
+ Optional<T> optional = recipes.a(c0.getCurrentRecipe(), world, c0);
+ if(optional.isPresent()) {
+ // Yatopia start
+ if(c0.getCurrentRecipe() != null) {
+ Optional<T> optional = recipes.a(c0.getCurrentRecipe(), world, c0);
+ if(optional.isPresent()) {
+ c0.setCurrentRecipe(optional.get());
+ return optional;
+ }
+ }
+ return optional;
+ }
+ }
+ for(IRecipe<C> rep : this.a(recipes)) {
+ Optional<T> optional = recipes.a(rep, world, c0);
+ if(optional.isPresent()) {
+ Optional<T> optional = recipes.a(rep, world, c0);
+ if(optional.isPresent()) {
+ c0.setCurrentRecipe(optional.get());
+ return optional;
+ }
+ return optional;
+ }
+ }
+ c0.setCurrentRecipe(null); // CraftBukkit - Clear recipe when no recipe is found
+ return Optional.empty();
+ // YAPFA end
+ // Yatopia end
}
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
index 59aa2f8a797482c43fd47d3bce936772ad3cd6aa..7b1d20d395ffd264b23dccba230f5e6205796b56 100644
index acc533ca8ad612cc439208f4adf6e3d3289c92c7..eded99b59beb7d6fe759b21fa7d3082057c741d4 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -99,7 +99,13 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
this.c = recipes;
}
+ //YAPFA
+ //Yatopia
+ private static Map<Item, Integer> cachedFuelMap = null;
+
+
public static Map<Item, Integer> f() {
+ if(cachedFuelMap != null) {
+ return cachedFuelMap; // YAPFA
+ }
+ if(cachedFuelMap != null) {
+ return cachedFuelMap; // Yatopia
+ }
Map<Item, Integer> map = Maps.newLinkedHashMap();
a(map, (IMaterial) Items.LAVA_BUCKET, 20000);
@ -56,16 +56,16 @@ index 59aa2f8a797482c43fd47d3bce936772ad3cd6aa..7b1d20d395ffd264b23dccba230f5e62
a(map, (IMaterial) Blocks.FLETCHING_TABLE, 300);
a(map, (IMaterial) Blocks.SMITHING_TABLE, 300);
a(map, (IMaterial) Blocks.COMPOSTER, 300);
+ cachedFuelMap = map; // YAPFA
+ cachedFuelMap = map; // Yatopia
return map;
}
@@ -613,4 +620,19 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
@@ -615,4 +622,19 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
}
}
+
+ // YAPFA start
+
+ // Yatopia start
+ private IRecipe cachedRecipe = null;
+ @Override
+ public IRecipe getCurrentRecipe() {
@ -73,10 +73,10 @@ index 59aa2f8a797482c43fd47d3bce936772ad3cd6aa..7b1d20d395ffd264b23dccba230f5e62
+ }
+ @Override
+ public void setCurrentRecipe(IRecipe recipe) {
+ cachedRecipe = recipe;
+ cachedRecipe = recipe;
+ }
+
+
+ // YAPFA end
+
+
+ // Yatopia end
+
}

View File

@ -18,24 +18,24 @@ index 1ce89c28c2b54278dc8f1c17f2d0ccb743a27b34..1b360140b6161e9cae96752943d57420
if (iinventory == null) {
diff --git a/src/main/java/net/minecraft/server/BlockHopper.java b/src/main/java/net/minecraft/server/BlockHopper.java
index a29294fbc7cd6fcfff0df9eadd11de3bd7f1405e..3a07fb76ebeddaf6b3676e04a995638cc43cf2f2 100644
index a29294fbc7cd6fcfff0df9eadd11de3bd7f1405e..7918382f26807f945dc7966b81c3c1e2f0fc3c41 100644
--- a/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 {
@Override
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
this.a(world, blockposition, iblockdata);
+ //YAPFA start
+ //Yatopia start
+ TileEntity tileEntity = world.getTileEntity(blockposition);
+ if (tileEntity instanceof TileEntityHopper) {
+ ((TileEntityHopper)tileEntity).flushCaches();
+ }
+ // YAPFA end
+ // Yatopia end
}
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
index 20df9bd21d0e4d2579d05d79672da2eb26478044..a7f9d3e5ec1d582eb7101d5b6a969281b15be028 100644
index d68503f0291303f74ed3fc459a9f34ce44cf13d7..f05fed742957de7bdf6d056fdb243d286a1c1b0e 100644
--- a/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;
@ -46,27 +46,27 @@ index 20df9bd21d0e4d2579d05d79672da2eb26478044..a7f9d3e5ec1d582eb7101d5b6a969281
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@@ -611,14 +612,44 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
@@ -629,14 +630,44 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
@Nullable
private IInventory l() {
+ if(this.cachedPush != null) {
+ return this.cachedPush;
+ }
+ if(this.cachedPush != null) {
+ return this.cachedPush;
+ }
EnumDirection enumdirection = (EnumDirection) this.getBlock().get(BlockHopper.FACING);
- return b(this.getWorld(), this.position.shift(enumdirection));
+ IInventory tmp = b(this.getWorld(), this.position.shift(enumdirection), this.cachedPushAir);
+ if(tmp != null && !(tmp instanceof IWorldInventory) && !(tmp instanceof Entity)) {
+ this.cachedPush = tmp;
+ this.cachedPush = tmp;
+ }else {
+ if(tmp == null) {
+ this.cachedPushAir = true;
+ }
+ return tmp;
+ if(tmp == null) {
+ this.cachedPushAir = true;
+ }
+ return tmp;
+ }
+ if(this.cachedPush == null) {
+ this.cachedPushAir = true;
+ this.cachedPushAir = true;
+ }
+ return this.cachedPush;
}
@ -74,85 +74,76 @@ index 20df9bd21d0e4d2579d05d79672da2eb26478044..a7f9d3e5ec1d582eb7101d5b6a969281
@Nullable
public static IInventory b(IHopper ihopper) {
- return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A());
+ //YAPFA start
+ if(ihopper instanceof TileEntityHopper) {
+ TileEntityHopper hopper = (TileEntityHopper) ihopper;
+ if(hopper.cachedAbove != null) {
+ return hopper.cachedAbove;
+ }
+ IInventory inv = a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), hopper.cachedPullAir);
+ hopper.cachedAbove = inv;
+ if(hopper.cachedAbove == null) {
+ hopper.cachedPullAir = true;
+ }
+ //Yatopia start
+ if(ihopper instanceof TileEntityHopper) {
+ TileEntityHopper hopper = (TileEntityHopper) ihopper;
+ if(hopper.cachedAbove != null) {
+ return hopper.cachedAbove;
+ }
+ IInventory inv = a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), hopper.cachedPullAir);
+ hopper.cachedAbove = inv;
+ if(hopper.cachedAbove == null) {
+ hopper.cachedPullAir = true;
+ }
+ return inv;
+ } else {
+ return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), false);
+ }
+ //YAPFA end
+ } else {
+ return a(ihopper.getWorld(), ihopper.x(), ihopper.z() + 1.0D, ihopper.A(), false);
+ }
+ //Yatopia end
}
public static List<EntityItem> c(IHopper ihopper) {
@@ -633,14 +664,15 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
@@ -651,14 +682,15 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
@Nullable
- 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
+ public static IInventory b(World world, BlockPosition blockposition, boolean skipBlockCheck) {
+ return a(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, true, skipBlockCheck); // YAPFA // Paper
+ return a(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, true, skipBlockCheck); // Yatopia // Paper
}
@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, boolean optimizeEntities) { // Paper
- Object object = null;
+ public static IInventory a(World world, double d0, double d1, double d2, boolean skipBlockCheck) { return a(world, d0, d1, d2, false, skipBlockCheck); } // YAPFA // Paper - overload to default false
+ public static IInventory a(World world, double d0, double d1, double d2, boolean optimizeEntities, boolean skipBlockCheck) { // YAPFA // Paper
+ Object object = null;
+ if(!skipBlockCheck) { // YAPFA
+ 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 optimizeEntities, boolean skipBlockCheck) { // Yatopia // Paper
+ Object object = null;
+ if(!skipBlockCheck) { // Yatopia
BlockPosition blockposition = new BlockPosition(d0, d1, d2);
if ( !world.isLoaded( blockposition ) ) return null; // Spigot
IBlockData iblockdata = world.getType(blockposition);
@@ -658,15 +690,16 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
@@ -676,8 +708,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
}
}
}
-
+ }
- 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()*/)) { // YAPFA // Paper
+ if (object == null && (!optimizeEntities || true/*!org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(block).isOccluding()*/)) { // Yatopia // Paper
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()) {
object = (IInventory) list.get(world.random.nextInt(list.size()));
}
}
-
+
return (IInventory) object;
}
@@ -728,4 +761,21 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
@@ -746,4 +779,21 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi
protected Container createContainer(int i, PlayerInventory playerinventory) {
return new ContainerHopper(i, playerinventory, this);
}
+
+ // YAPFA start
+
+
+ // Yatopia start
+
+ private IInventory cachedAbove = null;
+ private IInventory cachedPush = null;
+ private boolean cachedPushAir = false;
+ private boolean cachedPullAir = false;
+
+
+ public void flushCaches() {
+ cachedAbove = null;
+ cachedPush = null;
+ cachedPushAir = false;
+ cachedPullAir = false;
+ cachedAbove = null;
+ cachedPush = null;
+ cachedPushAir = false;
+ cachedPullAir = false;
+ }
+
+ // YAPFA end
+
+
+ // Yatopia end
+
}

View File

@ -1,14 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Fri, 17 Jul 2020 01:10:17 +0200
Date: Fri, 31 Jul 2020 22:04:17 -0500
Subject: [PATCH] Optimize TileEntity loading
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
index a2e3e96e1e96c152de820283c1f8cb6248321f54..1725fc72846949fa08009ca5bec6214828bbbf3c 100644
index c2c19a6fbfa2a4aba21aa71789071c69a6246556..7dfd36e22a896ae440bbda6db0628c44493b44d2 100644
--- 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
@@ -1,11 +1,10 @@
@@ -1,12 +1,10 @@
package me.jellysquid.mods.lithium.common.util.collections;
-import it.unimi.dsi.fastutil.objects.ObjectArraySet;
@ -17,11 +17,12 @@ index a2e3e96e1e96c152de820283c1f8cb6248321f54..1725fc72846949fa08009ca5bec62148
/**
* Wraps a {@link List} with a hash table which provides O(1) lookups for {@link Collection#contains(Object)}.
- *
+ * Uses a hashset so some issues can happen if the same entry get's added multiple times! (Doesn't matter for this usecase)
*
* @see https://github.com/jellysquid3/lithium-fabric/blob/1.16.x/fabric/src/main/java/me/jellysquid/mods/lithium/common/util/collections/HashedList.java
*/
@@ -163,6 +162,6 @@ public class HashedList<T> implements List<T> {
public class HashedList<T> implements List<T> {
@@ -163,6 +161,6 @@ public class HashedList<T> implements List<T> {
}
public static <T> HashedList<T> wrapper(List<T> list) {
@ -31,7 +32,7 @@ index a2e3e96e1e96c152de820283c1f8cb6248321f54..1725fc72846949fa08009ca5bec62148
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4a956f36812f36ea9898cb9e0c231ddb5eaa12cd..98196c11e6b22b14c0c23ae877559f06a5795a0f 100644
index 2ab8412f20a77547c8bb12b927d23b2acb84965b..034ba79e67f3e4b0af4372e6942007efdd2e7096 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2,6 +2,8 @@ package net.minecraft.server;
@ -57,8 +58,8 @@ index 4a956f36812f36ea9898cb9e0c231ddb5eaa12cd..98196c11e6b22b14c0c23ae877559f06
//public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
- public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
- protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
+ public final List<TileEntity> tileEntityListTick = HashedList.wrapper(Lists.newArrayList()); // YAPFA
+ protected final List<TileEntity> tileEntityListPending = HashedList.wrapper(Lists.newArrayList()); // YAPFA
+ public final List<TileEntity> tileEntityListTick = HashedList.wrapper(Lists.newArrayList()); // Yatopia
+ protected final List<TileEntity> tileEntityListPending = HashedList.wrapper(Lists.newArrayList()); // Yatopia
protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
public final Thread serverThread;
private final boolean debugWorld;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Global Eula file
diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java
index 229c3b0f0c650b501f31147adaa17194af57fedd..703f90500188f037ec907cdb610aa86c7ed9ecf1 100644
index 229c3b0f0c650b501f31147adaa17194af57fedd..e70da06948abf2aa2223a037aeb5f58fb0a466e3 100644
--- a/src/main/java/net/minecraft/server/EULA.java
+++ b/src/main/java/net/minecraft/server/EULA.java
@@ -1,9 +1,11 @@
@ -25,26 +25,26 @@ index 229c3b0f0c650b501f31147adaa17194af57fedd..703f90500188f037ec907cdb610aa86c
public EULA(java.nio.file.Path java_nio_file_path) {
this.b = java_nio_file_path;
- this.c = SharedConstants.d || this.b();
+ this.c = SharedConstants.d || globalEula() || this.b(this.b); // YAPFA
+ this.c = SharedConstants.d || globalEula() || this.b(this.b); // Yatopia
+ }
+
+ // Yatopia start
+
+ private boolean globalEula() {
+ File globalEula = new File(System.getProperty("user.home"), "eula.txt");
+
+ if(globalEula.exists()) {
+ return b(globalEula.toPath());
+ } else {
+ System.out.println("No global eula found at " + globalEula.getAbsolutePath());
+ }
+ return false;
}
- private boolean b() {
+ // YAPFA start
+
+ private boolean globalEula() {
+ File globalEula = new File(System.getProperty("user.home"), "eula.txt");
+ // Yatopia end
+
+ if(globalEula.exists()) {
+ return b(globalEula.toPath());
+ } else {
+ System.out.println("No global eula found at " + globalEula.getAbsolutePath());
+ }
+ return false;
+ }
+
+ // YAPFA end
+
+ private boolean b(java.nio.file.Path path) { // YAPFA
+ private boolean b(java.nio.file.Path path) { // Yatopia
try {
- InputStream inputstream = Files.newInputStream(this.b);
+ InputStream inputstream = Files.newInputStream(path);

View File

@ -1,12 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=84=97=E3=84=A0=CB=8B=20=E3=84=91=E3=84=A7=CB=8A?=
<tsao-chi@the-lingo.org>
Date: Thu, 2 Apr 2020 11:16:18 +0800
Subject: [PATCH] Akarin Save json list async
From: tsao chi <tsao-chi@the-lingo.org>
Date: Fri, 31 Jul 2020 22:11:10 -0500
Subject: [PATCH] Akarin Updated Save json list async
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
index 9213bfb78e92b838189161045e3945588251b486..f2c14ba3123556ea6a3d0b9c945271fa2e08aff0 100644
index 9213bfb78e92b838189161045e3945588251b486..6d7452d05c648cdee50b2077aec6f100449b8229 100644
--- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -20,6 +20,8 @@ import java.util.Iterator;
@ -26,7 +25,7 @@ index 9213bfb78e92b838189161045e3945588251b486..f2c14ba3123556ea6a3d0b9c945271fa
this.removeStaleEntries(); // Paper - remove expired values before saving
JsonArray jsonarray = new JsonArray();
@@ -155,29 +158,21 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
@@ -155,29 +158,20 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
jsonlistentry.getClass();
return (JsonObject) SystemUtils.a(jsonobject, jsonlistentry::a); // CraftBukkit - decompile error
}).forEach(jsonarray::add);
@ -35,12 +34,12 @@ index 9213bfb78e92b838189161045e3945588251b486..f2c14ba3123556ea6a3d0b9c945271fa
Throwable throwable = null;
try {
+ bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
+ bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
JsonList.b.toJson(jsonarray, bufferedwriter);
} catch (Throwable throwable1) {
throwable = throwable1;
- throwable = throwable1;
- throw throwable1;
+ JsonList.LOGGER.warn("Failed to save " + this.c, e); // Akarin - Save json list async
+ throw new RuntimeException(throwable1);
} finally {
- if (bufferedwriter != null) {
- if (throwable != null) {
@ -53,10 +52,10 @@ index 9213bfb78e92b838189161045e3945588251b486..f2c14ba3123556ea6a3d0b9c945271fa
- bufferedwriter.close();
- }
- }
+ IOUtils.closeQuietly(bufferedwriter);
}
-
+ IOUtils.closeQuietly(bufferedwriter);
}
+ }; // Akarin - Save json list async
+ MCUtil.scheduleAsyncTask(runnable); // Akarin - Save json list async
}

View File

@ -0,0 +1,76 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Fri, 31 Jul 2020 22:31:08 -0500
Subject: [PATCH] Akarin updated Cache hashcode for BlockPosition
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index dab89b0c69ddff24d37cee06107bdc464012c6bb..1e0acca45d0c8f7873176a46018b38eba02aa667 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -28,6 +28,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
return b < 0 || b >= 256;
}
// Paper end
+ protected int hash; // Akarin - cache hashcode
public BaseBlockPosition(int i, int j, int k) {
this.a = i;
@@ -52,8 +53,20 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
}
public final int hashCode() { // Paper
- return (this.getY() + this.getZ() * 31) * 31 + this.getX();
- }
+ // Akarin start - cache hashcode
+ int result = hash; // Make the situation not too bad when it is modified by multiple threads
+ if (result == 0) {
+ result = (this.b + this.e * 31) * 31 + this.a; // Paper
+ hash = result;
+ }
+ return result;
+ // return (this.getY() + this.getZ() * 31) * 31 + this.getX();
+ }
+
+ public final void recalcHashCode() {
+ hash = 0;
+ }
+ // Akarin end
public int compareTo(BaseBlockPosition baseblockposition) {
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 7ff4948a47be03c65c162ca04b2338cdcdafe7c4..14a626f98fb1faf38cf3d3e9d0bc79baf14559ac 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -438,7 +438,9 @@ public class BlockPosition extends BaseBlockPosition {
}
public BlockPosition.MutableBlockPosition e(int i, int j, int k) {
- return this.d(this.getX() + i, this.getY() + j, this.getZ() + k);
+ this.d(this.getX() + i, this.getY() + j, this.getZ() + k);
+ this.recalcHashCode();
+ return this;
}
public BlockPosition.MutableBlockPosition a(EnumDirection.EnumAxis enumdirection_enumaxis, int i, int j) {
@@ -469,16 +471,19 @@ public class BlockPosition extends BaseBlockPosition {
// Tuinity - moved up
public final void o(int i) { // Tuinity
((BaseBlockPosition)this).a = i; // need cast thanks to name conflict
+ this.recalcHashCode();
}
// Tuinity - moved up
public final void p(int i) { // Tuinity
((BaseBlockPosition)this).b = i; // Tuinity
+ this.recalcHashCode();
}
// Tuinity - moved up
public final void q(int i) { // Tuinity
((BaseBlockPosition)this).e = i; // Tuinity
+ this.recalcHashCode();
}
@Override

View File

@ -0,0 +1,358 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tsao chi <tsao-chi@the-lingo.org>
Date: Sun, 2 Aug 2020 12:25:52 -0500
Subject: [PATCH] Akarin updated Async Path Finding
Co-Author: 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..c4c3ef500b9b8465644a0b7712f43ba35ad3acc1 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() {
if (!EntityBee.this.bJ.k()) {
- super.c();
+ super.tickAsync();
}
}
};
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 027a55223c660f25b0b52f99efed5b0c037ae658..09f332aa02604dd86224a6f66ec4f84d7bf99318 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
index 681465d8a74831461dce4615d2d19c7ed46bc299..f04411a2a295d2a982dca5851ae76a80a6a83585 100644
--- a/src/main/java/net/minecraft/server/Navigation.java
+++ b/src/main/java/net/minecraft/server/Navigation.java
@@ -183,7 +183,7 @@ public class Navigation extends NavigationAbstract {
double d3 = (double) j2 + 0.5D - vec3d.z;
if (d2 * d0 + d3 * d1 >= 0.0D) {
- PathType pathtype = this.o.a(this.b, i2, j - 1, j2, this.a, l, i1, j1, true, true);
+ PathType pathtype = this.o.a(this.o.a, i2, j - 1, j2, this.a, l, i1, j1, true, true); // Akarin - use chunk cache
if (!this.a(pathtype)) {
return false;
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 2405dc5e9a6a971a565c37710b61d5fc4737bdf8..2dac507e9e0044a32ae54ea57eada0de04c1467d 100644
--- a/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 {
private int q;
private float r;
private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
+ // Akarin start - Async pathfinder
+ private long lastPathfindAsync;
+ private static final java.util.concurrent.ExecutorService pathfindExecutor =
+ java.util.concurrent.Executors.newSingleThreadExecutor(
+ new com.google.common.util.concurrent.ThreadFactoryBuilder()
+ .setDaemon(true)
+ .setNameFormat("StarLink Pathfinder - %d")
+ .build());
+ // Akarin end
// Tuinity start
public boolean isViableForPathRecalculationChecking() {
@@ -83,7 +92,40 @@ public abstract class NavigationAbstract {
}
}
+ // Akarin start - Async pathfinder, copied from above with modification
+ public void doPathfindAsync() {
+ if (this.b.getTime() - this.lastPathfindAsync > 20L) {
+ if (this.p != null) {
+ this.lastPathfindAsync = this.b.getTime();
+
+ // Bake chunk cache
+ float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);;
+ BlockPosition blockposition = this.a.getChunkCoordinates();
+ int k = (int) (f + (float) 8);
+ ChunkCache cache = 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()) {
+ doTickAsync(this.c);
+ return;
+ }
+ pathfindExecutor.execute(() -> {
+ PathEntity result = findPathAsync(cache, java.util.Collections.singleton(this.p), this.q);
+ NavigationAbstract.this.b.getMinecraftServer().processQueue.add(() -> {
+ if (result != null && result.m() != null)
+ this.p = result.m();
+
+ NavigationAbstract.this.c = result;
+ });
+ });
+ }
+ } else {
+ // Execute directly, keep behaviour with vanilla, see the original doTick method
+ doTickAsync(this.c);
+ }
+ }
+ // Akarin end
@Nullable
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
return this.a(new BlockPosition(d0, d1, d2), i);
@@ -164,7 +206,17 @@ public abstract class NavigationAbstract {
return pathentity;
}
}
-
+ // 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() {
++this.e;
if (this.m) {
this.j();
@@ -238,7 +290,7 @@ public abstract class NavigationAbstract {
Vec3D vec3d;
if (this.a()) {
- this.l();
+ //this.l();
} else if (this.c != null && this.c.f() < this.c.e()) {
vec3d = this.b();
Vec3D vec3d1 = this.c.a(this.a, this.c.f());
@@ -256,9 +308,44 @@ 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 Start
+ public void c() {
+ this.tickAsync();
+ }
+ //Yatopia End
+ // Akarin start - Async pathfinder, copied from above
+ public void tickAsync() {
+ ++this.e;
+ this.doPathfindAsync();
}
- protected void l() {
+ // This was copied from above partly with param
+ public void doTickAsync(PathEntity pathEntity) {
+ if (shouldContinuePathfind(pathEntity))
+ return;
+
+ Vec3D vec3d;
+ if (this.a()) {
+ this.applyPath(pathEntity);
+ } else if (pathEntity.f() < pathEntity.e()) {
+ vec3d = this.b();
+ 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)) {
+ 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, 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 +360,26 @@ public abstract class NavigationAbstract {
}
this.a(vec3d);
- }
+ }*/
+
+ // Akarin start - Async pathfinder, copied from above with param
+ protected void applyPath(PathEntity pathEntity) {
+ Vec3D vec3d = this.b();
+
+ this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F;
+ BaseBlockPosition baseblockposition = pathEntity.g();
+ double d0 = Math.abs(this.a.locX() - ((double) baseblockposition.getX() + 0.5D));
+ double d1 = Math.abs(this.a.locY() - (double) baseblockposition.getY());
+ double d2 = Math.abs(this.a.locZ() - ((double) baseblockposition.getZ() + 0.5D));
+ boolean flag = d0 < (double) this.l && d2 < (double) this.l && d1 < 1.0D;
+ if (flag || this.a.b(pathEntity.h().l) && this.b(vec3d)) {
+ pathEntity.c(pathEntity.f() + 1);
+ }
+
+ this.applyPath0(pathEntity, vec3d);
+ }
+ // Akarin end
private boolean b(Vec3D vec3d) {
if (this.c.e() <= this.c.f() + 1) {
return false;
@@ -324,7 +429,39 @@ public abstract class NavigationAbstract {
}
}
+ // Akarin start - Async pathfinder, copied from above with param
+ protected void applyPath0(PathEntity pathEntity, Vec3D vec3d) {
+ if (this.e - this.f > 100) {
+ if (vec3d.distanceSquared(this.g) < 2.25D) {
+ this.o();
+ }
+
+ this.f = this.e;
+ this.g = vec3d;
+ }
+
+ if (!pathEntity.b()) {
+ BaseBlockPosition baseblockposition = pathEntity.g();
+
+ if (baseblockposition.equals(this.h)) {
+ this.i += SystemUtils.getMonotonicMillis() - this.j;
+ } else {
+ this.h = baseblockposition;
+ double d0 = vec3d.f(Vec3D.c(this.h));
+
+ 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) {
+ this.e();
+ this.o();
+ }
+
+ this.j = SystemUtils.getMonotonicMillis();
+ }
+ }
+ // Akarin end
private void e() {
this.h = BaseBlockPosition.ZERO;
this.i = 0L;
@@ -389,7 +526,11 @@ public abstract class NavigationAbstract {
public boolean r() {
return this.o.e();
}
-
+ // Akarin start - Async pathfinder, copied from above with param
+ 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
index 0c33a0c9d59d79a39826b5ee14144604717ffebe..cf3f4c1a2a89cce0345566a62faa34ef7e93c603 100644
--- a/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 {
return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
}
- @Override
+/* @Override
public void c() {
++this.e;
if (this.m) {
@@ -53,6 +53,31 @@ public class NavigationFlying extends NavigationAbstract {
this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d);
}
}
+ }*/
+
+ // 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);
}
@Override
diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java
index 1c3a8043e735ec4605635efcfc5deb08a35ea1fd..bf2ac046eebd7f88fcb1d953f37952e791e6ea83 100644
--- a/src/main/java/net/minecraft/server/Pathfinder.java
+++ b/src/main/java/net/minecraft/server/Pathfinder.java
@@ -26,7 +26,7 @@ public class Pathfinder {
}
@Nullable
- public PathEntity a(ChunkCache chunkcache, EntityInsentient entityinsentient, Set<BlockPosition> set, float f, int i, float f1) {
+ public synchronized PathEntity a(ChunkCache chunkcache, EntityInsentient entityinsentient, Set<BlockPosition> set, float f, int i, float f1) { // Akarin - synchronized
this.d.a();
this.c.a(chunkcache, entityinsentient);
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
index cea160885783e8666b616375eac44ba6d1880e1f..9598563b4f97500fd3fba0165813d564d9c96c4f 100644
--- a/src/main/java/net/minecraft/server/PathfinderTurtle.java
+++ b/src/main/java/net/minecraft/server/PathfinderTurtle.java
@@ -148,7 +148,7 @@ public class PathfinderTurtle extends PathfinderNormal {
if (pathtype == PathType.OPEN) {
AxisAlignedBB axisalignedbb = new AxisAlignedBB((double) i - d2 + 0.5D, (double) j + 0.001D, (double) k - d2 + 0.5D, (double) i + d2 + 0.5D, (double) ((float) j + this.b.getHeight()), (double) k + d2 + 0.5D);
- if (!this.b.world.getCubes(this.b, axisalignedbb)) {
+ if (!this.a.getCubes(this.b, axisalignedbb)) { // Akarin - use chunk cache
return null;
}
diff --git a/src/main/java/net/minecraft/server/PathfinderWater.java b/src/main/java/net/minecraft/server/PathfinderWater.java
index fba6692a1e537b90e20aa448567c0ad6db653332..d576edc8c30288e98aeda8f1cb561b22c6b37536 100644
--- a/src/main/java/net/minecraft/server/PathfinderWater.java
+++ b/src/main/java/net/minecraft/server/PathfinderWater.java
@@ -63,7 +63,7 @@ public class PathfinderWater extends PathfinderAbstract {
@Override
protected PathPoint a(int i, int j, int k) {
PathPoint pathpoint = null;
- PathType pathtype = this.a(this.b.world, i, j, k);
+ PathType pathtype = this.a(this.a, i, j, k); // Akarin - use chunk cache
float f = this.b.a(pathtype);
if (f >= 0.0F) {

View File

@ -0,0 +1,198 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Mon, 3 Aug 2020 17:38:07 +0200
Subject: [PATCH] Redirect Configs
diff --git a/src/main/java/app/akarin/server/Config.java b/src/main/java/app/akarin/server/Config.java
index 1742facec843dd87897d62e4aab819835fab4a38..358ac3361c814b7cf5f9650a6a49c6efce7dd56a 100644
--- a/src/main/java/app/akarin/server/Config.java
+++ b/src/main/java/app/akarin/server/Config.java
@@ -4,6 +4,8 @@ import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
+import dev.tr7zw.yatopia.YatopiaConfig;
+
import java.io.File;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -22,8 +24,8 @@ public final class Config {
private static int configVersion;
public static void init(final File file) {
- Config.configFile = file;
- final YamlConfiguration config = new YamlConfiguration();
+ Config.configFile = YatopiaConfig.CONFIG_FILE;
+ /*final YamlConfiguration config = new YamlConfiguration();
config.options().header(CONFIG_HEADER);
config.options().copyDefaults(true);
@@ -40,9 +42,9 @@ public final class Config {
Bukkit.getLogger().log(Level.SEVERE, "Failure to load Akarin config", ex);
throw new RuntimeException(ex);
}
- }
+ }*/
- Config.load(config);
+ Config.load(YatopiaConfig.config);
}
public static void load(final YamlConfiguration config) {
diff --git a/src/main/java/com/mrivanplays/origami/OrigamiConfig.java b/src/main/java/com/mrivanplays/origami/OrigamiConfig.java
index 111fa3cd586c31eb0ab9fd425179d1f54a40a0f4..9038b3324c50982e85c5e1992de99df6ba902a89 100644
--- a/src/main/java/com/mrivanplays/origami/OrigamiConfig.java
+++ b/src/main/java/com/mrivanplays/origami/OrigamiConfig.java
@@ -2,6 +2,8 @@ package com.mrivanplays.origami;
import com.destroystokyo.paper.util.SneakyThrow;
+import dev.tr7zw.yatopia.YatopiaConfig;
+
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
@@ -23,7 +25,7 @@ public final class OrigamiConfig {
private static int configVersion;
public static void init(final File file) {
- OrigamiConfig.configFile = file;
+ /*OrigamiConfig.configFile = file;
final YamlConfiguration config = new YamlConfiguration();
config.options().header(CONFIG_HEADER);
config.options().copyDefaults(true);
@@ -42,8 +44,9 @@ public final class OrigamiConfig {
SneakyThrow.sneaky(e);
throw new RuntimeException(e); // unreachable
}
- }
- load(config);
+ }*/
+ configFile = YatopiaConfig.CONFIG_FILE;
+ load(YatopiaConfig.config);
}
public static void load(final YamlConfiguration config) {
diff --git a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
index 9f04500e167b8403c7487044a4ae03a6be61062a..fb3bf0731512b5517ca7ccb3240085b40e7f2abb 100644
--- a/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
+++ b/src/main/java/dev/tr7zw/yatopia/YatopiaConfig.java
@@ -33,7 +33,7 @@ import org.spigotmc.WatchdogThread;
public class YatopiaConfig {
- private static File CONFIG_FILE;
+ public static File CONFIG_FILE;
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"
+ "You have been warned!\n";
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 9ba65a7528755f54b9a1c4b1323b6e75de867f14..334cae3210cbe9e4d7e6f037c36c489f250c1021 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -169,6 +169,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return false;
}
com.destroystokyo.paper.PaperConfig.registerCommands();
+ // Yatopia start
+ try {
+ dev.tr7zw.yatopia.YatopiaConfig.init(new File("yatopia.yml"));
+ } catch (Exception e) {
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
+ return false;
+ }
+ dev.tr7zw.yatopia.YatopiaConfig.registerCommands();
+ // Yatopia end
// Purpur start
try {
net.pl3x.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
@@ -185,15 +194,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
us.minevict.papercut.PapercutConfig.init((java.io.File) options.valueOf("papercut-settings")); // Papercut
com.mrivanplays.origami.OrigamiConfig.init((java.io.File) options.valueOf("origami-settings")); // Origami - server config
- // Yatopia start
- try {
- dev.tr7zw.yatopia.YatopiaConfig.init(new File("yatopia.yml"));
- } catch (Exception e) {
- DedicatedServer.LOGGER.error("Unable to load server configuration", e);
- return false;
- }
- dev.tr7zw.yatopia.YatopiaConfig.registerCommands();
- // Yatopia end
this.setPVP(dedicatedserverproperties.pvp);
this.setAllowFlight(dedicatedserverproperties.allowFlight);
this.setResourcePack(dedicatedserverproperties.resourcePack, this.aY());
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index b3d6e713c2bfa1a0432b4afc3e8c31d4d7ca5844..0b3f40ed4b226bc71597182b546ff7becd1ef7c7 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -1,6 +1,8 @@
package net.pl3x.purpur;
import com.google.common.base.Throwables;
+
+import dev.tr7zw.yatopia.YatopiaConfig;
import net.minecraft.server.MinecraftServer;
import net.pl3x.purpur.command.PurpurCommand;
import org.bukkit.Bukkit;
@@ -37,8 +39,8 @@ public class PurpurConfig {
static boolean verbose;
public static void init(File configFile) {
- CONFIG_FILE = configFile;
- config = new YamlConfiguration();
+ CONFIG_FILE = YatopiaConfig.CONFIG_FILE;
+ /*config = new YamlConfiguration();
try {
config.load(CONFIG_FILE);
} catch (IOException ignore) {
@@ -47,7 +49,8 @@ public class PurpurConfig {
throw Throwables.propagate(ex);
}
config.options().header(HEADER);
- config.options().copyDefaults(true);
+ config.options().copyDefaults(true);*/
+ config = YatopiaConfig.config;
verbose = getBoolean("verbose", false);
commands = new HashMap<>();
diff --git a/src/main/java/us/minevict/papercut/PapercutConfig.java b/src/main/java/us/minevict/papercut/PapercutConfig.java
index 1256b689481f9d31dc2fbbf6072293c293ed6c2e..f242810198a48e82838e67dd356da596e3288f8e 100644
--- a/src/main/java/us/minevict/papercut/PapercutConfig.java
+++ b/src/main/java/us/minevict/papercut/PapercutConfig.java
@@ -1,6 +1,9 @@
package us.minevict.papercut;
import com.destroystokyo.paper.util.SneakyThrow;
+
+import dev.tr7zw.yatopia.YatopiaConfig;
+
import java.io.File;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -20,7 +23,7 @@ public final class PapercutConfig {
private static int configVersion;
public static void init(final File file) {
- final File papercutConfig = new File(file.getParent(), "papercut.yml");
+ /*final File papercutConfig = new File(file.getParent(), "papercut.yml");
if (!papercutConfig.exists()) {
final File oldConfig = new File(file.getParent(), "papercut.yml");
oldConfig.renameTo(papercutConfig);
@@ -42,11 +45,12 @@ public final class PapercutConfig {
} catch (final Exception ex) {
Bukkit.getLogger().log(Level.SEVERE, "Failure to load papercut config", ex);
SneakyThrow.sneaky(ex); /* Rethrow, this is critical */
- throw new RuntimeException(ex); // unreachable
+ /* throw new RuntimeException(ex); // unreachable
}
- }
+ }*/
- PapercutConfig.load(config);
+ configFile = YatopiaConfig.CONFIG_FILE;
+ PapercutConfig.load(YatopiaConfig.config);
}
public static void load(final YamlConfiguration config) {

10
pom.xml
View File

@ -1,14 +1,14 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>de.tr7zw.yapfa</groupId>
<artifactId>yapfa-parent</artifactId>
<groupId>dev.tr7zw.yatopia</groupId>
<artifactId>yatopia-parent</artifactId>
<version>dev-SNAPSHOT</version>
<packaging>pom</packaging>
<name>YAPFA (Parent)</name>
<name>Yatopia (Parent)</name>
<modules>
<module>YAPFA-API</module>
<module>YAPFA-Server</module>
<module>Yatopia-API</module>
<module>Yatopia-Server</module>
</modules>
</project>

104
scripts/applyPatches.sh Normal file → Executable file
View File

@ -3,10 +3,11 @@
# SCRIPT HEADER start
basedir=$1
source "$basedir/scripts/functions.sh"
gpgsign="$($gitcmd config commit.gpgsign || echo "false")"
echo " "
echo "----------------------------------------"
echo " $(bashcolor 1 32)Task$(bashcolorend) - Apply Patches"
echo " This will apply all of YAPFA patches on top of the Paper."
echo " This will apply all of Yatopia patches on top of the Paper."
echo " "
echo " $(bashcolor 1 32)Subtask:$(bashcolorend)"
echo " - Import Sources"
@ -18,63 +19,79 @@ echo "----------------------------------------"
# SCRIPT HEADER end
needimport=$2
function enableCommitSigningIfNeeded {
if [[ "$gpgsign" == "true" ]]; then
$gitcmd config commit.gpgsign true
fi
}
function applyPatch {
baseproject=$1
basename=$(basename $baseproject)
target=$2
branch=$3
patch_folder=$4
cd $basedir/$2
# Skip if that software have no patch
haspatch=-f "$basedir/patches/$patch_folder/"*.patch >/dev/null 2>&1 # too many files
if [ ! haspatch ]; then
echo " $(bashcolor 1 33)($5/$6) Skipped$(bashcolorend) - No patch found for $target under patches/$patch_folder"
return
fi
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Setup upstream project.."
cd "$basedir/$baseproject"
$gitcmd fetch --all &> /dev/null
# Create the upstream branch in Paper project with current state
$gitcmd checkout master >/dev/null 2>&1 # possibly already in
$gitcmd branch -D upstream &> /dev/null
$gitcmd branch -f upstream "$branch" &> /dev/null && $gitcmd checkout upstream &> /dev/null
# Disable GPG signing before AM, slows things down and doesn't play nicely.
# There is also zero rational or logical reason to do so for these sub-repo AMs.
# Calm down kids, it's re-enabled (if needed) immediately after, pass or fail.
$gitcmd config commit.gpgsign false
if [[ $needimport != "1" ]]; then
if [ $baseproject != "Paper/Paper-API" ]; then
if [ $baseproject != "Tuinity/Tuinity-API" ]; then
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Import new introduced NMS files.."
basedir && $scriptdir/importSources.sh $basedir 1 || exit 1
#cd $basedir/Yatopia-Server/
#branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
#branch_name=${branch_name:-9}
#cd $basedir
basedir && $scriptdir/importSources.sh $basedir "Yatopia" || exit 1
fi
fi
basedir
# Create source project dirs
if [ ! -d "$basedir/$target" ]; then
mkdir "$basedir/$target"
cd "$basedir/$target"
# $gitcmd remote add origin "$5"
fi
cd "$basedir/$target"
$gitcmd init > /dev/null 2>&1
echo " "
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Reset $target to $basename.."
# Add the generated Paper project as the upstream remote of subproject
$gitcmd remote rm upstream &> /dev/null
$gitcmd remote add upstream "$basedir/$baseproject" &> /dev/null
# Ensure that we are in the branch we want so not overriding things
$gitcmd checkout master &> /dev/null || $gitcmd checkout -b master &> /dev/null
$gitcmd fetch upstream &> /dev/null
# Reset our source project to Paper
cd "$basedir/$target" && $gitcmd reset --hard upstream/upstream &> /dev/null
#$gitcmd branch $target
echo " "
echo " $(bashcolor 1 32)($5/$6)$(bashcolorend) - Apply patches to $target.."
# Abort previous applying operation
$gitcmd am --abort >/dev/null 2>&1
#$gitcmd am --abort >/dev/null 2>&1
# Apply our patches on top Paper in our dirs
$gitcmd am --no-utf8 --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
#$gitcmd am --no-utf8 --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
cd $basedir/$2
git branch -d $2
git branch $2
git checkout $2
# for filename in $basedir/patches/$patch_folder/*.patch; do
# # Abort previous applying operation
# git am --abort >/dev/null 2>&1
# # Apply our patches on top Paper in our dirs
# git am --reject --whitespace=fix --no-utf8 --3way --ignore-whitespace $filename || (
# files=`$gitcmd diff --name-only | grep -E '.rej$' `
# if [[ files != null ]]; then
# for filerej in files; do
# echo "Error found .rej file! Deleting. This might have unforseen consqunces!"
# rm -f filerej
# done
# fi
# filenamend="${filename##*/}"
# filenamens=${filenamend%/*}
# filenameedited=${filenamens%.*} # retain the part before the period
# filenameedited=${filenameedited:5} # retain the part after the frist slash
# git add .
# git commit -m $filenameedited
# )
# done
$gitcmd am --abort >/dev/null 2>&1
# Apply our patches on top Paper in our dirs
$gitcmd am --whitespace=fix --no-utf8 --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
cd $basedir
if [ "$?" != "0" ]; then
echo " Something did not apply cleanly to $target."
@ -91,5 +108,16 @@ function applyPatch {
fi
}
(applyPatch Tuinity/Tuinity-API ${FORK_NAME}-API HEAD api $API_REPO 0 2 &&
applyPatch Tuinity/Tuinity-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO 1 2) || exit 1
rm -rf $basedir/Yatopia/Yatopia-Server
rm -rf $basedir/Yatopia/Yatopia-API
$1/scripts/resetToUpstream.sh $1
$1/scripts/getUpstream.sh $1
(applyPatch Yatopia/Yatopia-API ${FORK_NAME}-API HEAD api $API_REPO 0 2 &&
applyPatch Yatopia/Yatopia-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO 1 2 && enableCommitSigningIfNeeded) || (
enableCommitSigningIfNeeded
exit 1 )

55
scripts/applyUpstream.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
searchtxts=(Server API)
gpgsign="$(git config commit.gpgsign || echo "false")"
scriptdir=$1/scripts
function enableCommitSigningIfNeeded {
if [[ "$gpgsign" == "true" ]]; then
git config commit.gpgsign true
fi
}
# Disable GPG signing before AM, slows things down and doesn't play nicely.
# There is also zero rational or logical reason to do so for these sub-repo AMs.
# Calm down kids, it's re-enabled (if needed) immediately after, pass or fail.
git config commit.gpgsign false
cd $1/patches/$2
for D in ${searchtxts[@]}; do
echo "IMPORTANT:!!! $D"
if [ true ]; then
echo $D
dnoslash=$D
echo "DnoS: $dnoslash"
echo "$1/Yatopia-$dnoslash"
cd $1/Yatopia-$dnoslash
echo "Appyling $2 $dnoslash files!"
dnoslashlower="${dnoslash,,}"
#git branch $2-upstream
#git checkout $2-upstream
if [ $dnoslashlower != "api" ]; then
echo "$"
echo "Import new introduced NMS files.. test"
$scriptdir/importSources.sh $1 $2 || exit 1
fi
for filename in $1/patches/$2/$dnoslashlower/*.patch; do
# Abort previous applying operation
git am --abort >/dev/null 2>&1
# Apply our patches on top Paper in our dirs
git am --reject --whitespace=fix --no-utf8 --3way --ignore-whitespace $filename || (
#files=`$gitcmd diff --name-only | grep -E '.rej$' `
#if [[ files != null ]]; then
# for filerej in files; do
# echo "Error found .rej file! Deleting. This might have unforseen consqunces!"
# rm -f filerej
# done
#fi
filenamend="${filename##*/}"
filenamens=${filenamend%/*}
filenameedited=${filenamens%.*} # retain the part before the period
filenameedited=${filenameedited:5} # retain the part after the frist slash
git add .
git commit -m $filenameedited
)
done
fi
done
#git am --no-utf8 --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
enableCommitSigningIfNeeded

2
scripts/commitUpstream.sh Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
echo "[YAPFA] State: Commit Upstream"
echo "[Yatopia] State: Commit Upstream"
(
set -e

0
scripts/fetchUpstream.sh Normal file → Executable file
View File

2
scripts/functions.sh Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# CONFIG set
FORK_NAME="YAPFA"
FORK_NAME="Yatopia"
API_REPO=""
SERVER_REPO=""
PAPER_API_REPO=""

6
scripts/generateImports.sh Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
echo "[YAPFA] State: Generate Imports"
echo "[Yatopia] State: Generate Imports"
# For a description of this script, see updateUpstream.sh.
@ -41,6 +41,6 @@ done
# push the dev project
cd $basedir/mc-dev
$gitcmd add . -A
$gitcmd commit . -m "YAPFA-base"
$gitcmd tag -a "YAPFA-base" -m "YAPFA-base" 2>/dev/null
$gitcmd commit . -m "Yatopia-base"
$gitcmd tag -a "Yatopia-base" -m "Yatopia-base" 2>/dev/null
# gitpush . $MCDEV_REPO $paperVer

51
scripts/getUpstream.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
patchdir="$1/patches"
searchtxts=(server api)
i=0
echo "Starting Upstream Patching!"
cd $patchdir
for D in */; do
if [ -d "${D}" ]; then
dnoslash=${D%/*}
if [[ $dnoslash != "server" ]]; then
if [[ $dnoslash != "api" ]]; then
echo "Found $dnoslash directory!"
for file in ${searchtxts[@]}; do
i=0
rm -rf -f "$1/patches/$dnoslash/$file/"
echo "Looking for $file file!"
echo "$(cat $patchdir/$dnoslash/$file.txt)"
IFS='&'
read -ra ADDR <<< $(cat $patchdir/$dnoslash/$file.txt)
for patch in ${ADDR[@]}; do
echo "Found $patch in $file!"
echo $1/$dnoslash/patches/$file
for filename in $1/$dnoslash/patches/$file/*.patch; do
filenamend="${filename##*/}"
filenamens=${filenamend%/*}
#filenameedited=${filenamens%.*} # retain the part before the period
filenameedited=${filenamens::-6}
#echo $filenameedited
filenameedited=${filenameedited:5} # retain the part after the frist slash
if [[ $filenameedited == $patch ]]; then
echo "Found Matching file!"
if [[ $i == 0 ]]; then
echo "Making $file dir in $dnoslash patch dir"
mkdir $1/patches/$dnoslash/$file
fi
((i=i+1))
printf -v num "%04d" $i
echo "Making ${num}-${patch}.patch file for Yatopia"
cp $1/$dnoslash/patches/$file/$filenamens $1/patches/$dnoslash/$file/"${num}-${patch}.patch"
fi
done
done
IFS=' '
done
$1/scripts/applyUpstream.sh $1 $dnoslash || exit 1
fi
fi
fi
done

64
scripts/importSources.sh Normal file → Executable file
View File

@ -1,14 +1,15 @@
#!/usr/bin/env bash
maintask=$2
if [[ $maintask == "0" ]]; then
TASKTITLE="Import Sources"
else
TASKTITLE="Import Sources (Subtask)"
fi
#maintask=$2
#if [[ $maintask == "0" ]]; then
# TASKTITLE="Import Sources"
#else
# TASKTITLE="Import Sources (Subtask)"
#fi
# SCRIPT HEADER start
basedir=$1
echo "$2"
source "$basedir/scripts/functions.sh"
echo " "
echo "----------------------------------------"
@ -19,8 +20,9 @@ echo "----------------------------------------"
# For a description of this script, see updateUpstream.sh.
paperworkdir="$basedir/Tuinity/Paper/work"
paperserverdir="$basedir/Tuinity/Tuinity-Server"
papersrcdir="$paperserverdir/src/main/java"
forkname="$2"
paperserverdir="$basedir/Yatopia-Server"
papersrcdir="$basedir/Yatopia-Server/src/main/java"
papernmsdir="$papersrcdir/net/minecraft/server"
(
@ -82,23 +84,45 @@ function importLibraryToPaperWorkspace {
# Reset to last NORMAL commit if already have imported before
cd "$paperserverdir"
lastcommit=$(git log -1 --pretty=oneline --abbrev-commit)
if [[ "$lastcommit" = *"Extra dev imports of YAPFA"* ]]; then
if [[ "$lastcommit" = *"Extra dev imports of $forkname"* ]]; then
git reset --hard HEAD^
fi
)
# Filter and import every files which have patch to modify
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
patchedFilesNonNMS=$(cat patches/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
if [[ $forkname != "Yatopia" ]]; then
if [[ $forkname != null ]]; then
echo "test: $forkname == Purpur"
patchedFiles=$(cat patches/$forkname/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
patchedFilesNonNMS=$(cat patches/$forkname/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
else
echo "test: $forkname == Yatopia"
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
patchedFilesNonNMS=$(cat patches/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
fi
else
echo "test: $forkname == Yatopia"
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
patchedFilesNonNMS=$(cat patches/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
fi
(
cd "$paperserverdir"
$gitcmd fetch --all &> /dev/null
#$gitcmd fetch --all &> /dev/null
# Create the upstream branch in Paper project with current state
$gitcmd checkout master >/dev/null 2>&1 # possibly already in
$gitcmd branch -D upstream &>/dev/null
$gitcmd branch -f upstream HEAD && $gitcmd checkout upstream
#$gitcmd checkout master >/dev/null 2>&1 # possibly already in
#if [[ $3 != "Yatopia" ]]; then
#if [[ $3 != null ]]; then
#$gitcmd branch -D ${3}-upstream &>/dev/null
#$gitcmd branch -f ${3}-upstream HEAD && $gitcmd checkout ${3}-upstream
#else
#$gitcmd branch -D upstream &>/dev/null
#$gitcmd branch -f upstream HEAD && $gitcmd checkout upstream
#fi
#else
#$gitcmd branch -D upstream &>/dev/null
#$gitcmd branch -f upstream HEAD && $gitcmd checkout upstream
#fi
)
basedir
@ -118,18 +142,16 @@ done
# NMS import format:
# importToPaperWorkspace MinecraftServer
importToPaperWorkspace PistonExtendsChecker
importToPaperWorkspace EnumDirection
# Library import format (multiple files are supported):
# importLibraryToPaperWorkspace com.mojang datafixerupper com/mojang/datafixers/util Either.java
importLibraryToPaperWorkspace com.mojang authlib com/mojang/authlib yggdrasil/YggdrasilGameProfileRepository.java
importLibraryToPaperWorkspace com.mojang datafixerupper com/mojang/datafixers/util Either.java
# Submit imports by commit with file descriptions
(
cd "$paperserverdir"
# rm -rf nms-patches
git add . &> /dev/null
echo -e "Extra dev imports of YAPFA\n\n$IMPORT_LOG" | git commit src -F - &> /dev/null
echo -e "Extra dev imports of $forkname\n\n$IMPORT_LOG"
git commit -m "Extra dev imports of $forkname"
echo " $(bashcolor 1 32)Succeed$(bashcolorend) - Sources have been imported to Paper/Paper-Server (branch upstream)"
if [[ $maintask != "0" ]]; then # this is magical

5
scripts/initUpstream.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
cd $1
git submodule update --init -f
cd Tuinity
git submodule update --init --recursive -f

2
scripts/installLauncher.sh Normal file → Executable file
View File

@ -17,7 +17,7 @@ echo "----------------------------------------"
set -e
paperworkdir="$basedir/Tuinity/Paper/work"
mcver=$(cat "$paperworkdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
serverjar="$basedir/YAPFA-Server/target/yatopia-$mcver.jar"
serverjar="$basedir/Yatopia-Server/target/yatopia-$mcver.jar"
vanillajar="$paperworkdir/Minecraft/$mcver/$mcver.jar"
(

View File

@ -6,7 +6,7 @@ source "$basedir/scripts/functions.sh"
echo " "
echo "----------------------------------------"
echo " $(bashcolor 1 32)Task$(bashcolorend) - Rebuild Patches"
echo " This will diff the sources of YAPFA and Paper to build patches."
echo " This will diff the sources of Yatopia and Paper to build patches."
echo " "
echo " $(bashcolor 1 32)Modules:$(bashcolorend)"
echo " - $(bashcolor 1 32)1$(bashcolorend) : API"
@ -35,7 +35,7 @@ function savePatches {
fi
cd "$basedir/$targetname"
$gitcmd format-patch --no-signature --zero-commit --full-index --no-stat -N -o "$basedir/patches/$2" upstream/upstream >/dev/null
$gitcmd format-patch --no-signature --zero-commit --full-index --no-stat -N -o "$basedir/patches/$2" master >/dev/null
basedir
$gitcmd add -A "$basedir/patches/$2"
echo " $(bashcolor 1 32)($3/$4)$(bashcolorend) - Patches saved for $targetname to patches/$2"

41
scripts/resetToUpstream.sh Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env bash
searchtxts=(Server API)
basedir=$1
basename=$(basename $baseproject)
branch=HEAD
for type in ${searchtxts[@]}; do
baseproject=Tuinity/Tuinity-$type
target=Yatopia-$type
echo "$baseproject, $target, $branch, $basedir, $type, $basename"
echo "Setup upstream project.."
echo "$basedir/$baseproject"
cd "$basedir/$baseproject"
git fetch --all &> /dev/null
# Create the upstream branch in Paper project with current state
git checkout master >/dev/null 2>&1 # possibly already in
git branch -D upstream &> /dev/null
git branch -f upstream "$branch" &> /dev/null && git checkout upstream &> /dev/null
cd $basedir
# Create source project dirs
if [ ! -d "$basedir/$target" ]; then
mkdir "$basedir/$target"
cd "$basedir/$target"
# git remote add origin "$5"
fi
echo "$basedir/$target"
cd "$basedir/$target"
git init > /dev/null 2>&1
echo " "
echo "Reset $target to $basename.."
# Add the generated Paper project as the upstream remote of subproject
git remote rm upstream &> /dev/null
git remote add upstream "$basedir/$baseproject" &> /dev/null
# Ensure that we are in the branch we want so not overriding things
git checkout master &> /dev/null || git checkout -b master &> /dev/null
git fetch upstream &> /dev/null
# Reset our source project to Paper
cd "$basedir/$target" && git reset --hard upstream/upstream &> /dev/null
done

30
scripts/updateUpstream.sh Normal file → Executable file
View File

@ -12,13 +12,13 @@ echo " This will update and patch Paper, importing necessary sources for patchi
echo " "
echo " $(bashcolor 1 32)Projects:$(bashcolorend)"
echo " - $(bashcolor 1 32)1$(bashcolorend) : Paper"
echo " - $(bashcolor 1 32)2$(bashcolorend) : YAPFA"
echo " - $(bashcolor 1 32)2$(bashcolorend) : Yatopia"
echo "----------------------------------------"
# SCRIPT HEADER end
# This script are capable of patching paper which have the same effect with renewing the source codes of paper to its corresponding remote/official state, and also are able to reset the patches of paper to its head commit to override dirty changes which needs a argument with --resetPaper.
# After the patching, it will copying sources that do no exist in the YAPFA workspace but referenced in YAPFA patches into our workspace, depending on the content of our patches, this will be addressed by calling importSources.sh.
# After the patching, it will copying sources that do no exist in the Yatopia workspace but referenced in Yatopia patches into our workspace, depending on the content of our patches, this will be addressed by calling importSources.sh.
# Following by invoking generateImports.sh, it will generate new added/imported files of paper compared to the original decompiled sources into mc-dev folder under the root dir of the project, whose intention is unclear yet.
@ -27,18 +27,20 @@ set -e
subtasks=1
updatepaper=$2
if [ "$updatepaper" == "1" ]; then
echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Update Git submodules.."
$gitcmd submodule update --init --remote
fi
#if [ "$updatepaper" == "1" ]; then
#echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Update Git submodules.."
#$gitcmd submodule update --init --remote
#fi
if [[ "$2" == "--resetPaper" ]]; then
echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Reset Paper submodule.."
paperdir
$gitcmd fetch && $gitcmd reset --hard origin/master
basedir
$gitcmd add Paper
fi
#if [[ "$2" == "--resetPaper" ]]; then
#echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Reset Paper submodule.."
#paperdir
#$gitcmd fetch && $gitcmd reset --hard origin/master
#basedir
#$gitcmd add Paper
#fi
$basedir/scripts/fetchUpstream.sh $basedir
# patch paper
echo " $(bashcolor 1 32)(0/$subtasks)$(bashcolorend) - Apply patches of Tuinity.."
@ -80,7 +82,7 @@ paperdir
#tag Paper-API $forcetag
#tag Paper-Server $forcetag
echo " $(bashcolor 1 32)($subtasks/$subtasks) Succeed$(bashcolorend) - Submodules have been updated, regenerated and imported, run 'YAPFA patch' to test/fix patches, and by 'YAPFA rbp' to rebuild patches that fixed with the updated upstream."
echo " $(bashcolor 1 32)($subtasks/$subtasks) Succeed$(bashcolorend) - Submodules have been updated, regenerated and imported, run 'Yatopia patch' to test/fix patches, and by 'Yatopia rbp' to rebuild patches that fixed with the updated upstream."
echo " "
# gitpush Paper-API $PAPER_API_REPO $tag

2
server
View File

@ -1 +1 @@
YAPFA-Server/
Yatopia-Server/

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# YAPFA Build Script
# Yatopia Build Script
############################################################################
# Multicore building #
@ -19,11 +19,23 @@ JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $3 }'`
failed=0
case "$1" in
"reset")
(
$scriptdir/resetToUpstream.sh "$basedir"
) || failed=1
;;
"i" | "in" | "init" | "initsubmodules")
(
set -e
basedir
$scriptdir/initUpstream.sh "$basedir" || exit 1
) || failed=1
;;
"r" | "rb" | "rbp" | "rebuild")
(
set -e
basedir
$scriptdir/importSources.sh "$basedir" || exit 1
#$scriptdir/importSources.sh "$basedir" || exit 1
$scriptdir/rebuildPatches.sh "$basedir" || exit 1
) || failed=1
;;
@ -58,23 +70,24 @@ case "$1" in
basedir
;;
"a" | "api")
cd "$basedir/YAPFA-API"
cd "$basedir/Yatopia-API"
;;
"s" | "server")
cd "$basedir/YAPFA-Server"
cd "$basedir/Yatopia-Server"
;;
"fup" | "fetchupstream")
$scriptdir/fetchUpstream.sh "$basedir" || exit 1
;;
"c" | "clean")
rm -rf YAPFA-API
rm -rf YAPFA-Server
rm -rf Yatopia-API
rm -rf Yatopia-Server
rm -rf Paper
echo "Cleaned build files"
;;
"f" | "fu" | "full" | "fullbuild")
(
echo "$JAVA_VERSION"
$scriptdir/initUpstream.sh "$basedir" || exit 1
basedir
$scriptdir/updateUpstream.sh "$basedir" || exit 1
set -e
@ -82,15 +95,15 @@ case "$1" in
basedir
$mvncmd -N install surefire-report:report
cd ${FORK_NAME}-API
$mvncmd -e clean install && (cd ../Tuinity/Paper/Paper-MojangAPI && $mvncmd -e clean install) && cd ../${FORK_NAME}-Server && $mvncmd -e clean install surefire-report:report
($mvncmd -e clean install && (cd ../Tuinity/Paper/Paper-MojangAPI && $mvncmd -e clean install) && cd ../${FORK_NAME}-Server && $mvncmd -e clean install surefire-report:report) || exit 1
$scriptdir/installLauncher.sh "$basedir" || exit 1
) || failed=1
;;
"e" | "edit")
case "$2" in
"s" | "server")
export YAPFA_LAST_EDIT="$basedir/YAPFA-Server"
cd "$basedir/YAPFA-Server"
export Yatopia_LAST_EDIT="$basedir/Yatopia-Server"
cd "$basedir/Yatopia-Server"
(
set -e
gitstash
@ -100,14 +113,14 @@ case "$1" in
$gitcmd checkout master # possibly already in
$gitcmd branch -D upstream || true
$gitcmd branch -f upstream HEAD
cd "$basedir/YAPFA-Server"
cd "$basedir/Yatopia-Server"
$gitcmd rebase -i upstream/upstream
gitunstash
)
;;
"a" | "api")
export YAPFA_LAST_EDIT="$basedir/YAPFA-API"
cd "$basedir/YAPFA-API"
export Yatopia_LAST_EDIT="$basedir/Yatopia-API"
cd "$basedir/Yatopia-API"
(
set -e
gitstash
@ -117,14 +130,14 @@ case "$1" in
$gitcmd checkout master # possibly already in
$gitcmd branch -D upstream || true
$gitcmd branch -f upstream HEAD
cd "$basedir/YAPFA-API"
cd "$basedir/Yatopia-API"
$gitcmd rebase -i upstream/upstream
gitunstash
)
;;
"c" | "continue")
cd "$YAPFA_LAST_EDIT"
unset YAPFA_LAST_EDIT
cd "$Yatopia_LAST_EDIT"
unset Yatopia_LAST_EDIT
(
set -e
$gitcmd add .
@ -141,17 +154,17 @@ case "$1" in
;;
"setup")
if [[ -f ~/.bashrc ]] ; then
NAME="YAPFA"
NAME="Yatopia"
if [[ ! -z "${2+x}" ]] ; then
NAME="$2"
fi
(grep "alias $NAME=" ~/.bashrc > /dev/null) && (sed -i "s|alias $NAME=.*|alias $NAME='. $SOURCE'|g" ~/.bashrc) || (echo "alias $NAME='. $SOURCE'" >> ~/.bashrc)
alias "$NAME=. $SOURCE"
echo "You can now just type '$NAME' at any time to access the YAPFA tool."
echo "You can now just type '$NAME' at any time to access the Yatopia tool."
fi
;;
*)
echo "YAPFA build tool command. This provides a variety of commands to build and manage the YAPFA build"
echo "Yatopia build tool command. This provides a variety of commands to build and manage the Yatopia build"
echo "environment. For all of the functionality of this command to be available, you must first run the"
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
echo ""
@ -165,18 +178,18 @@ case "$1" in
echo ""
echo " These commands require the setup command before use:"
echo " * r, root | Change directory to the root of the project."
echo " * a. api | Move to the YAPFA-API directory."
echo " * s, server | Move to the YAPFA-Server directory."
echo " * a. api | Move to the Yatopia-API directory."
echo " * s, server | Move to the Yatopia-Server directory."
echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
echo " | respectively to edit the correct project. Use the argument \"continue\" after"
echo " | the changes have been made to finish and rebuild patches. Can be called from anywhere."
echo ""
echo " * setup | Add an alias to .bashrc to allow full functionality of this script. Run as:"
echo " | . ./YAPFA setup"
echo " | After you run this command you'll be able to just run 'YAPFA' from anywhere."
echo " | The default name for the resulting alias is 'YAPFA', you can give an argument to override"
echo " | . ./Yatopia setup"
echo " | After you run this command you'll be able to just run 'Yatopia' from anywhere."
echo " | The default name for the resulting alias is 'Yatopia', you can give an argument to override"
echo " | this default, such as:"
echo " | . ./YAPFA setup example"
echo " | . ./Yatopia setup example"
echo " | Which will allow you to run 'example' instead."
;;
esac