#Editing NBT giving weird errors about missing brackets

68 messages · Page 1 of 1 (latest)

lean bolt
#

@vocal patrol , I think this error message is a bug as there are no missing brackets that i can see. To be honest there is probably a better way to give a zombie a bow

sacred trenchBOT
#

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

lean bolt
#

nbt on a normal zombie with an item for reference

#
event.entity.mergeNbt({ HandItems:[{id:"minecraft:bow", Count: 1b, tag: {Damage: 0}},{}] })```
#

if i don't have the , Count: 1b, tag: {Damage: 0} bit it doesn't error but it also just doesn't give them the item

#

I have a line after that gives them strong potion effects that shows that it did successfully run

gloomy oracle
#

The issue is, that there's no b postfix on numbers in JavaScript

#

In place of 1b, use NBT.byte(1)

lean bolt
#

Ah, that's not something I was expecting

lean bolt
gloomy oracle
#

NBT.byteTag(1)

#

I'm sorry

vocal patrol
#

you shouldnt be doing mergeNbt for equipping items anyways as that will access the nbt of the entity through Rhino instead of using the built in java methods to parse the nbt map for you

lean bolt
#

for reference Count: 1 works

vocal patrol
#

forsure, wherever there is a minecraft method to handle that stuff you will want to use it

lean bolt
#

i did not think this would be as curse as it is

#

is there a good place to look for methods?

vocal patrol
#

do you have probejs

lean bolt
#

no, i'll get that

vocal patrol
#

you should, it shows all methods off an object

lean bolt
#

that is what i need

vocal patrol
#

there is also a site for docs here

boreal daggerBOT
#

You can find online JavaDocs for Forge/NeoForge and Fabric by clicking the button.
If you want to see classes added by Minecraft, choose Forge/NeoForge.

If the page doesn't load, click the "Status" button or ping @hazy granite.

vocal patrol
#

a more manual lookup but is very useful for looking up to see if a class or method exists

lean bolt
#

any clue why this doesn't seem to change the zombie.spawn_reinforcements attribute?

left osprey
#

Doesn’t the second argument need to be a UUID

lean bolt
#

didn't seem to work either

#

though there is probably another format i should be using

vocal patrol
#

highly recommend using visual studio code as its the best for kubejs and javascript

#

and you're able to get probejs typings only if you have vsc

vocal patrol
# lean bolt didn't seem to work either

also it isnt "minecraft:zombie.spawn_reinforcements" it's the actual attribute name. "minecraft:generic.spawn_reinforcements" the attribute id does not contain the entity name

lean bolt
#

It says Minecraft:zombie.spawn_reinforvements in the nbt of the mob

#

Because only zombies have that attribute

lean bolt
vocal patrol
#

weird, should be generic.spawn_reinforcements i think, lemme check source code, maybe im wrong here

#

ah yeah im just wrong, fair enough

vocal patrol
#

at the same time the min/max is 0/1 so adding 0.5 should significantly increase the chances pepethink

#

what is the other context of the code? seeing one line doesnt give us much to go off of here hmmm

#

also

boreal daggerBOT
#

Never say 'it crashed', 'it errored', or 'it didn't work' without providing the full scripts and log/crash report!

vocal patrol
#

mainly im looking for the server log

boreal daggerBOT
#

Please send your KubeJS server log. It can be found at /minecraft/logs/kubejs/server.log.
If you are on 1.18 or 1.16 it will be called server.txt.
Please send the file directly, without links or snippets.

lean bolt
#

There's nothing in the logs, no errors or crashes. Just failure. And sorry I shut down my pc as I have to get up in 7 hours. But the script is the same as this one but with a different attribute

#

Could the vanilla game be adjusting the value and updating it based on local difficulty

vocal patrol
#

that is not the script, it does not contain anything regarding modifyAttribute, i am asking for you to send what you currently have

vocal patrol
#

also how do you know it doesnt work? the nbt of the entity does not reflect the changes in the modifyAttribute method because it adds a separate attribute modifier, unless you modify the exact attribute instance of the entity

#

if you want to modify the base attribute then you should instead do this js entity.getAttribute("minecraft:zombie.spawn_reinforcements").setBaseValue(1)

lean bolt
#

Maybe I was looking at the wrong place

vocal patrol
#

thats what i was asking, where are you seeing this value?

lean bolt
boreal daggerBOT
#

Paste version of archer_zombie_server.js from @lean bolt

lean bolt
boreal daggerBOT
#

Paste version of archer_zombie.js from @lean bolt

lean bolt
#

i'll try editing the base

lean bolt
#

I'm going to close this ticket as all the nbt stuff is working now. I'm going to try adding skeleton projectile attack goals to the zombie which will probably become a new ticket