Jump to content

Texture wont display 1.11


Absithium_gamer

Recommended Posts

Learningmod.java
package Com.absithiumgamer.learningmod;
import Com.absithiumgamer.learningmod.proxy.CommonProxy;
import init.ModItems;
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_VESRIONS)

	public class learningmod {
	
	@Instance
	public static learningmod instance;

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

	@EventHandler
	public void preInit(FMLPreInitializationEvent event)
	{
		ModItems.init();
		ModItems.register();
	}
	
	@EventHandler
	public void Init(FMLInitializationEvent event)
	{
		proxy.init();	
	}
	
	@EventHandler
	public void postInit(FMLPostInitializationEvent event)
	{
		
	}
}

Reference
package Com.absithiumgamer.learningmod;

public class Reference {

	public static final String MOD_ID = "alm";
	public static final String NAME = "Learning Mod";
	public static final String VERSION="1.0";
	public static final String ACCEPTED_VESRIONS = "[1.11.2]";
	
	public static final String CLIENT_PROXY_CLASS = "Com.absithiumgamer.learningmod.proxy.ClientProxy";
	public static final String SERVER_PROXY_CLASS = "Com.absithiumgamer.learningmod.proxy.Serverproxy";
	
	public static enum learningmodItems{
			OBSIDIANINGOT("obsidianingot","ItemObsidianingot");
		
		private String unlocalizedName;
		private String registryName;
		
		learningmodItems(String unlocalizedName,String registryName) {
			this.unlocalizedName = unlocalizedName;
			this.registryName = registryName;
		}
			public String getUnlocalizedName() {
				return unlocalizedName;
			}
			public String getRegistryName() {
				return registryName;
			}
	}
}

ModItems.java
package init;

import items.ItemObsidianingot;
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 obsidianingot;
	
	public static void init () {
		obsidianingot = new ItemObsidianingot();
	}
	
	public static void register() {
		GameRegistry.register(obsidianingot);
	}
	
	public static void registerRenders() {
		registerRender(obsidianingot);
	}
	
	private static void registerRender(Item item) {
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
	}
	
}

ItemObsidianingot
package items;

import Com.absithiumgamer.learningmod.Reference;
import net.minecraft.item.Item;

public class ItemObsidianingot extends Item {
	
	public ItemObsidianingot() {
		setUnlocalizedName(Reference.learningmodItems.OBSIDIANINGOT.getUnlocalizedName());
		setRegistryName(Reference.learningmodItems.OBSIDIANINGOT.getRegistryName());
	}
}

itemobsidianingot
{
    "parent": "item/generated",
    "textures": {
        "layer0": "alm:item/obsidianingot"
     },
     
    "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]
        }
    }
}

en_US.lang
item.obsidianingot.name=Obsidian Ingot

Any help would be appreciated the problem is that the item texture does not display in the game 

Link to comment
Share on other sites

4 hours ago, diesieben07 said:

You just use setCustomModelResourceLocation instead of the ItemModelMesher method.

Coming from someone who updated all of his projects quite recently, I actually had a lot of trouble trying to update. I can understand why they are confused. I'd offer to help, but my "patchwork" is shoddy on that bit. I often just update ItemModelMesher on my old mods to match the current syntax, and just use ModelLoader on new projects.

 

ItemModelMesher works, but it doesn't work well. ModelLoader is a lot more stable.

  • Like 1

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Link to comment
Share on other sites

10 hours ago, ModMCdl said:

ItemModelMesher works, but it doesn't work well. ModelLoader is a lot more stable.

This is because the ModelMesher is Mojang's code and must be called at a very specific point during startup, whereas the ModelLoader is Forge supplied so that you (as a modder) can't fuck up.

  • Like 1

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

ModelLoader is a static class. That means in stead of:

Minecraft.getMinecraft().getRenderItem()

You put

ModelLoader

And then because method names are case-sensitive, you need to use:

setCustomModelResourceLocation

instead of

setcustommodelresourcelocation

 

This really isn't that hard.

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

It looks like you might need to study some Java fundamentals, because this is fairly basic syntax that you seem to be having trouble with. The correct line is:

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

 

Link to comment
Share on other sites

12 minutes ago, Absithium_gamer said:

thx and yea probably new to java script

Java is to Javascript as Car is to Carpet.

  • Like 2

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

6 hours ago, Draco18s said:

Java is to Javascript as Car is to Carpet.

You made my day, Draco xD

 

But seriously, yes. Brush up on at least basic Java first. Minecraft Modding is a wonderful way to learn how to program in Java, but you need to know the fundamentals first, otherwise you will have no idea what anything you're doing actually means.

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Link to comment
Share on other sites

11 hours ago, diesieben07 said:

It most definitely is not. Minecraft Modding is a giant mess of hacks on top of hacks and a minefield of horrible practices and undocumented code. This is not how "real world" development should work (and if it does at your company, run!).

It actually is. While it may not suit you in particular, I know several friends who really got down to it and used Minecraft Modding as a way to implement what they were learning in Java. It isn't an independent way to learn, but it allows an outlet to take what you learn and utilize it and build up off of it.

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Link to comment
Share on other sites

4 minutes ago, ModMCdl said:

but it allows an outlet to take what you learn and utilize it and build up off of it.

That is not "learning Java" that's "taking what you know and utilizing it."

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

19 hours ago, Draco18s said:

That is not "learning Java" that's "taking what you know and utilizing it."

Which is a major step of the learning process. I guess my initial statement was a bit vague. I was trying to emphasize that an underlying understanding of java must be known first.

Follow these rules when talking to me, and we'll get along fine.

1).I know Java fairly well. I don't know as much about modding. They are not the same, don't compare them.

2). I consider myself to always be learning. I make mistakes, you make mistakes. Who doesn't?

3). Insult me, and I will leave the thread. I have a real life, I don't have time to throw petty insults in a Minecraft Modding forum.

 

ModMCdl - Co-Founder and Director of Design for Artemis Game Studios

Link to comment
Share on other sites

6 hours ago, diesieben07 said:

My statement still stands. Taking practices from Minecraft Modding and applying them to "real-world programming" is a bad idea.

(I'll point out that Minecraft practices were better than what I was doing before because I was never taught any sort of organizational schema...)

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

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.

×
×
  • Create New...

Important Information

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