I am trying to make a crop that grows naturally but it doesn't seem to want to. It only grows when I use the bonemeal. (I have it printing to the chat when I attempt to harvest it using right click). It doesn't seem to grow naturally. What am I missing
Your Block#updateTick override does nothing but spawn particles, so the crop never grows from a random tick.
Is there a reason you're not extending BlockCrops? It handles this for you.
ModelLoader and StateMap are client-only classes, they cannot be referenced from common code (e.g. a Block constructor) without crashing the dedicated server.
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.
Then where do I call the ModelLoader#setCustomStateMapper method?
From a client-only class.
If you're registering your blocks and items in preInit, register your state mappers and models in preInit. If you're registering your blocks and items in RegistryEvent.Register, register your state mappers and models in ModelRegistryEvent.
RegistryEvent.Register and ModelRegistryEvent are both fired before preInit, so they need to be handled by static @SubscribeEvent methods in classes annotated with @Mod.EventBusSubscriber. Pass Side.CLIENT to the @Mod.EventBusSubscriber annotation on the client-only class so Forge doesn't try to load and register it on the dedicated server.
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.
Here is my crash report. I put it in both my client and common proxies and nothing seems to be working for me. It works only when I put it in the crop constructor.
Rollback Post to RevisionRollBack
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
java.lang.NullPointerException
at com.couchdoescode.tea.handlers.ItemHandler.registerRender(ItemHandler.java:36) ~[bin/:?]
at com.couchdoescode.tea.handlers.ItemHandler.registerRenders(ItemHandler.java:30) ~[bin/:?]
at com.couchdoescode.tea.proxy.ClientProxy.init(ClientProxy.java:19) ~[bin/:?]
at com.couchdoescode.tea.TeaMod.init(TeaMod.java:22) ~[bin/:?]
Something was null on line 36 of ItemHandler. If you don't know what's null, set a breakpoint on that line, run Minecraft in debug mode and then look at the values of the variables used on that line.
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.
Something was null on line 36 of ItemHandler. If you don't know what's null, set a breakpoint on that line, run Minecraft in debug mode and then look at the values of the variables used on that line.
I moved it to an event handler using ModelRegistryEvent and I tested it out and it said that my block is null.
Rollback Post to RevisionRollBack
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
I moved it to an event handler using ModelRegistryEvent and I tested it out and it said that my block is null.
When are you creating and registering your blocks? If you want to register your models in ModelRegistryEvent, you need to register your Blocks and Items in RegistryEvent.Register (as I said in post #4).
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.
When are you creating and registering your blocks? If you want to register your models in ModelRegistryEvent, you need to register your Blocks and Items in RegistryEvent.Register (as I said in post #4).
I'm still really new to events. Any way you could walk me through that process? It says I need a class that implements IForgeRegistryEntry but the unimplemented methods are a bit confusing as I would need some variables I assume that store the values and then I register the blocks using an event handler?
Rollback Post to RevisionRollBack
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
I'm still really new to events. Any way you could walk me through that process? It says I need a class that implements IForgeRegistryEntry but the unimplemented methods are a bit confusing as I would need some variables I assume that store the values and then I register the blocks using an event handler?
Block and Item both implement IForgeRegistryEntry (as do other singletons like Biome and SoundEvent), you don't need to implement it yourself.
You should still store your Block and Item instances in static fields like you did before, just register them when RegistryEvent.Register is fired for their registry type instead of in preInit.
You can see how I do it in my mod here and in the other classes in the init package.
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.
Block and Item both implement IForgeRegistryEntry (as do other singletons like Biome and SoundEvent), you don't need to implement it yourself.
You should still store your Block and Item instances in static fields like you did before, just register them when RegistryEvent.Register is fired for their registry type instead of in preInit.
You can see how I do it in my mod here and in the other classes in the init package.
It seems to give me a null pointer exception when I try to register the blocks. I ran it in debug mode and it shows the block I am registering as null. I'm gonna figure this out but any tips you could give me would be awesome.
You're instantiating BlockGreenTea and assigning the instance to the greenTea field in the init method, which is almost certainly called after RegistryEvent.Register is fired (since this happens before preInit).
You can't register something before it exists, so you need to instantiate BlockGreenTea in the greenTea field's initialiser or in the RegistryEvent.Register handler method.
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're instantiating BlockGreenTea and assigning the instance to the greenTea field in the init method, which is almost certainly called after RegistryEvent.Register is fired (since this happens before preInit).
You can't register something before it exists, so you need to instantiate BlockGreenTea in the greenTea field's initialiser or in the RegistryEvent.Register handler method.
Well, I broke my entire mod. Textures aren't loading, and I lost one of my items. Also, it keeps looking for blockstates that I told it to ignore and nothing is working right. I can't seem to find where you register your textures at.
Rollback Post to RevisionRollBack
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
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.
I am trying to make a crop that grows naturally but it doesn't seem to want to. It only grows when I use the bonemeal. (I have it printing to the chat when I attempt to harvest it using right click). It doesn't seem to grow naturally. What am I missing
Code
Thanks in advanced!
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
Your Block#updateTick override does nothing but spawn particles, so the crop never grows from a random tick.
Is there a reason you're not extending BlockCrops? It handles this for you.
ModelLoader and StateMap are client-only classes, they cannot be referenced from common code (e.g. a Block constructor) without crashing the dedicated server.
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.
Then where do I call the ModelLoader#setCustomStateMapper method?
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
From a client-only class.
If you're registering your blocks and items in preInit, register your state mappers and models in preInit. If you're registering your blocks and items in RegistryEvent.Register, register your state mappers and models in ModelRegistryEvent.
RegistryEvent.Register and ModelRegistryEvent are both fired before preInit, so they need to be handled by static @SubscribeEvent methods in classes annotated with @Mod.EventBusSubscriber. Pass Side.CLIENT to the @Mod.EventBusSubscriber annotation on the client-only class so Forge doesn't try to load and register it on the dedicated server.
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.
It gave me a null pointer exception. I put it in my ClientProxy preInit. Still not sure if that's where I put it or not.
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
THE typical cause for a Nullpointerexception on crops is when you register your items before your blocks.
That's not the case here. I have mine registered after
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
You're talking about the State Mapper. Did you set that after registering your blocks?
Also I think it's easier to find the problem if you post a log or crash report.
Here is my crash report. I put it in both my client and common proxies and nothing seems to be working for me. It works only when I put it in the crop constructor.
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
Something was null on line 36 of ItemHandler. If you don't know what's null, set a breakpoint on that line, run Minecraft in debug mode and then look at the values of the variables used on that line.
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.
I moved it to an event handler using ModelRegistryEvent and I tested it out and it said that my block is null.
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
When are you creating and registering your blocks? If you want to register your models in ModelRegistryEvent, you need to register your Blocks and Items in RegistryEvent.Register (as I said in post #4).
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.
I'm still really new to events. Any way you could walk me through that process? It says I need a class that implements IForgeRegistryEntry but the unimplemented methods are a bit confusing as I would need some variables I assume that store the values and then I register the blocks using an event handler?
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
Block and Item both implement IForgeRegistryEntry (as do other singletons like Biome and SoundEvent), you don't need to implement it yourself.
You should still store your Block and Item instances in static fields like you did before, just register them when RegistryEvent.Register is fired for their registry type instead of in preInit.
You can see how I do it in my mod here and in the other classes in the init package.
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.
It seems to give me a null pointer exception when I try to register the blocks. I ran it in debug mode and it shows the block I am registering as null. I'm gonna figure this out but any tips you could give me would be awesome.
Code:
CropHandler
ClientProxy
Crash Report
Thanks in advanced!
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
You're instantiating BlockGreenTea and assigning the instance to the greenTea field in the init method, which is almost certainly called after RegistryEvent.Register is fired (since this happens before preInit).
You can't register something before it exists, so you need to instantiate BlockGreenTea in the greenTea field's initialiser or in the RegistryEvent.Register handler method.
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.
Well, I broke my entire mod. Textures aren't loading, and I lost one of my items. Also, it keeps looking for blockstates that I told it to ignore and nothing is working right. I can't seem to find where you register your textures at.
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
I register my block and item models here.
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.
FIXED! Thanks so much!
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.