3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-16 11:30:06 +01:00

Upstream changes

Dieser Commit ist enthalten in:
Zach Brown 2016-03-17 23:29:51 -05:00
Ursprung 409596021c
Commit ca2ddce0ac
4 geänderte Dateien mit 99 neuen und 92 gelöschten Zeilen

2
Bukkit

@ -1 +1 @@
Subproject commit 6e846a5517443fddf08133186e439f4c121b2386
Subproject commit 60289d346ec1b74832965d470bfef515f936222b

@ -1 +1 @@
Subproject commit 8b69bdd0d1c4a6f6cfc32e60e30751f5f6440ce7
Subproject commit a12b1a47706a53b06ca18ae4ae9f696ea5699f3a

Datei anzeigen

@ -1,4 +1,4 @@
From 7fe07e6b89792e266ed03fcf78705708ada7bf58 Mon Sep 17 00:00:00 2001
From 93c3ea89eb16b2069bf0f078276f208780ea2920 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Mon, 29 Feb 2016 21:09:10 -0600
Subject: [PATCH] mc-dev imports
@ -4386,6 +4386,87 @@ index 0000000..b94444d
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java
new file mode 100644
index 0000000..4733f94
--- /dev/null
+++ b/src/main/java/net/minecraft/server/FileIOThread.java
@@ -0,0 +1,75 @@
+package net.minecraft.server;
+
+import com.google.common.collect.Lists;
+import java.util.Collections;
+import java.util.List;
+
+public class FileIOThread implements Runnable {
+
+ private static final FileIOThread a = new FileIOThread();
+ private List<IAsyncChunkSaver> b = Collections.synchronizedList(Lists.newArrayList());
+ private volatile long c;
+ private volatile long d;
+ private volatile boolean e;
+
+ private FileIOThread() {
+ Thread thread = new Thread(this, "File IO Thread");
+
+ thread.setPriority(1);
+ thread.start();
+ }
+
+ public static FileIOThread a() {
+ return FileIOThread.a;
+ }
+
+ public void run() {
+ while (true) {
+ this.c();
+ }
+ }
+
+ private void c() {
+ for (int i = 0; i < this.b.size(); ++i) {
+ IAsyncChunkSaver iasyncchunksaver = (IAsyncChunkSaver) this.b.get(i);
+ boolean flag = iasyncchunksaver.c();
+
+ if (!flag) {
+ this.b.remove(i--);
+ ++this.d;
+ }
+
+ try {
+ Thread.sleep(this.e ? 0L : 10L);
+ } catch (InterruptedException interruptedexception) {
+ interruptedexception.printStackTrace();
+ }
+ }
+
+ if (this.b.isEmpty()) {
+ try {
+ Thread.sleep(25L);
+ } catch (InterruptedException interruptedexception1) {
+ interruptedexception1.printStackTrace();
+ }
+ }
+
+ }
+
+ public void a(IAsyncChunkSaver iasyncchunksaver) {
+ if (!this.b.contains(iasyncchunksaver)) {
+ ++this.c;
+ this.b.add(iasyncchunksaver);
+ }
+ }
+
+ public void b() throws InterruptedException {
+ this.e = true;
+
+ while (this.c != this.d) {
+ Thread.sleep(10L);
+ }
+
+ this.e = false;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
new file mode 100644
index 0000000..300573a
@ -4771,81 +4852,6 @@ index 0000000..2f4265a
+ return this.b.getType(blockposition.down()).b();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NavigationListener.java b/src/main/java/net/minecraft/server/NavigationListener.java
new file mode 100644
index 0000000..f82ea80
--- /dev/null
+++ b/src/main/java/net/minecraft/server/NavigationListener.java
@@ -0,0 +1,69 @@
+package net.minecraft.server;
+
+import java.util.WeakHashMap;
+
+public class NavigationListener implements IWorldAccess {
+
+ private static final Object a = new Object();
+ private final WeakHashMap<NavigationAbstract, Object> b = new WeakHashMap();
+
+ public NavigationListener() {}
+
+ public void a(NavigationAbstract navigationabstract) {
+ this.b.put(navigationabstract, NavigationListener.a);
+ }
+
+ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) {
+ if (this.a(world, blockposition, iblockdata, iblockdata1)) {
+ NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]);
+ NavigationAbstract[] anavigationabstract1 = anavigationabstract;
+ int j = anavigationabstract.length;
+
+ for (int k = 0; k < j; ++k) {
+ NavigationAbstract navigationabstract = anavigationabstract1[k];
+
+ if (navigationabstract != null && !navigationabstract.i()) {
+ PathEntity pathentity = navigationabstract.k();
+
+ if (pathentity != null && !pathentity.b() && pathentity.d() != 0) {
+ PathPoint pathpoint = navigationabstract.c.c();
+ double d0 = blockposition.distanceSquared(((double) pathpoint.a + navigationabstract.a.locX) / 2.0D, ((double) pathpoint.b + navigationabstract.a.locY) / 2.0D, ((double) pathpoint.c + navigationabstract.a.locZ) / 2.0D);
+ int l = (pathentity.d() - pathentity.e()) * (pathentity.d() - pathentity.e());
+
+ if (d0 < (double) l) {
+ navigationabstract.j();
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+ protected boolean a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {
+ AxisAlignedBB axisalignedbb = iblockdata.d(world, blockposition);
+ AxisAlignedBB axisalignedbb1 = iblockdata1.d(world, blockposition);
+
+ return axisalignedbb != axisalignedbb1 && (axisalignedbb == null || !axisalignedbb.equals(axisalignedbb1));
+ }
+
+ public void a(BlockPosition blockposition) {}
+
+ public void a(int i, int j, int k, int l, int i1, int j1) {}
+
+ public void a(EntityHuman entityhuman, SoundEffect soundeffect, SoundCategory soundcategory, double d0, double d1, double d2, float f, float f1) {}
+
+ public void a(int i, boolean flag, double d0, double d1, double d2, double d3, double d4, double d5, int... aint) {}
+
+ public void a(Entity entity) {}
+
+ public void b(Entity entity) {}
+
+ public void a(SoundEffect soundeffect, BlockPosition blockposition) {}
+
+ public void a(int i, BlockPosition blockposition, int j) {}
+
+ public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {}
+
+ public void b(int i, BlockPosition blockposition, int j) {}
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayInResourcePackStatus.java b/src/main/java/net/minecraft/server/PacketPlayInResourcePackStatus.java
new file mode 100644
index 0000000..30ca225
@ -5152,5 +5158,5 @@ index 0000000..2286c9e
+ }
+}
--
2.7.2
2.7.3

Datei anzeigen

@ -1,4 +1,4 @@
From b5971e8a4cb89311fc6624431b159c526e8c343e Mon Sep 17 00:00:00 2001
From 43f79313160aa6461b4ee989f4fb2464ab9f1a4c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 8 Mar 2016 19:13:54 -0500
Subject: [PATCH] Optimize Navigation Listener
@ -32,10 +32,10 @@ index 7d794b9..aa18f54 100644
protected abstract Pathfinder a();
diff --git a/src/main/java/net/minecraft/server/NavigationListener.java b/src/main/java/net/minecraft/server/NavigationListener.java
index f82ea80..aade479 100644
index 39a4032..18536b5 100644
--- a/src/main/java/net/minecraft/server/NavigationListener.java
+++ b/src/main/java/net/minecraft/server/NavigationListener.java
@@ -1,26 +1,32 @@
@@ -1,16 +1,19 @@
package net.minecraft.server;
+import java.util.ArrayList; // Paper
@ -57,22 +57,23 @@ index f82ea80..aade479 100644
}
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) {
if (this.a(world, blockposition, iblockdata, iblockdata1)) {
+ /* // Paper start
NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]);
NavigationAbstract[] anavigationabstract1 = anavigationabstract;
int j = anavigationabstract.length;
@@ -19,10 +22,12 @@ public class NavigationListener implements IWorldAccess {
// NavigationAbstract[] anavigationabstract = (NavigationAbstract[]) this.b.keySet().toArray(new NavigationAbstract[0]);
// NavigationAbstract[] anavigationabstract1 = anavigationabstract;
// int j = anavigationabstract.length;
+ // Spigot end
- for (int k = 0; k < j; ++k) {
- NavigationAbstract navigationabstract = anavigationabstract1[k];
+ */
- for (NavigationAbstract navigationabstract : this.b.keySet()) {
- // NavigationAbstract navigationabstract = anavigationabstract1[k];
- // Spigot end
+ // Paper start
+ for (int k = 0; k < this.navigators.size(); ++k) {
+ NavigationAbstract navigationabstract = this.navigators.get(k);
+ // Paper end
if (navigationabstract != null && !navigationabstract.i()) {
PathEntity pathentity = navigationabstract.k();
@@ -55,9 +61,21 @@ public class NavigationListener implements IWorldAccess {
@@ -57,9 +62,21 @@ public class NavigationListener implements IWorldAccess {
public void a(int i, boolean flag, double d0, double d1, double d2, double d3, double d4, double d5, int... aint) {}
@ -97,5 +98,5 @@ index f82ea80..aade479 100644
public void a(SoundEffect soundeffect, BlockPosition blockposition) {}
--
2.7.2
2.7.3