Allow overwriting the block item texture.

fixes #345
This commit is contained in:
IntegratedQuantum 2024-07-04 10:38:30 +02:00
parent 337e014d88
commit 45fed30069

View File

@ -128,8 +128,13 @@ pub const BaseItem = struct {
pub fn getTexture(self: *BaseItem) graphics.Texture {
if(self.texture == null) {
if(self.block) |blockType| {
self.texture = graphics.generateBlockTexture(blockType);
if(self.image.imageData.ptr == graphics.Image.defaultImage.imageData.ptr) {
if(self.block) |blockType| {
self.texture = graphics.generateBlockTexture(blockType);
} else {
self.texture = graphics.Texture.init();
self.texture.?.generate(self.image);
}
} else {
self.texture = graphics.Texture.init();
self.texture.?.generate(self.image);