Allow spawning Item entities with World.spawnEntity

This API has more capabilities than .dropItem with the Consumer function

Item can be set inside of the Consumer pre spawn function.
This commit is contained in:
Aikar 2018-06-04 20:48:14 -04:00
parent df8f9f0f30
commit a082f773cb
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
3 changed files with 35 additions and 30 deletions

View File

@ -1,4 +1,4 @@
From 330ce044c0951d3829ed61953f64dc97072b8bb3 Mon Sep 17 00:00:00 2001
From 7c7f7211d71e8292dda5a79d6552aca44e33a70f Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 14:32:43 -0600
Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
@ -6,7 +6,7 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java
index 8361888c..3623751b 100644
index 8361888c2..3623751bf 100644
--- a/src/main/java/net/minecraft/server/EULA.java
+++ b/src/main/java/net/minecraft/server/EULA.java
@@ -51,7 +51,8 @@ public class EULA {
@ -20,7 +20,7 @@ index 8361888c..3623751b 100644
EULA.a.warn("Failed to save {}", this.b, exception);
} finally {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8d08b536..92d48025 100644
index 8d08b536a..92d480251 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1049,7 +1049,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
@ -33,7 +33,7 @@ index 8d08b536..92d48025 100644
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 9042deed..33b40ffc 100644
index 9042deed6..33b40ffc2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -136,7 +136,7 @@ import org.bukkit.event.server.TabCompleteEvent;
@ -46,7 +46,7 @@ index 9042deed..33b40ffc 100644
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 0c5862a3..e3667e55 100644
index 0c5862a3f..e3667e558 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -192,7 +192,7 @@ public class Main {
@ -59,7 +59,7 @@ index 0c5862a3..e3667e55 100644
Thread.sleep(TimeUnit.SECONDS.toMillis(15));
}
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 94a3d423..3ed983cc 100644
index 94a3d4237..91b8aa6a1 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -19,7 +19,7 @@ public class WatchdogThread extends Thread
@ -76,7 +76,7 @@ index 94a3d423..3ed983cc 100644
Logger log = Bukkit.getServer().getLogger();
log.log( Level.SEVERE, "The server has stopped responding!" );
- log.log( Level.SEVERE, "Please report this to http://www.spigotmc.org/" );
+ log.log( Level.SEVERE, "Please report this to https://aquifermc.org/" );
+ log.log( Level.SEVERE, "Please report this to https://github.com/PaperMC/Paper/issues" );
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() );
+ log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
@ -93,5 +93,5 @@ index 94a3d423..3ed983cc 100644
log.log( Level.SEVERE, "------------------------------" );
//
--
2.14.3
2.17.1

View File

@ -0,0 +1,27 @@
From 1bd75020d7f3a3ad3ec77930dc4fdf7be99ea430 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 4 Jun 2018 20:39:20 -0400
Subject: [PATCH] Allow spawning Item entities with World.spawnEntity
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 36dd8ad60..e88846bb5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -953,6 +953,10 @@ public class CraftWorld implements World {
if (Boat.class.isAssignableFrom(clazz)) {
entity = new EntityBoat(world, x, y, z);
entity.setPositionRotation(x, y, z, yaw, pitch);
+ // Paper start
+ } else if (org.bukkit.entity.Item.class.isAssignableFrom(clazz)) {
+ entity = new EntityItem(world, x, y, z, new net.minecraft.server.ItemStack(net.minecraft.server.Item.getItemOf(net.minecraft.server.Blocks.DIRT)));
+ // Paper end
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
entity = new EntityFallingBlock(world, x, y, z, world.getType(new BlockPosition(x, y, z)));
} else if (Projectile.class.isAssignableFrom(clazz)) {
--
2.17.1

View File

@ -1,22 +0,0 @@
From 0ba1966afe00a10523fefe20ffe56b412433a9fb Mon Sep 17 00:00:00 2001
From: Kyle Wood <demonwav@gmail.com>
Date: Mon, 4 Jun 2018 01:53:43 -0500
Subject: [PATCH] Report issues to the issue tracker
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index cb1fcf0f..57a4748a 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -56,7 +56,7 @@ public class WatchdogThread extends Thread
{
Logger log = Bukkit.getServer().getLogger();
log.log( Level.SEVERE, "The server has stopped responding!" );
- log.log( Level.SEVERE, "Please report this to https://aquifermc.org/" );
+ log.log( Level.SEVERE, "Please report this to https://github.com/PaperMC/Paper/issues" );
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() );
//
--
2.17.1