The Meaning of Life, the Universe, and Everything.
Location:
The Void
Join Date:
5/5/2015
Posts:
118
Member Details
I've recently just added blocks to my mod and whenever I try to launch it from Eclipse it starts and gives me the following error:
[06:21:50] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: #@!@# Game crashed! Crash report saved to: #@!@# /home/-user-/Modding/WoFMC/./crash-reports/crash-2016-09-25_06.21.50-client.txt
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
java: xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
[06:21:50] [Client thread/ERROR] [FML]: Caught exception from wychmire_wofmc
java.lang.NullPointerException
at com.github.wychmire.wofmc.init.ModBlocks.registerRender(ModBlocks.java:30) ~[bin/:?]
at com.github.wychmire.wofmc.init.ModBlocks.registerRenders(ModBlocks.java:26) ~[bin/:?]
at com.github.wychmire.wofmc.proxy.ClientProxy.init(ClientProxy.java:13) ~[bin/:?]
at com.github.wychmire.wofmc.WoFMC.init(WoFMC.java:33) ~[bin/:?]
You call ModBlocks.registerRender with a null argument on line 26 of ModBlocks because you never call ModBlocks.init and ModBlocks.register so ModBlocks.mud is still null.
Once you fix that, ItemModelMesher#register will throw a NullPointerException because you never register an ItemBlock for ModBlocks.mud (GameRegistry.register doesn't do this for you).
Instead of ItemModelMesher#register, you should be calling ModelLoader.setCustomModelResourceLocation or ModelLoader.setCustomMeshDefinition in preInit (if you're registering your blocks/items in preInit) or in response to ModelRegistryEvent (if you're registering your blocks/items using the recently-added registry events). These accept the same arguments as the two overloads of ItemModelMesher#register.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You call ModBlocks.registerRender with a null argument on line 26 of ModBlocks because you never call ModBlocks.init and ModBlocks.register so ModBlocks.mud is still null.
OK... So it should look like this?
I'm new to modding so if I miss an obvious point I'm sorry.
I'm new to modding so if I miss an obvious point I'm sorry.
I don't know why your IDE doesn't show you a bunch of errors xD
ModBlocks.init() and ModBlocks.register() don't take any arguments.
Also you shouldn't call that AFTER registering your renders. Call it from your Main mod class or CommonProxy BEFORE registering the renders from your ClientProxy.
Btw you're still using Minecraft.getMinecraft()#getRenderItem(). Look at Choonster's post for the correct replacement for this.
First of all your code editor is not doing the job it is supposed to do. What editor are you using? Netbeans?
Eclipse. The most likely reason I got no errors is because I wrote that snippet of code on Github, took a screen shot of it, and deleted the code in case that wasn't were I was supposed to put it.
In that case what GitHub client are you using? I say that you are missing out on convenient git interaction if you are not using gitkraken! It takes like 3 clicks to sync client files to page and is super fast!
Well the problem probably ("probably" because I am assuming that you have fixed the naming of the function in your local files not not in git) lies in the fact that you are calling register before init if you are calling init at all.
In my opinion splitting block reference population/initialization and actually registering the blocks in to 2 functions is a gigantic overkill.
The Meaning of Life, the Universe, and Everything.
Location:
The Void
Join Date:
5/5/2015
Posts:
118
Member Details
I'm running Manjaro Linux (Or Arch Linux) as a non-root user (basically a Windows Admin) and to use GitKraken I need to be a root user so I don't actually use a GitHub Client. So I slowly upload each file by hand.
Back to the mod, how would I implement the shown code? You have BlockM.class, BlockContainerM.class, and Block.class whereas I have ModBlocks.class.
You don't need to worry about robotic init. It's more advanced than you really need.
But if you are interested in the code I made a class that injects generated list of all classes from my mod in to an array and after that upon request I get all classes that extend the requested class. That's how I get all blocks that need to be registered. You definitely do not need this kind of automation and same goes for me but I made it for fun.
But for you I would recommend something more simple like:
remove the call to ModBlocks.register() and change the methods in ModBlocks to be public static (i.e. public static void <yourmethodname>(<yourarguments>) {<yourMEthodBody>}.
And there is no more method called ModBlocks.registerRenders(), you need to create that first.
The only problem now is that my block is missing. (i.e. I can't /give it to myself)
Yeah it's right now, you now need to call ModBlocks.register() from your CommonProxy (or Main class)'s preInit method.
Also create the following methods in ModBlocks and call ModBlocks.registerRenders() from your ClientProxy (make sure the normal register() method is called BEFORE that):
public static void registerRenders() {
registerRender(mud);
}
private static void registerRender(Block b ) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), 0, new ModelResourceLocation(b.getRegistryName(), "inventory"));
}
Yeah it's right now, you now need to call ModBlocks.register() from your CommonProxy (or Main class)'s preInit method.
Also create the following methods in ModBlocks and call ModBlocks.registerRenders() from your ClientProxy (make sure the normal register() method is called BEFORE that):
public static void registerRenders() {
registerRender(mud);
}
private static void registerRender(Block b ) {
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), 0, new ModelResourceLocation(b.getRegistryName(), "inventory"));
}
Having done all that it now gives me an error on the
ModBlocks.register();
line in the main class. The following is the error it gives me.
The method register(Block) in the type ModBlocks is not applicable for the arguments ()
I've recently just added blocks to my mod and whenever I try to launch it from Eclipse it starts and gives me the following error:
Here is a link to a Gist with the whole crash report
Here is a link to my GitHub page with the code
How would I go about fixing it?
You call ModBlocks.registerRender with a null argument on line 26 of ModBlocks because you never call ModBlocks.init and ModBlocks.register so ModBlocks.mud is still null.
Once you fix that, ItemModelMesher#register will throw a NullPointerException because you never register an ItemBlock for ModBlocks.mud (GameRegistry.register doesn't do this for you).
Instead of ItemModelMesher#register, you should be calling ModelLoader.setCustomModelResourceLocation or ModelLoader.setCustomMeshDefinition in preInit (if you're registering your blocks/items in preInit) or in response to ModelRegistryEvent (if you're registering your blocks/items using the recently-added registry events). These accept the same arguments as the two overloads of ItemModelMesher#register.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
OK... So it should look like this?
I'm new to modding so if I miss an obvious point I'm sorry.
I don't know why your IDE doesn't show you a bunch of errors xD
ModBlocks.init() and ModBlocks.register() don't take any arguments.
Also you shouldn't call that AFTER registering your renders. Call it from your Main mod class or CommonProxy BEFORE registering the renders from your ClientProxy.
Btw you're still using Minecraft.getMinecraft()#getRenderItem(). Look at Choonster's post for the correct replacement for this.
Alright, no matter what I try to change (this is about Choonster's suggestion) I always get errors. Can you show me some example code?
First of all your code editor is not doing the job it is supposed to do. What editor are you using? Netbeans?
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
Eclipse. The most likely reason I got no errors is because I wrote that snippet of code on Github, took a screen shot of it, and deleted the code in case that wasn't were I was supposed to put it.
Oooh well that explains it!
In that case what GitHub client are you using? I say that you are missing out on convenient git interaction if you are not using gitkraken! It takes like 3 clicks to sync client files to page and is super fast!
Well the problem probably ("probably" because I am assuming that you have fixed the naming of the function in your local files not not in git) lies in the fact that you are calling register before init if you are calling init at all.
In my opinion splitting block reference population/initialization and actually registering the blocks in to 2 functions is a gigantic overkill.
Before I used robotic initialization and registration I always did something like
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
I'm running Manjaro Linux (Or Arch Linux) as a non-root user (basically a Windows Admin) and to use GitKraken I need to be a root user so I don't actually use a GitHub Client. So I slowly upload each file by hand.
Back to the mod, how would I implement the shown code? You have BlockM.class, BlockContainerM.class, and Block.class whereas I have ModBlocks.class.
You don't need to worry about robotic init. It's more advanced than you really need.
But if you are interested in the code I made a class that injects generated list of all classes from my mod in to an array and after that upon request I get all classes that extend the requested class. That's how I get all blocks that need to be registered. You definitely do not need this kind of automation and same goes for me but I made it for fun.
But for you I would recommend something more simple like:
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
So it should look like this?
The only problem then is I get the following error: "Mud cannot be resolved to a type" (if you mouse over the little lightbulb/error thing)
Also, if I update the Forge version is there anything I have to change on my GitHub site?
"Mud cannot be resolved to a type"? Try auto importing and if that does not work than you did not create a class called "Mud"
No github is fine when you update forge as long as that does not require your mod files to be changed.
Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)
I may come back if MC fixes it's rendering pipeline.
Your class is BlockMud, not just Mud (at least it looks like that on your 2nd post).
Alright, so I changed is too BlockMud and everything is fine in that class now. However when I changed too BlockMud several other errors popped up.
I'm putting the two errors as attachments instead of in the post because they're kind of big.
remove the call to ModBlocks.register() and change the methods in ModBlocks to be public static (i.e. public static void <yourmethodname>(<yourarguments>) {<yourMEthodBody>}.
And there is no more method called ModBlocks.registerRenders(), you need to create that first.
When I delete
And
And then change
To
I get the following error...
(extra spaces added in someplaces to avoid emojis)
mud needs to be public static, too
Like this?
The only problem now is that my block is missing. (i.e. I can't /give it to myself)
Yeah it's right now, you now need to call ModBlocks.register() from your CommonProxy (or Main class)'s preInit method.
Also create the following methods in ModBlocks and call ModBlocks.registerRenders() from your ClientProxy (make sure the normal register() method is called BEFORE that):
Having done all that it now gives me an error on the
line in the main class. The following is the error it gives me.
Here's what my Main Class looks like.
package com.github.wychmire.wofmc;
import com.github.wychmire.wofmc.init.ModBlocks;
import com.github.wychmire.wofmc.init.ModItems;
import com.github.wychmire.wofmc.proxy.CommonProxy;
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;
@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class WoFMC
{
@Instance
public static WoFMC instance;
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
System.out.println("Pre Init");
ModItems.init();
ModItems.register();
ModBlocks.init();
ModBlocks.register();
}
@EventHandler
public void init(FMLInitializationEvent event)
{
System.out.println("Init");
proxy.init();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
System.out.println("Post Init");
}
}