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

[1.16.1] FluidTank issue


Maciej916
 Share

Recommended Posts

Every time i want to serialize or deserialize FluidTank in tile entity im getting StackOverflow issue, also when i run mod on dedicaded server and when I place block with FluidTank i'm also getting StackOverflow. Is this forge issue or i'm doing something wrong because on 1.15.2 it worked just fine.

 

[19:45:14] [IO-Worker-18/ERROR] [minecraft/Util]: Caught exception in thread Thread[IO-Worker-18,5,SERVER]
java.lang.StackOverflowError: null
	at java.io.DataOutputStream.write(DataOutputStream.java:107) ~[?:1.8.0_251] {}
	at java.io.DataOutputStream.writeUTF(DataOutputStream.java:401) ~[?:1.8.0_251] {}
	at java.io.DataOutputStream.writeUTF(DataOutputStream.java:323) ~[?:1.8.0_251] {}
	at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:407) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.write(CompoundNBT.java:84) ~[?:?] {re:classloading}
	at net.minecraft.nbt.CompoundNBT.writeEntry(CompoundNBT.java:408) ~[?:?] {re:classloading}

 

Also when I load save with FLuidTank tile im getting

Caused by: java.lang.RuntimeException: Tried to read NBT tag with too high complexity, depth > 512

 

My code:

    public final FluidTank tank = new FluidTank(10);
    
    @Override
    public void func_230337_a_(BlockState state, @Nonnull final CompoundNBT compound) {
        super.func_230337_a_(state, compound);
        this.tank.readFromNBT(compound.getCompound("tank"));
    }

    @Override
    public CompoundNBT write(CompoundNBT compound) {
        super.write(compound);
        compound.put("tank", this.tank.writeToNBT(compound));
        return compound;
    }

 

Forge version: 32.0.41

Edited by Maciej916
Link to comment
Share on other sites

2 hours ago, Maciej916 said:

compound.put("tank", this.tank.writeToNBT(compound));

This first writes the tank data to compound and then stores compound into itself under the name "tank".

So when the game writes compound to disk, it has to write compound. Which means it has to write compound. Which means it has to write compound. Repeat ad infinitum until the JVM explains to you that you are being silly.

  • Haha 1
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

×
×
  • Create New...

Important Information

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