#Is it possible entityjs can compat with another mod tag?

224 messages · Page 1 of 1 (latest)

cosmic lodge
#

Yeah i have problem i use entityjs to make a fish from unusualfish spawn only in enhanced celestia blue moon by using the tag it possible to run and work

my script

EntityJSEvents.spawnPlacement(event => {
event.and('unusualfishmod:ripper', (entitypredicate, levelaccessor, spawntype, blockpos, randomsource) => {
return levelaccessor.level.dimension.getTags().contains('#enhancedcelestials:blue_moon');
});
});

final sedgeBOT
#

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

cyan pivot
#

remove the #

#

and try it that way

cosmic lodge
#

okay thank you!

#

it doest work

#

😭

cyan pivot
#

in that case.. @rough silo

cosmic lodge
cosmic lodge
rough silo
#

do they already spawn there or are you trying to add spawns there?

cyan pivot
cosmic lodge
#

yeah they already spawn in overworld

cosmic lodge
rough silo
#

ah

#

well dimension is a string so theres no getTags after it

#
EntityJSEvents.spawnPlacement(event => {
    event.and('unusualfishmod:ripper', (entitypredicate, levelaccessor, spawntype, blockpos, randomsource) => {
        return levelaccessor.level.dimension == "enhancedcelestials:blue_moon"
    });
});``` put whatever the dimension name is there
rough silo
#

happens heh

rough silo
cosmic lodge
#

it mean they dont known how to spawn?

rough silo
#

it looks like the ripper doesnt have a spawnplacement registered

#

so i would create one

cosmic lodge
#

Oh

#

Sound good

#

i pray for you my lio you are my Hero🙏🏾

cosmic lodge
rough silo
#
EntityJSEvents.spawnPlacement(event => {
    event.replace('unusualfishmod:ripper',"in_water","motion_blocking_no_leaves",(entitypredicate, levelaccessor, spawntype, blockpos, randomsource) => {
        return levelaccessor.level.dimension == "enhancedcelestials:blue_moon"
    });
});```
cosmic lodge
rough silo
#

wait is the blue moon a dimension of a moon phase?

#

cause those are 2 separate things

cosmic lodge
#

what it mean

rough silo
#

it means you cant get it like that

#

try this js EntityJSEvents.spawnPlacement(event => { event.replace('unusualfishmod:ripper',"in_water","motion_blocking_no_leaves",(entitypredicate, levelaccessor, spawntype, blockpos, randomsource) => { const event_string = levelaccessor.level.getLunarContext().getLunarForecast().getCurrentEventRaw().key().location().toString() return event_string == "enhancedcelestials:blue_moon" }) })

#

actually wait

#

there now try

cosmic lodge
#

ok i will try my hero

cosmic lodge
#

Like this

#

the shark looking one is ripper

#

i hate so much

rough silo
#

ok inside of an item right clicked event console log event_string and see what it is returning

#

so you dont have to keep restarting your game to troubleshoot

#

thats what i'd do

weak starBOT
#

This is a list of all the events. Choose your version.

rough silo
#

what you're looking for is the right clicked event ```js
ItemEvents.rightClicked(event => {

})```

cosmic lodge
#

thx!

#

this hard

#

so how do we do next

rough silo
#

you can console log stuff with console.log()

#

so console.log(event_string)

cosmic lodge
#

OK!

rough silo
#

also dont forget to replace levelaccessor.level with event.level and the script is in server scripts ect

cosmic lodge
#

so you want console.log?

rough silo
#

yes

#

what does it say

cosmic lodge
#

where are those😭

weak starBOT
#

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or 1.16 it will be called server.txt.
Please send it if asked, as it contains helpful information.

cosmic lodge
#

AH i see

#

Ohs its not

#

It dont have anything..

#

(I just give up now😭)

rough silo
#

thats not server logs..

rough silo
#

it shows you the file path

cosmic lodge
#

WAIT.

#

Sorry my bad

#

Ok i dont give up now

rough silo
#

lol

cosmic lodge
weak starBOT
#

Paste version of server.log, startup.log, client.log from @cosmic lodge

cosmic lodge
#

I get it now angerysad

rough silo
#

also you have this error thats spamming your logs [22:22:31] [ERROR] ! recipe.js#51: Error in 'EntityEvents.spawned': TypeError: Cannot find function is in object minecraft:rabbit.

#

this is unrelated but you should probably also take care of it heh

cosmic lodge
#

oh i use badmobs ban that rabbit

#

wait its not.

rough silo
#

yeah but the event is erroring so its probably not banned

cosmic lodge
#

so how we gonna fix that

rough silo
#

you're gonna open up a separate ticket about the unrelated issue heh not here

#

for now you just need to right click an item and see what that one string says

cosmic lodge
#

it doesnt say anything..

rough silo
#

send code

cosmic lodge
#

okie

rough silo
#

the right click

cosmic lodge
#

ItemEvents.rightClicked(event => {
console.log("Event triggered on item right-click");

const player = event.player;
console.log("Player Name: " + player.name);

const item = event.item;
console.log("Item Name: " + item.id);

const entity = event.entity;
if (entity) {
    console.log("Entity Name: " + entity.name);
} else {
    console.log("No entity was clicked");
}

});

weak starBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:
Note that these are backticks, not apostrophes

```js :arrow_left:

ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

