Posted January 30, 20205 yr Is there a quick way to recover all TE within an area? I created this code, but I would like to know if there is something more efficient private void checkNeighbors(int area) { int range = area / 2; int X = getPos().getX(); int Z = getPos().getZ(); for(int x = X - range; x <= X + range; x++) { for(int z = Z - range; z <= Z + range; z++) { BlockPos pos = new BlockPos.MutableBlockPos(x, getPos().getY(), z); BlockState block = world.getBlockState(pos); if(block.hasTileEntity()) { TileEntity te = world.getTileEntity(pos); } } } }
January 30, 20205 yr Author But if I put my block near the edge of the chunk, then I will not get the blocks that are in another chunk?
January 30, 20205 yr 35 minutes ago, Edivad99 said: BlockPos pos = new BlockPos.MutableBlockPos(x, getPos().getY(), z); Also don't use mutable block positions if you aren't going to mutate them. Also also BlockPos.getAllInBox(...) exists. 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.
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.