Jump to content

Recommended Posts

Posted

I've followed every tutorial I could find, mainly the one by MrCrayfish, and everything still renders as a purple and black block.

There are no "missing texture" errors like there was in 1.7.10 but I dunno if that was just removed in 1.8 or not for the new rendering system.

 

I dunno where the problem is so I'll just post everything...

 

Main class

@Mod(modid = This.modid, version = This.version)
public class This
{
    public static final String modid = "oregenesis";
    public static final String version = "1.0";
    
    @SidedProxy(clientSide = "eiw.oregenesis.network.ClientProxy", serverSide = "eiw.oregenesis.network.ServerProxy")
    public static ServerProxy proxy;

    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
    	RegItems.register();
    	RegBlocks.register();
    	
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	proxy.renderContent();
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event)
    {
    	
    }
}

 

Item registry

public class RegItems
{
public static Item ingot_copper;

public static void register()
{
	ingot_copper = new ModItem(1F).setUnlocalizedName("ingot_copper");
	GameRegistry.registerItem(ingot_copper, ingot_copper.getUnlocalizedName().substring(5));
}

public static void render()
{
	rr(ingot_copper);
}

public static void rr(Item item)
{
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(This.modid + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

 

Block Registry

public class RegBlocks
{
public static Block ore_copper;

public static void register()
{
	ore_copper = new BlockOre(ore_copper).setUnlocalizedName("ore_copper");
	GameRegistry.registerBlock(ore_copper, ore_copper.getUnlocalizedName().substring(5));
}

public static void render()
{
	rr(ore_copper);
}

public static void rr(Block block)
{
	Item item = Item.getItemFromBlock(block);
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(This.modid + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
}

 

ClientProxy

public class ClientProxy extends ServerProxy
{

public static void renderContent()
{
	RegItems.render();
	RegBlocks.render();
}
}

 

======================================================================

 

Item .json for the ingot

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

 

Item model .json for the ore block

{
    "parent": "oregenesis:block/ore_copper",
    "display": {
        "thirdperson": {
            "rotation": [ 10, -45, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        }
    }
}

 

Blockstate .json for the ore block

{
    "variants": {
        "normal": { "model": "oregenesis:ore_copper" }
    }
}

 

Block model .json for the ore block

{
    "parent": "block/cube_all",
    "textures": {
        "all": "oregenesis:blocks/ore_copper"
    }
}

Posted

Isn't what's in that method required in 1.8?

 

I don't see what my item/block classes have to do with anything, but here:

 

ModItem

public class ModItem extends Item
{
public static float weight;

public ModItem(float weight)
{
	this.weight = weight;
	this.setCreativeTab(Tabs.oItems);
}
}

 

ModBlock

public class ModBlock extends Block
{
public ModBlock()
{
	super(Material.rock);
	this.setCreativeTab(Tabs.oBlocks);
}
}

 

BlockOre

public class BlockOre extends ModBlock
{
public static Item dropped;
public static Block blockDropped;
public static int amount, exp;

public BlockOre(Item dropped, int exp)
{
	this.dropped = dropped;
	this.amount = 1;
	this.exp = exp;
}
public BlockOre(Item dropped, int amount, int exp)
{
	this.dropped = dropped;
	this.amount = amount;
	this.exp = exp;
}
public BlockOre(Block blockDropped)
{
	this.blockDropped = blockDropped;
	this.amount = 1;
	this.exp = 0;
}

@Override
    public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune)
    {
        return this.exp;
    }
@Override
    public int quantityDropped(Random random)
    {
        return this.amount;
    }
@Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
    {
	if(dropped != null)
	{
		return dropped;
	}
	else if(blockDropped != null)
	{
		return Item.getItemFromBlock(blockDropped);
	}
        return Item.getItemFromBlock(this);
    }
@Override
    public int quantityDroppedWithBonus(int fortune, Random random)
    {
        return this.amount + random.nextInt(fortune);
    }
}

Posted

Isn't what's in that method required in 1.8?

 

I don't see what my item/block classes have to do with anything, but here:

Yes, the contents of the method are required, but you already have your 'render' method (poorly named, btw - it is not 'rendering' anything, it is registering resources to be used later in rendering), so why have that method if all it does is call another method? Just put the code in one method, and call that.

 

Your Block class especially is important because you may have had different IBlockStates, in which case your .json file would have been wrong.

 

Anyway, your .json files all look correct - TheGreyGhost's troubleshooting guide is quite comprehensive; if you can't find what you need in there, read it again. Seriously. It describes 99.99% of all texture troubles.

 

If that still doesn't help, update to the latest version of Forge, start Minecraft, and look again at the console output - there should most definitely be something in there describing the problem.

Posted

Apparently the problem was that I stupidly didn't add the ".json" extenstion to the files...

 

Now the block has its texture in the world, but the both block and item models in hand do not.

The only error in the console is this, which I'm assuming is totally unrelated:

 

[pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@1763a8a1[id=9a0ac3e8-2a19-3175-bbea-119d15dbea78,name=Player94,properties={},legacy=false]

 

 

According to that guide, it suggests a missing model. But it's not missing, or incorrectly named...is it?

 

GTk3EdR.png

Posted

Hi

 

Try putting a breakpoint here

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

 

and seeing whether it gets added to the registry properly.  Your item or  item name may not be what you expect.

 

-TGG

Posted

Hi

His code is fine if he wants to put it in a seperate method...its still going to be called regardless. Anyway, I don't really see a problem in your code (quick skim through it), I think you should be looking more into your .JSON model to see if all the code is correct there, its really easy to mess that up. Remember this (I'm not saying your code is wrong) - Item Class[Registers your items and contains methods to invoke the rendering], ClientProxy[Calls the static method that contains the rendering], Main[Calls the registerRender() method (or whatever you called the method) to actually execute the code - remember to not call this in the pre-initialization event or you will crash]. With all this remember to make sure your modID is the same everywhere, I recommend keeping a constant storing your modID in your Main or some reference class to keep things organized and to ensure the same modID when called every time. Lastly, please check that your package structure in your resources is correct and that the modID is the same there. Hope that helps!

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

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.