#Thread

1 messages ยท Page 1 of 1 (latest)

kindred wagon
#

.

fast spoke
#

ok

kindred wagon
#

I have this now

#

oh wait i still can't send screenshots

fast spoke
#

did you !verify in the channel?

kindred wagon
#

yeah i'm blue

#

sometimes

fast spoke
#

If you did reconnect

kindred wagon
#

reconnect to the website?

fast spoke
#

to discord

kindred wagon
#

i did its kinda glitchy

fast spoke
#

You show white to me

#

Your name changed but you show white

kindred wagon
#

Yeah sometimes its blue sometimes white

fast spoke
#

That usually fixes by reconnecting to discord

kindred wagon
#

i'll rejoin the discord and verify again

#

t

fast spoke
#

better

kindred wagon
#

rejoining fixed it

#

I have this now

fast spoke
#

id is teh UUID field

kindred wagon
#

I just copypasted all this except the player

fast spoke
#

yep, use id

kindred wagon
#

thanks

fast spoke
#

hoveringArrowUsers, delete

kindred wagon
#

I also got this

kindred wagon
fast spoke
#

ah it wants a Function

#

one sec

brittle horizon
#

DataHolder::new

fast spoke
#

yep

#

I was going to lambda, but instance is better

#

replace new DataHolder... with DataHolder::new

kindred wagon
#

Like this

fast spoke
#

yep

kindred wagon
#

I got this in my listener on right click air

fast spoke
#

ok, and?

#

looks fine

kindred wagon
#

Yeah, I should remove the hoveringarrowusers line entirely right

fast spoke
#

a right click air will only fire if you already have an object in hand

#

yes

kindred wagon
fast spoke
#

teh DataHolder is all about that specific user so no need for it

kindred wagon
fast spoke
#

yes

#

Arrow

kindred wagon
# fast spoke Arrow

Should I put Player player = Bukkit.getPlayer(id); in every method or can I just add it outside all the methods so its in scope for everything at once

fast spoke
#

If you are goign to remove the players dataHolder reliably on disconnect you can hold it in a field

kindred wagon
#

Alright

#

Should I put the stuff outside the bukkitrunnable in the addTarget method or does some of this code need to be in my listener like the raytrace

fast spoke
#

you rayTrace in your Listener, then pass the hit entity to your DataHolder#addTarget

#

does your arrow start flying the instant it gets a new target?

#

well, you could rayTrace in your addEntity I guess

#

just logic in yoru Listener to see if you need to raytrace

#

probably cleaner

kindred wagon
fast spoke
#

in that case all that code should move into addTarget

#

BUT

#

only start a new Homing if there is not one running already

kindred wagon
#

the new homing starts on hit entity, and on hit entity the homing is at its location so its done

fast spoke
#

that code you showed starts a new task every time an entity is targeted

#

you shoudl only start it once, if not already running

#

if (homingArrow == null) homingArrow = new BukkitRunnable...

#

I'm correct in thinking (like Guardians) the arrow flys to each target in order.

fast spoke
#

ok

kindred wagon
#

i fixed this line by adding getuniqueid
targets.add(rayTraceResult.getHitEntity().getUniqueId());

fast spoke
#

remove first line

#

you add twice, once before your checks

kindred wagon
#

done

fast spoke
#

as you are doing the raytrace in the addTarget you shoudl also change the method to not take a UUID

#

it will find the target now, so doesn;t need one passed to it

kindred wagon
#

So like this

#

Entity entity

#

instead of UUID entityid

fast spoke
#

no, remove that, just ()

#

no arguments

kindred wagon
#

alr

#

I'll also put .getUniqueId behind every rayTraceResult.getHitentity

fast spoke
#

where needed

#

not needed in the instanceof checks

kindred wagon
#

Oh al

#

How about the pasttargets checks

fast spoke
#

yes, its needed there

kindred wagon
#

Do I need to make a new pasttargets thing just like players and targets

fast spoke
#

you can ignore the warning

#

you already check for null earlier

#

oh actually you don;t check for null

kindred wagon
#

do i wanna change to like this but for pasttargets

fast spoke
#

you check if the result is null but not for hit entity

#

what is past targets?

kindred wagon
#

Once a target is hit, or actually even a mob that wasn't a target, it gets added to past targets so it can't be added to targets again

