aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/xmrvizzy/skyblocker/skyblock/dwarven/Puzzler.java
blob: 6c1def82bec6c143fd35ee3fec7597893ab6d289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package me.xmrvizzy.skyblocker.skyblock.dwarven;

import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;

public class Puzzler {

    public static void solve(String message) {
        MinecraftClient client = MinecraftClient.getInstance();
        if (client.player == null && client.world == null) return;

        int x = 181;
        int y = 195;
        int z = 135;

        String path = Formatting.strip(message);
        path = path.substring(path.indexOf(":") + 2);
        String check = path
                .replaceAll("▲", "").replaceAll("▶", "")
                .replaceAll("▼", "").replaceAll("◀", "");

        if (check.isEmpty()) {
            for (char c : path.toCharArray()) {
                if (c == '▲') z += 1;
                if (c == '▶') x -= 1;
                if (c == '▼') z -= 1;
                if (c == '◀') x += 1;
            }

            client.world.setBlockState(new BlockPos(x, y, z), Blocks.EMERALD_BLOCK.getDefaultState());
        }
    }
}