• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Hi, I am trying to start my modding journey and just created a quick test mod that literally does nothing, but when I launch the modinfo file doesn't show up and it says it is missing. I am using the 1.12.2 forge mdk and just changing the naming info to be a tad different. Even when I try just running the base mdk with no changes made it doesn't show up. I really don't understand how the base download doesn't work... I am using IntelliJ if that matters.   On top of that, when I run my mod I always get 1 error with not helpful info just saying "Caused by: java.lang.IllegalArgumentException", anyone know what that is about?   I appreciate any help!
    • That method never cause this exception. There is no point in adding it here. Even if some of your code might cause this, you should handle it inside the method properly (you are making a mod, not an API).   LivingDamageEvent is a Forge event. You are putting it in the Mod event subscriber.
    • Thanks for your advice! I ended up using a PlayerModel as I needed the outer skin thing, and for my Renderer i used BipedRenderer. Cheers
    • Hello, this is my first try at making a mod on Minecraft, and I'm facing a problem. I'm using forge's 1.16.1 example mod that i modified to suit my needs. My mod is very simple, I just want to execute some code when the player takes damage. For that, I'm using the LivingDamageEvent event, and it works exactly as i want in singleplayer. However, when I join a multiplayer server, it seems like my mod is turned off automatically for some reason. The FMLServerStartingEvent doesn't trigger because I don't see anything in the launcher_log.txt after I close minecraft, and same for LivingDamageEvent. Is there a reason for that ?   Here's the code i'm using, it's just a modified version of forge's example mod :   package com.example.examplemod; import net.minecraft.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingDamageEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; 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.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import java.io.IOException; import java.io.InputStream; import java.net.URL; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // 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 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()); } @SuppressWarnings("resource") 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); } // 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"); } public class MyForgeEventHandler { @SubscribeEvent public void pickupItem(EntityItemPickupEvent event) { System.out.println("Item picked up!"); } } @SubscribeEvent public void onPlayerHurt(LivingDamageEvent event) throws IOException { System.out.println("Player attacked ! damage : " + event.getAmount()); #Execute some code here ... } }  
  • Topics

  • Who's Online (See full list)