fast spoke
#

for what reason?

kindred wagon
#

The arrow glitched if it went to the same target twice and this was an easy way of fixing it, and I also want to be able to count how many mobs it hit so I can increase the damage if it hit more entities and decrease the cooldown if it hit more entities later on

fast spoke
#

I'd just count

#

as you are using a Set it can't target the same Entity twice

kindred wagon
#

What do you suggest I use to replace pastTargets? as I remove the 1st target from the targets arraylist everytime an entity gets hit so I can't use that to count how many it hit before

fast spoke
#

a simple int counter

#

later when you add a hitTarget method you can increment the counter in that

kindred wagon
#

Alright

#

So for now i can remove this check and everything to do with pasttargets in the dataholder

fast spoke
#

yes

kindred wagon
#

I can't use this anymore to get the first target in the arraylist as its a Set now

fast spoke
#

no

#

you usejava if (!targets.isEmpty()) targets.iterator().next()

kindred wagon
#

Same here right

#

targets.iterator().next()

#

nvm that gives error

fast spoke
#
if (!targets.isEmpty()) {
  UUID id = targets.iterator().next();
  Entity entity = Bukkit.getEntity(id);
  if (entity == null || entity.isDead()) targets.remove(id);
}```
#

its a UUID remember, not an entity

kindred wagon
#

I got this now but I think i'm doing duplicate ifstatements & the geteyelocation sentence & the one above is probably wrong

#

I'll remove the highest if statement

#

and replace player with id

#

oh wait nvm

#

i just need to assign something else to target

#

got this now

fast spoke
#

at the very top you should have an if(targets.isEmpty) { this.cancel()); return;}

#

delete the line UUID target = (id);

#

add a return; after the targets.remove(id)

#

then move your lower code in the code block after

#

err

#

what is this doing?

#

isn;t this supposed to fly the arrow around all targets?

kindred wagon
#

these 2 lines is the calculation to fly towards the target, and cause its a runtasktimer it will keep going when the target is changed

fast spoke
#

ok I was wondering why it was called a returnVector

kindred wagon
#

Oh its cause I had it at the return calculation and then copypasted it to this one aswell i should change it

fast spoke
#

move those two lines in after java targets.remove(id); return; } ...

#

use entity not id

#

to get the vector

kindred wagon
fast spoke
#

yep, but you needs to cast to LivingEntity not Entity if you want eyeLocation

#

we can check in teh addTarget if it's a LivingEntity before adding

kindred wagon
fast spoke
#

looks good

kindred wagon
#

i got no more errors in this class but I still need to add code to stopArrow and stop the hovering arrows

fast spoke
#

yep

#

you shoudl stop the hovering when you start your homing

kindred wagon
#

Oh i think this works

#

canceling the bukkitrunnable

fast spoke
#

yes

#

when you stop homing you should also set the task to null after

kindred wagon
#

alr so i also wanna make a stopHoming method

fast spoke
#

nope

kindred wagon
#

oh

fast spoke
#

you only start homing when adding a target if homing is null

#

so you can stop it and set to null when it runs out of targets

#

setting to null is the signal to the addTarget code it should start a new one

kindred wagon
#

yeah but when it runs out of targets i first need to add the player as target so it can return and then i made it so when it hits the player everything cancels

fast spoke
#

ok

#

you cna do that

kindred wagon
#

So i will make a return method now and add my return code in there

fast spoke
#

in the return on empty you instead add your player UUID

#

let the rest of the code run

#

then when it hits the player it will be passed in as a hit and you can cancel/set null there

kindred wagon
#

yeah

fast spoke
#

the player will just be treated as another target, so that codes done

kindred wagon
#

but I still wanna make a new method right cause now the arrow will only home to 1 target, I have in my onProjectileHit method the code to go to the next target on hit and remove the old target

fast spoke
#

no

#

this code will loop over all targets, one after another

kindred wagon
#

this is my old code to remove old target and go to new

fast spoke
#

well once we add teh hitTarget code

#

now it sems time to add a hitTarget(Entity entity) method

kindred wagon
#

alr

fast spoke
#

public void as always

#

in your event you shoudl dojava if (getHitEntity != null) players.forEach(holder -> holder.hitTarget(event.getHitEntity());

kindred wagon
#

Shouldn't I call the stopHovering arrow method & startHoming method at the point all the code was at first like this

#

in my listener

fast spoke
#

no

#

you will start the hovering event in the createArrow

kindred wagon
#

oh alright

fast spoke
#

your arrow should always be hovering (when active) unless homing

kindred wagon
#

like this?

fast spoke
#

just cancel it anyway. it doesn;t matter what state it's in

#

um

#

no

#

do it yoru way, check first

#

as Tasks can throw not started errors if you try to cancel an already cancelled task

kindred wagon
#

So I don't need a stopHovering method as I can just write hoveringArrows.cancel();

fast spoke
#

yep

kindred wagon
#

Alright and I'll keep the starthoming method in the listener and it will automatically cancel the hoveringarrows in there

kindred wagon
fast spoke
#

yep

kindred wagon
#

oops i forgot this

#

or do I wanna put addtarget inside the starthoming method aswell

fast spoke
#

those look fine to me

#

although

kindred wagon
#

alr

fast spoke
#

perhaps not, you don;t want it to stop homing if no target was found

kindred wagon
#

yeha i'll add a check

fast spoke
#

just call addTarget

#

then in addTarget, if it gets through, stop homing

kindred wagon
fast spoke
#

yeah sorry, you stop hovering, start homing

kindred wagon
#

i got this at the bottom of addtarget

#

I just noticed I also cancel hoveringArrows here

fast spoke
#

yep, alls good then

kindred wagon
#

so I can remove the check in startHoming

#

cause startHoming is called at the same moment the hoveringArrows is cancelled so its allways cancelled at this point i think

fast spoke
#

yep

kindred wagon
#

I put what you said in my event

fast spoke
#

that will be seen once you add teh hitTarget method in your data class

kindred wagon
#

Alright

#

I did I just didn't add anything to it yet, I will just put everything in my onProjectileHitEvent in there except the first check

fast spoke
#

yeha, it needs args

#

Entity entity

kindred wagon
#

Do I need to keep my ifstatements where I use event. in the listener?

fast spoke
#

which one?

kindred wagon
#

I have a lot

#

I should make a method for everything under a event.getHitEntity ifstatement right?

fast spoke
#

that last screenshot you can delete it all

#

the top screen shoudl be all you need

kindred wagon
#

This all too?

fast spoke
#

all that is now in your homing task code in yoru data class

kindred wagon
#

Yeah this is to switch between targets and make it home to the player when its empty

fast spoke
#

we will do all that in your data class

#

none of that is needed now

kindred wagon
#

Alrught

#

How about this?
this is the code to clear everything that needs to be cleared and change the ghasttear item to an arrow again when it hits the user

fast spoke
#

that will all be moved into the hitTarget method

kindred wagon
fast spoke
#

yep

kindred wagon
#

this is all i got rn, the stuff with pastTargets is to make a damage combo so u deal more damage when u have more pastTargets

#

I can also remove that right as I need to rewrite it cause pastTargets is gone

fast spoke
#

past targets will be changing to a hit counter in the data class

kindred wagon
#

alr i'll just comment it too

#

This is all I have rn, the last check is so the player doesn't take damage but I have to comment & uncomment that to test damage withmyself

fast spoke
#

you change teh damage if hitting a player?

kindred wagon
#

Honestly idk what to write in hitTarget now cause you say it will already cycle through

kindred wagon
fast spoke
#

ok, we'll ignore any change for a player for now

#

we can set that later

#

lets focus on processing teh hit

kindred wagon
#

Aight

fast spoke
#

in the hitTarget methodjava if (!targets.contains(entity.getUniqueId()) return;

#

so we ignore it if it's not one of our targets

kindred wagon
#

got it

fast spoke
#

ah we need a second arg in this method

#

we need the arrow

#

to see if it is OUR arrow

kindred wagon
#

I added Arrow arrow

fast spoke
#

ok

kindred wagon
fast spoke
#

ok

#

so now we should only be dealing with our arrow and our targets

kindred wagon
#

yeah

#

brb toilet 5m when I'm back i;ll add what you write

fast spoke
#

oh, if the target we hit is the first in our Set, we remove teh target

#

ok

#
targets.remove(entity.getUniqueId());
if (targets.isEmpty()) {
    if (entity.getUniqueId().equals(id) {
        //We hit ourself as the last target so we are home.
        return;
    }
    targets.add(id)
}```
#

we also need to add our counter now

#

but, lets get this working first

kindred wagon
#

Alright i got it

fast spoke
#

yep

#

in that part where we hit ourself, we should cancel the homing task, set it null and start the hovering task

kindred wagon
fast spoke
#

looks good

#

you should be very close to being able to test

kindred wagon
#

cause I didn't update the code in my server yet

#

Oh i still got an related problem with this

#

it works in this bottom sentence tho

fast spoke
#

oh sorry its a Map so it's a map entry

#

so probably holder.getValue().hitTarget...

kindred wagon
fast spoke
#

one sec

#

forEach((k,v) -> v.hitTarget

#

would probably have been simpler to just value it

#

players.values().forEach(holder -> holder.hitTarget

kindred wagon
#

they both work now

#

Which one should I keep?

fast spoke
#

where are you getting your flyingYakaArrow from?

#

second one looks cleaner

kindred wagon
#

I still have all these things at the top

fast spoke
#

don;t use that

kindred wagon
#

remove them all?

fast spoke
#

get teh projectile from the event

kindred wagon
#

except dataholder

fast spoke
#

else it won;t match the players projectile

#

yep, all are junk now

kindred wagon
#

So I should make a getter for flyingYakkaArrow?

fast spoke
#

no

#

you only need to compare the player arrow to the projectile in the hitTarget method

kindred wagon
fast spoke
#

pass the event.getProjectile()

kindred wagon
#

oh alright

kindred wagon
fast spoke
#

its probably getEntity()

kindred wagon
#

Alright

#

I got this now

#

I'll change Arrow to Projectile in here

fast spoke
#

change the arg in the hitTarget method to take a Projectile

kindred wagon
#

i did ๐Ÿ‘

#

Oh but I can't properly check if its the right arrow now

#

As I make the arrow flyingYakaArrow so i can't check if it was flyingYakaArrow before

fast spoke
#

do you need to check it?

kindred wagon
#

I mean otherwise any projectile that hits the target will be seen as flyingYakaArrow right?

fast spoke
#

not in any of the data class code, as it will compare to the actuall arrow you spawned

#

but

#

what version of Spigot are you building for?

#

what is the oldest you need to support?

kindred wagon
#

Uh i'm coding for 1.20.4 but idk which version of spigot i'm using

fast spoke
#

in that case we can use PDC

#

goto the code where you spawn the arrow

kindred wagon
fast spoke
#

ok after that dojava flyingYakaArrow.getPersistentDataContainer().set(new NamespacedKey(YourPlugin, "yaka"), PersistentDataType.INTEGER, 0);

kindred wagon
#

Oh to give a key smart, my arrow and ghasttear items have keys already but i didn't do it for the flyingarrow

fast spoke
#

you can also use this to increment as a hit counter

#

so in your hit code just check for the PDC key

kindred wagon
fast spoke
#

if it doesn;t exist it's not your arrow

#

ah I missed a bit

#

fixed

kindred wagon
#

oh yeah a key I also forgot xdd

fast spoke
#

you can now early return in the hitTarget method if no PDC key

kindred wagon
#

I think i'm doing something wrong

fast spoke
#

one thing I'm not sure we covered was if Bukkit.getEntity(UUID) returns null in teh homing task. We shoudl remove the target from our Set

#

new NamespacedKey(plugin, "yaka")

kindred wagon
#

got it thanks

#

Do I need to call a method at the end?

fast spoke
#

no

kindred wagon
#

so that event is done?

fast spoke
#

yes

#

teh only thing you need to do later is adjust damage

kindred wagon
#

Now I only need to resolve all these errors xd

fast spoke
#

not toohard

kindred wagon
#

I should probably put this in the dataholder too right

#

this is so you can change the ghasttear back to an arrow

#

if you right click

#

and everything will cancel

fast spoke
#
//onQuit
DataHolder holder = players.get(event.getPlayer().getUniqueId());
holder.quit();
players.remove(event.getPlayer().getUniqueId());```
#

add a quit method to teh Data Holder to cancel either task if running and remove the arrow

#

you don;t need to change any damage values as teh arrow is created new

kindred wagon
#

Also I should probably make a new Player player; at the top right

#

cause since I removed it all my players don't work

fast spoke
#

yes

kindred wagon
#

and just change every player to .getUniqueId

fast spoke
#

I fixed it for event

#

err needs getPlayer() ๐Ÿ˜›

brittle horizon
#

damn elgar it's been lik 5 hours and you're still going

brittle horizon
fast spoke
#

lol yep, we rewrote minecraft for the heck of it

#

PDC tag your ghast tear

kindred wagon
#

i didn't think it'd be so hard to make it compatible for multiple players, I thought it would be a case of changing some names

brittle horizon
#

Why haven't we made a manager class yet?

fast spoke
#

lol, been moving code to teh right places

#

we only just started on events

brittle horizon
#

elgar's been spoon feeding for the past 5 hours

fast spoke
#

a fair bit, but he's understanding it

kindred wagon
fast spoke
#

tags?

kindred wagon
#

I mean its a key I just called it tag

fast spoke
#

ah ok, yep

#

you should check for that PDC rather than comparing material type

#

else any ghast tear can be used

kindred wagon
#

I already check for that at the start

fast spoke
#

you use the events getPlayer()

#

ok

#

did you add the quit method in your data holder?

kindred wagon
fast spoke
#

if you have you can just call quit on their DataHolder then

#

and remove them from the map

kindred wagon
#

I just copypasted it but I still need to change some stuff

#

like imma re3move the player check

fast spoke
#

player already exists in yoru DataHolder, so use thaT

#

delete all pastTargets stuff

#

and no need to change damage at all

#

no users anymore either

kindred wagon
#

Should I add the check if its the right player in the quit method or quit event

fast spoke
#

no

#

it doesn;t matter who calls quit in teh DataHolder it shoudl execute

kindred wagon
#

but I don't wanna remove stuff for players that didn't use the arrow right? won't that be a waste of resources when I have a lot of stuff that needs to be removed on quit

fast spoke
#

after calling homing.cancel() you shoudl also set it null, just so you won;t have any issues if you forget to remove from teh Map at any time

#

teh quit method doesn;t remove any items

#

it only removes the arrow entity and stops any tasks

kindred wagon
#

yeah

#

but then the code will run for everyone thgat quits I thought i wanna limit it so it only prcs when someone who is using it quits

fast spoke
#

it only runs for the player who is quitting

kindred wagon
#

cause imma remove everything also when they turn their ghasttear back into an arrow

kindred wagon
fast spoke
#

you do in the quit event

kindred wagon
fast spoke
#

you get the player from teh event and only run their quit code

#

event.getPlayer().getUniqueId()

kindred wagon
#

I don;'t have any if statements so I don't really understand how I'm seperating the arrow users from all other players that quit

fast spoke
#

because you are forgetting each Player has their own DataHolder

#

you only call quit in teh DataHolder for that specific player

kindred wagon
#

oh

#

my bad

fast spoke
#

Instances can be confusing

#

just because there is only one set of code, it's per instance not per class

kindred wagon
#

Should I replace these with the same code in the onQUit method or create an onDisable method so I can also disable the hovering arrows in there and basically copy the onquit

fast spoke
#

no, just call quit

#

don;t copy coide

kindred wagon
#

Yeah but I also need to disable hoveringArrows in there

fast spoke
#

use the same code you use in onQuit event

kindred wagon
#

or I can just add removing hoveringArrows to onquit

fast spoke
#

get teh players DataHolder and call quit

#

brb I need the loo, 10 mins

kindred wagon
#

Alright

#

i got no more errors ๐Ÿฅน

#

imma test it, but i can't test it with multiple players cause server.pro doesn't work anymore so i gotta find something to make a server quick

#

Also idk if the "player" I use in my listener is the UUID player as I assign it like this

#

oh the first interact event doesn't work yet

fast spoke
#

Yeah I'm not good with object instancing like that, which is why I prefer lambdas

#

one sec

fast spoke
#

ok try computeIfAbsent(player.getUniqueId(), k -> new DataHolder(k));

kindred wagon
#

also if I click on replace its the same sentence as before so thats why its the same error

fast spoke
#

@brittle horizon Why does this error?

#

can't use DataHolder::new as it needs a UUID

#

show me your whole DataHolder class

brittle horizon
#

and k -> new DataHolder(k) is the same as DataHolder::new

brittle horizon
#

something tells me your IDE's just bugging out

#

Try seeing if it compiles

kindred wagon
#

yeah replacing will turn into this

#

but the problem is that this gives an error

brittle horizon
#

That works

#

What's the stacktrace?

kindred wagon
brittle horizon
#

full line

kindred wagon
brittle horizon
#

h

#

What's like 46?

kindred wagon
brittle horizon
#

Fun

brittle horizon
#

The map would error a lot sooner than DataHolder does

#

I'll need the full stacktrace

kindred wagon
#

Oh also at 26

brittle horizon
#

My bets are on the Bukkit.getPlayer method being called before id is init

brittle horizon
kindred wagon
brittle horizon
#

fun it's pointing to an empty line

fast spoke
#

ah

brittle horizon
#

Yeah

#

Player player = Bukkit.getPlayer(id);

#

id is not initialized

fast spoke
#

yeah it's his Field of Player inj teh DataHander

brittle horizon
#

I'd refactor this code to not be leak prone

#

Why are we storing a player field in the first place

#
public Player getPlayer() {
  return Bukkit.getPlayer(this.id);
}
fast spoke
#

I'm middle of dinne, but I did say no tto store a player, get it when needed

brittle horizon
#

Store it as a local variable on every method when needed

#

Same for all your entities

fast spoke
#

You have the UUID so just get as required

brittle horizon
#

I'm gonna go on a lil walk and have dinner with my homie gtg

kindred wagon
#

bye have fun

#

If i'm understanding this right I should remove this and paste it in every method where needed Player player = Bukkit.getPlayer(id);

fast spoke
#

yes

#

in that class

kindred wagon
#

And same for entities so private Arrow flyingYakaArrow;

#

or idk

fast spoke
#

well, you can have a Player field, but you have to set it in the constructor

#

so the field would be Player player;Then in the constructorplayer = Bukkit.getPlayer(id);

kindred wagon
#

in the parameters of the constructor or inside?

fast spoke
#

under this.id =

kindred wagon
fast spoke
#

yes

kindred wagon
#

I can pass the interact event now but the flyingYakaArrow doesn't spawn properly

#

no errors

#

I can hear the dolphin sound so it gets till there i guess

kindred wagon
fast spoke
#

what do you mean?

#

the arrow is fine

kindred wagon
#

oh but it doesn't spawn when I rightclick

fast spoke
#

as you create it you can store a reference to it

#

does anything happen when you right click?

kindred wagon
#

yeah I hear the dolphin sound on line 63

#

I can add debugg messages inside the runnable to see till where the code runs

fast spoke
#

I have no idea what line 63 is, so

kindred wagon
#

on the left in the last screenshot

fast spoke
#

ah ok, the playSound

kindred wagon
#

I added debugg messages 1-6 imma test it now

fast spoke
#

I see why

kindred wagon
#

oh

fast spoke
#

um

#

why are you creating a runTask inside your TaskTimer?

kindred wagon
#

implement methods

fast spoke
#

no not the run method

#

line 66

#

a new runTask inside your run method

kindred wagon
#

oh

#

uh

fast spoke
#

delete 66 and 95

kindred wagon
#

Which lines in thsi screenshots as they moved aroudn a bit

fast spoke
#

line 70

kindred wagon
#

70 and 99?

fast spoke
#

yep

kindred wagon
#

i didn't even add a delay to that runtask so it was there for no reason

#

That unfortunately didn't solve it but I'll keep it removed as it serves no purpose

fast spoke
#

yep

#

if you hear the dolphin sound then the code is running

#

teh arrow itself gets spawned very close to teh player (initially)

#

10cm from their eyes

kindred wagon
#

I hear the dolphin sound but no arrow gets spanwed not even for a split second

fast spoke
#

its likely inside their head still

#

increase teh distance it spawns at

#

also add debug to ensure teh task is running

kindred wagon
#

the task is not running i checked with printlns

fast spoke
#

where did you add teh debug to check?

kindred wagon
#

under every if statement & inside run & inside new runnable

#

but I think I know what i messsed up

#

very stupid mistake by me/ rookie mistake same thing

#

i disabled everything in the wrong event

fast spoke
#

๐Ÿ™‚

kindred wagon
#

it works now

fast spoke
#

excellent

kindred wagon
#

but when it hits a target it doesn't go to the next yet

fast spoke
#

does it get destroyed?

kindred wagon
#

no

#

it keeps flying at the spot of the entity

#

And if I move the entity it follows it and glitches on its head

fast spoke
#

Check if this is returning by mistake

kindred wagon
#

I added all of these debug messages and none of them trigger

#

Also while the arrow is flying to the 1st target, if I click on the 2nd target redirects, instead of hitting the 1st target and then redirecting to the 2nd target like before

fast spoke
#

have you forgot to delete an arrow field in your Listener?

kindred wagon
#

this was my old quit method

#

and i call it here

fast spoke
#

what?

kindred wagon
#

and here

#

if thats what you mean

fast spoke
#

I didn;t ask about quit

#

show your listener class

kindred wagon
#

I only delete stuff in on quit, on hit yourself and on right click

#

oh i see something else that happens now

#

while the arrow is glitchin in the head of an entity

#

if I click on a new entity it goes towards it

#

but only once

fast spoke
#

only once?

kindred wagon
#

wait sometimes more

fast spoke
#

delete line 30 in your Listener Player player;

kindred wagon
#

i'm confused

#

maybe i don't clear targets right

kindred wagon
fast spoke
#

line 45 becomes Player player = event.getPlayer();

kindred wagon
#

alright no more errors

#

i got the same thing

fast spoke
#

ah line 85 has an error

kindred wagon
#

once its stuck in the head sometimes it can go to a new target sometimes not

fast spoke
#

players.values().forEach(holder -> holder.hitTarget(event.getEntity(), flyingYakaArrow));Should beplayers.values().forEach(holder -> holder.hitTarget(event.getHitEntity(), flyingYakaArrow));

#

I think

#

yes

#

its currently passing arrow and arrow

kindred wagon
#

a step further it doesn't glitch anymore

#

but it also doesn't return

#

and it goes through the targets in the opposite way

fast spoke
#

we can sort order after it works

#

does it handle multiple targets?

kindred wagon
#

yeah, if I click on 3 golems before it hits one, it will go to the last golem I clicked on then the 2nd to last then the 1st

#

its right just the exact opposite order, but it doesnt return yet

fast spoke
#

after the last one?

kindred wagon
#

yeah

#

after the last one it falls

fast spoke
#

no attempt at all to fly to the player?

kindred wagon
#

no

#

I'll send a video 1s

fast spoke
#

oh sec I see it

fast spoke
#

in startHoming

#

delete

kindred wagon
#

oh yeah xd

#

yess it returns now and everything after works fine

fast spoke
#

just the order now then?

#

in the DataHolder change from a HashSet to LinkedHashSet

#

that will preserve insertion order

kindred wagon
#

yeah, and then i'll change some small things I think are within my skill level

fast spoke
#

in DataHolder delete private Map<UUID, DataHolder> players = new HashMap<>();

#

should not be in there at all

kindred wagon
#

I also added this line as when it returns the arrow keeps flying behind me instead of deleting

fast spoke
#

yep

kindred wagon
#

and in the projectile hit event I will add an else under this that despawns everything and gives the arrow item back as that means it hit a block

fast spoke
#

yep

kindred wagon
#

Although there is no "event.getPlayer" as its an projectile hit event so I'm not sure how to get it

fast spoke
#

well call teh quit method in the Holder and give an arrow back

#

projectile.getShooter()

kindred wagon
#

but there is no shooter

fast spoke
#

if you set it when you spawned it

kindred wagon
#

as I don't use a bow

fast spoke
#

set teh shooter when you spawn it

kindred wagon
#

alright

#

when I spawn it or when I start homing towards a target?

fast spoke
#

when you spawn

kindred wagon
fast spoke
#

yep

kindred wagon
#

for the first part I need to use ProjectileSource and the 2nd part I need to use Player to send a message so idk

fast spoke
#

if (shooter instanceof Player player)

kindred wagon
#

Thanks got it

#

Almost everything works like before and I think this will work with multiple players. I think I'll be able to figure out the rest until its exactly how I like it, thank you so much. I don't know how I can thank you enough for spending all these hours helping a stranger but I am super grateful โค๏ธ

fast spoke
#

np it was fun ๐Ÿ™‚