#Item textures like thermal coins

71 messages · Page 1 of 1 (latest)

harsh parcel
#

@dusky sonnet I am pinging you because you told me how to do this in the first place, I have made the model files and put the code into the startup script. I added my whole kubejs folder, because I have no clue why it doesn't work. The item I wanted to add like this is the research_point item.

grand citrusBOT
#

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

dusky sonnet
#

the count predicate is not default minecraft, it's registered by coth

#

in the original thread there was a fix posted, let me find that

harsh parcel
#

I have it here ``` StartupEvents.postInit(event => {
if (!Platform.isClientEnvironment) return;
const $ItemProperties = Java.loadClass('net.minecraft.client.renderer.item.ItemProperties')

$ItemProperties.register(Item.of('kubejs:research_point'), new ResourceLocation('count'), (stack, world, living, seed) => {
    return stack.getCount() / stack.getMaxStackSize()
})

})```

dusky sonnet
#

oh

harsh parcel
#

It is in the block_items creation script at the bottom

dusky sonnet
#

try to move it so that it's the first event in the file

harsh parcel
#

I will try it. It can take some time, it is a rather big modpack

harsh parcel
dusky sonnet
#

I think I see the issue

harsh parcel
#

What is it?

dusky sonnet
#

you're making the items use the model as the their texture

#

and also in the first item it's invalid

#

also, you should move them into the item folder so that it's the default

#

(now they're in .../kubejs/models/, whereas they should be in .../kubejs/models/item/)

harsh parcel
#

So I have to move them and that fixes it?

dusky sonnet
#

and remove that weird .texture(...)

#

it should fix itself

harsh parcel
#

But I need the .texture because the item id is not the same as the models name because I want to make 5 diffrent ones

dusky sonnet
#

you can't set the items model using texture

#

they are two different things

harsh parcel
#

Can I do .model() then?

dusky sonnet
#

no

#

you can do .modelJson(json)

harsh parcel
#

Ok and the json is replaced by the name of the model or the stuff that I put in the model json file?

dusky sonnet
#

2

harsh parcel
#

This will be a mess....

dusky sonnet
#

or just create more models in the models folder heh

#

both will work

harsh parcel
#

I will put it in its own js file

harsh parcel
dusky sonnet
#

no

harsh parcel
dusky sonnet
harsh parcel
#

Bruh

deep hound
#

Is the resource location for the item actually kubejs:research_point?

dusky sonnet
# deep hound Is the resource location for the item actually `kubejs:research_point`?

it's not

event.create('research_point1').texture('kubejs:research_point').color(0, 0x0000FF).displayName('Research point tier 1')
event.create('research_point2').texture('kubejs:models/research_point').color(0, 0xFFFF00).displayName('Research point tier 2')
event.create('research_point3').texture('kubejs:models/research_point').color(0, 0x800080).displayName('Research point tier 3')
event.create('research_point4').texture('kubejs:models/research_point').color(0, 0xf82c00).displayName('Research point tier 4')
event.create('research_point5').texture('kubejs:models/research_point').color(0, 0x00FF00).displayName('Research point tier 5')
deep hound
#

because that method requires you set it for each item individually

dusky sonnet
#

^ a fragment of their script

deep hound
#

Change it to this then

$ItemProperties.registerGeneric(new ResourceLocation('count'), (stack, world, living, seed) => {
        return stack.getCount() / stack.getMaxStackSize()
    })
harsh parcel
#

Doesn't this register it for all items?

#

Does this lag a lot or take a lot of time?

deep hound
#

I doubt it

harsh parcel
#
        return stack.getCount() / stack.getMaxStackSize()
    })
$ItemProperties.register(Item.of('kubejs:research_point2'), new ResourceLocation('count'), (stack, world, living, seed) => {
        return stack.getCount() / stack.getMaxStackSize()
    })
$ItemProperties.register(Item.of('kubejs:research_point3'), new ResourceLocation('count'), (stack, world, living, seed) => {
        return stack.getCount() / stack.getMaxStackSize()
    })
$ItemProperties.register(Item.of('kubejs:research_point4'), new ResourceLocation('count'), (stack, world, living, seed) => {
        return stack.getCount() / stack.getMaxStackSize()
    })
$ItemProperties.register(Item.of('kubejs:research_point5'), new ResourceLocation('count'), (stack, world, living, seed) => {
        return stack.getCount() / stack.getMaxStackSize()
    })```Can I also just do this? I will only add those 5 items with it
deep hound
#

That works too

harsh parcel
#

Ok thanks

harsh parcel
#

I don't want to take unnecessary loading time or ram usage

deep hound
#

Every item in the game already has at least 3 predicates

harsh parcel
#

That would be a 33% load time increase

#

@deep hound

deep hound
#

What does the model json look like?

#

and what is the path of your models?

harsh parcel
#

I will just send you my whole kubejs folder if this is ok

deep hound
#

I guess that works

harsh parcel
harsh parcel
dusky sonnet
harsh parcel
#

Ok

#

I will have to leave soon and I would like to fix it befor that

#

Sorry

deep hound
#

Not completly sure, everything looks right

harsh parcel
#

So... am I screwed?

deep hound
#

oh

#

You have your models in items but you are referencing /item/

#

So just rename the kubejs/models/items folder to kubejs/models/item

harsh parcel
#

Thanks a lot