Mark chunk as active if ChunkUnloadEvent is cancelled

Potentially related to GH-169
This commit is contained in:
Zach Brown 2016-04-03 02:02:00 -05:00
parent bb265b967d
commit 2f79610112
3 changed files with 24 additions and 13 deletions

View File

@ -1,4 +1,4 @@
From 20f4010aef693e1da12b34b5322ecedac5abb53c Mon Sep 17 00:00:00 2001
From cde3b788b4a629944ca36ec406ab7a384b4c273b Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Tue, 1 Mar 2016 13:43:16 -0600
Subject: [PATCH] Player Exhaustion Multipliers
@ -36,10 +36,10 @@ index 88e1e98..0f71013 100644
ItemStack itemstack1 = this.u(iblockdata);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index e1bb5c5..11388ab 100644
index ad57082..46c826c 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1451,13 +1451,13 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1448,13 +1448,13 @@ public abstract class EntityHuman extends EntityLiving {
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.q, i);
@ -56,5 +56,5 @@ index e1bb5c5..11388ab 100644
} else if (this.n_()) {
if (d1 > 0.0D) {
--
2.7.4
2.8.0

View File

@ -1,4 +1,4 @@
From 2dfb9ed0eaf09ab4ca3ea4f5aa68596cdf8c6235 Mon Sep 17 00:00:00 2001
From 2b9bf67504d0f896fddad31118b8d6d0e55045f2 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 23:45:08 -0600
Subject: [PATCH] Entity Origin API
@ -81,7 +81,7 @@ index 564ea37..1113b1c 100644
public EntityLiving getSource() {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 72d0f5c..3f4bc0f 100644
index 0460dc5..87236e8 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -948,6 +948,12 @@ public abstract class World implements IBlockAccess {
@ -98,10 +98,10 @@ index 72d0f5c..3f4bc0f 100644
flag = true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 8a1df54..f61f6cd 100644
index 908dcee..f4168c4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -604,4 +604,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -603,4 +603,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return spigot;
}
// Spigot end

View File

@ -1,4 +1,4 @@
From 8fd1f5dfead2200e93116763999f776de862a848 Mon Sep 17 00:00:00 2001
From c9723ad854bc3dc21412e28c3a7914e9a97768fd Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 17:57:25 -0400
Subject: [PATCH] Optimize Chunk Unload Queue
@ -36,7 +36,7 @@ index 8b11266..ac35cf4 100644
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 450bf9b..f5a2580 100644
index 450bf9b..5485a66 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -21,7 +21,7 @@ import org.bukkit.event.world.ChunkUnloadEvent;
@ -147,7 +147,7 @@ index 450bf9b..f5a2580 100644
if (chunk.hasLightUpdates()) continue; // Paper - Don't unload chunks with pending light updates.
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
@@ -320,7 +340,7 @@ public class ChunkProviderServer implements IChunkProvider {
@@ -320,13 +340,18 @@ public class ChunkProviderServer implements IChunkProvider {
continue;
}
@ -156,7 +156,18 @@ index 450bf9b..f5a2580 100644
if (neighbor != null) {
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
@@ -362,4 +382,69 @@ public class ChunkProviderServer implements IChunkProvider {
}
}
}
+ // Paper start
+ } else {
+ // Unload event is cancelled, make sure this chunk is marked active
+ markChunkActive(chunk);
+ // Paper end
}
}
// CraftBukkit end
@@ -362,4 +387,69 @@ public class ChunkProviderServer implements IChunkProvider {
public boolean e(int i, int j) {
return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit
}
@ -240,7 +251,7 @@ index 63e118d..721bcae 100644
i += server.getChunkAt( x, z ).entityCount.get( oClass );
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f76ff72..c1cb133 100644
index d658fa2..0a3cfbc 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -159,9 +159,15 @@ public abstract class World implements IBlockAccess {