mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-22 18:46:27 +01:00
Hydrinity optimizations & Lithium generation patches & more
Closes #257 Ports 2 patches from Purpur: Infinity-bow-settings & Allow-infinite-and-mending-enchantments-together Added an option for infinity with no arrows too. Option for custom locale has come! You can put a locale.json file in your server folder to change it. We've got the finest patches from Hydrinity ( Mykyta approved & allowed ) too. We have some amazing new options in yatopia.yml, we're gonna have documentation for them soon so stay tuned! Last but not least, chunk generation patches. We've tested them extensively so no weirdness happens. Thanks for using Yatopia as your production server software. Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
This commit is contained in:
parent
0dd46b620b
commit
c09ee99f7e
23
PATCHES.md
23
PATCHES.md
@ -30,6 +30,7 @@ # Patches
|
||||
| server | Add timings for Behavior | Phoenix616 | |
|
||||
| server | Add timings for Pathfinder | MrIvanPlays | |
|
||||
| server | Allow anvil colors | William Blake Galbreath | |
|
||||
| server | Allow infinite and mending enchantments together | William Blake Galbreath | |
|
||||
| api | Allow inventory resizing | William Blake Galbreath | |
|
||||
| server | Allow leashing villagers | William Blake Galbreath | |
|
||||
| server | Allow soil to moisten from water directly under it | William Blake Galbreath | |
|
||||
@ -37,10 +38,13 @@ # Patches
|
||||
| server | Alternative Keepalive Handling | William Blake Galbreath | |
|
||||
| server | Avoid double I/O operation on load player file | ㄗㄠˋ ㄑㄧˊ | |
|
||||
| server | Barrels and enderchests 6 rows | William Blake Galbreath | |
|
||||
| server | Brandings | tr7zw | |
|
||||
| server | Brandings | YatopiaMC | |
|
||||
| server | Configurable BlockPhysicsEvent | Mykyta Komarnytskyy | |
|
||||
| server | Configurable criterion triggers | Mykyta Komarnytskyy | |
|
||||
| server | Configurable flight checks | epserv | |
|
||||
| server | Configurable villager brain ticks | William Blake Galbreath | |
|
||||
| server | Cows eat mushrooms | William Blake Galbreath | |
|
||||
| server | Custom Locale Support | Bud Gidiere | |
|
||||
| api | Default permissions | William Blake Galbreath | |
|
||||
| server | Despawn rate config options per projectile type | jmp | |
|
||||
| api | Disable reload command | Ivan Pekov | |
|
||||
@ -65,13 +69,15 @@ # Patches
|
||||
| server | Highly optimize VillagePlace filtering | Ivan Pekov | |
|
||||
| server | Hopper Optimizations | Phoenix616 | |
|
||||
| server | Improve task performance | ishland | Mykyta Komarn |
|
||||
| server | Infinity No Arrows | Bud Gidiere | |
|
||||
| server | Infinity bow settings | William Blake Galbreath | |
|
||||
| server | Item stuck sleep config | tr7zw | |
|
||||
| api | Kill AnnotationTest | tr7zw | |
|
||||
| server | Lagging threshold | William Blake Galbreath | |
|
||||
| server | MC-168772 Fix - Add turtle egg block options | William Blake Galbreath | |
|
||||
| server | MC-4 Fix - Item position desync | William Blake Galbreath | |
|
||||
| api | Modify POM | tr7zw | |
|
||||
| server | Modify POM | tr7zw | |
|
||||
| api | Modify POM | YatopiaMC | |
|
||||
| server | Modify POM | YatopiaMC | |
|
||||
| server | Modify default configs | tr7zw | |
|
||||
| server | Nuke streams off BlockPosition | Ivan Pekov | |
|
||||
| server | Nuke streams off SectionPosition | Ivan Pekov | |
|
||||
@ -104,6 +110,7 @@ # Patches
|
||||
| server | Send more packets immediately | MrIvanPlays | |
|
||||
| server | Shutdown Bootstrap thread pool | foss-mc | |
|
||||
| server | Skip events if there's no listeners | William Blake Galbreath | |
|
||||
| server | Smarter statistics ticking | Mykyta Komarnytskyy | |
|
||||
| server | Snowman drop and put back pumpkin | William Blake Galbreath | |
|
||||
| server | Squid EAR immunity | William Blake Galbreath | |
|
||||
| server | Stop squids floating on top of water | William Blake Galbreath | |
|
||||
@ -115,9 +122,10 @@ # Patches
|
||||
| server | Use GlueList for some list initialisations in packets | Ivan Pekov | |
|
||||
| server | Use faster block collision check for entity suffocation check | Mykyta Komarn | |
|
||||
| server | Use offline uuids if we need to | Ivan Pekov | |
|
||||
| api | Yatopia API Bundle | Bud Gidiere | |
|
||||
| server | Utilities | YatopiaMC | Mykyta Komarnytskyy, Ivan Pekov |
|
||||
| api | Yatopia API Bundle | YatopiaMC | |
|
||||
| server | Yatopia configuration | tr7zw | |
|
||||
| server | Yatopia-Server-Fixes | Bud Gidiere | |
|
||||
| server | Yatopia-Server-Fixes | YatopiaMC | |
|
||||
| server | dont load chunks for physics | Aikar | |
|
||||
| server | lithium MixinBiome | JellySquid | |
|
||||
| server | lithium MixinBox | JellySquid | |
|
||||
@ -125,8 +133,13 @@ # Patches
|
||||
| server | lithium MixinDirection | JellySquid | |
|
||||
| server | lithium MixinGoalSelector | JellySquid | |
|
||||
| server | lithium MixinLandPathNodeMaker | JellySquid | |
|
||||
| server | lithium NoiseChunkGeneratorMixin | JellySquid | |
|
||||
| server | lithium PerlinNoiseSamplerMixin | JellySquid | Bud Gidiere |
|
||||
| server | lithium ScaleLayer CachingLayerContext | JellySquid | |
|
||||
| server | lithium VoronoiBiomeAccessTypeMixin | JellySquid | |
|
||||
| server | lithium VoxelShapesMixin | JellySquid | Ivan Pekov |
|
||||
| server | lithium collision optimizations | JellySquid | Ivan Pekov |
|
||||
| server | lithium enum_values | JellySquid | |
|
||||
| server | lithium reduce allocations | JellySquid | Mykyta Komarnytskyy |
|
||||
| server | lithium-MixinChunkGeneratorAbstract | JellySquid | tr7zw |
|
||||
| server | lithium-MixinDataWatcher | JellySquid | tr7zw |
|
||||
|
@ -1 +1 @@
|
||||
Purpur-config-files&Timings-stuff&Barrels-and-enderchests-6-rows&Lagging-threshold&Configurable-villager-brain-ticks&Alternative-Keepalive-Handling&MC-168772-Fix-Add-turtle-egg-block-options&MC-4-Fix-Item-position-desync&Fix-outdated-server-showing-in-ping-before-server-fu&Dont-send-useless-entity-packets&Cows-eat-mushrooms&Snowman-drop-and-put-back-pumpkin&Allow-soil-to-moisten-from-water-directly-under-it&Option-to-toggle-milk-curing-bad-omen&Fix-the-dead-lagging-the-server&Skip-events-if-there-s-no-listeners&Add-permission-for-F3-N-debug&Allow-leashing-villagers&Add-option-to-disable-saving-projectiles-to-disk&Add-5-second-tps-average-in-tps&Entity-lifespan&Squid-EAR-immunity&Allow-anvil-colors&Add-no-tick-block-list&Add-option-to-disable-dolphin-treasure-searching&Stop-squids-floating-on-top-of-water&Despawn-rate-config-options-per-projectile-type&PaperPR-Add-hex-color-code-support-for-console-loggi&Persistent-TileEntity-Lore-and-DisplayName
|
||||
Purpur-config-files&Timings-stuff&Barrels-and-enderchests-6-rows&Lagging-threshold&Configurable-villager-brain-ticks&Alternative-Keepalive-Handling&MC-168772-Fix-Add-turtle-egg-block-options&MC-4-Fix-Item-position-desync&Fix-outdated-server-showing-in-ping-before-server-fu&Dont-send-useless-entity-packets&Cows-eat-mushrooms&Snowman-drop-and-put-back-pumpkin&Allow-soil-to-moisten-from-water-directly-under-it&Option-to-toggle-milk-curing-bad-omen&Fix-the-dead-lagging-the-server&Skip-events-if-there-s-no-listeners&Add-permission-for-F3-N-debug&Allow-leashing-villagers&Add-option-to-disable-saving-projectiles-to-disk&Add-5-second-tps-average-in-tps&Entity-lifespan&Squid-EAR-immunity&Allow-anvil-colors&Add-no-tick-block-list&Add-option-to-disable-dolphin-treasure-searching&Stop-squids-floating-on-top-of-water&Despawn-rate-config-options-per-projectile-type&PaperPR-Add-hex-color-code-support-for-console-loggi&Persistent-TileEntity-Lore-and-DisplayName&Infinity-bow-settings&Allow-infinite-and-mending-enchantments-together
|
@ -1,5 +1,5 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
From: YatopiaMC <yatopiamc@gmail.com>
|
||||
Date: Sat, 1 Aug 2020 15:51:06 -0500
|
||||
Subject: [PATCH] Yatopia API Bundle
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
From: YatopiaMC <yatopiamc@gmail.com>
|
||||
Date: Sat, 1 Aug 2020 15:51:49 -0500
|
||||
Subject: [PATCH] Modify POM
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
Date: Thu, 6 Aug 2020 19:47:50 -0500
|
||||
From: YatopiaMC <yatopiamc@gmail.com>
|
||||
Date: Sun, 25 Oct 2020 12:23:35 -0500
|
||||
Subject: [PATCH] Yatopia-Server-Fixes
|
||||
|
||||
|
||||
@ -1531,7 +1531,7 @@ index 72e1528c1250a4b59abed862c8ccb2507a66c862..00000000000000000000000000000000
|
||||
-
|
||||
- this.chunkCheck(entity1);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 4a7285bd8e9ba3b7ad94c67c1880cc216cea5bc9..75a1524791923864f325100c0e9ed3fa8f187247 100644
|
||||
index 31f918778317f05bd5b09f4a8ee55bb4b71defd1..cb568bd17f4ac650f20859d2ac8d430bc928d718 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -129,11 +129,6 @@ public class PurpurConfig {
|
||||
@ -1546,8 +1546,47 @@ index 4a7285bd8e9ba3b7ad94c67c1880cc216cea5bc9..75a1524791923864f325100c0e9ed3fa
|
||||
public static double laggingThreshold = 19.0D;
|
||||
private static void tickLoopSettings() {
|
||||
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
|
||||
@@ -172,4 +167,14 @@ public class PurpurConfig {
|
||||
private static void fixItemPositionDesync() {
|
||||
fixItemPositionDesync = getBoolean("settings.fix-item-position-desync", fixItemPositionDesync);
|
||||
}
|
||||
+
|
||||
+ public static boolean allowInfinityMending = false;
|
||||
+ private static void enchantmentSettings() {
|
||||
+ if (version < 5) {
|
||||
+ boolean oldValue = getBoolean("settings.enchantment.allow-infinite-and-mending-together", false);
|
||||
+ set("settings.enchantment.allow-infinity-and-mending-together", oldValue);
|
||||
+ set("settings.enchantment.allow-infinite-and-mending-together", null);
|
||||
+ }
|
||||
+ allowInfinityMending = getBoolean("settings.enchantment.allow-infinity-and-mending-together", allowInfinityMending);
|
||||
+ }
|
||||
}
|
||||
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 59a692200527a94c1f67d7058579a08803089509..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java.rej
|
||||
+++ /dev/null
|
||||
@@ -1,18 +0,0 @@
|
||||
-diff a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java (rejected hunks)
|
||||
-@@ -194,6 +194,16 @@ public class PurpurConfig {
|
||||
- cryingObsidianValidForPortalFrame = getBoolean("settings.blocks.crying_obsidian.valid-for-portal-frame", cryingObsidianValidForPortalFrame);
|
||||
- }
|
||||
-
|
||||
-+ public static boolean allowInfinityMending = false;
|
||||
-+ private static void enchantmentSettings() {
|
||||
-+ if (version < 5) {
|
||||
-+ boolean oldValue = getBoolean("settings.enchantment.allow-infinite-and-mending-together", false);
|
||||
-+ set("settings.enchantment.allow-infinity-and-mending-together", oldValue);
|
||||
-+ set("settings.enchantment.allow-infinite-and-mending-together", null);
|
||||
-+ }
|
||||
-+ allowInfinityMending = getBoolean("settings.enchantment.allow-infinity-and-mending-together", allowInfinityMending);
|
||||
-+ }
|
||||
-+
|
||||
- public static boolean endermanShortHeight = false;
|
||||
- private static void entitySettings() {
|
||||
- endermanShortHeight = getBoolean("settings.entity.enderman.short-height", endermanShortHeight);
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 361f7857e461578e90cb71e15027dadaf794cb69..9fd735bb4e5590be1eec958f10acb76abb719dc1 100644
|
||||
index 361f7857e461578e90cb71e15027dadaf794cb69..142120d9fe4b6a621957b8e7b21dd757a8eb38a2 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -1,7 +1,14 @@
|
||||
@ -1565,7 +1604,7 @@ index 361f7857e461578e90cb71e15027dadaf794cb69..9fd735bb4e5590be1eec958f10acb76a
|
||||
import static net.pl3x.purpur.PurpurConfig.log;
|
||||
|
||||
public class PurpurWorldConfig {
|
||||
@@ -56,4 +63,114 @@ public class PurpurWorldConfig {
|
||||
@@ -56,4 +63,123 @@ 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));
|
||||
}
|
||||
@ -1678,31 +1717,40 @@ index 361f7857e461578e90cb71e15027dadaf794cb69..9fd735bb4e5590be1eec958f10acb76a
|
||||
+ smallFireballDespawnRate = getInt("gameplay-mechanics.projectile-despawn-rates.small_fireball", smallFireballDespawnRate);
|
||||
+ snowballDespawnRate = getInt("gameplay-mechanics.projectile-despawn-rates.snowball", snowballDespawnRate);
|
||||
+ witherSkullDespawnRate = getInt("gameplay-mechanics.projectile-despawn-rates.wither_skull", witherSkullDespawnRate);
|
||||
+ }
|
||||
+
|
||||
+ public boolean infinityWorksWithNormalArrows = true;
|
||||
+ public boolean infinityWorksWithSpectralArrows = false;
|
||||
+ public boolean infinityWorksWithTippedArrows = false;
|
||||
+ private void infinityArrowsSettings() {
|
||||
+ infinityWorksWithNormalArrows = getBoolean("gameplay-mechanics.infinity-bow.normal-arrows", infinityWorksWithNormalArrows);
|
||||
+ infinityWorksWithSpectralArrows = getBoolean("gameplay-mechanics.infinity-bow.spectral-arrows", infinityWorksWithSpectralArrows);
|
||||
+ infinityWorksWithTippedArrows = getBoolean("gameplay-mechanics.infinity-bow.tipped-arrows", infinityWorksWithTippedArrows);
|
||||
+ }
|
||||
}
|
||||
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 b355db095a49ccee8027a4f350c45526abb98273..0000000000000000000000000000000000000000
|
||||
index f8757d6440fd513860d0c908c011f0833c486be8..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java.rej
|
||||
+++ /dev/null
|
||||
@@ -1,17 +0,0 @@
|
||||
-diff a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java (rejected hunks)
|
||||
-@@ -184,6 +184,7 @@ public class PurpurWorldConfig {
|
||||
- public boolean fixClimbingBypassingCrammingRule = false;
|
||||
- public boolean milkCuresBadOmen = true;
|
||||
- public boolean saveProjectilesToDisk = true;
|
||||
-+ public boolean persistentTileEntityDisplayNames = false;
|
||||
- public double tridentLoyaltyVoidReturnHeight = 0.0D;
|
||||
- public double voidDamageHeight = -64.0D;
|
||||
- public int raidCooldownSeconds = 0;
|
||||
-@@ -196,6 +197,7 @@ public class PurpurWorldConfig {
|
||||
- fixClimbingBypassingCrammingRule = getBoolean("gameplay-mechanics.fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule);
|
||||
- milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
|
||||
- saveProjectilesToDisk = getBoolean("gameplay-mechanics.save-projectiles-to-disk", saveProjectilesToDisk);
|
||||
-+ persistentTileEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-tileentity-display-names-and-lore", persistentTileEntityDisplayNames);
|
||||
- tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);
|
||||
- voidDamageHeight = getDouble("gameplay-mechanics.void-damage-height", voidDamageHeight);
|
||||
- raidCooldownSeconds = getInt("gameplay-mechanics.raid-cooldown-seconds", raidCooldownSeconds);
|
||||
-@@ -147,6 +147,15 @@ public class PurpurWorldConfig {
|
||||
- idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList);
|
||||
- }
|
||||
-
|
||||
-+ public boolean infinityWorksWithNormalArrows = true;
|
||||
-+ public boolean infinityWorksWithSpectralArrows = false;
|
||||
-+ public boolean infinityWorksWithTippedArrows = false;
|
||||
-+ private void infinityArrowsSettings() {
|
||||
-+ infinityWorksWithNormalArrows = getBoolean("gameplay-mechanics.infinity-bow.normal-arrows", infinityWorksWithNormalArrows);
|
||||
-+ infinityWorksWithSpectralArrows = getBoolean("gameplay-mechanics.infinity-bow.spectral-arrows", infinityWorksWithSpectralArrows);
|
||||
-+ infinityWorksWithTippedArrows = getBoolean("gameplay-mechanics.infinity-bow.tipped-arrows", infinityWorksWithTippedArrows);
|
||||
-+ }
|
||||
-+
|
||||
- public int dragonFireballDespawnRate = -1;
|
||||
- public int eggDespawnRate = -1;
|
||||
- public int enderPearlDespawnRate = -1;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3cc0feac5e69e70a996d45696682f1b638c23eec..ed594eb6c8102b0ce1b52f2d2db714aa9fdeffd0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
|
@ -1,11 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
From: YatopiaMC <yatopiamc@gmail.com>
|
||||
Date: Wed, 26 Feb 2020 17:08:07 +0100
|
||||
Subject: [PATCH] Modify POM
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index e5b74fbf25b1e537aa9f6490b75a74106b4aa888..2a77cf53a684535e8331989d252660055d01755d 100644
|
||||
index e5b74fbf25b1e537aa9f6490b75a74106b4aa888..d1fc96337dcd8c9b164ba4c0b24b298807884884 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,11 +1,11 @@
|
||||
@ -53,7 +53,20 @@ index e5b74fbf25b1e537aa9f6490b75a74106b4aa888..2a77cf53a684535e8331989d25266005
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@@ -154,6 +163,15 @@
|
||||
@@ -141,6 +150,12 @@
|
||||
<version>4.8.47</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
+ <!-- Fast Math -->
|
||||
+ <dependency>
|
||||
+ <groupId>org.apache.commons</groupId>
|
||||
+ <artifactId>commons-math3</artifactId>
|
||||
+ <version>3.6.1</version>
|
||||
+ </dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
@@ -154,6 +169,15 @@
|
||||
<id>spigotmc-public</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
@ -69,7 +82,7 @@ index e5b74fbf25b1e537aa9f6490b75a74106b4aa888..2a77cf53a684535e8331989d25266005
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
@@ -165,15 +183,15 @@
|
||||
@@ -165,15 +189,15 @@
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
<build>
|
||||
|
@ -1,5 +1,5 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: tr7zw <tr7zw@live.de>
|
||||
From: YatopiaMC <yatopiamc@gmail.com>
|
||||
Date: Wed, 26 Feb 2020 18:37:34 +0100
|
||||
Subject: [PATCH] Brandings
|
||||
|
||||
|
79
patches/server/0004-Utilities.patch
Normal file
79
patches/server/0004-Utilities.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: YatopiaMC <yatopiamc@gmail.com>
|
||||
Date: Fri, 23 Oct 2020 09:20:01 -0700
|
||||
Subject: [PATCH] Utilities
|
||||
|
||||
This patch includes all utilities required by the Yatopia project and its patches.
|
||||
|
||||
Co-authored-by: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
|
||||
|
||||
diff --git a/src/main/java/net/yatopia/server/util/Constants.java b/src/main/java/net/yatopia/server/util/Constants.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5b2ac2bd00c49e44f5692be42e483409a3b70a5c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/yatopia/server/util/Constants.java
|
||||
@@ -0,0 +1,7 @@
|
||||
+package net.yatopia.server.util;
|
||||
+
|
||||
+public class Constants {
|
||||
+
|
||||
+ public static final int[] EMPTY_ARRAY = new int[0];
|
||||
+ public static final int[] ZERO_ARRAY = new int[]{0};
|
||||
+}
|
||||
diff --git a/src/main/java/net/yatopia/server/util/MathUtils.java b/src/main/java/net/yatopia/server/util/MathUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b1d277d831a36a0f9e5c33f1957e1739de18abb5
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/yatopia/server/util/MathUtils.java
|
||||
@@ -0,0 +1,17 @@
|
||||
+package net.yatopia.server.util;
|
||||
+
|
||||
+public class MathUtils {
|
||||
+
|
||||
+ /**
|
||||
+ * An efficient modulo implementation that avoids the use of loops
|
||||
+ * and instead uses faster bitwise operations to achieve the fastest
|
||||
+ * possible execution time.
|
||||
+ *
|
||||
+ * @param dividend the dividend
|
||||
+ * @param divisor the divisor
|
||||
+ * @return the remainder
|
||||
+ */
|
||||
+ public static int fastMod(int dividend, int divisor) {
|
||||
+ return dividend & (divisor - 1);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/yatopia/server/util/TimeUtils.java b/src/main/java/net/yatopia/server/util/TimeUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d68e8ec871b99f0e6fe1c52948bedf38bd449b27
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/yatopia/server/util/TimeUtils.java
|
||||
@@ -0,0 +1,27 @@
|
||||
+package net.yatopia.server.util;
|
||||
+
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+
|
||||
+public class TimeUtils {
|
||||
+
|
||||
+ public static String getFriendlyName(TimeUnit unit) {
|
||||
+ switch (unit) {
|
||||
+ case NANOSECONDS:
|
||||
+ return "ns";
|
||||
+ case MILLISECONDS:
|
||||
+ return "ms";
|
||||
+ case MICROSECONDS:
|
||||
+ return "micros";
|
||||
+ case SECONDS:
|
||||
+ return "s";
|
||||
+ case MINUTES:
|
||||
+ return "m";
|
||||
+ case DAYS:
|
||||
+ return "d";
|
||||
+ case HOURS:
|
||||
+ return "h";
|
||||
+ default:
|
||||
+ throw new AssertionError();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
@ -29,39 +29,6 @@ index 662a005becd1d2642ae50c25fdf3bfadf7ae6ae2..21a0656ce8a44acf45a1756add556a5c
|
||||
//this.methodProfiler.exitEnter("nextTickWait"); // Akarin - remove caller
|
||||
this.X = true;
|
||||
this.W = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
|
||||
diff --git a/src/main/java/net/yatopia/server/TimeUtils.java b/src/main/java/net/yatopia/server/TimeUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b506aaeab4ad997b83d3aa6daaab6eea52a08568
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/yatopia/server/TimeUtils.java
|
||||
@@ -0,0 +1,27 @@
|
||||
+package net.yatopia.server;
|
||||
+
|
||||
+import java.util.concurrent.TimeUnit;
|
||||
+
|
||||
+public class TimeUtils {
|
||||
+
|
||||
+ public static String getFriendlyName(TimeUnit unit) {
|
||||
+ switch (unit) {
|
||||
+ case NANOSECONDS:
|
||||
+ return "ns";
|
||||
+ case MILLISECONDS:
|
||||
+ return "ms";
|
||||
+ case MICROSECONDS:
|
||||
+ return "micros";
|
||||
+ case SECONDS:
|
||||
+ return "s";
|
||||
+ case MINUTES:
|
||||
+ return "m";
|
||||
+ case DAYS:
|
||||
+ return "d";
|
||||
+ case HOURS:
|
||||
+ return "h";
|
||||
+ default:
|
||||
+ throw new AssertionError();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 7277919e1cc5ee8f8fead434a1a33c9008c1618e..0645185e2d73f7001a07a9f5c8461da71b1327d5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@ -74,7 +41,7 @@ index 7277919e1cc5ee8f8fead434a1a33c9008c1618e..0645185e2d73f7001a07a9f5c8461da7
|
||||
+ @Override public java.time.Duration getLastTickTime() { return net.minecraft.server.MinecraftServer.lastTickTime; } // Yatopia
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..8e930bdd6a88806b8857bc73f93ec296f47bd4c3 100644
|
||||
index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..a7b97660ac147dffbbb4ec83e6a2753732d7c041 100644
|
||||
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
||||
@@ -34,6 +34,11 @@ public class TicksPerSecondCommand extends Command
|
||||
@ -102,7 +69,7 @@ index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..8e930bdd6a88806b8857bc73f93ec296
|
||||
+ long toAskedUnit = unit.convert( nanos, nanosUnit );
|
||||
+ long ms = nanosUnit.toMillis( nanos );
|
||||
+ ChatColor startingColor = ms < 40 ? ChatColor.GREEN : ( ms < 50 ) ? ChatColor.YELLOW : ChatColor.RED;
|
||||
+ return startingColor.toString() + toAskedUnit + ChatColor.GOLD + net.yatopia.server.TimeUtils.getFriendlyName( unit );
|
||||
+ return startingColor.toString() + toAskedUnit + ChatColor.GOLD + net.yatopia.server.util.TimeUtils.getFriendlyName( unit );
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
}
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add NBT API as a first-class lib
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 2a77cf53a684535e8331989d252660055d01755d..fd15e54ea87581c61566b7ed4620435fac579bab 100644
|
||||
index d1fc96337dcd8c9b164ba4c0b24b298807884884..69e8253419cb30a975bbf4849d4065a5b696604d 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -321,6 +321,10 @@
|
||||
@@ -327,6 +327,10 @@
|
||||
<pattern>net.minecraft.server</pattern>
|
||||
<shadedPattern>net.minecraft.server.v${minecraft_version}</shadedPattern>
|
||||
</relocation>
|
@ -3,14 +3,25 @@ From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Sat, 26 Sep 2020 11:37:25 -0500
|
||||
Subject: [PATCH] lithium PerlinNoiseSamplerMixin
|
||||
|
||||
This is a more optimized version of Lithium's PerlinNoiseSamplerMixin.
|
||||
Original code by JellySquid, licensed under LGPLv3
|
||||
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
|
||||
|
||||
Co-authored-by: Bud Gidiere <sgidiere@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java b/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
|
||||
index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..bf7aad5885138db06ce7c51a65b0493dd825f6f7 100644
|
||||
index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..43836d07df27b96036a6b77f88aa66e05738a614 100644
|
||||
--- a/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
|
||||
+++ b/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
|
||||
@@ -8,6 +8,12 @@ public final class NoiseGeneratorPerlin {
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
+import org.apache.commons.math3.util.FastMath; // Yatopia
|
||||
|
||||
public final class NoiseGeneratorPerlin {
|
||||
|
||||
@@ -8,6 +9,12 @@ public final class NoiseGeneratorPerlin {
|
||||
public final double a;
|
||||
public final double b;
|
||||
public final double c;
|
||||
@ -23,7 +34,7 @@ index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..bf7aad5885138db06ce7c51a65b0493d
|
||||
|
||||
public NoiseGeneratorPerlin(Random random) {
|
||||
this.a = random.nextDouble() * 256.0D;
|
||||
@@ -29,9 +35,21 @@ public final class NoiseGeneratorPerlin {
|
||||
@@ -29,8 +36,19 @@ public final class NoiseGeneratorPerlin {
|
||||
this.d[i + j] = b0;
|
||||
}
|
||||
|
||||
@ -38,73 +49,54 @@ index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..bf7aad5885138db06ce7c51a65b0493d
|
||||
+ // Yatopia end
|
||||
}
|
||||
|
||||
+ public final double sample(double x, double y, double z, double d, double e) { return a(x, y, z, d, e); } // Yatopia - OBFHELPER
|
||||
+ // Yatopia start - replaced logic
|
||||
+ /*
|
||||
public double a(double d0, double d1, double d2, double d3, double d4) {
|
||||
+ // Yatopia start - replaced logic
|
||||
+ /*
|
||||
double d5 = d0 + this.a;
|
||||
double d6 = d1 + this.b;
|
||||
double d7 = d2 + this.c;
|
||||
@@ -55,6 +73,29 @@ public final class NoiseGeneratorPerlin {
|
||||
@@ -55,6 +73,125 @@ public final class NoiseGeneratorPerlin {
|
||||
}
|
||||
|
||||
return this.a(i, j, k, d8, d9 - d14, d10, d11, d12, d13);
|
||||
+ */
|
||||
+ final double ox = d0 + this.a;
|
||||
+ final double oy = d1 + this.b;
|
||||
+ final double oz = d2 + this.c;
|
||||
+ public final double sample(double x, double y, double z, double d, double e) { return a(x, y, z, d, e); } // Yatopia - OBFHELPER
|
||||
+ public final double a(double x, double y, double z, double d, double e) {
|
||||
+ final double ox = x + this.a;
|
||||
+ final double oy = y + this.b;
|
||||
+ final double oz = z + this.c;
|
||||
+
|
||||
+ final double fox = FastMath.floor(ox);
|
||||
+ final double foy = FastMath.floor(oy);
|
||||
+ final double foz = FastMath.floor(oz);
|
||||
+
|
||||
+ final double fox = Math.floor(ox);
|
||||
+ final double foy = Math.floor(oy);
|
||||
+ final double foz = Math.floor(oz);
|
||||
+
|
||||
+ double oox = ox - fox;
|
||||
+ final double oox = ox - fox;
|
||||
+ double ooy = oy - foy;
|
||||
+ double ooz = oz - foz;
|
||||
+ final double ooz = oz - foz;
|
||||
+
|
||||
+ final double fx = MathHelper.j(oox);
|
||||
+ final double fy = MathHelper.j(ooy);
|
||||
+ final double fz = MathHelper.j(ooz);
|
||||
+ final double fx = oox * oox * oox * (oox * (oox * 6.0 - 15.0) + 10.0);
|
||||
+ final double fy = ooy * ooy * ooy * (ooy * (ooy * 6.0 - 15.0) + 10.0);
|
||||
+ final double fz = ooz * ooz * ooz * (ooz * (ooz * 6.0 - 15.0) + 10.0);
|
||||
+
|
||||
+ if (d3 != 0.0D) {
|
||||
+ ooy = ooy - (Math.floor(Math.min(d4, ooy) / d3) * d3);
|
||||
+ }
|
||||
+ if (d != 0.0D) { ooy = ooy - (FastMath.floor(FastMath.min(e, ooy) / d) * d); }
|
||||
+
|
||||
+ final int sectionX = (int) fox;
|
||||
+ final int sectionY = (int) foy;
|
||||
+ final int sectionZ = (int) foz;
|
||||
+
|
||||
+ return this.sample((int) fox, (int) foy, (int) foz, oox, ooy, ooz, fx, fy, fz);
|
||||
+ // Yatopia end
|
||||
}
|
||||
|
||||
private static double a(int i, double d0, double d1, double d2) {
|
||||
@@ -67,7 +108,10 @@ public final class NoiseGeneratorPerlin {
|
||||
return this.d[i & 255] & 255;
|
||||
}
|
||||
|
||||
+ public final double sample(int i, int j, int k, double d0, double d1, double d2, double d3, double d4, double d5) { return a(i, j, k, d0, d1, d2, d3, d4, d5); } // Yatopia - OBFHELPER
|
||||
public double a(int i, int j, int k, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||
+ // Yatopia start - replaced logic
|
||||
+ /*
|
||||
int l = this.a(i) + j;
|
||||
int i1 = this.a(l) + k;
|
||||
int j1 = this.a(l + 1) + k;
|
||||
@@ -84,5 +128,100 @@ public final class NoiseGeneratorPerlin {
|
||||
double d13 = a(this.a(i2 + 1), d0 - 1.0D, d1 - 1.0D, d2 - 1.0D);
|
||||
|
||||
return MathHelper.a(d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13);
|
||||
+ */
|
||||
+ final byte[] perm = this.d;
|
||||
+
|
||||
+ final int i1 = (perm[i & 255] & 255) + j;
|
||||
+ final int l = (perm[(i + 1) & 255] & 255) + j;
|
||||
+ final int i = (perm[sectionX & 255] & 255) + sectionY;
|
||||
+ final int l = (perm[(sectionX + 1) & 255] & 255) + sectionY;
|
||||
+
|
||||
+ final int j1 = (perm[255 & i] & 255) + k;
|
||||
+ final int m = (perm[l & 255] & 255) + k;
|
||||
+ final int j = (perm[255 & i] & 255) + sectionZ;
|
||||
+ final int m = (perm[l & 255] & 255) + sectionZ;
|
||||
+
|
||||
+ final int k1 = (perm[(i + 1) & 255] & 255) + k;
|
||||
+ final int n = (perm[(l + 1) & 255] & 255) + k;
|
||||
+ final int k = (perm[(i + 1) & 255] & 255) + sectionZ;
|
||||
+ final int n = (perm[(l + 1) & 255] & 255) + sectionZ;
|
||||
+
|
||||
+ final double localX2 = d0 - 1.0D;
|
||||
+ final double localY2 = d1 - 1.0D;
|
||||
+ final double localZ2 = d2 - 1.0D;
|
||||
+ final double localX2 = oox - 1.0D;
|
||||
+ final double localY2 = ooy - 1.0D;
|
||||
+ final double localZ2 = ooz - 1.0D;
|
||||
+
|
||||
+ final int d00 = (j & 255) << GRADIENT_STRIDE_SH;
|
||||
+ final int d01 = (m & 255) << GRADIENT_STRIDE_SH;
|
||||
@ -118,31 +110,31 @@ index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..bf7aad5885138db06ce7c51a65b0493d
|
||||
+
|
||||
+ final byte[] grad = this.gradientTable;
|
||||
+
|
||||
+ final double g00x = grad[d00] * d0;
|
||||
+ final double g00y = grad[d00 + 1] * d1;
|
||||
+ final double g00z = grad[d00 + 2] * d2;
|
||||
+ final double g00x = grad[d00] * oox;
|
||||
+ final double g00y = grad[d00 + 1] * ooy;
|
||||
+ final double g00z = grad[d00 + 2] * ooz;
|
||||
+
|
||||
+ final double g01x = grad[d01] * localX2;
|
||||
+ final double g01y = grad[d01 + 1] * d1;
|
||||
+ final double g01z = grad[d01 + 2] * d2;
|
||||
+ final double g01y = grad[d01 + 1] * ooy;
|
||||
+ final double g01z = grad[d01 + 2] * ooz;
|
||||
+
|
||||
+ final double g02x = grad[d02] * d0;
|
||||
+ final double g02x = grad[d02] * oox;
|
||||
+ final double g02y = grad[d02 + 1] * localY2;
|
||||
+ final double g02z = grad[d02 + 2] * d2;
|
||||
+ final double g02z = grad[d02 + 2] * ooz;
|
||||
+
|
||||
+ final double g03x = grad[d03] * localX2;
|
||||
+ final double g03y = grad[d03 + 1] * localY2;
|
||||
+ final double g03z = grad[d03 + 2] * d2;
|
||||
+ final double g03z = grad[d03 + 2] * ooz;
|
||||
+
|
||||
+ final double g10x = grad[d10] * d0;
|
||||
+ final double g10y = grad[d10 + 1] * d1;
|
||||
+ final double g10x = grad[d10] * oox;
|
||||
+ final double g10y = grad[d10 + 1] * ooy;
|
||||
+ final double g10z = grad[d10 + 2] * localZ2;
|
||||
+
|
||||
+ final double g11x = grad[d11] * localX2;
|
||||
+ final double g11y = grad[d11 + 1] * d1;
|
||||
+ final double g11y = grad[d11 + 1] * ooy;
|
||||
+ final double g11z = grad[d11 + 2] * localZ2;
|
||||
+
|
||||
+ final double g12x = grad[d12] * d0;
|
||||
+ final double g12x = grad[d12] * oox;
|
||||
+ final double g12y = grad[d12 + 1] * localY2;
|
||||
+ final double g12z = grad[d12 + 2] * localZ2;
|
||||
+
|
||||
@ -164,10 +156,10 @@ index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..bf7aad5885138db06ce7c51a65b0493d
|
||||
+ final double dc1 = g03 - g02;
|
||||
+ final double dc2 = g13 - g12;
|
||||
+
|
||||
+ final double dba1 = d3 * ba1;
|
||||
+ final double dba2 = d3 * ba2;
|
||||
+ final double ddc1 = d3 * dc1;
|
||||
+ final double ddc2 = d3 * dc2;
|
||||
+ final double dba1 = fx * ba1;
|
||||
+ final double dba2 = fx * ba2;
|
||||
+ final double ddc1 = fx * dc1;
|
||||
+ final double ddc2 = fx * dc2;
|
||||
+
|
||||
+ final double dd0 = g00 + dba1;
|
||||
+ final double dd1 = g10 + dba2;
|
||||
@ -177,13 +169,14 @@ index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..bf7aad5885138db06ce7c51a65b0493d
|
||||
+ final double aa0 = dd2 - dd0;
|
||||
+ final double aa1 = dd3 - dd1;
|
||||
+
|
||||
+ final double y20 = d4 * aa0;
|
||||
+ final double y31 = d4 * aa1;
|
||||
+ final double y20 = fy * aa0;
|
||||
+ final double y31 = fy * aa1;
|
||||
+
|
||||
+ final double aa2 = dd0 + y20;
|
||||
+ final double aa3 = dd1 + y31;
|
||||
+
|
||||
+ return dd0 + y20 + (d4 * (aa3 - aa2));
|
||||
+ return dd0 + y20 + (fz * (aa3 - aa2));
|
||||
+ // Yatopia end
|
||||
}
|
||||
}
|
||||
|
||||
private static double a(int i, double d0, double d1, double d2) {
|
@ -7,21 +7,26 @@ Original code by JellySquid, licensed under LGPLv3
|
||||
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/GenLayerZoomVoronoi.java b/src/main/java/net/minecraft/server/GenLayerZoomVoronoi.java
|
||||
index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..6888efc480105f5702dbad7270d59a5c908b4122 100644
|
||||
index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..47415b738c83541f76d504ad4d5f619ccd023feb 100644
|
||||
--- a/src/main/java/net/minecraft/server/GenLayerZoomVoronoi.java
|
||||
+++ b/src/main/java/net/minecraft/server/GenLayerZoomVoronoi.java
|
||||
@@ -6,6 +6,80 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
|
||||
@@ -8,6 +8,8 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
|
||||
|
||||
private GenLayerZoomVoronoi() {}
|
||||
|
||||
+
|
||||
+ // Disable constant condition warnings due to IDEA not being able to see that a method will be replaced at runtime
|
||||
+ @SuppressWarnings("ConstantConditions")
|
||||
+ @Override
|
||||
+ public BiomeBase a(long seed, int x, int y, int z, BiomeManager.Provider storage) {
|
||||
+ int x1 = x - 2;
|
||||
+ int y1 = y - 2;
|
||||
+ int z1 = z - 2;
|
||||
@Override
|
||||
public BiomeBase a(long i, int j, int k, int l, BiomeManager.Provider biomemanager_provider) {
|
||||
+ // Yatopia start - replaced logic
|
||||
+ /*
|
||||
int i1 = j - 2;
|
||||
int j1 = k - 2;
|
||||
int k1 = l - 2;
|
||||
@@ -54,6 +56,75 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
|
||||
l2 = (k2 & 2) == 0 ? i2 : i2 + 1;
|
||||
i3 = (k2 & 1) == 0 ? j2 : j2 + 1;
|
||||
return biomemanager_provider.getBiome(k3, l2, i3);
|
||||
+ */
|
||||
+ int x1 = j - 2;
|
||||
+ int y1 = k - 2;
|
||||
+ int z1 = l - 2;
|
||||
+
|
||||
+ int x2 = x1 >> 2;
|
||||
+ int y2 = y1 >> 2;
|
||||
@ -39,7 +44,7 @@ index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..6888efc480105f5702dbad7270d59a5c
|
||||
+ // to determine the closest one. We can avoid the unnecessary step and simply keep track of the nearest one.
|
||||
+ double minDist = Double.POSITIVE_INFINITY;
|
||||
+
|
||||
+ for (int i = 0; i < 8; i++) {
|
||||
+ for (int i1 = 0; i1 < 8; i1++) {
|
||||
+ // Block sample positions
|
||||
+ int bX;
|
||||
+ int bY;
|
||||
@ -50,7 +55,7 @@ index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..6888efc480105f5702dbad7270d59a5c
|
||||
+ double sY;
|
||||
+ double sZ;
|
||||
+
|
||||
+ if ((i & 0b100) == 0) {
|
||||
+ if ((i1 & 0b100) == 0) {
|
||||
+ bX = x2;
|
||||
+ sX = x3;
|
||||
+ } else {
|
||||
@ -58,7 +63,7 @@ index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..6888efc480105f5702dbad7270d59a5c
|
||||
+ sX = x3 - 1.0D;
|
||||
+ }
|
||||
+
|
||||
+ if ((i & 0b010) == 0) {
|
||||
+ if ((i1 & 0b010) == 0) {
|
||||
+ bY = y2;
|
||||
+ sY = y3;
|
||||
+ } else {
|
||||
@ -66,7 +71,7 @@ index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..6888efc480105f5702dbad7270d59a5c
|
||||
+ sY = y3 - 1.0D;
|
||||
+ }
|
||||
+
|
||||
+ if ((i & 0b001) == 0) {
|
||||
+ if ((i1 & 0b001) == 0) {
|
||||
+ bZ = z2;
|
||||
+ sZ = z3;
|
||||
+ } else {
|
||||
@ -74,7 +79,7 @@ index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..6888efc480105f5702dbad7270d59a5c
|
||||
+ sZ = z3 - 1.0D;
|
||||
+ }
|
||||
+
|
||||
+ double dist = a(seed, bX, bY, bZ, sX, sY, sZ);
|
||||
+ double dist = a(i, bX, bY, bZ, sX, sY, sZ);
|
||||
+
|
||||
+ if (minDist > dist) {
|
||||
+ minDist = dist;
|
||||
@ -85,30 +90,23 @@ index 70ea171edc419f8614004b6e50fc34b8fd9b4a20..6888efc480105f5702dbad7270d59a5c
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return storage.getBiome(retX, retY, retZ);
|
||||
+ }
|
||||
+ /* //Yatopia Start - Replaced Logic
|
||||
@Override
|
||||
public BiomeBase a(long i, int j, int k, int l, BiomeManager.Provider biomemanager_provider) {
|
||||
int i1 = j - 2;
|
||||
@@ -55,6 +129,7 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
|
||||
i3 = (k2 & 1) == 0 ? j2 : j2 + 1;
|
||||
return biomemanager_provider.getBiome(k3, l2, i3);
|
||||
+ return biomemanager_provider.getBiome(retX, retY, retZ);
|
||||
+ // Yatopia end
|
||||
}
|
||||
+ */ //Yatopia End
|
||||
|
||||
private static double a(long i, int j, int k, int l, double d0, double d1, double d2) {
|
||||
long i1 = LinearCongruentialGenerator.a(i, (long) j);
|
||||
@@ -75,10 +150,8 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
|
||||
return a(d2 + d5) + a(d1 + d4) + a(d0 + d3);
|
||||
@@ -76,9 +147,14 @@ public enum GenLayerZoomVoronoi implements GenLayerZoomer {
|
||||
}
|
||||
|
||||
- private static double a(long i) {
|
||||
- double d0 = (double) ((int) Math.floorMod(i >> 24, 1024L)) / 1024.0D;
|
||||
-
|
||||
- return (d0 - 0.5D) * 0.9D;
|
||||
+ private static double a(long seed) {
|
||||
+ return (((seed >> 24) & 1023L) - 512) * 0.00087890625; // * 0.9 / 1024.0d
|
||||
private static double a(long i) {
|
||||
+ // Yatopia start - replaced logic
|
||||
+ /*
|
||||
double d0 = (double) ((int) Math.floorMod(i >> 24, 1024L)) / 1024.0D;
|
||||
|
||||
return (d0 - 0.5D) * 0.9D;
|
||||
+ */
|
||||
+ return (((i >> 24) & 1023L) - 512) * 0.00087890625; // * 0.9 / 1024.0d
|
||||
+ // Yatopia end
|
||||
}
|
||||
|
||||
private static double a(double d0) {
|
@ -1,16 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Sat, 26 Sep 2020 14:25:07 -0500
|
||||
Date: Fri, 23 Oct 2020 16:45:51 -0500
|
||||
Subject: [PATCH] lithium NoiseChunkGeneratorMixin
|
||||
|
||||
Additional Optimizations By YatopiaMC,
|
||||
Original code by SuperCoder79, licensed under LGPLv3
|
||||
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
|
||||
index 119804e5c12aca3f4fbfeaf424f46152f43b3941..100b53e95eeb9582a629fccf5022a527c07a5f86 100644
|
||||
index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e012510612a25fee850e583b3733ff49e8e41319 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
|
||||
@@ -112,7 +112,15 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
@@ -5,6 +5,8 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
|
||||
+import org.apache.commons.math3.util.FastMath; // Yatopia Fast Math
|
||||
+
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -112,7 +114,15 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
return this.w == i && ((GeneratorSettingBase) this.h.get()).a(resourcekey);
|
||||
}
|
||||
|
||||
@ -26,7 +36,7 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..100b53e95eeb9582a629fccf5022a527
|
||||
double d4 = 0.0D;
|
||||
double d5 = 0.0D;
|
||||
double d6 = 0.0D;
|
||||
@@ -148,6 +156,83 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
@@ -148,7 +158,85 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
}
|
||||
|
||||
return MathHelper.b(d4 / 512.0D, d5 / 512.0D, (d6 / 10.0D + 1.0D) / 2.0D);
|
||||
@ -34,6 +44,7 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..100b53e95eeb9582a629fccf5022a527
|
||||
+ double frequency = 1.0;
|
||||
+ double interpolationValue = 0.0;
|
||||
+
|
||||
+ // Calculate interpolation data to decide what noise to sample.
|
||||
+ for (int octave = 0; octave < 8; octave++) {
|
||||
+ double scaledVerticalScale = d3 * frequency;
|
||||
+ double scaledY = j * scaledVerticalScale;
|
||||
@ -104,9 +115,55 @@ index 119804e5c12aca3f4fbfeaf424f46152f43b3941..100b53e95eeb9582a629fccf5022a527
|
||||
+ }
|
||||
+
|
||||
+ // Vanilla behavior, return interpolated noise
|
||||
+ return MathHelper.b(clampedInterpolation, lowerNoise / 512.0, upperNoise / 512.0);
|
||||
+ return MathHelper.d(clampedInterpolation, lowerNoise / 512.0, upperNoise / 512.0);
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
}
|
||||
+ // Yatopia end
|
||||
|
||||
private double[] b(int i, int j) {
|
||||
double[] adouble = new double[this.o + 1];
|
||||
@@ -275,7 +363,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
|
||||
double d2 = d1 * 24.575625D - 2.0D;
|
||||
|
||||
- return d2 < 0.0D ? d2 * 0.009486607142857142D : Math.min(d2, 1.0D) * 0.006640625D;
|
||||
+ return d2 < 0.0D ? d2 * 0.009486607142857142D : FastMath.min(d2, 1.0D) * 0.006640625D; // Yatopia Fast Math
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -292,10 +380,10 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
}
|
||||
|
||||
private int a(int i, int j, @Nullable IBlockData[] aiblockdata, @Nullable Predicate<IBlockData> predicate) {
|
||||
- int k = Math.floorDiv(i, this.m);
|
||||
- int l = Math.floorDiv(j, this.m);
|
||||
- int i1 = Math.floorMod(i, this.m);
|
||||
- int j1 = Math.floorMod(j, this.m);
|
||||
+ int k = FastMath.floorDiv(i, this.m); // Yatopia Fast Math
|
||||
+ int l = FastMath.floorDiv(j, this.m); // Yatopia Fast Math
|
||||
+ int i1 = FastMath.floorMod(i, this.m); // Yatopia Fast Math
|
||||
+ int j1 = FastMath.floorMod(j, this.m); // Yatopia Fast Math
|
||||
double d0 = (double) i1 / (double) this.m;
|
||||
double d1 = (double) j1 / (double) this.m;
|
||||
double[][] adouble = new double[][]{this.b(k, l), this.b(k, l + 1), this.b(k + 1, l), this.b(k + 1, l + 1)};
|
||||
@@ -534,9 +622,9 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
StructurePiece structurepiece = (StructurePiece) objectlistiterator.next();
|
||||
StructureBoundingBox structureboundingbox = structurepiece.g();
|
||||
|
||||
- k4 = Math.max(0, Math.max(structureboundingbox.a - j3, j3 - structureboundingbox.d));
|
||||
+ k4 = FastMath.max(0, FastMath.max(structureboundingbox.a - j3, j3 - structureboundingbox.d)); // Yatopia Fast Math
|
||||
l4 = j2 - (structureboundingbox.b + (structurepiece instanceof WorldGenFeaturePillagerOutpostPoolPiece ? ((WorldGenFeaturePillagerOutpostPoolPiece) structurepiece).d() : 0));
|
||||
- i5 = Math.max(0, Math.max(structureboundingbox.c - i4, i4 - structureboundingbox.f));
|
||||
+ i5 = FastMath.max(0, FastMath.max(structureboundingbox.c - i4, i4 - structureboundingbox.f)); // Yatopia Fast Math
|
||||
}
|
||||
|
||||
objectlistiterator.back(objectlist.size());
|
||||
@@ -591,7 +679,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
double d0 = (double) (i * i + k * k);
|
||||
double d1 = (double) j + 0.5D;
|
||||
double d2 = d1 * d1;
|
||||
- double d3 = Math.pow(2.718281828459045D, -(d2 / 16.0D + d0 / 16.0D));
|
||||
+ double d3 = FastMath.pow(2.718281828459045D, -(d2 / 16.0D + d0 / 16.0D)); // Yatopia Fast Math
|
||||
double d4 = -d1 * MathHelper.i(d2 / 2.0D + d0 / 2.0D) / 2.0D;
|
||||
|
||||
return d4 * d3;
|
132
patches/server/0069-lithium-reduce-allocations.patch
Normal file
132
patches/server/0069-lithium-reduce-allocations.patch
Normal file
@ -0,0 +1,132 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Sat, 24 Oct 2020 19:36:50 -0500
|
||||
Subject: [PATCH] lithium reduce allocations
|
||||
|
||||
This patch reduces object allocations in several places.
|
||||
|
||||
Parts of this patch were created for the Lithium project <https://github.com/jellysquid3/lithium-fabric> by JellySquid <jellysquid+atwork@protonmail.com> and 2No2Name <https://github.com/2No2Name> under the GNU LGPLv3 license.
|
||||
Portions of this patch that were sourced from Lithium were remapped from Yarn mappings by Mykyta Komarnytskyy <nkomarn@hotmail.com>.
|
||||
|
||||
Co-authored-by: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
|
||||
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/ChunkRandomSource.java b/src/main/java/me/jellysquid/mods/lithium/common/world/ChunkRandomSource.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7a71b7ea50fc528864961582f9230f2b8654bf12
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/ChunkRandomSource.java
|
||||
@@ -0,0 +1,12 @@
|
||||
+package me.jellysquid.mods.lithium.common.world;
|
||||
+
|
||||
+import net.minecraft.server.BlockPosition;
|
||||
+import net.minecraft.server.World;
|
||||
+
|
||||
+public interface ChunkRandomSource {
|
||||
+ /**
|
||||
+ * Alternative implementation of {@link World#a(int, int, int, int)} which does not allocate
|
||||
+ * a new {@link BlockPosition}.
|
||||
+ */
|
||||
+ void getRandomPosInChunk(int x, int y, int z, int mask, BlockPosition.MutableBlockPosition out);
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockComposter.java b/src/main/java/net/minecraft/server/BlockComposter.java
|
||||
index 55a5999080b831217b88ed3657e95218fe982c18..f30587b0c455d5159084020719bca7ded535b4c1 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockComposter.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockComposter.java
|
||||
@@ -305,7 +305,7 @@ public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumDirection enumdirection) {
|
||||
- return enumdirection == EnumDirection.UP ? new int[]{0} : new int[0];
|
||||
+ return enumdirection == EnumDirection.UP ? net.yatopia.server.util.Constants.ZERO_ARRAY : net.yatopia.server.util.Constants.EMPTY_ARRAY; // Yatopia - avoid array allocation
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -355,7 +355,7 @@ public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumDirection enumdirection) {
|
||||
- return enumdirection == EnumDirection.DOWN ? new int[]{0} : new int[0];
|
||||
+ return enumdirection == EnumDirection.DOWN ? net.yatopia.server.util.Constants.ZERO_ARRAY : net.yatopia.server.util.Constants.EMPTY_ARRAY; // Yatopia - avoid array allocation
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -391,7 +391,7 @@ public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumDirection enumdirection) {
|
||||
- return new int[0];
|
||||
+ return net.yatopia.server.util.Constants.EMPTY_ARRAY; // Yatopia - avoid array allocation
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index b356686a963e6f5367f39735967b1fb43ad075dc..989cc3d8ca161be0307ce8b43a56c1770fb10c88 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -33,7 +33,7 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
-public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
+public abstract class World implements GeneratorAccess, AutoCloseable, me.jellysquid.mods.lithium.common.world.ChunkRandomSource {
|
||||
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final Codec<ResourceKey<World>> f = MinecraftKey.a.xmap(ResourceKey.b(IRegistry.L), ResourceKey::a);
|
||||
@@ -1509,4 +1509,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
public final boolean isDebugWorld() {
|
||||
return this.debugWorld;
|
||||
}
|
||||
+
|
||||
+ // Yatopia start
|
||||
+ @Override
|
||||
+ public void getRandomPosInChunk(int x, int y, int z, int mask, BlockPosition.MutableBlockPosition out) {
|
||||
+ n = this.n * 3 + 1013904223;
|
||||
+ int rand = n >> 2;
|
||||
+ out.setValues(x + (rand & 15), y + (rand >> 16 & mask), z + (rand >> 8 & 15));
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 11cb25dca79d2db50170252397e9a63223b2e2a5..9e869d2e402c8f2177dd4083b4f3bc4b8fbb4b5c 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -90,6 +90,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
private final EnderDragonBattle dragonBattle;
|
||||
private final StructureManager structureManager;
|
||||
private final boolean Q;
|
||||
+ private final BlockPosition.MutableBlockPosition randomPosInChunkCachedPos = new BlockPosition.MutableBlockPosition(); // Yatopia
|
||||
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -1074,7 +1075,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
//gameprofilerfiller.exitEnter("iceandsnow"); // Akarin - remove caller
|
||||
if (!this.paperConfig.disableIceAndSnow && this.randomTickRandom.nextInt(16) == 0) { // Paper - Disable ice and snow // Paper - optimise random ticking
|
||||
// Paper start - optimise chunk ticking
|
||||
- this.getRandomBlockPosition(j, 0, k, 15, blockposition);
|
||||
+ this.redirectTickGetRandomPosInChunk(this, j, 0, k, 15); // Yatopia
|
||||
int normalY = chunk.getHighestBlockY(HeightMap.Type.MOTION_BLOCKING, blockposition.getX() & 15, blockposition.getZ() & 15);
|
||||
int downY = normalY - 1;
|
||||
blockposition.setY(normalY);
|
||||
@@ -1133,7 +1134,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
BlockPosition blockposition2 = blockposition.setValues(j + randomX, randomY, k + randomZ);
|
||||
IBlockData iblockdata = com.destroystokyo.paper.util.maplist.IBlockDataList.getBlockDataFromRaw(raw);
|
||||
|
||||
- iblockdata.b(this, blockposition2, this.randomTickRandom);
|
||||
+ iblockdata.b(this, blockposition2.immutableCopy(), this.randomTickRandom); // Yatopia
|
||||
|
||||
// We drop the fluid tick since LAVA is ALREADY TICKED by the above method.
|
||||
// TODO CHECK ON UPDATE
|
||||
@@ -1145,6 +1146,12 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
// Paper end
|
||||
}
|
||||
}
|
||||
+ // Yatopia start - reduce blockposition allocations
|
||||
+ private BlockPosition redirectTickGetRandomPosInChunk(WorldServer serverWorld, int x, int y, int z, int mask) {
|
||||
+ ((me.jellysquid.mods.lithium.common.world.ChunkRandomSource) serverWorld).getRandomPosInChunk(x, y, z, mask, this.randomPosInChunkCachedPos);
|
||||
+ return this.randomPosInChunkCachedPos;
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
|
||||
protected BlockPosition a(BlockPosition blockposition) {
|
||||
BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition);
|
55
patches/server/0070-Smarter-statistics-ticking.patch
Normal file
55
patches/server/0070-Smarter-statistics-ticking.patch
Normal file
@ -0,0 +1,55 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
Date: Sat, 24 Oct 2020 21:03:53 -0500
|
||||
Subject: [PATCH] Smarter statistics ticking
|
||||
|
||||
In vanilla, statistics that count time spent for an action (i.e. time played or sneak time) are incremented every tick. This is retarded. With this patch and a configured interval of 20, the statistics are only ticked every 20th tick and are incremented by 20 ticks at a time. This means a lot less ticking with the same accurate counting.
|
||||
|
||||
With an interval of 20, this patch saves roughly 3ms per tick on a server w/ 80 players online.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index ff6a8473027d82db1fbf3ab18fd0cfe08e2d9d78..1c46e9eaedfd8214d998845a07fd8f88eec711ae 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -163,18 +163,23 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.p();
|
||||
if (!this.world.isClientSide) {
|
||||
this.foodData.a(this);
|
||||
- this.a(StatisticList.PLAY_ONE_MINUTE);
|
||||
+ // Yatopia start
|
||||
+ int interval = net.yatopia.server.YatopiaConfig.playerTimeStatisticsInterval;
|
||||
+ if (net.yatopia.server.util.MathUtils.fastMod(ticksLived, interval) == 0) {
|
||||
+ this.a(StatisticList.PLAY_ONE_MINUTE, interval);
|
||||
+ // Yatopia end
|
||||
if (this.isAlive()) {
|
||||
- this.a(StatisticList.TIME_SINCE_DEATH);
|
||||
+ this.a(StatisticList.TIME_SINCE_DEATH, interval); // Yatopia
|
||||
}
|
||||
|
||||
if (this.bw()) {
|
||||
- this.a(StatisticList.SNEAK_TIME);
|
||||
+ this.a(StatisticList.SNEAK_TIME, interval); // Yatopia
|
||||
}
|
||||
|
||||
if (!this.isSleeping()) {
|
||||
- this.a(StatisticList.TIME_SINCE_REST);
|
||||
+ this.a(StatisticList.TIME_SINCE_REST, interval); // Yatopia
|
||||
}
|
||||
+ } // Yatopia
|
||||
}
|
||||
|
||||
int i = 29999999;
|
||||
diff --git a/src/main/java/net/yatopia/server/YatopiaConfig.java b/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
index f0e7684304cab9cea05fa266a66a2ad8172c55b6..9df9f316ac2ec2567435ad33e7d4cdfff384381f 100644
|
||||
--- a/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
+++ b/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
@@ -253,4 +253,9 @@ public class YatopiaConfig {
|
||||
checkFlying = getBoolean("settings.checks.flight", checkFlying);
|
||||
checkVehicleFlying = getBoolean("settings.checks.vehicle-flight", checkVehicleFlying);
|
||||
}
|
||||
+
|
||||
+ public static int playerTimeStatisticsInterval = 1;
|
||||
+ private static void intervals() {
|
||||
+ playerTimeStatisticsInterval = Math.max(1, getInt("settings.intervals.player-time-statistics", 1));
|
||||
+ }
|
||||
}
|
47
patches/server/0071-Configurable-criterion-triggers.patch
Normal file
47
patches/server/0071-Configurable-criterion-triggers.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
Date: Sat, 24 Oct 2020 21:08:17 -0500
|
||||
Subject: [PATCH] Configurable criterion triggers
|
||||
|
||||
This patch adds toggles for three criterion triggers that are called every tick. These can be very unnecessary, and especially in the case of CriterionTriggerEnterBlock, quite heavy.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index b43b02c0bdd5dbf0b7d30de90bdc2f74c015ecc8..b97b6d124089828f773528480fd4a235d89c0c15 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -427,6 +427,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
@Override
|
||||
protected void a(IBlockData iblockdata) {
|
||||
+ if (net.yatopia.server.YatopiaConfig.criterionTriggerEnterBlock) // Yatopia
|
||||
CriterionTriggers.d.a(this, iblockdata);
|
||||
}
|
||||
|
||||
@@ -569,7 +570,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutExperience(this.exp, this.expTotal, this.expLevel));
|
||||
}
|
||||
|
||||
- if (this.ticksLived % 20 == 0) {
|
||||
+ if (net.yatopia.server.YatopiaConfig.criterionTriggerLocation && this.ticksLived % 20 == 0) { // Yatopia
|
||||
CriterionTriggers.p.a(this);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/yatopia/server/YatopiaConfig.java b/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
index 9df9f316ac2ec2567435ad33e7d4cdfff384381f..b92ef7f84755b1de4726c993601ec134a1e7ce9c 100644
|
||||
--- a/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
+++ b/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
@@ -258,4 +258,14 @@ public class YatopiaConfig {
|
||||
private static void intervals() {
|
||||
playerTimeStatisticsInterval = Math.max(1, getInt("settings.intervals.player-time-statistics", 1));
|
||||
}
|
||||
+
|
||||
+ public static boolean criterionTriggerLocation = true;
|
||||
+ public static boolean criterionTriggerEnterBlock = true;
|
||||
+ public static boolean criterionTriggerTick = true;
|
||||
+ private static void criterionTriggers() {
|
||||
+ criterionTriggerLocation = getBoolean("settings.criterion-triggers.location", true);
|
||||
+ criterionTriggerEnterBlock = getBoolean("settings.criterion-triggers.enter-block", true);
|
||||
+ criterionTriggerTick = getBoolean("settings.criterion-triggers.tick", true);
|
||||
+ }
|
||||
+
|
||||
}
|
35
patches/server/0072-Configurable-BlockPhysicsEvent.patch
Normal file
35
patches/server/0072-Configurable-BlockPhysicsEvent.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
Date: Sat, 24 Oct 2020 21:12:45 -0500
|
||||
Subject: [PATCH] Configurable BlockPhysicsEvent
|
||||
|
||||
Bukkit's BlockPhysicsEvent is *ridiculously* spammy and can easily rack in 1,600 calls/sec on a server with just one player. This hogs a ton of CPU time.
|
||||
Paper does alleviate this quite well by only firing if plugins are listening, but a lot of common world protection plugins use this event do not offer toggles for their listeners, which makes Paper's change ineffective for most servers.
|
||||
This patch implements a hard toggle for the event.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 6d62aa2b08f40479997f8bcc841cfb704b18e1b9..0faf368c145a3230f2890302020ee39ead1d2916 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1408,7 +1408,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
- worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
|
||||
+ worldserver.hasPhysicsEvent = net.yatopia.server.YatopiaConfig.fireBlockPhysicsEvent && org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper // Yatopia
|
||||
TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
|
||||
|
||||
this.methodProfiler.a(() -> {
|
||||
diff --git a/src/main/java/net/yatopia/server/YatopiaConfig.java b/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
index b92ef7f84755b1de4726c993601ec134a1e7ce9c..366b1c0f7e55c954a6a2d84e4aaa857764ce1f5a 100644
|
||||
--- a/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
+++ b/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
@@ -268,4 +268,8 @@ public class YatopiaConfig {
|
||||
criterionTriggerTick = getBoolean("settings.criterion-triggers.tick", true);
|
||||
}
|
||||
|
||||
+ public static boolean fireBlockPhysicsEvent = true;
|
||||
+ private static void fireBlockPhysicsEvent() {
|
||||
+ fireBlockPhysicsEvent = getBoolean("settings.fire-block-physics-event", true);
|
||||
+ }
|
||||
}
|
35
patches/server/0073-Infinity-No-Arrows.patch
Normal file
35
patches/server/0073-Infinity-No-Arrows.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
Date: Sun, 25 Oct 2020 12:24:19 -0500
|
||||
Subject: [PATCH] Infinity No Arrows
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 1c46e9eaedfd8214d998845a07fd8f88eec711ae..9967d1277af9f1c3e5c320dbb97a605468e07c59 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -2137,7 +2137,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
}
|
||||
}
|
||||
|
||||
- return this.abilities.canInstantlyBuild ? new ItemStack(Items.ARROW) : ItemStack.b;
|
||||
+ return this.abilities.canInstantlyBuild || (world.purpurConfig.infinityWorksWithNoArrows && EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_INFINITE, itemstack) > 0) ? new ItemStack(Items.ARROW) : ItemStack.b; // Yatopia
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 142120d9fe4b6a621957b8e7b21dd757a8eb38a2..aed464125373eaefe61c14706b3bef046b2b691e 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -177,9 +177,11 @@ public class PurpurWorldConfig {
|
||||
public boolean infinityWorksWithNormalArrows = true;
|
||||
public boolean infinityWorksWithSpectralArrows = false;
|
||||
public boolean infinityWorksWithTippedArrows = false;
|
||||
+ public boolean infinityWorksWithNoArrows = false;
|
||||
private void infinityArrowsSettings() {
|
||||
infinityWorksWithNormalArrows = getBoolean("gameplay-mechanics.infinity-bow.normal-arrows", infinityWorksWithNormalArrows);
|
||||
infinityWorksWithSpectralArrows = getBoolean("gameplay-mechanics.infinity-bow.spectral-arrows", infinityWorksWithSpectralArrows);
|
||||
infinityWorksWithTippedArrows = getBoolean("gameplay-mechanics.infinity-bow.tipped-arrows", infinityWorksWithTippedArrows);
|
||||
+ infinityWorksWithNoArrows = getBoolean("gameplay-mechanics.infinity-bow.no-arrows", infinityWorksWithNoArrows);
|
||||
}
|
||||
}
|
44
patches/server/0074-Custom-Locale-Support.patch
Normal file
44
patches/server/0074-Custom-Locale-Support.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
Date: Sun, 25 Oct 2020 11:45:38 -0500
|
||||
Subject: [PATCH] Custom Locale Support
|
||||
|
||||
All Server Jars Come with a pre-baked, usually English, locale file. This patch allows you to change the locale file by creating a locale.json file in the root directory of your server. Note that while custom locale files are supported by the server no support will be given for non-official Mojang locale files.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java
|
||||
index 29d55483510d3644a1edd3a01d7314232c358ac6..9909dd07d47ec86b71b74f66ab0e252de3441e23 100644
|
||||
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
|
||||
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
|
||||
@@ -30,9 +30,19 @@ public abstract class LocaleLanguage {
|
||||
private static LocaleLanguage c() {
|
||||
Builder<String, String> builder = ImmutableMap.builder();
|
||||
BiConsumer<String, String> biconsumer = builder::put; // Paper - decompile fix
|
||||
+ boolean usingCustomLocale = false; // Yatopia
|
||||
|
||||
try {
|
||||
- InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
|
||||
+ // Yatopia Start - Custom Locale
|
||||
+ InputStream inputstream;
|
||||
+ java.io.File file = new java.io.File("./locale.json");
|
||||
+ if (file.isFile() && file.canRead()) {
|
||||
+ usingCustomLocale = true;
|
||||
+ inputstream = new java.io.FileInputStream(file);
|
||||
+ } else {
|
||||
+ inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
|
||||
+ }
|
||||
+ // Yatopia End
|
||||
Throwable throwable = null;
|
||||
|
||||
try {
|
||||
@@ -55,7 +65,11 @@ public abstract class LocaleLanguage {
|
||||
|
||||
}
|
||||
} catch (JsonParseException | IOException ioexception) {
|
||||
+ if (!usingCustomLocale) { // Yatopia
|
||||
LocaleLanguage.LOGGER.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", ioexception);
|
||||
+ } else { // Yatopia start
|
||||
+ LocaleLanguage.LOGGER.error("Couldn't read strings from custom locale file. Please check that your custom Locale File is formatted correctly", ioexception);
|
||||
+ } // Yatopia end
|
||||
}
|
||||
|
||||
final Map<String, String> map = builder.build();
|
Loading…
Reference in New Issue
Block a user