Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Author
10 hours ago, diesieben07 said:

This has nothing to do with static.

One of your constructors registers the data parameter. The other one doesn't. They both need to do it.

Surprisingly it worked. I had to register the key with a null value, though. Now I'm getting a crash after shooting the entity, quitting and reloading. I have no idea why since my prints tell me that my uuid value is not null.

Edited by Melonslise

  • Author
1 hour ago, diesieben07 said:

You managed to get a null Integer into your ID key.

I added prints to the read/write nbt methods to check if I was writing/reading a null UUID, however you can see from the log that it's reading/writing an existing value.

  • Author
Just now, diesieben07 said:

The UUID is not the problem.

Isn't the log pointing at the read/write nbt method, though?

  • Author
14 minutes ago, diesieben07 said:

No, it is not.

Are you sure?

Quote

Caused by: java.lang.NullPointerException
at net.minecraft.nbt.NBTTagCompound.setUniqueId(NBTTagCompound.java:126) ~[NBTTagCompound.class:?]
at melonslise.runicinscription.common.entity.EntityProjectile.writeEntityToNBT(EntityProjectile.java:210) ~[EntityProjectile.class:?]
at net.minecraft.entity.Entity.writeToNBT(Entity.java:1798) ~[Entity.class:?]
... 12 more

 

But even if the issue really is caused by a null in the ID key, I can't register the DataManager on the client otherwise. If I try to create a player field, it will be null on the client.

Edited by Melonslise

  • Author
15 minutes ago, diesieben07 said:

 

Alright, but as I said, if I create a player field to set the key, it will be null on client and I don't know any way to fix that.

  • Author
6 minutes ago, diesieben07 said:

You can't do this. You must set a value.

I thought the DataManager synced the client and server. Since I'm already setting the key on the server, shouldn't it sync to the client as well?

  • Author
6 minutes ago, diesieben07 said:

Yes, but it can only do so if the key is registered there.

I thought I was already registering the key in both my constructors.

  • Author
27 minutes ago, diesieben07 said:

Yes, but you said you did it with null on the client. You cannot use null.

What do I use then? A random number?

  • Author
1 hour ago, diesieben07 said:

Yes, you can use -1 for example. It will be overwritten by what the server sends anyways.

Still getting an error. Still looks like it has problems with nbt. I added a print and looks like it's writing nbt 2 times. Once it writes the correct value and the second time it writes null. Why so?

  • Author
8 minutes ago, diesieben07 said:

I do not know.

This is almost impossible to diagnose for me, because I do not see your code and I cannot run it. Please post a working Git repo of your mod if possible.

Alright, it will take a while, though.

  • Author
56 minutes ago, diesieben07 said:

I do not know.

This is almost impossible to diagnose for me, because I do not see your code and I cannot run it. Please post a working Git repo of your mod if possible.

Here's the repo. Check the 'Alpha-1.10' branch.

Remember, though, the update is a heavy wip so you might see very unoptimized/retarded code in some places.

Edited by Melonslise

  • Author
1 minute ago, diesieben07 said:

Sorry, but your repository is not useful, you are missing at least the build.gradle. The repository root should be the root of your project.

I haven't compiled the mod so far so I'm currently using the default build.gradle from the latest 1.10 forge.

  • Author
3 minutes ago, diesieben07 said:

Good for you.

Tell me which files you need and I'll upload them for you.

Edited by Melonslise

  • Author
8 minutes ago, diesieben07 said:

At the very least the repository needs to contain your build.gradle and your code. The repo should work out of the box when being cloned.

Ok, I added the build.gradle file.

  • Author
9 minutes ago, diesieben07 said:

This condition will never be true. NBTTagCompound::setUniqueId creates two entries with suffixes "Most" and "Least", so hasKey cannot be used to check if a unique ID saved like this exists. You have to use NBTTagCompound::hasUniqueId instead.

Incredible. Now everything is working.

Thanks a lot to you! You deserve a place in the credits list of my mod.

Edited by Melonslise

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.