#Can't find method of loaded class UUIDUtils

72 messages · Page 1 of 1 (latest)

sterile pilot
#

my script

const $UUIDUtil = Java.loadClass("net.minecraft.core.UUIDUtil")

ItemEvents.rightClicked('stick', e => {
    const {player, item, hand, server, level } = e

    if(hand == 'OFF_HAND')return
    if(!player.persistentData.test){
        const display = level.createEntity('item_display')

        player.persistentData.test = $UUIDUtil.uuidFromIntArray(display.nbt.UUID)
        console.log(player.persistentData.test)

        let dNBT = display.nbt
        dNBT.merge({item:{id:Item.of('andesite_stairs').id, Count:NBT.b(1)}, billboard:'vertical', Pos:[player.x, player.y + 1, player.z]})
        //console.printObject(dNBT)
        display.setNbt(dNBT)
        //console.printObject(display.nbt)
        display.spawn()
        

    }else{
        server.tell(player.persistentData.test)
    }  
})

Using this also gives similar error

const UUID = Java.loadClass('java.util.UUID');
let randomUUID = () => UUID.randomUUID();
scenic crowBOT
#

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

sterile pilot
#

Why can't acess this methods, is some config?

solar blazeBOT
#

Paste version of server.log from @sterile pilot

crystal violet
#

what do you want to do with those UUIDs?

link a player with a display item?

sterile pilot
#

so i need an way to get the UUID of entity, save than use in the hex value form, not the int array

crystal violet
#

So, linking a display item to a player? 🤣

#

You are saving a display item uuid into persistent data of a player

#

each player can have only 1 display item linked to?

sterile pilot
sterile pilot
crystal violet
#

are you doing pedestals?

sterile pilot
crystal violet
#

ai krai kkkk

sterile pilot
#

i have horrible script for pedestals and tring to refactor

sterile pilot
#

i tried changing the nbt of item play before, but the ingame visual didn't change, even though nbt did

#

anyways, @crystal violet why can't i call the loaded class? what i'm doing wrong this time in this pleasant evening?

crystal violet
#

the UUID class? don't know try changing the variable to $UUID

#

i think UUID conflicts

#

with some used by KubeJS

sterile pilot
#

Can't find method net.minecraft.core.UUIDUtil.m_235885_(net.minecraft.nbt.IntArrayTag)

crystal violet
#

aren't you talking about util.UUID? the random

#

oh

#

need to check linkie on that but I think it is down

sterile pilot
crystal violet
#

press F

#

you need to pass real int[]

#

not intarraytag from NBT stuff

#

@sterile pilot use display.nbt.UUID.asIntArray

sterile pilot
#
player.persistentData.test = $UUIDUtil.uuidFromIntArray(display.nbt.UUID.asIntArray)
crystal violet
#

taht error is from a console.log of a null

#

are you trying to console.log something?

sterile pilot
#
console.log(display.serializeNBT().getUUID('UUID'))
        player.persistentData.test = $UUIDUtil.uuidFromIntArray(display.nbt.UUID)
        console.log(player.persistentData.test)
crystal violet
#

some of those are null, use
console.log(something ?? undefined)

sterile pilot
#

wow, using command kubejs persistantdata get gives an error

crystal violet
#

don't use = for nbt stuff, it is not accurate, use the nbt methods

sterile pilot
#

to save in the persistentData?

crystal violet
#

player.persistentData.putUUID("test", display.uuid)
you don't need any UUID manipulation on this one

#

console.log(player.persistentData.test)

#

you might see the int arrays

sterile pilot
#

but can i use the int array in the getEntity method?

#

or would i need to convert to string

crystal violet
#

show code

#

you might need: $UUIDUtil.uuidFromIntArray(player.persistentData.test.asIntArray)

sterile pilot
#
if(hand == 'OFF_HAND')return
    if(!player.persistentData.test){
        const display = level.createEntity('item_display')

        console.log(display.serializeNBT().getUUID('UUID'))
        player.persistentData.putUUID('test', display.uuid)
   
      
        let dNBT = display.nbt
        dNBT.merge({item:{id:Item.of('andesite_stairs').id, Count:NBT.b(1)}, billboard:'vertical', Pos:[player.x, player.y + 1, player.z]})
        //console.printObject(dNBT)
        display.setNbt(dNBT)
        //console.printObject(display.nbt)
        display.spawn()
        

    }else{
        server.tell(player.persistentData.test)
        console.printObject(server.getEntities().get($UUIDUtil.uuidFromIntArray(player.persistentData.test.asIntArray)).entityData)
    }  ```
#

Error in 'ItemEvents.rightClicked': Cannot convert 20ec4f7d-c231-4acb-b4d3-dfbda40c2f9d to java.lang.Integer

crystal violet
#

what ingame message did you receive? if any

#

looks like using .test directly might be converting the uuid
try persistentData.get("test")

sterile pilot
crystal violet
#

hmm wait I think that get()

#

bro 😐

#

you are not using getEntity

#

you are using get from an array/collection and it is expecting an Index

#

hence why it needs an Integer

sterile pilot
#

okay lol

crystal violet
sterile pilot
#

console.printObject(level.getEntity(player.persistentData.get('test')).entityData)

crystal violet
#

noo

#

kek

sterile pilot
#

i'm using getEntity now

crystal violet
#

level.getEntity($UUIDUtil.uuidFromIntArray(player.persistentData.test.asIntArray)).entityData

sterile pilot
#

i can finally Start testing...pepelaugh

#

@crystal violet as always, thanks