Jump to content

Recommended Posts

Posted

Hey, I've managed to create following project:

J3WJsqj.png

By following Loremaster's tutorials. I'm currently at the "create a custom item" phase, but my items get texture errors:

12:27:42] [main/ERROR] [TEXTURE ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
[12:27:42] [main/ERROR] [TEXTURE ERRORS]: The following texture errors were found.
[12:27:42] [main/ERROR] [TEXTURE ERRORS]: ==================================================
[12:27:42] [main/ERROR] [TEXTURE ERRORS]:   DOMAIN um
[12:27:42] [main/ERROR] [TEXTURE ERRORS]: --------------------------------------------------
[12:27:42] [main/ERROR] [TEXTURE ERRORS]:   domain um is missing 2 textures
[12:27:42] [main/ERROR] [TEXTURE ERRORS]:     domain um has 1 location:
[12:27:42] [main/ERROR] [TEXTURE ERRORS]:       mod um resources at C:\Users\Frederik\Desktop\WorkspaceUno\Mod\bin
[12:27:42] [main/ERROR] [TEXTURE ERRORS]: -------------------------
[12:27:42] [main/ERROR] [TEXTURE ERRORS]:     The missing resources for domain um are:
[12:27:42] [main/ERROR] [TEXTURE ERRORS]:       textures/items/schematic_sign.png.png
[12:27:42] [main/ERROR] [TEXTURE ERRORS]:       textures/items/paste.png.png
[12:27:42] [main/ERROR] [TEXTURE ERRORS]: -------------------------
[12:27:42] [main/ERROR] [TEXTURE ERRORS]:     No other errors exist for domain um
[12:27:42] [main/ERROR] [TEXTURE ERRORS]: ==================================================

As the error suggest I do believe it might be path or name related, but after triple-checking it seems like it's either not that, or I've stared myself blind. I checked the MOD_ID and it is properly put to "um", and all the naming seem to be as it should. Are there any other reasons this could happen? Hopefully someone can spot something, thank you =)

Posted (edited)

1) 

textures/items/schematic_sign.png.png

has two file endings, is this intended?

 

2) You shouldn't add file endings to your json files (don't know if your doing this, the forge log could just be being specific)

 

3)are you prefixing your texture locations with <MODID>:<PATH>

for example my mod's id is wiptech

{
    "parent": "item/generated",
    "textures": {
        "layer0": "wiptech:items/copper_ingot"
    },
    "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]
        }
    }
}

 

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

If that doesn't fix the problem, please post In-game screenshots, the contents of paste.json and your item registration and model registration code 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

More project info

IGN Image:

MjFPeW9.png

 

RegistryHandler.java:

package com.mta.utzonmod.util.handlers;

import com.mta.utzonmod.init.ModItems;
import com.mta.utzonmod.util.IHasModel;

import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@EventBusSubscriber
public class RegistryHandler {
	@SubscribeEvent
	public static void onItemRegister(RegistryEvent.Register<Item> event) {
		event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0]));
	}
	
	@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event) {
		for(Item item : ModItems.ITEMS) {
			if(item instanceof IHasModel) {
				((IHasModel)item).registerModels();
			}
		}
	}
}

 

IHasModel.java:

package com.mta.utzonmod.util;

public interface IHasModel {
	public void registerModels();
}

 

Posted (edited)
2 minutes ago, Stenbergcsgo said:

((IHasModel)item).registerModels();

 

2 minutes ago, Stenbergcsgo said:

registerModels();

and this does... what?

please post that code

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

This is how I do it

 

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

		for (Item item: Items.ITEMS)
		{
			if(!item.getHasSubtypes()) {
				ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
			} else {
              //register items with subtypes
            }
        }
}

 

Blocks is a Block[] with all my blocks in it and Items is an Item[] with all my items in it

 

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Code from ItemBase.java overriding the registerModels() function from the IHasModel interface:

package com.mta.utzonmod.items;

import com.mta.utzonmod.Main;
import com.mta.utzonmod.init.ModItems;
import com.mta.utzonmod.util.IHasModel;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class ItemBase extends Item implements IHasModel {

	public ItemBase(String name) {
		setUnlocalizedName(name);
		setRegistryName(name);
		setCreativeTab(CreativeTabs.MISC);
		
		ModItems.ITEMS.add(this);
	}
	
	@Override
	public void registerModels() {
		
		Main.proxy.registerItemRenderer(this, 0, "inventory");
		
	}
	
}

 

Posted
6 minutes ago, Stenbergcsgo said:

Main.proxy.registerItemRenderer(this, 0, "inventory");

this code?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Oh no, they register stuff inside the item class...

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

ItemBase.java

package com.mta.utzonmod.item;
import com.mta.utzonmod.Reference;
import net.minecraft.item.Item;
public class ItemBase extends Item
{
    
    public ItemBase(String name)
    {
        super();
        
        this.setRegistryName(Reference.ID, name);
        this.setUnlocalizedName(name);
    }
      
}

 

ItemPaste.java

