Started by
Spleet2.0
on
Topic category: Help with Minecraft modding (Java Edition)
Hello,
I would simply like to be able to change the texture of a geckolib block in-game. However, I looked in the added procedure blocks and there is one only for entities.
Unless you're trying to add an animated texture, you might just have to manually replace the block with a differently textured version of itself that's otherwise identical. It's not an elegant solution, but it's generally pretty effective. (You can use the 'keep NBT/Inventory' variant of the replace block function if this is important.) Not recommended if you need a lot of different variants for something, but if it's just a couple, it'll probably be fine.
I have many variations of the block
...It still might be worth making different variants, if only because it makes it easier to have different code depending on the current state of the block. There may be some way to change block textures based on NBT data, but it will likely require custom code.
To be more precise, I wanted to create a board to make pizza, and when you add an ingredient on it it is put on the pizza
You could maybe try using some sort of entity for the pizza- entities can be assigned different textures based on NBT data, either using optifine, or using geckolib; (beacons and enchanting tables are both blocks that use entities for animated components). You'd need to make an entity with no AI that despawns if the block is broken, and changes its visibility/texture based on the contents of the current block it's on. (You could even then add some behavior where right clicking the entity empties out the block it's on, and adds the pizza to the player's inventory.)
There are, of course, other ways you could do this, this is just the first thing that comes to mind.
or just use blockstates, but there are kinda complicated.
How can we create a non-living entity (like the enchantment table)
And how do we use blockstates?
Not entirely sure about blockstates. To create a non-living entity, you can just make an entity like normal, but disable AI, collisions, vulnerability to attack, etc. It will still technically be considered a living entity, but you can configure the settings in such a way that it will not be movable, have a hitbox, or take damage.
Thank !
Is it possible to immunize the entity with the /kill command ?
Not that I know of, the kill command would probably still work; the only reason you can't 'kill' beacon beams and enchantment table books is because the kill command literally doesn't accept them as dependencies. But you should be able to make an entity that's immune to movement/regular damage, and could then layer additional entities directly on top of it for different topping textures?
Yes
But is there a way to easily exchange data between the block and the entity ? For example, the "corresponding" pizza would have to disappear when the block is destroyed, to change depending on the state of the block...etc.