#Convert int array into uuid

24 messages · Page 1 of 1 (latest)

storm gate
#

Just the title. I have an int array type and I want to convert into an uuid

lunar topazBOT
#

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

oblique cedar
#

Lookup for NbtUtils or putUUID here in the discord

#

there are some examples I created in the past days

storm gate
#

actually I got the UUID from a compound tag

oblique cedar
#

u probably want the NbtUtils solution

storm gate
#

let me look for the NbtUtils

oblique cedar
storm gate
#

I tried getUUID("entity") and it didnt work

oblique cedar
#

then it wasn't in uuid format or the key did not exist

storm gate
#

let me see what the error was

drowsy rapidsBOT
#

Paste version of message.txt from @storm gate

storm gate
#

and the code

#
BlockEvents.rightClicked("kubejs:pedestal", e => {
    if (e.hand == "off_hand") return;
    /**
     * @type {{"item": string, "entity": Internal.UUID}}
     */
    let data = e.block.entityData["data"];
    let oldItem = data["item"];
    data["item"] = e.item.id;
    if (data["entity"] != "") getEntityByID(e.block.entityData.getUUID("entity")).kill();
    let entity = e.block.createEntity("block_display").mergeNbt({ block_state: { Name: e.item.id } });
    e.block.entityData.getCompound("data").putUUID("entity", entity.uuid)
    console.log(e.block.entityData)
    entity.spawn();
    e.player.getHeldItem("main_hand").count -= 1;
    e.player.addItem({ count: 1, item: oldItem });
    e.cancel();
})
oblique cedar
#

e.block.entityData.getUUID("entity") would mean nbt.entity, from the log you data looks like nbt.data.entity

if(data.entity) {
  getEntityByID(data.getUUID("entity")).kill()
}
#

you probably also want to null check before you call kill incase the entity does not exist

storm gate
#

ok thx

#

although it probably will exist

#

if (data["entity"] != "")

#

this check was a little different

#

it checked if it was null

#

i thought it was the problem, so I removed

#

thx for the help