Jump to content

[1.12.2] Render .obj and .mtl file


_mudblood

Recommended Posts

Hello I hope, you can help me with the problem of rendering the model. The model itself is rendered, but here maps of textures/glare/normals/smooth/shading are not superimposed, and the .mtl file itself seems to be skipping. All paths and file names are named correctly. I do everything via json file in blockstates. What is the problem?

Attached screenshots, including the console.

I will be very grateful for help. 

Item

Spoiler

public class LongSword extends ItemSword {
    public LongSword(String name, ToolMaterial material) {
        super(material);
        setRegistryName(name);
        setUnlocalizedName(name);
        setCreativeTab(Main.LevWeapon);
    }
}

 


Register

Spoiler

public class ItemsRegister {
  
    public static ToolMaterial LongSwordMaterial = EnumHelper.addToolMaterial("LongSwordMaterial", 2, 256, 50.0F, 2.0F, 12);
  
    public static ItemSword long_sword = new LongSword("long_sword", LongSwordMaterial);
  
    public static void register() {
        setRegister(long_sword);
    }
  
    @SideOnly(Side.CLIENT)
    public static void registerRender() {
        setRender(long_sword);
    }
  
    private static void setRegister(Item item) {
        ForgeRegistries.ITEMS.register(item);
    }
  
    @SideOnly(Side.CLIENT)
    private static void setRender(Item item) {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

    }
}

 


Proxy

Spoiler

public class ClientProxy extends CommonProxy {

    public void registerModel(Item item) {
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    }

    @Override
    public void preInit(FMLPreInitializationEvent event) {
        OBJLoader.INSTANCE.addDomain(Main.MODID);
        registerModel(ItemsRegister.long_sword);
        super.preInit(event);
    }

    @Override
    public void init(FMLInitializationEvent event) {
        ItemsRegister.registerRender();
        super.init(event);
    }

    @Override
    public void postInit(FMLPostInitializationEvent event) {
        super.postInit(event);
    }
}

 


blockstates .json file

Spoiler

{
  "forge_marker": 1,
  "defaults": {
    "model": "leviathan:long_sword.obj"
  },
  "variants": {
    "inventory": [
      {
        "transform": {
          "thirdperson_lefthand": {
            "rotation": [ { "x": -90 }, { "y": 0 }, { "z": 0 } ],
            "translation": [ 0, -0.1, 0.1 ],
            "scale": 1.00
          },
          "thirdperson_righthand": {
            "rotation": [ { "x": -90 }, { "y": 0 }, { "z": 0 } ],
            "translation": [ 0, -0.1, 0.1 ],
            "scale": 1.00
          },
          "gui": {
            "rotation": [ { "x": -90 }, { "y": 0 }, { "z": -0 } ],
            "translation": [ -0.2, -0.2, 0 ],
            "scale": 1.00
          },
          "firstperson_righthand": {
            "rotation": [ { "x": -90 }, { "y": 0 }, { "z": 0 } ],
            "translation": [ 0, -0.1, 0 ],
            "scale": 1.00
          },
          "firstperson_lefthand": {
            "rotation": [ { "x": -90 }, { "y": 0 }, { "z": 0 } ],
            "translation": [ 0, -0.1, 0 ],
            "scale": 1.00
          },
          "ground": {
            "rotation": [ { "x": -90 }, { "y": 0 }, { "z": 0 } ],
            "scale": 1.00
          }
        }
      }
    ]
  }
}

 


.mtl file

Spoiler

newmtl Garda
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 1
map_Bump leviathan:textures/items/models/nmap_long_sword
map_Ka leviathan:textures/items/models/aomap_long_sword
map_Kd leviathan:textures/items/models/cycmap_long_sword

newmtl Leswie
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 1
map_Bump leviathan:textures/items/models/nmap_long_sword
map_Ka leviathan:textures/items/models/aomap_long_sword
map_Kd leviathan:textures/items/models/cycmap_long_sword

newmtl Ruka
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.640000 0.640000 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

 

 

2018-06-10_23.29.49.jpg

Screenshot_314.png

Edited by _mudblood
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.