Posted December 13, 201410 yr Hi, I have created an item that gets the x,y,z coordinates of whichever block that a player right clicks. These coordinates are then saved as NBT tag compounds in the following way item.stackTagCompound.setDouble("selectedBlockXCoord", x); item.stackTagCompound.setDouble("selectedBlockYCoord", y); item.stackTagCompound.setDouble("selectedBlockZCoord", z); I know that you can retrieve this data in the following way Double selectedBlockXCoord =item.stackTagCompound.getDouble("selectedBlockXCoord"); I wish to use this item to get world coordinates and then to pass these coordinates to any entity that I right click on. I am trying to figure out a way to accomplish this functionality. Does anyone have any ideas?
December 13, 201410 yr If the entity is yours, you can override the interact(EntityPlayer) method, in which you can get the ItemStack the player is holding (can be null), check if the item is the item you want, and get the variables from the stackTagCompound (can be null) of the item the player is currently holding. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
December 23, 201410 yr Author What do you mean by if the entity is yours? Do you mean tamed by you or do you mean a custom entity that I have created and added as part of my mod? My ultimate goal is: I wish to use the item to "select" any entity in the world a custom entity to start but eventually try to extend the functionality to any entity found in the world and then pass on to it coordinates that the entity will use to create way-points and from those calculate a vector so that custom pathing can be achieved. I have been trying to break the problem down into smaller and smaller chunks as my thread involving custom pathing didnt generate specific enough responses.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.