mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Update Spigot to version 1.5. By using this build you agree to the following terms: (read next line)
1) You will not hold SpigotMC responsible for any losses or damages incurred to you by using this build 2) You will report ALL bugs to SpigotMC and not other parties Thanks for all the support and all parties who made this update possible; especially the awesome Spigot community. Sorry for the delay, but we had to fix some crucial bugs. Regressions in this commit: @mikeprimm's smarter chunk ticking patch has been removed as it prevents proper redstone and other block ticking logic. By: md_5 <md_5@live.com.au>
This commit is contained in:
parent
78b59cb9ef
commit
5e01ba90c1
@ -1,6 +1,6 @@
|
||||
From c9ed47ce088878a5e0fdaa3bcf635aa201a6fd82 Mon Sep 17 00:00:00 2001
|
||||
From fb119d1c590c5394eecadda95eeea26ccffc25be Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sat, 16 Mar 2013 10:10:46 +1100
|
||||
Date: Sat, 16 Mar 2013 10:13:29 +1100
|
||||
Subject: [PATCH] Spigot changes.
|
||||
|
||||
---
|
||||
@ -22,7 +22,7 @@ Subject: [PATCH] Spigot changes.
|
||||
src/main/java/net/minecraft/server/PlayerList.java | 10 +-
|
||||
.../net/minecraft/server/ThreadLoginVerifier.java | 21 +++
|
||||
src/main/java/net/minecraft/server/World.java | 152 ++++++++++++++++++---
|
||||
.../java/net/minecraft/server/WorldServer.java | 123 ++++++++++++++---
|
||||
.../java/net/minecraft/server/WorldServer.java | 36 ++++-
|
||||
.../java/org/bukkit/craftbukkit/CraftServer.java | 45 +++---
|
||||
.../java/org/bukkit/craftbukkit/CraftWorld.java | 76 ++++++++++-
|
||||
src/main/java/org/bukkit/craftbukkit/Spigot.java | 20 +++
|
||||
@ -32,7 +32,7 @@ Subject: [PATCH] Spigot changes.
|
||||
.../org/bukkit/craftbukkit/util/LongHashSet.java | 11 +-
|
||||
.../bukkit/craftbukkit/util/LongObjectHashMap.java | 5 +
|
||||
src/main/resources/configurations/bukkit.yml | 27 ++++
|
||||
28 files changed, 557 insertions(+), 97 deletions(-)
|
||||
28 files changed, 488 insertions(+), 79 deletions(-)
|
||||
create mode 100644 src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
create mode 100644 src/main/java/org/bukkit/craftbukkit/util/FlatMap.java
|
||||
|
||||
@ -710,7 +710,7 @@ index 9c39815..67f2560 100644
|
||||
entityhuman = (EntityHuman) this.players.get(i);
|
||||
j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5;
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index d99b6a3..b806bdf 100644
|
||||
index d99b6a3..34f7bb1 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -1,5 +1,7 @@
|
||||
@ -729,24 +729,6 @@ index d99b6a3..b806bdf 100644
|
||||
|
||||
import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.weather.LightningStrikeEvent;
|
||||
@@ -24,7 +27,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
private final MinecraftServer server;
|
||||
public EntityTracker tracker; // CraftBukkit - private final -> public
|
||||
private final PlayerChunkMap manager;
|
||||
- private Set L;
|
||||
+ private LongObjectHashMap<Set<NextTickListEntry>> L; // CraftBukkit - change to something chunk friendly
|
||||
private TreeSet M;
|
||||
public ChunkProviderServer chunkProviderServer;
|
||||
public boolean savingDisabled;
|
||||
@@ -53,7 +56,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
}
|
||||
|
||||
if (this.L == null) {
|
||||
- this.L = new HashSet();
|
||||
+ this.L = new LongObjectHashMap<Set<NextTickListEntry>>(); // CraftBukkit
|
||||
}
|
||||
|
||||
if (this.M == null) {
|
||||
@@ -277,15 +280,30 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
}
|
||||
|
||||
@ -788,7 +770,7 @@ index d99b6a3..b806bdf 100644
|
||||
- block.a(this, k2 + k, i3 + chunksection.d(), l2 + l, this.random);
|
||||
+ // Spigot start
|
||||
+ if (players < 1) {
|
||||
+ //grow fast if no players are in this chunk
|
||||
+ // grow fast if no players are in this chunk
|
||||
+ this.growthOdds = modifiedOdds;
|
||||
+ } else {
|
||||
+ this.growthOdds = 100;
|
||||
@ -800,146 +782,6 @@ index d99b6a3..b806bdf 100644
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -429,10 +457,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
nextticklistentry.a(j1);
|
||||
}
|
||||
|
||||
- if (!this.L.contains(nextticklistentry)) {
|
||||
- this.L.add(nextticklistentry);
|
||||
- this.M.add(nextticklistentry);
|
||||
- }
|
||||
+ // if (!this.L.contains(nextticklistentry)) {
|
||||
+ // this.L.add(nextticklistentry);
|
||||
+ // this.M.add(nextticklistentry);
|
||||
+ // }
|
||||
+ addNextTickIfNeeded(nextticklistentry); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,10 +473,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
nextticklistentry.a((long) i1 + this.worldData.getTime());
|
||||
}
|
||||
|
||||
- if (!this.L.contains(nextticklistentry)) {
|
||||
- this.L.add(nextticklistentry);
|
||||
- this.M.add(nextticklistentry);
|
||||
- }
|
||||
+ //if (!this.L.contains(nextticklistentry)) {
|
||||
+ // this.L.add(nextticklistentry);
|
||||
+ // this.M.add(nextticklistentry);
|
||||
+ //}
|
||||
+ addNextTickIfNeeded(nextticklistentry); // CraftBukkit
|
||||
}
|
||||
|
||||
public void tickEntities() {
|
||||
@@ -469,9 +499,9 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
public boolean a(boolean flag) {
|
||||
int i = this.M.size();
|
||||
|
||||
- if (i != this.L.size()) {
|
||||
- throw new IllegalStateException("TickNextTick list out of synch");
|
||||
- } else {
|
||||
+ //if (i != this.L.size()) { // Spigot
|
||||
+ // throw new IllegalStateException("TickNextTick list out of synch"); // Spigot
|
||||
+ //} else { // Spigot
|
||||
if (i > 1000) {
|
||||
// CraftBukkit start - if the server has too much to process over time, try to alleviate that
|
||||
if (i > 20 * 1000) {
|
||||
@@ -492,9 +522,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
break;
|
||||
}
|
||||
|
||||
- this.M.remove(nextticklistentry);
|
||||
- this.L.remove(nextticklistentry);
|
||||
- this.T.add(nextticklistentry);
|
||||
+ // Spigot start
|
||||
+ //this.M.remove(nextticklistentry);
|
||||
+ //this.L.remove(nextticklistentry);
|
||||
+ this.removeNextTickIfNeeded(nextticklistentry);
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
this.methodProfiler.b();
|
||||
@@ -536,10 +568,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
this.methodProfiler.b();
|
||||
this.T.clear();
|
||||
return !this.M.isEmpty();
|
||||
- }
|
||||
+ // } // Spigot
|
||||
}
|
||||
|
||||
public List a(Chunk chunk, boolean flag) {
|
||||
+ return this.getNextTickEntriesForChunk(chunk, flag); // Spigot
|
||||
+ /* Spigot start
|
||||
ArrayList arraylist = null;
|
||||
ChunkCoordIntPair chunkcoordintpair = chunk.l();
|
||||
int i = (chunkcoordintpair.x << 4) - 2;
|
||||
@@ -578,6 +612,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
}
|
||||
|
||||
return arraylist;
|
||||
+ // Spigot end */
|
||||
}
|
||||
|
||||
public void entityJoinedWorld(Entity entity, boolean flag) {
|
||||
@@ -648,7 +683,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
}
|
||||
|
||||
if (this.L == null) {
|
||||
- this.L = new HashSet();
|
||||
+ this.L = new LongObjectHashMap<Set<NextTickListEntry>>();
|
||||
}
|
||||
|
||||
if (this.M == null) {
|
||||
@@ -934,4 +969,48 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
return this.setTypeIdAndData(x, y, z, typeId, data, 3);
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Spigot start
|
||||
+ private void addNextTickIfNeeded(NextTickListEntry ent) {
|
||||
+ long coord = LongHash.toLong(ent.a >> 4, ent.c >> 4);
|
||||
+ Set<NextTickListEntry> chunkset = L.get(coord);
|
||||
+ if (chunkset == null) {
|
||||
+ chunkset = new HashSet<NextTickListEntry>();
|
||||
+ L.put(coord, chunkset);
|
||||
+ } else if (chunkset.contains(ent)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ chunkset.add(ent);
|
||||
+ M.add(ent);
|
||||
+ }
|
||||
+
|
||||
+ private void removeNextTickIfNeeded(NextTickListEntry ent) {
|
||||
+ long coord = LongHash.toLong(ent.a >> 4, ent.c >> 4);
|
||||
+ Set<NextTickListEntry> chunkset = L.get(coord);
|
||||
+ if (chunkset == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (chunkset.remove(ent)) {
|
||||
+ M.remove(ent);
|
||||
+ if (chunkset.isEmpty()) {
|
||||
+ L.remove(coord);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private List<NextTickListEntry> getNextTickEntriesForChunk(Chunk chunk, boolean remove) {
|
||||
+ long coord = LongHash.toLong(chunk.x, chunk.z);
|
||||
+ Set<NextTickListEntry> chunkset = L.get(coord);
|
||||
+ if (chunkset == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ List<NextTickListEntry> list = new ArrayList<NextTickListEntry>(chunkset);
|
||||
+ if (remove) {
|
||||
+ L.remove(coord);
|
||||
+ M.removeAll(list);
|
||||
+ chunkset.clear();
|
||||
+ }
|
||||
+ return list;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3775022..8f65601 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 597aeb82a73eed6c5c6af591427a7773fb707bf0 Mon Sep 17 00:00:00 2001
|
||||
From 4e69548e7279f907018b2d66fb5e074be25c6ee7 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Primm <mike@primmhome.com>
|
||||
Date: Wed, 20 Feb 2013 23:07:53 -0500
|
||||
Subject: [PATCH] Optimize getTileEntities performance
|
||||
@ -9,10 +9,10 @@ Avoid traversing tile entities for every loaded chunk
|
||||
1 file changed, 12 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
index 6ade608..d399e7b 100644
|
||||
index 957dbd9..b250438 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||
@@ -663,17 +663,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
@@ -655,17 +655,20 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
|
||||
|
||||
public List getTileEntities(int i, int j, int k, int l, int i1, int j1) {
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
34
pom.xml
Normal file
34
pom.xml
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Spigot-Parent</name>
|
||||
<description>Parent project for all Spigot modules.</description>
|
||||
<url>https://github.com/EcoCityCraft/Spigot</url>
|
||||
|
||||
<modules>
|
||||
<module>Spigot-Server</module>
|
||||
<module>Spigot-API</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>md_5-releases</id>
|
||||
<url>http://repo.md-5.net/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>md_5-snapshots</id>
|
||||
<url>http://repo.md-5.net/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
</project>
|
Loading…
Reference in New Issue
Block a user