even even even more work

This commit is contained in:
MiniDigger 2020-06-25 16:09:55 +02:00
parent 8ac3123f9f
commit 03a53a63b6
215 changed files with 1750 additions and 2211 deletions

6
SHIT_TO_CHECK.md Normal file
View file

@ -0,0 +1,6 @@
# Shit to check
* Mini: "Allow disabling armour stand ticking": Not sure if the equipment update actually works, vanilla shifted a bunch of shit
* Mini: "Optimize World Server Map": Figure out how to fill PaperWorldMap, it needs a dim key which doesnt exist anymore?
* Mini: "MC-50319": fix if still works
* Mini: I definetly dropped a patch I didnt want to drop, we need to go thru in the end and see if all patches are still in, lol

View file

@ -635,10 +635,10 @@ index 74ad1325727bdc41ed5b2e67058aeaa4fe6db4f2..03dc3dd41015dc210d2781c207261fc3
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9c13f39e85b019440cb59bbd736ad9920e2151da..174c63f2c93693aa06a3574dc6dea91c98ea1e25 100644
index 9aa648bb5ec42730f6ce85902b91a079084e7f8e..d9dda69118a5319da28cf3011fe5d8a64da08a5c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -792,6 +792,7 @@ public final class CraftServer implements Server {
@@ -793,6 +793,7 @@ public final class CraftServer implements Server {
}
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
@ -646,7 +646,7 @@ index 9c13f39e85b019440cb59bbd736ad9920e2151da..174c63f2c93693aa06a3574dc6dea91c
for (WorldServer world : console.getWorlds()) {
world.worldDataServer.setDifficulty(config.difficulty);
world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals);
@@ -819,6 +820,7 @@ public final class CraftServer implements Server {
@@ -820,6 +821,7 @@ public final class CraftServer implements Server {
world.ticksPerAmbientSpawns = this.getTicksPerAmbientSpawns();
}
world.spigotConfig.init(); // Spigot
@ -654,7 +654,7 @@ index 9c13f39e85b019440cb59bbd736ad9920e2151da..174c63f2c93693aa06a3574dc6dea91c
}
pluginManager.clearPlugins();
@@ -826,6 +828,7 @@ public final class CraftServer implements Server {
@@ -827,6 +829,7 @@ public final class CraftServer implements Server {
resetRecipes();
reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
@ -662,7 +662,7 @@ index 9c13f39e85b019440cb59bbd736ad9920e2151da..174c63f2c93693aa06a3574dc6dea91c
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -2051,4 +2054,35 @@ public final class CraftServer implements Server {
@@ -2055,4 +2058,35 @@ public final class CraftServer implements Server {
{
return spigot;
}

View file

@ -3807,10 +3807,10 @@ index 0000000000000000000000000000000000000000..da7a325d070e194cd1664ed20dcb3a76
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f5346ebbc338b002a9997e13e3bfba2d31457d90..aeb2e95e4c350f0b539466fc56ac41c8280aba20 100644
index 3cb0957d8b57c930d74fc25aa5e1a0eaaf33e747..0aed429bfa996b1b01dbe2c876c6ad489ab7fa4a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -764,6 +764,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -767,6 +767,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
MinecraftServer.LOGGER.error("Failed to unlock level {}", this.convertable.getLevelName(), ioexception1);
}
// Spigot start
@ -4116,7 +4116,7 @@ index dc5e59bcecbe080445f33daa01b81ba747ed6337..ca41e420a1ab22f097dd0b98e156fd51
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index a25d431630596d631b6ee1c1a9f386f5940eb480..11e42f083d793dbdda3aab3280984add26232ed3 100644
index 5f692d719fd270120207ebcf6d0a2a24e8d59f7b..3e2e355177e32856dac07dc8b98658ad1b717045 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -101,6 +101,26 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -4447,7 +4447,7 @@ index ac7c9efc53123e4fa964b33f67cf8196846056cc..f45b5ddc66024e993ac94436ee25a03e
private final MinecraftServer server;
public final WorldDataServer worldDataServer; // CraftBukkit - type
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index e636cc71f7ea2941dd50cb0242cb9bc00ffecfb3..c59da5b36c158a25ab861b1aaee497b4119feb3e 100644
index 993fae70fe6844581b2a52bd4df8088539d49b8a..2097ea9b2683bf4063fbcb601720e8d297fb3b13 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -85,6 +85,7 @@ public final class CraftItemStack extends ItemStack {

View file

@ -1116,10 +1116,10 @@ index dccb315440f7429fe881bd0d12af8f1ae8e35c3d..96a95413f74592ef0a8e9367fd3ed81f
if (!this.world.isClientSide && this.dN() && this.aC()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316bcd9b492b 100644
index 0aed429bfa996b1b01dbe2c876c6ad489ab7fa4a..76ee1196df1d9a0f4c9dfb7b590ee95cc9871aae 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -64,7 +64,7 @@ import org.bukkit.craftbukkit.CraftServer;
@@ -65,7 +65,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.Main;
import org.bukkit.event.server.ServerLoadEvent;
// CraftBukkit end
@ -1128,7 +1128,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
import org.spigotmc.SlackActivityAccountant; // Spigot
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
@@ -118,8 +118,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -119,8 +119,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
private long T;
public final Thread serverThread;
private long nextTick;
@ -1139,7 +1139,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
private final ResourcePackRepository<ResourcePackLoader> resourcePackRepository;
private final ScoreboardServer scoreboardServer;
@Nullable
@@ -710,6 +710,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -713,6 +713,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
// CraftBukkit end
MinecraftServer.LOGGER.info("Stopping server");
@ -1147,7 +1147,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -907,9 +908,21 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -910,9 +911,21 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
private boolean canSleepForTick() {
// CraftBukkit start
@ -1169,7 +1169,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
private void executeModerately() {
this.executeAll();
java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
@@ -917,9 +930,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -920,9 +933,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// CraftBukkit end
protected void sleepForTick() {
@ -1181,7 +1181,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
});
}
@@ -1002,10 +1015,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1005,10 +1018,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
protected void exit() {}
protected void a(BooleanSupplier booleansupplier) {
@ -1201,7 +1201,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
++this.ticks;
this.b(booleansupplier);
if (i - this.T >= 5000000000L) {
@@ -1023,14 +1044,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1026,14 +1047,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
@ -1216,7 +1216,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
}
this.methodProfiler.enter("snooper");
@@ -1043,6 +1062,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1046,6 +1065,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
this.methodProfiler.exit();
@ -1230,7 +1230,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
this.methodProfiler.enter("tallying");
long l = this.h[this.ticks % 100] = SystemUtils.getMonotonicNanos() - i;
@@ -1053,30 +1079,29 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1056,30 +1082,29 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.exit();
org.spigotmc.WatchdogThread.tick(); // Spigot
this.slackActivityAccountant.tickEnded(l); // Spigot
@ -1269,7 +1269,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
// Send time updates to everyone, it will get the right time from the world the player is in.
if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -1084,7 +1109,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1087,7 +1112,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); // Add support for per player time
}
}
@ -1278,7 +1278,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
@@ -1125,24 +1150,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1128,24 +1153,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
this.methodProfiler.exitEnter("connection");
@ -1310,7 +1310,7 @@ index aeb2e95e4c350f0b539466fc56ac41c8280aba20..a7579b01d27e367603ba643c390b316b
this.methodProfiler.exit();
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 11e42f083d793dbdda3aab3280984add26232ed3..d40d7f18a44bb70f8867617b5afec8492e1fbfcb 100644
index 3e2e355177e32856dac07dc8b98658ad1b717045..7c5eaff23ef6bf3cdf2575330ea6341d6240e283 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1,7 +1,9 @@
@ -1756,10 +1756,10 @@ index f45b5ddc66024e993ac94436ee25a03e085742b4..2b39fb903c1cf6ded8aa170f5bd25f4f
// CraftBukkit start - moved from MinecraftServer.saveChunks
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 174c63f2c93693aa06a3574dc6dea91c98ea1e25..e7a8d0d02b49863ee3ad325b8be23bae6d3b861c 100644
index d9dda69118a5319da28cf3011fe5d8a64da08a5c..eb762944b1e7ba6fa47c899c77c94b789e92bdbd 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2024,12 +2024,31 @@ public final class CraftServer implements Server {
@@ -2028,12 +2028,31 @@ public final class CraftServer implements Server {
private final Spigot spigot = new Spigot()
{

View file

@ -19,10 +19,10 @@ index aab33df7a36eb69300fedfce733985d6c239ca01..550232cb3819138b3bae0fa1c5142948
throwable = throwable1;
throw throwable1;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a7579b01d27e367603ba643c390b316bcd9b492b..bcf84fb1edda703f263a96d5ae2f3c7a3707c1ae 100644
index 76ee1196df1d9a0f4c9dfb7b590ee95cc9871aae..f4d2ecac55d8ec6272fcb9488c8d4488119b991d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1222,7 +1222,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1225,7 +1225,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
public String getServerModName() {
@ -32,10 +32,10 @@ index a7579b01d27e367603ba643c390b316bcd9b492b..bcf84fb1edda703f263a96d5ae2f3c7a
public CrashReport b(CrashReport crashreport) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e7a8d0d02b49863ee3ad325b8be23bae6d3b861c..14f9fe011d45b7339c6475fcadff451126c5b1dc 100644
index eb762944b1e7ba6fa47c899c77c94b789e92bdbd..e5f7d6847be56e8fffa437d9dc4712667839161a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -223,7 +223,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
@@ -224,7 +224,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
public final class CraftServer implements Server {

View file

@ -12,10 +12,10 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index bcf84fb1edda703f263a96d5ae2f3c7a3707c1ae..a0055b2c27179fea9f09d6a70931a8f00d03413a 100644
index f4d2ecac55d8ec6272fcb9488c8d4488119b991d..401e528b0812f4917fe782a16ce3831e4427ac6b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -143,7 +143,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -144,7 +144,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public org.bukkit.command.ConsoleCommandSender console;
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
public ConsoleReader reader;
@ -24,7 +24,7 @@ index bcf84fb1edda703f263a96d5ae2f3c7a3707c1ae..a0055b2c27179fea9f09d6a70931a8f0
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
public File bukkitDataPackFolder;
@@ -153,7 +153,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -154,7 +154,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Spigot start
public static final int TPS = 20;
public static final int TICK_TIME = 1000000000 / TPS;
@ -33,7 +33,7 @@ index bcf84fb1edda703f263a96d5ae2f3c7a3707c1ae..a0055b2c27179fea9f09d6a70931a8f0
public final double[] recentTps = new double[ 3 ];
public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant();
// Spigot end
@@ -805,6 +805,57 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -808,6 +808,57 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
{
return ( avg * exp ) + ( tps * ( 1 - exp ) );
}
@ -91,7 +91,7 @@ index bcf84fb1edda703f263a96d5ae2f3c7a3707c1ae..a0055b2c27179fea9f09d6a70931a8f0
// Spigot End
protected void v() {
@@ -817,30 +868,38 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -820,30 +871,38 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Spigot start
Arrays.fill( recentTps, 20 );
@ -140,10 +140,10 @@ index bcf84fb1edda703f263a96d5ae2f3c7a3707c1ae..a0055b2c27179fea9f09d6a70931a8f0
GameProfilerTick gameprofilertick = GameProfilerTick.a("Server");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 14f9fe011d45b7339c6475fcadff451126c5b1dc..40019f276abea084b15386f00bde1bfdd5fdae77 100644
index e5f7d6847be56e8fffa437d9dc4712667839161a..1598cebd25f36e6609cb5eeaf9557c6d543eee4b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2021,6 +2021,17 @@ public final class CraftServer implements Server {
@@ -2025,6 +2025,17 @@ public final class CraftServer implements Server {
return CraftMagicNumbers.INSTANCE;
}

View file

@ -123,10 +123,10 @@ index bf156897acfe25c16a1b09a83a00ba3ab647a2dd..842563f2030382659a62a3a63d9af9d5
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a0055b2c27179fea9f09d6a70931a8f00d03413a..cc3718765ed54f8042a2687e409a51098ebc67a0 100644
index 401e528b0812f4917fe782a16ce3831e4427ac6b..fe47aa345b93105547e216f683491943866ccd3f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1206,6 +1206,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1209,6 +1209,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.exit();
this.methodProfiler.exit();

View file

@ -48,10 +48,10 @@ index 890b0fc7baf51ed6896d979021b3956c5c279c40..b468182266c39b9defa1aa287290f75f
} else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) {
// Do nothing, this is coming from a plugin
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 40019f276abea084b15386f00bde1bfdd5fdae77..c63d1468d2908db75176c5926a46293f5b94b6b2 100644
index 1598cebd25f36e6609cb5eeaf9557c6d543eee4b..ce5046ac7cd9648c303c1e6f850c5212af48a5b3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -744,6 +744,29 @@ public final class CraftServer implements Server {
@@ -745,6 +745,29 @@ public final class CraftServer implements Server {
Validate.notNull(commandLine, "CommandLine cannot be null");
org.spigotmc.AsyncCatcher.catchOp("command dispatch"); // Spigot

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c63d1468d2908db75176c5926a46293f5b94b6b2..15ee6ee6e96bb48f73cbb2944eeee8f726914e2d 100644
index ce5046ac7cd9648c303c1e6f850c5212af48a5b3..8091c4538a97fbc8f2495183ef952aecde659342 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1680,6 +1680,7 @@ public final class CraftServer implements Server {
@@ -1684,6 +1684,7 @@ public final class CraftServer implements Server {
return helpMap;
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Be a bit more informative in maxHealth exception
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 28151d15372ea30d308fedda502427a4ba161cd0..20ada1ab2bea9fa5bde19cb4768d64f73a4154d2 100644
index 8f16b27123f1fc7c648c7d1f7c557e491d36f243..7e95ef170c418594f5469431c052e64107c08ab5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -107,7 +107,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -109,7 +109,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setHealth(double health) {
health = (float) health;
if ((health < 0) || (health > getMaxHealth())) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add velocity warnings
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 15ee6ee6e96bb48f73cbb2944eeee8f726914e2d..49889d8c1d1f9b9c79b1d526f4cd9a94944c1c72 100644
index 8091c4538a97fbc8f2495183ef952aecde659342..af17df4810ef30eba640028dd0b2047ed387eff0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -258,6 +258,7 @@ public final class CraftServer implements Server {
@@ -259,6 +259,7 @@ public final class CraftServer implements Server {
public boolean ignoreVanillaPermissions = false;
private final List<CraftPlayer> playerView;
public int reloadCount;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add methods for working with arrows stuck in living entities
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 20ada1ab2bea9fa5bde19cb4768d64f73a4154d2..8c3fa2335cfa1df94eb64bda5b12f1f5858dec27 100644
index 7e95ef170c418594f5469431c052e64107c08ab5..d5b165e8275c012d775b77b8440489716a6c3c08 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -629,4 +629,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -636,4 +636,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public <T> void setMemory(MemoryKey<T> memoryKey, T t) {
getHandle().getBehaviorController().setMemory(CraftMemoryKey.fromMemoryKey(memoryKey), CraftMemoryMapper.toNms(t));
}

View file

@ -30,10 +30,10 @@ index f402a29b0904a0094ffe6e42dbdc6fbc0912d9d9..6ef5bb9f323da7cbf8cb24d094bf43c4
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 49889d8c1d1f9b9c79b1d526f4cd9a94944c1c72..2fb96635d7f811fd77a807ae4a4cc1c0ae0af47a 100644
index af17df4810ef30eba640028dd0b2047ed387eff0..3b61bb5da6adc04eed934885be7ece2b3f4ea74c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -394,6 +394,7 @@ public final class CraftServer implements Server {
@@ -395,6 +395,7 @@ public final class CraftServer implements Server {
if (type == PluginLoadOrder.STARTUP) {
helpMap.clear();
helpMap.initializeGeneralTopics();
@ -41,7 +41,7 @@ index 49889d8c1d1f9b9c79b1d526f4cd9a94944c1c72..2fb96635d7f811fd77a807ae4a4cc1c0
}
Plugin[] plugins = pluginManager.getPlugins();
@@ -413,7 +414,7 @@ public final class CraftServer implements Server {
@@ -414,7 +415,7 @@ public final class CraftServer implements Server {
commandMap.registerServerAliases();
DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions();

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions
https://github.com/PaperMC/Paper/issues/49
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2fb96635d7f811fd77a807ae4a4cc1c0ae0af47a..530c0fb05c4631e8946a7defdf9e5c535bc3ddc2 100644
index 3b61bb5da6adc04eed934885be7ece2b3f4ea74c..e1c39accfbdd1ac4bcfdfa9bc159f6d62a36fb50 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2140,5 +2140,23 @@ public final class CraftServer implements Server {
@@ -2144,5 +2144,23 @@ public final class CraftServer implements Server {
return null;
}
}

View file

@ -7,10 +7,10 @@ Metadata is not meant to persist reload as things break badly with non primitive
This will remove metadata on reload so it does not crash everything if a plugin uses it.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 530c0fb05c4631e8946a7defdf9e5c535bc3ddc2..f29253ba0fdf30d78dbec58a8c706e219653ddeb 100644
index e1c39accfbdd1ac4bcfdfa9bc159f6d62a36fb50..c8073b635ff03e2d76b1def6fd3144b88a385722 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -848,8 +848,18 @@ public final class CraftServer implements Server {
@@ -849,8 +849,18 @@ public final class CraftServer implements Server {
world.paperConfig.init(); // Paper
}

View file

@ -32,10 +32,10 @@ index f87fc631255aa5948459f0726b188ebbbae13c5f..446a2ffcd95fd631750b74fd31b4c410
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index cc3718765ed54f8042a2687e409a51098ebc67a0..3202c171cffed5c5cec74f6b082aedaeae1c7b9d 100644
index fe47aa345b93105547e216f683491943866ccd3f..2455bbee53b4fe3084a785471fde7c4a3354dd4b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1172,6 +1172,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1175,6 +1175,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();

View file

@ -19,10 +19,10 @@ index d500cd75a9229584a70bbdbda6de9bce67b836e8..e4f0db64c061af684c28f50f0a37fbca
+ }
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3202c171cffed5c5cec74f6b082aedaeae1c7b9d..04429bb6f4d75800425087d8a5463ab9f4f4cef3 100644
index 2455bbee53b4fe3084a785471fde7c4a3354dd4b..89aad84d516e96bcebf1d9684426a3be0cba8ca1 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -433,6 +433,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -436,6 +436,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] remove null possibility for getServer singleton
to stop IDE complaining about potential NPE
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 04429bb6f4d75800425087d8a5463ab9f4f4cef3..17846ca9190c63671ad616c668aa1fe1367bcac1 100644
index 89aad84d516e96bcebf1d9684426a3be0cba8ca1..dcc138b48e6208f774586e09eb43c3446494542f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -69,6 +69,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
@@ -70,6 +70,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
@ -17,7 +17,7 @@ index 04429bb6f4d75800425087d8a5463ab9f4f4cef3..17846ca9190c63671ad616c668aa1fe1
public static final Logger LOGGER = LogManager.getLogger();
public static final File b = new File("usercache.json");
public static final WorldSettings c = new WorldSettings("Demo World", EnumGamemode.SURVIVAL, false, EnumDifficulty.NORMAL, false, new GameRules(), DataPackConfiguration.a);
@@ -176,6 +177,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -177,6 +178,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository<ResourcePackLoader> resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
super("Server");
@ -25,7 +25,7 @@ index 04429bb6f4d75800425087d8a5463ab9f4f4cef3..17846ca9190c63671ad616c668aa1fe1
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ag);
this.methodProfiler = GameProfilerDisabled.a;
this.serverPing = new ServerPing();
@@ -2033,7 +2035,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -2036,7 +2038,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Deprecated
public static MinecraftServer getServer() {

View file

@ -10,10 +10,10 @@ Additionally, move Saving of the User cache to be done async, incase
the user never changed the default setting for Spigot's save on stop only.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 17846ca9190c63671ad616c668aa1fe1367bcac1..800ca2d57295c40853f5f1e58ce15e75f1a5afad 100644
index dcc138b48e6208f774586e09eb43c3446494542f..56c9e7e2fd3b454f20fe6f440915bbb770d9a0c9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -786,7 +786,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -789,7 +789,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} catch (java.lang.InterruptedException ignored) {} // Paper
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
LOGGER.info("Saving usercache.json");

View file

@ -45,10 +45,10 @@ index 060887d765604e4be82913607bb6266a278f5db6..c5957c2d6c54b076ebe7f9a432e30551
} else {
String[] astring1 = astring;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f29253ba0fdf30d78dbec58a8c706e219653ddeb..28b3c800683dd42b88d630c9ae83996b7b4f65df 100644
index c8073b635ff03e2d76b1def6fd3144b88a385722..ff4cbded970340c0c5321f1c6c3494dc3267e14e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1458,7 +1458,8 @@ public final class CraftServer implements Server {
@@ -1462,7 +1462,8 @@ public final class CraftServer implements Server {
// Spigot Start
GameProfile profile = null;
// Only fetch an online UUID in online mode

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 28b3c800683dd42b88d630c9ae83996b7b4f65df..a0d1e57ff34dfb36913ff937575bb3c1ad444f54 100644
index ff4cbded970340c0c5321f1c6c3494dc3267e14e..f18fb72b62a2c04f03a06de2bbcdee5b7a971aa4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2169,5 +2169,24 @@ public final class CraftServer implements Server {
@@ -2173,5 +2173,24 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions();
}

View file

@ -278,10 +278,10 @@ index ba42ca08ca61832cb07bebcfa0b1e5422d7b30e9..623cd63711c6cb79dce7a46056e193fd
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 426b25c709a8e87f409156e252ea7597c154a50b..876a62a456c8ff938cca4944b0b40a135dd6ac1c 100644
index dc33b91a517b8cfeeed06781fb62f5baa6113aa7..7c4514ad1969f7f79bb474606df0f2c3c5888b1a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1805,7 +1805,7 @@ public class CraftWorld implements World {
@@ -1807,7 +1807,7 @@ public class CraftWorld implements World {
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
entity = new EntityTNTPrimed(world, x, y, z, null);
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
@ -289,7 +289,7 @@ index 426b25c709a8e87f409156e252ea7597c154a50b..876a62a456c8ff938cca4944b0b40a13
+ entity = new EntityExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
entity = EntityTypes.LIGHTNING_BOLT.a(world);
} else if (Firework.class.isAssignableFrom(clazz)) {
} else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
index 1b512cc45c7a185b8a7950ff9882e1f2af171cc8..fbad0456757cadea4d7f50c63dbb07bad7e8baa9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java

View file

@ -30,10 +30,10 @@ will have plugins and worlds saving to the disk has a high potential to result
in corruption/dataloss.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 800ca2d57295c40853f5f1e58ce15e75f1a5afad..8e47f5f5dcf217169107913cc0c8332ce881c644 100644
index 56c9e7e2fd3b454f20fe6f440915bbb770d9a0c9..bb08e1ed62e50549bcef036218f9ed9ed8124a97 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -90,6 +90,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -91,6 +91,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public final Map<ResourceKey<World>, WorldServer> worldServer;
private PlayerList playerList;
private volatile boolean isRunning;
@ -41,7 +41,7 @@ index 800ca2d57295c40853f5f1e58ce15e75f1a5afad..8e47f5f5dcf217169107913cc0c8332c
private boolean isStopped;
private int ticks;
protected final Proxy proxy;
@@ -739,7 +740,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -742,7 +743,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (this.playerList != null) {
MinecraftServer.LOGGER.info("Saving players");
this.playerList.savePlayers();
@ -50,7 +50,7 @@ index 800ca2d57295c40853f5f1e58ce15e75f1a5afad..8e47f5f5dcf217169107913cc0c8332c
try { Thread.sleep(100); } catch (InterruptedException ex) {} // CraftBukkit - SPIGOT-625 - give server at least a chance to send packets
}
@@ -804,8 +805,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -807,8 +808,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
return this.isRunning;
}
@ -64,7 +64,7 @@ index 800ca2d57295c40853f5f1e58ce15e75f1a5afad..8e47f5f5dcf217169107913cc0c8332c
if (flag) {
try {
this.serverThread.join();
@@ -815,6 +821,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -818,6 +824,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
}

View file

@ -20,10 +20,10 @@ index 5a83fc21cb6801d597a01fb4a83d30488f30bdb6..295b8390cbc31fc1fcb225f80ec2ff8f
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a0d1e57ff34dfb36913ff937575bb3c1ad444f54..2cbf143d1a01a34c67b75ab1f7cd35f4a3a2f751 100644
index f18fb72b62a2c04f03a06de2bbcdee5b7a971aa4..1417bdfc00bbe6d55bbd59b8d5c9aa88f17dbb6b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2188,5 +2188,10 @@ public final class CraftServer implements Server {
@@ -2192,5 +2192,10 @@ public final class CraftServer implements Server {
commandMap.registerServerAliases();
return true;
}

View file

@ -186,19 +186,19 @@ index b091db5901d75769e406c454b205f102c82ca021..49b5c226dcbd4ef7d2a3418ef2c7e98b
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 8e47f5f5dcf217169107913cc0c8332ce881c644..f2cdf60fd96f94e09a17ad1bdec522d282ccf3e9 100644
index bb08e1ed62e50549bcef036218f9ed9ed8124a97..a068bce80d9d0638b67e6dff66f857f5e8dd52fc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -57,7 +57,7 @@ import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.LogManager;
@@ -58,7 +58,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
// CraftBukkit start
import com.google.common.collect.ImmutableSet;
-import jline.console.ConsoleReader;
+// Paper
+// import jline.console.ConsoleReader; // Paper
import joptsimple.OptionSet;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.CraftServer;
@@ -144,7 +144,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -145,7 +145,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
public OptionSet options;
public org.bukkit.command.ConsoleCommandSender console;
public org.bukkit.command.RemoteConsoleCommandSender remoteConsole;
@ -207,7 +207,7 @@ index 8e47f5f5dcf217169107913cc0c8332ce881c644..f2cdf60fd96f94e09a17ad1bdec522d2
public static int currentTick = 0; // Paper - Further improve tick loop
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
@@ -214,7 +214,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -215,7 +215,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.options = options;
this.datapackconfiguration = datapackconfiguration;
this.vanillaCommandDispatcher = datapackresources.commandDispatcher; // CraftBukkit
@ -217,7 +217,7 @@ index 8e47f5f5dcf217169107913cc0c8332ce881c644..f2cdf60fd96f94e09a17ad1bdec522d2
if (System.console() == null && System.getProperty("jline.terminal") == null) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
Main.useJline = false;
@@ -235,6 +237,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -236,6 +238,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
LOGGER.warn((String) null, ex);
}
}
@ -226,7 +226,7 @@ index 8e47f5f5dcf217169107913cc0c8332ce881c644..f2cdf60fd96f94e09a17ad1bdec522d2
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
}
// CraftBukkit end
@@ -977,7 +981,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -980,7 +984,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
org.spigotmc.WatchdogThread.doStop(); // Spigot
// CraftBukkit start - Restore terminal to original settings
try {
@ -235,7 +235,7 @@ index 8e47f5f5dcf217169107913cc0c8332ce881c644..f2cdf60fd96f94e09a17ad1bdec522d2
} catch (Exception ignored) {
}
// CraftBukkit end
@@ -1348,7 +1352,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1351,7 +1355,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@Override
public void sendMessage(IChatBaseComponent ichatbasecomponent, UUID uuid) {
@ -259,10 +259,10 @@ index c595d6e6126749a94e264acdb9e0ba609c72e6bc..21f583302e9d8da8c9a9651ce40c64dc
this.k = new GameProfileBanList(PlayerList.b);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2cbf143d1a01a34c67b75ab1f7cd35f4a3a2f751..08bc47fdec472c73493cc1a75bd0d84287b1c811 100644
index 1417bdfc00bbe6d55bbd59b8d5c9aa88f17dbb6b..e92367a8add47a62567fe691820e2b57baa58b3f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -45,7 +45,7 @@ import java.util.function.Consumer;
@@ -46,7 +46,7 @@ import java.util.function.Consumer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
@ -271,7 +271,7 @@ index 2cbf143d1a01a34c67b75ab1f7cd35f4a3a2f751..08bc47fdec472c73493cc1a75bd0d842
import net.minecraft.server.Advancement;
import net.minecraft.server.ArgumentEntity;
import net.minecraft.server.BiomeManager;
@@ -1177,9 +1177,13 @@ public final class CraftServer implements Server {
@@ -1181,9 +1181,13 @@ public final class CraftServer implements Server {
return logger;
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add UnknownCommandEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 08bc47fdec472c73493cc1a75bd0d84287b1c811..1d7549e03bc43f1867662acf12ae3cb82a951478 100644
index e92367a8add47a62567fe691820e2b57baa58b3f..c305bf571626e25f084d9323551bd39506042a75 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -104,6 +104,7 @@ import net.minecraft.server.WorldNBTStorage;
@@ -105,6 +105,7 @@ import net.minecraft.server.WorldNBTStorage;
import net.minecraft.server.WorldServer;
import net.minecraft.server.WorldSettings;
import org.apache.commons.lang.Validate;
@ -16,7 +16,7 @@ index 08bc47fdec472c73493cc1a75bd0d84287b1c811..1d7549e03bc43f1867662acf12ae3cb8
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -175,6 +176,7 @@ import org.bukkit.craftbukkit.util.Versioning;
@@ -176,6 +177,7 @@ import org.bukkit.craftbukkit.util.Versioning;
import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -24,7 +24,7 @@ index 08bc47fdec472c73493cc1a75bd0d84287b1c811..1d7549e03bc43f1867662acf12ae3cb8
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerChatTabCompleteEvent;
import org.bukkit.event.server.BroadcastMessageEvent;
@@ -775,7 +777,13 @@ public final class CraftServer implements Server {
@@ -776,7 +778,13 @@ public final class CraftServer implements Server {
// Spigot start
if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) {

View file

@ -449,7 +449,7 @@ index da7a325d070e194cd1664ed20dcb3a762c9a517a..797654c653ec6dc4d46b457cf8a6121b
* Calculates distance between 2 entities
* @param e1
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 4537fc3e134973679a6b661a98437fb9120fc449..a4a796c0287021625c03ec68b79d555067c449cc 100644
index 1fce35c89ee4edda27c9d755cf9ee8d315567621..ca45b10b5dd7003314ff4c3294f13d2c53d9e678 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -87,7 +87,7 @@ public class Main {
@ -462,10 +462,10 @@ index 4537fc3e134973679a6b661a98437fb9120fc449..a4a796c0287021625c03ec68b79d5550
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f2cdf60fd96f94e09a17ad1bdec522d282ccf3e9..82e0def9becf8ecb68b2629531852808ad5a40a3 100644
index a068bce80d9d0638b67e6dff66f857f5e8dd52fc..c8a82a6b4b29dcee0f7996b7fd9f01fd73ec2659 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1599,6 +1599,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1602,6 +1602,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.G = i;
}
@ -560,10 +560,10 @@ index 4f769211cf98c3da720a904da3dcdcd4c7611f0b..a038397028848edb4f43cd4f72625466
private UserCacheEntry(GameProfile gameprofile, Date date) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1d7549e03bc43f1867662acf12ae3cb82a951478..07a4ce8c71d52f4a6f1f9c97b9cb143c72db8af9 100644
index c305bf571626e25f084d9323551bd39506042a75..d9464d759c6df200a9bceeee028baa15dd2b86b3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -224,6 +224,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
@@ -225,6 +225,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
@ -573,7 +573,7 @@ index 1d7549e03bc43f1867662acf12ae3cb82a951478..07a4ce8c71d52f4a6f1f9c97b9cb143c
public final class CraftServer implements Server {
private final String serverName = "Paper"; // Paper
private final String serverVersion;
@@ -2205,5 +2208,24 @@ public final class CraftServer implements Server {
@@ -2209,5 +2212,24 @@ public final class CraftServer implements Server {
public boolean suggestPlayerNamesWhenNullTabCompletions() {
return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions;
}

View file

@ -7,10 +7,10 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr
to ensure it meets latest minecraft expectations.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index b2fadd5a3c2d35e1d6f3c02dd5cf450ff1f31d36..71e289b5a7777e307b937f243d4f2204d17d8845 100644
index c55c7d765d179c8d78929fe3395ce3e147f8daea..0a29a851c4bd5ef9745c93e29a8c580baece00da 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -321,4 +321,10 @@ public final class CraftItemFactory implements ItemFactory {
@@ -325,4 +325,10 @@ public final class CraftItemFactory implements ItemFactory {
public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException {
return ((CraftMetaItem) meta).updateMaterial(material);
}

View file

@ -34,10 +34,10 @@ index ea7cb9943dc6da7a05e0841985eb1be4b6bc5169..c83ba9d9869f8ba51df17963d530536d
public abstract boolean b(String s);
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 71e289b5a7777e307b937f243d4f2204d17d8845..8d694e3a659a405fc5f6729ce512be81316229a9 100644
index 0a29a851c4bd5ef9745c93e29a8c580baece00da..9dcc81140a803c07c839faa115db81ff09e22515 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -326,5 +326,18 @@ public final class CraftItemFactory implements ItemFactory {
@@ -330,5 +330,18 @@ public final class CraftItemFactory implements ItemFactory {
public ItemStack ensureServerConversions(ItemStack item) {
return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
}

View file

@ -18,10 +18,10 @@ index 34f2821a64c7893ff0a8c33ae4b77ce883227f0c..7ec1a572efd99928e8aae9b75c0eed73
protected int ticksFarFromPlayer;
protected float aQ;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 8c3fa2335cfa1df94eb64bda5b12f1f5858dec27..1f33b2d7db6ab1c0f07f3e87cb046eda40f6c698 100644
index d5b165e8275c012d775b77b8440489716a6c3c08..5e2642b33d36e0695d6adc879f9595030adaaf31 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -319,6 +319,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -321,6 +321,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
}

View file

@ -72,10 +72,10 @@ index b2eac041c3ff7d8a7c4524dac381ab95045f28af..fa5c640239451579fba35ad7b0979739
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 07a4ce8c71d52f4a6f1f9c97b9cb143c72db8af9..cf93d5451a68e812811b32add1a76ed1ee6f3c27 100644
index d9464d759c6df200a9bceeee028baa15dd2b86b3..f51a59f5c1a0c8e34921fbf79c86f999c9951ee6 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1761,7 +1761,7 @@ public final class CraftServer implements Server {
@@ -1765,7 +1765,7 @@ public final class CraftServer implements Server {
offers = tabCompleteChat(player, message);
}

View file

@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..a85466bc7e0a8aa54b9eff14077fe6c9
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 82e0def9becf8ecb68b2629531852808ad5a40a3..445d691b5051b4aefe480bea33a7bd6855009ecf 100644
index c8a82a6b4b29dcee0f7996b7fd9f01fd73ec2659..f5fa425308e4253d961f8f2bac5b961616dd8521 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2,6 +2,9 @@ package net.minecraft.server;
@ -190,7 +190,7 @@ index 82e0def9becf8ecb68b2629531852808ad5a40a3..445d691b5051b4aefe480bea33a7bd68
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1118,7 +1121,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1121,7 +1124,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (i - this.T >= 5000000000L) {
this.T = i;
this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount()));

View file

@ -6,23 +6,23 @@ Subject: [PATCH] Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 55d08d77480fda81e0155aa1e0287fddc827b67a..fda1b3d91b14080bf04a02c1340c63a6eb37911d 100644
index 5326e7433dc0a4ff0e1d0ca30aad95b1ec718d6a..a781ac0cf8766e915c10ebd3823cbe5b0d1c5230 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -66,7 +66,7 @@ public abstract class EntityHuman extends EntityLiving {
protected int bO;
protected final float bP = 0.02F;
private int bS;
- private final GameProfile bT;
+ private GameProfile bT; public final void setProfile(final GameProfile profile) { this.bT = profile; } // Paper - OBFHELPER
private ItemStack bV;
private final ItemCooldown bW;
@@ -65,7 +65,7 @@ public abstract class EntityHuman extends EntityLiving {
protected int bN;
protected final float bO = 0.02F;
private int g;
- private final GameProfile bQ;
+ private final GameProfile bQ; public final void setProfile(final GameProfile profile) { this.bQ = profile; } // Paper - OBFHELPER
private ItemStack bS;
private final ItemCooldown bT;
@Nullable
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 1b43f921646e3c1bfdca22ef7d3719c72aaf4520..1c4ac7bf7ac4d864ba6efd46d8c562c238dad2bc 100644
index 80a21dbc05ed3007f2e827f7a320131244c3044b..e0f0a1e91a037f93b239e779aa8fd92be8a8c01f 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -37,7 +37,7 @@ public class LoginListener implements PacketLoginInListener {
@@ -36,7 +36,7 @@ public class LoginListener implements PacketLoginInListener {
public final NetworkManager networkManager;
private LoginListener.EnumProtocolState g;
private int h;
@ -31,7 +31,7 @@ index 1b43f921646e3c1bfdca22ef7d3719c72aaf4520..1c4ac7bf7ac4d864ba6efd46d8c562c2
private final String j;
private SecretKey loginKey;
private EntityPlayer l;
@@ -291,12 +291,12 @@ public class LoginListener implements PacketLoginInListener {
@@ -290,12 +290,12 @@ public class LoginListener implements PacketLoginInListener {
final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
// Paper start
@ -48,7 +48,7 @@ index 1b43f921646e3c1bfdca22ef7d3719c72aaf4520..1c4ac7bf7ac4d864ba6efd46d8c562c2
uniqueId = i.getId();
// Paper end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc263f88947f 100644
index 734274db8f8c53d7e5310f2c16b1c64a42a6277c..4f0dabdb6683402d9fd0ea789381928fa06ee119 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,6 +1,8 @@
@ -60,7 +60,7 @@ index 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc26
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.io.BaseEncoding;
@@ -1175,8 +1177,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1216,8 +1218,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
// Remove this player from the hidden player's EntityTrackerEntry
@ -75,7 +75,7 @@ index 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc26
PlayerChunkMap.EntityTracker entry = tracker.trackedEntities.get(other.getId());
if (entry != null) {
entry.clear(getHandle());
@@ -1217,8 +1224,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1258,8 +1265,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
hiddenPlayers.remove(player.getUniqueId());
@ -90,7 +90,7 @@ index 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc26
getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
@@ -1227,6 +1239,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1268,6 +1280,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
entry.updatePlayer(getHandle());
}
}

View file

@ -7,7 +7,7 @@ If the dragon tries to find "ground" and hits a hole, or off edge,
it will infinitely keep looking for non air and eventually crash.
diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
index c42de9771e96f0b1bc8fbe9fe76572ab18d5d98c..40a8beff556873a5db108e44fd053e8de80e36a6 100644
index d70a45f2530d9dd5e10aa48f20db33a97bbe952e..fbc2ec88f7c71c853c492301986a23dafc8fa7a6 100644
--- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
@@ -54,7 +54,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded

View file

@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3697b3298feaec30c305e3da011790f2406e12d7..0ec84609896dd53a0c2c232f45e5c8f83558a37c 100644
index f51a59f5c1a0c8e34921fbf79c86f999c9951ee6..98475ce12d6b370b69466f1869d8be07d5130806 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1403,6 +1403,26 @@ public final class CraftServer implements Server {
@@ -1466,6 +1466,26 @@ public final class CraftServer implements Server {
return recipients.size();
}

View file

@ -23,14 +23,14 @@ index 5884b04f7e84048a9710736bd14237140ebf2cf7..ba341e0174cdc3b5b8bc83b743027018
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index a0254d8e519fa8b19dc282f3abf33b8ebe4f0aba..e60e10c57d5acaecb70e89c83c34f1f8870091c2 100644
index ef9719bf20db92a7e6690bccb00cc54293d392a9..ae43d8d2af0daa68f13528d25bac1d94964662bc 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -138,6 +138,7 @@ public class WorldNBTStorage implements IPlayerFileData {
@@ -27,6 +27,7 @@ public class WorldNBTStorage {
}
@Override
public void save(EntityHuman entityhuman) {
+ if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable
try {
NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound());
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat.tmp");
File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir);

View file

@ -9,10 +9,10 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d571248f597cbad63d26bc1bdf91cc263f88947f..f5c722644a1955c9bc68c89fdbb84526f9bbb7a0 100644
index 4f0dabdb6683402d9fd0ea789381928fa06ee119..ec0cb22d53733bed33019b257ac06ca9dc80d19e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -137,6 +137,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -141,6 +141,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start
private org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus;
private String resourcePackHash;
@ -20,7 +20,7 @@ index d571248f597cbad63d26bc1bdf91cc263f88947f..f5c722644a1955c9bc68c89fdbb84526
// Paper end
public CraftPlayer(CraftServer server, EntityPlayer entity) {
@@ -1444,7 +1445,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1485,7 +1486,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void addChannel(String channel) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add method to open already placed sign
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 191bb7345e06cbad7bef416e4e849df3727bdac0..20f0783025516048851aedef0a70759c2953ae47 100644
index d67fd3bf1048afae0bb78a95724ddf53337d9a2f..42bc39381c4fc5ff81bdd312afd1644dcc5d40c2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -617,4 +617,17 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -584,4 +584,17 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
entity.remove();
}
}

View file

@ -20,10 +20,10 @@ index 77cdbfadf9c3eddb6a02460c321fa816d1bab8ac..171c8e3031cf4bf4da062663089cc0cb
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index fda1b3d91b14080bf04a02c1340c63a6eb37911d..14a0e3d41ccd896da3b1126a403b0b684cada907 100644
index a781ac0cf8766e915c10ebd3823cbe5b0d1c5230..59f7fced6213c218cd19863be99964eb496b6fe6 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1112,7 +1112,11 @@ public abstract class EntityHuman extends EntityLiving {
@@ -1091,7 +1091,11 @@ public abstract class EntityHuman extends EntityLiving {
}
this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D));

View file

@ -5,14 +5,14 @@ Subject: [PATCH] Fix exploit that allowed colored signs to be created
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index c256e798d12098881cb5bfb655eab5b63f1614e7..a357b6167405be4034cf3dad4124827e04278366 100644
index fa5c640239451579fba35ad7b0979739e0b7b16f..e78306cb187b5f08e32888ebd55c4c486fc8dad2 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2502,7 +2502,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2541,7 +2541,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
String[] lines = new String[4];
for (int i = 0; i < astring.length; ++i) {
- lines[i] = EnumChatFormat.b(new ChatComponentText(EnumChatFormat.b(astring[i])).getString());
- lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a(astring[i])).getString());
+ lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines);

View file

@ -8,7 +8,7 @@ Fires an event anytime an enderman intends to teleport away from the player
You may cancel this, enabling ranged attacks to damage the enderman for example.
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 538c2169cd53d364b941ad1251df3731f77b3a2c..2893f75bdff91e810431c64899b64047c372aa62 100644
index 37a4bce1cd24e04b70367484c1ad3beae047ab08..888e66520548a47dbfa1c452b0d3fa5dcbe2002c 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
@ -19,7 +19,7 @@ index 538c2169cd53d364b941ad1251df3731f77b3a2c..2893f75bdff91e810431c64899b64047
import java.util.Random;
import java.util.UUID;
import java.util.function.Predicate;
@@ -56,6 +57,12 @@ public class EntityEnderman extends EntityMonster {
@@ -56,6 +57,12 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
}
@ -32,37 +32,37 @@ index 538c2169cd53d364b941ad1251df3731f77b3a2c..2893f75bdff91e810431c64899b64047
@Override
public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
@@ -177,7 +184,7 @@ public class EntityEnderman extends EntityMonster {
if (this.world.isDay() && this.ticksLived >= this.bA + 600) {
float f = this.aI();
@@ -209,7 +216,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
if (this.world.isDay() && this.ticksLived >= this.bz + 600) {
float f = this.aO();
- if (f > 0.5F && this.world.f(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.world.f(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
- if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
this.setGoalTarget((EntityLiving) null);
this.eq();
this.eM();
}
@@ -277,17 +284,19 @@ public class EntityEnderman extends EntityMonster {
} else if (!(damagesource instanceof EntityDamageSourceIndirect) && damagesource != DamageSource.FIREWORKS) {
boolean flag = super.damageEntity(damagesource, f);
- if (!this.world.p_() && damagesource.ignoresArmor() && this.random.nextInt(10) != 0) {
+ if (!this.world.p_() && damagesource.ignoresArmor() && this.random.nextInt(10) != 0 && this.tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper
this.eq();
}
return flag;
} else {
@@ -307,17 +314,19 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
if (this.isInvulnerable(damagesource)) {
return false;
} else if (damagesource instanceof EntityDamageSourceIndirect) {
+ if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
for (int i = 0; i < 64; ++i) {
if (this.eq()) {
if (this.eM()) {
return true;
}
}
+ } // Paper end
return false;
}
@@ -422,7 +431,7 @@ public class EntityEnderman extends EntityMonster {
} else {
boolean flag = super.damageEntity(damagesource, f);
- if (!this.world.s_() && this.random.nextInt(10) != 0) {
+ if (!this.world.s_() && this.random.nextInt(10) != 0 && this.tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper
this.eM();
}
@@ -459,7 +468,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
static class PathfinderGoalPlayerWhoLookedAtTarget extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
@ -71,12 +71,12 @@ index 538c2169cd53d364b941ad1251df3731f77b3a2c..2893f75bdff91e810431c64899b64047
private EntityHuman j;
private int k;
private int l;
@@ -481,7 +490,7 @@ public class EntityEnderman extends EntityMonster {
@@ -522,7 +531,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
} else {
if (this.c != null && !this.i.isPassenger()) {
if (this.i.f((EntityHuman) this.c)) {
if (this.i.g((EntityHuman) this.c)) {
- if (this.c.h((Entity) this.i) < 16.0D) {
+ if (this.c.h((Entity) this.i) < 16.0D && this.getEnderman().tryEscape(EndermanEscapeEvent.Reason.STARE)) {
this.i.eq();
this.i.eM();
}

View file

@ -6,16 +6,16 @@ Subject: [PATCH] Enderman.teleportRandomly()
Ability to trigger the vanilla "teleport randomly" mechanic of an enderman.
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 2893f75bdff91e810431c64899b64047c372aa62..f279c9b1482d3b3d632a762affff425139920b66 100644
index 888e66520548a47dbfa1c452b0d3fa5dcbe2002c..67a678eceea5304d8ad1eaaee62c57c1088096f5 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -193,6 +193,7 @@ public class EntityEnderman extends EntityMonster {
@@ -225,6 +225,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
super.mobTick();
}
+ public final boolean teleportRandomly() { return this.eq(); } // Paper - OBFHELPER
protected boolean eq() {
if (!this.world.p_() && this.isAlive()) {
+ public final boolean teleportRandomly() { return this.eM(); } // Paper - OBFHELPER
protected boolean eM() {
if (!this.world.s_() && this.isAlive()) {
double d0 = this.locX() + (this.random.nextDouble() - 0.5D) * 64.0D;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
index 970efabd37d380ee1028c80a8e967e0f7aee9760..0c5f35934617529e92c02729687b524c3796128c 100644

View file

@ -26,15 +26,15 @@ index 171c8e3031cf4bf4da062663089cc0cb4552fab6..9c52e31f4cf1e64a37c65c021da219fc
+ log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled"));
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 724b78b5d2d7f4ce8de31c763d2d95b986c1b7f6..9eed1dce3e48683b751ebbaac0487a046354622e 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -201,6 +201,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
if (nbttagcompound.hasKeyOfType("owner", 10)) {
this.shooterId = GameProfileSerializer.b(nbttagcompound.getCompound("owner"));
diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java
index 8ce491fc155450a94582f94c78c8c296f8eeb864..cdf80e50de0840002f62f4c1df4fbcc4e13675d7 100644
--- a/src/main/java/net/minecraft/server/IProjectile.java
+++ b/src/main/java/net/minecraft/server/IProjectile.java
@@ -48,6 +48,7 @@ public abstract class IProjectile extends Entity {
protected void loadData(NBTTagCompound nbttagcompound) {
if (nbttagcompound.b("Owner")) {
this.shooter = nbttagcompound.a("Owner");
+ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooter = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
}
+ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooterId = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
}
this.d = nbttagcompound.getBoolean("LeftOwner");

View file

@ -10,19 +10,19 @@ Adds an option to control the force mode of the particle.
This adds a new Builder API which is much friendlier to use.
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index e428b3cb8c8ca5a662a0e867bf74d08775f1bacd..a834a77b2de8f7287be69fd5d002ff43261a9a85 100644
index 6d5bb1c5183c0e7fc83e197f3a6840b2dcb1ad02..7a71e6dfea35addb7d3d33d8ce187cc2c6943de6 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -56,7 +56,7 @@ public class WorldServer extends World {
@@ -56,7 +56,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
public final Int2ObjectMap<Entity> entitiesById = new Int2ObjectLinkedOpenHashMap();
private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap();
private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque();
- private final List<EntityPlayer> players = Lists.newArrayList();
+ public final List<EntityPlayer> players = Lists.newArrayList(); // Paper - private -> public
public final ChunkProviderServer chunkProvider; // Paper - public
boolean tickingEntities;
private final MinecraftServer server;
private final WorldNBTStorage dataManager;
@@ -1392,12 +1392,17 @@ public class WorldServer extends World {
@@ -1311,12 +1311,17 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
public <T extends ParticleParam> int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
@ -43,10 +43,10 @@ index e428b3cb8c8ca5a662a0e867bf74d08775f1bacd..a834a77b2de8f7287be69fd5d002ff43
if (this.a(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 13a83f285126123811a148453ccaea6f9bf197b4..1a3ca48485ebce128ae1288e6a50308c76ee0452 100644
index 876a62a456c8ff938cca4944b0b40a135dd6ac1c..aa497699fc0fab80b3da1ff4dd08840260cb22d3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2287,11 +2287,17 @@ public class CraftWorld implements World {
@@ -2295,11 +2295,17 @@ public class CraftWorld implements World {
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {

View file

@ -8,21 +8,21 @@ Allow control over whether or not an enderman aggros a player.
This allows you to override/extend the pumpkin/stare logic.
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index f279c9b1482d3b3d632a762affff425139920b66..b7c67f0cdb3d02c7a2dbe85f9a432836cb34bb6e 100644
index 67a678eceea5304d8ad1eaaee62c57c1088096f5..7c13e5b711706c8aaa363d80350597a52920f12b 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -141,7 +141,15 @@ public class EntityEnderman extends EntityMonster {
this.setCarried(iblockdata);
@@ -168,7 +168,15 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable {
this.a((WorldServer) this.world, nbttagcompound);
}
+ // Paper start - OBFHELPER - ok not really, but verify this on updates
private boolean f(EntityHuman entityhuman) {
+ boolean shouldAttack = f_real(entityhuman);
private boolean g(EntityHuman entityhuman) {
+ boolean shouldAttack = g_real(entityhuman);
+ com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) entityhuman.getBukkitEntity());
+ event.setCancelled(!shouldAttack);
+ return event.callEvent();
+ }
+ private boolean f_real(EntityHuman entityhuman) {
+ private boolean g_real(EntityHuman entityhuman) {
+ // Paper end
ItemStack itemstack = (ItemStack) entityhuman.inventory.armor.get(3);

View file

@ -6,12 +6,12 @@ Subject: [PATCH] WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index ddff0b57869c3511346510a91336045ec1469bdc..aa90111716c69379df250f06957a2db5178bbe92 100644
index e146957d219960d0b6371b9460e73fb0ea150dde..a364ab990883bcdf84d8d92385a738200630864d 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -88,7 +88,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
@@ -85,7 +85,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a);
this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b);
if (itemstack.getItem() == Items.POTION) {
- List<MobEffect> list = PotionUtil.getEffects(itemstack);
+ // Paper start

View file

@ -6,7 +6,7 @@ Subject: [PATCH] WitchThrowPotionEvent
Fired when a witch throws a potion at a player
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index aa90111716c69379df250f06957a2db5178bbe92..1f2759e95e6a8382c5d27899b05a993beee25f5a 100644
index a364ab990883bcdf84d8d92385a738200630864d..75d014ad49c701e4c693be4e2f8e7dc6d592fa5f 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -185,9 +185,16 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
@ -27,4 +27,4 @@ index aa90111716c69379df250f06957a2db5178bbe92..1f2759e95e6a8382c5d27899b05a993b
+ // Paper end
entitypotion.pitch -= -20.0F;
entitypotion.shoot(d0, d1 + (double) (f1 * 0.2F), d2, 0.75F, 8.0F);
this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
if (!this.isSilent()) {

View file

@ -8,7 +8,7 @@ This API has more capabilities than .dropItem with the Consumer function
Item can be set inside of the Consumer pre spawn function.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 1a3ca48485ebce128ae1288e6a50308c76ee0452..28a94e473482b414b50ca793564acd409a5dc133 100644
index aa497699fc0fab80b3da1ff4dd08840260cb22d3..61780597747e67581531ae436249ddd1c32bae82 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1489,6 +1489,10 @@ public class CraftWorld implements World {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] WitchReadyPotionEvent
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index 1f2759e95e6a8382c5d27899b05a993beee25f5a..be6ecfb08aaba3fc5d96e918b7540fc75c92e89e 100644
index 75d014ad49c701e4c693be4e2f8e7dc6d592fa5f..a6142ef24bc5bfa15a0ec84fbd8267ffab4e25bf 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -121,7 +121,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
@@ -118,7 +118,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
}
if (potionregistry != null) {
@ -18,6 +18,6 @@ index 1f2759e95e6a8382c5d27899b05a993beee25f5a..be6ecfb08aaba3fc5d96e918b7540fc7
+ org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
+ this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack));
+ // Paper end
this.by = this.getItemInMainHand().k();
this.t(true);
this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
this.bx = this.getItemInMainHand().k();
this.v(true);
if (!this.isSilent()) {

View file

@ -6,19 +6,19 @@ 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 854cffe6c98956cbafa2ead9b831e39209a76c8d..641a52b968ef04a142b32703b61c8b75643b36a6 100644
index c4d034c6a6ff176bc954c00c328512bdf67455a6..7b2010ec4955fb5788c60178c6e306ea3098e9ba 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 {
@@ -552,6 +552,7 @@ public final class ItemStack {
this.getItem().b(this, world, entityhuman);
}
+ public int getItemUseMaxDuration() { return k(); } // Paper - OBFHELPER
public int k() {
return this.getItem().f_(this);
return this.getItem().e_(this);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 3dd912abe3fec22adb29d8edfd66b9f5f3bee4f6..a41be8fdaebe7cf61537c638392b3dc7c7f5b371 100644
index bbee99c13e66b50401489fa4ea497980b1e50b18..4f72b8874f9575c5fc7949c39b4d489809bba097 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -174,6 +174,13 @@ public final class CraftItemStack extends ItemStack {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Implement EntityTeleportEndGatewayEvent
diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
index 78fba79378173dc2c4290e048c3497e206332458..c71f76004ed934e9e921efc4cb637f2e77af92d2 100644
index 4686880e1f37841ae0217654ed6aa8f813ad90a6..ea61a473d8e47428ed5cd4541a5855f0e2c50815 100644
--- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java
+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
@@ -145,8 +145,19 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
@@ -163,8 +163,19 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
}
// CraftBukkit end
@ -23,7 +23,7 @@ index 78fba79378173dc2c4290e048c3497e206332458..c71f76004ed934e9e921efc4cb637f2e
+ return;
+ }
- entity.enderTeleportAndLoad((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
- entity1.enderTeleportAndLoad((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
+ entity.enderTeleportAndLoad(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
+ // Paper end - EntityTeleportEndGatewayEvent
}

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 374cf28fb42b13152f58fd63c4f0cb25eae6a2d9..b89530079751c13894527f21572cc37e3a5548b8 100644
index af9ac84c2caf42d0714d6050ee7db7e39a47878b..e4c1a7c152b2c1202c77e5d5d1c386d84007bc97 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -12,7 +12,7 @@ public class EntityCreeper extends EntityMonster {
@ -15,10 +15,10 @@ index 374cf28fb42b13152f58fd63c4f0cb25eae6a2d9..b89530079751c13894527f21572cc37e
private static final DataWatcherObject<Boolean> POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);
- private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);
+ private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> isIgnitedDW = d; // Paper OBFHELPER
private int bw;
private int bv;
private int fuseTicks;
public int maxFuseTicks = 30;
@@ -219,6 +219,7 @@ public class EntityCreeper extends EntityMonster {
@@ -217,6 +217,7 @@ public class EntityCreeper extends EntityMonster {
this.createEffectCloud();
} else {
fuseTicks = 0;

View file

@ -21,10 +21,10 @@ check is essentially the same as this.getHandle() == other.getHandle()
However, replaced it too to make it clearer of intent.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 2d84f8410a7b8ff88d9dbab64741dcdf40fc1612..5f16dea1a543607e76f7ef70fe44e9a3f12e9132 100644
index 66edc6ae67084959503ffa0df2c04174fb29b8d8..51f027e8f98240fec989ea877095031bab087bda 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -724,14 +724,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -732,14 +732,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return false;
}
final CraftEntity other = (CraftEntity) obj;

View file

@ -53,21 +53,21 @@ index ba341e0174cdc3b5b8bc83b7430270181ea92793..26ab855dcf38446a3d8577108bd16fdb
+ }
}
diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java
index 3ed6a1e785f68c4bb6c5afe024c43150915968a3..03398ce8fdcc68cf5aa7caa3c8fd51c9e8e178eb 100644
index ee9069c744df63cbb7f21dd9d28d6d554593674c..ca18d3156fd2b10f8ee48ff02f6f47e6e649200b 100644
--- a/src/main/java/net/minecraft/server/LootSelectorEntry.java
+++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java
@@ -11,8 +11,8 @@ import org.apache.commons.lang3.ArrayUtils;
public abstract class LootSelectorEntry extends LootEntryAbstract {
- protected final int c;
- protected final int e;
- protected final int f;
+ protected final int e; public int getWeight() { return e; } // Paper - OBFHELPER
+ protected final int f; public int getQuality() { return f; } // Paper - OBFHELPER
protected final LootItemFunction[] g;
private final BiFunction<ItemStack, LootTableInfo, ItemStack> c;
+ protected final int c; public int getWeight() { return c; } // Paper - OBFHELPER
+ protected final int e; public int getQuality() { return e; } // Paper - OBFHELPER
protected final LootItemFunction[] f;
private final BiFunction<ItemStack, LootTableInfo, ItemStack> g;
private final LootEntry h = new LootSelectorEntry.c() {
@@ -145,11 +145,38 @@ public abstract class LootSelectorEntry extends LootEntryAbstract {
@@ -143,11 +143,38 @@ public abstract class LootSelectorEntry extends LootEntryAbstract {
public abstract class c implements LootEntry {
@ -77,7 +77,7 @@ index 3ed6a1e785f68c4bb6c5afe024c43150915968a3..03398ce8fdcc68cf5aa7caa3c8fd51c9
@Override
public int a(float f) {
- return Math.max(MathHelper.d((float) LootSelectorEntry.this.e + (float) LootSelectorEntry.this.f * f), 0);
- return Math.max(MathHelper.d((float) LootSelectorEntry.this.c + (float) LootSelectorEntry.this.e * f), 0);
+ // Paper start - Offer an alternative loot formula to refactor how luck bonus applies
+ // SEE: https://luckformula.emc.gs for details and data
+ if (lastLuck != null && lastLuck == f) {
@ -104,7 +104,7 @@ index 3ed6a1e785f68c4bb6c5afe024c43150915968a3..03398ce8fdcc68cf5aa7caa3c8fd51c9
+ return lastWeight;
}
}
+ private Float lastLuck = null;
+ private int lastWeight = 0;
+ // Paper end
+ private Float lastLuck = null;
+ private int lastWeight = 0;
+ // Paper end
}

View file

@ -5,12 +5,12 @@ Subject: [PATCH] Print Error details when failing to save player data
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index e60e10c57d5acaecb70e89c83c34f1f8870091c2..350ac42d6b45a1023f6254de7706818775b7957b 100644
index ae43d8d2af0daa68f13528d25bac1d94964662bc..41a1b93a9e0f16ed9415dfeccd490496650163cb 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -151,7 +151,7 @@ public class WorldNBTStorage implements IPlayerFileData {
@@ -38,7 +38,7 @@ public class WorldNBTStorage {
file.renameTo(file1);
SystemUtils.a(file1, file, file2);
} catch (Exception exception) {
- WorldNBTStorage.LOGGER.warn("Failed to save player data for {}", entityhuman.getDisplayName().getString());
+ WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper

View file

@ -19,19 +19,19 @@ index 9c52e31f4cf1e64a37c65c021da219fc26dda137..33ce9a500430a01650e69a3568c8b03d
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index f5da67fd8908f027835b837a8b847e27c3638790..1a1d608f5acfc92e3e55e53f63c9da6ab0aa6a0a 100644
index 26832d31cc64d26a9ca61a3bad21424ed366c74c..2ffc8eb4615abfaa6a9e99c45ea436cdf6a461c8 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -3002,7 +3002,7 @@ public abstract class EntityLiving extends Entity {
@@ -3171,7 +3171,7 @@ public abstract class EntityLiving extends Entity {
if (this.isHandRaised() && !this.activeItem.isEmpty()) {
Item item = this.activeItem.getItem();
- return item.e_(this.activeItem) != EnumAnimation.BLOCK ? false : item.f_(this.activeItem) - this.bl >= 5;
+ return item.e_(this.activeItem) != EnumAnimation.BLOCK ? false : item.f_(this.activeItem) - this.bl >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay
- return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bk >= 5;
+ return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bk >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay
} else {
return false;
}
@@ -3241,4 +3241,15 @@ public abstract class EntityLiving extends Entity {
@@ -3423,4 +3423,15 @@ public abstract class EntityLiving extends Entity {
public void broadcastItemBreak(EnumHand enumhand) {
this.broadcastItemBreak(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND);
}
@ -48,10 +48,10 @@ index f5da67fd8908f027835b837a8b847e27c3638790..1a1d608f5acfc92e3e55e53f63c9da6a
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 1760dfa7a312b63d7608d890c977452ad995d7ae..a8e44e95d6115833f4e20e6bb007842bdc52f1ef 100644
index 5e2642b33d36e0695d6adc879f9595030adaaf31..38eb8fbac1d5131249dd9ba8b9942b4c85de2c7f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -644,5 +644,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -657,5 +657,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setArrowsStuck(int arrows) {
getHandle().setArrowCount(arrows);
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API
Adds ability to get what arrow was shot, and control if it should be consumed.
diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
index fb9656afde07a871216a4c5e414777603be590d1..3c95c0428b211b14db65be16a95446debda789e6 100644
index 05ffe8af6a59e05d2c2e9567c675fd020d6b0723..84f83d48a8c41a26289ce0995aa9f5fd332c0ccb 100644
--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
@@ -157,7 +157,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
@@ -155,7 +155,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
// CraftBukkit start
@ -19,10 +19,10 @@ index fb9656afde07a871216a4c5e414777603be590d1..3c95c0428b211b14db65be16a95446de
event.getProjectile().remove();
return;
diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java
index 83aa70c295f93b1c19d81fb0b90876e62fe58c23..26899916d3f5274691386685d13d18f587e4ec28 100644
index 987b59dfcd3a69886e2722477300d313340690bb..b3cb832be6db70922c5495476e89124d75c9ed6d 100644
--- a/src/main/java/net/minecraft/server/ItemBow.java
+++ b/src/main/java/net/minecraft/server/ItemBow.java
@@ -36,6 +36,7 @@ public class ItemBow extends ItemProjectileWeapon {
@@ -26,6 +26,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
if ((double) f >= 0.1D) {
boolean flag1 = flag && itemstack1.getItem() == Items.ARROW;
@ -30,7 +30,7 @@ index 83aa70c295f93b1c19d81fb0b90876e62fe58c23..26899916d3f5274691386685d13d18f5
if (!world.isClientSide) {
ItemArrow itemarrow = (ItemArrow) ((ItemArrow) (itemstack1.getItem() instanceof ItemArrow ? itemstack1.getItem() : Items.ARROW));
EntityArrow entityarrow = itemarrow.a(world, itemstack1, (EntityLiving) entityhuman);
@@ -61,7 +62,7 @@ public class ItemBow extends ItemProjectileWeapon {
@@ -51,7 +52,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
entityarrow.setOnFire(100);
}
// CraftBukkit start
@ -39,7 +39,7 @@ index 83aa70c295f93b1c19d81fb0b90876e62fe58c23..26899916d3f5274691386685d13d18f5
if (event.isCancelled()) {
event.getProjectile().remove();
return;
@@ -71,7 +72,8 @@ public class ItemBow extends ItemProjectileWeapon {
@@ -61,7 +62,8 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
itemstack.damage(1, entityhuman, (entityhuman1) -> {
entityhuman1.broadcastItemBreak(entityhuman.getRaisedHand());
});
@ -49,20 +49,20 @@ index 83aa70c295f93b1c19d81fb0b90876e62fe58c23..26899916d3f5274691386685d13d18f5
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
@@ -88,7 +90,7 @@ public class ItemBow extends ItemProjectileWeapon {
@@ -78,7 +80,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
}
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.RANDOM.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
- if (!flag1 && !entityhuman.abilities.canInstantlyBuild) {
+ if (!flag1 && !entityhuman.abilities.canInstantlyBuild && consumeArrow) { // Paper
itemstack1.subtract(1);
if (itemstack1.isEmpty()) {
entityhuman.inventory.f(itemstack1);
diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java
index 7be41c8698e86727978db7d72b3dd3fbfe6b7272..60a47bccca5bc77039c0bec94eb329b3f2f0937f 100644
index 1592e94c78611a4b968bfb24daf68570e778fadd..31c80bb0a2e403c34fb9cd4b3ee4e903d90dc356 100644
--- a/src/main/java/net/minecraft/server/ItemCrossbow.java
+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java
@@ -221,7 +221,7 @@ public class ItemCrossbow extends ItemProjectileWeapon {
@@ -205,7 +205,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
((IProjectile) object).shoot((double) vector3fa.a(), (double) vector3fa.b(), (double) vector3fa.c(), f1, f2);
}
// CraftBukkit start
@ -72,10 +72,10 @@ index 7be41c8698e86727978db7d72b3dd3fbfe6b7272..60a47bccca5bc77039c0bec94eb329b3
event.getProjectile().remove();
return;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 6d7236d3dcdb70cc1f33f462d08e78720045ccd0..b9e011256f0c8f67808ebebb5e9dc63d3358849f 100644
index 8551d3c9ba808bb9a77897a9866249bc0845c3b2..bd820d9661616c1b294fff0a7af7581a84ada25f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -52,6 +52,7 @@ import net.minecraft.server.GeneratorAccess;
@@ -50,6 +50,7 @@ import net.minecraft.server.GeneratorAccess;
import net.minecraft.server.IBlockData;
import net.minecraft.server.IChatBaseComponent;
import net.minecraft.server.IInventory;
@ -83,7 +83,7 @@ index 6d7236d3dcdb70cc1f33f462d08e78720045ccd0..b9e011256f0c8f67808ebebb5e9dc63d
import net.minecraft.server.ItemActionContext;
import net.minecraft.server.ItemStack;
import net.minecraft.server.Items;
@@ -478,16 +479,16 @@ public class CraftEventFactory {
@@ -476,16 +477,16 @@ public class CraftEventFactory {
/**
* EntityShootBowEvent
*/

View file

@ -7,11 +7,11 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 14a0e3d41ccd896da3b1126a403b0b684cada907..6e9dd4d3717567f54ac706715d75bf53d48c5f7d 100644
index 59f7fced6213c218cd19863be99964eb496b6fe6..4893daca7ea64504731cfab455e09b0a11c65857 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -2157,6 +2157,17 @@ public abstract class EntityHuman extends EntityLiving {
return (EntitySize) EntityHuman.b.getOrDefault(entitypose, EntityHuman.bp);
@@ -2045,6 +2045,17 @@ public abstract class EntityHuman extends EntityLiving {
return ImmutableList.of(EntityPose.STANDING, EntityPose.CROUCHING, EntityPose.SWIMMING);
}
+ // Paper start
@ -28,7 +28,7 @@ index 14a0e3d41ccd896da3b1126a403b0b684cada907..6e9dd4d3717567f54ac706715d75bf53
@Override
public ItemStack f(ItemStack itemstack) {
if (!(itemstack.getItem() instanceof ItemProjectileWeapon)) {
@@ -2173,7 +2184,7 @@ public abstract class EntityHuman extends EntityLiving {
@@ -2061,7 +2072,7 @@ public abstract class EntityHuman extends EntityLiving {
for (int i = 0; i < this.inventory.getSize(); ++i) {
ItemStack itemstack2 = this.inventory.getItem(i);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fire EntityShootBowEvent for Illusioner
diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
index 2ea0583a3e9f2f13d84673cc412a3f4c9bfaf6f7..81b7cd06f2e1f1f2ce75ba84d47cc18723c2bfb6 100644
index 350c7f73e7c9dc43c57f6fb29b40760bf00826a3..76fd0513f3c89678809a28b9f1b22940fb5e5f23 100644
--- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
+++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
@@ -138,8 +138,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan
@@ -134,8 +134,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
@ -22,7 +22,7 @@ index 2ea0583a3e9f2f13d84673cc412a3f4c9bfaf6f7..81b7cd06f2e1f1f2ce75ba84d47cc187
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
+ this.world.addEntity(entityarrow);
+ }
this.a(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
this.playSound(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
- this.world.addEntity(entityarrow);
+ // Paper end
}

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Implement EntityKnockbackByEntityEvent
This event is called when an entity receives knockback by another entity.
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 1a1d608f5acfc92e3e55e53f63c9da6ab0aa6a0a..2a567dca19034ed9071ef09b5371eabb5fff557c 100644
index 2ffc8eb4615abfaa6a9e99c45ea436cdf6a461c8..324a98bf245f410983840ef9970e7215e84f7465 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -1421,6 +1421,16 @@ public abstract class EntityLiving extends Entity {
@@ -1531,6 +1531,16 @@ public abstract class EntityLiving extends Entity {
Vec3D vec3d1 = (new Vec3D(d0, 0.0D, d1)).d().a((double) f);
this.setMot(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + (double) f) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 28a94e473482b414b50ca793564acd409a5dc133..8968bf92b6c2718cbf9519c724bc85d27de54e72 100644
index 2aea66553dceadc504abcf5701f8c82b24d1bda7..648af70dcb89908c0d9bf259f208861ceee884ca 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -877,6 +877,11 @@ public class CraftWorld implements World {
@@ -881,6 +881,11 @@ public class CraftWorld implements World {
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
return !world.createExplosion(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? Explosion.Effect.BREAK : Explosion.Effect.NONE).wasCanceled;
}

View file

@ -6,36 +6,36 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API
How long an entity has raised hands to charge an attack or use an item
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 2a567dca19034ed9071ef09b5371eabb5fff557c..d604728db71d4e61a11fb1ccb7f02b6f6b914a51 100644
index 324a98bf245f410983840ef9970e7215e84f7465..3edd63cbfc3d4bf058f7fb56a4ed4a04b80fe927 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -112,7 +112,7 @@ public abstract class EntityLiving extends Entity {
@@ -118,7 +118,7 @@ public abstract class EntityLiving extends Entity {
private float bB;
private int jumpTicks;
private float bD;
- protected ItemStack activeItem;
+ public ItemStack activeItem; // Paper - public
protected int bk;
protected int bl;
protected int bm;
private BlockPosition bE;
@@ -2980,10 +2980,12 @@ public abstract class EntityLiving extends Entity {
@@ -3149,10 +3149,12 @@ public abstract class EntityLiving extends Entity {
return this.activeItem;
}
+ public int getItemUseRemainingTime() { return this.dE(); } // Paper - OBFHELPER
public int dE() {
return this.bl;
+ public int getItemUseRemainingTime() { return this.dY(); } // Paper - OBFHELPER
public int dY() {
return this.bk;
}
+ public int getHandRaisedTime() { return this.dF(); } // Paper - OBFHELPER
public int dF() {
return this.isHandRaised() ? this.activeItem.k() - this.dE() : 0;
+ public int getHandRaisedTime() { return this.dZ(); } // Paper - OBFHELPER
public int dZ() {
return this.isHandRaised() ? this.activeItem.k() - this.dY() : 0;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index a8e44e95d6115833f4e20e6bb007842bdc52f1ef..3a87c6574bbad9e6c2d7573eb447194c931d7ec4 100644
index 38eb8fbac1d5131249dd9ba8b9942b4c85de2c7f..bbe6188f50dd3c456dec5c3239bdcffbfceb3589 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -654,5 +654,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -667,5 +667,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setShieldBlockingDelay(int delay) {
getHandle().setShieldBlockingDelay(delay);
}

View file

@ -19,30 +19,30 @@ index 33ce9a500430a01650e69a3568c8b03db325a936..cea15d50ed89430ee8d8cff9de21e1fc
+ }
}
diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java
index 06748118494f2cc8cd692511e3b0bfd269fd249c..687efa022df41c23b5ffcce2efc2edcd8bd12dd6 100644
index 87ddabbbca4ac8444ad6ff69889d7fd0542045d4..785146bfb64fe1a467120d706aff7450cb9a8b96 100644
--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java
+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java
@@ -28,10 +28,10 @@ public class EnderDragonBattle {
private int h;
private int i;
private int j;
- private boolean k;
+ private boolean k; private void setDragonKilled(boolean dragonKilled) { this.k = dragonKilled; } // Paper - OBFHELPER
private boolean l;
public UUID m; // CraftBukkit PAIL private -> public, rename dragonUUID
- private boolean dragonKilled;
+ private boolean dragonKilled; private void setDragonKilled(boolean dragonKilled) { this.dragonKilled = dragonKilled; } // Paper - OBFHELPER
private boolean previouslyKilled;
public UUID dragonUUID;
- private boolean n;
+ private boolean n; private void setScanForLegacyFight(boolean scanForLegacyFight) { this.n = scanForLegacyFight; } private boolean scanForLegacyFight() { return this.n; } // Paper - OBFHELPER
public BlockPosition o; // CraftBukkit PAIL private -> public, rename portalLocation
public EnumDragonRespawn p; // CraftBukkit PAIL private -> public, rename respawnPhase
public BlockPosition exitPortalLocation;
public EnumDragonRespawn respawnPhase;
private int q;
@@ -41,6 +41,10 @@ public class EnderDragonBattle {
this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon", new Object[0]), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true);
this.e = Lists.newArrayList();
this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon"), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true);
this.gateways = Lists.newArrayList();
this.n = true;
+ // Paper start
+ setScanForLegacyFight(worldserver.paperConfig.scanForLegacyEnderDragon);
+ if (!scanForLegacyFight()) setDragonKilled(true);
+ // Paper end
this.d = worldserver;
this.world = worldserver;
if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) {
if (nbttagcompound.b("DragonUUID")) {
if (nbttagcompound.b("Dragon")) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Implement World.getEntity(UUID) API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 8968bf92b6c2718cbf9519c724bc85d27de54e72..a59172ff043e5220ffdd363582c38ae53c429f1a 100644
index 648af70dcb89908c0d9bf259f208861ceee884ca..66c89831796db1bbdd6c83cba786b27ef339ec9b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1291,6 +1291,15 @@ public class CraftWorld implements World {
@@ -1295,6 +1295,15 @@ public class CraftWorld implements World {
return list;
}

View file

@ -7,11 +7,11 @@ Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 6e9dd4d3717567f54ac706715d75bf53d48c5f7d..684978be7ccc401b71b0594828a7783b209a5210 100644
index 4893daca7ea64504731cfab455e09b0a11c65857..1f3e5c384a66bb0767cc18bdbe99b942f30faa55 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -164,7 +164,7 @@ public abstract class EntityHuman extends EntityLiving {
this.dW();
@@ -155,7 +155,7 @@ public abstract class EntityHuman extends EntityLiving {
this.es();
super.tick();
if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) {
- this.closeInventory();
@ -19,7 +19,7 @@ index 6e9dd4d3717567f54ac706715d75bf53d48c5f7d..684978be7ccc401b71b0594828a7783b
this.activeContainer = this.defaultContainer;
}
@@ -363,6 +363,13 @@ public abstract class EntityHuman extends EntityLiving {
@@ -350,6 +350,13 @@ public abstract class EntityHuman extends EntityLiving {
return 20;
}
@ -34,10 +34,10 @@ index 6e9dd4d3717567f54ac706715d75bf53d48c5f7d..684978be7ccc401b71b0594828a7783b
this.activeContainer = this.defaultContainer;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7fe4d964d 100644
index 00b19cce68abf405117c5e2d55ba86fc10e7db34..dc99c7730e72e1a52219fbe0b3b039899899f49d 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -368,7 +368,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -411,7 +411,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
// Paper end
if (!this.world.isClientSide && !this.activeContainer.canUse(this)) {
@ -46,7 +46,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7
this.activeContainer = this.defaultContainer;
}
@@ -542,7 +542,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -585,7 +585,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// SPIGOT-943 - only call if they have an inventory open
if (this.activeContainer != this.defaultContainer) {
@ -55,7 +55,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7
}
String deathMessage = event.getDeathMessage();
@@ -1057,7 +1057,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1164,7 +1164,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return OptionalInt.empty();
} else {
if (this.activeContainer != this.defaultContainer) {
@ -64,7 +64,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7
}
this.nextContainerCounter();
@@ -1117,7 +1117,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1224,7 +1224,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
// CraftBukkit end
if (this.activeContainer != this.defaultContainer) {
@ -73,7 +73,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7
}
// this.nextContainerCounter(); // CraftBukkit - moved up
@@ -1181,7 +1181,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -1288,7 +1288,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override
public void closeInventory() {
@ -85,26 +85,26 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7
+ CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit
+ // Paper end
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.m();
this.o();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a357b6167405be4034cf3dad4124827e04278366..0c9e46a8973436a4438730a49986c88f12829be1 100644
index e78306cb187b5f08e32888ebd55c4c486fc8dad2..2cbb0e0e1046efeff7f417d0c976754bd0e7959b 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2040,7 +2040,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2079,7 +2079,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
if (this.player.isFrozen()) return; // CraftBukkit
- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
+ CraftEventFactory.handleInventoryCloseEvent(this.player, org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLAYER); // CraftBukkit // Paper
this.player.m();
this.player.o();
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 46ea6d8e487d0c051780b0bdb06622e515cd987f..950afb131bbea53e46393fa19b0bfbb9d5c647f5 100644
index 70339603aa3e256470be241bf033f3471e2090ea..ef1ea58c252d063ce282d244236a510655538a11 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -390,7 +390,7 @@ public abstract class PlayerList {
@@ -419,7 +419,7 @@ public abstract class PlayerList {
entityplayer.a(StatisticList.LEAVE_GAME);
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
@ -114,10 +114,10 @@ index 46ea6d8e487d0c051780b0bdb06622e515cd987f..950afb131bbea53e46393fa19b0bfbb9
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game");
cserver.getPluginManager().callEvent(playerQuitEvent);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index a834a77b2de8f7287be69fd5d002ff43261a9a85..d4e963c169f847acce882dfba067be0d64638ec4 100644
index 7a71e6dfea35addb7d3d33d8ce187cc2c6943de6..dbc7db5c52752c52b3e84b370bbf38772dc20766 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1045,7 +1045,7 @@ public class WorldServer extends World {
@@ -968,7 +968,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
for (TileEntity tileentity : chunk.getTileEntities().values()) {
if (tileentity instanceof IInventory) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((IInventory) tileentity).getViewers())) {
@ -126,7 +126,7 @@ index a834a77b2de8f7287be69fd5d002ff43261a9a85..d4e963c169f847acce882dfba067be0d
}
}
}
@@ -1103,7 +1103,7 @@ public class WorldServer extends World {
@@ -1026,7 +1026,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) {
for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
@ -136,10 +136,10 @@ index a834a77b2de8f7287be69fd5d002ff43261a9a85..d4e963c169f847acce882dfba067be0d
}
// Spigot End
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 20f0783025516048851aedef0a70759c2953ae47..a6d75c0e07a25fdb59dde2e3eb2a0213c7112515 100644
index 42bc39381c4fc5ff81bdd312afd1644dcc5d40c2..1eac3798acfc8a6859f102250bc8e49ed29d6e21 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -467,8 +467,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -434,8 +434,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public void closeInventory() {
@ -155,10 +155,10 @@ index 20f0783025516048851aedef0a70759c2953ae47..a6d75c0e07a25fdb59dde2e3eb2a0213
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index f5c722644a1955c9bc68c89fdbb84526f9bbb7a0..368f786300573ff24a8dc46d96a6fb6bac26b35a 100644
index ec0cb22d53733bed33019b257ac06ca9dc80d19e..5575c44d6f427661de1fec2c69932b446284c54d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -784,7 +784,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -788,7 +788,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory
if (getHandle().activeContainer != getHandle().defaultContainer) {
@ -168,10 +168,10 @@ index f5c722644a1955c9bc68c89fdbb84526f9bbb7a0..368f786300573ff24a8dc46d96a6fb6b
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index b9e011256f0c8f67808ebebb5e9dc63d3358849f..4a76402c01dfe6525bae8728da2dde6e5d673765 100644
index bd820d9661616c1b294fff0a7af7581a84ada25f..3757a30e7b0ae1ec61211b2250bab47f70c776d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1301,12 +1301,22 @@ public class CraftEventFactory {
@@ -1299,12 +1299,22 @@ public class CraftEventFactory {
return event;
}

View file

@ -30,24 +30,23 @@ index cea15d50ed89430ee8d8cff9de21e1fc7982e1d8..387e0dcb9f01ad947daaa19211331a96
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java
index 7947563426f7f1cc9364d7b6f71256bf3beea463..e0bc6080ef29258473ec3ef7ffa7c246f08ac146 100644
index 7604d79468ce8d7d1a4f45872a5db0c700419029..e7bd9061cceba284443b75cc5506e1b9f2ef42e8 100644
--- a/src/main/java/net/minecraft/server/BlockBed.java
+++ b/src/main/java/net/minecraft/server/BlockBed.java
@@ -196,6 +196,9 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
@@ -199,6 +199,8 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int i) {
EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING);
+ // Paper start - configurable bed search radius
+ if (entitytypes == EntityTypes.PLAYER) return findSafePosition(entitytypes, (World) iworldreader, enumdirection, blockposition);
+
int j = blockposition.getX();
int k = blockposition.getY();
int l = blockposition.getZ();
@@ -225,7 +228,104 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
@@ -228,7 +230,104 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
return Optional.empty();
}
- protected static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) {
- public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) {
+ private static Optional<Vec3D> findSafePosition(EntityTypes<?> entitytypes, World world, EnumDirection updirection, BlockPosition blockposition){
+ int radius = world.paperConfig.bedSearchRadius;
+ double angle = Math.PI / 2;
@ -143,15 +142,15 @@ index 7947563426f7f1cc9364d7b6f71256bf3beea463..e0bc6080ef29258473ec3ef7ffa7c246
+ // Paper end
+
+ // Paper start -- add maxBelow param
+ protected static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); }
+ protected static Optional<Vec3D> isSafeRespawn(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) {
+ public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); }
+ public static Optional<Vec3D> isSafeRespawn(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) {
+ // Paper end
VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition);
if (voxelshape.c(EnumDirection.EnumAxis.Y) > 0.4375D) {
@@ -233,7 +333,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
@@ -236,7 +335,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
} else {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(blockposition);
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
- while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= 2 && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) {
+ while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= maxBelow && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { // Paper -- configurable max distance to search below

View file

@ -6,15 +6,15 @@ Subject: [PATCH] Vex#getSummoner API
Get's the NPC that summoned this Vex
diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java
index cd9fb3aabfca254ca522d39a25e54ceda0b6f5fc..a46730460e5d9f6e52d63ba1950d1e7195fe87cd 100644
index 1eb39fd5cc4fd3b070dcaf64c467da76f99456fc..ab4ac736f8fcda1ed6b58abe0a4ecba58d3b5d43 100644
--- a/src/main/java/net/minecraft/server/EntityVex.java
+++ b/src/main/java/net/minecraft/server/EntityVex.java
@@ -92,6 +92,7 @@ public class EntityVex extends EntityMonster {
@@ -89,6 +89,7 @@ public class EntityVex extends EntityMonster {
}
+ public EntityInsentient getOwner() { return l(); } // Paper - OBFHELPER
public EntityInsentient l() {
+ public EntityInsentient getOwner() { return eL(); } // Paper - OBFHELPER
public EntityInsentient eL() {
return this.c;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java

View file

@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0c9e46a8973436a4438730a49986c88f12829be1..a46ef5e72d03a32e22cfd77b2581de70edcc686a 100644
index 2cbb0e0e1046efeff7f417d0c976754bd0e7959b..8855a1de14f970ddac25d935a4b2e00c7e277908 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1950,6 +1950,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -1988,6 +1988,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
if (event.isCancelled()) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Don't change the Entity Random seed for squids
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index 1c1ff2069d6daaf866a3e80a9b3ce78b19941384..92efe4e7f50fa10bcdff52fb51a9b814d995c8c9 100644
index 9c9ec8226ab43beaae0ef4abc97632b503e2120c..c9c0b2ab265666986cdedf920955ee55ebbedaf3 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -21,7 +21,7 @@ public class EntitySquid extends EntityWaterAnimal {
@ -14,6 +14,6 @@ index 1c1ff2069d6daaf866a3e80a9b3ce78b19941384..92efe4e7f50fa10bcdff52fb51a9b814
super(entitytypes, world);
- this.random.setSeed((long) this.getId());
+ //this.random.setSeed((long) this.getId()); // Paper
this.bC = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
this.bB = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}

View file

@ -8,10 +8,10 @@ These are a critical sign that somethin went wrong, and you've lost some data...
We should kind of know about these things you know.
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index d4e963c169f847acce882dfba067be0d64638ec4..1019f180397abef5ec28d00c432415a7270026e2 100644
index dbc7db5c52752c52b3e84b370bbf38772dc20766..781b84535c105987d4b65e744977c87049b2a1a4 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1035,7 +1035,8 @@ public class WorldServer extends World {
@@ -958,7 +958,8 @@ public class WorldServer extends World implements GeneratorAccessSeed {
if (entity1 == null) {
return false;
} else {

View file

@ -5,13 +5,13 @@ Subject: [PATCH] Avoid item merge if stack size above max stack size
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 5efcc50ab9e8a99d88a9d2e7f15ecbcc4439b93e..e5c9bac88a59d52c9b2f05df3e4f373edbe009ca 100644
index cc173445caa0a064e724bc29b4955232a1dc1816..aad23b2c6cd674e05e609c4c019205978c6741f2 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -170,6 +170,10 @@ public class EntityItem extends Entity {
@@ -177,6 +177,10 @@ public class EntityItem extends Entity {
private void mergeNearby() {
if (this.w()) {
if (this.z()) {
+ // Paper start - avoid item merge if stack size above max stack size
+ ItemStack stack = getItemStack();
+ if (stack.getCount() >= stack.getMaxStackSize()) return;

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Use asynchronous Log4j 2 loggers
diff --git a/pom.xml b/pom.xml
index 8ad07cf6e03cbc5354d2dd2b149b51bbb5067a9d..fc2921e9783f2db63b71c6e244e24c9416cdbf76 100644
index 8150756361174fd46df8f73943ab48c55a523c0c..f578acae6fbe1ad7a0c05b96ba489482687ec1df 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,6 +77,13 @@

View file

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 19 Jul 2018 01:13:28 -0400
Subject: [PATCH] add more information to Entity.toString()
UUID, ticks lived, valid, dead
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 3e5b6c2a0ce6df2620d5f6505fcd25e6ea622744..3cb157cf4d1aa90b23f24b5090071d71c6bd2754 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2430,7 +2430,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public String toString() {
- return String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getDisplayName().getString(), this.id, this.world == null ? "~NULL~" : this.world.toString(), this.locX(), this.locY(), this.locZ());
+ return String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cx=%d, cz=%d, tl=%d, v=%b, d=%b]", new Object[] { this.getClass().getSimpleName(), this.getDisplayName().getString(), Integer.valueOf(this.id), this.uniqueID.toString(), this.world == null ? "~NULL~" : this.world.toString(), Double.valueOf(this.locX()), Double.valueOf(this.locY()), Double.valueOf(this.locZ()), getChunkX(), getChunkZ(), this.ticksLived, this.valid, this.dead}); // Paper - add more information
}
public boolean isInvulnerable(DamageSource damagesource) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues
Add -Ddebug.entities=true to your JVM flags to gain more information
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index fe730cd301e6bae46320355ee8cb67d406a72a9f..5fd57a3d30972d86c62025d63cd57b56a147cc94 100644
index 3cb157cf4d1aa90b23f24b5090071d71c6bd2754..814c885313967f007584f6832111ec5b445e4088 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -76,6 +76,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -77,6 +77,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
private CraftEntity bukkitEntity;
@ -19,18 +19,18 @@ index fe730cd301e6bae46320355ee8cb67d406a72a9f..5fd57a3d30972d86c62025d63cd57b56
if (bukkitEntity == null) {
bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 7804cc0f6a02d14f4adbe05b37e8470a382c0d26..4ee26ff08f7a058648ab54f0dcd81b466a9aced1 100644
index 4ae3e91677ecf9c2104a229b4e8b229d18b87aa4..458802dc4b1f923b159168efff0546bb731da07b 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -1064,6 +1064,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} else {
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking());
@@ -1093,6 +1093,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} else {
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking());
+ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.track(this.world.getPlayers());
if (entity instanceof EntityPlayer) {
@@ -1106,7 +1107,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
+ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.track(this.world.getPlayers());
if (entity instanceof EntityPlayer) {
@@ -1134,7 +1135,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.a();
}
@ -40,10 +40,10 @@ index 7804cc0f6a02d14f4adbe05b37e8470a382c0d26..4ee26ff08f7a058648ab54f0dcd81b46
protected void g() {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 6603392f475f0bfe7af259a54ba9bb3469c18541..fb719c5e18bcfa0e424c67c6b23c5abedd234f79 100644
index 6f91878fedd3bf8daedc16bcde7ac1fd042f704c..8148ecad0e313d2e6c0307915aaa670e7ad5a317 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -63,6 +63,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -68,6 +68,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean pvpMode;
public boolean keepSpawnInMemory = true;
public org.bukkit.generator.ChunkGenerator generator;
@ -52,20 +52,20 @@ index 6603392f475f0bfe7af259a54ba9bb3469c18541..fb719c5e18bcfa0e424c67c6b23c5abe
public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 1019f180397abef5ec28d00c432415a7270026e2..5086a854b84b05e5b9c0f5677051d19dfa42f343 100644
index 781b84535c105987d4b65e744977c87049b2a1a4..ac0bcde5ccc9ebb88922d8b82381b03675b87ae6 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -76,6 +76,9 @@ public class WorldServer extends World {
// CraftBukkit start
private int tickPosition;
@@ -84,6 +84,9 @@ public class WorldServer extends World implements GeneratorAccessSeed {
public final UUID uuid;
boolean hasPhysicsEvent = true; // Paper
+ private static Throwable getAddToWorldStackTrace(Entity entity) {
+ return new Throwable(entity + " Added to world at " + new java.util.Date());
+ }
// Add env and gen to constructor
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
@@ -997,8 +1000,28 @@ public class WorldServer extends World {
public Chunk getChunkIfLoaded(int x, int z) {
return this.chunkProvider.getChunkAt(x, z, false);
@@ -920,8 +923,28 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit start
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
@ -95,7 +95,7 @@ index 1019f180397abef5ec28d00c432415a7270026e2..5086a854b84b05e5b9c0f5677051d19d
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
return false;
} else if (this.isUUIDTaken(entity)) {
@@ -1158,7 +1181,24 @@ public class WorldServer extends World {
@@ -1081,7 +1104,24 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
}

View file

@ -1,20 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 19 Jul 2018 01:13:28 -0400
Subject: [PATCH] add more information to Entity.toString()
UUID, ticks lived, valid, dead
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 7c6bf0b91cdf59f6dcf155ee8abfbab61938cc8b..fe730cd301e6bae46320355ee8cb67d406a72a9f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2505,7 +2505,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
public String toString() {
- return String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getDisplayName().getText(), this.id, this.world == null ? "~NULL~" : this.world.getWorldData().getName(), this.locX(), this.locY(), this.locZ());
+ return String.format(Locale.ROOT, "%s[\'%s\'/%d, uuid=\'%s\', l=\'%s\', x=%.2f, y=%.2f, z=%.2f, cx=%d, cz=%d, tl=%d, v=%b, d=%b]", new Object[] { this.getClass().getSimpleName(), this.getDisplayName().getText(), Integer.valueOf(this.id), this.uniqueID.toString(), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ), getChunkX(), getChunkZ(), this.ticksLived, this.valid, this.dead}); // Paper - add more information
}
public boolean isInvulnerable(DamageSource damagesource) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] EnderDragon Events
diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
index 40a8beff556873a5db108e44fd053e8de80e36a6..18fdcd453af5dc22a5b0e3c41e77e3d3dbb70fea 100644
index fbc2ec88f7c71c853c492301986a23dafc8fa7a6..274ebd7dab74ca9bff3d5ea941b7335bdf601db8 100644
--- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
@@ -71,7 +71,11 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
@ -29,10 +29,10 @@ index 40a8beff556873a5db108e44fd053e8de80e36a6..18fdcd453af5dc22a5b0e3c41e77e3d3
public void e() {
if (this.d != null) {
diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
index a2c36548caea7c6a0050bb3b18675567a61fb96e..a9d20ee3bbaf4dd77204df9c28a233a0d36cdbd2 100644
index 7c94faa59c2b9887292c6d88fa2e3bb46e3e67c7..ac546ff959510a2d0120c24c90bf13ff83873161 100644
--- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java
+++ b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
@@ -68,7 +68,9 @@ public class DragonControllerStrafe extends AbstractDragonController {
@@ -71,7 +71,9 @@ public class DragonControllerStrafe extends AbstractDragonController {
EntityDragonFireball entitydragonfireball = new EntityDragonFireball(this.a.world, this.a, d9, d10, d11);
entitydragonfireball.setPositionRotation(d6, d7, d8, 0.0F, 0.0F);
@ -43,15 +43,15 @@ index a2c36548caea7c6a0050bb3b18675567a61fb96e..a9d20ee3bbaf4dd77204df9c28a233a0
if (this.d != null) {
while (!this.d.b()) {
diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java
index bc08b53fcdd411f15afb939702d68c98ed697479..db43ac1cc4ae959a432eedd3efee891b4e141c7f 100644
index 743a08d18df8890a61eeb48984c0882bb353e15c..96fdf9d068c2df154dbc2fb7978b0ba7a030c834 100644
--- a/src/main/java/net/minecraft/server/EntityDragonFireball.java
+++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java
@@ -41,8 +41,10 @@ public class EntityDragonFireball extends EntityFireball {
@@ -46,8 +46,10 @@ public class EntityDragonFireball extends EntityFireball {
}
}
+ if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(EntityLiving::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper
this.world.triggerEffect(2006, new BlockPosition(this), 0);
this.world.triggerEffect(2006, this.getChunkCoordinates(), this.isSilent() ? -1 : 1);
this.world.addEntity(entityareaeffectcloud);
+ } else entityareaeffectcloud.die(); // Paper
this.die();

View file

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerElytraBoostEvent
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
index 92dac35ec4eefe0d5794d8205bc872d23a62e3cb..bd524a35bb11005adfed12f66465fa8466a155f0 100644
index 6cc243025f5bdac9be39f8a88a018893a9941dba..885c03f62da3b14bf7aeb31f1ae6a95bc9f86de1 100644
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
@@ -36,11 +36,16 @@ public class ItemFireworks extends Item {
@ -28,4 +28,4 @@ index 92dac35ec4eefe0d5794d8205bc872d23a62e3cb..bd524a35bb11005adfed12f66465fa84
+ // Paper end
}
return InteractionResultWrapper.success(entityhuman.b(enumhand));
return InteractionResultWrapper.a(entityhuman.b(enumhand), world.s_());

View file

@ -0,0 +1,75 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Wed, 30 Nov 2016 20:56:58 -0600
Subject: [PATCH] Improve BlockPosition inlining
Normally the JVM can inline virtual getters by having two sets of code, one is the 'optimized' code and the other is the 'deoptimized' code.
If a single type is used 99% of the time, then its worth it to inline, and to revert to 'deoptimized' the 1% of the time we encounter other types.
But if two types are encountered commonly, then the JVM can't inline them both, and the call overhead remains.
This scenario also occurs with BlockPos and MutableBlockPos.
The variables in BlockPos are final, so MutableBlockPos can't modify them.
MutableBlockPos fixes this by adding custom mutable variables, and overriding the getters to access them.
This approach with utility methods that operate on MutableBlockPos and BlockPos.
Specific examples are BlockPosition.up(), and World.isValidLocation().
It makes these simple methods much slower than they need to be.
This should result in an across the board speedup in anything that accesses blocks or does logic with positions.
This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks.
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index 8b202b342f899a38b989b683bd8be4f5c4061f48..1842e69839a65e7b8d2c47fd30ec8f3179f04470 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -39,7 +39,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
- public boolean equals(Object object) {
+ public final boolean equals(Object object) { // Paper
if (this == object) {
return true;
} else if (!(object instanceof BaseBlockPosition)) {
@@ -51,7 +51,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
}
}
- public int hashCode() {
+ public final int hashCode() { // Paper
return (this.getY() + this.getZ() * 31) * 31 + this.getX();
}
@@ -59,15 +59,15 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
}
- public int getX() {
+ public final int getX() { // Paper
return this.a;
}
- public int getY() {
+ public final int getY() { // Paper
return this.b;
}
- public int getZ() {
+ public final int getZ() { // Paper
return this.e;
}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index b61651fcd6605cd8638ce14f15e41b878add3f1c..b25b84d017ee610d8f006536fdfa63e840474a9b 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -81,6 +81,7 @@ public class BlockPosition extends BaseBlockPosition {
return a(this.getX(), this.getY(), this.getZ());
}
+ public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER
public static long a(int i, int j, int k) {
long l = 0L;

View file

@ -1,257 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com>
Date: Wed, 30 Nov 2016 20:56:58 -0600
Subject: [PATCH] Improve BlockPosition inlining
Normally the JVM can inline virtual getters by having two sets of code, one is the 'optimized' code and the other is the 'deoptimized' code.
If a single type is used 99% of the time, then its worth it to inline, and to revert to 'deoptimized' the 1% of the time we encounter other types.
But if two types are encountered commonly, then the JVM can't inline them both, and the call overhead remains.
This scenario also occurs with BlockPos and MutableBlockPos.
The variables in BlockPos are final, so MutableBlockPos can't modify them.
MutableBlockPos fixes this by adding custom mutable variables, and overriding the getters to access them.
This approach with utility methods that operate on MutableBlockPos and BlockPos.
Specific examples are BlockPosition.up(), and World.isValidLocation().
It makes these simple methods much slower than they need to be.
This should result in an across the board speedup in anything that accesses blocks or does logic with positions.
This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks.
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index 7b05bb9edcd059a134cef12cc9fea570217bc601..a0450a7ddf21659c5636b3f298e6bf4f0a93fc4d 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -7,32 +7,30 @@ import javax.annotation.concurrent.Immutable;
public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
- @Deprecated
- private final int a;
- @Deprecated
- private final int b;
- @Deprecated
- private final int c;
// Paper start
- public boolean isValidLocation() {
- return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
+ protected int x;
+ protected int y;
+ protected int z;
+
+ public final boolean isValidLocation() {
+ return x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000 && y >= 0 && y < 256;
}
- public boolean isInvalidYLocation() {
- return b < 0 || b >= 256;
+ public final boolean isInvalidYLocation() {
+ return y < 0 || y >= 256;
}
// Paper end
public BaseBlockPosition(int i, int j, int k) {
- this.a = i;
- this.b = j;
- this.c = k;
+ this.x = i;
+ this.y = j;
+ this.z = k;
}
public BaseBlockPosition(double d0, double d1, double d2) {
this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
- public boolean equals(Object object) {
+ public final boolean equals(Object object) { // Paper
if (this == object) {
return true;
} else if (!(object instanceof BaseBlockPosition)) {
@@ -40,29 +38,31 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
} else {
BaseBlockPosition baseblockposition = (BaseBlockPosition) object;
- return this.getX() != baseblockposition.getX() ? false : (this.getY() != baseblockposition.getY() ? false : this.getZ() == baseblockposition.getZ());
+ return x == baseblockposition.x && z == baseblockposition.z && y == baseblockposition.y; // Paper
}
}
- public int hashCode() {
- return (this.getY() + this.getZ() * 31) * 31 + this.getX();
+ public final int hashCode() { // Paper
+ return (this.y + this.z * 31) * 31 + this.x; // Paper
}
public int compareTo(BaseBlockPosition baseblockposition) {
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
}
- public int getX() {
- return this.a;
+ // Paper start
+ public final int getX() {
+ return this.x;
}
- public int getY() {
- return this.b;
+ public final int getY() {
+ return this.y;
}
- public int getZ() {
- return this.c;
+ public final int getZ() {
+ return this.z;
}
+ // Paper end
public BaseBlockPosition down() {
return this.down(1);
@@ -75,13 +75,14 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
public BaseBlockPosition shift(EnumDirection enumdirection, int i) {
return i == 0 ? this : new BaseBlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i);
}
+ // Paper end
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX());
}
public boolean a(BaseBlockPosition baseblockposition, double d0) {
- return this.distanceSquared((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ(), false) < d0 * d0;
+ return this.distanceSquared((double) baseblockposition.x, (double) baseblockposition.y, (double) baseblockposition.z, false) < d0 * d0; // Paper
}
public boolean a(IPosition iposition, double d0) {
@@ -107,9 +108,9 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
}
public int n(BaseBlockPosition baseblockposition) {
- float f = (float) Math.abs(baseblockposition.getX() - this.getX());
- float f1 = (float) Math.abs(baseblockposition.getY() - this.getY());
- float f2 = (float) Math.abs(baseblockposition.getZ() - this.getZ());
+ float f = (float) Math.abs(baseblockposition.getX() - this.x); // Paper
+ float f1 = (float) Math.abs(baseblockposition.getY() - this.y); // Paper
+ float f2 = (float) Math.abs(baseblockposition.getZ() - this.z); // Paper
return (int) (f + f1 + f2);
}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index f8ac39e1b019b0918996f745d99f6ed09db0fd11..ec0e8f970dba64561afd6477a5df2821d9a8889a 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -99,6 +99,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
return new BlockPosition(b(i), c(i), d(i));
}
+ public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER
public static long a(int i, int j, int k) {
long l = 0L;
@@ -113,7 +114,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
}
public long asLong() {
- return a(this.getX(), this.getY(), this.getZ());
+ return a(this.x, this.y, this.z); // Paper
}
public BlockPosition a(double d0, double d1, double d2) {
@@ -343,11 +344,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
}
public static class MutableBlockPosition extends BlockPosition {
-
+ // Paper start - comment out
+ /*
protected int b;
protected int c;
protected int d;
-
+ */
+ // Paper end
public MutableBlockPosition() {
this(0, 0, 0);
}
@@ -357,10 +360,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
}
public MutableBlockPosition(int i, int j, int k) {
- super(0, 0, 0);
+ // Paper start
+ super(i, j, k);
+ /*
this.b = i;
this.c = j;
- this.d = k;
+ this.d = k;*/
+ // Paper end
}
public MutableBlockPosition(double d0, double d1, double d2) {
@@ -391,6 +397,9 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
return super.a(enumblockrotation).immutableCopy();
}
+
+ /*
+ // Paper start - use parent getters
@Override
public int getX() {
return this.b;
@@ -404,13 +413,16 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
@Override
public int getZ() {
return this.d;
- }
+ }*/
+ // Paper end
public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER
public BlockPosition.MutableBlockPosition d(int i, int j, int k) {
- this.b = i;
- this.c = j;
- this.d = k;
+ // Paper start - use xyz
+ this.x = i;
+ this.y = j;
+ this.z = k;
+ // Paper end
return this;
}
@@ -440,26 +452,26 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali
}
public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) {
- return this.d(this.b + enumdirection.getAdjacentX() * i, this.c + enumdirection.getAdjacentY() * i, this.d + enumdirection.getAdjacentZ() * i);
+ return this.d(this.x + enumdirection.getAdjacentX() * i, this.y + enumdirection.getAdjacentY() * i, this.z + enumdirection.getAdjacentZ() * i);
}
public BlockPosition.MutableBlockPosition e(int i, int j, int k) {
- return this.d(this.b + i, this.c + j, this.d + k);
+ return this.d(this.x + i, this.y + j, this.z + k);
}
public final void setX(final int x) { this.o(x); } // Paper - OBFHELPER
public void o(int i) {
- this.b = i;
+ this.x = i; // Paper change to x
}
public final void setY(final int y) { this.p(y); } // Paper - OBFHELPER
public void p(int i) {
- this.c = i;
+ this.y = i; // Paper change to y
}
public final void setZ(final int z) { this.q(z); } // Paper - OBFHELPER
public void q(int i) {
- this.d = i;
+ this.z = i; // Paper change to z
}
@Override

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Optimize RegistryID.c()
This is a frequent hotspot for world loading/saving.
diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java
index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44d6e30eb7 100644
index 6cdd4d46d987132c3c241800b5d59cee2dfa25e2..f9692408a1d177ba4668261070d7610ecfb53a7b 100644
--- a/src/main/java/net/minecraft/server/RegistryID.java
+++ b/src/main/java/net/minecraft/server/RegistryID.java
@@ -14,12 +14,14 @@ public class RegistryID<K> implements Registry<K> {
@ -24,7 +24,7 @@ index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44
}
public int getId(@Nullable K k0) {
@@ -44,9 +46,14 @@ public class RegistryID<K> implements Registry<K> {
@@ -48,9 +50,14 @@ public class RegistryID<K> implements Registry<K> {
}
private int c() {
@ -39,7 +39,7 @@ index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44
return this.e;
}
@@ -60,6 +67,7 @@ public class RegistryID<K> implements Registry<K> {
@@ -64,6 +71,7 @@ public class RegistryID<K> implements Registry<K> {
this.d = (K[]) (new Object[i]); // Paper - decompile fix
this.e = 0;
this.f = 0;
@ -47,7 +47,7 @@ index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44
for (int j = 0; j < ak.length; ++j) {
if (ak[j] != null) {
@@ -85,6 +93,7 @@ public class RegistryID<K> implements Registry<K> {
@@ -89,6 +97,7 @@ public class RegistryID<K> implements Registry<K> {
this.b[k] = k0;
this.c[k] = i;
this.d[i] = k0;
@ -55,7 +55,7 @@ index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44
++this.f;
if (i == this.e) {
++this.e;
@@ -149,6 +158,7 @@ public class RegistryID<K> implements Registry<K> {
@@ -153,6 +162,7 @@ public class RegistryID<K> implements Registry<K> {
Arrays.fill(this.d, (Object) null);
this.e = 0;
this.f = 0;

View file

@ -19,13 +19,13 @@ index 387e0dcb9f01ad947daaa19211331a96742ce004..eaaa51e4bf761f41fd516402ce1ad0f9
+ }
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index fb719c5e18bcfa0e424c67c6b23c5abedd234f79..52d0b9e37b222274cccd2a7a872f61a6a72f2f06 100644
index 8148ecad0e313d2e6c0307915aaa670e7ad5a317..66ce6afd46be67a131091d16b6a1221bbff333b5 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -782,6 +782,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -836,6 +836,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// Paper end
}
}
+ // Paper start - Prevent armor stands from doing entity lookups
+ @Override
+ public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisAlignedBB) {
@ -33,7 +33,6 @@ index fb719c5e18bcfa0e424c67c6b23c5abedd234f79..52d0b9e37b222274cccd2a7a872f61a6
+ return GeneratorAccess.super.getCubes(entity, axisAlignedBB);
+ }
+ // Paper end
+
public boolean b(AxisAlignedBB axisalignedbb) {
int i = MathHelper.floor(axisalignedbb.minX);
int j = MathHelper.f(axisalignedbb.maxX);
public Explosion explode(@Nullable Entity entity, double d0, double d1, double d2, float f, Explosion.Effect explosion_effect) {
return this.createExplosion(entity, (DamageSource) null, (ExplosionDamageCalculator) null, d0, d1, d2, f, false, explosion_effect);

View file

@ -4,11 +4,23 @@ Date: Mon, 23 Jul 2018 14:22:26 +0200
Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java
index 47324feca49786b49563d3d0e854e74ad27c190b..16a8ee36ba2b23207cb8630623d542ac5943b9df 100644
--- a/src/main/java/net/minecraft/server/BlockBase.java
+++ b/src/main/java/net/minecraft/server/BlockBase.java
@@ -453,6 +453,7 @@ public abstract class BlockBase {
return this.a != null ? this.a.b : this.b(iblockaccess, blockposition, VoxelShapeCollision.a());
}
+ public final VoxelShape getCollisionShape(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return this.b(iblockaccess, blockposition, voxelshapecollision); } // Paper - OBFHELPER
public VoxelShape b(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) {
return this.getBlock().c(this.p(), iblockaccess, blockposition, voxelshapecollision);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 5fd57a3d30972d86c62025d63cd57b56a147cc94..653e6d9a1640bedf08aaa5b436ac93e4cb1cb5b7 100644
index 814c885313967f007584f6832111ec5b445e4088..e281ab94a1a69059db653789532735e8c5fd272a 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -98,7 +98,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -99,7 +99,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
private static double e = 1.0D;
private final EntityTypes<?> f;
private int id;
@ -18,54 +30,53 @@ index 5fd57a3d30972d86c62025d63cd57b56a147cc94..653e6d9a1640bedf08aaa5b436ac93e4
protected int j;
@Nullable
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
index 278ef79d8962cc5d337e34891c7ea3a606336cbb..5c3731f68a31b73b886b872eba69de483f78a2aa 100644
index 5ac7957016d1ca6bc78ced0bcf3767d358677f45..ca92579304d060e2b718aab6f3e3f006d52f93e5 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -110,6 +110,16 @@ public class EntityFireworks extends Entity implements IProjectile {
@@ -118,7 +118,6 @@ public class EntityFireworks extends IProjectile {
this.move(EnumMoveType.SELF, vec3d);
this.setMot(vec3d);
}
-
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this::a, RayTrace.BlockCollisionOption.COLLIDER);
vec3d = this.getMot();
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this.getBoundingBox().a(vec3d).g(1.0D), (entity) -> {
if (!this.noclip) {
diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java
index cdf80e50de0840002f62f4c1df4fbcc4e13675d7..f85d80d7bb3e4e92bb8d281dfe577f663ebe9da1 100644
--- a/src/main/java/net/minecraft/server/IProjectile.java
+++ b/src/main/java/net/minecraft/server/IProjectile.java
@@ -129,8 +129,14 @@ public abstract class IProjectile extends Entity {
protected boolean a(Entity entity) {
if (!entity.isSpectator() && entity.isAlive() && entity.isInteractable()) {
Entity entity1 = this.getShooter();
-
+ // Paper start - Cancel hit for vanished players
+ if (this.spawningEntity != null && entity instanceof EntityPlayer && this.world instanceof WorldServer) {
+ Entity spawningEntity = ((WorldServer) this.world).getEntity(this.spawningEntity);
+ if (spawningEntity instanceof EntityPlayer) {
+ org.bukkit.entity.Player collided = (org.bukkit.entity.Player) entity.getBukkitEntity();
+ org.bukkit.entity.Player shooter = (org.bukkit.entity.Player) spawningEntity.getBukkitEntity();
+ if (!shooter.canSee(collided)) return false;
+ }
+ if (entity1 instanceof EntityPlayer) {
+ org.bukkit.entity.Player collided = (org.bukkit.entity.Player) entity.getBukkitEntity();
+ org.bukkit.entity.Player shooter = (org.bukkit.entity.Player) entity1.getBukkitEntity();
+ if (!shooter.canSee(collided)) return false;
+ }
return entity1 == null || this.d || !entity1.isSameVehicle(entity);
+ // Paper end
return !entity.isSpectator() && entity.isAlive() && entity.isInteractable();
}, RayTrace.BlockCollisionOption.COLLIDER, true);
diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java
index 181661fc8fe9d46cb36cfffac38c58f0d5003192..c5fddef030489bff0de9e0efb4f11c83bcfee628 100644
--- a/src/main/java/net/minecraft/server/IBlockData.java
+++ b/src/main/java/net/minecraft/server/IBlockData.java
@@ -147,6 +147,7 @@ public class IBlockData extends BlockDataAbstract<Block, IBlockData> implements
return this.c != null ? this.c.g : this.b(iblockaccess, blockposition, VoxelShapeCollision.a());
}
+ public final VoxelShape getCollisionShape(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return this.b(iblockaccess, blockposition, voxelshapecollision); } // Paper - OBFHELPER
public VoxelShape b(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) {
return this.getBlock().b(this, iblockaccess, blockposition, voxelshapecollision);
}
} else {
return false;
}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index ab875a7365693264ea8e5002d9d115e16320dbc8..aed353365bfdf1a133997f47cb458edc78af6c8b 100644
index 6c7f677f68d89d7e08c07a0f24268c5a638b4076..33d38a9a8a55c7a26d9a584e8058f42556b6ed59 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -136,7 +136,8 @@ public class ItemBlock extends Item {
@@ -139,7 +139,8 @@ public class ItemBlock extends Item {
EntityHuman entityhuman = blockactioncontext.getEntity();
VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) entityhuman);
// CraftBukkit start - store default return
- boolean defaultReturn = (!this.T_() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision);
- boolean defaultReturn = (!this.isCheckCollisions() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision);
+ World world = blockactioncontext.getWorld(); // Paper
+ boolean defaultReturn = (!this.T_() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && world.checkEntityCollision(iblockdata, entityhuman, voxelshapecollision, blockactioncontext.getClickPosition(), true); // Paper
+ boolean defaultReturn = (!this.isCheckCollisions() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && world.checkEntityCollision(iblockdata, entityhuman, voxelshapecollision, blockactioncontext.getClickPosition(), true); // Paper
org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null;
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
index 0f64a3c0569a778cd5b8c60f253c77681a83308d..0f95bcbccb96f9d525583f6bb6c0c0ed7fb7561b 100644
index e985b0efc20f7d271be1c7ffc2670ab89fc3a6a7..c2b8c9820663f95f58f0c3a62cd9ec99c835a82f 100644
--- a/src/main/java/net/minecraft/server/VoxelShape.java
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
@@ -46,6 +46,7 @@ public abstract class VoxelShape {
@ -77,7 +88,7 @@ index 0f64a3c0569a778cd5b8c60f253c77681a83308d..0f95bcbccb96f9d525583f6bb6c0c0ed
return (VoxelShape) (this.isEmpty() ? VoxelShapes.a() : new VoxelShapeArray(this.a, new DoubleListOffset(this.a(EnumDirection.EnumAxis.X), d0), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Y), d1), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Z), d2)));
}
diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java
index 0e30d8c9933dc6595b9715ef6dc99cc8910892cb..335142ec0dfad822cfe40877e99dec0f307e1a58 100644
index 86f6f082fe2991ea9065b09c9680b76ca1cf7154..b6e2a3d8d0cf510f497c6f974356fafaf2adc13b 100644
--- a/src/main/java/net/minecraft/server/VoxelShapes.java
+++ b/src/main/java/net/minecraft/server/VoxelShapes.java
@@ -35,6 +35,7 @@ public final class VoxelShapes {
@ -97,10 +108,10 @@ index 0e30d8c9933dc6595b9715ef6dc99cc8910892cb..335142ec0dfad822cfe40877e99dec0f
if (operatorboolean.apply(false, false)) {
throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 52d0b9e37b222274cccd2a7a872f61a6a72f2f06..2db91e85bd5e95d15b607a96114f33b6e7687b19 100644
index 66ce6afd46be67a131091d16b6a1221bbff333b5..f6cb503b8eb329cb6bfaa960f812da3c99ce45a8 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -153,6 +153,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -170,6 +170,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
}
@ -145,13 +156,13 @@ index 52d0b9e37b222274cccd2a7a872f61a6a72f2f06..2db91e85bd5e95d15b607a96114f33b6
+ // Paper end
+
@Override
public boolean p_() {
public boolean s_() {
return this.isClientSide;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 4a76402c01dfe6525bae8728da2dde6e5d673765..dccc187c6198ce2e8824b8460347586ccf5c6741 100644
index 3757a30e7b0ae1ec61211b2250bab47f70c776d4..a349ce7f04d6f2b29a0de534a3f7616778026666 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1179,6 +1179,14 @@ public class CraftEventFactory {
@@ -1177,6 +1177,14 @@ public class CraftEventFactory {
Projectile projectile = (Projectile) entity.getBukkitEntity();
org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 87e94693f6db07d1273854ad55e5f263f2f2239e..f0a8142b7477fde211b522e3982e614fc94e20f8 100644
index fdc02b512f2d4bc968977564d520bc7ec7189c69..a27f91e6c3d1f5dd0adf8a3b48a640cc63676114 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -518,6 +518,7 @@ public class Chunk implements IChunkAccess {
@@ -519,6 +519,7 @@ public class Chunk implements IChunkAccess {
entity.chunkZ = this.loc.z;
this.entities.add(entity); // Paper - per chunk entity list
this.entitySlices[k].add(entity);
@ -17,7 +17,7 @@ index 87e94693f6db07d1273854ad55e5f263f2f2239e..f0a8142b7477fde211b522e3982e614f
}
@Override
@@ -545,6 +546,7 @@ public class Chunk implements IChunkAccess {
@@ -546,6 +547,7 @@ public class Chunk implements IChunkAccess {
return;
}
entityCounts.decrement(entity.getMinecraftKeyString());

View file

@ -9,10 +9,10 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index f0a8142b7477fde211b522e3982e614fc94e20f8..9f369f932ca0a63bde246420cfde7949f3e78ca2 100644
index a27f91e6c3d1f5dd0adf8a3b48a640cc63676114..3ba19f75d24a1539c94f4fed9b8f90aecc918cdc 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -509,6 +509,25 @@ public class Chunk implements IChunkAccess {
@@ -510,6 +510,25 @@ public class Chunk implements IChunkAccess {
if (k >= this.entitySlices.length) {
k = this.entitySlices.length - 1;
}
@ -38,7 +38,7 @@ index f0a8142b7477fde211b522e3982e614fc94e20f8..9f369f932ca0a63bde246420cfde7949
if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper
entity.inChunk = true;
@@ -518,6 +537,7 @@ public class Chunk implements IChunkAccess {
@@ -519,6 +538,7 @@ public class Chunk implements IChunkAccess {
entity.chunkZ = this.loc.z;
this.entities.add(entity); // Paper - per chunk entity list
this.entitySlices[k].add(entity);
@ -46,7 +46,7 @@ index f0a8142b7477fde211b522e3982e614fc94e20f8..9f369f932ca0a63bde246420cfde7949
this.markDirty(); // Paper
}
@@ -542,6 +562,10 @@ public class Chunk implements IChunkAccess {
@@ -543,6 +563,10 @@ public class Chunk implements IChunkAccess {
// Paper start
if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
@ -58,10 +58,10 @@ index f0a8142b7477fde211b522e3982e614fc94e20f8..9f369f932ca0a63bde246420cfde7949
return;
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 653e6d9a1640bedf08aaa5b436ac93e4cb1cb5b7..84d36ea84e25a701af22900af6cd3099adf6cd54 100644
index e281ab94a1a69059db653789532735e8c5fd272a..6012891971265323603cb05ae444cca1bb058c89 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -71,6 +71,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -72,6 +72,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
}
};

View file

@ -4,43 +4,47 @@ Date: Thu, 26 Jul 2018 15:30:03 -0400
Subject: [PATCH] EntityTransformedEvent
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 3997dc6d979bf5a027861397b948aa4e8486fc58..a38a1f3447accd51dcd295fb28c4108cb87ad832 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -1244,6 +1244,7 @@ public abstract class EntityInsentient extends EntityLiving {
if (CraftEventFactory.callEntityTransformEvent(this, t0, EntityTransformEvent.TransformReason.DROWNED).isCancelled()) {
return null;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), t0.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return null; // Paper
this.world.addEntity(t0, CreatureSpawnEvent.SpawnReason.DROWNED);
// CraftBukkit end
this.die();
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index 1d96ecb2fda1b567866f620b183a5811f75fa7f2..8b199971bd67a196168afb2e63d4c72919fec8d2 100644
index 48d7e0f971d3147218e3be774a75cdb10d8b55a6..23ef033067e388b7b7b2a981df8655e240a30594 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -112,6 +112,7 @@ public class EntityMushroomCow extends EntityCow {
if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
return false;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return false; // Paper
this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
this.die(); // CraftBukkit - from above
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 6ca4fa43c41ad555c093b90cf08cfdb1e73fda22..6e0020ae0b4d2f2597843129b83fff0d194de337 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -699,6 +699,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
return;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper
this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
// CraftBukkit end
this.die();
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 83d5731b7f964136edf7cfabb96421e0788d067a..97a1dedf7460d513a560d722b2e0f1bf09fe669c 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -257,6 +257,7 @@ public class EntityZombie extends EntityMonster {
@@ -150,6 +150,7 @@ public class EntityMushroomCow extends EntityCow implements IShearable {
if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
return;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return; // Paper
this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
this.die(); // CraftBukkit - from above
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 00183a7f6e2000ce045ce50454f1296c4c93b148..a23c8d54a30a1ed1a3ed4d158da08229f59ca4c5 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -733,6 +733,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
return;
}
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper
this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
// CraftBukkit end
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityzombie.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return; // Paper
this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.DROWNED); // CraftBukkit - added spawn reason
this.die();
}
@@ -463,6 +464,7 @@ public class EntityZombie extends EntityMonster {
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index b808477cea6bf704edfaf08a2d0366bf263e69aa..3f16f9b34a75db6dc977cb0dc1603db34dd8ddc3 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -399,6 +399,7 @@ public class EntityZombie extends EntityMonster {
if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
return;
}
@ -49,10 +53,10 @@ index 83d5731b7f964136edf7cfabb96421e0788d067a..97a1dedf7460d513a560d722b2e0f1bf
this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java
index 5c2d132c3a495650c5c279065e6659a88de0421d..b1818d269a78b6cb5594dd2f21c91ab1452649f7 100644
index 2fb6356940b57e112d1ef35bfd3aee9cd98e5754..9b920332bd397f9711f0c99702245d54b9d3841b 100644
--- a/src/main/java/net/minecraft/server/EntityZombieVillager.java
+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java
@@ -197,6 +197,7 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo
@@ -212,6 +212,7 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo
((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam
return;
}

View file

@ -5,33 +5,33 @@ Subject: [PATCH] SkeletonHorse Additions
diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
index 621f2afee599e82806d54de15ff413674523815c..290cb9337c868fa3b9cbef0545886f44a00ef804 100644
index 2aee4c592cbf7e083c522a35846735bdb7a2e448..43e605f682709708f5b79c70398691dc195ef925 100644
--- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
+++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
@@ -6,7 +6,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
private final PathfinderGoalHorseTrap bF = new PathfinderGoalHorseTrap(this);
private boolean bG;
- private int bH;
+ private int bH; public int getTrapTime() { return this.bH; } // Paper - OBFHELPER
private final PathfinderGoalHorseTrap bD = new PathfinderGoalHorseTrap(this);
private boolean bE;
- private int bF;
+ private int bF; public int getTrapTime() { return this.bF; } // Paper - OBFHELPER
public EntityHorseSkeleton(EntityTypes<? extends EntityHorseSkeleton> entitytypes, World world) {
super(entitytypes, world);
@@ -124,10 +124,12 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
@@ -125,10 +125,12 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
return 0.96F;
}
+ public boolean isTrap() { return this.eq(); } // Paper - OBFHELPER
public boolean eq() {
return this.bG;
+ public boolean isTrap() { return this.eN(); } // Paper - OBFHELPER
public boolean eN() {
return this.bE;
}
+ public void setTrap(boolean trap) { this.r(trap); } // Paper - OBFHELPER
public void r(boolean flag) {
if (flag != this.bG) {
this.bG = flag;
+ public void setTrap(boolean trap) { this.t(trap); } // Paper - OBFHELPER
public void t(boolean flag) {
if (flag != this.bE) {
this.bE = flag;
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
index dfe5a63583d8c14c82cc778ee004f2877e43776d..37626f925fb7838e41f7bfab352c9360b3786b4a 100644
index d6b02adf9fe8287d600d76fb1c3be86fdee1fa77..b37e4aa37b35863d74cb6ef95562fba65486bdf9 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
@@ -15,6 +15,7 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal {
@ -39,9 +39,9 @@ index dfe5a63583d8c14c82cc778ee004f2877e43776d..37626f925fb7838e41f7bfab352c9360
@Override
public void e() {
+ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity()).callEvent()) return; // Paper
DifficultyDamageScaler difficultydamagescaler = this.a.world.getDamageScaler(new BlockPosition(this.a));
DifficultyDamageScaler difficultydamagescaler = this.a.world.getDamageScaler(this.a.getChunkCoordinates());
this.a.r(false);
this.a.t(false);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
index e822c2200d6270ca538eadd9637b748fc3602cb6..2a7d1d4ec2c1ff16840614165c6f0c37dc534d87 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java

View file

@ -18,10 +18,10 @@ an invalid entity.
This should reduce log occurrences of dupe uuid messages.
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 13d99de2cd08de02215031a1f699110c13ef35ff..f54572773c25b6716a68166efa8d3fc8b22b6258 100644
index 28039aa8421207ce04840cc90e03d21bc8b7269f..17b8c4445af2bd2ed907d05ed3c396d4290dc63d 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -300,6 +300,7 @@ public class ChunkRegionLoader {
@@ -301,6 +301,7 @@ public class ChunkRegionLoader {
nbttagcompound1.set("TileEntities", nbttaglist1);
NBTTagList nbttaglist2 = new NBTTagList();
@ -29,7 +29,7 @@ index 13d99de2cd08de02215031a1f699110c13ef35ff..f54572773c25b6716a68166efa8d3fc8
if (ichunkaccess.getChunkStatus().getType() == ChunkStatus.Type.LEVELCHUNK) {
Chunk chunk = (Chunk) ichunkaccess;
@@ -311,13 +312,28 @@ public class ChunkRegionLoader {
@@ -312,13 +313,28 @@ public class ChunkRegionLoader {
while (iterator1.hasNext()) {
Entity entity = (Entity) iterator1.next();
NBTTagCompound nbttagcompound4 = new NBTTagCompound();
@ -59,7 +59,7 @@ index 13d99de2cd08de02215031a1f699110c13ef35ff..f54572773c25b6716a68166efa8d3fc8
} else {
ProtoChunk protochunk = (ProtoChunk) ichunkaccess;
@@ -373,6 +389,19 @@ public class ChunkRegionLoader {
@@ -377,6 +393,19 @@ public class ChunkRegionLoader {
nbttagcompound1.set("Structures", a(chunkcoordintpair, ichunkaccess.h(), ichunkaccess.v()));
return nbttagcompound;
}
@ -80,10 +80,10 @@ index 13d99de2cd08de02215031a1f699110c13ef35ff..f54572773c25b6716a68166efa8d3fc8
public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) {
if (nbttagcompound != null) {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 5086a854b84b05e5b9c0f5677051d19dfa42f343..426ca12970e0c75ba75eee6c3e3cdbf833730737 100644
index ac0bcde5ccc9ebb88922d8b82381b03675b87ae6..d81d6f7b984dc3587baadc96fc33f087b3594dcc 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1078,6 +1078,7 @@ public class WorldServer extends World {
@@ -1001,6 +1001,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
List[] aentityslice = chunk.getEntitySlices(); // Spigot
int i = aentityslice.length;
@ -91,7 +91,7 @@ index 5086a854b84b05e5b9c0f5677051d19dfa42f343..426ca12970e0c75ba75eee6c3e3cdbf8
for (int j = 0; j < i; ++j) {
List<Entity> entityslice = aentityslice[j]; // Spigot
Iterator iterator = entityslice.iterator();
@@ -1090,11 +1091,25 @@ public class WorldServer extends World {
@@ -1013,11 +1014,25 @@ public class WorldServer extends World implements GeneratorAccessSeed {
throw (IllegalStateException) SystemUtils.c(new IllegalStateException("Removing entity while ticking!"));
}

View file

@ -11,10 +11,10 @@ Returns true if getDamage() == 0 or has damage tag or other tag is set.
Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves.
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index a41be8fdaebe7cf61537c638392b3dc7c7f5b371..d5e8a7ee6de22d09e563ad1c124a18810a38a0c5 100644
index 2146d1354c48b9a76b24bca321b578d401e1a0a8..3541fed804b9bbfbd8c658d6c03a74c3dd4acf25 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -553,7 +553,7 @@ public final class CraftItemStack extends ItemStack {
@@ -561,7 +561,7 @@ public final class CraftItemStack extends ItemStack {
@Override
public boolean hasItemMeta() {

View file

@ -23,18 +23,18 @@ index b839769ceae8932bb121a0b96fde1e7d129a1f63..5acad8e44f024d3ddf5ef4fd320460ac
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 9f369f932ca0a63bde246420cfde7949f3e78ca2..c84d90a9a0c67b5ff518ce3fbc21344c808a3cf1 100644
index 3ba19f75d24a1539c94f4fed9b8f90aecc918cdc..f7be161c8557ae3848227b1a61e27374770ad243 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -816,6 +816,7 @@ public class Chunk implements IChunkAccess {
@@ -818,6 +818,7 @@ public class Chunk implements IChunkAccess {
while (iterator.hasNext()) {
Entity entity1 = (Entity) iterator.next();
+ if (entity1.shouldBeRemoved) continue; // Paper
for (int i1 = 0; i1 < l; ++i1) {
Entity entity1 = (Entity) list1.get(i1);
+ if (entity1.shouldBeRemoved) continue; // Paper
if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) {
if (predicate == null || predicate.test(entity1)) {
@@ -853,6 +854,7 @@ public class Chunk implements IChunkAccess {
if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) {
if (predicate == null || predicate.test(entity1)) {
@@ -854,6 +855,7 @@ public class Chunk implements IChunkAccess {
while (iterator.hasNext()) {
T entity = (T) iterator.next(); // CraftBukkit - decompile error
@ -42,7 +42,7 @@ index 9f369f932ca0a63bde246420cfde7949f3e78ca2..c84d90a9a0c67b5ff518ce3fbc21344c
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
list.add(entity);
@@ -874,6 +876,7 @@ public class Chunk implements IChunkAccess {
@@ -875,6 +877,7 @@ public class Chunk implements IChunkAccess {
while (iterator.hasNext()) {
T t0 = (T) iterator.next(); // CraftBukkit - decompile error
@ -51,10 +51,10 @@ index 9f369f932ca0a63bde246420cfde7949f3e78ca2..c84d90a9a0c67b5ff518ce3fbc21344c
if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check
list.add(t0);
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 84d36ea84e25a701af22900af6cd3099adf6cd54..6e87ff52df30f4de8cfb11d1dbfb71211d656831 100644
index 6012891971265323603cb05ae444cca1bb058c89..9163916e6f600f2efa3e05f3df1d07ef9b60cd3a 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -195,6 +195,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@@ -196,6 +196,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@ -63,19 +63,10 @@ index 84d36ea84e25a701af22900af6cd3099adf6cd54..6e87ff52df30f4de8cfb11d1dbfb7121
public float getBukkitYaw() {
return this.yaw;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 426ca12970e0c75ba75eee6c3e3cdbf833730737..3067ab76d94c58fbfd52fac6754bf6d6d7f01d09 100644
index d81d6f7b984dc3587baadc96fc33f087b3594dcc..ba0bb12dd5c5068d31c8a925e31804ddf2cec5da 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -908,7 +908,7 @@ public class WorldServer extends World {
while (objectiterator.hasNext()) {
Entity entity = (Entity) objectiterator.next();
-
+ if (entity.shouldBeRemoved) continue; // Paper
if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
@@ -1230,6 +1230,7 @@ public class WorldServer extends World {
@@ -1153,6 +1153,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
entity.origin = entity.getBukkitEntity().getLocation();
}
// Paper end
@ -83,7 +74,7 @@ index 426ca12970e0c75ba75eee6c3e3cdbf833730737..3067ab76d94c58fbfd52fac6754bf6d6
new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}
@@ -1242,6 +1243,7 @@ public class WorldServer extends World {
@@ -1165,6 +1166,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.removeEntityFromChunk(entity);
this.entitiesById.remove(entity.getId());
this.unregisterEntity(entity);
@ -92,10 +83,10 @@ index 426ca12970e0c75ba75eee6c3e3cdbf833730737..3067ab76d94c58fbfd52fac6754bf6d6
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a59172ff043e5220ffdd363582c38ae53c429f1a..6c3cd51d92d2271cd216c42c18733d549fbe668d 100644
index 66c89831796db1bbdd6c83cba786b27ef339ec9b..411d7a3f7d4d54fbf748888e24f2032c4d091250 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1027,6 +1027,7 @@ public class CraftWorld implements World {
@@ -1031,6 +1031,7 @@ public class CraftWorld implements World {
for (Object o : world.entitiesById.values()) {
if (o instanceof net.minecraft.server.Entity) {
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o;
@ -103,7 +94,7 @@ index a59172ff043e5220ffdd363582c38ae53c429f1a..6c3cd51d92d2271cd216c42c18733d54
Entity bukkitEntity = mcEnt.getBukkitEntity();
// Assuming that bukkitEntity isn't null
@@ -1046,6 +1047,7 @@ public class CraftWorld implements World {
@@ -1050,6 +1051,7 @@ public class CraftWorld implements World {
for (Object o : world.entitiesById.values()) {
if (o instanceof net.minecraft.server.Entity) {
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o;
@ -111,7 +102,7 @@ index a59172ff043e5220ffdd363582c38ae53c429f1a..6c3cd51d92d2271cd216c42c18733d54
Entity bukkitEntity = mcEnt.getBukkitEntity();
// Assuming that bukkitEntity isn't null
@@ -1072,6 +1074,7 @@ public class CraftWorld implements World {
@@ -1076,6 +1078,7 @@ public class CraftWorld implements World {
for (Object entity: world.entitiesById.values()) {
if (entity instanceof net.minecraft.server.Entity) {
@ -119,7 +110,7 @@ index a59172ff043e5220ffdd363582c38ae53c429f1a..6c3cd51d92d2271cd216c42c18733d54
Entity bukkitEntity = ((net.minecraft.server.Entity) entity).getBukkitEntity();
if (bukkitEntity == null) {
@@ -1095,6 +1098,7 @@ public class CraftWorld implements World {
@@ -1099,6 +1102,7 @@ public class CraftWorld implements World {
for (Object entity: world.entitiesById.values()) {
if (entity instanceof net.minecraft.server.Entity) {

View file

@ -8,15 +8,15 @@ Add the following:
- Enable/Disable slot interactions
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index 992d7bfb0fd26540fbdeaf8d7845e8c2c81d608b..61d7d507aaac3e7e5a885387ae89c67dfb1c9844 100644
index 0232ffba7b18174e0ce44d91285541a9869d07b9..a70b1a17fe884980ef7c3c0a36e567a0e69ef7f0 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -36,7 +36,7 @@ public class EntityArmorStand extends EntityLiving {
private final NonNullList<ItemStack> armorItems;
private boolean armorStandInvisible;
public long bq;
- private int bB;
+ private int bB; public void setDisabledSlots(int i) { bB = i; } public int getDisabledSlots() { return bB; } // Paper - OBFHELPER
public long bp;
- private int bA;
+ private int bA; public void setDisabledSlots(int i) { bA = i; } public int getDisabledSlots() { return bA; } // Paper - OBFHELPER
public Vector3f headPose;
public Vector3f bodyPose;
public Vector3f leftArmPose;
@ -26,7 +26,7 @@ index 992d7bfb0fd26540fbdeaf8d7845e8c2c81d608b..61d7d507aaac3e7e5a885387ae89c67d
+ public boolean isSlotDisabled(EnumItemSlot slot) { return this.d(slot); } // Paper - OBFHELPER
private boolean d(EnumItemSlot enumitemslot) {
return (this.bB & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms();
return (this.bA & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 124c3185bc5c344555f684629c8818130d80ab3d..d1d689e5d78c569313c4059c4652724605dc07d2 100644

View file

@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 20 Jul 2018 23:37:03 -0500
Subject: [PATCH] AnvilDamageEvent
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
index 6b98557f59cb92db9987a58db58cfa3adbd6de48..24631b2bcb2a1d057c1fb6596ff401133c8b548a 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -67,7 +67,16 @@ public class ContainerAnvil extends ContainerAnvilAbstract {
if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a((Tag) TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) {
IBlockData iblockdata1 = BlockAnvil.c(iblockdata);
-
+ // Paper start
+ com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null);
+ if (!event.callEvent()) {
+ return;
+ } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) {
+ iblockdata1 = null;
+ } else {
+ iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING));
+ }
+ // Paper end
if (iblockdata1 == null) {
world.a(blockposition, false);
world.triggerEffect(1029, blockposition, 0);

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add TNTPrimeEvent
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index d32857c8724f97c7625208cf815c275264179209..b41de95a6390910ba8bb21bfa12ab61c85900218 100644
index 0cbf4d7d460a3e9e632fd0c9cfd318f3065f18d6..1e6159f211fb445e45bab3ca1a3bf21750928302 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
@ -15,17 +15,17 @@ index d32857c8724f97c7625208cf815c275264179209..b41de95a6390910ba8bb21bfa12ab61c
+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent
import java.util.Map;
import java.util.Random;
import java.util.Map.Entry;
@@ -237,7 +238,7 @@ public class BlockFire extends Block {
world.setTypeAndData(blockposition, (IBlockData) this.a((IBlockAccess) world, blockposition).set(BlockFire.AGE, l), 3);
@@ -249,7 +250,7 @@ public class BlockFire extends BlockFireAbstract {
world.setTypeAndData(blockposition, this.a(world, blockposition, l), 3);
} else {
- world.a(blockposition, false);
+ if(iblockdata.getBlock() != Blocks.TNT) world.a(blockposition, false); // Paper - TNTPrimeEvent - We might be cancelling it below, move the setAir down
}
Block block = iblockdata.getBlock();
@@ -245,6 +246,13 @@ public class BlockFire extends Block {
@@ -257,6 +258,13 @@ public class BlockFire extends BlockFireAbstract {
if (block instanceof BlockTNT) {
BlockTNT blocktnt = (BlockTNT) block;
@ -40,7 +40,7 @@ index d32857c8724f97c7625208cf815c275264179209..b41de95a6390910ba8bb21bfa12ab61c
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
index 6cb82420b428fdc7bbcd4f22f1f65ba085a7f3c2..592fcd538a4e25d7779328d6d6cd8efda238b55d 100644
index c6fe9c1f7ef06c4524533130b493ca5e72bd1693..7b601955f3fd36f06c838b896b455a606954d980 100644
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
@@ -1,6 +1,7 @@
@ -53,7 +53,7 @@ index 6cb82420b428fdc7bbcd4f22f1f65ba085a7f3c2..592fcd538a4e25d7779328d6d6cd8efd
@@ -15,6 +16,11 @@ public class BlockTNT extends Block {
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (iblockdata1.getBlock() != iblockdata.getBlock()) {
if (!iblockdata1.a(iblockdata.getBlock())) {
if (world.isBlockIndirectlyPowered(blockposition)) {
+ // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);;
@ -80,12 +80,12 @@ index 6cb82420b428fdc7bbcd4f22f1f65ba085a7f3c2..592fcd538a4e25d7779328d6d6cd8efd
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
if (!world.isClientSide) {
+ // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);;
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
+ org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null;
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent())
+ return;
+ // Paper end
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource());
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, explosion.getSource());
entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
@@ -71,6 +88,11 @@ public class BlockTNT extends Block {
@ -100,22 +100,22 @@ index 6cb82420b428fdc7bbcd4f22f1f65ba085a7f3c2..592fcd538a4e25d7779328d6d6cd8efd
a(world, blockposition, (EntityLiving) entityhuman);
world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11);
if (!entityhuman.isCreative()) {
@@ -101,6 +123,13 @@ public class BlockTNT extends Block {
@@ -100,6 +122,13 @@ public class BlockTNT extends Block {
}
// CraftBukkit end
+ // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, entityarrow.getBukkitEntity()).callEvent()) {
+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, iprojectile.getBukkitEntity()).callEvent()) {
+ return;
+ }
+ // Paper end
+
a(world, blockposition, entity1 instanceof EntityLiving ? (EntityLiving) entity1 : null);
a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null);
world.a(blockposition, false);
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 138e2ea56a91e519a34fd3be9c0ab111a4b17544..6a4ccaeb0fef2cabab87b33bf89b5a68608800e9 100644
index 05b7cdb33b45a4f503cd7fe4130b54d59e7b6452..279807dc5045e765fe7496315494b2cb231d08f9 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -11,6 +11,7 @@ import org.bukkit.craftbukkit.block.CraftBlock;
@ -126,9 +126,9 @@ index 138e2ea56a91e519a34fd3be9c0ab111a4b17544..6a4ccaeb0fef2cabab87b33bf89b5a68
// PAIL: Fixme
public class EntityEnderDragon extends EntityInsentient implements IMonster {
@@ -468,6 +469,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
@@ -466,6 +467,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
});
craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.a);
craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.b);
}
+ // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.x, blockposition.y, blockposition.z);

View file

@ -1,27 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 20 Jul 2018 23:37:03 -0500
Subject: [PATCH] AnvilDamageEvent
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
index 1d9ce5ef1cc0158e8218d4cf15bc1e84017e7620..286b930ddb7224fa3929cb0ef0b94f5f5205b104 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -85,6 +85,16 @@ public class ContainerAnvil extends Container {
if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a(TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) {
IBlockData iblockdata1 = BlockAnvil.e(iblockdata);
+ // Paper start
+ com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null);
+ if (!event.callEvent()) {
+ return;
+ } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) {
+ iblockdata1 = null;
+ } else {
+ iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING));
+ }
+ // Paper end
if (iblockdata1 == null) {
world.a(blockposition, false);

View file

@ -45,7 +45,7 @@ index 26ab855dcf38446a3d8577108bd16fdbb76126b2..adef07d4d521b4aaa6f3389b04aa27e2
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a46ef5e72d03a32e22cfd77b2581de70edcc686a..e7ad580740bab3e102f32bd715c6b01a0e721e09 100644
index 8855a1de14f970ddac25d935a4b2e00c7e277908..6884fcd0749eba2dc84f1447b338a879ff79f0c8 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -76,6 +76,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -56,7 +56,7 @@ index a46ef5e72d03a32e22cfd77b2581de70edcc686a..e7ad580740bab3e102f32bd715c6b01a
// CraftBukkit end
private int j;
private final Int2ShortMap k = new Int2ShortOpenHashMap();
@@ -207,6 +208,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -206,6 +207,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.minecraftServer.getMethodProfiler().exit();
// CraftBukkit start
for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ;
@ -64,7 +64,7 @@ index a46ef5e72d03a32e22cfd77b2581de70edcc686a..e7ad580740bab3e102f32bd715c6b01a
/* Use thread-safe field access instead
if (this.chatThrottle > 0) {
--this.chatThrottle;
@@ -526,7 +528,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -529,7 +531,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
// CraftBukkit start

View file

@ -5,28 +5,28 @@ Subject: [PATCH] Add hand to bucket events
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index 6e385b53048da91a0f50bf02f6510de2a685baab..2c8bbf20ae7f9be2c57822833bb285b86ea1a901 100644
index 28f97aea9c64678c6e6f821482ad47388af83089..30ee6df6b47c7cfa555a757a01270b986e4fdf9e 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -61,7 +61,7 @@ public class EntityCow extends EntityAnimal {
@@ -58,7 +58,7 @@ public class EntityCow extends EntityAnimal {
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) {
// CraftBukkit start - Got milk?
- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand
- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand
if (event.isCancelled()) {
return false;
return EnumInteractionResult.PASS;
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
index 7c5c0498435e3fae6a7997e34f197d402daa3bd8..ffe4b9eb868ecd9582ba1d3fc3aef0f82372e852 100644
index aada95b9d02d8ca0b870ec08875b5b719a543212..d68ee8d5dc5f8a75dc465f155acccb79c1ebe99c 100644
--- a/src/main/java/net/minecraft/server/ItemBucket.java
+++ b/src/main/java/net/minecraft/server/ItemBucket.java
@@ -41,7 +41,7 @@ public class ItemBucket extends Item {
if (iblockdata.getBlock() instanceof IFluidSource) {
// CraftBukkit start
FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a());
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand);
- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a());
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); // Paper - add enumhand
if (event.isCancelled()) {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager)
@ -34,14 +34,14 @@ index 7c5c0498435e3fae6a7997e34f197d402daa3bd8..ffe4b9eb868ecd9582ba1d3fc3aef0f8
iblockdata = world.getType(blockposition);
BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1;
- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit
+ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand
- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack)) { // CraftBukkit
+ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand
this.a(world, itemstack, blockposition2);
if (entityhuman instanceof EntityPlayer) {
CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack);
@@ -115,10 +115,12 @@ public class ItemBucket extends Item {
@@ -94,10 +94,12 @@ public class ItemBucket extends Item {
public void a(World world, ItemStack itemstack, BlockPosition blockposition) {}
// CraftBukkit start
public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) {
- return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null);
+ // Paper start - add enumHand
@ -54,28 +54,85 @@ index 7c5c0498435e3fae6a7997e34f197d402daa3bd8..ffe4b9eb868ecd9582ba1d3fc3aef0f8
// CraftBukkit end
if (!(this.fluidType instanceof FluidTypeFlowing)) {
return false;
@@ -128,11 +130,11 @@ public class ItemBucket extends Item {
boolean flag = iblockdata.a(this.fluidType);
@@ -110,7 +112,7 @@ public class ItemBucket extends Item {
if (!iblockdata.isAir() && !flag && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) {
- return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit
+ return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit
} else {
// CraftBukkit start
if (entityhuman != null) {
- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack);
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand);
if (event.isCancelled()) {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index dccc187c6198ce2e8824b8460347586ccf5c6741..2e859c32b5a7d314e38221da75d785ff244224ad 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -381,6 +381,20 @@ public class CraftEventFactory {
// CraftBukkit start
if (flag1 && entityhuman != null) {
- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack);
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumhand
if (event.isCancelled()) {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f6cb503b8eb329cb6bfaa960f812da3c99ce45a8..a47de606a82b840180bd203816955fb657cc7c6c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -210,6 +210,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
// Paper end
+ // Paper start - moved up from WorldServer
+ public BlockPosition getSpawn() {
+ BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
+
+ if (!this.getWorldBorder().a(blockposition)) {
+ blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
+ }
+
+ return blockposition;
+ }
+ // Paper end
@Override
public boolean s_() {
return this.isClientSide;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index ba0bb12dd5c5068d31c8a925e31804ddf2cec5da..14ec04c6503cca58f64fc2a82a9fd715a06dcefb 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1484,15 +1484,17 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition));
}
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
- public BlockPosition getSpawn() {
- BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
-
- if (!this.getWorldBorder().a(blockposition)) {
- blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
- }
-
- return blockposition;
- }
+ // Paper - moved up to World
+ //public BlockPosition getSpawn() {
+ // BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
+ //
+ // if (!this.getWorldBorder().a(blockposition)) {
+ // blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
+ // }
+ //
+ // return blockposition;
+ //}
+ // Paper end
public LongSet getForceLoadedChunks() {
ForcedChunk forcedchunk = (ForcedChunk) this.getWorldPersistentData().b(ForcedChunk::new, "chunks");
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index a349ce7f04d6f2b29a0de534a3f7616778026666..46889e7b462673f5d03e6efc1114074da3165d47 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -220,7 +220,7 @@ public class CraftEventFactory {
public static Entity entityDamage; // For use in EntityDamageByEntityEvent
// helper methods
- private static boolean canBuild(WorldServer world, Player player, int x, int z) {
+ private static boolean canBuild(World world, Player player, int x, int z) {
int spawnSize = Bukkit.getServer().getSpawnRadius();
if (world.getDimensionKey() != World.OVERWORLD) return true;
@@ -379,6 +379,20 @@ public class CraftEventFactory {
}
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
+ // Paper start - add enumHand
+ return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null);
+ }
@ -93,7 +150,7 @@ index dccc187c6198ce2e8824b8460347586ccf5c6741..2e859c32b5a7d314e38221da75d785ff
Player player = (Player) who.getBukkitEntity();
CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item);
Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem());
@@ -393,10 +407,10 @@ public class CraftEventFactory {
@@ -391,10 +405,10 @@ public class CraftEventFactory {
PlayerEvent event;
if (isFilling) {

View file

@ -5,11 +5,11 @@ Subject: [PATCH] MC-135506: Experience should save as Integers
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 87c6b77ce3b1446893a0d617b63f925a403e09cc..53c6c3389216c1fc5c0789b4a1621acb239cc9ec 100644
index 7f2d8de12473c5413bbfc10ea0947d6a30802645..2396b4d6ffda648c24fc39cef22792c7d9247456 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -207,7 +207,7 @@ public class EntityExperienceOrb extends Entity {
public void b(NBTTagCompound nbttagcompound) {
@@ -202,7 +202,7 @@ public class EntityExperienceOrb extends Entity {
public void saveData(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Health", (short) this.e);
nbttagcompound.setShort("Age", (short) this.c);
- nbttagcompound.setShort("Value", (short) this.value);
@ -17,8 +17,8 @@ index 87c6b77ce3b1446893a0d617b63f925a403e09cc..53c6c3389216c1fc5c0789b4a1621acb
this.savePaperNBT(nbttagcompound); // Paper
}
@@ -215,7 +215,7 @@ public class EntityExperienceOrb extends Entity {
public void a(NBTTagCompound nbttagcompound) {
@@ -210,7 +210,7 @@ public class EntityExperienceOrb extends Entity {
public void loadData(NBTTagCompound nbttagcompound) {
this.e = nbttagcompound.getShort("Health");
this.c = nbttagcompound.getShort("Age");
- this.value = nbttagcompound.getShort("Value");

View file

@ -12,24 +12,24 @@ This allows the client to render multiple skull textures from the same user,
for when different skins were used when skull was made.
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 641a52b968ef04a142b32703b61c8b75643b36a6..0b0c3c681c07cf8506df1b91b1feaf130891a440 100644
index 7b2010ec4955fb5788c60178c6e306ea3098e9ba..95e801a9a7ca405ff7e80c920fa78493d0ef5374 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -54,7 +54,7 @@ public final class ItemStack {
// Paper end
@@ -60,7 +60,7 @@ public final class ItemStack {
private int g;
@Deprecated
private Item item;
- private NBTTagCompound tag;
+ NBTTagCompound tag; // Paper -> package private
private boolean h;
private EntityItemFrame i;
private ShapeDetectorBlock j;
private boolean j;
private Entity k;
private ShapeDetectorBlock l;
diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java
index d9574a9ace96d8c5666e62a5aed96a67021b91d8..e810da87977b441cc329066e3cb158ef3bc62a66 100644
index 6e049c2e2a142ce022b9dc278a3bb302f723e42c..e3ba2e8db98c94ed10e96601addb0110a8385926 100644
--- a/src/main/java/net/minecraft/server/PacketDataSerializer.java
+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java
@@ -250,9 +250,18 @@ public class PacketDataSerializer extends ByteBuf {
if (item.usesDurability() || item.o()) {
@@ -274,9 +274,18 @@ public class PacketDataSerializer extends ByteBuf {
if (item.usesDurability() || item.n()) {
// Spigot start - filter
itemstack = itemstack.cloneItemStack();
- CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
@ -48,7 +48,7 @@ index d9574a9ace96d8c5666e62a5aed96a67021b91d8..e810da87977b441cc329066e3cb158ef
}
this.a(nbttagcompound);
@@ -272,7 +281,17 @@ public class PacketDataSerializer extends ByteBuf {
@@ -296,7 +305,17 @@ public class PacketDataSerializer extends ByteBuf {
itemstack.setTag(this.l());
// CraftBukkit start
if (itemstack.getTag() != null) {
@ -68,10 +68,10 @@ index d9574a9ace96d8c5666e62a5aed96a67021b91d8..e810da87977b441cc329066e3cb158ef
// CraftBukkit end
return itemstack;
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index 3a1d0deb0dec880d73185690e2a7c769a2731479..1fcbbd698a7e1b9ae3e8b5fa0328b85c43019bea 100644
index e336437207f9d6adbab69ef2785c129ff2ec1b36..72ff0a1e6428a1776f49c26e1715f5f2428ba242 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -58,6 +58,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
@@ -60,6 +60,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
if (this.f() || (i & 1 << j) != 0) {
NBTTagCompound nbttagcompound = tileentity.b();
@ -80,10 +80,10 @@ index 3a1d0deb0dec880d73185690e2a7c769a2731479..1fcbbd698a7e1b9ae3e8b5fa0328b85c
this.g.add(nbttagcompound);
}
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index 83faa9dc5f74df4609cab34a66e4feed12990463..93030a7b24d53953b3672a23816dfc02d3c74caf 100644
index 9a2efd38f28819355a271b9515ac98c3382c7383..fb7aa15c272678be7ec2a1d28891a62121695ed8 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
@@ -142,9 +142,37 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
@@ -145,9 +145,37 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
@Nullable
@Override
public PacketPlayOutTileEntityData getUpdatePacket() {

Some files were not shown because too many files have changed in this diff Show more