#Pretty good why

1 messages · Page 1 of 1 (latest)

acoustic swallow
#

im kinda stuck

kind eagle
#

Ok

acoustic swallow
#

thinking about creative way retrive a radius of blocks

#

i dont want to loop thru box radius

#

i was thinking to use BETWEEN do you think it would work?

kind eagle
#

That's the best way though

acoustic swallow
#

i need to get 1 block radius

#

i cant really loop sql statements bad idea

kind eagle
#

Spatial partitioning

acoustic swallow
#

i would better do a single request

kind eagle
#

What's the use case

acoustic swallow
#

i basically on block place event want to get the blocks in 1 radius

#

now using x y z

#

which y should be between + - (1 )

kind eagle
#

Get blocks?

acoustic swallow
#

and x z capture corners i guess

#

no not blocks

#

i store data using x y z

#

as a key

kind eagle
#

I have a library for that

acoustic swallow
#

what library

#

i made it without mysql (using flatfile)

kind eagle
#

It lets you attach arbitrary data to any block and retrieve data

acoustic swallow
#

just by looping lol

#

nah im on 1.7.10 lmao

kind eagle
#

It can be backed by pdc or sqlite

#

SQLite will work for 1.7.10

acoustic swallow
#

there no things like that in the api back then

#

well i didnt understand

kind eagle
#

The readme has instructions for how to install it

#

This wiki page has usage instructions

acoustic swallow
#

i think we have miss understand here but wait ill check it

kind eagle
#

Let me know if you have any questions

acoustic swallow
#
            int radius = 3;
            int minX = loc.getBlockX() - radius;
            int minY = loc.getBlockY() - radius;
            int minZ = loc.getBlockZ() - radius;
            int maxX = loc.getBlockX() + radius;
            int maxY = loc.getBlockY() + radius;
            int maxZ = loc.getBlockZ() + radius;


            for (int x = minX; x <= maxX; ++x) {
                for (int y = minY; y <= maxY; ++y) {
                    for (int z = minZ; z <= maxZ; ++z) {
#

its just what i meant

#

to do

#

using betweens lol

kind eagle
#

Yeah but you shouldn't

#

Not without creating an index, at least

#

But not with MySQL regardless

#

MySQL is best for cross server data

#

This seems like it's tied to the world

#

So, not cross server

acoustic swallow
#

oh i saw your library it looks dope

#

nah i return data i stored in the sql server

#

like do you think using betweens

#

i would be able to get both corners each time?

kind eagle
#

That doesn't change what I said

#

Yes you could do it using between

#

I hope you're not doing it on the main thread, though?

acoustic swallow
#

it would be headache?

#

nah i got hikari cp

#

😄

#

so im fine

kind eagle
#

Ok

acoustic swallow
#

suffered enough with SQlite locks

#

lol

kind eagle
#

I don't know about between

acoustic swallow
#

its only reason i dont stick to SQLite just because the locks if it begin used

kind eagle
#

But you can just use <= >=

kind eagle
acoustic swallow
#

i closed and opened

#

i just sometimes had many requests at the same time

#

which caused problems

#

and didnt use cache to put queires

kind eagle
#

Right that's why you keep a queue in another thread

#

And use transactions

#

They make it much much faster

#

I'm suggesting using my library because all that logic is already implemented there

#

If you don't want to, I understand

#

But it will make things easier

acoustic swallow
#

nah not looking to get things easier sorry ;P i should learn some how

#

afterwards all

#

like using some libraries is fine

#

like protocol lib

#

but in general your library will replace all my work till now xd

#

thanks!

kind eagle
#

If you have a cuboid

#

You should just be able to check x <= maxX AND x >= minX

#

For all dimensions