-
Posts
2617 -
Joined
-
Last visited
-
Days Won
37
Everything posted by Ugdhar
-
[1.15.1] Why does Minecraft crash when I try to spawn my entity?
Ugdhar replied to DragonITA's topic in Modder Support
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. -
[1.15.1] How to get a block from it's position
Ugdhar replied to Reprevise's topic in Modder Support
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! -
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/
- 1 reply
-
- 1
-
[1.15.1] ExampleMod and FMLClientSetupEvent
Ugdhar replied to Ugdhar's topic in Support & Bug Reports
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"); } } } -
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. . . . .
-
Then I would question if the items are even being registered. I guess post logs?
-
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.
-
You may have Java 8, but you're not using it to run Forge.
-
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?
-
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.
-
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.
-
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.
-
minecraft 1.7.10 / 1.7.10 forge worlds dont load
Ugdhar replied to G01d3nKryptic's topic in Support & Bug Reports
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. -
Please show where you assign the item to the ItemGroup
-
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.
-
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.
- 1 reply
-
- 1
-
You need to set the registry name of your stuff before you register them.
-
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.
-
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.
-
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.
-
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!
-
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!
-
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.
-
Did you check out the LTS link at the top of every page? It explains everything.