Jump to content

Recommended Posts

Posted (edited)

 

Hi, Like usual im having problems with paths and models/textures.....

 

All my code:

Spoiler

 

Main file


package com.MODID;

import com.MODID.blocks.BlockBase;
import com.MODID.proxy.CommonProxy;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
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.registry.GameRegistry;

@Mod(modid = Refs.MODID, version = Refs.VERSION)
public class MODID
{
	public static CreativeTabs CTMODID = new CreativeTabs(null){

		@Override
		public ItemStack getTabIconItem() {
			return new ItemStack(Item.getItemFromBlock(BlockBase.BlockFoo));
		}
		
	};
	public CommonProxy proxy = new CommonProxy();
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
      proxy.preInit(event);
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
      proxy.init(event);
    }
    
    public void postInit(FMLPostInitializationEvent event)
    {
      proxy.postInit(event);
    }
    
}

 

Registry Utilities


package com.MODID;

import com.MODID.blocks.BlockBase;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;

public class RegUt 
{
	public static void registerAll(FMLPreInitializationEvent event)
    {
      registerBlocks(event, BlockBase.BlockFoo);
    }
	
	public static void registerBlocks(FMLPreInitializationEvent event, Block ... blocks)
    {
      for(Block b : blocks)
      {
    	  final ItemBlock i = new ItemBlock(b);
    	  b.setCreativeTab(EksDee.CTbar);
    	  if(event.getSide() == Side.CLIENT)
    	  {
    		  GameRegistry.register(b);
    		  GameRegistry.register(i, b.getRegistryName());
    		  ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), 0, new ModelResourceLocation(b.getRegistryName(), "inventory"));
    		  
    	  }
      }
    }
	
	public static void registerItems(FMLPreInitializationEvent event, Item ...items )
	{
		for(Item i : items)
	      {
			i.setCreativeTab(EksDee.CTbar);
			if(event.getSide() == Side.CLIENT)
				{
					GameRegistry.register(i);
	    		  GameRegistry.register(i, i.getRegistryName());
	    		  ModelLoader.setCustomModelResourceLocation(i, 0, new ModelResourceLocation(i.getRegistryName(), "normal"));
	    	  }
	      }
	}
}

 

 

References


package com.MODID;

public class Refs 
{
	public static final String MODID = "MODID";
    public static final String VERSION = "1.0";
    public static final String CLIENT_PROXY = "com.MODID.ClientProxy";
    public static final String COMMON_PROXY = "com.MODID.CommonProxy";
}

 

 

Common Proxy


package com.MODID.proxy;

import com.MODID.RegUt;

import net.minecraftforge.fml.common.event.*;


public class CommonProxy 
{
	public void preInit(FMLPreInitializationEvent event)
	{
		RegUt.registerAll(event);
	}
	public void init(FMLInitializationEvent event)
	{	
	}
	public void postInit(FMLPostInitializationEvent event)
	{
	}
	public void serverStarting(FMLServerStartingEvent event)
	{
	}
	public void serverStopping(FMLServerStoppingEvent event) 
	{
	}
}

 

ClientProxy


package com.MODID.proxy;

import com.MODID.RegUt;

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;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;

public class ClientProxy extends CommonProxy 
{

	@Override
	public void preInit(FMLPreInitializationEvent event) {
		super.preInit(event);
	}

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

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

	@Override
	public void serverStarting(FMLServerStartingEvent event) {
		// TODO Auto-generated method stub
		super.serverStarting(event);
	}

	@Override
	public void serverStopping(FMLServerStoppingEvent event) {
		super.serverStopping(event);
	}
	
}

 

Blockbase


package com.MODID.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;

public class BlockBase {
	public static Block BlockFoo = new Block(Material.CLAY).setHardness(100f).setLightOpacity(0).setLightLevel(100f).setRegistryName("fooblock");
	public static Item ItemFoo = new Item().setRegistryName("foo");
}

 

Json files:

 

blockstates\fooblock.json


{
    "variants": {
        "normal": [
            { "model": "MODID:fooblock" },
            { "model": "MODID:fooblock", "y": 90 },
            { "model": "MODID:fooblock", "y": 180 },
            { "model": "MODID:fooblock", "y": 270 }
        ]
    }
}

 

 

models\block\fooblock.json


{
    "parent": "block/cube_all",
    "textures": {
        "all": "textures/fooblock"
    }
}

 

all my files seem to match but what I get

is a black purple block with this written on it:

Quote

MODID:fooblock#Inventory

texture, model & blockstate paths

src\main\resources\assets\MODID\blockstates\fooblock.json

src\main\resources\assets\MODID\models\block\fooblock.json

src\main\resources\assets\MODID\textures\block\fooblock.jpg

 

 

 

Edited by Delupara

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted (edited)

You need to include your mod ID as the domain of the model and texture paths, i.e. "<modid>:<model_name>" and "<modid>:<texture_path>".

 

Textures need to in PNG format, not JPEG.

 

Is the block called fooblock or memeblock? Your files are apparently called fooblock, but the blockstates file uses the memeblock.json model and the model uses the memeblock.png texture.

 

