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.

Antonii

Members
  • Joined

  • Last visited

Everything posted by Antonii

  1. Can I take player's inventory from this event? public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { // TODO Auto-generated method stub } should I make a public variable that I set in onWorldLoad and in which I store EntityPlayer? Or..how else could I get the player? Like this: Minecraft.getMinecraft().player ?
  2. " Sorry, I am not following here. You say it is never called on the client. Are you sure it is registered to ClientCommandHandler? " Yes as the code shows. I thought that when I enter a command it is first sent to the server to be checked because otherwise I couldn't explain the fact that the server sends back a "You don't have permission"
  3. " When registered to ClientCommandHandler the command should not be "sent out". Use the debugger to find out what is happening exactly. " -the execute function is never called on client side and the server generates an error so the command is sent out-over network. Two final questions(from what I have seen the doc is pretty thin so your experience is my salvation): Where should I put my code to be executed when I enter the custom command?and How on this earth can I loop through the player's inventory-there's NOTHING on this subject,only for server side-?
  4. I realized something. I can't tell the difference between the client events and server ones. I <know> the difference but you have enligthen me. So the event was for server side. How can I know that? Is there a list with all the events available? About the custom command. The execute method seems to be for the server side(it has a MinecraftServer argument so it's quite obvious) so ,of course in a multiplayer game it will not be executed because the server is not local. What should I do to prevent the command to be sent out? Is not a problem because I've seen that I can detect the command: weirdly the getName function is called exactly once only for the command so I can use this location to write code for the actual command. But it's upsetting me that the command is still sent out. Isn't there an event for capturing chat or commands that I can cancel?
  5. diesieben07 No the mod is client-oriented. I join a server from Multiplayer menu in Minecraft. It should stay active during the play right?
  6. I hate this. It takes forever for Minecraft to build and to test the mod. Now it stoppped working. On the breakEvent I wanted this code to be executed Minecraft.getMinecraft().player.sendChatMessage("asdasd"); It worked for a few builds. Now...it STOPED! I have built Minecraft like a hundred times. No luck. What is going on? Event File package com.user.testmod; import net.minecraft.client.Minecraft; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; public class Event { @SubscribeEvent public void onPlayerLoggedInEvent(PlayerLoggedInEvent event) { System.out.println("logged"); } @SubscribeEvent public void breakEvent(BlockEvent.BreakEvent event) { System.out.println("breakEvent"); Minecraft.getMinecraft().player.sendChatMessage("asdasd"); } @SubscribeEvent public void onBreakBlock(BreakEvent event) { System.out.println("Break block"); event.setCanceled(true); } } Main package com.user.testmod; import com.user.testmod.proxy.ClientProxy; import com.user.testmod.proxy.CommonProxy; import ibxm.Player; import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent; @Mod(modid=Reference.MODID,name=Reference.MODNAME,version=Reference.VERSION,acceptableRemoteVersions = "*",acceptedMinecraftVersions=Reference.ACCEPTED_MINECRAFT_VERSIONS) public class Main{ @Instance public static Main instance; @SidedProxy(clientSide="com.user.testmod.proxy.ClientProxy",serverSide="com.user.testmod.proxy.CommonProxy") public static CommonProxy proxy; @EventHandler public static void preInit(FMLPreInitializationEvent event) { System.out.println("a"); } @EventHandler public static void Init(FMLInitializationEvent event) { System.out.println("b"); MinecraftForge.EVENT_BUS.register(new Event()); ClientCommandHandler.instance.registerCommand(new Command()); ClientCommandHandler.instance.registerCommand(new Command2()); } @EventHandler public static void postInit(FMLPostInitializationEvent event) { System.out.println("c"); } } I am starting to hate Java and Minecraft. It's like Python with dependencies on Windows.
  7. diesieben07 I have provided the code for the events I reffered. By "fly" I meant onFlyFall. The breakEvent event is not called when in multiplayer. When I am on a local world It works but not in multiplayer. If you don't mind ,another thing :"RenderPlayerEvent.Specials.Post" is deprecated -what is the alternative? There's absolutely no reference to it on the internet-only for older versions. I couldn't see any given alternatives.
  8. Another thing: it looks like the code for fly event is called twice by main thread and Server thread. Why is that? Am I supposed to explicitly use a side? Why doesn't that happen with the break event?
  9. In the end: I can't possibly believe that my problem has no solution. I read that some events do not exist so I have to edit network packets but I can't believe that onBreak event is not called when I break a block, What is the solution? Are mods THAT hard to make? Always being forced to use packets?
  10. I am new to mods. What should I use instead of ClientCommandHandler? And how do you know it's common code? Is it from this line "public static CommonProxy proxy;" ?
  11. I want to create a new command for the client to use. I tested the code on a local world and it works(for now there are only some print lines). It seems that Minecraft uses a list and a loop to search through all commands and when found it calls its execute method. But when I join a server the game still searches for my command but instead of executing its method it looks like it's sent to the server and checked there. This of course results in an error("The server couldn't find the command"). Main class: Command class package com.user.testmod; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; public class Command extends CommandBase{ @Override public String getName() { // TODO Auto-generated method stub System.out.println("comm aaa"); return "test"; } @Override public String getUsage(ICommandSender sender) { // TODO Auto-generated method stub System.out.println("comm bbb"); return null; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { // TODO Auto-generated method stub System.out.println("command executed"); } } There are other weird things happening that I believe are related: I implemented an onBreakBlock event -it works on a local world but does nothing in multiplayer. Event class package com.user.testmod; import net.minecraft.client.Minecraft; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerFlyableFallEvent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class Event { @SubscribeEvent public void breakEvent(BlockEvent.BreakEvent event) { System.out.println("ccc"); Minecraft.getMinecraft().player.sendChatMessage("asdasd"); } @SubscribeEvent public void onBreakBlock(BreakEvent event) { event.setCanceled(true); } @SubscribeEvent public void onFlyFall(PlayerFlyableFallEvent event) { System.out.println("dddd"); //just testing different events to see which works in multiplayer-many don't } } How can I fix it?

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.