Jump to content

Can someone help me with textures


StezeH
 Share

Recommended Posts

So I am new and I have registered my item and added a .png file to the item folder in textures and created an .json file for the model but it doesnt load and i am not sure what to do so ill just give you my code and maybe its unfixable but help would be appreciated

 

Items class

 

package com.StezeH.StezehsMod.init;

 

import com.StezeH.StezehsMod.client.Reference;

 

import net.minecraft.client.Minecraft;

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

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

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

 

public class StezehsItems {

 

 

public static Item purple_glowstone_dust;

 

public static void init(){

purple_glowstone_dust = new Item().setCreativeTab(CreativeTabs.MATERIALS).setMaxStackSize(64).setUnlocalizedName("purple_glowstone_dust");

}

public static void register(){

GameRegistry.register(purple_glowstone_dust.setRegistryName(purple_glowstone_dust.getUnlocalizedName().substring(5)));

}

public static void registerRenders(){

registerRender(purple_glowstone_dust);

 

}

public static void registerRender(Item item){

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));

}

}

 

Client Proxy class

 

package com.StezeH.StezehsMod.proxy;

 

import com.StezeH.StezehsMod.init.StezehsItems;

 

public class ClientProxy extends CommonProxy{

@Override

public void registerRenders(){

StezehsItems.registerRenders();

}

}

 

Main class

 

package com.StezeH.StezehsMod.client;

 

import com.StezeH.StezehsMod.init.StezehsItems;

import com.StezeH.StezehsMod.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.event.FMLServerStartingEvent;

 

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

public class StezehsMod {

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

public static CommonProxy proxy;

 

@EventHandler

public void preInit(FMLPreInitializationEvent event){

StezehsItems.init();

StezehsItems.register();

}

public void init(FMLInitializationEvent event){

proxy.registerRenders();

}

public void postInit(FMLPostInitializationEvent event){

 

}

 

@EventHandler

public void serverLoad(FMLServerStartingEvent event){

 

}

}

 

Link to comment
Share on other sites

You can't use client side code in common code.  You must move that stuff to your client proxy.

 

Also, you must use ModelLoader.setCustomModelResourceLocation

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/ores/client/ClientProxy.java

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You also want to getRegistryName instead of forming a resource location from a fragment of getUnlocalizedName.

 

PS: Unless the subject line says otherwise, we will usually assume you're using the latest mc version. Even then it's nice to have it in there.

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

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
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.

 Share



×
×
  • Create New...

Important Information

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