Add more permanent getLastTick time API

Also fix bad plugins that touch NMS not working
This commit is contained in:
Ivan Pekov 2020-09-27 19:05:16 +03:00
parent a5753ad102
commit c4a1166224
No known key found for this signature in database
GPG Key ID: BC975C392D9CA3A3
14 changed files with 204 additions and 141 deletions

View File

@ -14,8 +14,8 @@ # Patches
| server | Add GameProfileLookupEvent | tr7zw | |
| api | Add NBT API as a first-class lib | tr7zw | |
| server | Add NBT API as a first-class lib | tr7zw | |
| api | Add getLastTickMs api | tr7zw | |
| server | Add getLastTickMs api | tr7zw | |
| api | Add last tick time API | Ivan Pekov | |
| server | Add last tick time API | Ivan Pekov | |
| server | Add no-tick block list | William Blake Galbreath | |
| server | Add option to disable dolphin treasure searching | William Blake Galbreath | |
| server | Add option to disable observer clocks | Phoenix616 | |
@ -128,7 +128,7 @@ # Patches
| server | lithium MixinDirection | JellySquid | |
| server | lithium MixinGoalSelector | JellySquid | |
| server | lithium MixinLandPathNodeMaker | JellySquid | |
| server | lithium NoiseChunkGeneratorMixin | JellySquid | |
| server | lithium NoiseChunkGeneratorMixin | SuperCoder79 | |
| server | lithium PerlinNoiseSamplerMixin | JellySquid | |
| server | lithium VoronoiBiomeAccessTypeMixin | JellySquid | |
| server | lithium VoxelShapesMixin | JellySquid | Ivan Pekov |

View File

@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Sat, 1 Aug 2020 15:54:43 -0500
Subject: [PATCH] Add getLastTickMs api
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 8d172d58b7c935f608ac49d3376d5b90bdf0abdd..808574e7d40346fd0b923b14b534730cbfd10aae 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1798,4 +1798,10 @@ public final class Bukkit {
return server.isLagging();
}
// Purpur end
+
+ // Yatopia start
+ public static long getLastTickMs() {
+ return server.getLastTickMs();
+ }
+ // Yatopia end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index d92d19a689c5dd928095c082a7c96680e97c6e6a..6783cb1650dae96b61de2a0e9b90854d0b05ad0a 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1625,4 +1625,13 @@ public interface Server extends PluginMessageRecipient {
*/
boolean isLagging();
// Purpur end
+
+ // Yatopia start
+ /**
+ * Get the ms the last servertick took
+ *
+ * @return Last ticks ms
+ */
+ long getLastTickMs();
+ // Yatopia end
}

View File

@ -0,0 +1,53 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Sun, 27 Sep 2020 18:01:50 +0300
Subject: [PATCH] Add last tick time API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 8d172d58b7c935f608ac49d3376d5b90bdf0abdd..0db3be3d2909c429ad37aa732ec6c0420b384376 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1798,4 +1798,14 @@ public final class Bukkit {
return server.isLagging();
}
// Purpur end
+
+ // Yatopia start
+ @Deprecated
+ public static long getLastTickMs() {
+ return server.getLastTickMs();
+ }
+ public static java.time.Duration getLastTickTime() {
+ return server.getLastTickTime();
+ }
+ // Yatopia end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index d92d19a689c5dd928095c082a7c96680e97c6e6a..f51125bde1d315569c974ddd52a83447f97fc695 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1625,4 +1625,23 @@ public interface Server extends PluginMessageRecipient {
*/
boolean isLagging();
// Purpur end
+
+ // Yatopia start
+ /**
+ * Returns the time the last tick took in milliseconds.
+ *
+ * @return long time value
+ * @deprecated newer method with java's Duration and a possibility to convert it from millis to something else
+ */
+ @Deprecated
+ default long getLastTickMs() {
+ return getLastTickTime().toMillis();
+ }
+ /**
+ * Returns the time in {@link java.time.Duration} the last tick took.
+ *
+ * @return duration
+ */
+ java.time.Duration getLastTickTime();
+ // Yatopia end
}

