ImpactDevelopment / ImpactIssues

Please use this repo to report bugs and request features
https://impactclient.net/
219 stars 36 forks source link

A setting for smart auto walk which will not path into new chunks #2579

Open drees5 opened 4 years ago

drees5 commented 4 years ago

It would be helpful for afk base hunting if auto walk could use the new chunks module to detect new chunks, then path around them/along them (following a loaded chunk trail)

5HT2 commented 4 years ago

.b explore

drees5 commented 4 years ago

What's would be the difference between #explore and this (https://github.com/kami-blue/client/issues/752) then? By the way, I mean the auto-walking, I understand that the stashfinder is separate.

5HT2 commented 4 years ago

.b explore walks around in unexplored chunks

kami-blue/client#752 is to add functionality to KAMI Blue's stashfinder to automatically turn while flying, at specific intervals determined by the Hilbert Curve in mathematics.

drees5 commented 4 years ago

Sorry, I should have been more specific with my first statement, when I said new chunks I was referring to the "new chunks" module in impact or "Chunk Finder" module in KAMI BLUE which renders chunks that have been loaded for the first time on spigot servers.

5HT2 commented 4 years ago

Ohhh

.b explore is baritones own way of pathing, and it avoides chunks that you haven't explored before, not new chunks

the new chunks module in impact just renders new chunks

if you want an autowalk option to specifically avoid only new chunks I can reopen this but I was discussing this earlier, there's situations which it would completely break

Screenshot_20200810-214329.png

drees5 commented 4 years ago

Is there no way of getting around the issues with running in circles? Like with baritone when there are no know locations of a block, and it explores in order to find one, couldn't you do a similar thing with new chunks, exploring to find previously loaded chunks. And with the problem of running in circles, would it be possible to remember previously explored/cached chunks like with #explore and try to avoid re-exploring them?

5HT2 commented 4 years ago

I mean technically yes you could

5HT2 commented 4 years ago

but it's annoying to do

drees5 commented 4 years ago

Fair enough lol, you mentioned above that you already coded some of the module before running into issues, is the code anywhere on the repository so I could have a go at it as a project?

drees5 commented 4 years ago

Even if you are unwilling to send me your previous attempt, if you could re-open the issue it would be good, perhaps one day you will see the issue and have time to tackle it.

Thanks

5HT2 commented 4 years ago

Code isn't anywhere anymore, as it was too unreliable. I didn't bother pushing it to a branch.

drees5 commented 4 years ago

In order to get the ChunkX and ChunkY, would I have to get it via reading the file in which new chunks are saved, or could I directly tell which chunks are new chunks when exploring?

I had a look at the code for the new chunks rendering module, but I couldn't figure out where the module was getting the coordinates of the new chunks.

5HT2 commented 4 years ago

You can't get the coordinates themselves until the chunk is fully generated, just keep that in mind.

https://github.com/kami-blue/client/blob/a80bb58e4f4ceb5352f6193481a2ad03c4e4fad0/src/main/java/me/zeroeightsix/kami/module/modules/render/ChunkFinder.java#L68-L71

This is how chunkfinder gets the coords

drees5 commented 4 years ago

How does the chunk finder actually tell which chunks are being loaded for the first time though, is it related to the chunks being "dirty"? One last thing, why are you using a binary shift to multiply the chunk coordinates by 16, is it faster?

5HT2 commented 4 years ago

One last thing, why are you using a binary shift to multiply the chunk coordinates by 16, is it faster?

Yes.

is it related to the chunks being "dirty"?

Also yes.

This removes the no longer new chunks from the list

    @EventHandler
    private Listener<net.minecraftforge.event.world.ChunkEvent.Unload> unloadListener = new Listener<>(event -> dirty = chunks.remove(event.getChunk()));

This adds the new chunks while they're load. They're not a "full chunk" if you're currently generating them.

    @EventHandler
    public Listener<ChunkEvent> listener = new Listener<>(event -> {
        if (!event.getPacket().isFullChunk()) {
            chunks.add(event.getChunk());
            dirty = true;
            if (saveNewChunks.getValue()) {
                saveNewChunk(event.getChunk());
            }
        }
    });