#Dafeist's thread because chat is spammy

1 messages · Page 1 of 1 (latest)

deep kite
#

Let's move here

pure junco
#

k

dawn plaza
#

that should work perfectly fine

pure junco
#

no it doesn't

dawn plaza
#

that means you made a mistake somewhere else

pure junco
#

bro

#

are you kidding me? lol

deep kite
#

Ugh

dawn plaza
#

so you're telling me, all this time that ive been using this, it was wrong?

remote fjord
#

didn't @deep kite rant something about circular LoS?

dawn plaza
#

it always worked perfectly fine

pure junco
dawn plaza
#

yeah i think i know what the problem might be

deep kite
#
Location eye = player.getEyeLocation();
Vector direction = eye.getDirection().normalize();

double distance = (selection.depth + selection.width) / 4D;
Location distBlock = eye.clone().add(direction.clone().multiply(5 + distance));
#

let's break down some variables

pure junco
#

ok

#

and now?

dawn plaza
#

could u please send the entire function?

deep kite
#

are you braindead

dawn plaza
#

me?

deep kite
#

problem is not about circular LOS now that I have a video

#

yes

dawn plaza
#

guess i am

pure junco
#

but you can see the problem right?

deep kite
#

I mean

#

I see what you're trying to do

#

and this approach is "good enough", you're just snapping a block to the client's LOS

pure junco
#

thats not good enough as im literally tilting away all the time when im seeing this

deep kite
#

Just for some general info, what's the depth and width you're using?

pure junco
#

its the width and depth of my schematic

deep kite
#

and are you rounding stuff or just calling getBlock().setType

pure junco
#

but it's irrelevant here, as the same problem occurs when just using 5

pure junco
deep kite
#

Okay

remote fjord
#

perhaps it might be a better approach to just test this code by spawning a particle at the given location?

#

If that works then it is the position -> block logic that is a bit unfortunate

pure junco
#

instead of sending a block change sending a particle?

remote fjord
#

More or less yeah

#

without rounding the position to the nearest block position

deep kite
#

by not rounding we can assure it's not an issue with your math :p

pure junco
#

1sec

#

damn I hate the arguments of spawnParticle

deep kite
#

player#spawnParticle(location, ParticleType.something, 1, 0, 0, 0, 0)

pure junco
#

does not exist

deep kite
#

are you working on 1.8 or something

pure junco
#

1.19.3

#

with J17, everything latest

deep kite
#

flip the particle and location args

#

should be this one

#

by adding all those 0's you ensure there's no random velocity

#

which looks awful

pure junco
#

yep this spawns at weird locations

#

not on the crosshair at all

remote fjord
#

Could you show a video so we could have an idea what is going on?

pure junco
#

yes 1sec

deep kite
#

show code you're rounding shit

dawn plaza
#

ok

#

i just remade it and it works fine 💀

#

bro what the fuck are you doing

pure junco
#

wait imma spawn the particle directly

dawn plaza
#

BRO NAH

#

it spawns directly at my fucking crosshair

#

u trolling right?