View File

@ -1,71 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Fri, 31 Jul 2020 21:19:26 -0500
Subject: [PATCH] Add getLastTickMs api
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 323d489b1e690500986bc0cbb4c2c93cc193bf70..5274dcde8b06200357b11b77cc72ec415d4e47e4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -928,6 +928,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper End
// Spigot End
+ public static long lastTickMs = 0; // Yatopia
+
protected void w() {
try {
long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper
@@ -996,7 +998,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(gameprofilertick);
//this.methodProfiler.a(); // Akarin - remove caller
//this.methodProfiler.enter("tick"); // Akarin - remove caller
+ long tickStart = System.currentTimeMillis(); // Yatopia
this.a(this::canSleepForTick);
+ lastTickMs = System.currentTimeMillis() - tickStart; // Yatopia
//this.methodProfiler.exitEnter("nextTickWait"); // Akarin - remove caller
this.X = true;
// Purpur start - tps catchup
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 42628d6dbf54977d34442f46c89b771af3af5b11..c80d47409fe02bc261d2dbb0569cdec979939655 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2420,4 +2420,11 @@ public final class CraftServer implements Server {
return getServer().lagging;
}
// Purpur end
+
+ // Yatopia start
+ @Override
+ public long getLastTickMs() {
+ return net.minecraft.server.MinecraftServer.lastTickMs;
+ }
+ // Yatopia end
}
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..76cf2353754821361a4541c21fc8d5f1a670b0de 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -33,7 +33,7 @@ public class TicksPerSecondCommand extends Command
for ( int i = 0; i < tps.length; i++) {
tpsAvg[i] = format( tps[i] );
}
- sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Purpur
+ sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ") + ChatColor.GOLD + " Last tick time: " + format( org.bukkit.Bukkit.getLastTickMs() )); // Purpur // Yatopia
if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) {
sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)");
if (!hasShownMemoryWarning) {
@@ -52,4 +52,12 @@ public class TicksPerSecondCommand extends Command
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
+ ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
}
+
+ // Yatopia start
+ public static String format(long ms)
+ {
+ ChatColor startingColor = ms < 40 ? ChatColor.GREEN : ( ms < 50 ) ? ChatColor.YELLOW : ChatColor.RED;
+ return startingColor.toString() + ms + ChatColor.GOLD + "ms";
+ }
+ // Yatopia end
}

View File

