#Overlay textures on item

101 messages · Page 1 of 1 (latest)

fading heath
#

How can I make a texture overlay the texture of an item or a block? For example I want to make compacted variants of my items so I want to put a x2 in one of the corners and I don't want to redo every texture. Thanks in advance

bright hornetBOT
#

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

spark hollow
#

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

crude thunder
#

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

fading heath
#

I just want to add a x2 on one corner of the item/block without having to make an extra texture for every one

next pebble
#

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

next pebble
#

yes you do

#

unless you like that pink and black checkered texture

fading heath
next pebble
#

if you dont provide a custom mdel kubejs will generate one for you based on the data you provided

fading heath
#

Ah ok

#

So how would I add a second layer to that?

next pebble
#

.textureJson.addProperty("layer1", "kubejs:item/other_texture")

#

after everything else, or save your item to a variable and use it on that

fading heath
next pebble
#

after everything else

fading heath
#

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?

next pebble
#

yes

fading heath
#

Ok

#

Why does it have to be at the end?

#

Thanks a lot btw

next pebble
#

because addProperty is void and doesnt return anything

#

so any methods after it would try and execute on nothing

#

💥

fading heath
#

Ok thanks

bright hornetBOT
#

Ticket re-opened!

amber roverBOT
#

Paste version of startup.log from @fading heath

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

next pebble
#

what is line 486

#

that second error makes no sense
it definitely exists, im staring at it in my ide

fading heath
#
    ```
amber roverBOT
#

[Quote ➤](#1139581907244417085 message) if its a block's item its a ton harder cause its not a flat texture

next pebble
#

i have no idea how you would do it for blocks

fading heath
#

Is it possible to do it just for the block item?

next pebble
#

you would have to give it a flat item model

fading heath
fading heath
amber roverBOT
#

Paste version of startup.log from @fading heath

fading heath
#
```Line 405, its the first item where I add the overlay
spark hollow
fading heath
#

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

spark hollow
#

oh i see

fading heath
#

Can you help me with the crash?

spark hollow
#

yeah lemme look

#

i have a bit to catch up on

spark hollow
#

for example

fading heath
#

No

#

But will do now

#

Dos this work for items as well?

spark hollow
#

hmm MAYBE

#

not sure

amber roverBOT
#

[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')
})
fading heath
spark hollow
#

fair enough

fading heath
spark hollow
#

hmm

#

you mean your texture isnt showing up now?

fading heath
#

It crashes

spark hollow
#

crash report plox

#

and startup events

fading heath
#

Let me reproduce it really quick

spark hollow
#

bet

amber roverBOT
#

Paste version of block_items_creation.js, startup.log, crash-2023-08-12_14.56.02-fml.txt from @fading heath

spark hollow
#

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

fading heath
#

Without that it works fine

spark hollow
#

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

sharp hollow
#

@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💀

fading heath
#

💀

sharp hollow
#

have you found a solution yet

fading heath
#

But thanks for the info

#

No

#

I just made the textures a bit darker when they are compacted

sharp hollow
#

i feel like a parent model would work

fading heath
#

I have no idea to be honest

white wave
#

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

fading heath
fading heath
white wave
#

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

fading heath
sharp hollow
#

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"
            }
        }
    }
}```
white wave
#

Get rid of .parentModel("kubejs:block/dirt")