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.
2021-08-25 07:59:26 +00:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index eca9a9eb3d8dcd51ee9e96f2f4050bf51bc58b48..aea3fafb093814bfb1e010aa70d138eecc07af93 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -525,6 +525,10 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
2021-06-11 12:02:28 +00:00
if (Boat.class.isAssignableFrom(clazz)) {
2021-08-25 07:59:26 +00:00
entity = new net.minecraft.world.entity.vehicle.Boat(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)) {
2021-08-25 07:59:26 +00:00
+ entity = new net.minecraft.world.entity.item.ItemEntity(world, x, y, z, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Item.byBlock(net.minecraft.world.level.block.Blocks.DIRT)));
2021-06-11 12:02:28 +00:00
+ // Paper end
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
2021-08-25 07:59:26 +00:00
entity = new FallingBlockEntity(world, x, y, z, this.getHandle().getBlockState(new BlockPos(x, y, z)));
2021-06-11 12:02:28 +00:00
} else if (Projectile.class.isAssignableFrom(clazz)) {