2021-06-11 14:02:28 +02: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 09:59:26 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
2023-07-04 10:22:56 +02:00
index 3dd759d030411420f93eb5ac51f2087ecbf2dc49..4dc5c75d1fa0748b6e7e95d90b92a865b2f6362e 100644
2021-08-25 09:59:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
2023-06-13 01:51:45 +02:00
@@ -592,6 +592,10 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
2022-06-07 23:45:11 +02:00
entity = net.minecraft.world.entity.EntityType.BOAT.create(world);
}
2021-06-11 14:02:28 +02:00
entity.moveTo(x, y, z, yaw, pitch);
+ // Paper start
+ } else if (org.bukkit.entity.Item.class.isAssignableFrom(clazz)) {
2021-08-25 09:59:26 +02: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 14:02:28 +02:00
+ // Paper end
} else if (FallingBlock.class.isAssignableFrom(clazz)) {
2023-03-14 19:59:51 +01:00
BlockPos pos = BlockPos.containing(x, y, z);
2022-03-01 06:43:03 +01:00
entity = FallingBlockEntity.fall(world, pos, this.getHandle().getBlockState(pos));