In future, the FML log (logs/fml-client-latest.log in the game directory) will tell you why models/textures failed to load. If you don't know how to interpret the errors, post the full log using Gist or Pastebin when asking for help.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)
3 hours ago, Choonster said:

You need to include your mod ID as the domain of the model and texture paths, i.e. "<modid>:<model_name>" and "<modid>:<texture_path>".

 

Textures need to in PNG format, not JPEG.

 

Is the block called fooblock or memeblock? Your files are apparently called fooblock, but the blockstates file uses the memeblock.json model and the model uses the memeblock.png texture.

 

In future, the FML log (logs/fml-client-latest.log in the game directory) will tell you why models/textures failed to load. If you don't know how to interpret the errors, post the full log using Gist or Pastebin when asking for help.

Its memeblock but for example sake I did that. 

 

I edited main post registry utilities to include Mod ID
Same issue now the text on the block reads MODID:MODID:fooblock#inventory.

 

as for my log I dont think I can see it, here is the link to it and tell me what you think


 

Edited by Delupara

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted
36 minutes ago, Delupara said:

as for my log I dont think I can see it, here is the link to it and tell me what you think

There are no errors in that log. The AuthenticationException is because you aren't using a real MC account and Minecraft.net isn't logging  you in. That's normal.

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.

Posted (edited)
1 hour ago, Delupara said:

I edited main post registry utilities to include Mod ID
Same issue now the text on the block reads MODID:MODID:fooblock#inventory.

 

You needed to change the blockstates file and the model, not the registration class.

 

RegUt.registerBlocks and RegUt.regItems are broken since they only register the Blocks/Items on the physical client, but this needs to happen on both physical sides. Model registration must be done in a separate client-only class to avoid crashing the dedicated server.

 

You should be using registry events instead of registering things in preInit. GameRegistry.register is no longer accessible in 1.12, so this will make it easier to update.

 

The log you linked isn't the FML log.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)
4 hours ago, Draco18s said:

There are no errors in that log. The AuthenticationException is because you aren't using a real MC account and Minecraft.net isn't logging  you in. That's normal.

Yeah I kind of realised that mate, just showed him because, well for one there were no errors and then maybe I could of missed something. Never hurt!

4 hours ago, Choonster said:

 

You needed to change the blockstates file and the model, not the registration class.

 

RegUt.registerBlocks and RegUt.regItems are broken since they only register the Blocks/Items on the physical client, but this needs to happen on both physical sides. Model registration must be done in a separate client-only class to avoid crashing the dedicated server.

 

You should be using registry events instead of registering things in preInit. GameRegistry.register is no longer accessible in 1.12, so this will make it easier to update.

 

The log you linked isn't the FML log.

Well Idk what log it is because it came straight from the path you specified. Named lastest.log

EDIT: I took the wrong file, my bad.

EDIT: here is the real log

 

Also Im not entire sure I understood you, but I changed back the registration and modified my JSON files in the main post. The error is persisting probably because like I said I missunderstood you.

Edited by Delupara

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted

MODID:fooblock#normal for blockstate "MODID:fooblock"

Caused by: java.io.FileNotFoundException: MODID:blockstates/fooblock.json

 

Also, if MODID is your actual mod ID, it is both a bad name and capitalized. It must be all lower case.

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.

Posted (edited)
3 hours ago, Draco18s said:

MODID:fooblock#normal for blockstate "MODID:fooblock"

Caused by: java.io.FileNotFoundException: MODID:blockstates/fooblock.json

 

Also, if MODID is your actual mod ID, it is both a bad name and capitalized. It must be all lower case.

Hmmm, Still doesn't work, and I'm not too familiar with the error I picked up

 

Quote

[14:44:16] [Client thread/ERROR] [FML/]: Exception loading model for variant MODID:fooblock#normal for blockstate "MODID:fooblock" and for item "MODID:fooblock", normal location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model MODID:item/fooblock with loader VanillaLoader.INSTANCE, skipping
    at net.minecraftforge.client.model.ModelLoaderRegistry.getModel

no, MODID isn't my actuall mod id

Edited only 1 file on main post: registry utilities 

Edited by Delupara

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

Posted

"Exception loading model for variant" is a generic error that wraps around an underlying cause.

The cause in this case is a missing file exception:

 

Caused by: java.io.FileNotFoundException: MODID:blockstates/fooblock.json

Caused by: java.io.FileNotFoundException: MODID:models/item/fooblock.json

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.

Posted
3 hours ago, Draco18s said:

"Exception loading model for variant" is a generic error that wraps around an underlying cause.

The cause in this case is a missing file exception:

 

Caused by: java.io.FileNotFoundException: MODID:blockstates/fooblock.json

Caused by: java.io.FileNotFoundException: MODID:models/item/fooblock.json

I still dont get it, How cant it find the files??? ffs this path system is so annoying please help me :(

When they say your code doesn't follow convention but ur edgy so u dont care

d-d-d-dab on them haterz

 

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.