#Overlay textures on item
101 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
you mean you want the texture to change as there are more items in the stack?
you may need to further explain this to me a bit so i understand your premise because if its just an item stack texture change then theres an easy way to do it with a resource pack
He wants to make like compressed items
like 9x iron block gives 1x compressed iron block
9x 1x compressed iron block gives 2x compressed iron block
and I think he wants to add an overlay indicating it is a 2x compressed for example
Yes exactly
I just want to add a x2 on one corner of the item/block without having to make an extra texture for every one
if its a custom item with a normal item model its rather easy, just another layer in the model json
if its a block's item its a ton harder cause its not a flat texture
I don't use models
if you dont provide a custom mdel kubejs will generate one for you based on the data you provided
.textureJson.addProperty("layer1", "kubejs:item/other_texture")
after everything else, or save your item to a variable and use it on that
event.create('dyson_sphere_energy_core').texture('kubejs:item/white_energy_core').textureJson.addProperty("layer1", "kubejs:item/x2_overlay").color(0, 0xFFA500).displayName('Dyson sphere energy core')Like thins?
after everything else
event.create('dyson_sphere_energy_core').texture('kubejs:item/white_energy_core').color(0, 0xFFA500).displayName('Dyson sphere energy core').textureJson.addProperty("layer1", "kubejs:item/x2_overlay")Like this?
yes
because addProperty is void and doesnt return anything
so any methods after it would try and execute on nothing
💥
Ok thanks
Ticket re-opened!
It errored
Paste version of startup.log from @fading heath
event.create('dyson_sphere_rod_x3').texture('kubejs:item/white_rod').texture('kubejs:item/x3_overlay').color(0, 0xFFA500).displayName('Dyson sphere rod x3').textureJson.addProperty("layer1", "kubejs:item/x3_overlay")
event.create('dyson_sphere_plate_x3').texture('kubejs:item/white_plate').texture('kubejs:item/x3_overlay').color(0, 0xFFA500).displayName('Dyson sphere plate x3').textureJson.addProperty("layer1", "kubejs:item/x3_overlay")
event.create('dyson_sphere_gear_x3').texture('kubejs:item/white_gear').texture('kubejs:item/x3_overlay').color(0, 0xFFA500).displayName('Dyson sphere gear x3').textureJson.addProperty("layer1", "kubejs:item/x3_overlay")
event.create('dyson_sphere_screw_x3').texture('kubejs:item/white_screw').texture('kubejs:item/x3_overlay').color(0, 0xFFA500).displayName('Dyson sphere screw x3').textureJson.addProperty("layer1", "kubejs:item/x3_overlay")
event.create('dyson_sphere_energy_core_x3').texture('kubejs:item/white_energy_core').texture('kubejs:item/x3_overlay').color(0, 0xFFA500).displayName('Dyson sphere energy core x3').textureJson.addProperty("layer1", "kubejs:item/x3_overlay")
event.create('dyson_sphere_capacitor_x2').texture('kubejs:item/white_capacitor').color(0, 0xFFA500).displayName('Dyson sphere capacitor x2').textureJson.addProperty("layer1", "kubejs:item/x2_overlay")
event.create('dyson_sphere_rod_x2').texture('kubejs:item/white_rod').color(0, 0xFFA500).displayName('Dyson sphere rod x2').textureJson.addProperty("layer1", "kubejs:item/x2_overlay")
These are some of the items
what is line 486
that second error makes no sense
it definitely exists, im staring at it in my ide
```
[Quote ➤](#1139581907244417085 message) if its a block's item its a ton harder cause its not a flat texture
i have no idea how you would do it for blocks
Is it possible to do it just for the block item?
you would have to give it a flat item model
How?
I removed the block part for now
Paste version of startup.log from @fading heath
```Line 405, its the first item where I add the overlay
wouldnt that just be a seperate block all together then?
It is a seperate block but I don't want to make all the textures for a compacted variant, I want to use an overlay instead
oh i see
Can you help me with the crash?
have you tried just using .overlayTexture('kubejs:item/x3_overlay'
for example
[Quote ➤](#1119630229594443858 message) Not sure if this is something I did in my definition here. It seems to render black behind any transparent block
StartupEvents.registry('fluid', event => {
let blood = event.create('blood')
.viscosity(1500).density(1400)
.flowingTexture('kubejs:block/blood_flow').stillTexture('kubejs:block/blood_still')
let attributes = blood.createAttributes()
blood.attributes = attributes.dropOff(2).slopeFindDistance(3).tickDelay(20).overlayTexture('kubejs:block/blood_overlay')
})
It does not
fair enough
But the game doesn't load with the textureJson
It crashes
Let me reproduce it really quick
bet
Paste version of block_items_creation.js, startup.log, crash-2023-08-12_14.56.02-fml.txt from @fading heath
so it seems its still crashing with the previous addproperty function, i really meant to ask you to remove it before trying
im actually starting to think my method wont work because the overlay may only show up when the block is placed down in the world
But that is needed for the overlay of the items
Without that it works fine
yeah thats what im trying to figure out, for some reason the examples ive seen online for the .addProperty are for loot tables
json loot tables
@fading heath im basically doing the same thing as you and i have no idea how to add an overlays or second texture, so ive manually made the textures💀
💀
have you found a solution yet
But thanks for the info
No
I just made the textures a bit darker when they are compacted
i feel like a parent model would work
I have no idea to be honest
A bit late, but you can just do .texture('layer1', 'kubejs:item/overlay') to add a second layer, with the small caveat that you will have to manually set the base textures as well with .texture('kubejs:item/itemname') if you aren't already
also, you can do a similar thing for blocks on Forge using the composite model, but it's a bit more complicated and requires overriding the entire modelJson
I will try that once I get home, thanks a lot. And yes I am already using .texture
I am using for, do you know how to do it? If yes would you be so kind and tell me how to do it?
So the basics are you just need the model file to look like
{
"parent": "minecraft:block/block",
"loader": "forge:composite",
"textures": {
"particle": "minecraft:block/dirt"
},
"parts": {
"solid": {
"render_type": "solid",
"parent": "minecraft:block/dirt"
},
"translucent": {
"render_type": "translucent",
"parent": "minecraft:block/cube_all",
"textures": {
"all": "kubejs:block/example_overlay"
}
}
}
}
I'm just not entirely sure how to override a block model in the startup event
Is it possible to just add the overly to the item of the block?
aw sweet im trying it now
event.create('compressed_dirt_test').displayName('Compressed Dirt test (1x)').parentModel("kubejs:block/dirt").material('dirt').hardness(2.5);
[02:06:04] [ERROR] ! #5: Error occurred while handling event 'StartupEvents.registry': TypeError: Cannot find function parentModel in object dev.latvian.mods.kubejs.block.custom.BasicBlockJS$Builder@3a9cc3d2. (startup_scripts:CompressedBlocks.js#5)
cant get it to work
ive named the json dirt.json and put it in assets/models/block/dirt.json
"parent": "minecraft:block/block",
"loader": "forge:composite",
"textures": {
"particle": "minecraft:block/dirt"
},
"parts": {
"solid": {
"render_type": "solid",
"parent": "minecraft:block/dirt"
},
"translucent": {
"render_type": "translucent",
"parent": "minecraft:block/cube_all",
"textures": {
"all": "kubejs:block/overlays/layer_1"
}
}
}
}```
Get rid of .parentModel("kubejs:block/dirt")