Jump to content

[SOLVED] Unable To Load Textures


1Poseidon3

Recommended Posts

So here's the thing, I was following a Youtube tutorial from a fairly trustable and popular Youtuber and lots of people had success with his tutorials. I on the other hand, did not. I followed his instructions to the letter (except for using my own item names) and still didn't get the end result. Instead of getting the ingot I was hopping to get, I got a block looking item (as if you were holding a Stone block) and it was covered in the usual purple and black checkered texture. I have no idea what I am doing wrong and I would like to know if someone can figure it out since I have tried for hours with no success. Here are my classes:

 

PeriodicTable.java

 

 

package com.poseidon.periodictable;

import com.poseidon.periodictable.init.Items;
import com.poseidon.periodictable.proxy.CommonProxy;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
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;
import net.minecraftforge.fml.common.registry.GameRegistry;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class PeriodicTable
{
   
   @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
   public static CommonProxy proxy;
   
   @EventHandler
   public void preInit(FMLPreInitializationEvent event)
   {
      Items.init();
      Items.register();
   } 
   
   @EventHandler
   public void init(FMLInitializationEvent event)
   {
      proxy.registerRenders();
   }
   
   @EventHandler
   public void postInit(FMLPostInitializationEvent event)
   {
      
   }
}

 

 

 

Items.java

 

 

package com.poseidon.periodictable.init;

import com.poseidon.periodictable.*;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class Items {

   public static Item lithium;
   
   public static void init()
   {
      lithium = new Item().setUnlocalizedName("lithium");
   }
   
   public static void register()
   {
      GameRegistry.registerItem(lithium, lithium.getUnlocalizedName().substring(5));
   }
   
   public static void registerRenders()
   {
      registerRender(lithium);
   }
   
   public static void registerRender(Item item)
   {
      Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
   }
}

 

 

 

lithium.json

 

 

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": "pt:items/lithium"
    },
    "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 ]
        }
    }
}

 

 

 

ClientProxy.java

 

 

package com.poseidon.periodictable.proxy;

public class ClientProxy extends CommonProxy {
   
   @Override
   public void registerRenders() {
      
   }
}

 

 

 

CommonProxy.java

 

 

package com.poseidon.periodictable.proxy;

import com.poseidon.periodictable.init.Items;

public class CommonProxy {
   
   public void registerRenders() {
      Items.registerRenders();
   }
}

 

 

 

That should about cover the classes that could be causing any problems. I have no idea what is causing my texture to not appear so if someone could assist me, that would be wonderful. Thanks in advance!

egg

Link to comment
Share on other sites

 

So you're saying change this:

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class PeriodicTable
{
   
   @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
   public static CommonProxy proxy;

 

 

 

To this?:

 

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)
public class PeriodicTable
{
   
   @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
   public static ClientProxy proxy;

 

 

Or move the Items.registerRenders() from CommonProxy.java to ClientProxy.java?

egg

Link to comment
Share on other sites

In other words, the empty method should be in common, and the register call should be in client's override.

 

Another note: I'd discourage you from naming a class as "Items" (or "Blocks" for that matter). If you duplicate class names from vanilla Minecraft, then your code could be confusing, and referring to the vanilla class someday (e.g. when you write recipes) would be awkward.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

In other words, the empty method should be in common, and the register call should be in client's override.

 

Another note: I'd discourage you from naming a class as "Items" (or "Blocks" for that matter). If you duplicate class names from vanilla Minecraft, then your code could be confusing, and referring to the vanilla class someday (e.g. when you write recipes) would be awkward.

 

 

Thank you. I ended up figuring that part out on my own but thanks anyways. I appreciate it! Also, thanks for the suggestions on Items.java and Blocks.java (when I make it). I didn't know that was a thing.

egg

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.