Posted October 28, 201311 yr I am going to try this again(even though last time it just ended up in a fit of frustration) to get something to save server-side. I have tried many many times to get this to work but no matter how hard I try I cannot get it to work properly. But as the title says, is all I need is to save an integer to the server(and for the client to get). I am going to say however that if you had helped me before on this and I was being mean to you I want to say sorry. Like I said I was just very frustrated that I could not get it to work and I am sorry for that. But other than that please feel free to post your solution!
October 28, 201311 yr What do you mean by "save an integer"? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 28, 201311 yr Author What do you mean by "save an integer"? I mean like an nbt save or something so that it will always be there even if you close the game.
October 29, 201311 yr Author Use java and a text file simple as that. I am sorry but I do not see how that would work seeing that I need the server to be able to read and write to the same file.
October 29, 201311 yr Author You could always save it to the world's NBT tag compound. I could try but I have never gotten that to work quiet right.
October 29, 201311 yr In SP he server can and in multiply the server needs packets to keep the client sunk up.
October 29, 201311 yr Use java and a text file simple as that. I am sorry but I do not see how that would work seeing that I need the server to be able to read and write to the same file. You only need to read at one point: When the server starts You only need to write at one point: When the server stops (There's one additional write operation: if the file to read doesn't exist, initialize it). There's no reason to be reading and writing to the same file at the same time (although you can). That said: Take a look at this post. It will allow you to create and read an arbitrary NBT data file. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 29, 201311 yr Author Use java and a text file simple as that. I am sorry but I do not see how that would work seeing that I need the server to be able to read and write to the same file. You only need to read at one point: When the server starts You only need to write at one point: When the server stops (There's one additional write operation: if the file to read doesn't exist, initialize it). There's no reason to be reading and writing to the same file at the same time (although you can). That said: Take a look at this post. It will allow you to create and read an arbitrary NBT data file. Well the thing is that it will be constantly be edited.
October 29, 201311 yr Editing the integer is not a problem at all. Even then the two points in time that you'll have to save/write to the file is when the server shuts down/starts up. Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.
October 29, 201311 yr Editing the integer is not a problem at all. Even then the two points in time that you'll have to save/write to the file is when the server shuts down/starts up. Because the rest of the time it's just a variable in memory! Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 29, 201311 yr Author Editing the integer is not a problem at all. Even then the two points in time that you'll have to save/write to the file is when the server shuts down/starts up. Yes, but how would I get the server to save it?
October 29, 201311 yr Yes, but how would I get the server to save it? Take a look at this post. It will allow you to create and read an arbitrary NBT data file. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 30, 201311 yr Author Yes, but how would I get the server to save it? Take a look at this post. It will allow you to create and read an arbitrary NBT data file. Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor on NBTTagCompound compound = CompressedStreamTools.read(stream); Does the same on every class.
October 30, 201311 yr Send a PM to Veovis. He's the one who figured it out and has a working codebase. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 30, 201311 yr Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor on NBTTagCompound compound = CompressedStreamTools.read(stream); Does the same on every class. ...Handle the IOException. [spoiler=Hint] try/catch
October 31, 201311 yr Author Default constructor cannot handle exception type IOException thrown by implicit super constructor. Must define an explicit constructor on NBTTagCompound compound = CompressedStreamTools.read(stream); Does the same on every class. ...Handle the IOException. [spoiler=Hint] try/catch The code still does not work, it is not able to be used outside of the try/catch method.
October 31, 201311 yr outside *Cough* Did you try inside the try/catch? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
October 31, 201311 yr Author outside *Cough* Did you try inside the try/catch? I have to call it outside of the try/catch. I can use it inside but it will not work for what I need.
October 31, 201311 yr Author Why not? Because the code I need cannot be used. Let me explain.. try{ NBT compound = whatever; }catch{ //Exception Here } I cannot use compound anywhere else except for the try/catch statement.
October 31, 201311 yr Why not? Because the code I need cannot be used. Let me explain.. try{ compound = whatever; }catch{ //Exception Here } I cannot use compound anywhere else except for the try/catch statement. Initiliaze the variable outside of the try catch like this NBT compound = null; try{ compound = CompressedStreamTools.read(stream); }catch(Exception e){//handle} now you can access the compound variable anywhere. compound.whatEverTheHellYouNeed(); ******* If it helps toss me a thank you.
October 31, 201311 yr Author Why not? Because the code I need cannot be used. Let me explain.. try{ compound = whatever; }catch{ //Exception Here } I cannot use compound anywhere else except for the try/catch statement. Initiliaze the variable outside of the try catch like this NBT compound = null; try{ compound = CompressedStreamTools.read(stream); }catch(Exception e){//handle} now you can access the compound variable anywhere. compound.whatEverTheHellYouNeed(); ******* If it helps toss me a thank you. Yes! Thank you! I can now access it from outside of the try/catch.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.