Created
August 11, 2025 10:51
-
-
Save joranmulderij/cd85d589d6ea5ea073c8f5204380170d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from litemapy import * | |
| from math import * | |
| from shutil import copy | |
| reg = Region(0, 0, 0, 213, 9, 213) | |
| center_offset = 106 | |
| schem = reg.as_schematic(name="Beacon Ring", author="FlutterDart", description="Made with litemapy") | |
| beacon = BlockState("minecraft:beacon") | |
| iron_block = BlockState("minecraft:iron_block") | |
| blue_concrete = BlockState("minecraft:blue_concrete") | |
| reg[center_offset, 0, center_offset] = BlockState("minecraft:red_concrete") | |
| beacon_colors = [] | |
| def bin_to_blocks(binary, block1, block2): | |
| stack = [BlockState("minecraft:white_stained_glass")] | |
| for i in range(6): | |
| if binary[i] == "0": | |
| stack.insert(1, block1) | |
| else: | |
| stack.insert(1, block2) | |
| return stack | |
| def put_beacon_colors(block1, block2): | |
| for i in range(63): | |
| binary = bin(i)[2:].zfill(6) | |
| stack = bin_to_blocks(binary, block1, block2) | |
| beacon_colors.append(stack) | |
| put_beacon_colors(BlockState("minecraft:purple_stained_glass"), BlockState("minecraft:red_stained_glass")) | |
| put_beacon_colors(BlockState("minecraft:red_stained_glass"), BlockState("minecraft:orange_stained_glass")) | |
| put_beacon_colors(BlockState("minecraft:orange_stained_glass"), BlockState("minecraft:yellow_stained_glass")) | |
| put_beacon_colors(BlockState("minecraft:yellow_stained_glass"), BlockState("minecraft:lime_stained_glass")) | |
| put_beacon_colors(BlockState("minecraft:lime_stained_glass"), BlockState("minecraft:cyan_stained_glass")) | |
| put_beacon_colors(BlockState("minecraft:cyan_stained_glass"), BlockState("minecraft:blue_stained_glass")) | |
| put_beacon_colors(BlockState("minecraft:blue_stained_glass"), BlockState("minecraft:purple_stained_glass")) | |
| print(len(beacon_colors)) | |
| def put_beacon(x, z): | |
| reg[x, 1, z] = beacon | |
| reg[x, 0, z] = iron_block | |
| reg[x+1, 0, z] = iron_block | |
| reg[x-1, 0, z] = iron_block | |
| reg[x, 0, z+1] = iron_block | |
| reg[x, 0, z-1] = iron_block | |
| reg[x+1, 0, z+1] = iron_block | |
| reg[x-1, 0, z+1] = iron_block | |
| reg[x+1, 0, z-1] = iron_block | |
| reg[x-1, 0, z-1] = iron_block | |
| angle = 180 + degrees(atan2(z-center_offset, x-center_offset)) | |
| color_index = round(angle / 360 * len(beacon_colors)) % len(beacon_colors) | |
| stack = beacon_colors[color_index] | |
| for i in range(7): | |
| reg[x, 2+i, z] = stack[i] | |
| print(360/degrees(atan2(1, 105))) | |
| steps = 220 | |
| for i in range(steps//4+1): | |
| angle = i * (360 / steps) | |
| least_angle_error = 1000 | |
| for x in range(-110+1, 110+1): | |
| for z in range(-110+1, 110+1): | |
| if x**2 + z**2 <= 104**2: | |
| continue | |
| elif x**2 + z**2 >= 106**2: | |
| continue | |
| actual_angle = degrees(atan2(z, x)) | |
| angle_error = abs(actual_angle - angle) | |
| if angle_error < least_angle_error: | |
| least_angle_error = angle_error | |
| least_error_x = x | |
| least_error_z = z | |
| print(f"Angle: {angle}, Error: {least_angle_error}, Coordinates: ({least_error_x}, {least_error_z})") | |
| put_beacon(center_offset + least_error_x, center_offset + least_error_z) | |
| put_beacon(center_offset + least_error_x, center_offset - least_error_z) | |
| put_beacon(center_offset - least_error_x, center_offset + least_error_z) | |
| put_beacon(center_offset - least_error_x, center_offset - least_error_z) | |
| schem.save("beacon_ring.litematic") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment