Jump to content

[1.10] Name and Texture won't load on the Item


Rockinredross867

Recommended Posts

I have been trying to figure this one out for a while. I am watching Mr. Crayfish's video series and it doesn't seem like anything is working. I have tried fixing my modid to lowercase. I made sure that everything that I did was right was right. The bottom of this thread is my source code. Sorry for no spoilers and such. The website won't let me insert them.

 

Main.java

 

package com.rockinredross.main;

 

import com.rockinredross.init.ModItems;

import com.rockinredross.proxy.IProxy;

 

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.Mod.Instance;

import net.minecraftforge.fml.common.SidedProxy;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

 

@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)

public class Main {

 

@Instance

public static Main instance = new Main();

 

@SidedProxy(clientSide = Reference.CLEINT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)

public static IProxy proxy;

 

@EventHandler

public void preInit(FMLPreInitializationEvent event) {

System.out.println("Pre-Init");

ModItems.init();

ModItems.register();

}

 

@EventHandler

public void init(FMLInitializationEvent event) {

System.out.println("Init");

proxy.init();

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event) {

System.out.println("Post-Init");

}

 

}

 

Reference.java

 

package com.rockinredross.main;

 

public class Reference {

 

public static final String MOD_ID = "giantsmod";

public static final String NAME = "The Giants Mod";

public static final String VERSION = "1.0";

public static final String ACCEPTED_VERSIONS = "[1.10]";

 

public static final String CLEINT_PROXY_CLASS = "com.rockinredross.proxy.ClientProxy";

public static final String SERVER_PROXY_CLASS = "com.rockinredross.proxy.ServerProxy";

 

public static enum EModItems {

CHEESE("cheese", "ItemCheese");

 

private String unlocalizedName;

private String registryName;

 

EModItems(String unlocalizedName, String registryName) {

this.unlocalizedName = unlocalizedName;

this.registryName = registryName;

}

 

public String getUnlocalizedName() {

return unlocalizedName;

}

 

public String getRegistryName() {

return registryName;

}

}

}

 

ModItems.java

 

package com.rockinredross.init;

 

import com.rockinredross.items.ItemCheese;

import com.rockinredross.main.Reference;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;

import net.minecraft.item.Item;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

public class ModItems {

 

public static Item cheese;

 

public static void init() {

cheese = new ItemCheese();

}

 

public static void register() {

GameRegistry.register(cheese);

}

 

public static void registerRenderers() {

registerRender(cheese);

}

 

private static void registerRender(Item item) {

Minecraft.getMinecraft().getRenderItem().getItemModelMesher()

.register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

}

 

}

 

ClientProxy.java

 

package com.rockinredross.proxy;

 

import com.rockinredross.init.ModItems;

 

public class ClientProxy implements IProxy {

 

@Override

public void init() {

ModItems.registerRenderers();

}

 

}

 

en_US.lang

 

item.cheese.name=Cheese

 

ItemCheese.json

 

{

    "parent": "builtin/generated",

    "textures": {

        "layer0": "giantsmod:items/cheese"

    },

    "display": {

        "thirdperson": {

            "rotation": [-90, 0, 0],

            "translation": [0, 1, -3],

            "scale": [0.55, 0.55, 0.55]

        },

        "firstperson": {

            "rotation": [0, -135, 25],

            "translation": [0, 4, 2],

            "scale": [1.7, 1.7, 1.7]

        }

    }

}

Link to comment
Share on other sites

It has been stated before on the forums that MrCrayfish's tutorials are not very good. I'll show you what I mean:

  • Use
    ModelLoader.setCustomModelResourceLocation

    instead of

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register

    .

  • Don't put client code (
    ModItems.registerRenderers()

    inside common code (

    ModItems

    . Put it on your

    ClientProxy

    .

  • You should use
    item/generated

    in your model JSON instead of

    builtin/generated

    .

  • Don't initialize your
    @Instance

    variable yourself, Forge does it for you.

  • You have that awful
    EModItems

    (why?) but you never use it.

  • You don't need the
    display

    object in your model JSON, as it handled for you by

    item/generated

    .

 

There are more issues with your code and his tutorials that you haven't gotten to yet, and I won't go into detail right now.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.