mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2025-01-14 04:01:49 +01:00
optimizations (#297)
* Drop useless stuff * Faster Random * TE opts * Patches.md * More Faster Random * Fix Build * More Opts * AirplaneLite * Update README.md removed TIC-TACS and adding AirplaneLite * Add AirplaneLite to the update script * Rebuild patches * Make enchanting table ticking configurable * AirplaneLite to commitUpstream.sh * Use FastRandom on more places Co-authored-by: Bud Gidiere <sgidiere@gmail.com> Co-authored-by: Simon Gardling <Titaniumtown@gmail.com>
This commit is contained in:
parent
e8a2efeb31
commit
784079fc31
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,6 +16,7 @@ target/site/surefire-report.html
|
||||
/patches/Empirecraft/**
|
||||
/patches/Rainforest/**
|
||||
/patches/Origami/**
|
||||
/patches/AirplaneLite/**
|
||||
!/patches/Purpur/server.txt
|
||||
!/patches/Purpur/api.txt
|
||||
!/patches/Empirecraft/server.txt
|
||||
@ -26,6 +27,8 @@ target/site/surefire-report.html
|
||||
!/patches/Rainforest/api.txt
|
||||
!/patches/Origami/server.txt
|
||||
!/patches/Origami/api.txt
|
||||
!/patches/AirplaneLite/server.txt
|
||||
!/patches/AirplaneLite/api.txt
|
||||
*.jar
|
||||
|
||||
/testserver/**
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -18,3 +18,6 @@
|
||||
path = Origami
|
||||
url = https://github.com/Minebench/Origami.git
|
||||
branch = 1.16
|
||||
[submodule "AirplaneLite"]
|
||||
path = AirplaneLite
|
||||
url = https://github.com/Technove/AirplaneLite.git
|
||||
|
1
AirplaneLite
Submodule
1
AirplaneLite
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit fd35d6a7f218d33c6792d92f52f09f13e1d7d920
|
20
PATCHES.md
20
PATCHES.md
@ -12,7 +12,6 @@ # Patches
|
||||
| api | Add ChatColor.getById | Aikar | |
|
||||
| api | Add GameProfileLookupEvent | tr7zw | |
|
||||
| server | Add GameProfileLookupEvent | tr7zw | |
|
||||
| server | Add GlueList | Mykyta Komarn | |
|
||||
| server | Add IntelliJ IDEA runnable | Bud Gidiere | |
|
||||
| server | Add JsonList save timings | Ivan Pekov | |
|
||||
| api | Add NBT API as a first-class lib | tr7zw | |
|
||||
@ -30,6 +29,8 @@ # Patches
|
||||
| server | Add permission for F3+N debug | William Blake Galbreath | |
|
||||
| server | Add timings for Behavior | Phoenix616 | |
|
||||
| server | Add timings for Pathfinder | MrIvanPlays | |
|
||||
| server | AirplaneLite Data Structs | Paul Sauve | |
|
||||
| server | AirplaneLite MC Dev Fixes | Paul Sauve | |
|
||||
| server | Allow anvil colors | William Blake Galbreath | |
|
||||
| server | Allow infinite and mending enchantments together | William Blake Galbreath | |
|
||||
| api | Allow inventory resizing | William Blake Galbreath | |
|
||||
@ -40,6 +41,8 @@ # Patches
|
||||
| server | Avoid double I/O operation on load player file | ㄗㄠˋ ㄑㄧˊ | |
|
||||
| server | Barrels and enderchests 6 rows | William Blake Galbreath | |
|
||||
| server | Brandings | YatopiaMC | |
|
||||
| server | Concurrent loadedChunkMap | Paul Sauve | |
|
||||
| server | Concurrent visibleChunks and updatingChunks | Paul Sauve | |
|
||||
| server | Configurable BlockPhysicsEvent | Mykyta Komarnytskyy | |
|
||||
| server | Configurable criterion triggers | Mykyta Komarnytskyy | |
|
||||
| server | Configurable flight checks | l_MrBoom_l | |
|
||||
@ -47,6 +50,7 @@ # Patches
|
||||
| server | Configurable villager brain ticks | William Blake Galbreath | |
|
||||
| server | Cows eat mushrooms | William Blake Galbreath | |
|
||||
| server | Custom Locale Support | Bud Gidiere | |
|
||||
| server | DataBits slight optimization | Paul Sauve | |
|
||||
| api | Default permissions | William Blake Galbreath | |
|
||||
| server | Despawn rate config options per projectile type | jmp | |
|
||||
| api | Disable reload command | Ivan Pekov | |
|
||||
@ -111,31 +115,33 @@ # Patches
|
||||
| server | Shutdown Bootstrap thread pool | foss-mc | |
|
||||
| server | Signs allow color codes | William Blake Galbreath | |
|
||||
| server | Signs editable on right click | William Blake Galbreath | |
|
||||
| server | Simpler ShapelessRecipes comparison for Vanilla | Paul Sauve | |
|
||||
| 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 | |
|
||||
| server | Stop wasting resources on JsonList#get | Ivan Pekov | |
|
||||
| server | Strip raytracing for EntityLiving#hasLineOfSight | Paul Sauve | |
|
||||
| server | Swap priority of checks in chunk ticking | Paul Sauve | |
|
||||
| server | Swaps the predicate order of collision | ㄗㄠˋ ㄑㄧˊ | |
|
||||
| server | Tile Entity optimizations | Mykyta Komarnytskyy | |
|
||||
| server | Timings stuff | William Blake Galbreath | |
|
||||
| server | Use Glue List as delegate for NonNullList | Mykyta Komarn | |
|
||||
| server | Use Glue List in WeightedList | Ivan Pekov | |
|
||||
| server | Use GlueList for some list initialisations in packets | Ivan Pekov | |
|
||||
| server | Use faster random implementation | Mykyta Komarnytskyy | |
|
||||
| server | Use offline uuids if we need to | Ivan Pekov | |
|
||||
| server | Use unmodifiableMap instead of making copy | Paul Sauve | |
|
||||
| server | Utilities | YatopiaMC | Mykyta Komarnytskyy, Ivan Pekov |
|
||||
| api | Yatopia API Bundle | YatopiaMC | |
|
||||
| server | Yatopia configuration | tr7zw | |
|
||||
| server | Yatopia-Server-Fixes | YatopiaMC | |
|
||||
| server | dont load chunks for physics | Aikar | |
|
||||
| server | lithium MixinBiome | JellySquid | |
|
||||
| server | lithium DataTrackerMixin | JellySquid | tr7zw |
|
||||
| server | lithium HashedList | JellySquid | |
|
||||
| server | lithium MixinBox | JellySquid | |
|
||||
| server | lithium MixinDirection | JellySquid | |
|
||||
| server | lithium MixinGoalSelector | JellySquid | |
|
||||
| server | lithium NoiseChunkGeneratorMixin | JellySquid | |
|
||||
| server | lithium PerlinNoiseSamplerMixin | JellySquid | Bud Gidiere |
|
||||
| server | lithium VoronoiBiomeAccessTypeMixin | JellySquid | |
|
||||
| server | lithium VoxelShapesMixin | JellySquid | Ivan Pekov |
|
||||
| server | lithium enum_values | JellySquid | |
|
||||
| server | lithium reduce allocations | JellySquid | Mykyta Komarnytskyy |
|
||||
| server | lithium-MixinDataWatcher | JellySquid | tr7zw |
|
||||
|
@ -17,6 +17,7 @@ ## So what is Yatopia?
|
||||
* [Lithium](https://github.com/jellysquid3/lithium-fabric)
|
||||
* [Origami](https://github.com/Minebench/Origami)
|
||||
* [Purpur](https://github.com/pl3xgaming/Purpur)
|
||||
* [AirplaneLite](https://github.com/Technove/AirplaneLite)
|
||||
|
||||
|
||||
## Try it out
|
||||
|
1
patches/AirplaneLite/server.txt
Normal file
1
patches/AirplaneLite/server.txt
Normal file
@ -0,0 +1 @@
|
||||
AirplaneLite-MC-Dev-Fixes&AirplaneLite-Data-Structs&Strip-raytracing-for-EntityLiving-hasLineOfSight&Simpler-ShapelessRecipes-comparison-for-Vanilla&Use-unmodifiableMap-instead-of-making-copy&DataBits-slight-optimization&Concurrent-loadedChunkMap&Concurrent-visibleChunks-and-updatingChunks&Swap-priority-of-checks-in-chunk-ticking
|
@ -349,6 +349,41 @@ index 963c90c065a9e362c8c3030bb36ac6bf0c14a8e2..00000000000000000000000000000000
|
||||
- }
|
||||
-
|
||||
- public boolean checkIfLeftOwner() { return this.h(); } // Purpur - OBFHELPER
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 07b76471e29dc18f336604d635a325786e0dd73c..57b1381c31395b4233cbb6a5dbb5bd296a664ef4 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -853,7 +853,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
//this.dataRegionManager.addChunk(playerchunk.location.x, playerchunk.location.z); // Tuinity
|
||||
}
|
||||
|
||||
- this.updatingChunks.put(i, playerchunk);
|
||||
+ // AirplaneL start
|
||||
+ this.internalMap.addUpdatingChunk(i, playerchunk);
|
||||
+ //this.updatingChunks.put(i, playerchunk);
|
||||
+ // AirplaneL end
|
||||
this.updatingChunksModified = true;
|
||||
}
|
||||
|
||||
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 8f76beb966ee37af62e4360704cf11ac84892dde..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java.rej
|
||||
+++ /dev/null
|
||||
@@ -1,13 +0,0 @@
|
||||
-diff a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java (rejected hunks)
|
||||
-@@ -840,7 +862,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
- }
|
||||
- this.getVillagePlace().dequeueUnload(playerchunk.location.pair()); // Tuinity - unload POI data
|
||||
-
|
||||
-- this.updatingChunks.put(i, playerchunk);
|
||||
-+ // AirplaneL start
|
||||
-+ this.internalMap.addUpdatingChunk(i, playerchunk);
|
||||
-+ //this.updatingChunks.put(i, playerchunk);
|
||||
-+ // AirplaneL end
|
||||
- this.updatingChunksModified = true;
|
||||
- }
|
||||
-
|
||||
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
index a62c87bceab2c9700a7b3925f208b0ffa2b9b393..1a6c593f5f20fb3a8e87ccb70cd3de7f0dcb0327 100644
|
||||
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
|
||||
@ -385,7 +420,7 @@ index dd52a8fe4fd46e57a5d1af49ba1965a483cf4fcc..00000000000000000000000000000000
|
||||
- IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS, !(iworldreader instanceof World) || !((World) iworldreader).origamiConfig.onlyFindGeneratedFeatures);
|
||||
- if (ichunkaccess == null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 9c92f7e7f51c7438a6d4f74b26f4965cdff538b0..55f12f104515e73e7f282bfbd21cb372ad5c3832 100644
|
||||
index 6f243d1f8e99f66a29e3af689c2bdbdd5597b868..5b45051af00b823e7bbfd9407f2ff66539583863 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -96,6 +96,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
@ -8,6 +8,23 @@ This patch includes all utilities required by the Yatopia project and its patche
|
||||
Co-authored-by: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index d8db9f467fb0f4e5576e8c9ae5fc6cf69921d1bc..797e7c884fcd8a28d0c538e3e174080f485d95d3 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -166,6 +166,12 @@
|
||||
<artifactId>commons-math3</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
+ <!-- Fast Random -->
|
||||
+ <dependency>
|
||||
+ <groupId>org.apache.commons</groupId>
|
||||
+ <artifactId>commons-rng-core</artifactId>
|
||||
+ <version>1.3</version>
|
||||
+ </dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
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
|
||||
@ -21,6 +38,76 @@ index 0000000000000000000000000000000000000000..5b2ac2bd00c49e44f5692be42e483409
|
||||
+ 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/FastRandom.java b/src/main/java/net/yatopia/server/util/FastRandom.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..8fa24a06f6dbdfcef2c9b907b2e7b1267befab48
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/yatopia/server/util/FastRandom.java
|
||||
@@ -0,0 +1,64 @@
|
||||
+package net.yatopia.server.util;
|
||||
+
|
||||
+import org.apache.commons.rng.core.source64.XoRoShiRo128PlusPlus;
|
||||
+
|
||||
+import java.util.Random;
|
||||
+import java.util.SplittableRandom;
|
||||
+
|
||||
+public class FastRandom extends Random {
|
||||
+
|
||||
+ private XoRoShiRo128PlusPlus random;
|
||||
+
|
||||
+ public FastRandom() {
|
||||
+ super();
|
||||
+ SplittableRandom randomseed = new SplittableRandom();
|
||||
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ public FastRandom(long seed) {
|
||||
+ super(seed);
|
||||
+ SplittableRandom randomseed = new SplittableRandom(seed);
|
||||
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean nextBoolean() {
|
||||
+ return random.nextBoolean();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt() {
|
||||
+ return random.nextInt();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float nextFloat() {
|
||||
+ return (float) random.nextDouble();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double nextDouble() {
|
||||
+ return random.nextDouble();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public synchronized void setSeed(long seed) {
|
||||
+ SplittableRandom randomseed = new SplittableRandom(seed);
|
||||
+ this.random = new XoRoShiRo128PlusPlus(randomseed.nextLong(), randomseed.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void nextBytes(byte[] bytes) {
|
||||
+ random.nextBytes(bytes);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt(int bound) {
|
||||
+ return random.nextInt(bound);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public long nextLong() {
|
||||
+ return random.nextLong();
|
||||
+ }
|
||||
+}
|
||||
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
|
||||
|
@ -47,7 +47,7 @@ index c1eb8e8679de29cb0c18feed73b277801b4b07e5..c8e0310143e72e43832ecaebe6b9252f
|
||||
this.setAllowFlight(dedicatedserverproperties.allowFlight);
|
||||
this.setResourcePack(dedicatedserverproperties.resourcePack, this.ba());
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index a3dba232bfbc06471a0f5d5de78884cc335664d5..5ae64eedf47922973df6b98ad0f953b32f28e51c 100644
|
||||
index 75b04efa0c0d03bd97508a466d5f00b33fa901fa..db73c73277a7061b2004109d060cca7ded92908f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -267,6 +267,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -59,7 +59,7 @@ index 537456a7427cddd6783f5b5d8ee2d655668c4c53..004184a7c3da4f72f68a5fd9b4dd5abd
|
||||
}
|
||||
\ 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 5ae64eedf47922973df6b98ad0f953b32f28e51c..0f3f87469d4b1a0d190b7aad66aa9697830cdf10 100644
|
||||
index db73c73277a7061b2004109d060cca7ded92908f..1e1e31c218581811cf6662360c9de8ceeccade04 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2859,7 +2859,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add NBT API as a first-class lib
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index d8db9f467fb0f4e5576e8c9ae5fc6cf69921d1bc..47ad4c9a021b35fdb9e020571df7f5c0262e6313 100644
|
||||
index 797e7c884fcd8a28d0c538e3e174080f485d95d3..cbc10255e7133b8860d52609c3ca5d2290499e76 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -342,6 +342,10 @@
|
||||
@@ -348,6 +348,10 @@
|
||||
<pattern>net.minecraft.server</pattern>
|
||||
<shadedPattern>net.minecraft.server.v${minecraft_version}</shadedPattern>
|
||||
</relocation>
|
||||
|
@ -39,7 +39,7 @@ index 5d3bb5f393a1e0e4a2e8b9a466530a91279697a9..7f084e7f11a829c10d113c7fb39eec0b
|
||||
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 0f3f87469d4b1a0d190b7aad66aa9697830cdf10..4abd93dfe2cc0e2c1a333a50f194a0a7bf6fa9a8 100644
|
||||
index 1e1e31c218581811cf6662360c9de8ceeccade04..7d28bd1743b98e1493b87d9a3336e1426f65a9fe 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2580,10 +2580,12 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Fri, 31 Jul 2020 21:46:32 -0500
|
||||
Subject: [PATCH] lithium MixinBiome
|
||||
Subject: [PATCH] lithium HashedList
|
||||
|
||||
Original code by JellySquid, licensed under GNU Lesser General Public License v3.0
|
||||
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
|
||||
@ -292,16 +292,3 @@ index 0000000000000000000000000000000000000000..2d79932dbd1fc386a94b8d6ea3526934
|
||||
+ return new HashedList<>(list);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java
|
||||
index a18ca3f0001a771f21012bd39711f581efb2fef0..0f88b7b38b6191c3adbebdee82427275640c4197 100644
|
||||
--- a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java
|
||||
+++ b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java
|
||||
@@ -113,7 +113,7 @@ public class BiomeSettingsMobs {
|
||||
private final Map<EnumCreatureType, List<BiomeSettingsMobs.c>> a = (Map) Stream.of(EnumCreatureType.values()).collect(Maps.toImmutableEnumMap((enumcreaturetype) -> {
|
||||
return enumcreaturetype;
|
||||
}, (enumcreaturetype) -> {
|
||||
- return new MobList(); // Use MobList instead of ArrayList
|
||||
+ return me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(new MobList()); // Use MobList instead of ArrayList // Yatopia - hashedlist
|
||||
}));
|
||||
// Paper end
|
||||
private final Map<EntityTypes<?>, BiomeSettingsMobs.b> b = Maps.newLinkedHashMap();
|
File diff suppressed because it is too large
Load Diff
@ -5,19 +5,17 @@ Subject: [PATCH] Optimize TileEntity load/unload
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 55f12f104515e73e7f282bfbd21cb372ad5c3832..6c69cc17b11ba9de81dcf223074ecf7ce1214ccb 100644
|
||||
index 5b45051af00b823e7bbfd9407f2ff66539583863..de7ca87e74084c5cca109a6eff071da351dec91b 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -42,9 +42,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
@@ -42,8 +42,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
public static final ResourceKey<World> THE_END = ResourceKey.a(IRegistry.L, new MinecraftKey("the_end"));
|
||||
private static final EnumDirection[] a = EnumDirection.values();
|
||||
//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();
|
||||
- protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
|
||||
+ public final List<TileEntity> tileEntityListTick = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(new net.yatopia.server.list.GlueList<>()); // Yatopia
|
||||
+ protected final List<TileEntity> tileEntityListPending = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(new net.yatopia.server.list.GlueList<>()); // Yatopia
|
||||
+ protected final List<TileEntity> tileEntityListUnload = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(new net.yatopia.server.list.GlueList<>()); // Yatopia
|
||||
+ public final List<TileEntity> tileEntityListTick = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(Lists.newArrayList()); // Yatopia
|
||||
+ protected final List<TileEntity> tileEntityListPending = me.jellysquid.mods.lithium.common.util.collections.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;
|
||||
private int d;
|
@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Tue, 4 Aug 2020 21:46:05 +0200
|
||||
Subject: [PATCH] lithium-MixinDataWatcher
|
||||
Subject: [PATCH] lithium DataTrackerMixin
|
||||
|
||||
Original code by JellySquid, licensed under GNU Lesser General Public License v3.0
|
||||
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
|
@ -6,23 +6,9 @@ Subject: [PATCH] Optimize some stuff in WorldServer ticking
|
||||
Replaced some streams and some array lists with glue lists
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index ec86f278af15ec115d09135b75179e00dd013c11..58d05ee4432bb2ec58ed31d6cd07ccbd89f9eac3 100644
|
||||
index 79142c74bd5c9751a0c5f2f326cdf8adf8d61301..b3385a1522c82998420efcf0d27ecb87da76d039 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -64,11 +64,11 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
public final Int2ObjectMap<Entity> entitiesById = new Int2ObjectLinkedOpenHashMap(); final com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entitiesForIteration = new com.tuinity.tuinity.util.maplist.IteratorSafeOrderedReferenceSet<>(2048, 0.5f, 2048, 0.2, true); // Tuinity - make removing entities while ticking safe
|
||||
private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
|
||||
private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque();
|
||||
- public final List<EntityPlayer> players = Lists.newArrayList(); // Paper - private -> public
|
||||
+ public final List<EntityPlayer> players = new net.yatopia.server.list.GlueList<>(); // Paper - private -> public // Yatopia
|
||||
public final ChunkProviderServer chunkProvider; // Paper - public
|
||||
boolean tickingEntities;
|
||||
// Paper start
|
||||
- List<java.lang.Runnable> afterEntityTickingTasks = Lists.newArrayList();
|
||||
+ List<java.lang.Runnable> afterEntityTickingTasks = new net.yatopia.server.list.GlueList<>(); // Yatopia
|
||||
public void doIfNotEntityTicking(java.lang.Runnable run) {
|
||||
if (tickingEntities) {
|
||||
afterEntityTickingTasks.add(run);
|
||||
@@ -960,12 +960,21 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
|
||||
}
|
@ -5,7 +5,7 @@ Subject: [PATCH] Optimize BehaviorController
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BehaviorController.java b/src/main/java/net/minecraft/server/BehaviorController.java
|
||||
index ae2905b403a63396d9cdc61444586ea5548f2974..6b8da8303a19bbd65a4b38c664c49a6a8ac646a4 100644
|
||||
index ae2905b403a63396d9cdc61444586ea5548f2974..4ad7f42158bb945088a4d1c574c63dd6c15fa53c 100644
|
||||
--- a/src/main/java/net/minecraft/server/BehaviorController.java
|
||||
+++ b/src/main/java/net/minecraft/server/BehaviorController.java
|
||||
@@ -53,13 +53,16 @@ public class BehaviorController<E extends EntityLiving> {
|
||||
@ -21,7 +21,7 @@ index ae2905b403a63396d9cdc61444586ea5548f2974..6b8da8303a19bbd65a4b38c664c49a6a
|
||||
- });
|
||||
+ // Yatopia start
|
||||
+ // about previous impl: WHY ? WHO DID THIS TO YOU?
|
||||
+ Collection<T> candidates = new net.yatopia.server.list.GlueList<>();
|
||||
+ Collection<T> candidates = new java.util.ArrayList<>();
|
||||
+ for (MemoryModuleType<?> moduleType : collection) {
|
||||
+ moduleType.getSerializer()
|
||||
+ .map(c -> IRegistry.MEMORY_MODULE_TYPE.getKey(moduleType))
|
||||
@ -79,7 +79,7 @@ index ae2905b403a63396d9cdc61444586ea5548f2974..6b8da8303a19bbd65a4b38c664c49a6a
|
||||
|
||||
+ // Yatopia start
|
||||
+ private List<BehaviorController.a<?>> memoriesList() {
|
||||
+ List<BehaviorController.a<?>> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ List<BehaviorController.a<?>> ret = new java.util.ArrayList<>();
|
||||
+ for (Map.Entry<MemoryModuleType<?>, Optional<? extends ExpirableMemory<?>>> entry : memories.entrySet()) {
|
||||
+ ret.add(BehaviorController.a.b(entry.getKey(), (Optional) entry.getValue()));
|
||||
+ }
|
@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..18666522e08153093bc5457b2524622a
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 6fcc7ed7c129e6a33386d65b37cbba4a44e96f0f..dbe6f7d555e8c851faba5cafee8831c516256c09 100644
|
||||
index 6fcc7ed7c129e6a33386d65b37cbba4a44e96f0f..e6b5a21c523c598f53207d024322301fbae74825 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -341,6 +341,16 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
@ -77,7 +77,7 @@ index 6fcc7ed7c129e6a33386d65b37cbba4a44e96f0f..dbe6f7d555e8c851faba5cafee8831c5
|
||||
|
||||
+ // Yatopia start
|
||||
+ public static java.util.List<BlockPosition> getPositions(int i, int j, int k, int l, int i1, int j1) {
|
||||
+ java.util.List<BlockPosition> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<BlockPosition> ret = new java.util.ArrayList<>();
|
||||
+ Iterable<BlockPosition> iterable = b(i, j, k, l, i1, j1);
|
||||
+ net.yatopia.server.HoldingConsumer<BlockPosition> consumer = new net.yatopia.server.HoldingConsumer<>();
|
||||
+ java.util.Spliterator<BlockPosition> spliterator = iterable.spliterator();
|
||||
@ -109,26 +109,22 @@ index 271fddbbf73ca5c0e4e2722d7246c14b778d6072..7d5935be528a17809f778578dd2cc559
|
||||
int i = Math.abs(chunkcoordintpair.x - chunkcoordintpair1.x) + 1;
|
||||
int j = Math.abs(chunkcoordintpair.z - chunkcoordintpair1.z) + 1;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java
|
||||
index f73641ddb3e82bc653732105ef0a3d41a28e845f..f1d6239b834498dc12c1674b3e776d0c15215568 100644
|
||||
index f73641ddb3e82bc653732105ef0a3d41a28e845f..cd9b52d0233caa6ad60b90e2049c6247f6e1954b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityBee.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityBee.java
|
||||
@@ -720,15 +720,24 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB
|
||||
@@ -720,15 +720,19 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB
|
||||
private List<BlockPosition> j() {
|
||||
BlockPosition blockposition = EntityBee.this.getChunkCoordinates();
|
||||
VillagePlace villageplace = ((WorldServer) EntityBee.this.world).y();
|
||||
- Stream<VillagePlaceRecord> stream = villageplace.c((villageplacetype) -> {
|
||||
+ List<VillagePlaceRecord> stream = villageplace.cList((villageplacetype) -> { // Yatopia
|
||||
+ List<BlockPosition> stream = villageplace.cListPositions((villageplacetype) -> { // Yatopia
|
||||
return villageplacetype == VillagePlaceType.t || villageplacetype == VillagePlaceType.u;
|
||||
}, blockposition, 20, VillagePlace.Occupancy.ANY);
|
||||
- }, blockposition, 20, VillagePlace.Occupancy.ANY);
|
||||
-
|
||||
+ }, (record) -> i(record.getPosition()), blockposition, 20, VillagePlace.Occupancy.ANY); // Yatopia
|
||||
+ // Yatopia start
|
||||
+ List<BlockPosition> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ for (VillagePlaceRecord record : stream) {
|
||||
+ BlockPosition pos = record.getPosition();
|
||||
+ if (i(pos)) { ret.add(pos); }
|
||||
+ }
|
||||
+ ret.sort(Comparator.comparingDouble((pos1) -> pos1.distanceSquared(blockposition)));
|
||||
+ return ret;
|
||||
+ stream.sort(Comparator.comparingDouble((pos1) -> pos1.distanceSquared(blockposition)));
|
||||
+ return stream;
|
||||
+ /*
|
||||
return (List) stream.map(VillagePlaceRecord::f).filter((blockposition1) -> {
|
||||
return EntityBee.this.i(blockposition1);
|
||||
@ -197,7 +193,7 @@ index f95925f1c5d091f1a129d0437bb6e175c6ac080f..6796b1a832779b65d337c63d6b600e2a
|
||||
return StreamSupport.stream(new AbstractSpliterator<SectionPosition>((long) ((l - i + 1) * (i1 - j + 1) * (j1 - k + 1)), 64) {
|
||||
final CursorPosition a = new CursorPosition(i, j, k, l, i1, j1);
|
||||
diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java
|
||||
index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16ab07d7079 100644
|
||||
index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..cd9c619dd038abafede98703946d37e53595af73 100644
|
||||
--- a/src/main/java/net/minecraft/server/VillagePlace.java
|
||||
+++ b/src/main/java/net/minecraft/server/VillagePlace.java
|
||||
@@ -46,7 +46,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
@ -209,7 +205,7 @@ index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16a
|
||||
}
|
||||
|
||||
public boolean a(VillagePlaceType villageplacetype, BlockPosition blockposition) {
|
||||
@@ -67,6 +67,29 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
@@ -67,6 +67,39 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
});
|
||||
}
|
||||
|
||||
@ -218,7 +214,7 @@ index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16a
|
||||
+ int j = org.apache.commons.math3.util.FastMath.floorDiv(i, 16) + 1;
|
||||
+
|
||||
+ java.util.List<ChunkCoordIntPair> list = ChunkCoordIntPair.streamList(new ChunkCoordIntPair(pos), j);
|
||||
+ java.util.List<VillagePlaceRecord> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<VillagePlaceRecord> ret = new java.util.ArrayList<>();
|
||||
+ for (ChunkCoordIntPair chunkPos : list) {
|
||||
+ for (int k = 0; k < 16; k++) { // ITS THE LAW
|
||||
+ this.d(SectionPosition.a(chunkPos, k).asLong()).ifPresent(section -> ret.addAll(section.aList(filter, occupancy)));
|
||||
@ -228,24 +224,34 @@ index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16a
|
||||
+ }
|
||||
+ public java.util.List<VillagePlaceRecord> cList(Predicate<VillagePlaceType> predicate, BlockPosition pos, int i, VillagePlace.Occupancy occupancy) {
|
||||
+ int j = i * i;
|
||||
+ java.util.List<VillagePlaceRecord> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<VillagePlaceRecord> ret = new java.util.ArrayList<>();
|
||||
+ for (VillagePlaceRecord record : this.bList(predicate, pos, i, occupancy)) {
|
||||
+ if (record.getPosition().distanceSquared(pos) <= j) { ret.add(record); }
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ public java.util.List<BlockPosition> cListPositions(Predicate<VillagePlaceType> predicate, Predicate<VillagePlaceRecord> recordFilter, BlockPosition pos, int i, VillagePlace.Occupancy occupancy) {
|
||||
+ int j = i * i;
|
||||
+ java.util.List<BlockPosition> ret = new java.util.ArrayList<>();
|
||||
+ for (VillagePlaceRecord record : this.bList(predicate, pos, i, occupancy)) {
|
||||
+ BlockPosition recordPosition = record.getPosition();
|
||||
+ if (recordPosition.distanceSquared(pos) <= j && recordFilter.test(record)) { ret.add(recordPosition); }
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
+
|
||||
public Stream<VillagePlaceRecord> c(Predicate<VillagePlaceType> predicate, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) {
|
||||
int j = i * i;
|
||||
|
||||
@@ -83,10 +106,28 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
@@ -83,10 +116,28 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
});
|
||||
}
|
||||
|
||||
+ // Yatopia start
|
||||
+ public java.util.List<BlockPosition> aList(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> posFilter, BlockPosition pos, int i, VillagePlace.Occupancy occupancy) {
|
||||
+ java.util.List<BlockPosition> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<BlockPosition> ret = new java.util.ArrayList<>();
|
||||
+ int j = i * i;
|
||||
+ for (VillagePlaceRecord record : this.bList(predicate, pos, i, occupancy)) {
|
||||
+ BlockPosition recordPosition = record.getPosition();
|
||||
@ -268,7 +274,7 @@ index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16a
|
||||
public Stream<BlockPosition> b(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> predicate1, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) {
|
||||
return this.a(predicate, predicate1, blockposition, i, villageplace_occupancy).sorted(Comparator.comparingDouble((blockposition1) -> {
|
||||
return blockposition1.j(blockposition);
|
||||
@@ -94,31 +135,68 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
@@ -94,31 +145,68 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
}
|
||||
|
||||
public Optional<BlockPosition> c(Predicate<VillagePlaceType> predicate, Predicate<BlockPosition> predicate1, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) {
|
||||
@ -339,7 +345,7 @@ index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16a
|
||||
}
|
||||
|
||||
public boolean b(BlockPosition blockposition) {
|
||||
@@ -211,7 +289,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
@@ -211,7 +299,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
}
|
||||
|
||||
private void a(ChunkSection chunksection, SectionPosition sectionposition, BiConsumer<BlockPosition, VillagePlaceType> biconsumer) {
|
||||
@ -348,7 +354,7 @@ index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16a
|
||||
IBlockData iblockdata = chunksection.getType(SectionPosition.b(blockposition.getX()), SectionPosition.b(blockposition.getY()), SectionPosition.b(blockposition.getZ()));
|
||||
|
||||
VillagePlaceType.b(iblockdata).ifPresent((villageplacetype) -> {
|
||||
@@ -221,6 +299,16 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
@@ -221,6 +309,16 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
}
|
||||
|
||||
public void a(IWorldReader iworldreader, BlockPosition blockposition, int i) {
|
||||
@ -365,7 +371,7 @@ index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16a
|
||||
SectionPosition.b(new ChunkCoordIntPair(blockposition), Math.floorDiv(i, 16)).map((sectionposition) -> {
|
||||
return Pair.of(sectionposition, this.d(sectionposition.s()));
|
||||
}).filter((pair) -> {
|
||||
@@ -232,6 +320,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
@@ -232,6 +330,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
}).forEach((chunkcoordintpair) -> {
|
||||
iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.EMPTY);
|
||||
});
|
||||
@ -374,7 +380,7 @@ index 3c9668c9c30ea57c1608e32ece27ec56d580fc62..0473972ae760096ac541c87f8b10f16a
|
||||
|
||||
final class a extends LightEngineGraphSection {
|
||||
diff --git a/src/main/java/net/minecraft/server/VillagePlaceSection.java b/src/main/java/net/minecraft/server/VillagePlaceSection.java
|
||||
index f43bc1f7d693d63c6bbdba976c048d2d0c8767b1..8b9f5797a6bee47ff16ee713777b5220dbb0afc6 100644
|
||||
index f43bc1f7d693d63c6bbdba976c048d2d0c8767b1..15d2b2c21e61369b5c7897914ccf0aa950f44668 100644
|
||||
--- a/src/main/java/net/minecraft/server/VillagePlaceSection.java
|
||||
+++ b/src/main/java/net/minecraft/server/VillagePlaceSection.java
|
||||
@@ -5,6 +5,10 @@ import com.google.common.collect.Maps;
|
||||
@ -401,7 +407,7 @@ index f43bc1f7d693d63c6bbdba976c048d2d0c8767b1..8b9f5797a6bee47ff16ee713777b5220
|
||||
|
||||
+ // Yatopia start
|
||||
+ public java.util.List<VillagePlaceRecord> aList(Predicate<VillagePlaceType> predicate, VillagePlace.Occupancy occupancy) {
|
||||
+ java.util.List<VillagePlaceRecord> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<VillagePlaceRecord> ret = new java.util.ArrayList<>();
|
||||
+ for (Map.Entry<VillagePlaceType, Set<VillagePlaceRecord>> entry : c.entrySet()) {
|
||||
+ if (predicate.test(entry.getKey())) {
|
||||
+ for (VillagePlaceRecord record : entry.getValue()) { if (occupancy.a().test(record)) ret.add(record); }
|
||||
@ -447,22 +453,22 @@ index 0000000000000000000000000000000000000000..438adad46014043591f41d037d130a85
|
||||
+}
|
||||
diff --git a/src/main/java/net/yatopia/server/YatopiaChunkPos.java b/src/main/java/net/yatopia/server/YatopiaChunkPos.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..871e305356103f87c2c1ad1487c804b60e13c076
|
||||
index 0000000000000000000000000000000000000000..757c459668837aa36e21f90265f08fbbb4bdead8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/yatopia/server/YatopiaChunkPos.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package net.yatopia.server;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.function.Consumer;
|
||||
+import me.jellysquid.mods.lithium.common.util.Producer;
|
||||
+import net.minecraft.server.ChunkCoordIntPair;
|
||||
+import net.yatopia.server.list.GlueList;
|
||||
+
|
||||
+public class YatopiaChunkPos {
|
||||
+
|
||||
+ public static List<ChunkCoordIntPair> asList(ChunkCoordIntPair pos1, ChunkCoordIntPair pos2) {
|
||||
+ List<ChunkCoordIntPair> list = new GlueList<>();
|
||||
+ List<ChunkCoordIntPair> list = new ArrayList<>();
|
||||
+ Producer.fillList(getStreamProducer(pos1, pos2), list);
|
||||
+ return list;
|
||||
+ }
|
||||
@ -507,23 +513,23 @@ index 0000000000000000000000000000000000000000..871e305356103f87c2c1ad1487c804b6
|
||||
+}
|
||||
diff --git a/src/main/java/net/yatopia/server/YatopiaChunkSectionPos.java b/src/main/java/net/yatopia/server/YatopiaChunkSectionPos.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..134c761c7897f37c20b5209866374dd79dc5b0e4
|
||||
index 0000000000000000000000000000000000000000..4466c4c3afe875106a8dd0818718ce71e1d00eb3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/yatopia/server/YatopiaChunkSectionPos.java
|
||||
@@ -0,0 +1,32 @@
|
||||
+package net.yatopia.server;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.function.Consumer;
|
||||
+import me.jellysquid.mods.lithium.common.util.Producer;
|
||||
+import net.minecraft.server.CursorPosition;
|
||||
+import net.minecraft.server.SectionPosition;
|
||||
+import net.yatopia.server.list.GlueList;
|
||||
+
|
||||
+public class YatopiaChunkSectionPos {
|
||||
+
|
||||
+ public static List<SectionPosition> getChunkSectionPosList(int i, int j, int k, int l, int i1, int j1) {
|
||||
+ List<SectionPosition> list = new GlueList<>();
|
||||
+ List<SectionPosition> list = new ArrayList<>();
|
||||
+ Producer.fillList(getChunkSectionPosProducer(i, j, k, l, i1, j1), list);
|
||||
+ return list;
|
||||
+ }
|
@ -45,7 +45,7 @@ index e10995ec30dd9a10d781b3c1709fd2db5a9becdd..456af55b5908f7192a63c6b15fb93a34
|
||||
return optional.map((villageplacerecord) -> {
|
||||
BlockPosition blockposition1 = villageplacerecord.f();
|
||||
diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java
|
||||
index 0473972ae760096ac541c87f8b10f16ab07d7079..faf44b060da5189e06732f699fa6766665c1b391 100644
|
||||
index cd9c619dd038abafede98703946d37e53595af73..1ddd7c7d3a7d331e3a37c11cd345089146c112e0 100644
|
||||
--- a/src/main/java/net/minecraft/server/VillagePlace.java
|
||||
+++ b/src/main/java/net/minecraft/server/VillagePlace.java
|
||||
@@ -80,6 +80,18 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
@ -56,7 +56,7 @@ index 0473972ae760096ac541c87f8b10f16ab07d7079..faf44b060da5189e06732f699fa67666
|
||||
+ int j = org.apache.commons.math3.util.FastMath.floorDiv(i, 16) + 1;
|
||||
+
|
||||
+ java.util.List<ChunkCoordIntPair> list = ChunkCoordIntPair.streamList(new ChunkCoordIntPair(pos), j);
|
||||
+ java.util.List<VillagePlaceRecord> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<VillagePlaceRecord> ret = new java.util.ArrayList<>();
|
||||
+ for (ChunkCoordIntPair chunkPos : list) {
|
||||
+ for (int k = 0; k < 16; k++) {
|
||||
+ this.d(SectionPosition.a(chunkPos, k).asLong()).ifPresent(section -> ret.addAll(section.getFilteredList(filter, filterRecords, occupancy)));
|
||||
@ -66,8 +66,8 @@ index 0473972ae760096ac541c87f8b10f16ab07d7079..faf44b060da5189e06732f699fa67666
|
||||
+ }
|
||||
public java.util.List<VillagePlaceRecord> cList(Predicate<VillagePlaceType> predicate, BlockPosition pos, int i, VillagePlace.Occupancy occupancy) {
|
||||
int j = i * i;
|
||||
java.util.List<VillagePlaceRecord> ret = new net.yatopia.server.list.GlueList<>();
|
||||
@@ -323,6 +335,18 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
java.util.List<VillagePlaceRecord> ret = new java.util.ArrayList<>();
|
||||
@@ -333,6 +345,18 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
||||
*/ // Yatopia end
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ index 0473972ae760096ac541c87f8b10f16ab07d7079..faf44b060da5189e06732f699fa67666
|
||||
|
||||
private final Long2ByteMap b = new Long2ByteOpenHashMap();
|
||||
diff --git a/src/main/java/net/minecraft/server/VillagePlaceSection.java b/src/main/java/net/minecraft/server/VillagePlaceSection.java
|
||||
index 8b9f5797a6bee47ff16ee713777b5220dbb0afc6..1a0a30a1e7a231d05109428b2f57ae91841f3579 100644
|
||||
index 15d2b2c21e61369b5c7897914ccf0aa950f44668..5bc361c60bdf58122513fef267f60bd385d4af24 100644
|
||||
--- a/src/main/java/net/minecraft/server/VillagePlaceSection.java
|
||||
+++ b/src/main/java/net/minecraft/server/VillagePlaceSection.java
|
||||
@@ -69,6 +69,19 @@ public class VillagePlaceSection {
|
||||
@ -95,7 +95,7 @@ index 8b9f5797a6bee47ff16ee713777b5220dbb0afc6..1a0a30a1e7a231d05109428b2f57ae91
|
||||
return ret;
|
||||
}
|
||||
+ public java.util.List<VillagePlaceRecord> getFilteredList(Predicate<VillagePlaceType> predicate, Predicate<VillagePlaceRecord> recordFilter, VillagePlace.Occupancy occupancy) {
|
||||
+ java.util.List<VillagePlaceRecord> ret = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<VillagePlaceRecord> ret = new java.util.ArrayList<>();
|
||||
+ for (Map.Entry<VillagePlaceType, Set<VillagePlaceRecord>> entry : c.entrySet()) {
|
||||
+ if (predicate.test(entry.getKey())) {
|
||||
+ for (VillagePlaceRecord record : entry.getValue()) {
|
@ -1,60 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: JellySquid <jellysquid+atwork@protonmail.com>
|
||||
Date: Thu, 20 Aug 2020 16:37:20 +0300
|
||||
Subject: [PATCH] lithium VoxelShapesMixin
|
||||
|
||||
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: Ivan Pekov <ivan@mrivanplays.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EnumAxisCycle.java b/src/main/java/net/minecraft/server/EnumAxisCycle.java
|
||||
index 92ab79532d29341e8840341ff5ee8f5203cb4aad..bc7b9d0b4d9e3f7519bb013054eeec512e9342d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnumAxisCycle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java
|
||||
@@ -82,6 +82,7 @@ public enum EnumAxisCycle {
|
||||
|
||||
public abstract int a(int i, int j, int k, EnumDirection.EnumAxis enumdirection_enumaxis);
|
||||
|
||||
+ public final EnumDirection.EnumAxis cycle(EnumDirection.EnumAxis axis) { return a(axis); } // Yatopia - OBFHELPER
|
||||
public abstract EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis);
|
||||
|
||||
public abstract EnumAxisCycle a();
|
||||
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
|
||||
index 700660dd93b3090334bb3033d5f5fdd6ab684744..fd34dffa63995c1fc277eac28eb1cd23e3a5e105 100644
|
||||
--- a/src/main/java/net/minecraft/server/VoxelShape.java
|
||||
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
|
||||
@@ -148,6 +148,7 @@ public abstract class VoxelShape {
|
||||
}
|
||||
}
|
||||
|
||||
+ public final double calculateMaxDistance(EnumDirection.EnumAxis axis, AxisAlignedBB box, double movement) { return a(axis, box, movement); } // Yatopia - OBFHELPER
|
||||
public double a(EnumDirection.EnumAxis enumdirection_enumaxis, AxisAlignedBB axisalignedbb, double d0) {
|
||||
return this.a(EnumAxisCycle.a(enumdirection_enumaxis, EnumDirection.EnumAxis.X), axisalignedbb, d0);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
|
||||
index db735e29d427cc8f4bd4ba54c7a44daf9fed9e61..641e40dd24082cfe1450e5a3a29312bd07ad2155 100644
|
||||
--- a/src/main/java/net/minecraft/server/VoxelShapes.java
|
||||
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java
|
||||
@@ -272,6 +272,21 @@ public final class VoxelShapes {
|
||||
return 0.0D;
|
||||
} else {
|
||||
EnumAxisCycle enumaxiscycle1 = enumaxiscycle.a();
|
||||
+ // Yatopia start
|
||||
+ if (d0 < 0 || enumaxiscycle1.cycle(EnumDirection.EnumAxis.Z) == EnumDirection.EnumAxis.Y) {
|
||||
+ int x = MathHelper.floor((axisalignedbb.minX + axisalignedbb.maxX) / 2);
|
||||
+ int y = MathHelper.f(axisalignedbb.minY) - 1;
|
||||
+ int z = MathHelper.floor((axisalignedbb.minZ + axisalignedbb.maxZ) / 2);
|
||||
+ BlockPosition pos = new BlockPosition(x, y, z);
|
||||
+ IBlockData data = iworldreader.getTypeIfLoaded(pos);
|
||||
+ if (data != null) {
|
||||
+ d0 = data.getCollisionShape(iworldreader, pos, voxelshapecollision).calculateMaxDistance(EnumDirection.EnumAxis.Y, axisalignedbb.offset(-x, -y, -z), d0);
|
||||
+ if (Math.abs(d0) < 1.0E-7D) {
|
||||
+ return 0.0D;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = enumaxiscycle1.a(EnumDirection.EnumAxis.X);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis1 = enumaxiscycle1.a(EnumDirection.EnumAxis.Y);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis2 = enumaxiscycle1.a(EnumDirection.EnumAxis.Z);
|
@ -25,7 +25,7 @@ index fdfd955aad65b758696b72a71521ec74e9aa122a..7c3e792b53329c869fbd21e298961b3f
|
||||
return this.getBlock().a(block);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index dbe6f7d555e8c851faba5cafee8831c516256c09..3bd6d37a93b741043851c6a24ffe61f517774546 100644
|
||||
index e6b5a21c523c598f53207d024322301fbae74825..9e41ff0ed0686fb7c400a0f551e3ea5927183ca3 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -318,7 +318,15 @@ public class BlockPosition extends BaseBlockPosition {
|
@ -18,7 +18,7 @@ index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..f3494ac1ad659352ca5595adf9e6919b
|
||||
return this.size == 0 && this.pendingTasks.isEmpty();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 58d05ee4432bb2ec58ed31d6cd07ccbd89f9eac3..ff541132cf2064a5d6af866c8b486dfa886ad69f 100644
|
||||
index b3385a1522c82998420efcf0d27ecb87da76d039..6c39796e672a6412e85f69a6a3dfdb1037e51d30 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -1905,6 +1905,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Respect PlayerKickEvent leaveMessage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index a7373681b8442b302a5f9cf5a7408443defc6f8c..9ca2bb896a17312614b08d5717a7713908a45845 100644
|
||||
index a7373681b8442b302a5f9cf5a7408443defc6f8c..292eef68b8d71236c845dd5c42c5366b5b55efc0 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -320,7 +320,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
@ -10,7 +10,7 @@ added.
|
||||
These changes aim to reduce that load whenever you are using the /whitelist command.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/CommandWhitelist.java b/src/main/java/net/minecraft/server/CommandWhitelist.java
|
||||
index 893d2c1c74ed28dcdb83b71762ccdcbfd50a8f9d..f9e97d28ab182ff1b9e216b2c451642855d52738 100644
|
||||
index 893d2c1c74ed28dcdb83b71762ccdcbfd50a8f9d..107091a4cae0e4eaba93f69ae91239ab891a90d9 100644
|
||||
--- a/src/main/java/net/minecraft/server/CommandWhitelist.java
|
||||
+++ b/src/main/java/net/minecraft/server/CommandWhitelist.java
|
||||
@@ -12,8 +12,8 @@ public class CommandWhitelist {
|
||||
@ -64,7 +64,7 @@ index 893d2c1c74ed28dcdb83b71762ccdcbfd50a8f9d..f9e97d28ab182ff1b9e216b2c4516428
|
||||
return i;
|
||||
}
|
||||
+ */
|
||||
+ java.util.List<WhiteListEntry> toAdd = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<WhiteListEntry> toAdd = new java.util.ArrayList<>();
|
||||
+ for (GameProfile profile : collection) {
|
||||
+ if (!whitelist.isWhitelisted(profile)) {
|
||||
+ toAdd.add(new WhiteListEntry(profile));
|
||||
@ -92,7 +92,7 @@ index 893d2c1c74ed28dcdb83b71762ccdcbfd50a8f9d..f9e97d28ab182ff1b9e216b2c4516428
|
||||
return i;
|
||||
}
|
||||
+ */
|
||||
+ java.util.List<JsonListEntry<GameProfile>> toRemove = new net.yatopia.server.list.GlueList<>();
|
||||
+ java.util.List<JsonListEntry<GameProfile>> toRemove = new java.util.ArrayList<>();
|
||||
+ for (GameProfile profile : collection) {
|
||||
+ if (whitelist.isWhitelisted(profile)) {
|
||||
+ toRemove.add(new WhiteListEntry(profile));
|
@ -5,7 +5,7 @@ Subject: [PATCH] Configurable flight checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 9ca2bb896a17312614b08d5717a7713908a45845..9ee1490dd40592004c40f65bace476762801dafa 100644
|
||||
index 292eef68b8d71236c845dd5c42c5366b5b55efc0..9d896d0bd7feda493a3aecd7959c287cd84ecb7f 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -177,7 +177,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Pekov <ivan@mrivanplays.com>
|
||||
Date: Mon, 28 Sep 2020 14:20:17 -0500
|
||||
Subject: [PATCH] Use Glue List in WeightedList
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WeightedList.java b/src/main/java/net/minecraft/server/WeightedList.java
|
||||
index f0fdfd6891e59891e7370a2d682b65c647b28e9e..bdaffa7a6ff7dce00cb31d5ce5e3c11000b35316 100644
|
||||
--- a/src/main/java/net/minecraft/server/WeightedList.java
|
||||
+++ b/src/main/java/net/minecraft/server/WeightedList.java
|
||||
@@ -21,7 +21,7 @@ public class WeightedList<U> {
|
||||
// Paper start - add useClone option
|
||||
public WeightedList() { this(true); }
|
||||
public WeightedList(boolean isUnsafe) {
|
||||
- this(Lists.newArrayList(), isUnsafe);
|
||||
+ this(new net.yatopia.server.list.GlueList<>(), isUnsafe);
|
||||
}
|
||||
|
||||
private WeightedList(List<WeightedList.a<U>> list) { this(list, true); }
|
||||
@@ -29,7 +29,14 @@ public class WeightedList<U> {
|
||||
this.isUnsafe = isUnsafe;
|
||||
// Paper end
|
||||
this.b = new Random();
|
||||
- this.list = Lists.newArrayList(list); // Paper - decompile conflict
|
||||
+ // Yatopia start
|
||||
+ if (!(list instanceof net.yatopia.server.list.GlueList)) {
|
||||
+ this.list = new net.yatopia.server.list.GlueList<>(list);
|
||||
+ } else {
|
||||
+ this.list = list;
|
||||
+ }
|
||||
+ //this.list = Lists.newArrayList(list); // Paper - decompile conflict
|
||||
+ // Yatopia end
|
||||
}
|
||||
|
||||
public static <U> Codec<WeightedList<U>> a(Codec<U> codec) {
|
||||
@@ -49,7 +56,7 @@ public class WeightedList<U> {
|
||||
|
||||
public WeightedList<U> a(Random random) {
|
||||
// Paper start - make concurrent safe, work off a clone of the list
|
||||
- List<WeightedList.a<U>> list = isUnsafe ? new java.util.ArrayList<WeightedList.a<U>>(this.list) : this.list;
|
||||
+ List<WeightedList.a<U>> list = isUnsafe ? new net.yatopia.server.list.GlueList<>(this.list) : this.list; // Yatopia
|
||||
list.forEach((weightedlist_a) -> weightedlist_a.a(random.nextFloat()));
|
||||
list.sort(Comparator.comparingDouble(a::c));
|
||||
return isUnsafe ? new WeightedList<>(list, isUnsafe) : this;
|
||||
@@ -91,6 +98,7 @@ public class WeightedList<U> {
|
||||
this.c = -Math.pow((double) f, (double) (1.0F / (float) this.b));
|
||||
}
|
||||
|
||||
+ public final T getElement() { return a; } // Yatopia - OBFHELPER
|
||||
public T a() {
|
||||
return this.a;
|
||||
}
|
@ -12,7 +12,7 @@ These changes knock off an extra ~10ms of tick duration with a sample of ~7,700
|
||||
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
index 58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a..ddd3a071dde9daeebc3d512dd8fd02594d2071fe 100644
|
||||
index 58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a..3da86dc56f33e4f1900f6b4f66ca6696eaf6525a 100644
|
||||
--- a/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
|
||||
@@ -31,6 +31,10 @@ public class CraftingManager extends ResourceDataJson {
|
||||
@ -20,7 +20,7 @@ index 58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a..ddd3a071dde9daeebc3d512dd8fd0259
|
||||
public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit
|
||||
private boolean d;
|
||||
+ // Yatopia start
|
||||
+ private static final List<IRecipe<?>> ALL_RECIPES_CACHE = new net.yatopia.server.list.GlueList<>();
|
||||
+ private static final List<IRecipe<?>> ALL_RECIPES_CACHE = new java.util.ArrayList<>();
|
||||
+ private static final Map<Recipes<?>, List<IRecipe<?>>> TYPES_CACHE = new Object2ObjectLinkedOpenHashMap<>();
|
||||
+ // Yatopia end
|
||||
|
||||
@ -44,7 +44,7 @@ index 58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a..ddd3a071dde9daeebc3d512dd8fd0259
|
||||
CraftingManager.LOGGER.info("Loaded {} recipes", map1.size());
|
||||
}
|
||||
|
||||
@@ -79,23 +91,44 @@ public class CraftingManager extends ResourceDataJson {
|
||||
@@ -79,33 +91,65 @@ public class CraftingManager extends ResourceDataJson {
|
||||
} else {
|
||||
map.putAndMoveToFirst(irecipe.getKey(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority
|
||||
}
|
||||
@ -84,20 +84,33 @@ index 58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a..ddd3a071dde9daeebc3d512dd8fd0259
|
||||
return irecipe;
|
||||
}).collect(Collectors.toList());
|
||||
+ */
|
||||
+ return (List) TYPES_CACHE.computeIfAbsent(recipes, recipes1 -> new net.yatopia.server.list.GlueList<>(getRecipesMap(recipes).values()));
|
||||
+ return (List) TYPES_CACHE.computeIfAbsent(recipes, recipes1 -> new me.jellysquid.mods.lithium.common.util.collections.HashedList<>(new java.util.ArrayList<>(getRecipesMap(recipes).values())));
|
||||
+ // Yatopia end
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> List<T> b(Recipes<T> recipes, C c0, World world) {
|
||||
@@ -106,6 +139,7 @@ public class CraftingManager extends ResourceDataJson {
|
||||
+ // Yatopia start - replace stream
|
||||
+ /*
|
||||
return (List) this.b(recipes).values().stream().flatMap((irecipe) -> {
|
||||
return SystemUtils.a(recipes.a(irecipe, world, c0));
|
||||
}).sorted(Comparator.comparing((irecipe) -> {
|
||||
return irecipe.getResult().j();
|
||||
})).collect(Collectors.toList());
|
||||
+ */
|
||||
+ List<T> ret = new java.util.ArrayList<>();
|
||||
+ for (IRecipe<C> recipe : this.b(recipes).values()) {
|
||||
+ recipes.a(recipe, world, c0).ifPresent(ret::add);
|
||||
+ }
|
||||
+ ret.sort(Comparator.comparing(recipe -> recipe.getResult().getTranslationKey()));
|
||||
+ return ret;
|
||||
+ // Yatopia end
|
||||
}
|
||||
|
||||
+ private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> getRecipesMap(Recipes<T> recipes) { return b(recipes); } // Yatopia - OBFHELPER
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> b(Recipes<T> recipes) {
|
||||
return (Map) this.recipes.getOrDefault(recipes, new Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit
|
||||
}
|
||||
@@ -127,15 +161,26 @@ public class CraftingManager extends ResourceDataJson {
|
||||
@@ -127,15 +171,26 @@ public class CraftingManager extends ResourceDataJson {
|
||||
}
|
||||
|
||||
public Optional<? extends IRecipe<?>> getRecipe(MinecraftKey minecraftkey) {
|
||||
@ -127,7 +140,7 @@ index 58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a..ddd3a071dde9daeebc3d512dd8fd0259
|
||||
}
|
||||
|
||||
public Stream<MinecraftKey> d() {
|
||||
@@ -155,6 +200,10 @@ public class CraftingManager extends ResourceDataJson {
|
||||
@@ -155,6 +210,10 @@ public class CraftingManager extends ResourceDataJson {
|
||||
// CraftBukkit start
|
||||
public void clearRecipes() {
|
||||
this.recipes = Maps.newHashMap();
|
||||
@ -138,3 +151,15 @@ index 58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a..ddd3a071dde9daeebc3d512dd8fd0259
|
||||
|
||||
for (Recipes<?> recipeType : IRegistry.RECIPE_TYPE) {
|
||||
this.recipes.put(recipeType, new Object2ObjectLinkedOpenHashMap<>());
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
index 3adb29f004d2fee36f3ee9b21ee5417e84b64837..376ab1d4c4f729639714b5eeedec514a2176531a 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
||||
@@ -570,6 +570,7 @@ public final class ItemStack {
|
||||
return !this.e() ? this.doMaterialsMatch(itemstack) : !itemstack.isEmpty() && this.getItem() == itemstack.getItem();
|
||||
}
|
||||
|
||||
+ public final String getTranslationKey() { return j(); } // Yatopia - OBFHELPER
|
||||
public String j() {
|
||||
return this.getItem().f(this);
|
||||
}
|
@ -5,14 +5,14 @@ Subject: [PATCH] PaperPR: Fix harming potion dupe
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemPotion.java b/src/main/java/net/minecraft/server/ItemPotion.java
|
||||
index 7862b63a245222d9a3d0896bdb2741b0e5e7ac40..47a6e8428f5a9dd19514ee0ad487bcb16dc34214 100644
|
||||
index 7862b63a245222d9a3d0896bdb2741b0e5e7ac40..04e48b195387410d9494ef87beba15e8d9e0419d 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemPotion.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemPotion.java
|
||||
@@ -22,6 +22,8 @@ public class ItemPotion extends Item {
|
||||
CriterionTriggers.z.a((EntityPlayer) entityhuman, itemstack);
|
||||
}
|
||||
|
||||
+ List<MobEffect> instantLater = new net.yatopia.server.list.GlueList<>(); // Yatopia
|
||||
+ List<MobEffect> instantLater = new java.util.ArrayList<>(); // Yatopia
|
||||
+
|
||||
if (!world.isClientSide) {
|
||||
List<MobEffect> list = PotionUtil.getEffects(itemstack);
|
@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mykyta Komarn <nkomarn@hotmail.com>
|
||||
Date: Thu, 1 Oct 2020 06:52:35 -0700
|
||||
Subject: [PATCH] Use Glue List as delegate for NonNullList
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NonNullList.java b/src/main/java/net/minecraft/server/NonNullList.java
|
||||
index 2d3c406a05b9710d40471aa61c3540dbc971c1e3..52b263fc257e5e8889aa8285331581b7d8142c44 100644
|
||||
--- a/src/main/java/net/minecraft/server/NonNullList.java
|
||||
+++ b/src/main/java/net/minecraft/server/NonNullList.java
|
||||
@@ -10,7 +10,7 @@ import org.apache.commons.lang3.Validate;
|
||||
|
||||
public class NonNullList<E> extends AbstractList<E> {
|
||||
|
||||
- private final List<E> a;
|
||||
+ private final net.yatopia.server.list.GlueList<E> a; // Yatopia
|
||||
private final E b;
|
||||
|
||||
public static <E> NonNullList<E> a() {
|
||||
@@ -22,7 +22,7 @@ public class NonNullList<E> extends AbstractList<E> {
|
||||
Object[] aobject = new Object[i];
|
||||
|
||||
Arrays.fill(aobject, e0);
|
||||
- return new NonNullList<>(Arrays.asList(aobject), e0);
|
||||
+ return new NonNullList<>((List<E>) Arrays.asList(aobject), e0); // Yatopia - decompile fix
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@@ -31,11 +31,18 @@ public class NonNullList<E> extends AbstractList<E> {
|
||||
}
|
||||
|
||||
protected NonNullList() {
|
||||
- this(Lists.newArrayList(), (Object) null);
|
||||
+ this(new net.yatopia.server.list.GlueList<>(), null); // Yatopia - decompile fix & GlueList
|
||||
}
|
||||
|
||||
protected NonNullList(List<E> list, @Nullable E e0) {
|
||||
- this.a = list;
|
||||
+ // Yatopia start
|
||||
+ if (!(list instanceof net.yatopia.server.list.GlueList)) {
|
||||
+ this.a = new net.yatopia.server.list.GlueList<>(list);
|
||||
+ } else {
|
||||
+ this.a = (net.yatopia.server.list.GlueList<E>) list;
|
||||
+ }
|
||||
+ //this.a = list;
|
||||
+ // Yatopia end
|
||||
this.b = e0;
|
||||
}
|
||||
|
@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Pekov <ivan@mrivanplays.com>
|
||||
Date: Thu, 8 Oct 2020 20:48:54 +0300
|
||||
Subject: [PATCH] Use GlueList for some list initialisations in packets
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
index 837056fdd8b8125bcfe39a1d49fa6e1797bba708..0197e67f43c015e528faf10970d4c9b70e721f5e 100644
|
||||
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
@@ -271,7 +271,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
if (extra == null || extra.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
- java.util.List<Packet> ret = new java.util.ArrayList<>(1 + extra.size());
|
||||
+ java.util.List<Packet> ret = new net.yatopia.server.list.GlueList<>(1 + extra.size()); // Yatopia
|
||||
buildExtraPackets0(extra, ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -324,7 +324,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
if (!hasExtraPackets) {
|
||||
this.packetQueue.add(new NetworkManager.QueuedPacket(packet, genericfuturelistener));
|
||||
} else {
|
||||
- java.util.List<NetworkManager.QueuedPacket> packets = new java.util.ArrayList<>(1 + extraPackets.size());
|
||||
+ java.util.List<NetworkManager.QueuedPacket> packets = new net.yatopia.server.list.GlueList<>(1 + extraPackets.size()); // Yatopia
|
||||
packets.add(new NetworkManager.QueuedPacket(packet, null)); // delay the future listener until the end of the extra packets
|
||||
|
||||
for (int i = 0, len = extraPackets.size(); i < len;) {
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
index 72fdbf1534b65284ac8020dcc15fe1512766d087..60ec969a805be277932057bc7685aeedd06ee4c1 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
|
||||
@@ -30,7 +30,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
|
||||
// Paper end
|
||||
|
||||
// Paper start
|
||||
- private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>();
|
||||
+ private final java.util.List<Packet> extraPackets = new net.yatopia.server.list.GlueList<>(); // Yatopia
|
||||
private static final int TE_LIMIT = Integer.getInteger("tuinity.excessive-te-limit", 750); // Tuinity - handle oversized chunk data packets more robustly
|
||||
private static final int TE_SPLIT_LIMIT = Math.max(4096 + 1, Integer.getInteger("tuinity.te-split-limit", 15_000)); // Tuinity - handle oversized chunk data packets more robustly
|
||||
private boolean mustSplit; // Tuinity - handle oversized chunk data packets more robustly
|
||||
@@ -55,7 +55,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
|
||||
Iterator iterator; // Tuinity - move declaration up
|
||||
Entry entry; // Tuinity - move delcaration up
|
||||
// Paper end
|
||||
- this.g = Lists.newArrayList();
|
||||
+ this.g = new net.yatopia.server.list.GlueList<>(); // Yatopia
|
||||
iterator = chunk.getTileEntities().entrySet().iterator();
|
||||
int totalTileEntities = 0; // Paper
|
||||
|
||||
@@ -158,7 +158,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
|
||||
packetdataserializer.readBytes(this.f);
|
||||
int j = packetdataserializer.i();
|
||||
|
||||
- this.g = Lists.newArrayList();
|
||||
+ this.g = new net.yatopia.server.list.GlueList<>(); // Yatopia
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
this.g.add(packetdataserializer.l());
|
@ -5,7 +5,7 @@ Subject: [PATCH] Configurable movement checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 9ee1490dd40592004c40f65bace476762801dafa..43256c5eacae604860e906b727f922a3d74aa7e0 100644
|
||||
index 9d896d0bd7feda493a3aecd7959c287cd84ecb7f..6d23b9ce8340439837c56ad13c2b5996e20fbc51 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -440,7 +440,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
305
patches/server/0064-Use-faster-random-implementation.patch
Normal file
305
patches/server/0064-Use-faster-random-implementation.patch
Normal file
@ -0,0 +1,305 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
Date: Fri, 27 Nov 2020 10:33:59 -0600
|
||||
Subject: [PATCH] Use faster random implementation
|
||||
|
||||
Replace usages of random in world and entity classes with FastRandom, an adapter for XoRoShiRo128PlusPlus. This nearly doubles random performance across the board.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||
index b5401eaf974857455c17c3f9cfdedf2eb4bde321..bcc01ea8a07deb3f437ebadd90d02e20e91889a0 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||
@@ -13,7 +13,7 @@ import java.util.UUID;
|
||||
|
||||
public class PaperLootableInventoryData {
|
||||
|
||||
- private static final Random RANDOM = new Random();
|
||||
+ private static final Random RANDOM = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
|
||||
private long lastFill = -1;
|
||||
private long nextRefill = -1;
|
||||
diff --git a/src/main/java/net/minecraft/server/CommandSpreadPlayers.java b/src/main/java/net/minecraft/server/CommandSpreadPlayers.java
|
||||
index c9f4b69874e693c8e5c3346f09db7b5014dcfb63..b5047b0b6de4c737f52dcb4d109c610d8451260d 100644
|
||||
--- a/src/main/java/net/minecraft/server/CommandSpreadPlayers.java
|
||||
+++ b/src/main/java/net/minecraft/server/CommandSpreadPlayers.java
|
||||
@@ -37,7 +37,7 @@ public class CommandSpreadPlayers {
|
||||
}
|
||||
|
||||
private static int a(CommandListenerWrapper commandlistenerwrapper, Vec2F vec2f, float f, float f1, int i, boolean flag, Collection<? extends Entity> collection) throws CommandSyntaxException {
|
||||
- Random random = new Random();
|
||||
+ Random random = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
double d0 = (double) (vec2f.i - f1);
|
||||
double d1 = (double) (vec2f.j - f1);
|
||||
double d2 = (double) (vec2f.i + f1);
|
||||
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
|
||||
index 73bff2ca1f09cf6f33479f175cae72e456e8db4b..a481a2f05b701c85cf863cd3dadc22c31403942d 100644
|
||||
--- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
|
||||
@@ -52,7 +52,7 @@ public class ContainerEnchantTable extends Container {
|
||||
}
|
||||
// CraftBukkit end
|
||||
};
|
||||
- this.h = new Random();
|
||||
+ this.h = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
this.i = ContainerProperty.a();
|
||||
this.costs = new int[3];
|
||||
this.enchantments = new int[]{-1, -1, -1};
|
||||
diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
index 38dc6086d18951e065d4048d1d8eee288c5c5fd1..08c83c8a226b6b38250aba2fab86d4685228797b 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
@@ -73,7 +73,7 @@ public class EnderDragonBattle {
|
||||
}
|
||||
} else {
|
||||
this.gateways.addAll(ContiguousSet.create(Range.closedOpen(0, 20), DiscreteDomain.integers()));
|
||||
- Collections.shuffle(this.gateways, new Random(i));
|
||||
+ Collections.shuffle(this.gateways, new net.yatopia.server.util.FastRandom(i)); // Yatopia - fast random
|
||||
}
|
||||
|
||||
this.f = ShapeDetectorBuilder.a().a(" ", " ", " ", " # ", " ", " ", " ").a(" ", " ", " ", " # ", " ", " ", " ").a(" ", " ", " ", " # ", " ", " ", " ").a(" ### ", " # # ", "# #", "# # #", "# #", " # # ", " ### ").a(" ", " ### ", " ##### ", " ##### ", " ##### ", " ### ", " ").a('#', ShapeDetectorBlock.a(BlockPredicate.a(Blocks.BEDROCK))).b();
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 094b4be4ef0e7c47696575158d3d0208542576ca..3b3081d1135ae52cbb12f9473a99f3a2d6526ecf 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -61,7 +61,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
|
||||
// Paper start
|
||||
boolean isQueuedForRegister = false;
|
||||
- public static Random SHARED_RANDOM = new Random() {
|
||||
+ public static Random SHARED_RANDOM = new net.yatopia.server.util.FastRandom() { //Yatopia Faster Random
|
||||
private boolean locked = false;
|
||||
@Override
|
||||
public synchronized void setSeed(long seed) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
index 6891e61bcfea82958e100abaef94865bf36a32c2..37172d3def389f3510e05b8e63e94b5ec045e3c5 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -38,7 +38,7 @@ public class EntityFishingHook extends IProjectile {
|
||||
|
||||
private EntityFishingHook(World world, EntityHuman entityhuman, int i, int j) {
|
||||
super(EntityTypes.FISHING_BOBBER, world);
|
||||
- this.b = new Random();
|
||||
+ this.b = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
this.ak = true;
|
||||
this.am = EntityFishingHook.HookState.FLYING;
|
||||
this.Y = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 151c1eb0be3099a0512caadeedc1354bb07db5c7..436055024ed498613a32e555a2201d2bad40df4c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -186,7 +186,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
long l = k * k;
|
||||
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
|
||||
int j1 = this.u(i1);
|
||||
- int k1 = (new Random()).nextInt(i1);
|
||||
+ int k1 = worldserver.random.nextInt(i1); // Yatopia - don't create new random instance
|
||||
|
||||
for (int l1 = 0; l1 < i1; ++l1) {
|
||||
int i2 = (k1 + j1 * l1) % i1;
|
||||
@@ -224,7 +224,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
long l = k * k;
|
||||
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
|
||||
int j1 = this.u(i1);
|
||||
- int k1 = (new Random()).nextInt(i1);
|
||||
+ int k1 = worldserver.random.nextInt(i1); // Yatopia - don't create new random instance
|
||||
|
||||
for (int l1 = 0; l1 < i1; ++l1) {
|
||||
int i2 = (k1 + j1 * l1) % i1;
|
||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||
index fe513a9470a0c474ca436ede4a5a7da476cf6c8d..8c2381f8108a28aa2a627e5356439050c3983fb8 100644
|
||||
--- a/src/main/java/net/minecraft/server/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
||||
@@ -27,7 +27,7 @@ public class Explosion {
|
||||
private static final ExplosionDamageCalculator a = new ExplosionDamageCalculator();
|
||||
private final boolean b;
|
||||
private final Explosion.Effect c;
|
||||
- private final Random d = new Random();
|
||||
+ private final Random d = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
private final World world;
|
||||
private final double posX;
|
||||
private final double posY;
|
||||
diff --git a/src/main/java/net/minecraft/server/Item.java b/src/main/java/net/minecraft/server/Item.java
|
||||
index c3b57e8d572d13ec74d6df5544072cdc55756690..6b15fc26f3ce629666efd4b46c2d62b29a62c263 100644
|
||||
--- a/src/main/java/net/minecraft/server/Item.java
|
||||
+++ b/src/main/java/net/minecraft/server/Item.java
|
||||
@@ -13,7 +13,7 @@ public class Item implements IMaterial {
|
||||
public static final Map<Block, Item> e = Maps.newHashMap();
|
||||
protected static final UUID f = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
protected static final UUID g = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3");
|
||||
- protected static final Random RANDOM = new Random();
|
||||
+ protected static final Random RANDOM = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
protected final CreativeModeTab i;
|
||||
private final EnumItemRarity a;
|
||||
private final int maxStackSize;
|
||||
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
index 9190caed195b9987e3af545f4de63b8d956788a6..00e9ebe7ce698f523e08d5ed6e48e41fe3bfe85d 100644
|
||||
--- a/src/main/java/net/minecraft/server/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/LoginListener.java
|
||||
@@ -32,7 +32,7 @@ public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
private static final AtomicInteger b = new AtomicInteger(0);
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
- private static final Random random = new Random();
|
||||
+ private static final Random random = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
private final byte[] e = new byte[4];
|
||||
private final MinecraftServer server;
|
||||
public final NetworkManager networkManager;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 94c20ad7fb8872f763953e0991a72a075700a024..a28bca93e1ebb2b2427947aebd53b6cdcc5f7806 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -196,7 +196,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ai);
|
||||
this.methodProfiler = GameProfilerDisabled.a;
|
||||
this.serverPing = new ServerPing();
|
||||
- this.r = new Random();
|
||||
+ this.r = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
this.serverPort = -1;
|
||||
this.worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
|
||||
this.isRunning = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/MobSpawnerTrader.java b/src/main/java/net/minecraft/server/MobSpawnerTrader.java
|
||||
index 8d89f51182444852062d549d23c00a93e601eb38..b207839f4d8ff00252187083e787526b6eba08e2 100644
|
||||
--- a/src/main/java/net/minecraft/server/MobSpawnerTrader.java
|
||||
+++ b/src/main/java/net/minecraft/server/MobSpawnerTrader.java
|
||||
@@ -7,7 +7,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class MobSpawnerTrader implements MobSpawner {
|
||||
|
||||
- private final Random a = new Random();
|
||||
+ private final Random a = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
private final IWorldDataServer b;
|
||||
private int c; public final int getMinuteTimer() { return this.c; } public final void setMinuteTimer(int x) { this.c = x; } // Paper - OBFHELPER
|
||||
private int d; public final int getDayTimer() { return this.d; } public final void setDayTimer(int x) { this.d = x; } // Paper - OBFHELPER
|
||||
diff --git a/src/main/java/net/minecraft/server/PiglinAI.java b/src/main/java/net/minecraft/server/PiglinAI.java
|
||||
index 0407fa1751d89a037da8cb01f5ceef9b9833dd18..09a5ea308a8d0dc3c8a38fce115e62d9b2e0b8aa 100644
|
||||
--- a/src/main/java/net/minecraft/server/PiglinAI.java
|
||||
+++ b/src/main/java/net/minecraft/server/PiglinAI.java
|
||||
@@ -273,7 +273,7 @@ public class PiglinAI {
|
||||
}
|
||||
|
||||
private static boolean a(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
- return entityliving1.getEntityType() != EntityTypes.HOGLIN ? false : (new Random(entityliving.world.getTime())).nextFloat() < 0.1F;
|
||||
+ return entityliving1.getEntityType() != EntityTypes.HOGLIN ? false : (new net.yatopia.server.util.FastRandom(entityliving.world.getTime())).nextFloat() < 0.1F; // Yatopia - fast random
|
||||
}
|
||||
|
||||
protected static boolean a(EntityPiglin entitypiglin, ItemStack itemstack) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Raid.java b/src/main/java/net/minecraft/server/Raid.java
|
||||
index 11f768e04d71b96350fdb586a280c52e062dfcf2..71e64250214b27c215d30d6c6d5fe51b7a7c43a1 100644
|
||||
--- a/src/main/java/net/minecraft/server/Raid.java
|
||||
+++ b/src/main/java/net/minecraft/server/Raid.java
|
||||
@@ -47,7 +47,7 @@ public class Raid {
|
||||
|
||||
public Raid(int i, WorldServer worldserver, BlockPosition blockposition) {
|
||||
this.bossBattle = new BossBattleServer(Raid.a, BossBattle.BarColor.RED, BossBattle.BarStyle.NOTCHED_10);
|
||||
- this.random = new Random();
|
||||
+ this.random = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
this.y = Optional.empty();
|
||||
this.id = i;
|
||||
this.world = worldserver;
|
||||
@@ -61,7 +61,7 @@ public class Raid {
|
||||
|
||||
public Raid(WorldServer worldserver, NBTTagCompound nbttagcompound) {
|
||||
this.bossBattle = new BossBattleServer(Raid.a, BossBattle.BarColor.RED, BossBattle.BarStyle.NOTCHED_10);
|
||||
- this.random = new Random();
|
||||
+ this.random = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
this.y = Optional.empty();
|
||||
this.world = worldserver;
|
||||
this.id = nbttagcompound.getInt("Id");
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
|
||||
index 6ea4bc31151bce2bdd3376a889029c4b999befac..bcd36fd3ad56897eb9968a96cb8cf3b0c1f93e8d 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
|
||||
@@ -10,7 +10,7 @@ import org.bukkit.entity.HumanEntity;
|
||||
|
||||
public class TileEntityDispenser extends TileEntityLootable {
|
||||
|
||||
- private static final Random a = new Random();
|
||||
+ private static final Random a = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
private NonNullList<ItemStack> items;
|
||||
|
||||
// CraftBukkit start - add fields and methods
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityEnchantTable.java b/src/main/java/net/minecraft/server/TileEntityEnchantTable.java
|
||||
index 9b0c75332d9815657d96183e51e40cf14ee3ed75..de597d053fcdb983b9b08f0628e4708e6149ffab 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityEnchantTable.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityEnchantTable.java
|
||||
@@ -15,7 +15,7 @@ public class TileEntityEnchantTable extends TileEntity implements INamableTileEn
|
||||
public float k;
|
||||
public float l;
|
||||
public float m;
|
||||
- private static final Random n = new Random();
|
||||
+ private static final Random n = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
private IChatBaseComponent o;
|
||||
|
||||
public TileEntityEnchantTable() {
|
||||
diff --git a/src/main/java/net/minecraft/server/WeightedList.java b/src/main/java/net/minecraft/server/WeightedList.java
|
||||
index f0fdfd6891e59891e7370a2d682b65c647b28e9e..964f7a4cda578c2d91d8150217da2fe0aabd6197 100644
|
||||
--- a/src/main/java/net/minecraft/server/WeightedList.java
|
||||
+++ b/src/main/java/net/minecraft/server/WeightedList.java
|
||||
@@ -28,7 +28,7 @@ public class WeightedList<U> {
|
||||
private WeightedList(List<WeightedList.a<U>> list, boolean isUnsafe) {
|
||||
this.isUnsafe = isUnsafe;
|
||||
// Paper end
|
||||
- this.b = new Random();
|
||||
+ this.b = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
this.list = Lists.newArrayList(list); // Paper - decompile conflict
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index de7ca87e74084c5cca109a6eff071da351dec91b..7431bfc335dadfb5f5f83ccba6d8923c15756dc1 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -48,13 +48,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
public final Thread serverThread;
|
||||
private final boolean debugWorld;
|
||||
private int d;
|
||||
- protected int n = (new Random()).nextInt();
|
||||
+ protected int n = (new net.yatopia.server.util.FastRandom()).nextInt(); // Yatopia - wtf ? why doesn't this use the already initiated random!?
|
||||
protected final int o = 1013904223;
|
||||
protected float lastRainLevel;
|
||||
protected float rainLevel;
|
||||
protected float lastThunderLevel;
|
||||
protected float thunderLevel;
|
||||
- public final Random random = new Random();
|
||||
+ public final Random random = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
private final DimensionManager x;
|
||||
public final WorldDataMutable worldData;
|
||||
private final Supplier<GameProfilerFiller> methodProfiler;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 2028db6da469fc3c086842302d782bb081ed39f9..f2c6c7192dc567fc17c4804d439e82a141122004 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -334,7 +334,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
- private static final Random rand = new Random();
|
||||
+ private static final Random rand = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
|
||||
public CraftWorld(WorldServer world, ChunkGenerator gen, Environment env) {
|
||||
this.world = world;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
index f3066e6c781bcee72c235abcef5060fb080892d5..defeba5372bbd870e82d436c4bff8de1c0c7a0c5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
@@ -13,7 +13,7 @@ import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
public class CraftFirework extends CraftProjectile implements Firework {
|
||||
|
||||
- private final Random random = new Random();
|
||||
+ private final Random random = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
private final CraftItemStack item;
|
||||
|
||||
public CraftFirework(CraftServer server, EntityFireworks entity) {
|
||||
diff --git a/src/test/java/org/bukkit/NibbleArrayTest.java b/src/test/java/org/bukkit/NibbleArrayTest.java
|
||||
index 40ba97fb77dddafe7c792249ca343d5abee3e5d0..86f9b00dd860c62fc783dbee0857854c22a1d06a 100644
|
||||
--- a/src/test/java/org/bukkit/NibbleArrayTest.java
|
||||
+++ b/src/test/java/org/bukkit/NibbleArrayTest.java
|
||||
@@ -11,7 +11,7 @@ public class NibbleArrayTest {
|
||||
|
||||
@Test
|
||||
public void testNibble() {
|
||||
- Random random = new Random();
|
||||
+ Random random = new net.yatopia.server.util.FastRandom(); //Yatopia Faster Random
|
||||
byte[] classic = new byte[NIBBLE_SIZE];
|
||||
NibbleArray nibble = new NibbleArray();
|
||||
|
109
patches/server/0065-Tile-Entity-optimizations.patch
Normal file
109
patches/server/0065-Tile-Entity-optimizations.patch
Normal file
@ -0,0 +1,109 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
Date: Fri, 30 Oct 2020 20:13:08 -0700
|
||||
Subject: [PATCH] Tile Entity optimizations
|
||||
|
||||
This patch includes various tile entity optimizations. Normally, these aren't going to improve performance much, but can be useful if you have loads of tile entities or they are being used as building blocks.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityBeehive.java b/src/main/java/net/minecraft/server/TileEntityBeehive.java
|
||||
index a60e0872d51aeb330bd5334e35f18ad0ed63834e..40bde90306106534e73d6845caf956514e5dcf88 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityBeehive.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityBeehive.java
|
||||
@@ -286,6 +286,7 @@ public class TileEntityBeehive extends TileEntity implements ITickable {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ if (this.bees.size() == 0) return; // Yatopia - TE optimizations
|
||||
if (!this.world.isClientSide) {
|
||||
this.y();
|
||||
BlockPosition blockposition = this.getPosition();
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityEnchantTable.java b/src/main/java/net/minecraft/server/TileEntityEnchantTable.java
|
||||
index de597d053fcdb983b9b08f0628e4708e6149ffab..2400860b70cec7e1c875c0c6abd589f67b8f8146 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityEnchantTable.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityEnchantTable.java
|
||||
@@ -43,6 +43,7 @@ public class TileEntityEnchantTable extends TileEntity implements INamableTileEn
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
+ if (!net.yatopia.server.YatopiaConfig.shouldTickEnchantingTables) { return; } // Yatopia - TE optimizations
|
||||
this.j = this.i;
|
||||
this.l = this.k;
|
||||
EntityHuman entityhuman = this.world.a((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D, 3.0D, false);
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 7431bfc335dadfb5f5f83ccba6d8923c15756dc1..1f7449175329adae4bfc8eacb58b22830720a8b4 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -917,13 +917,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
if (!tileentity.isRemoved() && tileentity.hasWorld()) {
|
||||
BlockPosition blockposition = tileentity.getPosition();
|
||||
|
||||
- if (this.getChunkProvider().a(blockposition) && this.getWorldBorder().a(blockposition)) {
|
||||
+ // Yatopia start - TE optimizations
|
||||
+ Chunk chunk = tileentity.getCurrentChunk();
|
||||
+ PlayerChunk playerchunk = chunk == null ? null : chunk.playerChunk;
|
||||
+ if (playerchunk == null) continue;
|
||||
+ if (playerchunk.isTickingReady() && this.getWorldBorder().a(blockposition)) {
|
||||
try {
|
||||
gameprofilerfiller.a(() -> {
|
||||
return String.valueOf(TileEntityTypes.a(tileentity.getTileType()));
|
||||
});
|
||||
tileentity.tickTimer.startTiming(); // Spigot
|
||||
- if (tileentity.getTileType().isValidBlock(this.getType(blockposition).getBlock())) {
|
||||
+ if (tileentity.getTileType().isValidBlock(chunk.getType(blockposition).getBlock())) {
|
||||
+ // Yatopia end
|
||||
((ITickable) tileentity).tick();
|
||||
} else {
|
||||
tileentity.w();
|
||||
@@ -957,9 +962,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
this.tileEntityListTick.remove(tileTickPosition--);
|
||||
// Spigot end
|
||||
//this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
- if (this.isLoaded(tileentity.getPosition())) {
|
||||
- this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition());
|
||||
- }
|
||||
+ // Yatopia start - TE optimizations
|
||||
+ Chunk chunk = tileentity.getCurrentChunk();
|
||||
+ if (chunk == null) continue;
|
||||
+ // if (this.isLoaded(tileentity.getPosition())) {
|
||||
+ chunk.removeTileEntity(tileentity.getPosition());
|
||||
+ // } // Yatopia end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -978,8 +986,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
}
|
||||
// CraftBukkit end */
|
||||
|
||||
- if (this.isLoaded(tileentity1.getPosition())) {
|
||||
- Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
||||
+ // Yatopia start - TE optimizations
|
||||
+ Chunk chunk = tileentity1.getCurrentChunk();
|
||||
+ if (chunk == null) continue;
|
||||
+ // if (this.isLoaded(tileentity1.getPosition())) {
|
||||
+ // Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
||||
IBlockData iblockdata = chunk.getType(tileentity1.getPosition());
|
||||
|
||||
chunk.setTileEntity(tileentity1.getPosition(), tileentity1);
|
||||
@@ -990,7 +1001,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
this.a(tileentity1);
|
||||
}
|
||||
// CraftBukkit end
|
||||
- }
|
||||
+ // } // Yatopia end
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/yatopia/server/YatopiaConfig.java b/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
index 5139279822b1fdc4a60de5abc76e81c75fe2e6bb..d33dd43747afc17dd80472c87e99b5cb409b40e9 100644
|
||||
--- a/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
+++ b/src/main/java/net/yatopia/server/YatopiaConfig.java
|
||||
@@ -283,4 +283,9 @@ public class YatopiaConfig {
|
||||
checkVehicleMovedQuickly = getBoolean("settings.checks.vehicle-moved-quickly", checkVehicleMovedQuickly);
|
||||
checkVehicleMovedWrongly = getBoolean("settings.checks.vehicle-moved-wrongly", checkVehicleMovedWrongly);
|
||||
}
|
||||
+
|
||||
+ public static boolean shouldTickEnchantingTables = false;
|
||||
+ private static void tickEnchantingTables() {
|
||||
+ shouldTickEnchantingTables = getBoolean("settings.tick.enchanting-tables", shouldTickEnchantingTables);
|
||||
+ }
|
||||
}
|
@ -12,6 +12,7 @@ akarin=$(changeLog Akarin)
|
||||
empirecraft=$(changeLog Empirecraft)
|
||||
origami=$(changeLog Origami)
|
||||
purpur=$(changeLog Purpur)
|
||||
airplaneL=$(changeLog AirplaneLite)
|
||||
|
||||
updated=""
|
||||
logsuffix=""
|
||||
@ -35,6 +36,10 @@ if [ ! -z "$purpur" ]; then
|
||||
logsuffix="$logsuffix\n\nPurpur Changes:\n$purpur"
|
||||
if [ -z "$updated" ]; then updated="Purpur"; else updated="$updated/Purpur"; fi
|
||||
fi
|
||||
if [ ! -z "$airplaneL" ]; then
|
||||
logsuffix="$logsuffix\n\nAirplaneLite Changes:\n$airplaneL"
|
||||
if [ -z "$updated" ]; then updated="AirplaneLite"; else updated="$updated/AirplaneLite"; fi
|
||||
fi
|
||||
disclaimer="Upstream/An Sidestream has released updates that appears to apply and compile correctly\nThis update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing."
|
||||
|
||||
if [ ! -z "$1" ]; then
|
||||
|
@ -14,6 +14,7 @@ function update {
|
||||
}
|
||||
|
||||
function updateAll {
|
||||
update AirplaneLite master
|
||||
update Akarin 1.16.3
|
||||
update Empirecraft master
|
||||
update Origami 1.16
|
||||
|
Loading…
Reference in New Issue
Block a user