Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by Blackop778

  1. Tip to surviving on this forum: don't mention 1.7.10. They'll lock your thread. It's not fun.
  2. Works great using EntityJoinWorldEvent. I also had that event unregister itself to reduce computation (probably by a minuscule amount) and added it back with @SubscribeEvent public void onPlayerLeftServer(ClientDisconnectionFromServerEvent event) { Minecraft.getMinecraft().addScheduledTask(new Runnable() { @Override public void run() { MinecraftForge.EVENT_BUS.register(new ClassThatContainsEntityJoinWorldEventMethod()); } }); }
  3. Using the code: @SubscribeEvent public void onPlayerJoinedServer(FMLNetworkEvent.ClientConnectedToServerEvent event) { Minecraft.getMinecraft().addScheduledTask(new Runnable() { @Override public void run() { NETWORKWRAPPER.sendToServer(new HasModMessage()); MineCalc.LOGGER.info("Joined a server"); } }); } The Logger works but the message never gets received on the server. When I left the server an error is thrown in the client:
  4. I want to send a packet to a server whenever I join it. What event should I subscribe to to know when to send the packet? It would be okay if it triggered while joining a single player world too. I considered using an EntityJoinWorldEvent but I only want to trigger it for myself and not for loading other players (would that happen?).
  5. So I was writing a response but it turns out the vanilla client disconnects when I send it a modded packet from a forge server running my mod compiled into a jar, which it didn't do while running a server with gradle runServer. Maybe you can help me figure that out for now. Error message from server is "Internal Exception: io.netty.handler.codec.EncoderException: java.io.IOException: Can't serialize unregistered packet" I'm creating a system that translates error messages server-side for players that don't have my mod installed. When a client connects the server sends a packet that contains the player that joined's name, which is message.name. The client sends the packet back to let the server know it has my mod and doesn't need pre-translated messages.
  6. Glancing at the documentation it states "isSilkTouching is set if this is considered a silk touch harvesting operation, vs a normal harvesting operation. Act accordingly." I believe you can just setDropChance to 1f if isSilkTouching, but I may be mistaken. That would only work if the spawner is in the List<ItemStack> drops.
  7. My mod sends a packet to clients that are supposed to send the contents back. The server doesn't have any problems sending the packet to clients, and the first player to connect receives the packet, but the return message never gets sent. If the first player reconnects then everything functions properly. To be clear I want the ModCheckMessageHandler to send a HasModMessage to the server, which never receives the message. Client Handler: public static class ModCheckMessageHandler implements IMessageHandler<ModCheckMessage, HasModMessage> { @Override public HasModMessage onMessage(ModCheckMessage message, MessageContext ctx) { MineCalc.LOGGER.info("Server has MineCalc installed"); return new HasModMessage(message.name); } } Server Handler: public static class HasModMessageHandler implements IMessageHandler<HasModMessage, IMessage> { @Override public IMessage onMessage(HasModMessage message, MessageContext ctx) { MineCalc.LOGGER.info(message.name + " returned HasModMessage"); Calculate.hasMod.add(message.name); return null; } } How handlers are registered on client and server: NetHub.NETWORKWRAPPER.registerMessage(ModCheckMessageHandler.class, ModCheckMessage.class, NetHub.packetDiscriminator++, Side.CLIENT); NetHub.NETWORKWRAPPER.registerMessage(HasModMessageHandler.class, HasModMessage.class, NetHub.packetDiscriminator++, Side.SERVER); What's wrong?
  8. The issue with this solution is that I don't know which player's modlist I'm looking at. I could assume it's the next player to connect but I'd imagine it may break if many players connect at once.
  9. I'd like English to be displayed in place of failing to translate. I was planning on sending a regular TextComponent in place of a TextComponentTranslate.
  10. My mod simply adds a command so it isn't necessary for players to have my mod. When there is an error with the command a TextComponentTranslation is sent to the player which only displays properly if the player has my mod. I'd like to just send a regular chat English chat message if the player doesn't have the mod but I have no idea whether or not the player does. How could I find this out?
  11. Is it possible for gradle to tell Eclipse to read either a specific file or a file extension with a certain text file encoding? It defaults to Cp1252 but this file is encoded in UTF-8 so some unicode characters are mangled until I specify that the file is UTF-8. I would like it so when I run gradlew setupDecompWorkspace eclipse the file would automatically be read as UTF-8 in Eclipse. Is this possible? Thanks for your help.
  12. How is the built in one any different? Also it isn't available in 1.7.10.
  13. I'm sending the player a message using player.addChatMessage(new TextComponentString("MineCalc has an update available. See http://blackop778.github.io/MineCalc/update.html?version=" + ForgeVersion.mcVersion)); and would like it to show up as a link, but it only shows up as regular text. How would I do this? Thanks in advance.
  14. What about public String getCommandUsage(ICommandSender icommandsender) It returns a string so TextComponentTranslations cannot be returned.
  15. I'm looking to localize strings that get returned by my command. I18n seems to be the way to do it but it is depreciated. What is the replacement? Also why is it depreciated?
  16. You posted the same link twice. Edit: I now realize I have a noet linked to one of your articles in the GuiConfig class. Small world or something.
  17. On my mod I've got a GuiFactory setup to show a config screen in-game. The changes work on the game, but I cannot get it to save to the actual .cfg file. I checked and the .cfg isn't read only. It's even properly putting in the # Configuration file header, but isn't updating the settings. Relevant code: GuiConfig class Config class: From the class with the @mod annotation: I didn't include the GuiFactory class since the only overwritten method simply returns the GuiConfig class. Any idea what's wrong?
  18. So I have a mod that simply adds a command and would like to be able to use it on singleplayer or multiplayer. It works fine on SSP but on MP you are required to have the mod on the client too. Is it possible to have a single jar that works on SSP and on MP without requiring it on clients? The command is a chat based calculator, something that shouldn't be required on both. Thanks for help!
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.