Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions Spigot-Server-Patches/0004-MC-Utils.patch
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
From 9e9204318a93e93baf42cab944f182a7d8c38d78 Mon Sep 17 00:00:00 2001
From 73d2ddd776712fc5317714a83c7150f1f95a8246 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils

Collection of utils to help reduce NMS diff

diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 00fb20d..030e4af 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -675,6 +675,13 @@ public class Chunk {
return !block.isTileEntity() ? null : ((ITileEntity) block).a(this.world, iblockdata.getBlock().toLegacyData(iblockdata));
}

+ // Paper start - OBFHELPER
+ @Nullable
+ public final TileEntity getTileEntityImmediately(BlockPosition pos) {
+ return a(pos, EnumTileEntityState.IMMEDIATE);
+ }
+ // Paper end
+
@Nullable
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
new file mode 100644
index 0000000..f059bc2
index 0000000..2724678
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -0,0 +1,185 @@
@@ -0,0 +1,197 @@
+package net.minecraft.server;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
Expand Down Expand Up @@ -195,6 +213,18 @@ index 0000000..f059bc2
+ public static void scheduleAsyncTask(Runnable run) {
+ asyncExecutor.execute(run);
+ }
+
+ @Nullable
+ public static TileEntityHopper getHopper(World world, BlockPosition pos) {
+ Chunk chunk = world.getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4);
+ if (chunk != null && chunk.getBlockData(pos).getBlock() == Blocks.HOPPER) {
+ TileEntity tileEntity = chunk.getTileEntityImmediately(pos);
+ if (tileEntity instanceof TileEntityHopper) {
+ return (TileEntityHopper) tileEntity;
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index c01cecb..7fa49dd 100644
Expand Down Expand Up @@ -237,5 +267,5 @@ index 256614d..e86ca6c 100644

public NBTTagList() {}
--
2.7.4 (Apple Git-66)
2.8.3

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From f739616fdab39b3ef5bdd9e64fdaf319f262026c Mon Sep 17 00:00:00 2001
From 4f42f838608bebcdeff9ad07b917eec2837cd1ab Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 15:08:03 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities


diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 00fb20d..5690e81 100644
index 030e4af..ab56040 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -721,6 +721,10 @@ public class Chunk {
@@ -728,6 +728,10 @@ public class Chunk {
tileentity.z();
this.tileEntities.put(blockposition, tileentity);
// CraftBukkit start
Expand All @@ -20,5 +20,5 @@ index 00fb20d..5690e81 100644
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
+ " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!");
--
2.8.2
2.8.3

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 1bba159601a998917f3ebe31c6b6642951a02ef7 Mon Sep 17 00:00:00 2001
From ac85cea2d386822bf5759cbea98e36e212b50baf Mon Sep 17 00:00:00 2001
From: CullanP <cullanpage@gmail.com>
Date: Thu, 3 Mar 2016 02:13:38 -0600
Subject: [PATCH] Avoid hopper searches if there are no items
Expand All @@ -14,7 +14,7 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear
Combined, this adds up a lot.

diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 3806def..acce7cb 100644
index 31992a6..67c9fef 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -47,6 +47,13 @@ public class Chunk {
Expand Down Expand Up @@ -59,7 +59,7 @@ index 3806def..acce7cb 100644
// Spigot start - decrement creature type count
// Keep this synced up with World.a(Class)
if (entity instanceof EntityInsentient) {
@@ -848,6 +869,15 @@ public class Chunk {
@@ -855,6 +876,15 @@ public class Chunk {
if (!this.entitySlices[k].isEmpty()) {
Iterator iterator = this.entitySlices[k].iterator();

Expand All @@ -75,7 +75,7 @@ index 3806def..acce7cb 100644
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();

@@ -880,7 +910,18 @@ public class Chunk {
@@ -887,7 +917,18 @@ public class Chunk {
i = MathHelper.clamp(i, 0, this.entitySlices.length - 1);
j = MathHelper.clamp(j, 0, this.entitySlices.length - 1);

Expand All @@ -95,5 +95,5 @@ index 3806def..acce7cb 100644

while (iterator.hasNext()) {
--
2.8.2
2.8.3

4 changes: 2 additions & 2 deletions Spigot-Server-Patches/0062-Expose-server-CommandMap.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From ef4ff54759bcfc8a1002c2bec92d661542798468 Mon Sep 17 00:00:00 2001
From 83e8c9c450f8b47849440dad6ea2b7c7a98cdd1b Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Thu, 3 Mar 2016 02:15:57 -0600
Subject: [PATCH] Expose server CommandMap
Expand All @@ -17,5 +17,5 @@ index bc48cf6..47851c1 100644
return commandMap;
}
--
2.8.2
2.8.3

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From d161119c1c5608813fb96a56afc6ab967c087faf Mon Sep 17 00:00:00 2001
From 979cee973c90861e4e336dd2b80033f7c1acc24a Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Thu, 3 Mar 2016 02:18:39 -0600
Subject: [PATCH] Be a bit more informative in maxHealth exception
Expand All @@ -21,5 +21,5 @@ index e662e4a..f13ca63 100644

if (entity instanceof EntityPlayer && health == 0) {
--
2.8.2
2.8.3

10 changes: 5 additions & 5 deletions Spigot-Server-Patches/0071-Add-exception-reporting-event.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 46b6f1db57959a42d8f67fbbbb8c7e2f2a8de68f Mon Sep 17 00:00:00 2001
From cb04f99e741cd68a4522fbdcd052250ee8991aec Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 03:15:41 -0600
Subject: [PATCH] Add exception reporting event
Expand Down Expand Up @@ -50,7 +50,7 @@ index 0000000..9339718
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index acce7cb..b39960a 100644
index 67c9fef..b6408bd 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1,5 +1,6 @@
Expand All @@ -68,7 +68,7 @@ index acce7cb..b39960a 100644

public class Chunk {

@@ -763,10 +765,15 @@ public class Chunk {
@@ -770,10 +772,15 @@ public class Chunk {
this.tileEntities.remove(blockposition);
// Paper end
} else {
Expand Down Expand Up @@ -292,7 +292,7 @@ index 26d7d12..fcd2ddf 100644
}

diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 26352d2..ccbfda0 100644
index 0258f4b..e092ba5 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1,5 +1,7 @@
Expand Down Expand Up @@ -372,5 +372,5 @@ index 2a22697..d82dddf 100644
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
--
2.8.2.windows.1
2.8.3

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 072fc0b7c6a6bc4d38bbd078405d29255b5f4a9a Mon Sep 17 00:00:00 2001
From 9628fd1e52e46907ccfa12546115afc7ca5b3af8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:46:14 -0400
Subject: [PATCH] Configurable Chunk Inhabited Timer
Expand All @@ -23,10 +23,10 @@ index a97eee7..8966b4a 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 98d9e99..7144227 100644
index 465638c..bcd0fcd 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1371,7 +1371,7 @@ public class Chunk {
@@ -1378,7 +1378,7 @@ public class Chunk {
}

public long x() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 17e02093634440f31ef3ddc7ee91b3b3a5b21dea Mon Sep 17 00:00:00 2001
From 48e9c2fb6601c2d0f244c15f9a658ee13f5196fb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 22:03:09 -0400
Subject: [PATCH] Prevent Waterflow BlockFromToEvent from loading chunks
Expand Down Expand Up @@ -48,5 +48,5 @@ index 2eb8622..4ff7635 100644
if (this.material == Material.LAVA) {
this.fizz(world, blockposition);
--
2.8.2
2.8.3

Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
From a7138126f853f5b09a48a0e348dbaf7dd93c39a8 Mon Sep 17 00:00:00 2001
From 16b5efc6d5910d4e79e28914acd29aeb9d6cb410 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 12 May 2016 01:55:17 -0400
Subject: [PATCH] Do not mark chunks as active for neighbor updates

Fixes chunk unload issues

diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 904141a..d7b9581 100644
index 3ef781e..1f596eb 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -991,25 +991,25 @@ public class Chunk {
@@ -998,25 +998,25 @@ public class Chunk {

public void loadNearby(IChunkProvider ichunkprovider, ChunkGenerator chunkgenerator) {
world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot
Expand Down Expand Up @@ -109,5 +109,5 @@ index 7b61b14..7752b50 100644
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
--
2.7.4 (Apple Git-66)
2.8.3

Loading