Contents
How to build Krutoy's data center on a Minecraft Server
This is a How-To for building up Krutoy's Datacenter. In this How-To we use a RCON-Perl interface and at first a normal Vanilla Minecraft-Server. In a second step we install Forge and OpenComputers in order to set up the OpenComputers Components for the data center.
Building the data center
In a first step install Minecraft libminecraft-rcon-perl from CPAN. Maybe this deb file I've already build will work for you: libminecraft-rcon-perl_0.1.4-1_all.deb. If it doesn't work I recommend to use dh-make-perl for creating a proper package for your needs.
Download Krutoy's data center table via command line:
wget http://hastebin.com/raw/upojowidah
Download the mc-rcon_printer.pl perl script and open it in an editor, for example with gedit or vi. Store it in the same directory where you have stored the upojowidah file (see above).
- Set you credentials and the corner coordinates:
- Line 2,3 of the above listing you can leave unchanged. In line 3 please fill in your password. Example:
1 my $mc_rcon_password = 'your_password_here';
Use the <F3> key to see you actual coordinates (see the Block field under the XYZ field). Ideal is a desert biome and a relatively plane area lying on a level about 64. Nevertheless, the Y-Coordinate for the data center should be at the 24. Remember: The data center has a very deep cellar, which spans about multiple floors.
On the command line in the directory where you have stored the mc-rcon_printer.pl script type:
chmod u+x mc-rcon_printer.pl
- and then press enter. This sets the execution flag for the file.
Start your local Minecraft server if it doesn't alreay runs. See the wiki page MinecraftServer for a detailed documention for setting up a local server.
Launch your Minecraft client, connect to you local server and move to the corner coords (use <F3>).
Press the <Esc> Button to switch back from Minecraft to your Desktop. Open a terminal and cd to the directory where you have stored the script an the upojowidah file. At this directory type:
./mc-rcon_printer.pl upojowidah
- Switch back to Minecraft and watch the show. The construction process for Krutoy's data center should take about 20 minutes.
FAQ
What to do if the server crashs
Creating such a large structure as the data center is no small burden on the server and it can collapse. If that happens do not panic. Simply terminate the script and restart the server. Then start the script again. To protect the server the script always makes a one-second pause each 10 chunks. If the server constantly crashs you have to mark down this value. The building process will takes longer then.
Can I modify the script
Of course! Play around with it. Adjust it to your needs or improve it. The script is very simple. There are some out commented lines that take over certain functions if you uncomment them. See the comments above these lines for more information.
mc-rcon_printer.pl listing
1 #!/usr/bin/perl -w
2 # $Id: mc-rcon_printer.pl 623 2016-01-10 15:00:08Z oliver $
3
4 use strict;
5 use Minecraft::RCON;
6
7 # Your credentials here:
8 my $mc_server = 'localhost';
9 my $mc_rcon_port = '25575';
10 my $mc_rcon_password = '';
11
12 # Corner coords
13 my $x = 0;
14 my $y = 24;
15 my $z = 0;
16
17 # Mapping value => block id
18 my %block_val2id = (0 => 'air', 1 => 'stone', 2 => 'grass', 3 => 'dirt', 4 => 'cobblestone', 5 => 'planks', 6 => 'sapling', 7 => 'bedrock', 8 => 'flowing_water', 9 => 'water', 10 => 'flowing_lava', 11 => 'lava', 12 => 'sand', 13 => 'gravel', 14 => 'gold_ore', 15 => 'iron_ore', 16 => 'coal_ore', 11 => 'log', 12 => 'leaves', 19 => 'sponge', 20 => 'glass', 21 => 'lapis_ore', 22 => 'lapis_block', 23 => 'dispenser', 24 => 'sandstone', 25 => 'noteblock', 26 => 'bed', 27 => 'golden_rail', 28 => 'detector_rail', 29 => 'sticky_piston', 30 => 'web', 31 => 'tallgrass', 32 => 'deadbush', 33 => 'piston', 34 => 'piston_head', 35 => 'wool', 36 => 'piston_extension', 37 => 'yellow_flower', 38 => 'red_flower', 39 => 'brown_mushroom', 40 => 'red_mushroom', 41 => 'gold_block', 42 => 'iron_block', 43 => 'double_stone_slab', 44 => 'stone_slab', 45 => 'brick_block', 46 => 'tnt', 47 => 'bookshelf', 48 => 'mossy_cobblestone', 49 => 'obsidian', 50 => 'torch', 51 => 'fire', 52 => 'mob_spawner', 53 => 'oak_stairs', 54 => 'chest', 55 => 'redstone_wire', 56 => 'diamond_ore', 57 => 'diamond_block', 58 => 'crafting_table', 59 => 'wheat', 60 => 'farmland', 61 => 'furnace', 62 => 'lit_furnace', 63 => 'standing_sign', 64 => 'wooden_door', 65 => 'ladder', 66 => 'rail', 67 => 'stone_stairs', 68 => 'wall_sign', 69 => 'lever', 70 => 'stone_pressure_plate', 71 => 'iron_door', 72 => 'wooden_pressure_plate', 73 => 'redstone_ore', 74 => 'lit_redstone_ore', 75 => 'unlit_redstone_torch', 76 => 'redstone_torch', 77 => 'stone_button', 78 => 'snow_layer', 79 => 'ice', 80 => 'snow', 81 => 'cactus', 82 => 'clay', 83 => 'reeds', 84 => 'jukebox', 85 => 'fence', 86 => 'pumpkin', 87 => 'netherrack', 88 => 'soul_sand', 89 => 'glowstone', 90 => 'portal', 91 => 'lit_pumpkin', 92 => 'cake', 93 => 'unpowered_repeater', 94 => 'powered_repeater', 95 => 'stained_glass', 96 => 'trapdoor', 97 => 'monster_egg', 98 => 'stonebrick', 99 => 'brown_mushroom_block', 100 => 'red_mushroom_block', 101 => 'iron_bars', 102 => 'glass_pane', 103 => 'melon_block', 104 => 'pumpkin_stem', 105 => 'melon_stem', 106 => 'vine', 107 => 'fence_gate', 108 => 'brick_stairs', 109 => 'stone_brick_stairs', 110 => 'mycelium', 111 => 'waterlily', 112 => 'nether_brick', 113 => 'nether_brick_fence', 114 => 'nether_brick_stairs', 115 => 'nether_wart', 116 => 'enchanting_table', 117 => 'brewing_stand', 118 => 'cauldron', 119 => 'end_portal', 120 => 'end_portal_frame', 121 => 'end_stone', 122 => 'dragon_egg', 123 => 'redstone_lamp', 124 => 'lit_redstone_lamp', 125 => 'double_wooden_slab', 126 => 'wooden_slab', 127 => 'cocoa', 128 => 'sandstone_stairs', 129 => 'emerald_ore', 130 => 'ender_chest', 131 => 'tripwire_hook', 132 => 'tripwire', 133 => 'emerald_block', 134 => 'spruce_stairs', 135 => 'birch_stairs', 136 => 'jungle_stairs', 137 => 'command_block', 138 => 'beacon', 139 => 'cobblestone_wall', 140 => 'flower_pot', 141 => 'carrots', 142 => 'potatoes', 143 => 'wooden_button', 144 => 'skull', 145 => 'anvil', 146 => 'trapped_chest', 147 => 'light_weighted_pressure_plate', 148 => 'heavy_weighted_pressure_plate', 149 => 'unpowered_comparator', 150 => 'powered_comparator', 151 => 'daylight_detector', 152 => 'redstone_block', 153 => 'quartz_ore', 154 => 'hopper', 155 => 'quartz_block', 156 => 'quartz_stairs', 157 => 'activator_rail', 158 => 'dropper', 159 => 'stained_hardened_clay', 160 => 'stained_glass_pane', 161 => 'leaves2', 162 => 'log2', 163 => 'acacia_stairs', 164 => 'dark_oak_stairs', 165 => 'slime', 166 => 'barrier', 167 => 'iron_trapdoor', 168 => 'prismarine', 169 => 'sea_lantern', 170 => 'hay_block', 171 => 'carpet', 172 => 'hardened_clay', 173 => 'coal_block', 174 => 'packed_ice', 175 => 'double_plant', 176 => 'standing_banner', 177 => 'wall_banner', 178 => 'daylight_detector_inverted', 179 => 'red_sandstone', 180 => 'red_sandstone_stairs', 181 => 'double_stone_slab2', 182 => 'stone_slab2', 183 => 'spruce_fence_gate', 184 => 'birch_fence_gate', 185 => 'jungle_fence_gate', 186 => 'dark_oak_fence_gate', 187 => 'acacia_fence_gate', 188 => 'spruce_fence', 189 => 'birch_fence', 190 => 'jungle_fence', 191 => 'dark_oak_fence', 192 => 'acacia_fence', 193 => 'spruce_door', 194 => 'birch_door', 195 => 'jungle_door', 196 => 'acacia_door', 197 => 'dark_oak_door', 198 => 'end_rod', 199 => 'chorus_plant', 200 => 'chorus_flower', 201 => 'purpur_block', 202 => 'purpur_pillar', 203 => 'purpur_stairs', 204 => 'purpur_double_slab', 205 => 'purpur_slab', 206 => 'end_bricks', 207 => 'beetroots', 208 => 'grass_path', 209 => 'end_gateway', 210 => 'repeating_command_block', 211 => 'chain_command_block', 212 => 'frosted_ice', 255 => 'structure_block');
19
20 # OpenComputers Components
21 #
22 # Mod:
23 # my %opencomputers_val2id = (533 => 'opencomputers:case3', 531 => 'opencomputers:screen3', 513 => 'opencomputers:cable', 4229 => 'air');
24 # Vanilla:
25 my %opencomputers_val2id = (533 => 'redstone_block', 531 => 'redstone_block', 513 => 'nether_brick_fence', 4229 => 'air');
26
27 # Join all block IDs
28 my %all_val2id = (%block_val2id, %opencomputers_val2id);
29
30 my $prepress_file = shift;
31 die "Missing prepress file!\n" if(!$prepress_file);
32 open (PREPRESS,"<$prepress_file") or die "Can't open $prepress_file\n";
33
34 my $i;
35 while(<PREPRESS>)
36 {
37 chomp();
38 my $line = $_;
39 if ($line !~/^\{ \d+,\d+,\d+,\d+,\d+,\d+, (\d+|\d+,\d+) \},$/)
40 {
41 print "Skipping: $line\n";
42 next;
43 }
44 $line =~ s/[{}\s]//g;
45 $line =~ s/,$//;
46 my @data = split(',', $line);
47 $data[7] = "0" if(!$data[7]);
48
49 # Set coordinates
50 $data[0]+=$x; $data[1]+=$y; $data[2]+=$z;
51 $data[3]+=$x; $data[4]+=$y; $data[5]+=$z;
52
53 # Set block ID
54 my $blockid = $all_val2id{$data[6]};
55
56 # UNCOMMENT for filling everything with air
57 # my $blockid = 'air';
58
59 $blockid = "x" if (!$blockid);
60 $i++;
61 my $fill = "fill $data[0] $data[1] $data[2] $data[3] $data[4] $data[5] $blockid $data[7] replace";
62
63 # UNCOMMENT to set only blocks from mods
64 # next if($data[6]<255);
65
66 # Print next fill command to execute
67 print "$i\t$fill\n";
68
69 # UNCOMMENT to enable DRY RUN
70 # next;
71
72 # Fill the chunks in!
73 my $rcon = Minecraft::RCON->new( { address => $mc_server, port => $mc_rcon_port, password => $mc_rcon_password, strip_color => 1, convert_color => 1} );
74 if ($rcon->connect) {
75 print $rcon->command($fill)."\n";
76 sleep 1 if (!($i%10)); # Wait a second after 10 chunks.
77 }
78 else {
79 print "Connection to $mc_server failed!\n";
80 sleep 1;
81 # UNCOMMENT for giving up ...
82 # last;
83 }
84 }