Jump to content

Recommended Posts

Posted

I'm getting a bit of a strange error now.

package goocraft4evr.expand_goocraft;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import com.goocraft.mod.items.ModItems;
import com.goocraft.mod.proxy.ServerProxy;

@Mod(modid=Main.MODID,version=Main.VERSION,name=Main.NAME,acceptedMinecraftVersions="[1.12.2]")
public class Main {
	public static final String MODID = "goocraft_mod";
	public static final String VERSION = "1.0";
	public static final String NAME = "Goocraft4Evr's Expansionary Goodstuffs";
	
	@Instance(MODID)
	public Main instance;
	
	@SidedProxy(clientSide = "goocraft4evr.expand_goocraft.proxy.Client_Proxy",serverSide = "goocraft4evr.expand_goocraft.proxy.Server_Proxy")
	public static ServerProxy proxy;
	
	@EventHandler
	public void preInit(FMLPreInitializationEvent event) {
		ModItems.init();
		proxy.preInit(event);
	}
	
	@EventHandler
	public void init(FMLInitializationEvent event) {
		proxy.init(event);
	}
	
	@EventHandler
	public void postInit(FMLPostInitializationEvent event) {
		proxy.postInit(event);
	}
}

this is the entirety of my Main class. For some reason, classes like ModItems and ServyProxy are undefined.

299683055_weirderror.png.110b1f424089b7fc6feeb999cfd4b5d5.png

There's my hierarchy above.

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted
Just now, SeptemberBlue said:

this is the entirety of my Main class. For some reason, classes like ModItems and ServyProxy are undefined.

Your imports aren't correct.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Now my problem is that I can't get my item to show up in my inventory (since I had to redo the whole mod thing, I've decided to start with an item then once that's done I'd do the ore and whatever)

 

Where should I look first?

Posted
Just now, Animefan8888 said:

What?

To be more specific, I'm wondering what java class would be responsible for why the items aren't showing up. To make it easier though, I'll just paste the code for these.

 

ModItem:

package goocraft4evr.expand_goocraft.items;

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

public class ModItem extends Item {

	public ModItem(String name) {
		this.setRegistryName(name);
		this.setUnlocalizedName(name);
		this.setCreativeTab(CreativeTabs.MATERIALS);
		ModItems.ITEMS.add(this);
	}
}

ModItems:

package goocraft4evr.expand_goocraft.items;

import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.Item;

public class ModItems {
	
	public static final List<Item> ITEMS = new ArrayList<Item>();
	
	public static void init() {
		new ModItem("Amethyst");
	}
}

RegistryHandler:

package goocraft4evr.expand_goocraft;

import goocraft4evr.expand_goocraft.items.ModItems;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
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.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) {
			ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(),null));
		}
	}
}

The Main method might also be relevant, but I've already posted that and it hasn't been changed.

Posted
1 minute ago, SeptemberBlue said:

@SubscribeEvent

public static void onItemRegister(RegistryEvent.Register<Item> event) {

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

}

You need to call ModItems.init at the beginning of this.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
Just now, Animefan8888 said:

Yes at the top of it.

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

I tried this but the item didn't show up. Unless you wanted it outside the method, like above the @SubscribeEvent thing.

 

I also thought I'd mention that I also have the item lang, textures and json set up in the res folder.

Posted
11 minutes ago, SeptemberBlue said:

I tried this but the item didn't show up. Unless you wanted it outside the method, like above the @SubscribeEvent thing.

What you have is what I meant. Is there anything in the console. Make the string lower case here aka "amethyst"

new ModItem("Amethyst");

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
2 minutes ago, Animefan8888 said:

What you have is what I meant. Is there anything in the console. Make the string lower case here aka "amethyst"


new ModItem("Amethyst");

By the looks of it, there's no mention of the item in the console.

Posted
4 minutes ago, SeptemberBlue said:

By the looks of it, there's no mention of the item in the console.

Put a System.out.println in your registry method to see if it is called.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
6 minutes ago, Animefan8888 said:

Is your mod loading check the mods list on the main menu.

Two things. First off, the mod doesn't seem to have anything set. It's still called example mod, despite the name, version, modid and whatnot set in the Main class.

 

The other thing is that the mod's disabled.

 

EDIT: I'll wait and see if I get this resolved, but if not, I'll just go back to the tutorial I used first and use the code from that to create functional items, as whatever code I have now clearly does not work, and I don't really know why either.

Edited by SeptemberBlue
Posted
2 minutes ago, SeptemberBlue said:

The other thing is that the mod's disabled.

Ok your mod isn't being loaded. You need to right click on the forge project Build Path->Configure Build Path->Order and Export->Select All->Apply and Close

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
Just now, Animefan8888 said:

Ok your mod isn't being loaded. You need to right click on the forge project Build Path->Configure Build Path->Order and Export->Select All->Apply and Close

already did it, one of the first steps of your tutorial.

Posted (edited)

So I've gone and redone my code again, and I'm looking at the code for my registryhandler class.

