izukuboi

Untitled

Aug 5th, 2023
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. from mcpi.minecraft import Minecraft
  2.  
  3. # Connect to the Minecraft server (replace 'localhost' and '4711' with your server's IP and port)
  4. mc = Minecraft.create("localhost", 4711)
  5.  
  6. # Define the region you want to scan (replace these coordinates with your desired region)
  7. min_x, min_y, min_z = -10, 0, -10
  8. max_x, max_y, max_z = 10, 10, 10
  9.  
  10. # Function to check if a block is visible
  11. def is_block_visible(x, y, z):
  12. player_x, player_y, player_z = mc.player.getPos()
  13.  
  14. max_distance = 10 # Adjust this value as needed for your use case
  15.  
  16. distance = ((x - player_x) ** 2 + (y - player_y) ** 2 + (z - player_z) ** 2) ** 0.5
  17.  
  18. return distance <= max_distance
  19.  
  20. # Function to scan blocks and print block data for visible blocks
  21. def scan_visible_blocks():
  22. for x in range(min_x, max_x + 1):
  23. for y in range(min_y, max_y + 1):
  24. for z in range(min_z, max_z + 1):
  25. if is_block_visible(x, y, z):
  26. block_data = mc.getBlockWithData(x, y, z)
  27. print(f"Visible Block at ({x}, {y}, {z}): ID={block_data.id}, Data={block_data.data}")
  28.  
  29. if __name__ == "__main__":
  30. scan_visible_blocks()
  31.  
Advertisement
Add Comment
Please, Sign In to add comment