diff --git a/src/main/java/dev/dubhe/anvilcraft/building/BuildingUndoResources.java b/src/main/java/dev/dubhe/anvilcraft/building/BuildingUndoResources.java index dc6c38bff0..90d8c81da6 100644 --- a/src/main/java/dev/dubhe/anvilcraft/building/BuildingUndoResources.java +++ b/src/main/java/dev/dubhe/anvilcraft/building/BuildingUndoResources.java @@ -5,6 +5,8 @@ import dev.dubhe.anvilcraft.block.UseItemOnBlock; import dev.dubhe.anvilcraft.block.entity.storage.StorageBlockEntity; import dev.dubhe.anvilcraft.block.item.LargeCakeBlockItem; +import dev.dubhe.anvilcraft.entity.FallingSpectralBlockEntity; +import dev.dubhe.anvilcraft.init.block.ModBlocks; import net.minecraft.core.BlockPos; import net.minecraft.core.component.DataComponents; import net.minecraft.core.registries.Registries; @@ -150,6 +152,10 @@ void entity(ServerLevel level, CompoundTag data, ItemStack supplied) { if (plan.unsupported()) throw new IllegalArgumentException("Unknown entity resources"); if (probe instanceof Mob && plan.material().isEmpty()) throw new IllegalArgumentException("Missing creature material"); ItemStack material = supplied.isEmpty() ? plan.material().copy() : supplied.copyWithCount(1); + if (probe instanceof FallingSpectralBlockEntity falling && falling.getBlockState().is(ModBlocks.SPECTRAL_ANVIL) + && (!copy.contains("Ghost") || copy.getBoolean("Ghost")) && !falling.dropItem) { + material = ItemStack.EMPTY; + } if (!material.isEmpty() && !(probe instanceof ItemEntity)) { if (probe.getCustomName() == null) material.remove(DataComponents.CUSTOM_NAME); else material.set(DataComponents.CUSTOM_NAME, probe.getCustomName());