Jump to content

Recommended Posts

Posted

Okay, after much tinkering, I'm still left with issues that I have no clue what the problem would be:

 

First off: My block texture doesn't load in hand, however when placed it is shown.

Here is the json for it:

 

 

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "all": "plentifulmisc:blocks/pmXianite"
        }
    },
    "variants": {
        "normal": {
            "model": "cube_all"
        },
        "inventory": {
            "model": "cube_all"
        }
    }
}

 

 

 

Secondly all of my textures, except the one I manually assigned due to it being a SeedFood. They are all registered and have the correct names, the log isnt outputting anything. So I'm stuck.

 

Here is my ItemBase, which is used to register the item:

 

 

package com.lambda.PlentifulMisc.item;

import com.lambda.PlentifulMisc.main.PlentifulMisc;

import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ItemBase extends Item
{
public ItemBase(String name)
{
	registerItem(name, this);
}

public static void registerItem(String name, Item item)
{
	item.setRegistryName(name);
	item.setCreativeTab(PlentifulMisc.instance.creativeTab);
	item.setUnlocalizedName(name);

	GameRegistry.register(item);
}
}

 

 

 

next is the item itself, there are multiple that are broken, but they most likely will have the same problem:

 

 

package com.lambda.PlentifulMisc.item;

import com.lambda.PlentifulMisc.main.PlentifulMisc;

import net.minecraft.item.Item;

public class ItemCheese extends ItemBase implements IItemModelProvider{

public ItemCheese() {
	super("pmcheese");
}

@Override
public void registerItemModel(Item item) {
	PlentifulMisc.proxy.registerItemRenderer(item, 0, "pmcheese");
}

}

 

 

 

here is the 'Register Item Model' Provider:

 

 

package com.lambda.PlentifulMisc.item;
import net.minecraft.item.Item;

public interface IItemModelProvider {

void registerItemModel(Item item);

}

 

 

 

here is the Common Proxy & Client, in the same order:

 

 

 

package com.lambda.PlentifulMisc.main;

import net.minecraft.item.Item;

public class CommonProxy {

public void registerItemRenderer(Item item, int meta, String id) {
}

}

 

 

 

 

 

package com.lambda.PlentifulMisc.client;

import com.lambda.PlentifulMisc.main.CommonProxy;

import com.lambda.PlentifulMisc.info.Reference;
import com.lambda.PlentifulMisc.main.CommonProxy;
import com.lambda.PlentifulMisc.main.PlentifulMisc;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.client.model.ModelLoader;

public class ClientProxy extends CommonProxy {
@Override
public void registerItemRenderer(Item item, int meta, String id) {
	ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(Reference.MOD_ID + ":" + id, "inventory"));
}
}

 

 

 

Next, the json for the item:

 

 

 

{
    "parent": "item/generated",
    "textures": {
        "layer0": "plentifulmisc:items/pmcheese"
    }
}

 

 

 

Mod items:

 

 

package com.lambda.PlentifulMisc.item;

import com.lambda.PlentifulMisc.block.ModBlocks;
import com.lambda.PlentifulMisc.main.PlentifulMisc;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSeedFood;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModItems
{
public static Item ROCKCRESS;

public static ItemCheese cheese; 

public static void load(FMLPreInitializationEvent event)
{

	cheese = new ItemCheese();

	//Special Model Loaders & registry
	ROCKCRESS = register(new ItemSeedFood(1, 0.3F, ModBlocks.CROP_ROCKCRESS, Blocks.FARMLAND).setUnlocalizedName("pmrockcress").setRegistryName("pmrockcress").setCreativeTab(PlentifulMisc.instance.creativeTab));
	ModelLoader.setCustomModelResourceLocation(ROCKCRESS, 0, new ModelResourceLocation(ROCKCRESS.getRegistryName(), "inventory"));
}


//For special overridden registry
private static <T extends Item> T register(T item) {
	GameRegistry.register(item);

	if (item instanceof IItemModelProvider ) {
		((IItemModelProvider )item).registerItemModel(item);
	}

	return item;
}
}

 

 

 

Lastly, my main class w/ reference

 

 

 

package com.lambda.PlentifulMisc.main;

import com.lambda.PlentifulMisc.block.ModBlocks;
import com.lambda.PlentifulMisc.info.Reference;
import com.lambda.PlentifulMisc.item.ModItems;
import com.lambda.PlentifulMisc.tab.PMCreativeTab;

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;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.MOD_VERSION)
public class PlentifulMisc
{ 
@SidedProxy(serverSide = "com.lambda.PlentifulMisc.main.CommonProxy", clientSide = "com.lambda.PlentifulMisc.client.ClientProxy")
public static CommonProxy proxy;
@Mod.Instance(Reference.MOD_ID)

public static PlentifulMisc instance;
public PMCreativeTab creativeTab;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	//REWRITE
	creativeTab = new PMCreativeTab();

	ModBlocks.load(event);
	ModItems.load(event);
}

@EventHandler
public void init(FMLInitializationEvent event){

}

@EventHandler
public void postInit(FMLPostInitializationEvent event){

}

}

 

 

 

 

 

package com.lambda.PlentifulMisc.info;

public class Reference {
public static final String MOD_ID = "plentifulmisc";
public static final String MOD_NAME = "Plentiful Misc";
public static final String MOD_VERSION = "0.0.1";
}

 

 

 

My assets:

http://prntscr.com/d6x2hy

 

Am trying to put this in a github so you guys can more easily see what's going on.

 

Thanks for your time.

Not new to java >> New to modding.

Posted

okay: so now i kinda know whats the problem, just dont know how to fix it..

 

So I can manually make a resource location for the item and it will work, so im guessing it has to do something with:

@Override
public void registerItemModel(Item item) {
	PlentifulMisc.proxy.registerItemRenderer(item, 0, "pmcheese");
}

 

Because this worked:

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

Not new to java >> New to modding.

Posted

Well...."pmcheese" isn't equal to cheese.getRegistryName()

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.

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.