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

Server side integer saving?


deadrecon98
 Share

Recommended Posts

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!

Link to comment
Share on other sites

  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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! :D

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :D

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share




  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • what do you mean with the width and height i want to draw?, if im using a 1920x1080 image what should i put in width and height
    • Okay so if it was the second what could I do?
    • 1.7 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Yes, although either you did not post the full log or somehow the game got hard shut-down before it ever crashed or even attempted to load a world.
    • every time i load into my survival world it crashes before it even loads. i get this error: The game crashed whilst exception in server tick loop Error: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException Exit Code: -1 and here is the crash report:  ---- Minecraft Crash Report ---- // You're mean. Time: 11/20/21 9:35 PM Description: There was a severe problem during mod loading that has caused the game to fail cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: codechicken/multipart/BlockMultipart     at cpw.mods.fml.common.LoadController.transition(LoadController.java:163)     at cpw.mods.fml.common.Loader.loadMods(Loader.java:544)     at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:208)     at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:480)     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:878)     at net.minecraft.client.main.Main.main(SourceFile:148)     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:497)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.NoClassDefFoundError: codechicken/multipart/BlockMultipart     at java.lang.Class.forName0(Native Method)     at java.lang.Class.forName(Class.java:348)     at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:440)     at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)     at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)     at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)     at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)     at com.google.common.eventbus.EventBus.post(EventBus.java:275)     at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)     at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)     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:497)     at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)     at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)     at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)     at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)     at com.google.common.eventbus.EventBus.post(EventBus.java:275)     at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)     at cpw.mods.fml.common.Loader.loadMods(Loader.java:513)     ... 10 more Caused by: java.lang.ClassNotFoundException: codechicken.multipart.BlockMultipart     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)     ... 34 more Caused by: java.lang.ArrayIndexOutOfBoundsException A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.7.10     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_51, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 447466712 bytes (426 MB) / 1367343104 bytes (1304 MB) up to 3817865216 bytes (3641 MB)     JVM Flags: 4 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx4096m -Xms256m -XX:PermSize=256m     AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1614 78 mods loaded, 78 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored     UC    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)      UC    FML{7.10.99.99} [Forge Mod Loader] (forge-1.7.10-10.13.4.1614-1.7.10.jar)      UC    Forge{10.13.4.1614} [Minecraft Forge] (forge-1.7.10-10.13.4.1614-1.7.10.jar)      UC    appliedenergistics2-core{rv2-stable-10} [AppliedEnergistics2 Core] (minecraft.jar)      UC    OpenModsCore{0.10.1} [OpenModsCore] (minecraft.jar)      UC    <CoFH ASM>{000} [CoFH ASM] (minecraft.jar)      UC    appliedenergistics2{rv2-stable-10} [Applied Energistics 2] (appliedenergistics2-rv2-stable-10.jar)      UC    bdlib{1.9.4.109} [BD Lib] (bdlib-1.9.4.109-mc1.7.10.jar)      UC    ae2stuff{0.5.0.56} [AE2 Stuff] (ae2stuff-0.5.0.56-mc1.7.10.jar)      UC    AgriCraft{1.7.10-1.5.0} [AgriCraft] (AgriCraft-1.7.10-1.5.0.jar)      UC    AppleCore{3.1.1} [AppleCore] (AppleCore-mc1.7.10-3.1.1.jar)      UC    CoFHCore{1.7.10R3.1.4} [CoFH Core] (CoFHCore-[1.7.10]3.1.4-329.jar)      UC    autopackager{1.5.9a} [AutoPackager] (autopackager-1.5.9a.jar)      UC    Baubles{1.0.1.10} [Baubles] (Baubles-1.7.10-1.0.1.10.jar)      UC    ThermalFoundation{1.7.10R1.2.6} [Thermal Foundation] (ThermalFoundation-[1.7.10]1.2.6-118.jar)      UC    ThermalExpansion{1.7.10R4.1.5} [Thermal Expansion] (ThermalExpansion-[1.7.10]4.1.5-248.jar)      UC    BigReactors{0.4.3A} [Big Reactors] (BigReactors-0.4.3A.jar)      UC    AWWayofTime{v1.3.3} [Blood Magic: Alchemical Wizardry] (BloodMagic-1.7.10-1.3.3-17.jar)      UC    BrandonsCore{1.0.0.12} [Brandon's Core] (BrandonsCore-1.0.0.12.jar)      UC    BuildCraft|Core{7.1.23} [BuildCraft] (buildcraft-7.1.23.jar)      UC    BuildCraft|Transport{7.1.23} [BC Transport] (buildcraft-7.1.23.jar)      UC    BuildCraft|Factory{7.1.23} [BC Factory] (buildcraft-7.1.23.jar)      UC    BuildCraft|Silicon{7.1.23} [BC Silicon] (buildcraft-7.1.23.jar)      UC    BuildCraft|Robotics{7.1.23} [BC Robotics] (buildcraft-7.1.23.jar)      UC    BuildCraft|Energy{7.1.23} [BC Energy] (buildcraft-7.1.23.jar)      UC    BuildCraft|Builders{7.1.23} [BC Builders] (buildcraft-7.1.23.jar)      UC    ChestTransporter{2.0.6} [Chest Transporter] (ChestTransporter-1.7.10-2.0.6.jar)      UC    craftingtweaks{1.0.88} [Crafting Tweaks] (craftingtweaks-mc1.7.10-1.0.88.jar)      UC    MineTweaker3{3.1.0} [MineTweaker 3] (CraftTweaker-1.7.10-3.1.0-legacy.jar)      UC    Ding{MC1.7.10v2} [Ding] (Ding-MC1.7.10v2.jar)      UC    DraconicEvolution{1.0.2h} [Draconic Evolution] (Draconic-Evolution-1.7.10-1.0.2h.jar)      UC    eplus{3.0.2-d} [Enchanting Plus] (EnchantingPlus-1.7.10-3.0.2-d.jar)      UC    endercore{1.7.10-0.2.0.39_beta} [EnderCore] (EnderCore-1.7.10-0.2.0.39_beta.jar)      UC    Thaumcraft{4.2.3.5} [Thaumcraft] (Thaumcraft-1.7.10-4.2.3.5.jar)      UC    Waila{1.5.10} [Waila] (Waila-1.5.10_1.7.10.jar)      UC    EnderIO{1.7.10-2.3.0.429_beta} [Ender IO] (EnderIO-1.7.10-2.3.0.429_beta.jar)      UC    ExtraUtilities{1.2.12} [Extra Utilities] (extrautilities-1.2.12.jar)      UC    fastleafdecay{1.4} [Fast Leaf Decay] (FastLeafDecay-1.7.10-1.4.jar)      UC    FoodExpansion{1.0} [Food Expansion] (FoodExpansion1.1.1-mc1.7.10.jar)      UC    gravestone{0.7.10.3} [Gravestone] (GraveStone Mod 0.7.10.3.jar)      UC    iChunUtil{4.2.3} [iChunUtil] (iChunUtil-4.2.3.jar)      UC    IC2{2.2.827-experimental} [IndustrialCraft 2] (industrialcraft-2-2.2.827-experimental.jar)      UC    InventoryPets{1.5.2} [Inventory Pets] (inventorypets-1.7.10-1.5.2-universal.jar)      UC    ironbackpacks{1.7.10-1.2.20} [Iron Backpacks] (IronBackpacks-1.7.10-1.2.20.jar)      UC    ironfurnaces{1.2.4} [Iron Furnaces] (ironfurnaces-1.2.4R.jar)      UC    journeymap{5.1.4p2} [JourneyMap] (journeymap-1.7.10-5.1.4p2-unlimited.jar)      UC    lootbags{2.0.17} [Loot Bags] (LootBags-1.7.10-2.0.17.jar)      UC    Mantle{1.7.10-0.3.2.jenkins191} [Mantle] (Mantle-1.7.10-0.3.2b.jar)      UE    Mekanism{9.1.1} [Mekanism] (Mekanism-1.7.10-9.1.1.1031.jar)      UE    MekanismGenerators{9.1.1} [MekanismGenerators] (MekanismGenerators-1.7.10-9.1.1.1031.jar)      UE    MekanismTools{9.1.1} [MekanismTools] (MekanismTools-1.7.10-9.1.1.1031.jar)      UC    MobDismemberment{4.0.0} [MobDismemberment] (MobDismemberment-4.0.0.jar)      UC    numina{1.7.10} [Numina] (Numina-0.4.1.106.jar)      UC    powersuits{1.7.10-0.11.1.117} [MachineMuse's Modular Powersuits] (ModularPowersuits-1.7.10-0.11.1.117.jar)      UC    MouseTweaks{2.4.4} [Mouse Tweaks] (MouseTweaks-2.4.4-mc1.7.10.jar)      UC    Neat{GRADLE:VERSION-GRADLE:BUILD} [Neat] (Neat 1.0-1.jar)      UC    NEIAddons{1.12.14.40} [NEI Addons] (neiaddons-1.12.14.40-mc1.7.10.jar)      UC    NEIAddons|Developer{1.12.14.40} [NEI Addons: Developer Tools] (neiaddons-1.12.14.40-mc1.7.10.jar)      UC    NEIAddons|AppEng{1.12.14.40} [NEI Addons: Applied Energistics 2] (neiaddons-1.12.14.40-mc1.7.10.jar)      UC    NEIAddons|Botany{1.12.14.40} [NEI Addons: Botany] (neiaddons-1.12.14.40-mc1.7.10.jar)      UC    NEIAddons|Forestry{1.12.14.40} [NEI Addons: Forestry] (neiaddons-1.12.14.40-mc1.7.10.jar)      UC    NEIAddons|CraftingTables{1.12.14.40} [NEI Addons: Crafting Tables] (neiaddons-1.12.14.40-mc1.7.10.jar)      UC    NEIAddons|ExNihilo{1.12.14.40} [NEI Addons: Ex Nihilo] (neiaddons-1.12.14.40-mc1.7.10.jar)      UC    OpenMods{0.10.1} [OpenMods] (OpenModsLib-1.7.10-0.10.1.jar)      UC    OpenBlocks{1.6} [OpenBlocks] (OpenBlocks-1.7.10-1.6.jar)      UC    oreexcavation{1.1.134} [OreExcavation] (OreExcavation-1.1.134.jar)      UC    harvestcraft{1.7.10j} [Pam's HarvestCraft] (Pam's HarvestCraft 1.7.10Lb.jar)      UC    PortalGun{4.0.0-beta-6} [PortalGun] (PortalGun-4.0.0-beta-6-fix-1.jar)      UC    ProjectE{1.7.10-PE1.10.1} [ProjectE] (ProjectE-1.7.10-PE1.10.1.jar)      UC    rftools{4.23} [RFTools] (rftools-4.23.jar)      UC    simplyjetpacks{1.5.3} [Simply Jetpacks] (SimplyJetpacks-MC1.7.10-1.5.3.jar)      UC    TConstruct{1.7.10-1.8.8.build988} [Tinkers' Construct] (TConstruct-1.7.10-1.8.8.jar)      UC    ThermalDynamics{1.7.10R1.2.1} [Thermal Dynamics] (ThermalDynamics-[1.7.10]1.2.1-172.jar)      UC    TMechworks{0.2.15.106} [Tinkers' Mechworks] (TMechworks-1.7.10-0.2.15.106.jar)      UC    trashslot{1.0.31} [TrashSlot] (trashslot-mc1.7.10-1.0.31.jar)      UC    TwilightForest{2.3.8dev} [The Twilight Forest] (twilightforest-1.7.10-2.3.8.jar)      UC    WailaHarvestability{1.1.6} [Waila Harvestability] (WailaHarvestability-mc1.7.10-1.1.6.jar)      UC    wawla{1.3.1} [What Are We Looking At] (Wawla-1.0.5.120.jar)      GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 471.55' Renderer: 'NVIDIA GeForce RTX 3060/PCIe/SSE2'     OpenModsLib class transformers: [stencil_patches:FINISHED],[movement_callback:FINISHED],[player_damage_hook:FINISHED],[map_gen_fix:ENABLED],[gl_capabilities_hook:FINISHED],[player_render_hook:ENABLED]     Class transformer null safety: found misbehaving transformers: me.guichaguri.betterfps.transformers.MathTransformer(me.guichaguri.betterfps.transformers.MathTransformer@7480d4ff) returned non-null result: 0,me.guichaguri.betterfps.transformers.EventTransformer(me.guichaguri.betterfps.transformers.EventTransformer@41f4cb61) returned non-null result: 0     AE2 Version: stable rv2-stable-10 for Forge 10.13.2.1291     CoFHCore: -[1.7.10]3.1.4-329     ThermalFoundation: -[1.7.10]1.2.6-118     ThermalExpansion: -[1.7.10]4.1.5-248     Mantle Environment: Environment healthy.     TConstruct Environment: Environment healthy.     ThermalDynamics: -[1.7.10]1.2.1-172 any help is extremely appreciated 
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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