19MisterX98 / Nether_Bedrock_Cracker

Cracks nether seeds from bedrock. JAVA EDITION ONLY
68 stars 8 forks source link

Please, for the love of god, make a mod that gets all the coordinats of all bedrock nearby. #24

Open tomasventura13 opened 3 days ago

tomasventura13 commented 3 days ago

It would be great if there was a mod that gets all the coordinates of all bedrock in a specific block radius (other than the surface or absolute bottom for obvious reasons), with a '.' command, and saves it into a 'config' file that can be open by the seedcracker program. I am tired of manually counting the individual position of each bedrock and alt tabbing between the game and the program. I would be incredibly thankful, and I believe this would be something simple to make. I am not as good of a coder or else I would do this, but I think you could, especially given how efficient it would make the process, even though it already works well.

Nippaku-Zanmu commented 3 days ago
package com.example.addon.modules;

import com.example.addon.Addon;
import meteordevelopment.meteorclient.events.world.ChunkDataEvent;
import meteordevelopment.meteorclient.settings.IntSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.settings.StringSetting;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.block.Blocks;
import net.minecraft.text.Text;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.Chunk;

import java.io.*;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class BedrockFinder extends Module {
    SettingGroup sgDefault = settings.getDefaultGroup();
    private final Setting<Integer> searchY = sgDefault.add(new IntSetting.Builder()
            .name("Y")
            .range(-64, 128)
            .sliderRange(-64, 128)
                    .defaultValue(123)
            .build());
    private final Setting<String> savePath = sgDefault.add(new StringSetting.Builder()
            .name("Path")
            .defaultValue("D:/br.txt")
            .build());
    public static ExecutorService executor = Executors.newSingleThreadExecutor();

    public BedrockFinder() {
        super(Addon.CATEGORY, "BedrockFinder", "");
    }
   LinkedHashSet<BlockPos> bedrockPos = new LinkedHashSet<>();

    @EventHandler
    private void onChunkData(ChunkDataEvent event) {
        executor.execute(()->{
            Chunk c = event.chunk();
            for (int x = c.getPos().getStartX(); x <= c.getPos().getEndX(); x++) {
                for (int z = c.getPos().getStartZ(); z <= c.getPos().getEndZ(); z++) {
                    BlockPos sPos = new BlockPos(x, searchY.get(), z);
                    if (c.getBlockState(sPos).getBlock().equals(Blocks.BEDROCK))
                        bedrockPos.add(sPos);
                }
            }
        });
    }

    @Override
    public void onDeactivate() {
        BufferedWriter bw = null;
        try {
            File f = new File(savePath.get());
            if (f.exists() && f.canWrite()) {
                bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f)));
                for (BlockPos pos : bedrockPos) {
                    String s = pos.getX() + " " + pos.getY() + " " + pos.getZ() +
                            " Bedrock";
                    bw.write(s);
                    bw.newLine();
                }
                bw.flush();
                bw.close();
            }else {
                ChatUtils.sendMsg(Text.of("File Not Found"));
            }
        } catch (Exception e) {
            ChatUtils.sendMsg(Text.of(e.getMessage()));
        } finally {
            bedrockPos.clear();
            try {
                if (bw != null) {
                    bw.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

This is a module for MeteorClient Please compile it yourself

tomasventura13 commented 3 days ago

Oh god I have no idea how to compile the addon, I've tried some stuff but I'm at a complete loss. Thanks for the help anyway, if you release it let me know, it would be great!

(btw, if you've ever compiled it for 1.21 feel free to post the file if you still got it or something :D)

Nippaku-Zanmu commented 3 days ago

Oh god I have no idea how to compile the addon, I've tried some stuff but I'm at a complete loss. Thanks for the help anyway, if you release it let me know, it would be great!

(btw, if you've ever compiled it for 1.21 feel free to post the file if you still got it or something :D)

I have some other modules inside the plugin I don't want to release it and you can try forking https://github.com/MeteorDevelopment/meteor-addon-template This is the plugin template for the Meteor client You can use Github's CI build to complete it All you need to do is copy the module and add a new module registration statement to the AddonTemplate.java, and then use Github's CI build or IDEA to build it

Hopefully I'm not wrong with what I mean Machine translation is not accurate for long sentences

tomasventura13 commented 3 days ago

Thanks, I tried putting the code in a file in src\main\java\com\example\addon\modules and used gradlew to compile it but it gave me a lot of errors and since I have absolutely no clue what I'm doing, I guess I will give up, again if you have anything more straightforward it would be great but thanks a lot anyway!