Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

Looks like an asset problem.

https://github.com/Gamerstone/FFactory/blob/master/resources/assets/ffactory/models/item/copper_chest.json#L1-L6

https://github.com/Gamerstone/FFactory/blob/master/resources/assets/ffactory/models/item/iron_chest.json#L1-L6

 

Your item model JSON can simply be: (For blocks!)

{
	"parent": "modid:block"
}

 

If it's an item texture, then your current method is just fine.

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

  • Author

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

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

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

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

  • Author

Thank you a lot i will try that as soon as I can

And I will also try fix all of the code style error

 

For the iron chest I did just copied the code from the copper one I would have fixed it if I had seen the chest workin

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.