#
    @EventHandler
    public void e(PlayerInteractEvent e){
        if(e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
        Player p = e.getPlayer();
        if(p.getInventory().getItemInMainHand().getType() != Material.DIAMOND_HORSE_ARMOR) return;
        Location l = p.getEyeLocation().add(p.getEyeLocation().getDirection().multiply(5));
        Bukkit.broadcastMessage(Utils.locationToString(l, 1));
        p.spawnParticle(Particle.FLAME, l, 1, 0, 0, 0, 0);
    
pure junco
#

where am I rounding?

#

hmm lets see

deep kite
#

ew 1 letter variables

pure junco
#

^

deep kite
dawn plaza
#

its not like i'd actually use it

deep kite
#

it does

pseudo geode
deep kite
#

bad habits

dawn plaza
#

i was just testing

#

but ok

deep kite
#

still bad habits

dawn plaza
#

ill use full letter variables next time

pseudo geode
#

one day you'll try smoking because you're just trying

pure junco
#
                Location distBlock = player.getEyeLocation().add(player.getEyeLocation().getDirection().normalize().multiply(5 + (selection.depth + selection.width)/4D));
                System.out.println("distBlock=" + distBlock.getX() + ";" + distBlock.getY() + ";" + distBlock.getZ());
                
                if(latest == null) {
                    latest = selection.show(player, distBlock, player.getFacing(), true);
                    return;
                }
                
                for(SchematicBlock block : latest) player.sendBlockChange(new Location(player.getWorld(), block.getX(), block.getY(), block.getZ()), Material.AIR.createBlockData());
                latest = selection.show(player, distBlock, player.getFacing(), true);
pseudo geode
#

it might not end well

dawn plaza
#

when u calculate it already??

deep kite
dawn plaza
#

or am i stupid

deep kite
dawn plaza
#

ah

pure junco
#

^

dawn plaza
#

also the code for vectors i provided spawns particle pin point on crosshair >:(

pure junco
#
    public ArrayList<SchematicBlock> show(Player player, Location center, BlockFace direction, boolean replaceAir) {

        ArrayList<SchematicBlock> blocks = render(center, direction, replaceAir);
                
        if(blocks == null) return null;
        for(SchematicBlock block : blocks) {
            player.sendBlockChange(new Location(player.getWorld(), block.getX(), block.getY(), block.getZ()), block.getBlockdata());
        }
        return blocks;
    }
deep kite
#

let's see if by I remaking it, it worky

pure junco
#

u need render too?

dawn plaza
pure junco
# dawn plaza

bro you know I already know the particle is on crosshair and im rounding?

#

why u constantly telling us that?

deep kite
#
Location eye = player.getEyeLocation();
Vector direction = eye.getDirection().normalize();

double distance = (selection.depth + selection.width) / 4D;
Location distBlock = eye.clone().add(direction.clone().multiply(5 + distance));

// debug
player.spawnParticle(Particle.FLAME, distBlock, 1, 0, 0, 0, 0);

if(latest != null) {
  BlockData airData = Material.AIR.createBlockData();

  for(SchematicBlock block : latest) {
    Location blockLocation = new Location(player.getWorld(), block.getX(), block.getY(), block.getZ());
    player.sendBlockChange(blockLocation, airData);
  }
}

latest = selection.show(player, distBlock, player.getFacing(), true);
pure junco
#

uhmmm what??

deep kite
#

should make it a bit cleaner

pure junco
deep kite
#

uh no?

#

because I assign the new position after

pure junco
#

imma just try out

deep kite
#

it just flushes the old position if it's there

#

and then draws the new one regardless

pure junco
#

does not work now

deep kite
#

lovely

#

does the particle render well at least

pure junco
#

1ec

#

nope it does not

deep kite
#

and you copypasted my code block exactly?

pure junco
#

yes

deep kite
#

because that's very odd

pure junco
#

then the issue seems to be in render()

#

since it gets the center passed and returns the blocks

#

wait method too big lol

#

Literally gonna throw bricks against the window rn. Already tying to fix this simple issue the whole damn afternoon

tired ibex
#

o.o

tired ibex
#

also could explain why you divide selection by 4? o.O

pure junco
#

Just a constant

pure junco
tired ibex
#

or explain why you divide it by 4

pure junco
#

Its just to lower the length a big

#

But don't care about that, its not the issue

tired ibex
#

and I assume

#

that when you were showing the block in the vide

#

that what you are trying to make like showing the player it will get placed before they place it?

pure junco
#

Yes

tired ibex
#

then...

#

the entire math is wrong

#

jk, not all of it lol

#

but selection is not even important for anything

#

it shouldn't even be part of the math except to express magnitude

#

that is the bigger it is, the further away it is so player can see it

#

because that is what you wanted

#

sqrt(selection.depth*selection.depth + selection.width*selection.width)

#

this gives you the magnitude of the selection

pure junco
#

Idk and care right now tho bc I gotta fix the issue first lol

#

Im gonna look at that later, first gotta get it working at all

tired ibex
#

double mag = sqrt(selection.depth*selection.depth + selection.width*selection.width);

Vector awayDistance = player.getEyeLocation.getDirection().multiply(mag);

Location blockLocationAway = awayDistance.toLocation();
#

this will give you a location relative to the size of the schematic

pure junco
#

bro

tired ibex
#

from this location, you can center your schematic