package com.mta.utzonmod.item;

public class ItemPaste extends ItemBase
{
	public ItemPaste(String name)
	{
		super(name);
	}
}

 

ModItems.java

package com.mta.utzonmod.init;

import com.mta.utzonmod.item.ItemPaste;
import net.minecraft.item.Item;

public class ModItems {
  public static final ItemPaste PASTE = new ItemPaste("paste");
  
  public static final Item[] ITEMS = {
    PASTE,
  };
  
}

 

Client Registry Class (Client Proxy or similar)

 

@Mod.EventBusSubscriber
public class CLIENT_PROXY_CLASS extends COMMON_PROXY_CLASS_OR_SIMILAR
{
  @SubscribeEvent
    public static void registerModels(ModelRegistryEvent event)
  {
    for (Item item: Items.ITEMS)
    {
      if(!item.getHasSubtypes()) {
        ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
      } else {
        //do stuff
      }
    }
  }
}

 

Edited by Cadiboo
Cleaned up code

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
7 minutes ago, Stenbergcsgo said:

Is that bad?

I'm not sure if its actually that bad, but I know that it leads to less clean code and lots of copy/pasted & repetitive code

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
package com.mta.utzonmod.item;

public class ItemPaste extends ItemBase
{
	public ItemPaste(String name)
	{
		super(name);
	}
}

 

package com.mta.utzonmod.item;

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Thanks for your code suggestion, I tried to converting to that, but I am now getting a few errors:

ClientProxy.java:

package com.mta.utzonmod.proxy;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Mod.EventBusSubscriber
public class ClientProxy extends CommonProxy {
	@SubscribeEvent
	public static void registerModels(ModelRegistryEvent event)
	{
		for (Item item: Items.ITEMS)
		{
			if(!item.getHasSubtypes()) {
				ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
			} else {
//do stuff
}
}
}
}

Error: 

ITEMS can not be resolved or is not a field

 

and my RegistryHandler.java:

package com.mta.utzonmod.util.handlers;

import com.mta.utzonmod.init.ModItems;
import com.mta.utzonmod.util.IHasModel;

import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@EventBusSubscriber
public class RegistryHandler {
	@SubscribeEvent
	public static void onItemRegister(RegistryEvent.Register<Item> event) {
		event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0]));
	}
	
	@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event) {
		for(Item item : ModItems.ITEMS) {
			if(item instanceof IHasModel) {
				((IHasModel)item).registerModels();
			}
		}
	}
}

Where I get the error: 

Cannot invoke toArray(Item[]) on the array type Item[]

 

Posted
5 minutes ago, Stenbergcsgo said:

@SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for(Item item : ModItems.ITEMS) { if(item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } }

Remove this from RegistryHandleer

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
@Mod.EventBusSubscriber
public class COMMON_PROXY_OR_SIMILAR {
  @SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event)
  {	
    event.getRegistry().registerAll(Items.ITEMS);
  }
}

 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

Please keep in mind that all of this is how I do it, It might not be the best way, but it looks clean and I can't find any problems with it.

 

For me, my common proxy is a mix of RegistryHandler and Common Proxy, and my Client Proxy is pretty much only used for registering models and renders etc

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

My classes are currently as such:

ClientProxy.java:
 

package com.mta.utzonmod.proxy;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Mod.EventBusSubscriber
public class ClientProxy extends CommonProxy {
	@SubscribeEvent
    public static void registerItems(RegistryEvent.Register<Item> event)
  {	
    event.getRegistry().registerAll(Items.ITEMS);
  }
}

and RegistryHandler.java:
 

package com.mta.utzonmod.util.handlers;

import com.mta.utzonmod.init.ModItems;
import com.mta.utzonmod.util.IHasModel;

import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@EventBusSubscriber
public class RegistryHandler {
	@SubscribeEvent
	public static void onItemRegister(RegistryEvent.Register<Item> event) {
		event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0]));
	}
}

however with same errors

Posted

I don't mind changing the method. My goal is to create a rather simple mod containing 3 custom items that hopefully should end up parsing strings. So it doesn't have to be anything too fancy, just want it to work =)

Posted (edited)
4 minutes ago, Stenbergcsgo said:

event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0]));

WHY WHY WHY

NO NO NO

should have seen this earlier

This fails so many ways

1) apparently cant event turn ModItems.ITEMS into an array

maybe because it has to be used like this ModItems.ITEMS.toArray() with nothing inside the ()

2) No idea what it would try to do with (new Item[0]), but it would fail absolutely horribly and fatally.

Do you know java or any other Object Oriented language? if so you will know that toArray(new Item[0]) is completely non-sensical and guaranteed to crash everything

 

event.getRegistry().registerAll(ModItems.ITEMS);

 

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Should I also change the 

 event.getRegistry().registerAll(Items.ITEMS);

to 

 event.getRegistry().registerAll(ModItems.ITEMS);

in the ClientProxy.java?

 

Just tried doing so, and now the errors are gone, but the items doesn't load at all.

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.