@ -0,0 +1,104 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Sun, 27 Sep 2020 18:30:10 +0300
Subject: [PATCH] Add last tick time API
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 323d489b1e690500986bc0cbb4c2c93cc193bf70..54e54cf4ed710923cc93d4ba77c378547761c8a1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -928,6 +928,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper End
// Spigot End
+ public static java.time.Duration lastTickTime = java.time.Duration.ZERO; // Yatopia
+
protected void w() {
try {
long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper
@@ -996,7 +998,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.a(gameprofilertick);
//this.methodProfiler.a(); // Akarin - remove caller
//this.methodProfiler.enter("tick"); // Akarin - remove caller
+ long tickStart = System.nanoTime(); // Yatopia
this.a(this::canSleepForTick);
+ lastTickTime = java.time.Duration.ofNanos(System.nanoTime() - tickStart); // Yatopia
//this.methodProfiler.exitEnter("nextTickWait"); // Akarin - remove caller
this.X = true;
// Purpur start - tps catchup
diff --git a/src/main/java/net/yatopia/server/TimeUtils.java b/src/main/java/net/yatopia/server/TimeUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..e4a18248cc6f872a9335eb70c12f7aa90b64d7a6
--- /dev/null
+++ b/src/main/java/net/yatopia/server/TimeUtils.java
@@ -0,0 +1,27 @@
+package net.yatopia.server;
+
+import java.util.concurrent.TimeUnit;
+
+public class TimeUtils {
+
+ public static String getFriendlyName(TimeUnit unit) {
+ switch (unit) {
+ case NANOSECONDS:
+ return "ns";
+ case MILLISECONDS:
+ return "ms";
+ case MICROSECONDS:
+ return "micros";
+ case SECONDS:
+ return "s";
+ case MINUTES:
+ return "m";
+ case DAYS:
+ return "d";
+ case HOURS:
+ return "h";
+ default:
+ throw new AssertionError();
+ }
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 42628d6dbf54977d34442f46c89b771af3af5b11..4bae0e82bc25b576a23b5f05af7c3ad944a54bcf 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2420,4 +2420,6 @@ public final class CraftServer implements Server {
return getServer().lagging;
}
// Purpur end
+
+ @Override public java.time.Duration getLastTickTime() { return net.minecraft.server.MinecraftServer.lastTickTime; } // Yatopia
}
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..ad0e9112d8cfffea8ed7034e74ccb11a690a03a3 100644
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
@@ -34,6 +34,11 @@ public class TicksPerSecondCommand extends Command
tpsAvg[i] = format( tps[i] );
}
sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Purpur
+ // Yatopia start
+ java.time.Duration lastTickTime = org.bukkit.Bukkit.getLastTickTime();
+ sender.sendMessage( ChatColor.GOLD + "Last tick ms: " + formatTo( lastTickTime, java.util.concurrent.TimeUnit.MILLISECONDS ) );
+ sender.sendMessage( ChatColor.GOLD + "Last tick ns: " + formatTo( lastTickTime, java.util.concurrent.TimeUnit.NANOSECONDS ) );
+ // Yatopia end
if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) {
sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)");
if (!hasShownMemoryWarning) {
@@ -52,4 +57,14 @@ public class TicksPerSecondCommand extends Command
return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString()
+ ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // Paper - only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise
}
+
+ // Yatopia start
+ public static String formatTo(java.time.Duration duration, java.util.concurrent.TimeUnit unit)
+ {
+ long toAskedUnit = unit.convert( duration.toNanos(), java.util.concurrent.TimeUnit.NANOSECONDS );
+ long ms = java.util.concurrent.TimeUnit.NANOSECONDS.toMillis( toAskedUnit );
+ ChatColor startingColor = ms < 40 ? ChatColor.GREEN : ( ms < 50 ) ? ChatColor.YELLOW : ChatColor.RED;
+ return startingColor.toString() + toAskedUnit + ChatColor.GOLD + net.yatopia.server.TimeUtils.getFriendlyName( unit );
+ }
+ // Yatopia end
}

View File

