Jump to content

Stenbergcsgo

Members
  • Posts

    62
  • Joined

  • Last visited

Everything posted by Stenbergcsgo

  1. 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.
  2. 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 =)
  3. 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
  4. 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[]
  5. Where do I put ItemPaste? Init or items?
  6. Is that bad?
  7. Yea I'm pretty new to the minecraft modding, so I'm a bit unsure about some of the functions. I've been following Loremaster's tutorials: , so some of the functions go unexplained. :-(
  8. 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"); } }
  9. More project info IGN Image: 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(); }
  10. Yea this is my json for the schematic_sign: { "parent": "item/generated", "textures": { "layer0": "um:items/schematic_sign" } }
  11. Hey, I've managed to create following project: 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 =)
×
×
  • Create New...

Important Information

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