Started by
ArcusM
on
Topic category: Help with Minecraft modding (Java Edition)
I created a custom item and wanted to use it to help players locate a custom structure I added. Is it possible to test for the player facing the structure and/or being within a certain distance of the structure? I’m thinking something along the lines of a procedure when they have the item in inventory, Do “this" if player is facing structure, else do “this” if player is within a certain distance. The logic part I can work out as long as there is a way to test for custom structures.
Edited by ArcusM on Mon, 09/30/2019 - 23:00
I don't think there is but what you could do is make a block named structure navigator with the same texture as your floor or wall blocks in your structure. Place that block in the center of your structure ie center floor block or wall.
Make the block drop a floor (wood plank) or a wall (cobblestone) block. Make it drop what ever type of block it's disguising it's self as. Also mimic the properties of that block such as toughness and tool type to break it with.
Make the block unaffected by silk touch.
That sounds great. I was thinking of something similar if there was no way to track a custom structure. So lets say I made such a block, how would I track that block? Is there something like get location of closets "structure navigator” and also something like a test for the player facing that closest structure navigator?
So I think you can in console commands but I'm not sure how to parse that information out to be usable in MC.
You could use the "check for a block in a 6x6x6 box" in the template library and modify it to your needs.
Not sure how taxing it would be.. Sucks that there is no tick rate settings or nbt data for items.
Yeah I’m wanting something like checking for a block hundreds, even thousands of blocks away. Basically wherever the player is I want them to be able to know when they’re facing the chunk that contains this block. Is there a prosecute a custom block to give it’s location when its created? Maybe if the block gives it’s location I could work backwards.
I could give a custom block NBT data. Would that make it easier to find?
Closest facing structure you would calculate the distance it took to find that block.ie the difference between the player position and the block position.
Player xyz - Found block xyz using abs.
Absolute math no negative numbers.
If it found two blocks of the same type
You would only want the lowest distance whatever value is the lowest is the only value you would use.
Store the calculated distance in a variable then do:
If nav block found at xyz distance<= calculated_distance then
Do other stuff
Endif