From 8112f4a6d90b3a2e472af2d0a784b5bba0a28cc6 Mon Sep 17 00:00:00 2001 From: lukas0008 Date: Thu, 19 Sep 2024 20:24:15 +0200 Subject: [PATCH] Make `block_id` macro work in pumpkin-world --- pumpkin-macros/src/block_id.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pumpkin-macros/src/block_id.rs b/pumpkin-macros/src/block_id.rs index 796eeca56..a71e90df4 100644 --- a/pumpkin-macros/src/block_id.rs +++ b/pumpkin-macros/src/block_id.rs @@ -131,8 +131,14 @@ pub fn block_id_impl(item: TokenStream) -> TokenStream { } }; - quote! { - pumpkin_world::block::block_id::BlockId::from_id(#id as u16) + if std::env::var("CARGO_PKG_NAME").unwrap() == "pumpkin-world" { + quote! { + crate::block::block_id::BlockId::from_id(#id as u16) + } + } else { + quote! { + pumpkin_world::block::block_id::BlockId::from_id(#id as u16) + } } .into() }