#.displayName(' ') doesn't work for blocks made with geckojs

67 messages · Page 1 of 1 (latest)

ripe hamlet
#

I'm trying to figure out how to name a block thats animated and made with geckojs, and addon for kubejs that allows use with geckolib, but even though i see no errors in the logs, the .displayName('') doesnt work to name it for some reason. My best bet is as im looking through the source code, it might be renaming it with the .defaultGeoModel(), or creating a separate item for the block that i can't rename, but I'm not sure as I don't particularly know how to read the source code well. I also don't know how i'd figure out a way around it if there is any. On a side note, I also tried to figure out how rotating blocks would work (like a furnace, facing only north, south, east, or west), but couldn't fully tell how off looking at the wiki and some of the support threads.

    event.create('blacklightbulb')
    .displayName('Black Light Bulb')
    .glassSoundType()
    .lightLevel(1)
    .unbreakable()
    .defaultTranslucent()
    .box(5, 3, 5, 11, 16, 11)
    .blockEntity((c =>{
        c.serverTick(20, 0, (blockEntity) => {
            if (global.tickingFunction) {
              global.tickingFunction(blockEntity)
            }
          })
    }))

    event.create('lightbulbwire')
    .displayName('Black Light Bulb Wire')
    .soundType('wool')
    .unbreakable()
    .defaultTranslucent()
    .box(7, 0, 7, 9, 16, 9)

    event.create('geckojs:letter_a', 'animatable')
    .displayName('A Key')
    .glassSoundType()
    .hardness(50)
    .resistance(1200)
    .tagBlock('minecraft:mineable/pickaxe')
    .tagBlock('minecraft:needs_diamond_tool')
    .requiresTool(true)
    .lightLevel(0.5)
    .box(6, 0, 1, 12, 16, 15, true)
    .animatableBlockEntity(info => {
        info.addAnimation(state => state.setAndContinue(RawAnimation.begin().thenLoop("animation.model.letterfloat")))
    })
    .defaultGeoModel()
})```
This is what I have in startup_scripts. I used to have Keys A-Z, but after finding issues with all of them not being named properly, I decided to only have A for now to figure out how to do it properly before. a weird thing though is that is automatically named it "Letter a", but all the other ones were "Letter B" through z, with the last letter being capital. may not be relevant though
Either way, any input on how I may get it named properly, that would be of great help to me as I've been trying for around 5 hours with no results. Thank you for your time :)
brisk quailBOT
#

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

ripe hamlet
#

if you need any further info from me, feel free to ask and ill provide where i can

ripe hamlet
#

I'm still interested in help, in case this is an auto close after inactivity

ripe hamlet
#

:(

ripe hamlet
#

ok i figured out directional facing stuff

#

via adding .property(BlockProperties.FACING)
and .placementState(state => { state.setValue(BlockProperties.FACING, state.horizontalDirection) })

#

but the custom boundaries dont work

#

and the name, the main reason for this post

#

still aint working

ripe hamlet
#

gave up on the boundaries

#

but yeah, just need input on how to circumvent the name thing

modest star
#

my best guess would be to use a lang, this would go in your client_scripts

ClientEvents.lang('en_us', event => {
    event.add('spell.kubejs.cosmic_cortex', 'Cosmic Cortex')
})
#

replace spell.kubejs.cosmic_cortex with whatever display name your item currently has

#

and then you can name it in the second part, atleast I assume this should work

ripe hamlet
#

ok

#

is there anyway to make this universal across all language?

#

this pack, while its mainly gonna be played by english speakers, i know someone plays in french, and wouldnt be surprised if other languages pop up

#

ill likely attempt translation of the languages i know will be used, but its an english speaking server so having it universal isnt as bad for a baseline, then translating when need be

knotty bay
#

If a translation entry is missing minecraft will fallback to en_us

ripe hamlet
#

cool thank you very much

modest star
#

You can also specify languages by doing the appropriate language phrase if you do want to make the items translate to other languages

#

But yes it will automatically use that translation for all language if no others are present

ripe hamlet
#

ok

#

i finally got available for testing this

#

and it doesnt work

#

but i think its because im not using the right name

#

how would i check the proper display name of an object

modest star
#

Go in game and check what it currently says

#

And use the exact display name in game

ripe hamlet
#

sorry for the late reply, i had an event and didnt see this message

#

but i believe i did

#

it wasnt anything like something.something.whatsitcalled

#

it was named "Letter a"

#

that display name

#

but i want it to be "A Key"

modest star
#

Ohhh, that's based off of the item ID directly, since the item ID is geckojs:letter_a the display name is Letter a, simply changing the item ID will fix that

#

Make the item ID geckojs:a_key and it should have a capital A as well as Key

#

And make sure to adjust all other scripts or resources that reference the item ID aswell

ripe hamlet
#

wait, why does the captital not happen to a

#

oh wait

#

is it because it thinks its a continutation?

modest star
#

Most items/blocks when registered should auto fill their display name based off of the item ID, and also follow standard English format for capitalization

ripe hamlet
#

ok

modest star
#

Words like a and the and of will never be capital in an item name

ripe hamlet
#

thank you, that honestly probably is the easiest solution

#

there is one problem though

#

i will have to figure out a system for renaming

#

as eventually i want a name that has some strange characters

#

not sure if they are ascii or unicode

#

▗ ▘ ▬ ▝ ▜ ▌ ▚ ▖ ▛ ▔ ◤ ▃ ◢ ▟ ▙ ▰ ▇ ▞ ▀ ▐ ◣ ▏ ◥ ▲ ▄ ▼

#

these

modest star
#

You could also try checking the gecko mod github to see if they have a specific way of giving things display names

ripe hamlet
#

i tried that but i couldnt figure it out unfortunately

#

they have 0 documentation

#

and i tried to view the source code to get a better idea of whats happening, but couldnt figure out anything unfortunately

modest star
#

Dknow if anything useful here, but it's their github, my only other suggestion would be using StartupEvents.modification and trying it that way

#

Actually nevermind you can't modify display name in that, I'm unsure

knotty bay
#

Unlocalized names all follow a very predictable format, so it would block.geckojs.letter_a
the lang event has renameItem(item, name) and renameBlock(block, name) you can use instead

ripe hamlet
#

so instead of

    event.add('block.geckojs.letter_a', 'A Key')
})```
(i guessed the block.geckojs.letter_a, but i didnt know if that was right and proceeded to do several different guesses)
it would be
```ClientEvents.lang('en_us', event => {
    event.renameBlock('block.geckojs.letter_a', 'A Key')
})```
knotty bay
#

The first one should work, for the second you would just the resource location

#

so, event.renameBlock('geckojs:letter_a', 'A Key')

ripe hamlet
#

Alright, the method works!

#

thank you very much

#

and thank you panam as well for helping

#

i shall now close this, have a wonderful day or night depending on wherever you are