Handling item/ghost-in-cursor placement
Posted: Sun Oct 29, 2023 1:59 pm
I'm trying to recreate something similar to the "underground visualisation" you get with underground pipes:
The entity ghost concerned, though, can't be an underground pipe (for reasons). It is either a crafting machine or a SimpleEntity. So I would have to be able to know when a player is holding a buildable item and then use the rendering API to temporarily draw whatever if the item is in the right place and has the right orientation.
I figured out the first part - using events to track when a buildable item or ghost is in the cursor, and starting a conditional on-tick if any player is in that state, clearing it when none are. But I don't think there is a way of telling what tile the entity is going to be built in, i.e. the tile you're currently pointing at. Am I wrong?
Also, I can't find out any way of telling what orientation the to-be-built entity has - is that even possible? cursor_stack and cursor_ghost return various kinds of item specification which doesn't have any concept of direction.
The entity ghost concerned, though, can't be an underground pipe (for reasons). It is either a crafting machine or a SimpleEntity. So I would have to be able to know when a player is holding a buildable item and then use the rendering API to temporarily draw whatever if the item is in the right place and has the right orientation.
I figured out the first part - using events to track when a buildable item or ghost is in the cursor, and starting a conditional on-tick if any player is in that state, clearing it when none are. But I don't think there is a way of telling what tile the entity is going to be built in, i.e. the tile you're currently pointing at. Am I wrong?
Also, I can't find out any way of telling what orientation the to-be-built entity has - is that even possible? cursor_stack and cursor_ghost return various kinds of item specification which doesn't have any concept of direction.