Jump to content

Missing texture without an error


winnetrie

Recommended Posts

Since the Moderator Diesieben gave me a warning:

Stop hijacking this thread. Make your own thread if you have a problem. This is a warning.

I think that's a bit rude because i didn't wanted to make a double thread.

There are forums that give you a warning for that!

So i started my own thread even when it's the same problem!

 

So to start:

 

I have everything set up fine for an item but when i start the game my item has no texture.

The console doesn't show any error.

 

I figured already out that there is something wrong with my proxy.

Somehow the method in the proxy is not being called even when i do call it.

 

Client proxy:

public class ClientProxy implements CommonProxy{

@Override
public void init() {

	ModItems.registerRenders();
	System.out.println("renders have been registered");

}	

}

 

my main class:

 

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

public class Tem {

@Instance
public static Tem instance;

@SidedProxy(serverSide = References.CLIENT_PROXY_CLASS, clientSide = References.SERVER_PROXY_CLASS)
public static CommonProxy proxy;

@EventHandler
public void preInit (FMLPreInitializationEvent event) {

	ModItems.init();
	ModItems.register();
	//ModItems.registerRenders();
	proxy.init();
}
@EventHandler
public void init (FMLInitializationEvent event){

}
@EventHandler
public void postInit(FMLPostInitializationEvent event){

}
}

 

Link to comment
Share on other sites

Well then i apologize for being rude and hijacking, wich was not my intention after all.

Still i think you could have said/asked this nice without giving a warning.

I'm trying to be nice to other people and i expect the same from others too.

But i apologized now, let's get over this now and stick to the real problem.

 

 

the ModItems class:

 

public class ModItems {

public static Item cheese;

public static void init(){

	cheese = new ItemCheese();

}

public static void register(){
	GameRegistry.register(cheese);

}

public static void registerRenders(){
	registerRender(cheese);

}

private static void registerRender(Item item){
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory"));
}

}

 

By testing i mean this:

 

public class ClientProxy implements CommonProxy{

@Override
public void init() {

	ModItems.registerRenders();
	System.out.println("renders have been registered");

}	

}

i don't see that message so i guess the method init is not working/ being called!

But and just for testing purpose, i moved

ModItems.registerRenders();

over to the main class in the preInit to see if the problem is something else.

This however does work like it should. So that means something is not right with the proxies, at least i think that is.

 

I did a tutorial from MrCrayFish on youtube, because he explains all the things too  so people understands it and it isn't just copy paste.

I did exactly what he did (i think) and it works for him but not for me. I did a small change with the ModelLoader,but even when i use the old way it doesn't work.

I watched the tutorial over and over again to see what i missed or did wrong, but i can't see the problem.

Here is the tutorial if you want to see for yourself:

Link to comment
Share on other sites

alright here is the reference class:

 

public class References {
public static final String MOD_ID = "tem";
public static final String NAME = "Tim's Expansion Mod";
public static final String VERSION = "1.0.0";
public static final String ACCEPTED_VERSIONS = "[1.10]";

public static final String CLIENT_PROXY_CLASS = "winnetrie.tem.proxy.ClientProxy";
public static final String SERVER_PROXY_CLASS = "winnetrie.tem.proxy.ServerProxy";

public static enum temItems {
	CHEESE("cheese", "cheese");

	private String unlocalizedName;
	private String registryName;

	temItems(String unlocalizedName, String registryName){
		this.unlocalizedName = unlocalizedName;
		this.registryName = registryName;

	}
	public String getUnlocalizedName(){
		return unlocalizedName;
	}
	public String getRegistryName(){
		return registryName;
	}
}

}

Link to comment
Share on other sites

Sorry if I'm treading on toes here... but if you're using ModelLoader shouldn't it be called in the preInit?

 

My CommonProxy setups like so:

public class CommonProxy {

    public void preInit(FMLPreInitializationEvent e) {
        BlockReg.load();
        ItemReg.load();
    }

    public void init(FMLInitializationEvent e) {

    }