``` :arrow_left:

This example will look like this:

ServerEvents.recipes(event => {
  event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
rough silo
#

not your name n stuff lol

rough silo
cosmic lodge
#

me rigth now

rough silo
#

ok hold on

#
ItemEvents.rightClicked(event => {
    const event_string = event.level.getLunarContext().getLunarForecast().getCurrentEventRaw().key().location().toString()
    console.log(event_string)
    event.player.tell(event_string)
});```this
cosmic lodge
#

OHH

#

Thank you

weak starBOT
#

Paste version of server.log from @cosmic lodge

rough silo
#

you didnt even right click

cosmic lodge
#

i spawm it like 100 times

rough silo
#

huh

#

this is a right click event though,

cosmic lodge
#

what happen...

rough silo
#

wym

cosmic lodge
#

i just rigth click rigth?

rough silo
#

we're trying to see what the string is logged as when you right click

cosmic lodge
#

wait i will seperated some mods

rough silo
#

no i mean

rough silo
#

right click and send me your logs

#

any item

cosmic lodge
#

oh okie

weak starBOT
#

Paste version of server.log from @cosmic lodge

rough silo
#

you copied the wrong version

#

change levelaccessor.level to event.level and try again

cosmic lodge
rough silo
#

in the item right click

cosmic lodge
#

oh ok

cyan pivot
cosmic lodge
#

it said enhancedcelestia:default

weak starBOT
#

Paste version of server.log from @cosmic lodge

rough silo
cosmic lodge
#

OKie

rough silo
cosmic lodge
#

but it spawn without a event turn on

#

yeah it say enhancedcelestia:blue_moon

rough silo
#

alright and did you restart your game to make the spawnplacement event reload?

#

all startup events require a full game restart

cosmic lodge
#

WAIT

#

☠️

#

i didnt

rough silo
#

and if they keep spawning after that i have another solution

#

alright do that

cosmic lodge
#

yeah it just keep spawn

#

😭

#

Hold Up

#

Wait wait

rough silo
#

this is the other option js EntityEvents.checkSpawn('unusualfishmod:ripper', event => { let { level } = event let event_string = level.getLunarContext().getLunarForecast().getCurrentEventRaw().key().location().toString() if (event_string == "enhancedcelestials:blue_moon") { event.success(false) } })

cosmic lodge
#

kna it dont work

#

ok i will try

rough silo
#

but make sure your other server events arent erroring because if it errors then itll stop running the events afterwards

cosmic lodge
#

okie

#

kna its keep spawning

#

😭

cyan pivot
#

what is "kna" hmmm

cosmic lodge
#

its like nah

rough silo
#

lol

rough silo
#

cause you have errors that are probably stopping it from working

cosmic lodge
#

what is that

cyan pivot
#

what happens when you try this

EntityEvents.checkSpawn('unusualfishmod:ripper', e => {
    let event_string = e.level.lunarContext.lunarForecast.currentEventRaw.key().location().toString()
    e.server.tell(event_string)
    if (event_string == 'enhancedcelestials:blue_moon')
        e.success(false)
})
cosmic lodge
#

i will try

cyan pivot
#

you can reload it instantly with /kubejs reload server_scripts

rough silo
#

^

cosmic lodge
#

good news they dont spawn!
bad news event to😭

rough silo
#

huh

cosmic lodge
#

they dont spawn both

#

😭

#

like normal and bluemoon event

#

ok it spawn

#

btw i will go sleep

#

see you tmr

rough silo
#

alright

cosmic lodge
#

i love you all

#

oh one thing

cyan pivot
cosmic lodge
rough silo
#

probably because you have other errors in your scripts

#

though i asked if you could send your recipes.js

cosmic lodge
#

oh ofc

#

wait wrong one

weak starBOT
#

Paste version of recipe.js from @cosmic lodge

cosmic lodge
#

this is my first script it experiment script

#

like follow doc and youtube tips

rough silo
#

the erroring line is this js if (entity.type.is("minecraft:wither_skeleton")) {

#

should be entity.type == "minecraft:wither_skeleton"

cosmic lodge
#

oh

#

sorry my auto keyboard get me again

#

wait why if this error the aother script will not working?

rough silo
#

oh i thought it was in there somewhere

#

is it the only event in its own script?

#

if so then send logs again

cosmic lodge
#

yeass

rough silo
#

send logs when you're trying to spawn it

cosmic lodge
rough silo
#

try spawning the entity and then send logs here

cosmic lodge
#

okie

#

this time i will try least mod

weak starBOT
#

Paste version of server.log from @cosmic lodge

rough silo
#

i see

#

change this == to !=

#

in the if statement

#

that ones on me

#
if (event_string != 'enhancedcelestials:blue_moon')```
cosmic lodge
#

Yo,s

#

Why? It a syntax?

rough silo
#

nah, == means "does this equal", != means "does this not equal"

#

you want it to only cancel the spawn if they arent in the specific moon phase, right now its opposite

cosmic lodge
#

Cool idea!

#

Liopyu brains at this moment

rough silo
#

lol

cyan pivot
#

lio is the smorterest

cosmic lodge
#

EVERYBODY

#

IT WORK PERRFECTLY!

#

Thx all of you i will give credit to my modpack

rough silo
#

epic

cosmic lodge
#

finally

#

i can rest

#

love you guys all! 🥹