summaryrefslogtreecommitdiffstats
path: root/nms-patches/WorldServer.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2015-04-13 11:04:38 +0100
committerThinkofdeath <thinkofdeath@spigotmc.org>2015-04-13 11:04:38 +0100
commit35d953bac8222289e039fb2c736020e94699c195 (patch)
tree4fffc9c38c225a2df579a852e601a41a7491553a /nms-patches/WorldServer.patch
parent501372f2c968a03be98e2d161c6228f4a5d856fb (diff)
downloadcraftbukkit-35d953bac8222289e039fb2c736020e94699c195.tar
craftbukkit-35d953bac8222289e039fb2c736020e94699c195.tar.gz
craftbukkit-35d953bac8222289e039fb2c736020e94699c195.tar.lz
craftbukkit-35d953bac8222289e039fb2c736020e94699c195.tar.xz
craftbukkit-35d953bac8222289e039fb2c736020e94699c195.zip
Replace the two nextTickList sets with a single one that combines both
Should prevent them from going out of sync
Diffstat (limited to 'nms-patches/WorldServer.patch')
-rw-r--r--nms-patches/WorldServer.patch125
1 files changed, 79 insertions, 46 deletions
diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch
index 9be99b44..4169daec 100644
--- a/nms-patches/WorldServer.patch
+++ b/nms-patches/WorldServer.patch
@@ -1,6 +1,6 @@
---- /home/matt/mc-dev-private//net/minecraft/server/WorldServer.java 2015-03-16 11:32:47.247153312 +0000
-+++ src/main/java/net/minecraft/server/WorldServer.java 2015-03-16 11:32:47.251153312 +0000
-@@ -16,11 +16,23 @@
+--- /home/matt/mc-dev-private//net/minecraft/server/WorldServer.java 2015-04-13 11:02:47.684046165 +0100
++++ src/main/java/net/minecraft/server/WorldServer.java 2015-04-13 11:02:47.688046165 +0100
+@@ -16,14 +16,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -11,6 +11,7 @@
+import org.bukkit.WeatherType;
+import org.bukkit.block.BlockState;
+import org.bukkit.craftbukkit.util.LongHash;
++import org.bukkit.craftbukkit.util.HashTreeSet;
+
+import org.bukkit.event.block.BlockFormEvent;
+import org.bukkit.event.weather.LightningStrikeEvent;
@@ -23,9 +24,14 @@
- private final EntityTracker tracker;
+ public EntityTracker tracker; // CraftBukkit - public, remove final
private final PlayerChunkMap manager;
- private final Set<NextTickListEntry> L = Sets.newHashSet();
- private final TreeSet<NextTickListEntry> M = new TreeSet();
-@@ -37,14 +49,22 @@
+- private final Set<NextTickListEntry> L = Sets.newHashSet();
+- private final TreeSet<NextTickListEntry> M = new TreeSet();
++ // private final Set<NextTickListEntry> L = Sets.newHashSet(); // CraftBukkit, PAIL: Rename nextTickListHash
++ private final HashTreeSet<NextTickListEntry> M = new HashTreeSet<NextTickListEntry>(); // CraftBukkit - HashTreeSet, PAIL: Rename nextTickList
+ private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
+ public ChunkProviderServer chunkProviderServer;
+ public boolean savingDisabled;
+@@ -37,14 +50,22 @@
private static final List<StructurePieceTreasure> U = Lists.newArrayList(new StructurePieceTreasure[] { new StructurePieceTreasure(Items.STICK, 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.PLANKS), 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG), 0, 1, 3, 10), new StructurePieceTreasure(Items.STONE_AXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOODEN_AXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.STONE_PICKAXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOODEN_PICKAXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.APPLE, 0, 2, 3, 5), new StructurePieceTreasure(Items.BREAD, 0, 2, 3, 3), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG2), 0, 1, 3, 10)});
private List<NextTickListEntry> V = Lists.newArrayList();
@@ -51,7 +57,7 @@
this.B();
this.C();
this.getWorldBorder().a(minecraftserver.aH());
-@@ -63,6 +83,7 @@
+@@ -63,6 +84,7 @@
this.villages.a((World) this);
}
@@ -59,7 +65,7 @@
this.scoreboard = new ScoreboardServer(this.server);
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) this.worldMaps.get(PersistentScoreboard.class, "scoreboard");
-@@ -73,6 +94,11 @@
+@@ -73,6 +95,11 @@
persistentscoreboard.a(this.scoreboard);
((ScoreboardServer) this.scoreboard).a(persistentscoreboard);
@@ -71,7 +77,7 @@
this.getWorldBorder().setCenter(this.worldData.C(), this.worldData.D());
this.getWorldBorder().setDamageAmount(this.worldData.I());
this.getWorldBorder().setDamageBuffer(this.worldData.H());
-@@ -84,9 +110,98 @@
+@@ -84,9 +111,98 @@
this.getWorldBorder().setSize(this.worldData.E());
}
@@ -170,7 +176,7 @@
public void doTick() {
super.doTick();
if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) {
-@@ -104,9 +219,11 @@
+@@ -104,9 +220,11 @@
this.e();
}
@@ -185,7 +191,7 @@
}
this.methodProfiler.c("chunkSource");
-@@ -135,6 +252,8 @@
+@@ -135,6 +253,8 @@
this.Q.a(this.getTime());
this.methodProfiler.b();
this.ak();
@@ -194,7 +200,7 @@
}
public BiomeBase.BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) {
-@@ -161,7 +280,7 @@
+@@ -161,7 +281,7 @@
if (entityhuman.v()) {
++i;
@@ -203,7 +209,7 @@
++j;
}
}
-@@ -187,25 +306,46 @@
+@@ -187,25 +307,46 @@
}
private void ag() {
@@ -244,7 +250,7 @@
entityhuman = (EntityHuman) iterator.next();
- } while (!entityhuman.v() && entityhuman.isDeeplySleeping());
-+
++
+ // CraftBukkit start
+ if (entityhuman.isDeeplySleeping()) {
+ foundActualSleepers = true;
@@ -254,7 +260,7 @@
return false;
} else {
-@@ -228,13 +368,20 @@
+@@ -228,13 +369,20 @@
int i = 0;
int j = 0;
@@ -280,7 +286,7 @@
this.a(k, l, chunk);
this.methodProfiler.c("tickChunk");
-@@ -260,11 +407,29 @@
+@@ -260,11 +408,29 @@
BlockPosition blockposition1 = blockposition.down();
if (this.w(blockposition1)) {
@@ -312,7 +318,28 @@
}
if (this.S() && this.getBiome(blockposition1).e()) {
-@@ -383,7 +548,7 @@
+@@ -359,8 +525,8 @@
+ nextticklistentry.a(j);
+ }
+
+- if (!this.L.contains(nextticklistentry)) {
+- this.L.add(nextticklistentry);
++ // CraftBukkit - use M, PAIL: Rename nextTickList
++ if (!this.M.contains(nextticklistentry)) {
+ this.M.add(nextticklistentry);
+ }
+ }
+@@ -375,15 +541,15 @@
+ nextticklistentry.a((long) i + this.worldData.getTime());
+ }
+
+- if (!this.L.contains(nextticklistentry)) {
+- this.L.add(nextticklistentry);
++ // CraftBukkit - use M, PAIL: Rename nextTickList
++ if (!this.M.contains(nextticklistentry)) {
+ this.M.add(nextticklistentry);
+ }
+
}
public void tickEntities() {
@@ -321,7 +348,12 @@
if (this.emptyTime++ >= 1200) {
return;
}
-@@ -408,7 +573,13 @@
+@@ -404,11 +570,17 @@
+ } else {
+ int i = this.M.size();
+
+- if (i != this.L.size()) {
++ if (false) { // CraftBukkit
throw new IllegalStateException("TickNextTick list out of synch");
} else {
if (i > 1000) {
@@ -336,25 +368,26 @@
}
this.methodProfiler.a("cleaning");
-@@ -477,7 +648,9 @@
- for (int i = 0; i < 2; ++i) {
- Iterator iterator;
-
-+ boolean remove = false; // CraftBukkit
- if (i == 0) {
-+ remove = true; // CraftBukkit
- iterator = this.M.iterator();
- } else {
- iterator = this.V.iterator();
-@@ -492,6 +665,7 @@
+@@ -421,8 +593,8 @@
+ break;
+ }
+
++ // CraftBukkit - use M, PAIL: Rename nextTickList
+ this.M.remove(nextticklistentry);
+- this.L.remove(nextticklistentry);
+ this.V.add(nextticklistentry);
+ }
+
+@@ -492,7 +664,7 @@
if (blockposition.getX() >= structureboundingbox.a && blockposition.getX() < structureboundingbox.d && blockposition.getZ() >= structureboundingbox.c && blockposition.getZ() < structureboundingbox.f) {
if (flag) {
-+ if (remove) // CraftBukkit
- this.L.remove(nextticklistentry);
+- this.L.remove(nextticklistentry);
++ // CraftBukkit - use M
iterator.remove();
}
-@@ -508,6 +682,7 @@
+
+@@ -508,6 +680,7 @@
return arraylist;
}
@@ -362,7 +395,7 @@
public void entityJoinedWorld(Entity entity, boolean flag) {
if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
-@@ -519,6 +694,7 @@
+@@ -519,6 +692,7 @@
super.entityJoinedWorld(entity, flag);
}
@@ -370,7 +403,7 @@
private boolean getSpawnNPCs() {
return this.server.getSpawnNPCs();
-@@ -531,13 +707,43 @@
+@@ -531,13 +705,43 @@
protected IChunkProvider k() {
IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider);
@@ -415,7 +448,7 @@
for (int k1 = 0; k1 < this.h.size(); ++k1) {
TileEntity tileentity = (TileEntity) this.h.get(k1);
BlockPosition blockposition = tileentity.getPosition();
-@@ -546,6 +752,8 @@
+@@ -546,6 +750,8 @@
arraylist.add(tileentity);
}
}
@@ -424,7 +457,7 @@
return arraylist;
}
-@@ -609,6 +817,23 @@
+@@ -609,6 +815,23 @@
int j = this.worldProvider.getSeaLevel();
int k = 0;
@@ -448,7 +481,7 @@
if (blockposition != null) {
i = blockposition.getX();
k = blockposition.getZ();
-@@ -618,7 +843,7 @@
+@@ -618,7 +841,7 @@
int l = 0;
@@ -457,7 +490,7 @@
i += random.nextInt(64) - random.nextInt(64);
k += random.nextInt(64) - random.nextInt(64);
++l;
-@@ -657,6 +882,7 @@
+@@ -657,6 +880,7 @@
public void save(boolean flag, IProgressUpdate iprogressupdate) throws ExceptionWorldConflict {
if (this.chunkProvider.canSave()) {
@@ -465,7 +498,7 @@
if (iprogressupdate != null) {
iprogressupdate.a("Saving level");
}
-@@ -667,7 +893,8 @@
+@@ -667,7 +891,8 @@
}
this.chunkProvider.saveChunks(flag, iprogressupdate);
@@ -475,7 +508,7 @@
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
-@@ -698,8 +925,12 @@
+@@ -698,8 +923,12 @@
this.worldData.k(this.getWorldBorder().getWarningTime());
this.worldData.b(this.getWorldBorder().j());
this.worldData.e(this.getWorldBorder().i());
@@ -489,7 +522,7 @@
}
protected void a(Entity entity) {
-@@ -731,8 +962,16 @@
+@@ -731,8 +960,16 @@
}
public boolean strikeLightning(Entity entity) {
@@ -507,7 +540,7 @@
return true;
} else {
return false;
-@@ -744,10 +983,20 @@
+@@ -744,10 +981,20 @@
}
public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) {
@@ -528,7 +561,7 @@
if (!flag1) {
explosion.clearBlocks();
}
-@@ -793,7 +1042,8 @@
+@@ -793,7 +1040,8 @@
BlockActionData blockactiondata = (BlockActionData) iterator.next();
if (this.a(blockactiondata)) {
@@ -538,7 +571,7 @@
}
}
-@@ -816,6 +1066,7 @@
+@@ -816,6 +1064,7 @@
boolean flag = this.S();
super.p();
@@ -546,7 +579,7 @@
if (this.o != this.p) {
this.server.getPlayerList().a(new PacketPlayOutGameStateChange(7, this.p), this.worldProvider.getDimension());
}
-@@ -834,6 +1085,21 @@
+@@ -834,6 +1083,21 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r));
}
@@ -568,7 +601,7 @@
}
-@@ -862,10 +1128,17 @@
+@@ -862,10 +1126,17 @@
}
public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) {