Posted January 26, 201510 yr As stated, I would like to know a method to know what blocks are in a radius So that I can do something special for them.
January 26, 201510 yr Hi This link about blocks might help. http://greyminecraftcoder.blogspot.co.at/2014/12/blocks-18.html Edit: Actually, that link is for 1.8. So it might be a bit confusing. 1.7.10 doesn't have block states, it has getBlock and getBlockMetadata (0-15) instead. But the picture is still correct. Basic idea: 1) use for loops to iterate over a cube in x, y, z centred on the player's current location [xp, yp, zp]. 2) at each [x,y,z], calculate the squared distance from the player's [xp,yp,zp]. If the squared distance is less than radius*radius, your [x,y,z] is within radius of the player, so then use World.getBlock(x,y,z) to retrieve the block at that location. -TGG
January 26, 201510 yr Author Now I have a list with target Blocks. Then I should proceed to: How to get position of those Blocks?
January 26, 201510 yr Now I have a list with target Blocks. Then I should proceed to: How to get position of those Blocks? You should save the coordinates found too. Use a custom class that stores both the block and its position, and keep a list of those. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 26, 201510 yr You don't need a cusstom class if you are just getting each of the blocks by using three neseted for loops. You would already have their coordinates, the three different variables from each of the for loops. Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
January 26, 201510 yr You don't need a cusstom class if you are just getting each of the blocks by using three neseted for loops. You would already have their coordinates, the three different variables from each of the for loops. It depends on what he's doing. If you're doing something "right now because you're looking at this block" then no. If you're doing something like "get me a list of all the valid locations matching X criteria" and picking one (or more) at random/via sorting algorithm, etc. then yeah, you should use a custom class. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
January 26, 201510 yr Yeah, what Draco said. Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods
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.