Convert some more stuff to datagen!

This commit is contained in:
Zontreck 2024-02-20 03:02:05 -07:00
parent 1015b36ee5
commit ef5f27270a
38 changed files with 87 additions and 199 deletions

View file

@ -22,5 +22,6 @@ public class ModDatagen
ExistingFileHelper helper = event.getExistingFileHelper();
gen.addProvider(event.includeClient(), new ModBlockStatesProvider(output, helper));
gen.addProvider(event.includeClient(), new ModItemModelsProvider(output,helper));
}
}

View file

@ -0,0 +1,83 @@
package dev.zontreck.otemod.data;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.items.*;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraftforge.client.model.generators.ItemModelBuilder;
import net.minecraftforge.client.model.generators.ItemModelProvider;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import java.util.Objects;
public class ModItemModelsProvider extends ItemModelProvider
{
public ModItemModelsProvider(PackOutput output, ExistingFileHelper helper)
{
super(output, OTEMod.MOD_ID, helper);
}
@Override
protected void registerModels() {
item(ModItems.ETERNIUM_FRAGMENT);
item(ModItems.IHAN_CRYSTAL);
item(ModItems.ETERNIUM_RAW_ORE);
item(ModItems.ETERNIUM_INGOT);
item(ModItems.MELTED_ENDER_PEARL);
item(ModItems.SINGULARITY);
item(ModItems.COMPRESSED_OBSIDIAN_SHEET);
item(ModItems.LAYERED_COMPRESSED_OBSIDIAN_SHEET);
item(ModItems.ENCASED_SINGULARITY);
item(ModItems.ETERNIUM_ROD);
item(ModItems.SCRUBBER_FRAME_PIECE);
item(ModItems.SCRUBBER_FRAME);
item(ModItems.VAULTSTEEL_INGOT);
item(ModItems.VAULT_FRAG_BL);
item(ModItems.VAULT_FRAG_BR);
item(ModItems.VAULT_FRAG_LC);
item(ModItems.VAULT_FRAG_L);
item(ModItems.VAULT_FRAG_R);
item(ModItems.VAULT_FRAG_UR);
item(ModItems.VAULT_FRAG_UL);
item(ModItems.VAULT_FRAG_U);
item(ModItems.VAULT_FRAG_C);
item(ModItems.VAULT);
item(ModItems.VAULT_RAW_ORE);
item(ModItems.MIAB);
item(ModItems.EMPTY_SPAWN_EGG);
item(ModItems.GENERIC_DEPRECATED_ITEM);
/*
DEPRECATED ITEMS
*/
deprecated(DeprecatedModItems.ILUSIUM_ORE);
deprecated(DeprecatedModItems.ILUSIUM_ROD);
deprecated(DeprecatedModItems.ILUSIUM_INGOT);
deprecated(DeprecatedModItems.POSS_BALL);
deprecated(DeprecatedModItems.AURORA_COMPOUND);
}
private ItemModelBuilder item(RegistryObject<Item> ite) {
return this.item((ResourceLocation) Objects.requireNonNull(ForgeRegistries.ITEMS.getKey(ite.get())));
}
private ItemModelBuilder item(ResourceLocation item) {
return (ItemModelBuilder)((ItemModelBuilder)((ItemModelBuilder)this.getBuilder(item.toString())).parent(new ModelFile.UncheckedModelFile("item/generated"))).texture("layer0", new ResourceLocation(item.getNamespace(), "item/" + item.getPath()));
}
private ItemModelBuilder deprecated(RegistryObject<Item> ite) {
return this.deprecated((ResourceLocation) Objects.requireNonNull(ForgeRegistries.ITEMS.getKey(ite.get())));
}
private ItemModelBuilder deprecated(ResourceLocation item) {
return (ItemModelBuilder)((ItemModelBuilder)((ItemModelBuilder)this.getBuilder(item.toString())).parent(new ModelFile.UncheckedModelFile("item/generated"))).texture("layer0", new ResourceLocation(item.getNamespace(), "item/deprecated"));
}
}

View file

@ -20,6 +20,8 @@ public class DeprecatedModItems
public static final RegistryObject<Item> AURORA_COMPOUND = CreativeModeTabs.addToOTEModTab(ITEMS.register("aurora_compound", () -> new DeprecatedItem()));
public static final RegistryObject<Item> POSS_BALL = CreativeModeTabs.addToOTEModTab(ITEMS.register("poss_ball", () -> new DeprecatedItem()));
public static void register(IEventBus bus){
ITEMS.register(bus);
}

View file

@ -52,8 +52,6 @@ public class ModItems {
public static final RegistryObject<Item> VAULT_RAW_ORE = CreativeModeTabs.addToOTEModTab(ITEMS.register("raw_vault_steel_ore", () -> new Item(new Item.Properties().stacksTo(64))));
@Deprecated
public static final RegistryObject<Item> POSS_BALL = CreativeModeTabs.addToOTEModTab(ITEMS.register("poss_ball", () -> new DeprecatedItem()));
public static final RegistryObject<Item> MIAB = CreativeModeTabs.addToOTEModTab(ITEMS.register("mob_capture_ball", ()->new MobCaptureBall()));

View file

@ -47,7 +47,7 @@ public class ThrownMobCaptureBall extends ThrowableItemProjectile
@Override
protected Item getDefaultItem()
{
return ModItems.POSS_BALL.get();
return ModItems.MIAB.get();
}
void returnBall()

View file

@ -13,7 +13,6 @@
"item.otemod.ihan_crystal.durability": "Durability: ",
"item.otemod.eternium_fragment": "Fragmented Eternium",
"item.otemod.eternium_dust": "Eternium Dust",
"item.otemod.aurora_compound": "Aurora Compound",
"item.otemod.melted_ender_pearl": "Melted Ender Pearl",
"item.otemod.eternium_ingot": "Eternium Ingot",
"item.otemod.eternium_rod": "Eternium Rod",
@ -52,9 +51,6 @@
"block.otemod.nether_vault_steel_ore_block": "Nether Vault Steel Ore",
"block.otemod.eternium_block": "Block of Eternium",
"block.otemod.void": "Void",
"block.otemod.ilusium_ore_block": "Ilusium Ore Block",
"block.otemod.deepslate_ilusium_ore_block": "Deepslate Ilusium Ore Block",
"block.otemod.ilusium_block": "Block of Ilusium",
"block.otemod.ilusium_portal": "Ilusium Portal",
"block.otemod.compression_chamber": "Compression Chamber",
"block.otemod.compressed_obsidian_block": "Block of Compressed Obsidian",

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/deprecated"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/compressed_obsidian_sheet"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/deprecated"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/empty_spawn_egg"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/encased_singularity"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/eternium_fragment"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/eternium_ingot"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/eternium_ore"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/eternium_rod"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/ihan_crystal"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/deprecated"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/deprecated"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/deprecated"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/layered_compressed_obsidian_sheet"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/melted_ender_pearl"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/mob_capture_ball"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/deprecated"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/raw_vault_steel_ore"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/scrubber_frame"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/scrubber_frame_piece"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/singularity"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_center"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_left"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_lower"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_lower_left"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_lower_right"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_right"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_upper"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_upper_left"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_fragment_upper_right"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "item/generated",
"textures": {
"layer0": "otemod:item/vault_steel_ingot"
}
}