#Editing NBT giving weird errors about missing brackets
68 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
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
The issue is, that there's no b postfix on numbers in JavaScript
In place of 1b, use NBT.byte(1)
Ah, that's not something I was expecting
it doesn't seem to like that
just try Count: 1 instead of Count: 1b, if that doesnt work then just do js event.entity.setMainHandItem("minecraft:bow")
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
makes sense, i just saw it when editing the nbt and didn't think
for reference Count: 1 works
forsure, wherever there is a minecraft method to handle that stuff you will want to use it
i did not think this would be as curse as it is
is there a good place to look for methods?
do you have probejs
no, i'll get that
you should, it shows all methods off an object
that is what i need
there is also a site for docs here
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.
a more manual lookup but is very useful for looking up to see if a class or method exists
that is perfect for when on mobile!
any clue why this doesn't seem to change the zombie.spawn_reinforcements attribute?
Doesn’t the second argument need to be a UUID
what editor are you using?
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
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
It says Minecraft:zombie.spawn_reinforvements in the nbt of the mob
Because only zombies have that attribute
It was just note pad. I am going to install vscode. I used it before but I had to switch from windows 10 to Linux and haven't reinstalled it yet
oh 
weird, should be generic.spawn_reinforcements i think, lemme check source code, maybe im wrong here
ah yeah im just wrong, fair enough
second arguement doesnt need to be a uuid as it will accept any identifier
at the same time the min/max is 0/1 so adding 0.5 should significantly increase the chances 
what is the other context of the code? seeing one line doesnt give us much to go off of here 
also
Never say 'it crashed', 'it errored', or 'it didn't work' without providing the full scripts and log/crash report!
mainly im looking for the server log
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.
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
that is not the script, it does not contain anything regarding modifyAttribute, i am asking for you to send what you currently have
its ok, we will have to pick it up tomorrow then, nbd
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)
ModifyAttribute on line 26
I don't fully follow what you mean, i was looking at the final value. It was always in the 0.0X range when adding should have made it in the 0.X range
Maybe I was looking at the wrong place
thats what i was asking, where are you seeing this value?
just try this though
sorry for the delay
Paste version of archer_zombie_server.js from @lean bolt
Paste version of archer_zombie.js from @lean bolt
doing this worked!
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