@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event) {
		for (Item item:ModItems.ITEMS) {
			Main.proxy.registerItemRenderer(item, 0, "inventory");
		}
		for (Block block:ModBlocks.BLOCKS) {
			Main.proxy.registerItemRenderer(Item.getItemFromBlock(block), 0, "inventory");
		}
	}

Is there a better way to rewrite this code or is this fine?

 

EDIT: So I was working on my block, and while it does appear in the creative inventory, it's missing an inventory texture and its texture when dropped as an item (which I'm assuming is the same texture for the item when its held, as that is also missing). The block has the correct texture though when placed. I'm certain the json files are correct, so I'm not too sure at the moment what the issue would be.

Edited by SeptemberBlue
added the block for loop.
Posted

Look at (and/or post) your logs.

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)
17 minutes ago, Draco18s said:

Look at (and/or post) your logs.

Logs being the text in the console, right?

 

EDIT:

[13:29:09] [main/ERROR] [FML]: Exception loading model for variant geg:amethyst_ore#inventory for item "geg:amethyst_ore", blockstate location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model geg:amethyst_ore#inventory with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:296) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_222]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]

 

EDIT:

@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 onBlockRegister(RegistryEvent.Register<Block> event) {
		event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0]));
	}
	
	@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event) {
		for (Item item:ModItems.ITEMS) {
			Main.proxy.registerItemRenderer(item, 0, "inventory");
		}
		for (Block block:ModBlocks.BLOCKS) {
			Main.proxy.registerItemRenderer(Item.getItemFromBlock(block), 0, "inventory");
		}
	}
}

Here's my registry class, if this is any help.

Edited by SeptemberBlue
Posted
22 minutes ago, SeptemberBlue said:

Exception loading model for variant geg:amethyst_ore#inventory for item "geg:amethyst_ore"

Look under this, see if there's another error starting with Caused By:

 

Also post your json files.

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
2 minutes ago, Draco18s said:

Look under this, see if there's another error starting with Caused By:

 

Also post your json files.

all json files are named "amethyst_ore.json"

blockstates:

{
    "variants": {
        "normal": { "model": "geg:amethyst_ore" }
    }
}

block model:

{
   "parent": "block/cube_all",
   "textures": {
       "all": "geg:blocks/amethyst_ore"
   }
}

item model:

{
   "parent": "geg:block/amethyst_ore"
}

 

also, here's this:

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

 

Posted
1 hour ago, SeptemberBlue said:

variant geg:amethyst_ore#inventory

You don't have this.

 

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/resources/assets/harderores/blockstates/ore_limonite.json#L11-L16

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)
15 minutes ago, Draco18s said:

EDIT: Alright, fixed blockstates. I'll just tweak it a bit, since I currently find it too cluttered.

EDIT 2: Maybe it's just me, but when I run client, it feels like it's running more slowly than before. Should this concern me or no? If so, I think it has something to do with how I'm registering stuff.

 

Speaking of which, do you just have 1 json per block? Because the 3 jsons I posted above were 3 seperate jsons.

Edited by SeptemberBlue

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




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I hosted forge modded server using feather client I was able to join without any issues yesterday, but today after I tested my shader on my single world then tried to join the world but it made error meassage. (I also changed server.properties's render settings, but I reverted it as same as yesterday) So I removed my shader and removed optifine on server and on my mod file then it made this error: Internal Exception: io.netty.handler.codec.DecoderException: net.minecraft.ResourceLocationException: Non [a-z0-9/-1 character in path of location: inecraft:ask_server\u0012\u0001\uFFFD\n\u0007targets\u001D\u0001\u0014minecraft:ask_server\u0012\u0002\uFFFD\n\uFFFD\n\u0002id!\u0014minecraft:ask_server\u0002 \u0001\uFFFD\n\u0006target\u0006\u0001\u0002\u0001\uFFFD\n\ttarget My server/client is 1.20.1 forge. And I got 34 mods total, it was working pretty fine yesterday (I did not add/remove any mods before it started happening) I hope it's not about my worlds, it's been quite long since using this world I'm not native english speaker so there may be grammar issue! Thank you for reading!
    • I run a forge server with a bunch of mods that randomly started having extreme tick problems. I have no clue on how to or where to start reading this crash report, so some help would be greatly appreciated. I've tried changing max tick time to -1 in server.properties, and this did stop the server from crashing, but there's no point in playing as every action in-game takes several seconds to execute.   log: https://pastebin.com/UjQ6G5A4 crash report:  https://pastebin.com/RDZmpYMD
    • bruh this is silly, it wount let me delete.
    • So am trying to make a custom 1.19.2 modpack and everything works until I add Oculus. I have tried Oculus+Embedium and Oculus+Rubdium and by themselves they work but as soon as I add anything it crashes no matter what it is. The modpack works fine with just Embedium and Rubdium. Can you help me to see if this is something i can fix or do i just have to deal with not having shaders. Here is the crash log. Thank you for your time. https://paste.ee/p/WXfNZ24K
    • What do I do now when it says "1 error"?
  • Topics

×
×
  • Create New...

Important Information

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