2021-06-11 12:02:28 +00:00
From 0000000000000000000000000000000000000000 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
2021-06-13 05:13:07 +00:00
index fbc82598a2f7ea439bb371ecf074b486ae09c355..e744a793062acce339c4914eb2eff2a8c2ff6f1b 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
2021-06-13 05:13:07 +00:00
@@ -1506,6 +1506,10 @@ public class CraftWorld implements World {
2021-06-11 12:02:28 +00:00
if (Boat.class.isAssignableFrom(clazz)) {
2021-06-12 19:30:37 +00:00
entity = new net.minecraft.world.entity.vehicle.Boat(this.world, x, y, z);
2021-06-11 12:02:28 +00:00
entity.moveTo(x, y, z, yaw, pitch);
+ // Paper start
+ } else if (org.bukkit.entity.Item.class.isAssignableFrom(clazz)) {
+ entity = new ItemEntity(world, x, y, z, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Item.byBlock(net.minecraft.world.level.block.Blocks.DIRT)));
+ // Paper end
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
2021-06-12 19:30:37 +00:00
entity = new FallingBlockEntity(this.world, x, y, z, this.world.getBlockState(new BlockPos(x, y, z)));
2021-06-11 12:02:28 +00:00
} else if (Projectile.class.isAssignableFrom(clazz)) {