Compare commits

...

28 commits

Author SHA1 Message Date
sulu5890
e5dbeaf248
Update Log4J (1.13.2) (#7155)
* Update Log4j

* update log4j (again)
2021-12-19 16:10:29 -08:00
Andrew Mollenkamp
5c03bfdac2 Backport Do less work if we have a custom Bukkit generator (#2873) 2020-01-18 13:07:43 -06:00
Mark Vainomaa
f28cd66538 Fix dupe with Eigencraft redstone implementation (#2867) 2020-01-16 20:14:29 -06:00
Mat
3adc8eb6e6 Backport disconnect exploit fixes to 1.13.2 (#2768) 2019-12-23 01:31:19 -06:00
William Blake Galbreath
e38aa244d4
Expose the internal current tick 2019-10-30 17:42:53 +00:00
Andrew Steinborn
26c863d3c2 Really fix JLine on Windows (#2633)
The history of how paths work in Win32 is a sad story and shall not be documented here.
Needless to say, Windows hates the temporary file name for jansi's native code since it
includes the version. For git builds, it includes quotes around the actual version. But
alas, the issue apparently doesn't occur if you build on Windows since it removes the
quotes from the git commandline that is ultimately used to build the version string,
because of more Win32 sadness and shame.

Go look at Raymond Chen's blog, The Old New Thing. It's full of Windows oddities and
it will make you want to weep because almost 90% of the world uses this legacy OS from
the 1980s.
2019-10-13 16:18:14 -05:00
Zach Brown
fee70e2178
Name the specific plugin generator class that isn't updated
Makes it easier to figure out which custom generator plugin hasn't been
updated to a specific version and is spamming you with
UnsupportedOperationExceptions
2019-10-02 21:28:12 -05:00
Omer Uddin
e1ceb8e148
Don't save canTick of armor stands if it has not been set by API (#2608) 2019-10-02 20:59:04 -05:00
Zach Brown
2153ca474d
Allow running on Java 13 2019-09-24 19:55:02 -05:00
Andrew Mollenkamp
26ec2f97e9 Fix shulker bullets exploding immediatly (#2536) 2019-09-21 22:48:50 -05:00
Kyle Wood
e0532a7aa7
Update Paperclip 2019-09-21 16:47:18 -05:00
Kyle Wood
f1114aa447
Update Paperclip, remove json dependency in paperclip (master) 2019-09-01 20:16:05 -05:00
Nassim
98e50a58ca Fix sign line capping check (master) (#2525) 2019-09-01 17:18:35 -05:00
Spottedleaf
60da3f17d6 Fix flag for whether to override version check (#2502) 2019-08-24 16:43:46 -05:00
Tom
0a7a855591
Don't use streams for VoxelShape calls
From GH-2355
2019-08-10 10:42:05 -05:00
Zach Brown
75dd53c6ca
Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game immediately stop the server to prevent data corruption.

You can override this functionality at your own peril.
2019-07-23 20:46:56 -05:00
Lucavon
de6476fab3
Add option to disable relative projectile velocity
Allows server owners to use 1.8 (and prior)'s projectile behavior
(ignored shooter's velocity when calculating projectile's velocity).

This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.

While this could easily be done with plugins, too, there are multiple problems:
1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
   from the projectile's velocity, the projectile's velocity would be different.
   As there's no way to detect whether the projectile's velocity has already been
   adjusted to ignore the player's velocity, plugins can't not do it if it's not
   necessary.
2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
   using an elytra. Checking for those inconsistencies is possible, but not as
   efficient as just not applying the velocity in the first place.
3) Solutions for 1) and especially 2) might not be future-proof, while this
   server-internal fix makes this change future-proof.
2019-07-23 19:55:10 -05:00
Omer Uddin
58bc259a18 Update 0280-Configurable-Bed-Search-Radius.patch (#2260) 2019-07-13 17:49:59 -05:00
Spottedleaf
8d6ef3025b Fix error in patch 'Optimize getChunkIfLoaded type calls' (#2295)
We were not correctly updating neighbour loaded when we unloaded chunks
since we were not actually retrieving neighbour chunks when unloading.

Thanks to Aikar to pointing this out here:
https://github.com/PaperMC/Paper/pulls#issuecomment-505573519
2019-07-08 02:18:58 -05:00
kashike
21a1674249
Merge pull request #2263 from Spottedleaf/fix-logging1
Queue log events when log buffer is full
2019-06-29 21:09:31 -07:00
Spottedleaf
73e3c1144d Queue log events when log buffer is full
This should resolve out of order logs when the buffer is full
2019-06-29 20:40:23 -07:00
Zach Brown
4180819fc0
Update Paperclip for Java 12 dev support 2019-06-24 22:31:20 -05:00
William Blake Galbreath
1b59bbbc7c
Rework fix for MC-114618 so not break map maker's workflow. Fixes #2221 2019-06-24 20:40:43 -05:00
Spottedleaf
725081bb95 Anti-Xray improvements (#2227) 2019-06-24 08:00:26 -05:00
Spottedleaf
35e71bbc9c Only write to cached header in RegionFile if write potentially succeeds (#2212)
* Only write to cached header in RegionFile if write potentially succeeds

* Fail write if timestamp update fails

This way timestamps should be consistent with their actual last write.

* Simply order the time write before the chunk write

otherwise we end up with an invalid offset on disk, it's better
to have an invalid timestamp
2019-06-22 15:27:52 -05:00
kashike
601fcb85b6
Merge pull request #2184 from darbyjack/master
Fixed 1.13 not properly firing the PreCreatureSpawnEvent (credit to Wiz)
2019-06-15 13:30:38 -07:00
darbyjack
6e5c731ec7
Fixed 1.13 not properly firing the PreCreatureSpawnEvent 2019-06-15 01:36:24 -05:00
Shane Freeder
df9c322286
Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
84f3da35 SPIGOT-5054: Prevent issue with invalid hanging entities
dfa7583f SPIGOT-4734: Sign placement fails when looking at grass
2019-06-12 10:04:13 +01:00
33 changed files with 1195 additions and 234 deletions

View file

@ -0,0 +1,26 @@
From 33d30a4d9fb9124f46d6bac21f5f8d6f7fbb2ff7 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Wed, 2 Oct 2019 21:24:28 -0500
Subject: [PATCH] Name the specific custom world gen plugin class that throws a
UOE
diff --git a/src/main/java/org/bukkit/generator/ChunkGenerator.java b/src/main/java/org/bukkit/generator/ChunkGenerator.java
index 9a18a05b..ccac5710 100644
--- a/src/main/java/org/bukkit/generator/ChunkGenerator.java
+++ b/src/main/java/org/bukkit/generator/ChunkGenerator.java
@@ -76,7 +76,10 @@ public abstract class ChunkGenerator {
*/
@NotNull
public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z, @NotNull BiomeGrid biome) {
- throw new UnsupportedOperationException("Custom generator is missing required method generateChunkData");
+ // Paper start - More helpful custom chunk gen exceptions
+ final String generatorClass = world.getGenerator() != null ? world.getGenerator().getClass().getName() : "null";
+ throw new UnsupportedOperationException("Custom generator is missing required method generateChunkData: " + generatorClass);
+ // Paper end
}
/**
--
2.23.0

View file

@ -0,0 +1,41 @@
From 02ea1aa9dda3125c29a1bcdfb5b5a3c76e4d2f6b Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 20 Apr 2019 19:47:29 -0500
Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index ca88f0a3..4b0c0dcb 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1629,6 +1629,10 @@ public final class Bukkit {
public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
return server.createProfile(uuid, name);
}
+
+ public static int getCurrentTick() {
+ return server.getCurrentTick();
+ }
// Paper end
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 697ff748..6be7e399 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1424,5 +1424,12 @@ public interface Server extends PluginMessageRecipient {
*/
@NotNull
com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name);
+
+ /**
+ * Get the current internal server tick
+ *
+ * @return Current tick
+ */
+ int getCurrentTick();
// Paper end
}
--
2.23.0

View file

@ -1,4 +1,4 @@
From acf9c715648075076c1438814a611103748ec3a0 Mon Sep 17 00:00:00 2001
From 92fe4db1e3d4ad1435ad12587ccf2af74c0a515d 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
@ -277,7 +277,7 @@ index b8abd6363f..a07ee150c2 100644
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 9e763b6e39..a7fc148591 100644
index 3e9621aea2..6a85fecb79 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -36,10 +36,19 @@ import org.bukkit.event.world.StructureGrowEvent;
@ -301,7 +301,7 @@ index 9e763b6e39..a7fc148591 100644
@Deprecated
private Item item;
private NBTTagCompound tag;
@@ -590,6 +599,17 @@ public final class ItemStack {
@@ -593,6 +602,17 @@ public final class ItemStack {
return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList();
}
@ -319,7 +319,7 @@ index 9e763b6e39..a7fc148591 100644
public void setTag(@Nullable NBTTagCompound nbttagcompound) {
this.tag = nbttagcompound;
}
@@ -674,6 +694,7 @@ public final class ItemStack {
@@ -677,6 +697,7 @@ public final class ItemStack {
return this.tag != null && this.tag.hasKeyOfType("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false;
}
@ -327,7 +327,7 @@ index 9e763b6e39..a7fc148591 100644
public void a(String s, NBTBase nbtbase) {
this.getOrCreateTag().set(s, nbtbase);
}
@@ -747,6 +768,7 @@ public final class ItemStack {
@@ -750,6 +771,7 @@ public final class ItemStack {
// CraftBukkit start
@Deprecated
public void setItem(Item item) {

View file

@ -1,4 +1,4 @@
From 08653afb00866b63ce45e73d12eac4be100fe9f9 Mon Sep 17 00:00:00 2001
From c66fe6923ac746798de73d909fe6c62d8352bd06 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 May 2015 23:00:19 -0400
Subject: [PATCH] Handle Item Meta Inconsistencies
@ -18,7 +18,7 @@ For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's.
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index a7fc148591..37d37f1f64 100644
index 6a85fecb79..d8a5a78bdf 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -7,6 +7,8 @@ import com.mojang.brigadier.StringReader;
@ -61,7 +61,7 @@ index a7fc148591..37d37f1f64 100644
this.getItem().a(this.tag);
// CraftBukkit end
}
@@ -612,6 +631,7 @@ public final class ItemStack {
@@ -615,6 +634,7 @@ public final class ItemStack {
// Paper end
public void setTag(@Nullable NBTTagCompound nbttagcompound) {
this.tag = nbttagcompound;
@ -69,7 +69,7 @@ index a7fc148591..37d37f1f64 100644
}
public IChatBaseComponent getName() {
@@ -688,6 +708,7 @@ public final class ItemStack {
@@ -691,6 +711,7 @@ public final class ItemStack {
nbttagcompound.setString("id", String.valueOf(IRegistry.ENCHANTMENT.getKey(enchantment)));
nbttagcompound.setShort("lvl", (short) ((byte) i));
nbttaglist.add((NBTBase) nbttagcompound);

View file

@ -1,4 +1,4 @@
From b6d424028e3980f33b12cf8b24fc51eaf7f3a613 Mon Sep 17 00:00:00 2001
From 18d269264ab9d8f85258b52572ab5c03cb5e19dd Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 9 Jun 2017 19:03:43 +0200
Subject: [PATCH] Use TerminalConsoleAppender for console improvements
@ -19,7 +19,7 @@ Other changes:
configuration
diff --git a/pom.xml b/pom.xml
index 51cefc0a1b..2b73ec28a1 100644
index 51cefc0a1..2b73ec28a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,10 +41,27 @@
@ -75,7 +75,7 @@ index 51cefc0a1b..2b73ec28a1 100644
<groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
new file mode 100644
index 0000000000..688b4715eb
index 000000000..688b4715e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -0,0 +1,40 @@
@ -121,7 +121,7 @@ index 0000000000..688b4715eb
+}
diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
new file mode 100644
index 0000000000..685deaa0e5
index 000000000..685deaa0e
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
@@ -0,0 +1,17 @@
@ -143,7 +143,7 @@ index 0000000000..685deaa0e5
+
+}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 4e9ef43b45..5bb1ea880a 100644
index 4e9ef43b4..5bb1ea880 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -79,6 +79,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
@ -185,7 +185,7 @@ index 4e9ef43b45..5bb1ea880a 100644
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index db511c1fe8..c6ecdf6e8e 100644
index db511c1fe..c6ecdf6e8 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -56,7 +56,6 @@ import org.apache.commons.lang3.Validate;
@ -243,7 +243,7 @@ index db511c1fe8..c6ecdf6e8e 100644
public KeyPair E() {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 9d44dcb3b2..8bb3fef21e 100644
index 9d44dcb3b..8bb3fef21 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -77,8 +77,7 @@ public abstract class PlayerList {
@ -257,7 +257,7 @@ index 9d44dcb3b2..8bb3fef21e 100644
this.k = new GameProfileBanList(PlayerList.a);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 962170cd3f..7e4f42b3f4 100644
index 962170cd3..7e4f42b3f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -146,8 +146,8 @@ import java.nio.ByteBuffer;
@ -285,7 +285,7 @@ index 962170cd3f..7e4f42b3f4 100644
@Override
public PluginCommand getPluginCommand(String name) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 472a8070e7..4102e19700 100644
index 472a8070e..daab48ed3 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -14,7 +14,7 @@ import java.util.logging.Logger;
@ -325,9 +325,18 @@ index 472a8070e7..4102e19700 100644
}
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
@@ -226,7 +236,7 @@ public class Main {
System.out.println("Unable to read system info");
}
// Paper end
-
+ System.setProperty( "library.jansi.version", "Paper" ); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
System.out.println("Loading libraries, please wait...");
MinecraftServer.main(options);
} catch (Throwable t) {
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
deleted file mode 100644
index 26a2fb8942..0000000000
index 26a2fb894..000000000
--- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
+++ /dev/null
@@ -1,74 +0,0 @@
@ -406,7 +415,7 @@ index 26a2fb8942..0000000000
- }
-}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
index 33e8ea02c4..1e3aae3b8f 100644
index 33e8ea02c..1e3aae3b8 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java
@@ -8,17 +8,27 @@ import java.util.logging.Level;
@ -485,7 +494,7 @@ index 33e8ea02c4..1e3aae3b8f 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
index 984df4083d..bbb5a84f36 100644
index 984df4083..bbb5a84f3 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ServerShutdownThread.java
@@ -20,7 +20,7 @@ public class ServerShutdownThread extends Thread {
@ -499,7 +508,7 @@ index 984df4083d..bbb5a84f36 100644
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
deleted file mode 100644
index b640971130..0000000000
index b64097113..000000000
--- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleWriterThread.java
+++ /dev/null
@@ -1,54 +0,0 @@
@ -558,7 +567,7 @@ index b640971130..0000000000
- }
-}
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 5cee8f00ef..08b6bb7f97 100644
index 5cee8f00e..08b6bb7f9 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -1,12 +1,11 @@
@ -588,5 +597,5 @@ index 5cee8f00ef..08b6bb7f97 100644
<AppenderRef ref="TerminalConsole" level="info"/>
</Root>
--
2.21.0
2.22.0

View file

@ -1,4 +1,4 @@
From 4393dd1c81c81419675b7914dbd37b92a34352c0 Mon Sep 17 00:00:00 2001
From 91b78dfee6b8735566be835c37afd120db8fd7c3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:01:31 -0500
Subject: [PATCH] PreCreatureSpawnEvent
@ -15,7 +15,7 @@ instead and save a lot of server resources.
See: https://github.com/PaperMC/Paper/issues/917
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 027ba71918..eca3f85ad2 100644
index 027ba719..eca3f85a 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -1,6 +1,7 @@
@ -56,7 +56,7 @@ index 027ba71918..eca3f85ad2 100644
if (entity == null) {
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 2aa0db5c22..b57616960e 100644
index 2aa0db5c..61195134 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -164,10 +164,30 @@ public final class SpawnerCreature {
@ -70,7 +70,7 @@ index 2aa0db5c22..b57616960e 100644
+ // Paper start
+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+ EntityTypes<? extends EntityInsentient> cls = biomebase_biomemeta.b;
+ org.bukkit.entity.EntityType type = EntityTypes.clsToTypeMap.get(cls);
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(cls).getKey());
+ if (type != null) {
+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ MCUtil.toLocation(worldserver, blockposition_mutableblockposition),
@ -92,5 +92,5 @@ index 2aa0db5c22..b57616960e 100644
entityinsentient = (EntityInsentient) biomebase_biomemeta.b.a((World) worldserver);
} catch (Exception exception) {
--
2.21.0
2.21.0.windows.1

View file

@ -1,4 +1,4 @@
From c386a2b894d68b0d9cc0cd0710b616de0585cf4b Mon Sep 17 00:00:00 2001
From 0ca047e7ba84c89d31537209fd94925619ae983a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Jun 2018 23:00:29 -0400
Subject: [PATCH] ItemStack#getMaxItemUseDuration
@ -6,10 +6,10 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 927394333a..c1b6eb52bf 100644
index 7ef3a0d878..3926a57aad 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -548,6 +548,7 @@ public final class ItemStack {
@@ -551,6 +551,7 @@ public final class ItemStack {
this.getItem().b(this, world, entityhuman);
}

View file

@ -1,4 +1,4 @@
From f1cf963f3f14757f6fb2f07fe26fdd50e8201883 Mon Sep 17 00:00:00 2001
From fbc5aa049c925955355972e08ce896e10c5b4d3e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 15:22:06 -0400
Subject: [PATCH] Configurable Bed Search Radius
@ -10,7 +10,7 @@ player at their bed should it of became obstructed.
Defaults to vanilla 1.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index aa2be2ede6..f5b2e88f3b 100644
index aa2be2ed..f5b2e88f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -452,4 +452,15 @@ public class PaperWorldConfig {
@ -30,69 +30,120 @@ index aa2be2ede6..f5b2e88f3b 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java
index 06f627002c..d81a2db6cd 100644
index 06f62700..0ab2112c 100644
--- a/src/main/java/net/minecraft/server/BlockBed.java
+++ b/src/main/java/net/minecraft/server/BlockBed.java
@@ -187,6 +187,52 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
@@ -187,6 +187,10 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
@Nullable
public static BlockPosition a(IBlockAccess iblockaccess, BlockPosition blockposition, int i) {
EnumDirection enumdirection = (EnumDirection) iblockaccess.getType(blockposition).get(BlockBed.FACING);
+ // Paper - replace whole method
+ World world = (World) iblockaccess;
+ int radius = world.paperConfig.bedSearchRadius;
+ for (int r = 1; r <= radius; r++) {
+ int x = -r;
+ int z = r;
+
+ // Iterates the edge of half of the box; then negates for other half.
+ while (x <= r && z > -r) {
+ for (int y = -1; y <= 1; y++) {
+ BlockPosition pos = blockposition.add(x, y, z);
+ if (isSafeRespawn(world, pos)) {
+ if (i-- <= 0) {
+ return pos;
+ }
+ }
+ pos = blockposition.add(-x, y, -z);
+ if (isSafeRespawn(world, pos)) {
+ if (i-- <= 0) {
+ return pos;
+ }
+ }
+
+ pos = blockposition.add(enumdirection.getAdjacentX() + x, y, enumdirection.getAdjacentZ() + z);
+ if (isSafeRespawn(world, pos)) {
+ if (i-- <= 0) {
+ return pos;
+ }
+ }
+
+ pos = blockposition.add(enumdirection.getAdjacentX() - x, y, enumdirection.getAdjacentZ() - z);
+ if (isSafeRespawn(world, pos)) {
+ if (i-- <= 0) {
+ return pos;
+ }
+ }
+ }
+ if (x < r) {
+ x++;
+ } else {
+ z--;
+ }
+ }
+ }
+
+ return null; /* // Paper comment out
+ // Paper start - replace whole method
+ return findSafePosition((World)iblockaccess, enumdirection, blockposition);
+ }
+ /* // Paper comment out
int j = blockposition.getX();
int k = blockposition.getY();
int l = blockposition.getZ();
@@ -212,9 +258,12 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
@@ -212,9 +216,106 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
}
}
- return null;
+ return null;*/ // Paper
+ return null;
+ }*/ // Paper comment out
+
+ private static BlockPosition findSafePosition(World world, EnumDirection updirection, BlockPosition blockposition){
+ int radius = world.paperConfig.bedSearchRadius;
+ double angle = Math.PI / 2;
+ int tmpX = (int)(updirection.getAdjacentX() * Math.cos(angle) - updirection.getAdjacentZ() * Math.sin(angle));
+ int tmpZ = (int)(updirection.getAdjacentX() * Math.sin(angle) + updirection.getAdjacentZ() * Math.cos(angle));
+
+ EnumDirection rightDirection = EnumDirection.a(tmpX, 0, tmpZ);
+ EnumDirection downDirection = updirection.opposite();
+ EnumDirection leftDirection = rightDirection.opposite();
+
+ EnumDirection[] corePositionOutDirection = new EnumDirection[6];
+ corePositionOutDirection[0] = updirection;
+ corePositionOutDirection[1] = leftDirection;
+ corePositionOutDirection[2] = leftDirection;
+ corePositionOutDirection[3] = downDirection;
+ corePositionOutDirection[4] = rightDirection;
+ corePositionOutDirection[5] = rightDirection;
+
+ BlockPosition[] corePosition = new BlockPosition[6];
+ corePosition[0] = blockposition.add(updirection.getAdjacentX(), 0, updirection.getAdjacentZ());
+ corePosition[1] = blockposition.add(leftDirection.getAdjacentX(), 0, leftDirection.getAdjacentZ());
+ corePosition[2] = corePosition[1].add(downDirection.getAdjacentX(), 0, downDirection.getAdjacentZ());
+ corePosition[3] = blockposition.add(2 * downDirection.getAdjacentX(), 0, 2 * downDirection.getAdjacentZ());
+ corePosition[5] = blockposition.add(rightDirection.getAdjacentX(), 0, rightDirection.getAdjacentZ());
+ corePosition[4] = corePosition[5].add(downDirection.getAdjacentX(), 0, downDirection.getAdjacentZ());
+
+ BlockPosition[] tmpPosition = new BlockPosition[8];
+ EnumDirection[] tmpPositionDirection = new EnumDirection[8];
+ tmpPositionDirection[0] = rightDirection;
+ tmpPositionDirection[1] = leftDirection;
+ tmpPositionDirection[2] = updirection;
+ tmpPositionDirection[3] = downDirection;
+ tmpPositionDirection[4] = leftDirection;
+ tmpPositionDirection[5] = rightDirection;
+ tmpPositionDirection[6] = downDirection;
+ tmpPositionDirection[7] = updirection;
+
+ BlockPosition pos;
+ boolean foundPosition;
+ for (int r = 1; r <= radius; r++) {
+ int h = 0;
+ while (h <= 1) {
+ int numIterated = 0;
+ for (int index = (int)(Math.random() * corePosition.length); numIterated < corePosition.length; index = (index+1) % corePosition.length) {
+ numIterated++;
+
+ pos = corePosition[index].add(0, h, 0);
+ foundPosition = isSafeRespawn(world, pos);
+ if (foundPosition) {
+ return pos;
+ }
+ }
+ tmpPosition[0] = corePosition[0].add(0, h, 0);
+ tmpPosition[1] = corePosition[0].add(0, h, 0);
+ tmpPosition[2] = corePosition[1].add(0, h, 0);
+ tmpPosition[3] = corePosition[2].add(0, h, 0);
+ tmpPosition[4] = corePosition[3].add(0, h, 0);
+ tmpPosition[5] = corePosition[3].add(0, h, 0);
+ tmpPosition[6] = corePosition[4].add(0, h, 0);
+ tmpPosition[7] = corePosition[5].add(0, h, 0);
+ for (int rr = 1; rr <= r; rr++){
+ numIterated = 0;
+ for (int index = (int)(Math.random() * tmpPosition.length); numIterated < tmpPosition.length; index = (index+1) % tmpPosition.length) {
+ numIterated++;
+ tmpPosition[index] = tmpPosition[index].add(tmpPositionDirection[index].getAdjacentX(), 0, tmpPositionDirection[index].getAdjacentZ());
+ pos = tmpPosition[index];
+
+ foundPosition = isSafeRespawn(world, pos);
+ if (foundPosition) {
+ return pos;
+ }
+ }
+ }
+ switch (h) {
+ case -1:
+ h = 1;
+ break;
+ case 0:
+ h = -1;
+ break;
+ case 1:
+ h = Integer.MAX_VALUE;
+ break;
+ }
+ }
+ for (int index = 0; index < corePosition.length; index++) {
+ EnumDirection tmp = corePositionOutDirection[index];
+ corePosition[index] = corePosition[index].add(tmp.getAdjacentX(), 0, tmp.getAdjacentZ());
+ }
+ }
return null;
}
+ // Paper end
+ protected static boolean isSafeRespawn(IBlockAccess iblockaccess, BlockPosition blockposition) { // Paper - OBFHELPER + behavior improvement
+ return a(iblockaccess, blockposition) && iblockaccess.getType(blockposition.down()).getMaterial().isBuildable(); // Paper - ensure solid block
@ -101,5 +152,5 @@ index 06f627002c..d81a2db6cd 100644
return iblockaccess.getType(blockposition.down()).q() && !iblockaccess.getType(blockposition).getMaterial().isBuildable() && !iblockaccess.getType(blockposition.up()).getMaterial().isBuildable();
}
--
2.21.0
2.19.0

View file

@ -1,4 +1,4 @@
From 82e41eb16264f724aa8745bc2ab2b2f0a50e94e8 Mon Sep 17 00:00:00 2001
From e4543acbe559922a7b6d49169b517c785a37a0e7 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Tue, 17 Jul 2018 16:42:17 +0200
Subject: [PATCH] Use asynchronous Log4j 2 loggers
@ -22,13 +22,34 @@ index 3ad5af3463..9cbd4880f7 100644
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
diff --git a/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java b/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java
new file mode 100644
index 0000000000..dceb121bcc
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java
@@ -0,0 +1,13 @@
+package com.destroystokyo.paper.log;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.async.AsyncQueueFullPolicy;
+import org.apache.logging.log4j.core.async.EventRoute;
+
+public final class LogFullPolicy implements AsyncQueueFullPolicy {
+
+ @Override
+ public EventRoute getRoute(final long backgroundThreadId, final Level level) {
+ return EventRoute.ENQUEUE;
+ }
+}
diff --git a/src/main/resources/log4j2.component.properties b/src/main/resources/log4j2.component.properties
new file mode 100644
index 0000000000..ee7c90784c
index 0000000000..ee683079c1
--- /dev/null
+++ b/src/main/resources/log4j2.component.properties
@@ -0,0 +1 @@
@@ -0,0 +1,2 @@
+Log4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
+log4j2.AsyncQueueFullPolicy=com.destroystokyo.paper.log.LogFullPolicy
\ No newline at end of file
--
2.21.0
2.22.0

View file

@ -1,11 +1,11 @@
From 002645efa8e27923e6260c7b57956b4295567be9 Mon Sep 17 00:00:00 2001
From 7905cae4bb0f0e9a908779158c0a7420f5afa4b3 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 15 Aug 2018 01:26:09 -0700
Subject: [PATCH] Allow disabling armour stand ticking
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6c4cb61dc5..0b60ca82ce 100644
index 6c4cb61d..0b60ca82 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -507,4 +507,10 @@ public class PaperWorldConfig {
@ -20,22 +20,23 @@ index 6c4cb61dc5..0b60ca82ce 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index c604182dd9..2c54e3e34a 100644
index c604182d..32728580 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -45,6 +45,11 @@ public class EntityArmorStand extends EntityLiving {
@@ -45,6 +45,12 @@ public class EntityArmorStand extends EntityLiving {
public Vector3f leftLegPose;
public Vector3f rightLegPose;
public boolean canMove = true; // Paper
+ // Paper start - Allow ArmorStands not to tick
+ public boolean canTick = true;
+ public boolean canTickSetByAPI = false;
+ private boolean noTickPoseDirty = false;
+ private boolean noTickEquipmentDirty = false;
+ // Paper end
public EntityArmorStand(World world) {
super(EntityTypes.ARMOR_STAND, world);
@@ -57,6 +62,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -57,6 +63,7 @@ public class EntityArmorStand extends EntityLiving {
this.leftLegPose = EntityArmorStand.bB;
this.rightLegPose = EntityArmorStand.bC;
this.noclip = this.isNoGravity();
@ -43,7 +44,7 @@ index c604182dd9..2c54e3e34a 100644
this.setSize(0.5F, 1.975F);
this.Q = 0.0F;
}
@@ -128,6 +134,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -128,6 +135,7 @@ public class EntityArmorStand extends EntityLiving {
this.bF.set(enumitemslot.b(), itemstack);
}
@ -51,27 +52,28 @@ index c604182dd9..2c54e3e34a 100644
}
public boolean c(int i, ItemStack itemstack) {
@@ -199,6 +206,7 @@ public class EntityArmorStand extends EntityLiving {
@@ -199,6 +207,7 @@ public class EntityArmorStand extends EntityLiving {
}
nbttagcompound.set("Pose", this.z());
+ nbttagcompound.setBoolean("Paper.CanTick", this.canTick); // Paper - persist no tick setting
+ if (this.canTickSetByAPI) nbttagcompound.setBoolean("Paper.CanTickOverride", this.canTick); // Paper - persist no tick setting
}
public void a(NBTTagCompound nbttagcompound) {
@@ -230,6 +238,11 @@ public class EntityArmorStand extends EntityLiving {
@@ -230,6 +239,12 @@ public class EntityArmorStand extends EntityLiving {
this.setMarker(nbttagcompound.getBoolean("Marker"));
this.bI = !this.isMarker();
this.noclip = this.isNoGravity();
+ // Paper start - persist no tick
+ if (nbttagcompound.hasKey("Paper.CanTick")) {
+ this.canTick = nbttagcompound.getBoolean("Paper.CanTick");
+ if (nbttagcompound.hasKey("Paper.CanTickOverride")) {
+ this.canTick = nbttagcompound.getBoolean("Paper.CanTickOverride");
+ this.canTickSetByAPI = true;
+ }
+ // Paper end
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose");
this.g(nbttagcompound1);
@@ -553,7 +566,30 @@ public class EntityArmorStand extends EntityLiving {
@@ -553,7 +568,30 @@ public class EntityArmorStand extends EntityLiving {
}
public void tick() {
@ -102,7 +104,7 @@ index c604182dd9..2c54e3e34a 100644
Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.b);
if (!this.headPose.equals(vector3f)) {
@@ -682,31 +718,37 @@ public class EntityArmorStand extends EntityLiving {
@@ -682,31 +720,37 @@ public class EntityArmorStand extends EntityLiving {
public void setHeadPose(Vector3f vector3f) {
this.headPose = vector3f;
this.datawatcher.set(EntityArmorStand.b, vector3f);
@ -141,7 +143,7 @@ index c604182dd9..2c54e3e34a 100644
public Vector3f r() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index bc1ab273bd..cb32d64bd0 100644
index bc1ab273..cb32d64b 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2083,52 +2083,7 @@ public abstract class EntityLiving extends Entity {
@ -257,10 +259,10 @@ index bc1ab273bd..cb32d64bd0 100644
float f2 = MathHelper.g(f - this.aQ);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 9f5c3b92e3..07ce93f17c 100644
index 9f5c3b92..73714d71 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
@@ -297,5 +297,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
@@ -297,5 +297,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
public boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot) {
return getHandle().isSlotDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
}
@ -273,9 +275,10 @@ index 9f5c3b92e3..07ce93f17c 100644
+ @Override
+ public void setCanTick(final boolean tick) {
+ this.getHandle().canTick = tick;
+ this.getHandle().canTickSetByAPI = true;
+ }
// Paper end
}
--
2.21.0
2.23.0

View file

@ -1,4 +1,4 @@
From 299cee7fed5ab4af4ff1096312c690260696221f Mon Sep 17 00:00:00 2001
From 151a5ecc03482e3ee9139f96edb6baeed604bff1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 22:09:52 -0400
Subject: [PATCH] Optimize Hoppers
@ -31,10 +31,10 @@ index 0b60ca82ce..e87fb94c06 100644
private void disableSprintInterruptionOnAttack() {
disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false);
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 0420589faa..0d06db9355 100644
index 8347264daf..8b0172838f 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -485,8 +485,9 @@ public final class ItemStack {
@@ -488,8 +488,9 @@ public final class ItemStack {
return this.getItem().a(this, entityhuman, entityliving, enumhand);
}

View file

@ -1,4 +1,4 @@
From b6acf5d97d05f6b9d8c544a1760eafd5643cc027 Mon Sep 17 00:00:00 2001
From dceca76b8863b3839a4c54698701d67ccc8951a1 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray
@ -107,13 +107,15 @@ index 0000000000..1ba8477bf9
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644
index 0000000000..e3da35b6ba
index 0000000000..d1da1fd2d0
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,684 @@
@@ -0,0 +1,691 @@
+package com.destroystokyo.paper.antixray;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
@ -176,7 +178,10 @@ index 0000000000..e3da35b6ba
+ executorService = null;
+ }
+
+ List<String> toObfuscate;
+
+ if (engineMode == EngineMode.HIDE) {
+ toObfuscate = paperWorldConfig.hiddenBlocks;
+ predefinedBlockData = null;
+ predefinedBlockDataStone = new IBlockData[] {Blocks.STONE.getBlockData()};
+ predefinedBlockDataNetherrack = new IBlockData[] {Blocks.NETHERRACK.getBlockData()};
@ -186,12 +191,14 @@ index 0000000000..e3da35b6ba
+ predefinedBlockDataBitsNetherrackGlobal = new int[] {ChunkSection.GLOBAL_PALETTE.getOrCreateIdFor(Blocks.NETHERRACK.getBlockData())};
+ predefinedBlockDataBitsEndStoneGlobal = new int[] {ChunkSection.GLOBAL_PALETTE.getOrCreateIdFor(Blocks.END_STONE.getBlockData())};
+ } else {
+ toObfuscate = new ArrayList<>(paperWorldConfig.replacementBlocks);
+ Set<IBlockData> predefinedBlockDataSet = new HashSet<IBlockData>();
+
+ for (String id : paperWorldConfig.hiddenBlocks) {
+ Block block = IRegistry.BLOCK.get(new MinecraftKey(id));
+
+ if (block != null && !block.isTileEntity()) {
+ toObfuscate.add(id);
+ predefinedBlockDataSet.add(block.getBlockData());
+ }
+ }
@ -211,7 +218,7 @@ index 0000000000..e3da35b6ba
+ predefinedBlockDataBitsEndStoneGlobal = null;
+ }
+
+ for (String id : (engineMode == EngineMode.HIDE) ? paperWorldConfig.hiddenBlocks : paperWorldConfig.replacementBlocks) {
+ for (String id : toObfuscate) {
+ Block block = IRegistry.BLOCK.get(new MinecraftKey(id));
+
+ if (block != null) {
@ -1534,7 +1541,7 @@ index 16e3469d01..e4c0cc6a33 100644
if (enumskyblock == EnumSkyBlock.SKY) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b007eb36c7..14f419deb8 100644
index 7b7152c06c..79dea3c858 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1,6 +1,8 @@

View file

@ -1,4 +1,4 @@
From 368ac6d9fa82a95c89036c5496a65826897a8995 Mon Sep 17 00:00:00 2001
From d2c0b20945ab11e5f3d11ee7bda4d9354a38ae03 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 29 Aug 2018 21:59:22 -0400
Subject: [PATCH] Optimize getChunkIfLoaded type calls
@ -10,7 +10,7 @@ Will improve inlining across many hot methods.
Improve getBrightness to not do double chunk map lookups.
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 41926a361..186cfda7e 100644
index 41926a361b..029f5fc9ed 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -379,7 +379,7 @@ public class ChunkProviderServer implements IChunkProvider {
@ -18,12 +18,12 @@ index 41926a361..186cfda7e 100644
}
- Chunk neighbor = this.getChunkAt(chunk.locX + x, chunk.locZ + z, false, false);
+ Chunk neighbor = this.chunks.get(chunk.chunkKey); // Paper
+ Chunk neighbor = this.chunks.get(ChunkCoordIntPair.asLong(chunk.locX + x, chunk.locZ + z)); // Paper
if (neighbor != null) {
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 79dea3c85..6d60262c6 100644
index 79dea3c858..6d60262c6e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -162,7 +162,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -55,7 +55,7 @@ index 79dea3c85..6d60262c6 100644
return chunk != null && !chunk.isEmpty();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 72eb8ed4f..7e52859c1 100644
index 72eb8ed4f4..7e52859c1d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -218,7 +218,7 @@ public class CraftWorld implements World {
@ -77,5 +77,5 @@ index 72eb8ed4f..7e52859c1 100644
return true;
}
--
2.21.0
2.22.0

View file

@ -1,4 +1,4 @@
From 31b199c08aabc3bac1268a37ab726e9905d67f3c Mon Sep 17 00:00:00 2001
From 8a1c84ee467ab09199ed78c01b2f88b6a87b7868 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 21 Aug 2018 01:39:35 +0100
Subject: [PATCH] Improve death events
@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
internal code.
diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java
index bbd5e2b2a8..19750ceed1 100644
index bbd5e2b2..19750cee 100644
--- a/src/main/java/net/minecraft/server/CombatTracker.java
+++ b/src/main/java/net/minecraft/server/CombatTracker.java
@@ -175,6 +175,7 @@ public class CombatTracker {
@ -27,7 +27,7 @@ index bbd5e2b2a8..19750ceed1 100644
int i = this.f ? 300 : 100;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 90e0d9d453..c4d4775627 100644
index 90e0d9d4..c4d47756 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1556,6 +1556,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -55,10 +55,10 @@ index 90e0d9d453..c4d4775627 100644
return SoundCategory.NEUTRAL;
}
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index 2c54e3e34a..a5cc5e2842 100644
index 32728580..746e3da7 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -659,7 +659,8 @@ public class EntityArmorStand extends EntityLiving {
@@ -661,7 +661,8 @@ public class EntityArmorStand extends EntityLiving {
}
public void killEntity() {
@ -69,7 +69,7 @@ index 2c54e3e34a..a5cc5e2842 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 6367fdd469..3d1cdd6271 100644
index 6367fdd4..3d1cdd62 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -76,14 +76,14 @@ public abstract class EntityLiving extends Entity {
@ -206,7 +206,7 @@ index 6367fdd469..3d1cdd6271 100644
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index dc72538de6..62feadc8af 100644
index dc72538d..62feadc8 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -72,6 +72,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -257,7 +257,7 @@ index dc72538de6..62feadc8af 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
index 17fab031b4..ee8219e3ba 100644
index 17fab031..ee8219e3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -674,6 +674,22 @@ public enum CraftSound {
@ -284,7 +284,7 @@ index 17fab031b4..ee8219e3ba 100644
this.minecraftKey = minecraftKey;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7a918ea72f..8d32982c53 100644
index 7a918ea7..8d32982c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1691,7 +1691,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -305,7 +305,7 @@ index 7a918ea72f..8d32982c53 100644
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index e76862ef49..68e30185a2 100644
index e76862ef..68e30185 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -600,9 +600,16 @@ public class CraftEventFactory {
@ -374,5 +374,5 @@ index e76862ef49..68e30185a2 100644
* Server methods
*/
--
2.21.0
2.23.0

View file

@ -1,4 +1,4 @@
From 38967270f42cbfe7456f9f4a901b2a8dbf8fc057 Mon Sep 17 00:00:00 2001
From 99c8dd0cc669c7285ba4571865ff27ae02eb3469 Mon Sep 17 00:00:00 2001
From: theosib <millerti@172.16.221.1>
Date: Thu, 27 Sep 2018 01:43:35 -0600
Subject: [PATCH] Optimize redstone algorithm
@ -19,7 +19,7 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 61ad2cef7b..a70a64070e 100644
index 61ad2cef7..a70a64070 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -588,4 +588,14 @@ public class PaperWorldConfig {
@ -39,10 +39,10 @@ index 61ad2cef7b..a70a64070e 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
new file mode 100644
index 0000000000..21d9d6d7ed
index 000000000..f3add024f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
@@ -0,0 +1,910 @@
@@ -0,0 +1,913 @@
+package com.destroystokyo.paper.util;
+
+import java.util.List;
@ -936,8 +936,11 @@ index 0000000000..21d9d6d7ed
+ // and set it in the world.
+ // Possible optimization: Don't commit state changes to the world until they
+ // need to be known by some nearby non-redstone-wire block.
+ state = state.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
+ worldIn.setTypeAndData(upd.self, state, 2);
+ BlockPosition pos = new BlockPosition(upd.self.getX(), upd.self.getY(), upd.self.getZ());
+ if (wire.canPlace(null, worldIn, pos)) {
+ state = state.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
+ worldIn.setTypeAndData(upd.self, state, 2);
+ }
+ }
+
+ return state;
@ -954,7 +957,7 @@ index 0000000000..21d9d6d7ed
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index 2e30270bb7..72d2617071 100644
index 2e30270bb..72d261707 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -1,5 +1,7 @@
@ -1122,7 +1125,7 @@ index 2e30270bb7..72d2617071 100644
iblockdata.a(world, blockposition, 0);
world.setAir(blockposition);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 94e189a550..d790fd89f7 100644
index 94e189a55..d790fd89f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -648,6 +648,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -1142,5 +1145,5 @@ index 94e189a550..d790fd89f7 100644
int i = 0;
EnumDirection[] aenumdirection = World.a;
--
2.21.0
2.24.1

View file

@ -41,7 +41,7 @@ index b193fbab47..188e450a13 100644
+ if (MAX_SIGN_LINE_LENGTH > 0 && astring[i].length() > MAX_SIGN_LINE_LENGTH) {
+ // This handles multibyte characters as 1
+ int offset = astring[i].codePoints().limit(MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum();
+ if (offset > astring.length) {
+ if (offset < astring[i].length()) {
+ astring[i] = astring[i].substring(0, offset);
+ }
+ }

View file

@ -1,4 +1,4 @@
From a1302f191f49bae1d19fa8cf1104b81acb83472b Mon Sep 17 00:00:00 2001
From 3c3d45bf524de7a3a1ee661ed6389415cefc1c89 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Mon, 1 Apr 2019 18:57:32 -0700
Subject: [PATCH] Make region files more reliable to write to
@ -37,7 +37,7 @@ affect save performance if the startup flag is used (especially on
HDDs).
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 82f7af46f8..e5659980b3 100644
index 82f7af46f8..c754e5b2c9 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -29,7 +29,7 @@ public class RegionFile {
@ -100,7 +100,7 @@ index 82f7af46f8..e5659980b3 100644
} else {
this.c.seek(this.c.length());
i1 = this.f.size();
@@ -280,9 +279,14 @@ public class RegionFile {
@@ -280,22 +279,27 @@ public class RegionFile {
}
this.g += 4096 * k1;
@ -116,8 +116,11 @@ index 82f7af46f8..e5659980b3 100644
+ // Paper end
}
this.b(i, j, (int) (SystemUtils.getTimeMillis() / 1000L));
@@ -292,10 +296,10 @@ public class RegionFile {
- this.b(i, j, (int) (SystemUtils.getTimeMillis() / 1000L));
+ // Paper - move this into writeChunkData
} catch (IOException ioexception) {
com.destroystokyo.paper.util.SneakyThrow.sneaky(ioexception); // Paper - we want the upper try/catch to retry this
}
}
@ -130,27 +133,32 @@ index 82f7af46f8..e5659980b3 100644
this.c.write(abyte, 0, j);
}
@@ -311,16 +315,17 @@ public class RegionFile {
@@ -311,16 +315,20 @@ public class RegionFile {
return this.getOffset(i, j) != 0;
}
+ private void updateChunkHeader(final int x, final int z, final int offset) throws IOException { this.a(x, z, offset); } // Paper - OBFHELPER
private void a(int i, int j, int k) throws IOException {
this.d[i + j * 32] = k;
- this.d[i + j * 32] = k;
+ // Paper - move this to after the write
this.c.seek((long) ((i + j * 32) * 4));
- this.c.writeInt(k);
+ this.writeInt(k); // Paper - Avoid 3 io write calls
+ this.d[i + j * 32] = k; // Paper - move this to after the write
}
+ private void updateChunkTime(final int x, final int z, final int time) throws IOException { this.b(x, z, time); } // Paper - OBFHELPER
private void b(int i, int j, int k) throws IOException {
this.e[i + j * 32] = k;
- this.e[i + j * 32] = k;
+ // Paper - move this to after the write
this.c.seek((long) (4096 + (i + j * 32) * 4));
- this.c.writeInt(k);
+ this.writeInt(k); // Paper - Avoid 3 io write calls
+ this.e[i + j * 32] = k; // Paper - move this to after the write
}
public void close() throws IOException {
@@ -331,6 +336,40 @@ public class RegionFile {
@@ -331,6 +339,41 @@ public class RegionFile {
}
// Paper start
@ -184,6 +192,7 @@ index 82f7af46f8..e5659980b3 100644
+ final int chunkOffset, final byte[] chunkData, final int chunkDataLength) throws IOException {
+ this.writeChunkData(chunkOffset, chunkData, chunkDataLength);
+ this.syncRegionFile(); // Sync is required to ensure the previous data is written successfully
+ this.updateChunkTime(x, z, (int) (SystemUtils.getTimeMillis() / 1000L));
+ this.updateChunkHeader(x, z, chunkHeaderData);
+ this.syncRegionFile(); // Ensure header changes go through
+ }

View file

@ -1,55 +0,0 @@
From 5101cc45bfa0c0bfe7b10ec48a179486dda609b0 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Wed, 17 Apr 2019 00:48:59 +0100
Subject: [PATCH] Fix NPE from sign placement
This fixes issues with upstreams changes to solve a private issue on
their side, as signs are placed, they may replace existing blocks, e.g.
grass, which breaks upstreams assumption that the sign is always placed
adjacent to a surface
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index f5d9b4abc2..fdbe9a2adc 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -70,6 +70,7 @@ public abstract class EntityHuman extends EntityLiving {
public EntityFishingHook hookedFish;
// Paper start
public boolean affectsSpawning = true;
+ public BlockPosition openingSign = null; // Paper - fix NPE when opening signs
// Paper end
// Paper start - Player view distance API
private int viewDistance = -1;
diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java
index 11045ee1e1..7808aed0c0 100644
--- a/src/main/java/net/minecraft/server/ItemSign.java
+++ b/src/main/java/net/minecraft/server/ItemSign.java
@@ -16,6 +16,7 @@ public class ItemSign extends ItemBlockWallable {
if (!world.isClientSide && !flag && entityhuman != null) {
// CraftBukkit start - SPIGOT-4678
// entityhuman.openSign((TileEntitySign) world.getTileEntity(blockposition));
+ entityhuman.openingSign = blockposition; // Paper - fix NPE when opening signs
ItemSign.openSign = true;
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index f8d82a0276..ccc0826bc6 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -305,7 +305,12 @@ public final class ItemStack {
// SPIGOT-4678
if (this.item instanceof ItemSign && ItemSign.openSign) {
ItemSign.openSign = false;
- entityhuman.openSign((TileEntitySign) world.getTileEntity(new BlockActionContext(itemactioncontext).getClickPosition()));
+ // Paper start - fix NPE when opening signs
+ if (entityhuman.openingSign != null) {
+ entityhuman.openSign((TileEntitySign) world.getTileEntity(entityhuman.openingSign));
+ entityhuman.openingSign = null;
+ }
+ // Paper end
}
// SPIGOT-1288 - play sound stripped from ItemBlock
--
2.21.0

View file

@ -1,4 +1,4 @@
From a22319f1c97b10ac0fc4e94467a2502c10e1c859 Mon Sep 17 00:00:00 2001
From bd170d71d97e59ff334f4f6291dc32e207ec8942 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Fri, 19 Apr 2019 12:41:13 -0500
Subject: [PATCH] Mob Spawner API Enhancements

View file

@ -1,4 +1,4 @@
From 701880fb5c0094c2569b8c7340cf0fa4277433ac Mon Sep 17 00:00:00 2001
From 23fe4c38f7f9259bf6d1f325a771d796c752dc62 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 22 Apr 2019 19:51:14 +0100
Subject: [PATCH] don't NPE on dimensionmanager toString
@ -14,7 +14,7 @@ this is not super elegant, but is the only route that promises not to
break stuff.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9c5b79920f..e5242f9f87 100644
index c41422a0a5..9fb6c09907 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -999,7 +999,14 @@ public final class CraftServer implements Server {

View file

@ -1,4 +1,4 @@
From 273c93317bcf0f5acd823b31eae7e1f2da65a0d8 Mon Sep 17 00:00:00 2001
From 9ec941d0e530370963068c7ec2591959f01a3bcd Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Sat, 27 Apr 2019 20:00:43 +0100
Subject: [PATCH] Fix sounds when item frames are modified (MC-123450)

View file

@ -1,4 +1,4 @@
From 4aaab5e21ab07136668aa409b8e2a2691c4f1c2b Mon Sep 17 00:00:00 2001
From e614a03a2ad21fdf3e18965cdb4ade849a9a3fd4 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 10 Jun 2019 09:36:40 +0100
Subject: [PATCH] Catch exceptions from dispenser entity spawns

View file

@ -1,11 +1,11 @@
From 2574fc84c5d9bfa168cb11c47bdc30a7d73f3696 Mon Sep 17 00:00:00 2001
From 4188d3f20337cc303e6ea5245cf4cdbd7e5ffd3c Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 2 Jun 2019 21:12:42 -0500
Subject: [PATCH] MC-114618 - Fix EntityAreaEffectCloud from going negative
diff --git a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java
index b2814c0e..13d749af 100644
index b2814c0e..033182ae 100644
--- a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java
+++ b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java
@@ -158,6 +158,12 @@ public class EntityAreaEffectCloud extends Entity {
@ -13,7 +13,7 @@ index b2814c0e..13d749af 100644
boolean flag = this.l();
float f = this.getRadius();
+ // Paper start - fix MC-114618
+ if (f < 0.5F) {
+ if (f < 0.0F) {
+ this.die();
+ return;
+ }
@ -21,23 +21,6 @@ index b2814c0e..13d749af 100644
if (this.world.isClientSide) {
ParticleParam particleparam = this.getParticle();
@@ -227,10 +233,12 @@ public class EntityAreaEffectCloud extends Entity {
if (this.radiusPerTick != 0.0F) {
f += this.radiusPerTick;
- if (f < 0.5F) {
- this.die();
- return;
- }
+ // Paper start - moved up - fix MC-114618
+ //if (f < 0.5F) {
+ // this.die();
+ // return;
+ //}
+ // Paper end
this.setRadius(f);
}
--
2.21.0
2.22.0

View file

@ -0,0 +1,83 @@
From 811b4e42f5a03c6fa2e4c1865d91946775cf6118 Mon Sep 17 00:00:00 2001
From: Lucavon <lucavonlp@gmail.com>
Date: Sun, 26 May 2019 15:36:04 +0200
Subject: [PATCH] Configurable projectile relative velocity
This patch adds an option "disable relative projectile velocity", which, when
nabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.
While this could easily be done with plugins, too, there are multiple problems:
P1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
P2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
P3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index bfd690ecc..b8131abae 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -474,6 +474,11 @@ public class PaperWorldConfig {
log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled"));
}
+ public boolean disableRelativeProjectileVelocity;
+ private void disableRelativeProjectileVelocity() {
+ disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false);
+ }
+
public boolean villagesLoadChunks = false;
private void villagesLoadChunks() {
villagesLoadChunks = getBoolean("game-mechanics.villages-load-chunks", false);
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 6aa518f17..736537b45 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -80,12 +80,13 @@ public abstract class EntityArrow extends Entity implements IProjectile {
float f7 = MathHelper.cos(f1 * 0.017453292F) * MathHelper.cos(f * 0.017453292F);
this.shoot((double) f5, (double) f6, (double) f7, f3, f4);
+ if (!entity.world.paperConfig.disableRelativeProjectileVelocity) { // Paper - allow disabling relative velocity
this.motX += entity.motX;
this.motZ += entity.motZ;
if (!entity.onGround) {
this.motY += entity.motY;
}
-
+ } // Paper - allow disabling relative velocity
}
public void shoot(double d0, double d1, double d2, float f, float f1) {
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 60ab1c751..5dae5d604 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -44,12 +44,13 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
float f7 = MathHelper.cos(f1 * 0.017453292F) * MathHelper.cos(f * 0.017453292F);
this.shoot((double) f5, (double) f6, (double) f7, f3, f4);
+ if (!entity.world.paperConfig.disableRelativeProjectileVelocity) { // Paper - allow disabling relative velocity
this.motX += entity.motX;
this.motZ += entity.motZ;
if (!entity.onGround) {
this.motY += entity.motY;
}
-
+ } // Paper - allow disabling relative velocity
}
public void shoot(double d0, double d1, double d2, float f, float f1) {
--
2.22.0

View file

@ -0,0 +1,40 @@
From a2c64719432ecef1a35ff34fc3405217b8025dea Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Tue, 23 Jul 2019 20:44:47 -0500
Subject: [PATCH] Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index dce52ac0fa..305bfa9f95 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -288,8 +288,22 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
}
}
+ // Paper start
+ private static final int CURRENT_DATA_VERSION = 1631;
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
+ // Paper end
+
@Nullable
protected Object[] a(GeneratorAccess generatoraccess, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[]
+ // Paper start - Do NOT attempt to load chunks saved with newer versions
+ if (nbttagcompound.hasKeyOfType("DataVersion", 3)) {
+ int dataVersion = nbttagcompound.getInt("DataVersion");
+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) {
+ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace();
+ System.exit(1);
+ }
+ }
+ // Paper end
if (nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8)) {
ChunkStatus.Type chunkstatus_type = this.a(nbttagcompound);
--
2.22.1

View file

@ -0,0 +1,425 @@
From 9e8e04410f7dc524803de83707aef94dd74f2b48 Mon Sep 17 00:00:00 2001
From: Tom <cryptite@gmail.com>
Date: Sun, 21 Jul 2019 11:21:06 -0500
Subject: [PATCH] Don't use streams for VoxelShape calls
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 2e460a7f6..3ed599ed7 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -4,6 +4,7 @@ import com.google.common.collect.UnmodifiableIterator;
import it.unimi.dsi.fastutil.objects.Object2ByteLinkedOpenHashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Collections; // Paper
import java.util.Objects;
import java.util.Random;
import java.util.stream.Stream;
@@ -75,7 +76,7 @@ public class Block implements IMaterial {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
- double d0 = VoxelShapes.a(EnumDirection.EnumAxis.Y, entity.getBoundingBox().d(0.0D, 1.0D, 0.0D), Stream.of(voxelshape), -1.0D);
+ double d0 = VoxelShapes.a(EnumDirection.EnumAxis.Y, entity.getBoundingBox().d(0.0D, 1.0D, 0.0D), Collections.singletonList(voxelshape), -1.0D); // Paper
entity.enderTeleportTo(entity.locX, entity.locY + 1.0D + d0, entity.locZ);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 581c78e00..894a2a34b 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -704,22 +704,22 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
AxisAlignedBB axisalignedbb = this.getBoundingBox();
if (d0 != 0.0D || d1 != 0.0D || d2 != 0.0D) {
- StreamAccumulator<VoxelShape> streamaccumulator = new StreamAccumulator<>(this.world.a(this, this.getBoundingBox(), d0, d1, d2));
+ List<VoxelShape> shapes = this.world.a_list(this, this.getBoundingBox(), d0, d1, d2); // Paper - Use list impl
if (d1 != 0.0D) {
- d1 = VoxelShapes.a(EnumDirection.EnumAxis.Y, this.getBoundingBox(), streamaccumulator.a(), d1);
+ d1 = VoxelShapes.a(EnumDirection.EnumAxis.Y, this.getBoundingBox(), shapes, d1); // Paper - Use list impl
this.a(this.getBoundingBox().d(0.0D, d1, 0.0D));
}
if (d0 != 0.0D) {
- d0 = VoxelShapes.a(EnumDirection.EnumAxis.X, this.getBoundingBox(), streamaccumulator.a(), d0);
+ d0 = VoxelShapes.a(EnumDirection.EnumAxis.X, this.getBoundingBox(), shapes, d0); // Paper - Use list impl
if (d0 != 0.0D) {
this.a(this.getBoundingBox().d(d0, 0.0D, 0.0D));
}
}
if (d2 != 0.0D) {
- d2 = VoxelShapes.a(EnumDirection.EnumAxis.Z, this.getBoundingBox(), streamaccumulator.a(), d2);
+ d2 = VoxelShapes.a(EnumDirection.EnumAxis.Z, this.getBoundingBox(), shapes, d2); // Paper - Use list impl
if (d2 != 0.0D) {
this.a(this.getBoundingBox().d(0.0D, 0.0D, d2));
}
@@ -740,41 +740,41 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
d1 = (double) this.Q;
d2 = d9;
if (d7 != 0.0D || d1 != 0.0D || d9 != 0.0D) {
- StreamAccumulator<VoxelShape> streamaccumulator1 = new StreamAccumulator<>(this.world.a(this, this.getBoundingBox(), d7, d1, d9));
+ List<VoxelShape> shapes = this.world.a_list(this, this.getBoundingBox(), d7, d1, d9); // Paper - Use list impl
AxisAlignedBB axisalignedbb2 = this.getBoundingBox();
AxisAlignedBB axisalignedbb3 = axisalignedbb2.b(d7, 0.0D, d9);
- d11 = VoxelShapes.a(EnumDirection.EnumAxis.Y, axisalignedbb3, streamaccumulator1.a(), d1);
+ d11 = VoxelShapes.a(EnumDirection.EnumAxis.Y, axisalignedbb3, shapes, d1); // Paper - Use list impl
if (d11 != 0.0D) {
axisalignedbb2 = axisalignedbb2.d(0.0D, d11, 0.0D);
}
- double d15 = VoxelShapes.a(EnumDirection.EnumAxis.X, axisalignedbb2, streamaccumulator1.a(), d7);
+ double d15 = VoxelShapes.a(EnumDirection.EnumAxis.X, axisalignedbb2, shapes, d7); // Paper - Use list impl
if (d15 != 0.0D) {
axisalignedbb2 = axisalignedbb2.d(d15, 0.0D, 0.0D);
}
- double d16 = VoxelShapes.a(EnumDirection.EnumAxis.Z, axisalignedbb2, streamaccumulator1.a(), d9);
+ double d16 = VoxelShapes.a(EnumDirection.EnumAxis.Z, axisalignedbb2, shapes, d9); // Paper - Use list impl
if (d16 != 0.0D) {
axisalignedbb2 = axisalignedbb2.d(0.0D, 0.0D, d16);
}
AxisAlignedBB axisalignedbb4 = this.getBoundingBox();
- double d17 = VoxelShapes.a(EnumDirection.EnumAxis.Y, axisalignedbb4, streamaccumulator1.a(), d1);
+ double d17 = VoxelShapes.a(EnumDirection.EnumAxis.Y, axisalignedbb4, shapes, d1); // Paper - Use list impl
if (d17 != 0.0D) {
axisalignedbb4 = axisalignedbb4.d(0.0D, d17, 0.0D);
}
- double d18 = VoxelShapes.a(EnumDirection.EnumAxis.X, axisalignedbb4, streamaccumulator1.a(), d7);
+ double d18 = VoxelShapes.a(EnumDirection.EnumAxis.X, axisalignedbb4, shapes, d7); // Paper - Use list impl
if (d18 != 0.0D) {
axisalignedbb4 = axisalignedbb4.d(d18, 0.0D, 0.0D);
}
- double d19 = VoxelShapes.a(EnumDirection.EnumAxis.Z, axisalignedbb4, streamaccumulator1.a(), d9);
+ double d19 = VoxelShapes.a(EnumDirection.EnumAxis.Z, axisalignedbb4, shapes, d9); // Paper - Use list impl
if (d19 != 0.0D) {
axisalignedbb4 = axisalignedbb4.d(0.0D, 0.0D, d19);
@@ -795,7 +795,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.a(axisalignedbb4);
}
- d1 = VoxelShapes.a(EnumDirection.EnumAxis.Y, this.getBoundingBox(), streamaccumulator1.a(), d1);
+ d1 = VoxelShapes.a(EnumDirection.EnumAxis.Y, this.getBoundingBox(), shapes, d1); // Paper - Use list impl
if (d1 != 0.0D) {
this.a(this.getBoundingBox().d(0.0D, d1, 0.0D));
}
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 24ca35119..1268f8887 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -3,6 +3,7 @@ package net.minecraft.server;
import com.mojang.datafixers.DataFixUtils;
import com.mojang.datafixers.types.Type;
+import java.util.List; // Paper
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -218,9 +219,9 @@ public class EntityTypes<T extends Entity> {
axisalignedbb1 = axisalignedbb1.b(0.0D, -1.0D, 0.0D);
}
- Stream<VoxelShape> stream = iworldreader.b((Entity) null, axisalignedbb1);
+ List<VoxelShape> shapes = iworldreader.b_list(null, axisalignedbb1); // Paper - Use list impl
- return 1.0D + VoxelShapes.a(EnumDirection.EnumAxis.Y, axisalignedbb, stream, flag ? -2.0D : -1.0D);
+ return 1.0D + VoxelShapes.a(EnumDirection.EnumAxis.Y, axisalignedbb, shapes, flag ? -2.0D : -1.0D); // Paper - Use list impl
}
public static void a(World world, @Nullable EntityHuman entityhuman, @Nullable Entity entity, @Nullable NBTTagCompound nbttagcompound) {
diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
index 175f242a8..c21f9c65d 100644
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
+++ b/src/main/java/net/minecraft/server/IEntityAccess.java
@@ -2,6 +2,9 @@ package net.minecraft.server;
import java.util.List;
import java.util.Objects;
+import java.util.Arrays; // Paper
+import java.util.ArrayList; // Paper
+import java.util.Collections; // Paper
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -16,18 +19,30 @@ public interface IEntityAccess {
}
default Stream<VoxelShape> a(@Nullable Entity entity, VoxelShape voxelshape, Set<Entity> set) {
+ return getEmptyCollisionShapes(entity, voxelshape, set).stream(); // Paper
+ }
+
+ // Paper start - Use lists instead of streams
+ default List<VoxelShape> getEmptyCollisionShapes(@Nullable Entity entity, VoxelShape voxelshape, Set<Entity> set) {
if (voxelshape.isEmpty()) {
- return Stream.empty();
+ return Collections.emptyList();
} else {
AxisAlignedBB axisalignedbb = voxelshape.getBoundingBox();
- return this.getEntities(entity, axisalignedbb.g(0.25D)).stream().filter((entity1) -> {
- return !set.contains(entity1) && (entity == null || !entity.x(entity1));
- }).flatMap((entity1) -> {
- return Stream.of(entity1.al(), entity == null ? null : entity.j(entity1)).filter(Objects::nonNull).filter((axisalignedbb1) -> {
- return axisalignedbb1.c(axisalignedbb);
- }).map(VoxelShapes::a);
- });
+ List<VoxelShape> shapes = new ArrayList<>();
+ for (Entity e : this.getEntities(entity, axisalignedbb.g(0.25D))) {
+ if (!(!set.contains(e) && (entity == null || !entity.x(e)))) continue;
+
+ List<AxisAlignedBB> alignedBBs = Arrays.asList(e.al(), entity == null ? null : entity.j(e));
+ for (AxisAlignedBB axisAlignedBB : alignedBBs) {
+ if (axisAlignedBB != null && axisAlignedBB.c(axisalignedbb)) {
+ shapes.add(VoxelShapes.a(axisalignedbb));
+ }
+ }
+ }
+
+ return shapes;
}
}
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java
index 554825ec1..6a1d8afd0 100644
--- a/src/main/java/net/minecraft/server/IWorldReader.java
+++ b/src/main/java/net/minecraft/server/IWorldReader.java
@@ -1,6 +1,8 @@
package net.minecraft.server;
+import java.util.ArrayList; // Paper
import java.util.Collections;
+import java.util.List; // Paper
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -111,7 +113,13 @@ public interface IWorldReader extends IBlockAccess {
return this.a(entity, VoxelShapes.a(axisalignedbb));
}
+ // Paper start - Use list instead of stream
default Stream<VoxelShape> a(VoxelShape voxelshape, VoxelShape voxelshape1, boolean flag) {
+ return a_list(voxelshape, voxelshape1, flag).stream();
+ }
+
+ default List<VoxelShape> a_list(VoxelShape voxelshape, VoxelShape voxelshape1, boolean flag) {
+ // Paper end
int i = MathHelper.floor(voxelshape.b(EnumDirection.EnumAxis.X)) - 1;
int j = MathHelper.f(voxelshape.c(EnumDirection.EnumAxis.X)) + 1;
int k = MathHelper.floor(voxelshape.b(EnumDirection.EnumAxis.Y)) - 1;
@@ -121,10 +129,13 @@ public interface IWorldReader extends IBlockAccess {
WorldBorder worldborder = this.getWorldBorder();
boolean flag1 = worldborder.b() < (double) i && (double) j < worldborder.d() && worldborder.c() < (double) i1 && (double) j1 < worldborder.e();
VoxelShapeBitSet voxelshapebitset = new VoxelShapeBitSet(j - i, l - k, j1 - i1);
- Predicate<VoxelShape> predicate = (voxelshape2) -> {
- return !voxelshape2.isEmpty() && VoxelShapes.c(voxelshape, voxelshape2, OperatorBoolean.AND);
- };
- Stream<VoxelShape> stream = StreamSupport.stream(BlockPosition.MutableBlockPosition.b(i, k, i1, j - 1, l - 1, j1 - 1).spliterator(), false).map((blockposition_mutableblockposition) -> {
+
+ // Paper start - Use list instead of stream
+ List<VoxelShape> voxels = new ArrayList<>();
+
+ Iterable<BlockPosition.MutableBlockPosition> blockPosIterable = BlockPosition.MutableBlockPosition.b(i, k, i1, j - 1, l - 1, j1 - 1);
+ for (BlockPosition.MutableBlockPosition blockposition_mutableblockposition : blockPosIterable) {
+ // Paper end
int k1 = blockposition_mutableblockposition.getX();
int l1 = blockposition_mutableblockposition.getY();
int i2 = blockposition_mutableblockposition.getZ();
@@ -132,53 +143,85 @@ public interface IWorldReader extends IBlockAccess {
boolean flag3 = l1 == k || l1 == l - 1;
boolean flag4 = i2 == i1 || i2 == j1 - 1;
- if ((!flag2 || !flag3) && (!flag3 || !flag4) && (!flag4 || !flag2) && this.isLoaded(blockposition_mutableblockposition)) {
- VoxelShape voxelshape2;
+ // Paper start - changes throughout this block to rid it of streams
+ VoxelShape shape;
+ if ((!flag2 || !flag3) && (!flag3 || !flag4) && (!flag4 || !flag2) && this.isLoaded(blockposition_mutableblockposition)) {
if (flag && !flag1 && !worldborder.a((BlockPosition) blockposition_mutableblockposition)) {
- voxelshape2 = VoxelShapes.b();
+ shape = VoxelShapes.b();
} else {
- voxelshape2 = this.getType(blockposition_mutableblockposition).getCollisionShape(this, blockposition_mutableblockposition);
+ shape = this.getType(blockposition_mutableblockposition).getCollisionShape(this, blockposition_mutableblockposition);
}
VoxelShape voxelshape3 = voxelshape1.a((double) (-k1), (double) (-l1), (double) (-i2));
- if (VoxelShapes.c(voxelshape3, voxelshape2, OperatorBoolean.AND)) {
- return VoxelShapes.a();
- } else if (voxelshape2 == VoxelShapes.b()) {
+ if (VoxelShapes.c(voxelshape3, shape, OperatorBoolean.AND)) {
+ shape = VoxelShapes.a();
+ } else if (shape == VoxelShapes.b()) {
voxelshapebitset.a(k1 - i, l1 - k, i2 - i1, true, true);
- return VoxelShapes.a();
+ shape = VoxelShapes.a();
} else {
- return voxelshape2.a((double) k1, (double) l1, (double) i2);
+ shape = shape.a((double) k1, (double) l1, (double) i2);
}
} else {
- return VoxelShapes.a();
+ shape = VoxelShapes.a();
}
- }).filter(predicate);
- return Stream.concat(stream, Stream.generate(() -> {
- return new VoxelShapeWorldRegion(voxelshapebitset, i, k, i1);
- }).limit(1L).filter(predicate));
+ if (!shape.isEmpty() && VoxelShapes.c(voxelshape, shape, OperatorBoolean.AND)) {
+ voxels.add(shape);
+ }
+ }
+
+ VoxelShapeWorldRegion worldShape = new VoxelShapeWorldRegion(voxelshapebitset, i, k, i1);
+ if (!worldShape.isEmpty() && VoxelShapes.c(voxelshape, worldShape, OperatorBoolean.AND)) {
+ voxels.add(worldShape);
+ }
+
+ return voxels;
+ // Paper end
}
+ // Paper start - Use lists instead of streams
default Stream<VoxelShape> a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, double d0, double d1, double d2) {
- return this.a(entity, axisalignedbb, Collections.emptySet(), d0, d1, d2);
+ return a_list(entity, axisalignedbb, d0, d1, d2).stream();
+ }
+
+ default List<VoxelShape> a_list(@Nullable Entity entity, AxisAlignedBB axisalignedbb, double d0, double d1, double d2) {
+ return this.a_list(entity, axisalignedbb, Collections.emptySet(), d0, d1, d2);
+ // Paper end
}
+ // Paper start - Use lists instead of streams
default Stream<VoxelShape> a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set<Entity> set, double d0, double d1, double d2) {
+ return a_list(entity, axisalignedbb, set, d0, d1, d2).stream();
+ }
+ default List<VoxelShape> a_list(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set<Entity> set, double d0, double d1, double d2) {
+ // Paper end
double d3 = 1.0E-7D;
VoxelShape voxelshape = VoxelShapes.a(axisalignedbb);
VoxelShape voxelshape1 = VoxelShapes.a(axisalignedbb.d(d0 > 0.0D ? -1.0E-7D : 1.0E-7D, d1 > 0.0D ? -1.0E-7D : 1.0E-7D, d2 > 0.0D ? -1.0E-7D : 1.0E-7D));
VoxelShape voxelshape2 = VoxelShapes.b(VoxelShapes.a(axisalignedbb.b(d0, d1, d2).g(1.0E-7D)), voxelshape1, OperatorBoolean.ONLY_FIRST);
- return this.a(entity, voxelshape2, voxelshape, set);
+ return this.a_list(entity, voxelshape2, voxelshape, set); // Paper - use list impl
}
+ // Paper start - Use lists instead of streams
default Stream<VoxelShape> b(@Nullable Entity entity, AxisAlignedBB axisalignedbb) {
- return this.a(entity, VoxelShapes.a(axisalignedbb), VoxelShapes.a(), Collections.emptySet());
+ return b_list(entity, axisalignedbb).stream();
}
+ default List<VoxelShape> b_list(@Nullable Entity entity, AxisAlignedBB axisalignedbb) {
+ return this.a_list(entity, VoxelShapes.a(axisalignedbb), VoxelShapes.a(), Collections.emptySet());
+ // Paper end
+ }
+
+ // Paper start - Use lists instead of streams
default Stream<VoxelShape> a(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set<Entity> set) {
+ return this.a_list(entity, voxelshape, voxelshape1, set).stream();
+ }
+
+ default List<VoxelShape> a_list(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set<Entity> set) {
+ // Paper end
boolean flag = entity != null && entity.bG();
boolean flag1 = entity != null && this.i(entity);
@@ -186,7 +229,7 @@ public interface IWorldReader extends IBlockAccess {
entity.n(!flag1);
}
- return this.a(voxelshape, voxelshape1, flag1);
+ return this.a_list(voxelshape, voxelshape1, flag1); // Paper - use list impl
}
default boolean i(Entity entity) {
@@ -212,7 +255,12 @@ public interface IWorldReader extends IBlockAccess {
}
default boolean a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set<Entity> set) {
- return this.a(entity, VoxelShapes.a(axisalignedbb), VoxelShapes.a(), set).allMatch(VoxelShape::isEmpty);
+ // Paper start - use lists instead of streams
+ for (VoxelShape shape : this.a_list(entity, VoxelShapes.a(axisalignedbb), VoxelShapes.a(), set)) {
+ if (!shape.isEmpty()) return false;
+ }
+ return true;
+ // Paper end
}
default boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisalignedbb) {
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
index 8c33bf159..7b51647f2 100644
--- a/src/main/java/net/minecraft/server/VoxelShapes.java
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java
@@ -6,6 +6,7 @@ import com.google.common.math.IntMath;
import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
import it.unimi.dsi.fastutil.doubles.DoubleList;
import java.util.Iterator;
+import java.util.List; // paper
import java.util.Objects;
import java.util.stream.Stream;
@@ -176,6 +177,18 @@ public final class VoxelShapes {
return d0;
}
+ // Paper start - copy of above without the use of the streams API
+ public static double a(EnumDirection.EnumAxis enumdirection_enumaxis, AxisAlignedBB axisalignedbb, List<VoxelShape> shapes, double d0) {
+ for (Iterator iterator = shapes.iterator(); iterator.hasNext(); d0 = ((VoxelShape) iterator.next()).a(enumdirection_enumaxis, axisalignedbb, d0)) {
+ // Paper end
+ if (Math.abs(d0) < 1.0E-7D) {
+ return 0.0D;
+ }
+ }
+
+ return d0;
+ }
+
public static boolean b(VoxelShape voxelshape, VoxelShape voxelshape1, EnumDirection enumdirection) {
if (voxelshape != b() && voxelshape1 != b()) {
EnumDirection.EnumAxis enumdirection_enumaxis = enumdirection.k();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 57b0f1a38..f5afaf42b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2387,10 +2387,20 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
}
+ // Paper start - Use lists instead of streams
public Stream<VoxelShape> a(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set<Entity> set) {
- Stream<VoxelShape> stream = IIBlockAccess.super.a(entity, voxelshape, voxelshape1, set); // CraftBukkit - decompile error
+ return a_list(entity, voxelshape, voxelshape1, set).stream();
+ }
- return entity == null ? stream : Stream.concat(stream, this.a(entity, voxelshape, set));
+ public List<VoxelShape> a_list(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set<Entity> set) {
+ List<VoxelShape> shapes = IIBlockAccess.super.a_list(entity, voxelshape, voxelshape1, set); // CraftBukkit - decompile error // Paper - Use list impl
+ if (entity == null) {
+ return shapes;
+ } else {
+ shapes.addAll(this.getEmptyCollisionShapes(entity, voxelshape, set));
+ return shapes;
+ }
+ // Paper end
}
public List<Entity> getEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, @Nullable Predicate<? super Entity> predicate) {
--
2.22.0

View file

@ -0,0 +1,22 @@
From 901cd905f4f9966045765dd861383cf07e42963c Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Tue, 24 Sep 2019 19:54:39 -0500
Subject: [PATCH] Allow running on Java 13
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index b145b55bc..387ed31db 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -172,7 +172,7 @@ public class Main {
}
float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
- if (javaVersion > 56.0) {
+ if (!Boolean.getBoolean("Paper.IgnoreJavaVersion") && javaVersion > 57.0) { // Paper - Don't complain about Java 13
System.err.println("Unsupported Java detected (" + javaVersion + "). Only up to Java 12 is supported.");
return;
}
--
2.23.0

View file

@ -0,0 +1,24 @@
From 1837cd5f7e2f61940b3cc9d60b572eaf7fa98dcd Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 20 Apr 2019 19:47:34 -0500
Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9fb6c0990..c92b508db 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2214,5 +2214,10 @@ public final class CraftServer implements Server {
}
return new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name);
}
+
+ @Override
+ public int getCurrentTick() {
+ return MinecraftServer.currentTick;
+ }
// Paper end
}
--
2.23.0

View file

@ -0,0 +1,105 @@
From af4651f62f0e4ebd4af0dac08b03c94550da301c Mon Sep 17 00:00:00 2001
From: Mathias <mail@mathias.is>
Date: Mon, 16 Dec 2019 19:11:10 +0200
Subject: [PATCH] Backport SPIGOT-5428: Better handling of some ItemMeta
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
index 2f72f0ce..ffc24634 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java
@@ -53,7 +53,14 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
NBTTagList patterns = entityTag.getList(PATTERNS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
for (int i = 0; i < Math.min(patterns.size(), 20); i++) {
NBTTagCompound p = patterns.getCompound(i);
- this.patterns.add(new Pattern(DyeColor.getByWoolData((byte) p.getInt(COLOR.NBT)), PatternType.getByIdentifier(p.getString(PATTERN.NBT))));
+ // Paper start - Backport SPIGOT-5428
+ DyeColor color = DyeColor.getByWoolData((byte) p.getInt(COLOR.NBT));
+ PatternType pattern = PatternType.getByIdentifier(p.getString(PATTERN.NBT));
+
+ if (color != null && pattern != null) {
+ this.patterns.add(new Pattern(color, pattern));
+ }
+ // Paper end
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
index 267581ec..7adbc4ea 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCharge.java
@@ -36,7 +36,13 @@ class CraftMetaCharge extends CraftMetaItem implements FireworkEffectMeta {
super(tag);
if (tag.hasKey(EXPLOSION.NBT)) {
- effect = CraftMetaFirework.getEffect(tag.getCompound(EXPLOSION.NBT));
+ // Paper start - Backport SPIGOT-5428
+ try {
+ effect = CraftMetaFirework.getEffect(tag.getCompound(EXPLOSION.NBT));
+ } catch (IllegalArgumentException ex) {
+ // Ignore invalid effects
+ }
+ // Paper end
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
index b82e2fdf..957c144b 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
@@ -93,7 +93,13 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
List<FireworkEffect> effects = this.effects = new ArrayList<FireworkEffect>(fireworkEffects.size());
for (int i = 0; i < fireworkEffects.size(); i++) {
- effects.add(getEffect((NBTTagCompound) fireworkEffects.get(i)));
+ // Paper start - Backport SPIGOT-5428
+ try {
+ effects.add(getEffect((NBTTagCompound) fireworkEffects.get(i)));
+ } catch (IllegalArgumentException ex) {
+ // Ignore invalid effects
+ }
+ // Paper end - Backport SPIGOT-5428
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
index e5b1a730..8a706aba 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
@@ -66,7 +66,13 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
}
if (display.hasKey(MAP_COLOR.NBT)) {
- color = Color.fromRGB(display.getInt(MAP_COLOR.NBT));
+ // Paper start - Backport SPIGOT-5428
+ try {
+ color = Color.fromRGB(display.getInt(MAP_COLOR.NBT));
+ } catch (IllegalArgumentException ex) {
+ // Invalid colour
+ }
+ // Paper end
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
index 29fbdcc8..9a7dec54 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
@@ -62,7 +62,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
type = CraftPotionUtil.toBukkit(tag.getString(DEFAULT_POTION.NBT));
}
if (tag.hasKey(POTION_COLOR.NBT)) {
- color = Color.fromRGB(tag.getInt(POTION_COLOR.NBT));
+ // Paper start - Backport SPIGOT-5428
+ try {
+ color = Color.fromRGB(tag.getInt(POTION_COLOR.NBT));
+ } catch (IllegalArgumentException ex) {
+ // Invalid colour
+ }
+ // Paper end
}
if (tag.hasKey(POTION_EFFECTS.NBT)) {
NBTTagList list = tag.getList(POTION_EFFECTS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
--
2.24.1

View file

@ -0,0 +1,42 @@
From 367bda02eaf6224a01907134e04c87b4230aca33 Mon Sep 17 00:00:00 2001
From: Paul Sauve <paul@burngames.net>
Date: Sun, 14 Jul 2019 21:05:03 -0500
Subject: [PATCH] Do less work if we have a custom Bukkit generator
Patch originally for Paper 1.14 from Paul Sauve <paul@burngames.net>
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ee071ba2..8af54019 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -769,12 +769,6 @@ public class WorldServer extends World implements IAsyncTaskHandler {
} else if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
this.worldData.setSpawn(BlockPosition.ZERO.up());
} else {
- WorldChunkManager worldchunkmanager = this.chunkProvider.getChunkGenerator().getWorldChunkManager();
- List<BiomeBase> list = worldchunkmanager.a();
- Random random = new Random(this.getSeed());
- BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random);
- ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
-
// CraftBukkit start
if (this.generator != null) {
Random rand = new Random(this.getSeed());
@@ -791,6 +785,14 @@ public class WorldServer extends World implements IAsyncTaskHandler {
}
// CraftBukkit end
+ // Paper start - this is useless if craftbukkit returns early
+ WorldChunkManager worldchunkmanager = this.chunkProvider.getChunkGenerator().getWorldChunkManager();
+ List<BiomeBase> list = worldchunkmanager.a();
+ Random random = new Random(this.getSeed());
+ BlockPosition blockposition = worldchunkmanager.a(0, 0, 256, list, random);
+ ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
+ // Paper end
+
if (blockposition == null) {
WorldServer.a.warn("Unable to find spawn biome");
}
--
2.17.1

View file

@ -0,0 +1,122 @@
From 7540f1ee0397e587cda2ea09b512ed2a0d8d65f4 Mon Sep 17 00:00:00 2001
From: sulu5890 <sulu@sulu.me>
Date: Sat, 11 Dec 2021 12:14:53 -0600
Subject: [PATCH] Update Log4j
diff --git a/pom.xml b/pom.xml
index 9cbd4880f..fd63cf958 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,25 +60,25 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
- <version>2.8.1</version>
+ <version>2.17.0</version> <!-- Paper - Update Log4j -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
- <version>2.8.1</version>
+ <version>2.17.0</version> <!-- Paper - Update Log4j -->
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-iostreams</artifactId>
- <version>2.8.1</version>
+ <version>2.17.0</version> <!-- Paper - Update Log4j -->
</dependency>
<!-- Paper - Async loggers -->
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
- <version>3.4.2</version>
+ <version>3.4.4</version> <!-- Paper - Update Log4j -->
<scope>runtime</scope>
</dependency>
<dependency>
@@ -122,15 +122,17 @@
Please see https://www.spigotmc.org/go/maven for more information.
-->
<repository>
- <id>spigotmc-public</id>
- <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
+ <!-- paper start - update log4j -->
+ <id>papermc</id>
+ <url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
- <id>spigotmc-public</id>
- <url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
+ <id>papermc</id>
+ <url>https://papermc.io/repo/repository/maven-public/</url>
+ <!-- paper end - update log4j -->
</pluginRepository>
</pluginRepositories>
@@ -172,6 +174,7 @@
<Specification-Title>Bukkit</Specification-Title>
<Specification-Version>${api.version}</Specification-Version>
<Specification-Vendor>Bukkit Team</Specification-Vendor>
+ <Multi-Release>true</Multi-Release> <!-- Paper - update log4j -->
</manifestEntries>
<manifestSections>
<manifestSection>
@@ -199,7 +202,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
- <version>3.1.1</version>
+ <version>3.2.4</version> <!-- Paper - Update Log4j -->
<executions>
<execution>
<phase>package</phase>
@@ -208,6 +211,16 @@
</goals>
<configuration>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> <!-- Paper -->
+ <!-- Paper start - Update Log4j -->
+ <filters>
+ <filter>
+ <artifact>org.spigotmc:minecraft-server:**</artifact>
+ <excludes>
+ <exclude>org/apache/logging/log4j/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <!-- Paper - Update Log4j -->
<createSourcesJar>${shadeSourcesJar}</createSourcesJar>
<relocations>
<!-- Cannot be relocated as it breaks translation property keys -->
@@ -242,16 +255,18 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/java.sql.Driver</resource>
</transformer>
- <transformer implementation="com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer" />
+ <transformer implementation="io.github.edwgiz.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer" /> <!-- Paper - Update Log4j -->
</transformers>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
- <groupId>com.github.edwgiz</groupId>
- <artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
- <version>2.8.1</version>
+ <!-- paper start - update log4j -->
+ <groupId>io.github.edwgiz</groupId>
+ <artifactId>log4j-maven-shade-plugin-extensions</artifactId>
+ <version>2.17.0</version>
+ <!-- paper end - update log4j -->
</dependency>
</dependencies>
</plugin>
--
2.34.1

@ -1 +1 @@
Subproject commit a46fdbc62c828e3f038cacbad9b32607dcc5a2f4
Subproject commit 84f3da353f467a940c6f889b5516a73c62da1f9e

@ -1 +1 @@
Subproject commit d4ceaa7405d1d8e480cf201d45eff7194741a06f
Subproject commit 2d4c7b3bbd322d8b7f3bbe2fe33ecf627251c828