Jump to content

Recommended Posts

Posted (edited)

hello.

i am a beginer in forge mod making and i wanted to code a chest with a custom size i achieved it but when i hold my item in my hand it's a big cube with purple and black square(missing texure) bug i don't have message in the logs about a missing blockstate nor textures all i have is the big buggy item here is a screen shot

 

 

2019-11-10_13.52.39.png

 

you can find my code here

https://github.com/Gamerstone/FFactory

 

sorry bad english im not a native speaker and thanks in advance

Edited by Marcb barbier Gamerstone
no name put
Posted (edited)

That's because you just copy-pasted what I put there..

Caused by: java.io.FileNotFoundException: modid:models/block.json

 

You have to put YOUR modid where modid is, and YOUR block name where block is.

{
	"parent": "ffactory:block/copper_chest"
}

for example... ^

Edited by MSpace-Dev
  • Like 1
Posted (edited)

oh you right sorry for that

i applied your fix there no more error in the logs but

i still have the render bug

 

Edit: i just updated the github with the fix still have the render bug tho

Edit2: its like the file is read (because i have the error without it) and it's not used even when i had the code for a simple 2d item it was still rendering the big cube

Edited by Marcb barbier Gamerstone
Posted (edited)

Problematic Code #1, Code Style #1, #2, #3, #4

 

Your chests aren't instances of IHasModel, so their Item models aren't being registered.

(It's almost like IHasModel is useless because all Blocks and Items need models!)

Even if they were, you've commented out the registerModels code in the copper chest anyways, which probably wouldn't help matters.

 

Edit: You'll also have a rather brown-looking iron chest, since you just copied the copper chest's Json over to the iron one.

Edited by SerpentDagger
  • Like 1
  • Thanks 1

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Posted (edited)

Do not make your classes implement IHasBlockModel.Refer here. (Code-Style, #3)

Register your items/blocks like this instead.

 

@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event)
{
	event.getRegistry().registerAll(ModBlocks.BLOCKS);
	Utils.getLogger().info("Blocks Registered");
}

@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event)
{
	event.getRegistry().registerAll(ModItems.ITEMS);

	for (Block block : ModBlocks.BLOCKS)
	{
		event.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName()).setUnlocalizedName(block.getUnlocalizedName()));
	}

	Utils.getLogger().info("Items Registered");
}

@SubscribeEvent
public static void registerModels(ModelRegistryEvent event)
{
	for (Block block : ModBlocks.BLOCKS)
	{
		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
	}

	for (Item item : ModItems.ITEMS)
	{
		ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
	}

	Utils.getLogger().info("Models Registered");
}

 

Edited by MSpace-Dev
Code formatting
  • Thanks 1

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.