Jump to content

Apace

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Apace

  1. Okay, I understand that. But previously, when I was testing it (Using the LoggedIn server event) it went like this: 1. I started Minecraft - the client loaded the config. 2. I joined Singleplayer - the client's values were in effect. 3. I joined Multiplayer (a server with the mod, but a different config) - the server's values got transferred to the client. 4. I joined Singleplayer again - the server's values were still in effect, instead of the client's values. To clarify: I don't have a problem at the moment, everything works fine. It's just that I don't understand why things happened like they did previously. EDIT: Fixed a mistake I made.
  2. Yeah, that's what I figured. Alright, good to know. Makes sense, now that I think about it. It is called "LoggedOut" and not "LoggingOut", after all. Okay, I didn't notice that I would receive the config values from the integrated servers upon starting single-player as well. That simplifies things. I was looking around for something like that the past few hours as well, it sure is very hidden. Okay, this part I don't understand. I mean, I did this now (the config reloads from the file whenever the client joins a game, using the ClientConnectedToServerEvent) and it works very well (awesome, thank you for that!) but why is this the case? Wouldn't Java just set the variables to whatever the client receives when it joins a game? I have one more problem now, though: When the client joins a vanilla server, it shouldn't load the default values, but different ones. How would I go about figuring out if the server has my mod installed or not?
  3. Hey guys, it's me again. I'm trying to get the configuration for my mod sent from the server to the client, so that the client can set its variables to that of the server. I'm using an IMessage to send two variables from the server to the client, the message gets sent using the PlayerLoggedInEvent: @SubscribeEvent public void JoinServer(PlayerLoggedInEvent event) { SolidStone.network.sendTo(new SSMessage(SSConfig.solidity, SSConfig.smeltingEnabled), (EntityPlayerMP)event.player); } This works fine. The client accepts the new values. When trying to reset the values for the client, I use a different message "SSMessageReset" without any arguments and try to send it when the PlayerLoggedOutEvent triggers: @SubscribeEvent public void LeaveServer(PlayerLoggedOutEvent event) { SolidStone.network.sendTo(new SSMessageReset(), (EntityPlayerMP)event.player); } This however, doesn't seem to produce any results. The LeaveServer method gets called, but the IMessageHandler for the SSMessageReset IMessage doesn't get called. I'm wondering if this is because the client has already disconnected? FYI, the messages are registered like this, in the preInit method of my main mod class: network = NetworkRegistry.INSTANCE.newSimpleChannel("SSChannel"); network.registerMessage(SSMessage.Handler.class, SSMessage.class, 0, Side.CLIENT); network.registerMessage(SSMessageReset.Handler.class, SSMessageReset.class, 1, Side.CLIENT); The only work-around I see for this, is that instead of using the same variables for both singleplayer and multiplayer games, the client stores two seperate sets of variables, effectively removing the need for a reset of the sent variables. That option doesn't seem as elegant to me though, and it really (really) bugs me, that my first approach doesn't work. I'm wondering if there's anything I might be doing wrong here, or if it really is true that the client has already disconnected when the PlayerLoggedOutEvent gets called. Any answers to this? Thanks in advance, - Apace
  4. Thanks to both of you guys for answering! I feared that there was no easy way to do this. Alright then, I guess I'll get to work. Will mark as solved for now, hopefully it will stay that way.
  5. Hello guys, I've been following TheGreyGhost's great MinecraftByExample series and have set up a configuration file for my mod. Depending on the configuration file, the mod makes certain blocks unbreakable. The config's loading/saving/using works perfectly in SSP. However, when in SMP, the client still uses its own configuration file (by how awesome Forge is, I've expected it to synchronize the config automagically). So, if the clients config file allows harvesting block A for example, and not block B, and the servers config file is the other way around, the client won't be able to mine block B (I'm setting the break speed to 0f in the BreakSpeed event), but the player will be able to start breaking block A, only to have it instantly respawn on breaking the block. Also, if the client connects to a server without the mod installed, it won't be able to break the blocks as set up in the config file either. My question is: Is there an easy work-around for this? If not, will I have to set up custom network messages which get sent when a client joins the server? If yes, is there any good tutorial out here on how to do stuff involving networking in Minecraft? Thanks in advance, - Apace
  6. Seems like I did something wrong when setting up the environment. I've deleted my old Forge environment now and will try to set it up once again. Using the latest recommended Forge version and following a different tutorial this time. I will tell you once it has finished if I now have access to the forgeSrc library. EDIT: Success! What I did to make it work: 1. Run 'gradlew setupDecompWorkspace' (I think this did the trick - I'm pretty sure I was using 'gradlew setupDevWorkspace' before) 2. Run 'gradlew eclipse' (or 'gradlew idea') Thanks for trying your best to help, Failender. EDITEDIT: Scrap that. The library is now called forgeSrc, but still only contains the compiled class files for both Minecraft and Forge. EDITEDITEDIT: Oh well, I am dumb. Apparently, the files show up as .class files in the package explorer still, but when double-clicking to view them they actually show the source code now, as opposed to the .class file information eclipse would normally show for compiled class files. So, yay, it works. Thanks to you again, Failender, and to bedrockminer for the tutorial on how to set up the Forge development environment.
  7. I'm working with 1.8. Using Forge 1.8-11.14.1.1412 at the moment.
  8. Yes, I'm using eclipse. There's no forgeSrc library for me though, only forgeBin. Is there an extra step I need to do to get this?
  9. Hello guys, I have started modding Minecraft back in beta something, and have stopped playing and modding Minecraft for a long time. Now I wanna get into it again, and everything is quite different. Back then, I used to look at the source code for Minecraft itself, as looking at the source code is one of the best tutorials one can have. Now, with the way the development environment is set up, there is no source code included, not for Forge, nor for Minecraft. So I'm asking, is there any way to download the source code of either of those things, because sticking with the available tutorials just isn't enough, imo. I'm really sorry if this is kind of a dumb question and there is an obvious answer to it, but I've been looking around for a quite a while now and can't seem to find anything. Thanks in advance, - Apace
×
×
  • Create New...

Important Information

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