From 9e0618ec28d108f2dc5d112626fe4eab6e76dbd7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 2 Nov 2024 17:40:23 +1100 Subject: [PATCH] SPIGOT-7937: Cannot spawn minecart during world generation with minecart_improvements enabled --- .../org/bukkit/craftbukkit/entity/CraftEntityTypes.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java index 1105204f7..5d35cfb77 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -491,7 +491,13 @@ public final class CraftEntityTypes { } private static Function createMinecart(EntityTypes entityTypes) { - return spawnData -> EntityMinecartAbstract.createMinecart(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), entityTypes, EntitySpawnReason.TRIGGERED, ItemStack.EMPTY, null); + return spawnData -> { + if (spawnData.normalWorld()) { + return EntityMinecartAbstract.createMinecart(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), entityTypes, EntitySpawnReason.TRIGGERED, ItemStack.EMPTY, null); + } else { + return combine(fromEntityType(entityTypes), (spawnData2, entity) -> entity.setInitialPos(spawnData.x(), spawnData.y(), spawnData.z())).apply(spawnData); + } + }; } private static Function createAndMove(EntityTypes entityTypes) {