@ -278,7 +278,7 @@ index 0000000000000000000000000000000000000000..c4dd521d18dd60ec07bdcf0d367b5135
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c80d47409fe02bc261d2dbb0569cdec979939655..fd8ffcc962d0391262d9f8b08f6ea2f84d65851a 100644
index 4bae0e82bc25b576a23b5f05af7c3ad944a54bcf..78d7fc805a1aeb0d31e51a5aa68e92d9ffd7ba73 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -845,6 +845,7 @@ public final class CraftServer implements Server {

View File

@ -697,7 +697,7 @@ index 0000000000000000000000000000000000000000..1ec2b7a9e0062ed4d45786167bd6c71b
+}
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/WorldHelper.java b/src/main/java/me/jellysquid/mods/lithium/common/world/WorldHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..700d391675286cf736be8bc42366118147c5fd60
index 0000000000000000000000000000000000000000..f858e5dcda60391fe869264f0c4a20bb14159e82
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/WorldHelper.java
@@ -0,0 +1,59 @@
@ -744,7 +744,7 @@ index 0000000000000000000000000000000000000000..700d391675286cf736be8bc423661181
+ * [VanillaCopy] but custom combination of: get class filtered entities together with excluding one entity
+ */
+ public static void getEntitiesOfClassGroup(Chunk worldChunk, Entity excluded, EntityClassGroup type, AxisAlignedBB box_1, List<Entity> list_1) {
+ EntitySlice<Entity>[] entitySections = worldChunk.getEntitySlices();
+ EntitySlice<Entity>[] entitySections = worldChunk.getAsSlices();
+ int int_1 = MathHelper.floor((box_1.minY - 2.0D) / 16.0D);
+ int int_2 = MathHelper.floor((box_1.maxY + 2.0D) / 16.0D);
+ int_1 = MathHelper.clamp(int_1, 0, entitySections.length - 1);
@ -775,7 +775,7 @@ index 0000000000000000000000000000000000000000..493103d755c222f2c6031ffb8f5c0b7a
+ Collection<T> getAllOfGroupType(EntityClassGroup type);
+}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index ac6e5e3309affc830d4db07fd9b8d809c3085033..37a3b26cdeb02acb8051f0a99313de7923ebae3b 100644
index ac6e5e3309affc830d4db07fd9b8d809c3085033..b7fcbef8d38c9406a891d64f8016bc16572f00d9 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -36,7 +36,7 @@ public class Chunk implements IChunkAccess {
@ -833,15 +833,24 @@ index ac6e5e3309affc830d4db07fd9b8d809c3085033..37a3b26cdeb02acb8051f0a99313de79
if (entity1.shouldBeRemoved) continue; // Paper
if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) {
@@ -1066,7 +1066,7 @@ public class Chunk implements IChunkAccess {
return this.tileEntities;
@@ -1067,8 +1067,16 @@ public class Chunk implements IChunkAccess {
}
- public List<Entity>[] getEntitySlices() { // Spigot
+ public EntitySlice<Entity>[] getEntitySlices() { // Spigot // Yatopia - md_5 is stupid
return this.entitySlices;
public List<Entity>[] getEntitySlices() { // Spigot
- return this.entitySlices;
+ // Yatopia start
+ List<Entity>[] ret = new List[entitySlices.length];
+ for (int i = 0, len = entitySlices.length; i < len; i++) {
+ EntitySlice<Entity> slice = entitySlices[i];
+ ret[i] = slice.toList();
+ }
+ return ret;
}
+ public EntitySlice<Entity>[] getAsSlices() { return entitySlices; }
+ // Yatopia end
@Override
public NBTTagCompound i(BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index decad96e5affe07078624c2ef95dd1f5e79601b2..228c17966e51b726768ef7bb6d15e00aa1599b3f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
@ -856,7 +865,7 @@ index decad96e5affe07078624c2ef95dd1f5e79601b2..228c17966e51b726768ef7bb6d15e00a
// Paper end
diff --git a/src/main/java/net/minecraft/server/EntitySlice.java b/src/main/java/net/minecraft/server/EntitySlice.java
index 1250c3cbe915815939627701c153ba6254fc05f0..5b5f45a987b58bf639292ac8398ae08b3cb9a1bf 100644
index 1250c3cbe915815939627701c153ba6254fc05f0..e0cbcc0a15f8089c29957badc20b0a786831c64b 100644
--- a/src/main/java/net/minecraft/server/EntitySlice.java
+++ b/src/main/java/net/minecraft/server/EntitySlice.java
@@ -14,18 +14,35 @@ import java.util.Map.Entry;
@ -930,7 +939,7 @@ index 1250c3cbe915815939627701c153ba6254fc05f0..5b5f45a987b58bf639292ac8398ae08b
});
return Collections.unmodifiableCollection(list);
@@ -87,4 +114,29 @@ public class EntitySlice<T> extends AbstractCollection<T> {
@@ -87,4 +114,38 @@ public class EntitySlice<T> extends AbstractCollection<T> {
public int size() {
return this.c.size();
}
@ -947,7 +956,7 @@ index 1250c3cbe915815939627701c153ba6254fc05f0..5b5f45a987b58bf639292ac8398ae08b
+ return Collections.unmodifiableCollection(collection);
+ }
+
+ private <S> Collection<T> createAllOfGroupType(EntityClassGroup type) {
+ private Collection<T> createAllOfGroupType(EntityClassGroup type) {
+ ReferenceLinkedOpenHashSet<T> allOfType = new ReferenceLinkedOpenHashSet<>();
+
+ for (T entity : this.c) {
@ -958,6 +967,15 @@ index 1250c3cbe915815939627701c153ba6254fc05f0..5b5f45a987b58bf639292ac8398ae08b
+ this.entitiesByGroup.put(type, allOfType);
+ return allOfType;
+ }
+
+ /**
+ * A workaround about md_5's dumb changes
+ *
+ * @return list representation of EntitySlice
+ */
+ public List<T> toList() {
+ return c;
+ }
+ // Yatopia end
}
diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java
@ -1013,7 +1031,7 @@ index 882b82d8952d34f6e3c639404d1a1521dedf1bb0..ccf1416000354b78ccef78b072062ce0
default EntityHuman findNearbyPlayer(Entity entity, double d0, @Nullable Predicate<Entity> predicate) { return this.findNearbyPlayer(entity.locX(), entity.locY(), entity.locZ(), d0, predicate); } // Paper
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index fbb36229ce936e323619457b618627254cc2ade8..727aecff6987b9194617bcb4e5e59d923a8dd858 100644
index fbb36229ce936e323619457b618627254cc2ade8..9b7e6d747b366f5967754f1a37ee362aa92e4947 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1351,11 +1351,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -1021,7 +1039,7 @@ index fbb36229ce936e323619457b618627254cc2ade8..727aecff6987b9194617bcb4e5e59d92
this.world.a(chunk.getTileEntities().values());
List<Entity> list = null;
- List<Entity>[] aentityslice = chunk.getEntitySlices(); // Spigot
+ EntitySlice<Entity>[] aentityslice = chunk.getEntitySlices(); // Spigot // Yatopia - md_5 is stupid
+ EntitySlice<Entity>[] aentityslice = chunk.getAsSlices(); // Spigot // Yatopia - md_5 is stupid
int i = aentityslice.length;
for (int j = 0; j < i; ++j) {
@ -1035,12 +1053,12 @@ index fbb36229ce936e323619457b618627254cc2ade8..727aecff6987b9194617bcb4e5e59d92
csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
int sum = 0;
- for (List<Entity> entities : chunk.getEntitySlices()) {
+ for (EntitySlice<Entity> entities : chunk.getEntitySlices()) { // Yatopia - this was caused due to md_5 being stupid
+ for (EntitySlice<Entity> entities : chunk.getAsSlices()) { // Yatopia - this was caused due to md_5 being stupid
int size = entities.size();
sum += size;
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 6610d2f0f852a2af93ab9a61d69a6862d11f1b19..17760dce57dd2e85f98c6fc63e2b49d838f7190e 100644
index 6610d2f0f852a2af93ab9a61d69a6862d11f1b19..619509cdb60c6236640fa9b85e9902235fa5aa27 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -649,8 +649,14 @@ public class WorldServer extends World implements GeneratorAccessSeed {
@ -1063,7 +1081,7 @@ index 6610d2f0f852a2af93ab9a61d69a6862d11f1b19..17760dce57dd2e85f98c6fc63e2b49d8
// Spigot End
this.tileEntityListUnload.addAll(chunk.getTileEntities().values());
- List[] aentityslice = chunk.getEntitySlices(); // Spigot
+ EntitySlice<Entity>[] aentityslice = chunk.getEntitySlices(); // Spigot // Yatopia - md_5 is stupid
+ EntitySlice<Entity>[] aentityslice = chunk.getAsSlices(); // Spigot // Yatopia - md_5 is stupid
int i = aentityslice.length;
java.util.List<Entity> toMoveChunks = new java.util.ArrayList<>(); // Paper

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Load also the chunk that you're teleporting to
Fixes Tuinity-178
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 17760dce57dd2e85f98c6fc63e2b49d838f7190e..54a5a36a53af0f4e3f1a7c88d39d2e590e15ee04 100644
index 619509cdb60c6236640fa9b85e9902235fa5aa27..0d3d1098c570a7b3d5092dd4f25d3a36581706d9 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -225,7 +225,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix "Unable to save chunk" error
diff --git a/src/main/java/net/minecraft/server/EntitySlice.java b/src/main/java/net/minecraft/server/EntitySlice.java
index 5b5f45a987b58bf639292ac8398ae08b3cb9a1bf..1e88e8de984a857c5414895f48af93e368d4951a 100644
index e0cbcc0a15f8089c29957badc20b0a786831c64b..b90cb567f443eadc15270f8f2da30caaba8c00cb 100644
--- a/src/main/java/net/minecraft/server/EntitySlice.java
+++ b/src/main/java/net/minecraft/server/EntitySlice.java
@@ -104,7 +104,7 @@ public class EntitySlice<T> extends AbstractCollection<T> implements me.jellysqu

View File

@ -18,7 +18,7 @@ index fd0beefb900c064d3c35a3d2f79f5b7d9c1287bb..4d024a4849b7566c0faba131caab57b4
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 54a5a36a53af0f4e3f1a7c88d39d2e590e15ee04..ede319e08a4d0356d8488172e497defd7982fcc2 100644
index 0d3d1098c570a7b3d5092dd4f25d3a36581706d9..4b86411f5e0dd9319deee3296827080ccb7865a5 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1815,6 +1815,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {

View File

@ -185,7 +185,7 @@ index 596815d70e69fd645bec5b6e8c1ebc7b2fa5345a..121504fc93781c78bc236e05ed91ee35
return (String[]) this.d.keySet().toArray(new String[this.d.size()]);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5274dcde8b06200357b11b77cc72ec415d4e47e4..8e4cdad1b76c24f4e459077c5a2b4b08e0a7134f 100644
index 54e54cf4ed710923cc93d4ba77c378547761c8a1..0540414af5e2462ac33710b94efde0d78df1eedf 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1960,6 +1960,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Fix watchdog termination hanging indefinitely
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8e4cdad1b76c24f4e459077c5a2b4b08e0a7134f..825cb882de70aa48f4a1a51b9cf426819d716b75 100644
index 0540414af5e2462ac33710b94efde0d78df1eedf..534ffa0df296d02fbc69102b7d38edb0bdb350cc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -820,6 +820,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas

View File

@ -7,7 +7,7 @@ Original code by JellySquid, licensed under LGPLv3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java b/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..7de67eb2ee790f538be3ca1aa5ea87959fdde413 100644
index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..03ba6b41b9720122464a5b2bf07fd07ae89a00c3 100644
--- a/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
+++ b/src/main/java/net/minecraft/server/NoiseGeneratorPerlin.java
@@ -8,6 +8,12 @@ public final class NoiseGeneratorPerlin {
@ -66,17 +66,15 @@ index d7ca619b228e2a5a461085e0c5222e6a36a66fe0..7de67eb2ee790f538be3ca1aa5ea8795
public double a(double d0, double d1, double d2, double d3, double d4) {
double d5 = d0 + this.a;
double d6 = d1 + this.b;
@@ -55,8 +95,8 @@ public final class NoiseGeneratorPerlin {
@@ -55,7 +95,7 @@ public final class NoiseGeneratorPerlin {
}
return this.a(i, j, k, d8, d9 - d14, d10, d11, d12, d13);
- }
-
+ } */ //Yatopia End
+
private static double a(int i, double d0, double d1, double d2) {
int j = i & 15;
@@ -67,6 +107,103 @@ public final class NoiseGeneratorPerlin {
return this.d[i & 255] & 255;
}

View File

@ -7,7 +7,7 @@ Original code by JellySquid, licensed under LGPLv3
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
index 119804e5c12aca3f4fbfeaf424f46152f43b3941..3ba2844ac7e9d8e49fa42a9da6f0af021b12dd8a 100644
index 119804e5c12aca3f4fbfeaf424f46152f43b3941..e9862fe294cdde305778ec6fd33005e00db57a73 100644
--- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
@@ -112,6 +112,97 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {