#Custom movement logic appearing to not work how it should

68 messages · Page 1 of 1 (latest)

sudden cypress
#

StartupEvents.registry('entity_type', event => {
```js
event.create('moltenball', 'entityjs:projectile')
/**
* One-Off values set at the startup of the game.
*/
.clientTrackingRange(128)
.isAttackable(true)
.mobCategory('misc')
.item(item => {
item.canThrow(true)
})
.sized(1, 1)
.renderOffset(0, 0, 0)
.renderScale(1, 1, 1)
.updateInterval(1)

    .move(context => {
        const { entity } = context;
        // Custom movement logic, for example, applying velocity to the arrow
       entity.setDeltaMovement(1.1, 1.2, 0.1);
    })
})```

Looks to move the same as if the .move segment was never there at all.
Goal: To have it move differently from how it should.

@granite fiber assuming its alr to ping you for this?

frosty plankBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

granite fiber
#

theres a velocity option in the item builder

sudden cypress
loud vaporBOT
#

Paste version of mclo.gs/O7GFuyX from @shell blaze

sudden cypress
#

i've not got probejs working as it should due to my os, what's the parameters?

granite fiber
#
 item.projectileVelocity(5)```
loud vaporBOT
granite fiber
#

this will be fixed in 1.21 when i get around to it since kubejs provides a vital function to fix probejs typings in abstract events but in 1.20.1 you'll have to do this for now

granite fiber
sudden cypress
#

i'll test projectile velocity now; is there something wrong with .move and setdeltamovement? as it's in the entityjs wiki

#

and for another projectile, i'll need it to slowly float upwards, so just setting how fast it shoots wouldn't be a great solution

granite fiber
#

it looks like its firing super move so it should be executing your code afterwards, also i found that addDeltaMovement/setDeltaMovement only work on clientside so you might want to log entity.level and see what it outputs

sudden cypress
#

i'll run with console.log(entity.level) appended then

granite fiber
#

also try addMotion

#

instead

#

thats my go-to instead of deltamovement personally since ive had issues with setDeltaMovement not working

#

also i assume move function is called on tick so if thats not working then i'd just try .tick instead if you dont need the MoverFunction param

sudden cypress
#

addmotion doesn't look to be doing anything, and it's not logging

granite fiber
#

also use a global function please

sudden cypress
#

for testing purposes or just for cleaner code?

granite fiber
#

no i mean

#

so you dont have to restart your game every time you change something to test

#

its up to you but its a godsend for saving time

#

and sanity

#

we went over this before hmmm

sudden cypress
#

yeah i really should

#

OH

#

add motion works though!!

#

ohh htank god.. dopamine save me

granite fiber
#

nice

sudden cypress
#

for context this is what im making lol

#

okay uhh

#

im like, 90% sure there will be another issue later

#

as i was tinkering with this last night

granite fiber
#

nice

sudden cypress
#

is it fine if i leave thread open for that purpose

granite fiber
#

sure

sudden cypress
#

thanks goat

sudden cypress
granite fiber
#

oh

sudden cypress
#

even if its just with blocks

granite fiber
#

uh yeah lemme see

#

do you mean for it to dissappear when colliding you mean?

#

or to stop

sudden cypress
#

to stop, or to like..

granite fiber
#

like rest on the ground?

sudden cypress
#

rest on the ground yeah

granite fiber
sudden cypress
#

ideally it wouldn't stick into the ground, but sort of; it would still move as it's regular projectile self, just it wouldn't go through blocks

granite fiber
#

i see

granite fiber
#

yeah this is requiring a lot of custom logic tbh

#

i can do it but it might take a bit

sacred hornet
#

woah what, that's rly cool

granite fiber
loud vaporBOT
#

Paste version of wyrm.js from @granite fiber

sudden cypress
#

sorry for late reply

#

thats AWESOME

granite fiber
#

lemme know if you have issues with it

granite fiber
# sudden cypress thats AWESOME

also something to note, if you dont plan on using a geckolib projectile then just remove the scalemodelforrender logic as it's not a thing in a 2d non geckolib projectile