Small datagen work towards block models.

Waiting on a Fabric PR to complete this.
This commit is contained in:
modmuss50 2022-09-16 22:12:48 +01:00
parent 01cddda4dd
commit f58a4adb3c
2 changed files with 20 additions and 0 deletions

View file

@ -1,5 +1,6 @@
package techreborn.datagen.mixin
import net.minecraft.block.Block
import net.minecraft.data.client.TextureMap
import net.minecraft.item.Item
import net.minecraft.util.Identifier
@ -20,4 +21,13 @@ class MixinTextureMap {
}
}
}
@Inject(method = "getId(Lnet/minecraft/block/Block;)Lnet/minecraft/util/Identifier;", at = @At("HEAD"), cancellable = true)
private static void getId(Block block, CallbackInfoReturnable<Identifier> cir) {
TexturePaths.blockItemTexturePaths.each {
if (it.key == block) {
cir.setReturnValue(new Identifier("techreborn", "block/${it.value}"))
}
}
}
}

View file

@ -31,4 +31,14 @@ class TexturePaths {
public static Map<Block, String> blockItemTexturePaths = [
(TRContent.RUBBER_DOOR): "misc/rubber_door"
]
static {
TRContent.Ores.values().each {
if (it.isDeepslate()) {
blockItemTexturePaths.put(it.block, "ore/deepslate/${it.name.toLowerCase()}_ore")
} else {
blockItemTexturePaths.put(it.block, "ore/${it.name.toLowerCase()}_ore")
}
}
}
}