    public void postInit(FMLPostInitializationEvent e) {

    }
}

And my ClientProxy like so:

public class ClientProxy extends CommonProxy {
    @Override
    public void preInit(FMLPreInitializationEvent e) {
        super.preInit(e);
        BlockRender.regRender();
        ItemRender.regRender();
    }

    @Override
    public void init(FMLInitializationEvent e) {
        super.init(e);
    }

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

With the main mod section like so:

@Mod.EventHandler
    public void preInit(FMLPreInitializationEvent e) {
        this.proxy.preInit(e);

        MinecraftForge.EVENT_BUS.register(this);
        FMLCommonHandler.instance().bus().register(this);

        path = e.getModConfigurationDirectory().getAbsolutePath() + File.separator + "NihilEnim" + File.separator;
        config = new Configuration(new File(path + "NihilEnim.cfg"));

        NihilEnimWorld.configure(config);

        if(config.hasChanged()) config.save();
    }

    @Mod.EventHandler
    public void init(FMLInitializationEvent e) {
        this.proxy.init(e);
    }

    @Mod.EventHandler
    public void postInit(FMLPostInitializationEvent e) {
        this.proxy.postInit(e);
    }

    @SubscribeEvent
    public void onWorldLoad(WorldEvent.Load e) {
        if(!e.getWorld().isRemote && e.getWorld() instanceof WorldServer) {
            NihilEnimWorld.load(e.getWorld());
        }
    }

Another thing to bare in mind is if your items aren't set to a Creative Tab, you won't find them anywhere. They need a Registry name as well, a json file to determine textures and scale, and only then can you say for certain that you're not getting errors.

Link to comment
Share on other sites

I doesn't matter how you call your methods, just give it logical names or whatever you like.

Also you don't need to this

public void preInit(FMLPreInitializationEvent e) 

again in your proxies.

That's already done in your main file.

Yes i haven't made a creative tab, but that has nothing to do with it.

I use the command to get the item, it only has no texture.

If i render it directly in the main file, wich should never be done ofc i know, it works.

So i'm wondering why it has no texture when i call the proxy?

 

EDITOmg .....i just found the problem......this is such a stupid mistake...really

The problem is at this line:

 

@SidedProxy(serverSide = References.CLIENT_PROXY_CLASS, clientSide = References.SERVER_PROXY_CLASS)
public static CommonProxy proxy;

I'm searching the problem the whole day....

Link to comment
Share on other sites

You should investigate why your proxy method does not seem to be called. I suspected it might be a mistake in the constants in your

References

class, which is not the case. I recommend you use the debugger to find out why it is not calling the method.

 

No i found the problem i edited my previous post

Link to comment
Share on other sites

Yeah mostly it is just a small thing. A typo!

 

my clientproxy looks now like this:

public class ClientProxy implements CommonProxy{

@Override
public void ItemRenderRegistry() {

	registerRender(ModItems.cheese);
	//ModItems.registerRenders();
	System.out.println("renders have been registered");
}	


private static void registerRender(Item item){
	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory"));
	//Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(),"inventory"));
}

}

 

@swordkorn

I wouldn't know why implementing it is wrong for you?

 

extends is for extending a class

implements is for implementing an interface

 

As far as i know you can only extend 1 class but you can implement as many interfaces you want.

Implementing interfaces can be very usefull.

Is it needed for what the use i have? No absolutely not, extending would be sufficient.

Perhaps for more advanced modding you would probebly need to implement multiple interfaces.

Link to comment
Share on other sites

Well the CommonProxy handles all the main behaviours for both Server and Client side.

 

Therefore making the Client and Server Proxies extend it will call on that specific side.

 

At least... that's how I've always seen it anyway. Feel free to correct me if I'm wrong, but you are correct. Implementing a class is generally used for interfaces.

 

Extending a class means it will inherit all the behaviours of that class. Implementing an Interface allows access to the methods and will call an individual instance of your class type with those methods implemented.

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.