Jump to content

Ugdhar

Moderators
  • Posts

    2617
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by Ugdhar

  1. Since you already have a github, you should post your code there. Much easier to read on there than pasted here, and as long as you keep updating it, no need to post updated code here. Making a guess based on the crash without seeing code, you're trying to register something that has not been initialized, so it's trying to register something that is null. *edit: Pretty sure it's an item, since the crash looks to be coming from ModItems.
  2. In the Referenced Libraries within your IDE, there should be a forge jarfile that you can browse the Forge and Vanilla classes, many of them have comments/javadocs to peruse. Sorry that I haven't got an answer for the first question, not something I've ever tried to do!
  3. You need Java installed to run the forge installer. I believe Java 8-10 will work for the supported versions of Forge. https://adoptopenjdk.net/
  4. Just in case anyone doesn't feel like opening the MDK to check out the example, this is the one packaged with 1.15.1-30.0.41): package com.example.examplemod; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.stream.Collectors; // The value here should match an entry in the META-INF/mods.toml file @Mod("examplemod") public class ExampleMod { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); public ExampleMod() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } } }
  5. Just out of curiosity, what happens if you change the icon in your FlatTilesItemGroup to a vanilla item, instead of one of your modded items? I'm just curious if the issue is arising because your item is not registered yet, therefore does not exist, so your tab isn't getting setup? Check out https://mcforge.readthedocs.io/en/1.14.x/concepts/registries/#injecting-registry-values-into-fields for info on ObjectHolders. Also. . . . .
  6. Then I would question if the items are even being registered. I guess post logs?
  7. You missed that part!
  8. Well, given the information I have, I would have to say there's something wrong with it if it's not working. Just for grins, if you change FLAT_TILES to ItemGroup.MISC does it add your items to the Miscellaneous tab? If that works, then your custom tab is broken.
  9. You may have Java 8, but you're not using it to run Forge.
  10. You should really post your entire codebase as a github repository, because not seeing everything makes it so much harder to see what's wrong. What is FLAT_TILES?
  11. You don't want the MinecraftForge repository if you are making mods, that would be for devloping/contributing patches to forge itself. Go to files.minecraftforge.net and download the MDK for the version you want to make mods for (only 1.14+ are supported on the forums), and the forge Docs (link at the top of every page) should help you get started.
  12. 1.12.2 is no longer supported due to how old it is. Please update to a modern version to receive support. See the LTS link at the top of every page for more information.
  13. 1.8.9 is no longer supported due to how old it is. Please update to a modern version to receive support. See the LTS link at the top of every page for more information.
  14. 1.7.10 is no longer supported due to how old it is. Please update to a modern version to receive support. See the LTS link at the top of every page for more information.
  15. Please show where you assign the item to the ItemGroup
  16. Your code is super hard to read with all of those method calls chained together, but I don't see anything that sets the creative tab (called ItemGroup I believe in the current supported versions) anywhere.
  17. 1.12.2 is no longer supported on these forums due to age. Please update to a modern version to receive support. See the LTS link at the top of every forum page for more information on supported versions.
  18. You need to set the registry name of your stuff before you register them.
  19. Make sure you have run the gradle task genEclipseRuns for your new project as well, if you're just copying files over, I would guess it's possible that running the new project could still target the original one.
  20. I believe you should be able to right-click on the project in your package/project manager, and select "Run As" to get the options to run using that project.
  21. https://www.minecraftforge.net/forum/topic/79304-112114-and-lts-system/ It's literally at the top of the page for every page, and explains what versions will be supported now and moving forward.
  22. The ExampleMod that comes with the MDK (1.15.1-30.0.41) adds a listener for the FMLClientSetupEvent in the constructor of the main mod class, for a method also a member of the main mod class. My question is, is this safe? Or should the FMLClientSetupEvent method be part of a client-only class? Just trying to figure out current best practices to avoid the whole reaching across logical sides thing. Thanks for your input!
  23. I was under the impression that 1.13+ could use 8-10, however I've only used 8 myself, so I can't honestly say. Glad you got it working at least!
  24. 1.7.10 is no longer supported on these forums due to it being really really old. Please update to a modern version to receive support. More information can be found on the LTS link at the top of every page.
  25. Did you check out the LTS link at the top of every page? It explains everything.
×
×
  • Create New...

Important Information

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