A bit more work for 1.14
This commit is contained in:
parent
a64c1a03c9
commit
ab34e2751e
11 changed files with 150 additions and 441 deletions
|
@ -1,4 +1,4 @@
|
||||||
From 253aab4a0dbe60736581c7036f6dc994f02d49a3 Mon Sep 17 00:00:00 2001
|
From 2b197fb4121fb5e528c4c58ee63df0b43f40966f Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Tue, 1 Mar 2016 23:09:29 -0600
|
Date: Tue, 1 Mar 2016 23:09:29 -0600
|
||||||
Subject: [PATCH] Further improve server tick loop
|
Subject: [PATCH] Further improve server tick loop
|
||||||
|
@ -12,19 +12,19 @@ Previous implementation did not calculate TPS correctly.
|
||||||
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
|
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index df85f35f37..7ca7b9f3ac 100644
|
index 89ad19e59c..7dfe1f0a3c 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -141,7 +141,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
@@ -150,7 +150,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||||
public org.bukkit.command.ConsoleCommandSender console;
|
public org.bukkit.command.ConsoleCommandSender console;
|
||||||
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
|
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
|
||||||
public ConsoleReader reader;
|
public ConsoleReader reader;
|
||||||
- public static int currentTick = (int) (System.currentTimeMillis() / 50);
|
- public static int currentTick = (int) (System.currentTimeMillis() / 50);
|
||||||
+ public static int currentTick = 0; // Paper - Further improve tick loop
|
+ public static int currentTick = 0; // Paper - Further improve tick loop
|
||||||
public final Thread primaryThread;
|
|
||||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||||
public int autosavePeriod;
|
public int autosavePeriod;
|
||||||
@@ -151,7 +151,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
public File bukkitDataPackFolder;
|
||||||
|
@@ -159,7 +159,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||||
// Spigot start
|
// Spigot start
|
||||||
public static final int TPS = 20;
|
public static final int TPS = 20;
|
||||||
public static final int TICK_TIME = 1000000000 / TPS;
|
public static final int TICK_TIME = 1000000000 / TPS;
|
||||||
|
@ -33,16 +33,7 @@ index df85f35f37..7ca7b9f3ac 100644
|
||||||
public final double[] recentTps = new double[ 3 ];
|
public final double[] recentTps = new double[ 3 ];
|
||||||
public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant();
|
public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant();
|
||||||
// Spigot end
|
// Spigot end
|
||||||
@@ -685,7 +685,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
@@ -745,6 +745,57 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||||
}
|
|
||||||
|
|
||||||
private boolean canSleepForTick() {
|
|
||||||
- return SystemUtils.getMonotonicMillis() < this.nextTick;
|
|
||||||
+ return System.nanoTime() - lastTick + catchupTime < TICK_TIME; // Paper - improved "are we lagging" check to match our own
|
|
||||||
}
|
|
||||||
|
|
||||||
// Spigot Start
|
|
||||||
@@ -693,6 +693,57 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
||||||
{
|
{
|
||||||
return ( avg * exp ) + ( tps * ( 1 - exp ) );
|
return ( avg * exp ) + ( tps * ( 1 - exp ) );
|
||||||
}
|
}
|
||||||
|
@ -100,16 +91,24 @@ index df85f35f37..7ca7b9f3ac 100644
|
||||||
// Spigot End
|
// Spigot End
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -705,29 +756,47 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
@@ -757,30 +808,48 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||||
|
|
||||||
// Spigot start
|
// Spigot start
|
||||||
Arrays.fill( recentTps, 20 );
|
Arrays.fill( recentTps, 20 );
|
||||||
- long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick, tickCount = 1;
|
- long curTime, tickSection = SystemUtils.getMonotonicMillis(), tickCount = 1;
|
||||||
+ long start = System.nanoTime(), curTime, wait, tickSection = start; // Paper - Further improve server tick loop
|
+ long start = System.nanoTime(), curTime, wait, tickSection = start; // Paper - Further improve server tick loop
|
||||||
+ lastTick = start - TICK_TIME; // Paper
|
+ lastTick = start - TICK_TIME; // Paper
|
||||||
while (this.isRunning) {
|
while (this.isRunning) {
|
||||||
curTime = System.nanoTime();
|
- long i = (curTime = SystemUtils.getMonotonicMillis()) - this.nextTick;
|
||||||
- wait = TICK_TIME - (curTime - lastTick) - catchupTime;
|
-
|
||||||
|
- if (i > 2000L && this.nextTick - this.lastOverloadTime >= 15000L) {
|
||||||
|
- long j = i / 50L;
|
||||||
|
-
|
||||||
|
- if (server.getWarnOnOverload()) // CraftBukkit
|
||||||
|
- MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||||
|
- this.nextTick += j * 50L;
|
||||||
|
- this.lastOverloadTime = this.nextTick;
|
||||||
|
+ curTime = System.nanoTime();
|
||||||
+ // Paper start - Further improve server tick loop
|
+ // Paper start - Further improve server tick loop
|
||||||
+ wait = TICK_TIME - (curTime - lastTick);
|
+ wait = TICK_TIME - (curTime - lastTick);
|
||||||
+ if (wait > 0) {
|
+ if (wait > 0) {
|
||||||
|
@ -123,12 +122,8 @@ index df85f35f37..7ca7b9f3ac 100644
|
||||||
+ catchupTime = 0;
|
+ catchupTime = 0;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
if (wait > 0) {
|
+ if (wait > 0) {
|
||||||
Thread.sleep(wait / 1000000);
|
+ Thread.sleep(wait / 1000000);
|
||||||
- catchupTime = 0;
|
|
||||||
- continue;
|
|
||||||
- } else {
|
|
||||||
- catchupTime = Math.min(1000000000, Math.abs(wait));
|
|
||||||
+ curTime = System.nanoTime();
|
+ curTime = System.nanoTime();
|
||||||
+ wait = TICK_TIME - (curTime - lastTick);
|
+ wait = TICK_TIME - (curTime - lastTick);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +132,7 @@ index df85f35f37..7ca7b9f3ac 100644
|
||||||
+ catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait);
|
+ catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait);
|
||||||
+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 )
|
+ if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 )
|
||||||
{
|
{
|
||||||
- double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL;
|
- double currentTps = 1E3 / ( curTime - tickSection ) * SAMPLE_INTERVAL;
|
||||||
- recentTps[0] = calcTps( recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min)
|
- recentTps[0] = calcTps( recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min)
|
||||||
- recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min)
|
- recentTps[1] = calcTps( recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min)
|
||||||
- recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min)
|
- recentTps[2] = calcTps( recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min)
|
||||||
|
@ -153,18 +148,28 @@ index df85f35f37..7ca7b9f3ac 100644
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
tickSection = curTime;
|
tickSection = curTime;
|
||||||
}
|
}
|
||||||
lastTick = curTime;
|
// Spigot end
|
||||||
|
|
||||||
- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||||
+ //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
|
+ //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
|
||||||
this.a(this::canSleepForTick);
|
+ this.a(this::canSleepForTick);
|
||||||
this.nextTick += 50L;
|
this.nextTick += 50L;
|
||||||
// Spigot end
|
if (this.T) {
|
||||||
|
this.T = false;
|
||||||
|
@@ -848,7 +917,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canSleepForTick() {
|
||||||
|
- return this.bg() || SystemUtils.getMonotonicMillis() < (this.ac ? this.ab : this.nextTick);
|
||||||
|
+ return System.nanoTime() - lastTick + catchupTime < TICK_TIME; // Paper - improved "are we lagging" check to match our own
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void sleepForTick() {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 351313d98c..7b4af7a904 100644
|
index a750d8ab5b..423cbd558e 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -1983,6 +1983,17 @@ public final class CraftServer implements Server {
|
@@ -1919,6 +1919,17 @@ public final class CraftServer implements Server {
|
||||||
return CraftMagicNumbers.INSTANCE;
|
return CraftMagicNumbers.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
From 46d9253b86272626d7bb064aabf9a8ed19217f02 Mon Sep 17 00:00:00 2001
|
From 4076d548ca6e55ff95403b309eb842e650799e87 Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||||
Date: Tue, 1 Mar 2016 23:12:03 -0600
|
Date: Tue, 1 Mar 2016 23:12:03 -0600
|
||||||
Subject: [PATCH] Only refresh abilities if needed
|
Subject: [PATCH] Only refresh abilities if needed
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
index 15c2e1dee7..0ee063bcd3 100644
|
index ca65d51d81..6b93cc3a57 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -1302,12 +1302,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -1328,12 +1328,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlying(boolean value) {
|
public void setFlying(boolean value) {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
From 9cc3c4b16c1f83dc857837cbe19b285814ae0b0c Mon Sep 17 00:00:00 2001
|
From cd1b38a03518343b566b13fa07feab35e3dea428 Mon Sep 17 00:00:00 2001
|
||||||
From: Byteflux <byte@byteflux.net>
|
From: Byteflux <byte@byteflux.net>
|
||||||
Date: Tue, 1 Mar 2016 23:45:08 -0600
|
Date: Tue, 1 Mar 2016 23:45:08 -0600
|
||||||
Subject: [PATCH] Entity Origin API
|
Subject: [PATCH] Entity Origin API
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||||
index 2198182ec9..b4b73dbfd3 100644
|
index 7191861e81..c813b59af5 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||||
@@ -160,6 +160,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -161,6 +161,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
|
public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
|
||||||
public boolean forceExplosionKnockback; // SPIGOT-949
|
public boolean forceExplosionKnockback; // SPIGOT-949
|
||||||
public Timing tickTimer = MinecraftTimings.getEntityTimings(this); // Paper
|
public Timing tickTimer = MinecraftTimings.getEntityTimings(this); // Paper
|
||||||
|
@ -16,7 +16,7 @@ index 2198182ec9..b4b73dbfd3 100644
|
||||||
// Spigot start
|
// Spigot start
|
||||||
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
||||||
public final boolean defaultActivationState;
|
public final boolean defaultActivationState;
|
||||||
@@ -1620,6 +1621,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -1529,6 +1530,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ index 2198182ec9..b4b73dbfd3 100644
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
||||||
@@ -1761,6 +1767,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -1650,6 +1656,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ index 2198182ec9..b4b73dbfd3 100644
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||||
@@ -1836,6 +1849,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -1727,6 +1740,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
|
|
||||||
protected abstract void b(NBTTagCompound nbttagcompound);
|
protected abstract void b(NBTTagCompound nbttagcompound);
|
||||||
|
|
||||||
|
@ -51,10 +51,10 @@ index 2198182ec9..b4b73dbfd3 100644
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
double[] adouble1 = adouble;
|
double[] adouble1 = adouble;
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
index a6eae266de..489dd861d2 100644
|
index 55591fbe05..90becdfdec 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
@@ -249,6 +249,14 @@ public class EntityFallingBlock extends Entity {
|
@@ -245,6 +245,14 @@ public class EntityFallingBlock extends Entity {
|
||||||
this.block = Blocks.SAND.getBlockData();
|
this.block = Blocks.SAND.getBlockData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,11 +70,11 @@ index a6eae266de..489dd861d2 100644
|
||||||
|
|
||||||
public void a(boolean flag) {
|
public void a(boolean flag) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||||
index 8c19278f37..7f4b68dcc0 100644
|
index e3001570f9..e0535604b6 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||||
@@ -108,6 +108,14 @@ public class EntityTNTPrimed extends Entity {
|
@@ -104,6 +104,14 @@ public class EntityTNTPrimed extends Entity {
|
||||||
|
@Override
|
||||||
protected void a(NBTTagCompound nbttagcompound) {
|
protected void a(NBTTagCompound nbttagcompound) {
|
||||||
this.setFuseTicks(nbttagcompound.getShort("Fuse"));
|
this.setFuseTicks(nbttagcompound.getShort("Fuse"));
|
||||||
+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility
|
+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility
|
||||||
|
@ -89,39 +89,22 @@ index 8c19278f37..7f4b68dcc0 100644
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
|
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
|
||||||
index 27debcfca9..22027321bd 100644
|
index ce510c4867..b7c94fe238 100644
|
||||||
--- a/src/main/java/net/minecraft/server/NBTTagList.java
|
--- a/src/main/java/net/minecraft/server/NBTTagList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
|
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
|
||||||
@@ -182,6 +182,7 @@ public class NBTTagList extends NBTList<NBTBase> {
|
@@ -161,6 +161,7 @@ public class NBTTagList extends NBTList<NBTBase> {
|
||||||
return new int[0];
|
return new int[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ public final double getDoubleAt(int i) { return this.k(i); } // Paper - OBFHELPER
|
+ public final double getDoubleAt(int i) { return this.h(i); } // Paper - OBFHELPER
|
||||||
public double k(int i) {
|
public double h(int i) {
|
||||||
if (i >= 0 && i < this.list.size()) {
|
if (i >= 0 && i < this.list.size()) {
|
||||||
NBTBase nbtbase = (NBTBase) this.list.get(i);
|
NBTBase nbtbase = (NBTBase) this.list.get(i);
|
||||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
||||||
index 106ad00dc7..470f406227 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/World.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/World.java
|
|
||||||
@@ -918,6 +918,12 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
||||||
int j = MathHelper.floor(entity.locZ / 16.0D);
|
|
||||||
boolean flag = entity.attachedToPlayer;
|
|
||||||
|
|
||||||
+ // Paper start - Set origin location when the entity is being added to the world
|
|
||||||
+ if (entity.origin == null) {
|
|
||||||
+ entity.origin = entity.getBukkitEntity().getLocation();
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
+
|
|
||||||
if (entity instanceof EntityHuman) {
|
|
||||||
flag = true;
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
index 7edbbb106b..660e59ba15 100644
|
index c1ad2626a7..852de0d625 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
@@ -816,4 +816,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
@@ -945,4 +945,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
return spigot;
|
return spigot;
|
||||||
}
|
}
|
||||||
// Spigot end
|
// Spigot end
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
From 425aae4f7f3a850716d02b84e961b8af34fdec04 Mon Sep 17 00:00:00 2001
|
From def800183b248ecec16bb7fe8c23196ff3450dc0 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Tue, 1 Mar 2016 23:52:34 -0600
|
Date: Tue, 1 Mar 2016 23:52:34 -0600
|
||||||
Subject: [PATCH] Prevent tile entity and entity crashes
|
Subject: [PATCH] Prevent tile entity and entity crashes
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
|
||||||
index 68ac014aab..c5212417c6 100644
|
index b5e0ba3909..16957b9aa2 100644
|
||||||
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
--- a/src/main/java/net/minecraft/server/TileEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
+++ b/src/main/java/net/minecraft/server/TileEntity.java
|
||||||
@@ -178,7 +178,12 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
@@ -179,7 +179,12 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||||
return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.C()) + " // " + this.getClass().getCanonicalName();
|
return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.q()) + " // " + this.getClass().getCanonicalName();
|
||||||
});
|
});
|
||||||
if (this.world != null) {
|
if (this.world != null) {
|
||||||
- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock());
|
- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock());
|
||||||
|
@ -23,37 +23,21 @@ index 68ac014aab..c5212417c6 100644
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||||
index 470f406227..b10e4c409d 100644
|
index 446f864420..62c77d8f51 100644
|
||||||
--- a/src/main/java/net/minecraft/server/World.java
|
--- a/src/main/java/net/minecraft/server/World.java
|
||||||
+++ b/src/main/java/net/minecraft/server/World.java
|
+++ b/src/main/java/net/minecraft/server/World.java
|
||||||
@@ -1147,10 +1147,12 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
@@ -674,11 +674,13 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||||
entity.tickTimer.stopTiming(); // Paper
|
|
||||||
} catch (Throwable throwable1) {
|
|
||||||
entity.tickTimer.stopTiming();
|
|
||||||
- crashreport1 = CrashReport.a(throwable1, "Ticking entity");
|
|
||||||
- crashreportsystemdetails1 = crashreport1.a("Entity being ticked");
|
|
||||||
- entity.appendEntityCrashDetails(crashreportsystemdetails1);
|
|
||||||
- throw new ReportedException(crashreport1);
|
|
||||||
+ // Paper start - Prevent tile entity and entity crashes
|
|
||||||
+ System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
|
|
||||||
+ throwable1.printStackTrace();
|
|
||||||
+ entity.dead = true;
|
|
||||||
+ continue;
|
|
||||||
+ // Paper end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1213,10 +1215,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
||||||
((ITickable) tileentity).tick();
|
((ITickable) tileentity).tick();
|
||||||
this.methodProfiler.exit();
|
gameprofilerfiller.exit();
|
||||||
} catch (Throwable throwable2) {
|
} catch (Throwable throwable) {
|
||||||
- crashreport1 = CrashReport.a(throwable2, "Ticking block entity");
|
- CrashReport crashreport = CrashReport.a(throwable, "Ticking block entity");
|
||||||
- crashreportsystemdetails1 = crashreport1.a("Block entity being ticked");
|
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block entity being ticked");
|
||||||
- tileentity.a(crashreportsystemdetails1);
|
-
|
||||||
- throw new ReportedException(crashreport1);
|
- tileentity.a(crashreportsystemdetails);
|
||||||
|
- throw new ReportedException(crashreport);
|
||||||
+ // Paper start - Prevent tile entity and entity crashes
|
+ // Paper start - Prevent tile entity and entity crashes
|
||||||
+ System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
|
+ System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
|
||||||
+ throwable2.printStackTrace();
|
+ throwable.printStackTrace();
|
||||||
+ tilesThisCycle--;
|
+ tilesThisCycle--;
|
||||||
+ this.tileEntityListTick.remove(tileTickPosition--);
|
+ this.tileEntityListTick.remove(tileTickPosition--);
|
||||||
+ continue;
|
+ continue;
|
||||||
|
@ -61,6 +45,24 @@ index 470f406227..b10e4c409d 100644
|
||||||
}
|
}
|
||||||
// Spigot start
|
// Spigot start
|
||||||
finally {
|
finally {
|
||||||
|
@@ -747,11 +749,12 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||||
|
// Spigot end
|
||||||
|
consumer.accept(entity);
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
- CrashReport crashreport = CrashReport.a(throwable, "Ticking entity");
|
||||||
|
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked");
|
||||||
|
-
|
||||||
|
- entity.appendEntityCrashDetails(crashreportsystemdetails);
|
||||||
|
- throw new ReportedException(crashreport);
|
||||||
|
+ // Paper start - Prevent tile entity and entity crashes
|
||||||
|
+ System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ);
|
||||||
|
+ throwable.printStackTrace();
|
||||||
|
+ entity.dead = true;
|
||||||
|
+ return;
|
||||||
|
+ // Paper end
|
||||||
|
}
|
||||||
|
// Spigot start
|
||||||
|
finally {
|
||||||
--
|
--
|
||||||
2.21.0
|
2.21.0
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From daccf0e889a168098bd6db251c164a2c0c3a1c2c Mon Sep 17 00:00:00 2001
|
From ff3266a66baaf6940a31d4a26742cf8cf7479b79 Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||||
Date: Tue, 1 Mar 2016 23:58:50 -0600
|
Date: Tue, 1 Mar 2016 23:58:50 -0600
|
||||||
Subject: [PATCH] Configurable top of nether void damage
|
Subject: [PATCH] Configurable top of nether void damage
|
||||||
|
@ -29,10 +29,10 @@ index 1ed58f4bba..a797a57671 100644
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||||
index b4b73dbfd3..ad30cdd824 100644
|
index c813b59af5..494c6cb4aa 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||||
@@ -461,9 +461,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -385,9 +385,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
this.fallDistance *= 0.5F;
|
this.fallDistance *= 0.5F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ index b4b73dbfd3..ad30cdd824 100644
|
||||||
+ // Extracted to own function
|
+ // Extracted to own function
|
||||||
+ /*
|
+ /*
|
||||||
if (this.locY < -64.0D) {
|
if (this.locY < -64.0D) {
|
||||||
this.aa();
|
this.ae();
|
||||||
}
|
}
|
||||||
+ */
|
+ */
|
||||||
+ this.performVoidDamage();
|
+ this.performVoidDamage();
|
||||||
|
@ -48,8 +48,8 @@ index b4b73dbfd3..ad30cdd824 100644
|
||||||
|
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
this.setFlag(0, this.fireTicks > 0);
|
this.setFlag(0, this.fireTicks > 0);
|
||||||
@@ -473,6 +479,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -397,6 +403,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
this.world.methodProfiler.exit();
|
this.world.getMethodProfiler().exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
|
@ -66,19 +66,19 @@ index b4b73dbfd3..ad30cdd824 100644
|
||||||
protected void E() {
|
protected void E() {
|
||||||
if (this.portalCooldown > 0) {
|
if (this.portalCooldown > 0) {
|
||||||
--this.portalCooldown;
|
--this.portalCooldown;
|
||||||
@@ -540,6 +557,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -464,6 +481,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
this.fireTicks = 0;
|
this.fireTicks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ protected final void doVoidDamage() { this.aa(); } // Paper - OBFHELPER
|
+ protected final void doVoidDamage() { this.ae(); } // Paper - OBFHELPER
|
||||||
protected void aa() {
|
protected void ae() {
|
||||||
this.die();
|
this.die();
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||||
index 205251bcdd..0f531e7d42 100644
|
index 4d2ef9a02b..6fc332dbff 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||||
@@ -193,9 +193,15 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableT
|
@@ -182,9 +182,15 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||||
this.setDamage(this.getDamage() - 1.0F);
|
this.setDamage(this.getDamage() - 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,14 +86,14 @@ index 205251bcdd..0f531e7d42 100644
|
||||||
+ // Extracted to own function
|
+ // Extracted to own function
|
||||||
+ /*
|
+ /*
|
||||||
if (this.locY < -64.0D) {
|
if (this.locY < -64.0D) {
|
||||||
this.aa();
|
this.ae();
|
||||||
}
|
}
|
||||||
+ */
|
+ */
|
||||||
+ this.performVoidDamage();
|
+ this.performVoidDamage();
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
int i;
|
// this.doPortalTick(); // CraftBukkit - handled in postTick
|
||||||
|
if (this.world.isClientSide) {
|
||||||
--
|
--
|
||||||
2.21.0
|
2.21.0
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
From c086f9f25ffe26781c60c9478f3a4882bb4fd620 Mon Sep 17 00:00:00 2001
|
From fa0eae868a9a3dc68fd35f43e31d6c70d69db1e0 Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||||
Date: Wed, 2 Mar 2016 00:03:55 -0600
|
Date: Wed, 2 Mar 2016 00:03:55 -0600
|
||||||
Subject: [PATCH] Check online mode before converting and renaming player data
|
Subject: [PATCH] Check online mode before converting and renaming player data
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||||
index 3d5aaf052b..c4173c0aad 100644
|
index e9e7d92584..e821dfbaf6 100644
|
||||||
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||||
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
|
||||||
@@ -166,7 +166,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
|
@@ -164,7 +164,7 @@ public class WorldNBTStorage implements IPlayerFileData {
|
||||||
File file = new File(this.playerDir, entityhuman.bu() + ".dat");
|
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
|
||||||
// Spigot Start
|
// Spigot Start
|
||||||
boolean usingWrongFile = false;
|
boolean usingWrongFile = false;
|
||||||
- if ( !file.exists() )
|
- if ( !file.exists() )
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
From 9c6780d7a876397d8bdc4b460242ba9ca91fcac0 Mon Sep 17 00:00:00 2001
|
From 5fa0966cfcf252ba31b9196baf0ed90e8ae237de Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||||
Date: Wed, 2 Mar 2016 00:32:25 -0600
|
Date: Wed, 2 Mar 2016 00:32:25 -0600
|
||||||
Subject: [PATCH] Always tick falling blocks
|
Subject: [PATCH] Always tick falling blocks
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||||
index a99c0cea0f..a95f93eb76 100644
|
index bf35950867..8e1234c246 100644
|
||||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||||
@@ -13,6 +13,7 @@ import net.minecraft.server.EntityCreature;
|
@@ -13,6 +13,7 @@ import net.minecraft.server.EntityCreature;
|
||||||
|
@ -18,7 +18,7 @@ index a99c0cea0f..a95f93eb76 100644
|
||||||
import net.minecraft.server.EntityHuman;
|
import net.minecraft.server.EntityHuman;
|
||||||
@@ -81,6 +82,7 @@ public class ActivationRange
|
@@ -81,6 +82,7 @@ public class ActivationRange
|
||||||
|| entity instanceof EntityFireball
|
|| entity instanceof EntityFireball
|
||||||
|| entity instanceof EntityWeather
|
|| entity instanceof EntityLightning
|
||||||
|| entity instanceof EntityTNTPrimed
|
|| entity instanceof EntityTNTPrimed
|
||||||
+ || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks
|
+ || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks
|
||||||
|| entity instanceof EntityEnderCrystal
|
|| entity instanceof EntityEnderCrystal
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
From a242286ea939a153321c6c4991f0783eac81ef5d Mon Sep 17 00:00:00 2001
|
From b050f65ecd22f2c4a4658bd195e2633834001d62 Mon Sep 17 00:00:00 2001
|
||||||
From: DoctorDark <doctordark11@gmail.com>
|
From: DoctorDark <doctordark11@gmail.com>
|
||||||
Date: Wed, 16 Mar 2016 02:21:39 -0500
|
Date: Wed, 16 Mar 2016 02:21:39 -0500
|
||||||
Subject: [PATCH] Configurable end credits
|
Subject: [PATCH] Configurable end credits
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 59d82fa4fb..012182378a 100644
|
index a797a57671..c2b9690a0c 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -147,4 +147,10 @@ public class PaperWorldConfig {
|
@@ -139,4 +139,10 @@ public class PaperWorldConfig {
|
||||||
log("Warning: This feature may help reduce TPS loss from light, but comes at the cost of buggy light data");
|
}
|
||||||
log("We are working to improve this feature.");
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ public boolean disableEndCredits;
|
+ public boolean disableEndCredits;
|
||||||
|
@ -20,25 +20,25 @@ index 59d82fa4fb..012182378a 100644
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||||
index 0902c69f33..c4a55c6a1f 100644
|
index e7856b2abe..5548163666 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||||
@@ -58,7 +58,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
@@ -59,7 +59,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||||
private long cu = SystemUtils.getMonotonicMillis();
|
private long cm = SystemUtils.getMonotonicMillis();
|
||||||
private Entity spectatedEntity;
|
private Entity spectatedEntity;
|
||||||
public boolean worldChangeInvuln;
|
public boolean worldChangeInvuln;
|
||||||
- private boolean cx;
|
- private boolean cp;
|
||||||
+ private boolean cx; private void setHasSeenCredits(boolean has) { this.cx = has; } // Paper - OBFHELPER
|
+ private boolean cp; private void setHasSeenCredits(boolean has) { this.cp = has; } // Paper - OBFHELPER
|
||||||
private final RecipeBookServer recipeBook;
|
private final RecipeBookServer recipeBook;
|
||||||
private Vec3D cz;
|
private Vec3D cr;
|
||||||
private int cA;
|
private int cs;
|
||||||
@@ -651,6 +651,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
@@ -697,6 +697,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||||
this.world.kill(this);
|
this.getWorldServer().removePlayer(this);
|
||||||
if (!this.viewingCredits) {
|
if (!this.viewingCredits) {
|
||||||
this.viewingCredits = true;
|
this.viewingCredits = true;
|
||||||
+ if (world.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits
|
+ if (world.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits
|
||||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, this.cx ? 0.0F : 1.0F));
|
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, this.cp ? 0.0F : 1.0F));
|
||||||
this.cx = true;
|
this.cp = true;
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.21.0
|
2.21.0
|
|
@ -1,280 +0,0 @@
|
||||||
From 121e2e7e17e70d345dd182ab23b4b02810174b18 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Aikar <aikar@aikar.co>
|
|
||||||
Date: Wed, 2 Mar 2016 00:52:31 -0600
|
|
||||||
Subject: [PATCH] Lighting Queue
|
|
||||||
|
|
||||||
This provides option to queue lighting updates to ensure they do not cause the server lag
|
|
||||||
|
|
||||||
diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
|
||||||
index 145cb274b0..eff9dcf54f 100644
|
|
||||||
--- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
|
||||||
+++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java
|
|
||||||
@@ -50,6 +50,8 @@ public class WorldTimingsHandler {
|
|
||||||
public final Timing worldSaveLevel;
|
|
||||||
public final Timing chunkSaveData;
|
|
||||||
|
|
||||||
+ public final Timing lightingQueueTimer;
|
|
||||||
+
|
|
||||||
public WorldTimingsHandler(World server) {
|
|
||||||
String name = server.worldData.getName() +" - ";
|
|
||||||
|
|
||||||
@@ -96,6 +98,8 @@ public class WorldTimingsHandler {
|
|
||||||
tracker2 = Timings.ofSafe(name + "tracker stage 2");
|
|
||||||
doTick = Timings.ofSafe(name + "doTick");
|
|
||||||
tickEntities = Timings.ofSafe(name + "tickEntities");
|
|
||||||
+
|
|
||||||
+ lightingQueueTimer = Timings.ofSafe(name + "Lighting Queue");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Timing getTickList(WorldServer worldserver, String timingsType) {
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
||||||
index 7691409f6c..cfcc244672 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
||||||
@@ -191,6 +191,13 @@ public class PaperConfig {
|
|
||||||
return config.getString(path, config.getString(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public static int maxTickMsLostLightQueue;
|
|
||||||
+ private static void lightQueue() {
|
|
||||||
+ int badSetting = config.getInt("queue-light-updates-max-loss", 10);
|
|
||||||
+ config.set("queue-light-updates-max-loss", null);
|
|
||||||
+ maxTickMsLostLightQueue = getInt("settings.queue-light-updates-max-loss", badSetting);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
private static void timings() {
|
|
||||||
boolean timings = getBoolean("timings.enabled", true);
|
|
||||||
boolean verboseTimings = getBoolean("timings.verbose", true);
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
||||||
index a797a57671..59d82fa4fb 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
||||||
@@ -139,4 +139,12 @@ public class PaperWorldConfig {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ public boolean queueLightUpdates;
|
|
||||||
+ private void queueLightUpdates() {
|
|
||||||
+ queueLightUpdates = getBoolean("queue-light-updates", false);
|
|
||||||
+ log("Lighting Queue enabled: " + queueLightUpdates);
|
|
||||||
+ log("Warning: This feature may help reduce TPS loss from light, but comes at the cost of buggy light data");
|
|
||||||
+ log("We are working to improve this feature.");
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
|
||||||
index e15ed21f67..a9aa13fbf8 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
|
||||||
@@ -94,6 +94,7 @@ public class Chunk implements IChunkAccess {
|
|
||||||
return removed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ final PaperLightingQueue.LightingQueue lightingQueue = new PaperLightingQueue.LightingQueue(this);
|
|
||||||
// Paper end
|
|
||||||
public boolean areNeighborsLoaded(final int radius) {
|
|
||||||
switch (radius) {
|
|
||||||
@@ -284,7 +285,7 @@ public class Chunk implements IChunkAccess {
|
|
||||||
|
|
||||||
private void g(boolean flag) {
|
|
||||||
this.world.methodProfiler.enter("recheckGaps");
|
|
||||||
- if (this.world.areChunksLoaded(new BlockPosition(this.locX * 16 + 8, 0, this.locZ * 16 + 8), 16)) {
|
|
||||||
+ if (this.areNeighborsLoaded(1)) { // Paper
|
|
||||||
for (int i = 0; i < 16; ++i) {
|
|
||||||
for (int j = 0; j < 16; ++j) {
|
|
||||||
if (this.g[i + j * 16]) {
|
|
||||||
@@ -335,7 +336,7 @@ public class Chunk implements IChunkAccess {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void a(int i, int j, int k, int l) {
|
|
||||||
- if (l > k && this.world.areChunksLoaded(new BlockPosition(i, 0, j), 16)) {
|
|
||||||
+ if (l > k && this.areNeighborsLoaded(1)) { // Paper
|
|
||||||
for (int i1 = k; i1 < l; ++i1) {
|
|
||||||
this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j));
|
|
||||||
}
|
|
||||||
@@ -535,6 +536,7 @@ public class Chunk implements IChunkAccess {
|
|
||||||
if (flag1) {
|
|
||||||
this.initLighting();
|
|
||||||
} else {
|
|
||||||
+ this.runOrQueueLightUpdate(() -> { // Paper - Queue light update
|
|
||||||
int i1 = iblockdata.b(this.world, blockposition);
|
|
||||||
int j1 = iblockdata1.b(this.world, blockposition);
|
|
||||||
|
|
||||||
@@ -542,6 +544,7 @@ public class Chunk implements IChunkAccess {
|
|
||||||
if (i1 != j1 && (i1 < j1 || this.getBrightness(EnumSkyBlock.SKY, blockposition) > 0 || this.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 0)) {
|
|
||||||
this.c(i, k);
|
|
||||||
}
|
|
||||||
+ }); // Paper
|
|
||||||
}
|
|
||||||
|
|
||||||
TileEntity tileentity;
|
|
||||||
@@ -1358,6 +1361,16 @@ public class Chunk implements IChunkAccess {
|
|
||||||
return this.D == 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Paper start
|
|
||||||
+ public void runOrQueueLightUpdate(Runnable runnable) {
|
|
||||||
+ if (this.world.paperConfig.queueLightUpdates) {
|
|
||||||
+ lightingQueue.add(runnable);
|
|
||||||
+ } else {
|
|
||||||
+ runnable.run();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
+
|
|
||||||
public static enum EnumTileEntityState {
|
|
||||||
|
|
||||||
IMMEDIATE, QUEUED, CHECK;
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
||||||
index eb83e20d50..c2ecc034e8 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
|
||||||
@@ -313,6 +313,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
save = event.isSaveChunk();
|
|
||||||
+ chunk.lightingQueue.processUnload(); // Paper
|
|
||||||
|
|
||||||
// Update neighbor counts
|
|
||||||
for (int x = -2; x < 3; x++) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
index 7ca7b9f3ac..00f1c36e99 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
@@ -890,7 +890,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
||||||
protected void a(BooleanSupplier booleansupplier) {
|
|
||||||
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper
|
|
||||||
this.slackActivityAccountant.tickStarted(); // Spigot
|
|
||||||
- long i = SystemUtils.getMonotonicNanos();
|
|
||||||
+ long i = SystemUtils.getMonotonicNanos(); long startTime = i; // Paper
|
|
||||||
|
|
||||||
++this.ticks;
|
|
||||||
if (this.S) {
|
|
||||||
@@ -948,6 +948,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
||||||
this.methodProfiler.exit();
|
|
||||||
this.methodProfiler.exit();
|
|
||||||
org.spigotmc.WatchdogThread.tick(); // Spigot
|
|
||||||
+ PaperLightingQueue.processQueue(startTime); // Paper
|
|
||||||
this.slackActivityAccountant.tickEnded(l); // Spigot
|
|
||||||
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/PaperLightingQueue.java b/src/main/java/net/minecraft/server/PaperLightingQueue.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000..9783f3a0d9
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/net/minecraft/server/PaperLightingQueue.java
|
|
||||||
@@ -0,0 +1,98 @@
|
|
||||||
+package net.minecraft.server;
|
|
||||||
+
|
|
||||||
+import co.aikar.timings.Timing;
|
|
||||||
+import com.destroystokyo.paper.PaperConfig;
|
|
||||||
+import it.unimi.dsi.fastutil.objects.ObjectCollection;
|
|
||||||
+
|
|
||||||
+import java.util.ArrayDeque;
|
|
||||||
+
|
|
||||||
+class PaperLightingQueue {
|
|
||||||
+ private static final long MAX_TIME = (long) (1000000 * (50 + PaperConfig.maxTickMsLostLightQueue));
|
|
||||||
+
|
|
||||||
+ static void processQueue(long curTime) {
|
|
||||||
+ final long startTime = System.nanoTime();
|
|
||||||
+ final long maxTickTime = MAX_TIME - (startTime - curTime);
|
|
||||||
+
|
|
||||||
+ if (maxTickTime <= 0) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ START:
|
|
||||||
+ for (World world : MinecraftServer.getServer().getWorlds()) {
|
|
||||||
+ if (!world.paperConfig.queueLightUpdates) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ObjectCollection<Chunk> loadedChunks = ((WorldServer) world).getChunkProvider().chunks.values();
|
|
||||||
+ for (Chunk chunk : loadedChunks.toArray(new Chunk[0])) {
|
|
||||||
+ if (chunk.lightingQueue.processQueue(startTime, maxTickTime)) {
|
|
||||||
+ break START;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ static class LightingQueue extends ArrayDeque<Runnable> {
|
|
||||||
+ final private Chunk chunk;
|
|
||||||
+
|
|
||||||
+ LightingQueue(Chunk chunk) {
|
|
||||||
+ super();
|
|
||||||
+ this.chunk = chunk;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Processes the lighting queue for this chunk
|
|
||||||
+ *
|
|
||||||
+ * @param startTime If start Time is 0, we will not limit execution time
|
|
||||||
+ * @param maxTickTime Maximum time to spend processing lighting updates
|
|
||||||
+ * @return true to abort processing furthur lighting updates
|
|
||||||
+ */
|
|
||||||
+ private boolean processQueue(long startTime, long maxTickTime) {
|
|
||||||
+ if (this.isEmpty()) {
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ if (isOutOfTime(maxTickTime, startTime)) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ try (Timing ignored = chunk.world.timings.lightingQueueTimer.startTiming()) {
|
|
||||||
+ Runnable lightUpdate;
|
|
||||||
+ while ((lightUpdate = this.poll()) != null) {
|
|
||||||
+ lightUpdate.run();
|
|
||||||
+ if (isOutOfTime(maxTickTime, startTime)) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Flushes lighting updates to unload the chunk
|
|
||||||
+ */
|
|
||||||
+ void processUnload() {
|
|
||||||
+ if (!chunk.world.paperConfig.queueLightUpdates) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ processQueue(0, 0); // No timeout
|
|
||||||
+
|
|
||||||
+ final int radius = 1;
|
|
||||||
+ for (int x = chunk.locX - radius; x <= chunk.locX + radius; ++x) {
|
|
||||||
+ for (int z = chunk.locZ - radius; z <= chunk.locZ + radius; ++z) {
|
|
||||||
+ if (x == chunk.locX && z == chunk.locZ) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ Chunk neighbor = chunk.world.getChunkIfLoaded(x, z);
|
|
||||||
+ if (neighbor != null) {
|
|
||||||
+ neighbor.lightingQueue.processQueue(0, 0); // No timeout
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private static boolean isOutOfTime(long maxTickTime, long startTime) {
|
|
||||||
+ return startTime > 0 && System.nanoTime() - startTime > maxTickTime;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
||||||
index b10e4c409d..f3755fcfbe 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/World.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/World.java
|
|
||||||
@@ -329,7 +329,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
||||||
|
|
||||||
if (iblockdata2.b(this, blockposition) != iblockdata1.b(this, blockposition) || iblockdata2.e() != iblockdata1.e()) {
|
|
||||||
this.methodProfiler.enter("checkLight");
|
|
||||||
- this.r(blockposition);
|
|
||||||
+ chunk.runOrQueueLightUpdate(() -> this.r(blockposition)); // Paper - Queue light update
|
|
||||||
this.methodProfiler.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.21.0
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
From 6298f2d72de6b88b59b1e49f27c7dd1051f2406a Mon Sep 17 00:00:00 2001
|
From 7db4d0c3eb67772cdffc6226fa7ccecc4a71be36 Mon Sep 17 00:00:00 2001
|
||||||
From: Iceee <andrew@opticgaming.tv>
|
From: Iceee <andrew@opticgaming.tv>
|
||||||
Date: Wed, 2 Mar 2016 01:39:52 -0600
|
Date: Wed, 2 Mar 2016 01:39:52 -0600
|
||||||
Subject: [PATCH] Fix lag from explosions processing dead entities
|
Subject: [PATCH] Fix lag from explosions processing dead entities
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||||
index 33809baf2e..c4db6367e9 100644
|
index 462f8f33a1..e1c628f177 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Explosion.java
|
--- a/src/main/java/net/minecraft/server/Explosion.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
||||||
@@ -111,7 +111,14 @@ public class Explosion {
|
@@ -146,7 +146,14 @@ public class Explosion {
|
||||||
int i1 = MathHelper.floor(this.posY + (double) f3 + 1.0D);
|
int i1 = MathHelper.floor(this.posY + (double) f3 + 1.0D);
|
||||||
int j1 = MathHelper.floor(this.posZ - (double) f3 - 1.0D);
|
int j1 = MathHelper.floor(this.posZ - (double) f3 - 1.0D);
|
||||||
int k1 = MathHelper.floor(this.posZ + (double) f3 + 1.0D);
|
int k1 = MathHelper.floor(this.posZ + (double) f3 + 1.0D);
|
||||||
|
@ -25,7 +25,7 @@ index 33809baf2e..c4db6367e9 100644
|
||||||
|
|
||||||
for (int l1 = 0; l1 < list.size(); ++l1) {
|
for (int l1 = 0; l1 < list.size(); ++l1) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
index 8225a82582..bbcbb62325 100644
|
index ac44db2543..035d70419d 100644
|
||||||
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
@@ -14,6 +14,7 @@ public final class IEntitySelector {
|
@@ -14,6 +14,7 @@ public final class IEntitySelector {
|
||||||
|
@ -34,7 +34,7 @@ index 8225a82582..bbcbb62325 100644
|
||||||
};
|
};
|
||||||
+ public static Predicate<Entity> canAITarget() { return e; } // Paper - OBFHELPER
|
+ public static Predicate<Entity> canAITarget() { return e; } // Paper - OBFHELPER
|
||||||
public static final Predicate<Entity> e = (entity) -> {
|
public static final Predicate<Entity> e = (entity) -> {
|
||||||
return !(entity instanceof EntityHuman) || !((EntityHuman) entity).isSpectator() && !((EntityHuman) entity).u();
|
return !(entity instanceof EntityHuman) || !entity.t() && !((EntityHuman) entity).isCreative();
|
||||||
};
|
};
|
||||||
--
|
--
|
||||||
2.21.0
|
2.21.0
|
|
@ -1,4 +1,4 @@
|
||||||
From 108ccce3714a95b77fa57a54360b303554bd4956 Mon Sep 17 00:00:00 2001
|
From bdafbcf48a32bfbede63ff359df1f1dfc81c23a5 Mon Sep 17 00:00:00 2001
|
||||||
From: Byteflux <byte@byteflux.net>
|
From: Byteflux <byte@byteflux.net>
|
||||||
Date: Wed, 2 Mar 2016 11:59:48 -0600
|
Date: Wed, 2 Mar 2016 11:59:48 -0600
|
||||||
Subject: [PATCH] Optimize explosions
|
Subject: [PATCH] Optimize explosions
|
||||||
|
@ -10,10 +10,10 @@ This patch adds a per-tick cache that is used for storing and retrieving
|
||||||
an entity's exposure during an explosion.
|
an entity's exposure during an explosion.
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
index 012182378a..a39451c69a 100644
|
index c2b9690a0c..a5ec0bc0e0 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
@@ -153,4 +153,10 @@ public class PaperWorldConfig {
|
@@ -145,4 +145,10 @@ public class PaperWorldConfig {
|
||||||
disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
|
disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
|
||||||
log("End credits disabled: " + disableEndCredits);
|
log("End credits disabled: " + disableEndCredits);
|
||||||
}
|
}
|
||||||
|
@ -25,32 +25,31 @@ index 012182378a..a39451c69a 100644
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||||
index c4db6367e9..3e44b2d549 100644
|
index e1c628f177..bcff117619 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Explosion.java
|
--- a/src/main/java/net/minecraft/server/Explosion.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
||||||
@@ -137,7 +137,7 @@ public class Explosion {
|
@@ -172,7 +172,7 @@ public class Explosion {
|
||||||
d8 /= d11;
|
d8 /= d11;
|
||||||
d9 /= d11;
|
d9 /= d11;
|
||||||
d10 /= d11;
|
d10 /= d11;
|
||||||
- double d12 = (double) this.world.a(vec3d, entity.getBoundingBox());
|
- double d12 = (double) a(vec3d, entity);
|
||||||
+ double d12 = this.getBlockDensity(vec3d, entity.getBoundingBox()); // Paper - Optimize explosions
|
+ double d12 = this.getBlockDensity(vec3d, entity); // Paper - Optimize explosions
|
||||||
double d13 = (1.0D - d7) * d12;
|
double d13 = (1.0D - d7) * d12;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@@ -313,4 +313,85 @@ public class Explosion {
|
@@ -361,4 +361,84 @@ public class Explosion {
|
||||||
public List<BlockPosition> getBlocks() {
|
|
||||||
return this.blocks;
|
private Effect() {}
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ // Paper start - Optimize explosions
|
+ // Paper start - Optimize explosions
|
||||||
+ private float getBlockDensity(Vec3D vec3d, AxisAlignedBB aabb) {
|
+ private float getBlockDensity(Vec3D vec3d, Entity entity) {
|
||||||
+ if (!this.world.paperConfig.optimizeExplosions) {
|
+ if (!this.world.paperConfig.optimizeExplosions) {
|
||||||
+ return this.world.a(vec3d, aabb);
|
+ return a(vec3d, entity);
|
||||||
+ }
|
+ }
|
||||||
+ CacheKey key = new CacheKey(this, aabb);
|
+ CacheKey key = new CacheKey(this, entity.getBoundingBox());
|
||||||
+ Float blockDensity = this.world.explosionDensityCache.get(key);
|
+ Float blockDensity = this.world.explosionDensityCache.get(key);
|
||||||
+ if (blockDensity == null) {
|
+ if (blockDensity == null) {
|
||||||
+ blockDensity = this.world.a(vec3d, aabb);
|
+ blockDensity = a(vec3d, entity);
|
||||||
+ this.world.explosionDensityCache.put(key, blockDensity);
|
+ this.world.explosionDensityCache.put(key, blockDensity);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
@ -124,11 +123,11 @@ index c4db6367e9..3e44b2d549 100644
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 00f1c36e99..f488c37f73 100644
|
index 7dfe1f0a3c..8704c091d7 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -1055,6 +1055,7 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
@@ -1122,6 +1122,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||||
worldserver.getTracker().updatePlayers();
|
|
||||||
this.methodProfiler.exit();
|
this.methodProfiler.exit();
|
||||||
this.methodProfiler.exit();
|
this.methodProfiler.exit();
|
||||||
+ worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
+ worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
||||||
|
@ -136,10 +135,10 @@ index 00f1c36e99..f488c37f73 100644
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||||
index f3755fcfbe..20990cbfdd 100644
|
index 62c77d8f51..25f19091c7 100644
|
||||||
--- a/src/main/java/net/minecraft/server/World.java
|
--- a/src/main/java/net/minecraft/server/World.java
|
||||||
+++ b/src/main/java/net/minecraft/server/World.java
|
+++ b/src/main/java/net/minecraft/server/World.java
|
||||||
@@ -22,6 +22,7 @@ import org.apache.logging.log4j.Logger;
|
@@ -19,6 +19,7 @@ import org.apache.logging.log4j.util.Supplier;
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -147,7 +146,7 @@ index f3755fcfbe..20990cbfdd 100644
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
@@ -139,6 +140,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
@@ -94,6 +95,7 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose
|
||||||
private org.spigotmc.TickLimiter entityLimiter;
|
private org.spigotmc.TickLimiter entityLimiter;
|
||||||
private org.spigotmc.TickLimiter tileLimiter;
|
private org.spigotmc.TickLimiter tileLimiter;
|
||||||
private int tileTickPosition;
|
private int tileTickPosition;
|
Loading…
Reference in a new issue