Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

serg_x

Members
  • Joined

  • Last visited

Everything posted by serg_x

  1. I`m writing a simple mod, that must find water block near player after command in chat. Main mod class: import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import org.apache.logging.log4j.Logger; @Mod(modid = QMod.MODID, useMetadata=true, clientSideOnly = true) public class QMod { public static final String MODID = "qmod"; public static Logger logger; @EventHandler public void preInit(FMLPreInitializationEvent event) { logger = event.getModLog(); } @EventHandler public void init(FMLInitializationEvent event) { logger.info("Init"); MinecraftForge.EVENT_BUS.register(new ChatListener(logger)); } } ChatListner: import net.minecraft.client.Minecraft; import net.minecraftforge.client.event.ClientChatEvent; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.apache.logging.log4j.Logger; public class ChatListener { static Logger logger; ChatListener(Logger lg) { logger = lg; } @SubscribeEvent public void ClientChatEvent(ClientChatEvent e) { logger.info("MESSAGE"); logger.info(e); Minecraft mc = FMLClientHandler.instance().getClient(); logger.info(mc); logger.info(mc.world); if (e.getMessage().contains(".find")) { logger.info("EEEE"); e.setCanceled(true); BottleFiller bottleFiller = new BottleFiller(logger, mc); bottleFiller.scanBlocks(); } } } If I lauch client with "gradle lauchClient" everything is OK. But when I try to launch it from the launcher(placed builded .jar into mods folder) an error occurs: [18:05:31] [Client thread/ERROR]: Exception caught during firing event net.minecraftforge.client.event.ClientChatEvent@e977f71: java.lang.NoSuchFieldError: world at com.sergx.zmod.ChatListener.ClientChatEvent(ChatListener.java:25) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_13_ChatListener_ClientChatEvent_ClientChatEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(ForgeEventFactory.java:436) at net.minecraft.client.gui.GuiScreen.func_175281_b(GuiScreen.java:416) at net.minecraft.client.gui.GuiScreen.func_175275_f(GuiScreen.java:411) at net.minecraft.client.gui.GuiChat.func_73869_a(SourceFile:81) at net.minecraft.client.gui.GuiScreen.func_146282_l(GuiScreen.java:558) at net.minecraft.client.gui.GuiScreen.func_146269_k(GuiScreen.java:512) at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1759) at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1098) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:398) at net.minecraft.client.main.Main.main(SourceFile:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Also instead of FMLClientHandler.instance().getClient() I used Minecraft.getMinecraft() but this didn't help. What am I doing wrong? MCversion 1.12.2, Forge 14.23.5.2859

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.