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

Posted

Hey! So, to get right to the point I am trying to add a currency to my mod that will be saved digitally. What I mean is when you pick up a coin it will add it to your overall amount and such. I easily did this in 1.6.4 but in 1.7.10 that's not the case. I just need someone to explain to me how to use the new packet system to communicate with the server about how many coins a specific player has and to add or subtract accordingly. I'm not asking to be hand-fed code here, just for someone to explain how to use the packet system in 1.7.10 with maybe a few examples.

 

Thank you in advance,

 

- Joey

 

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

  • Author

I have seen that tutorial before but, I still couldn't figure out how to tell the server the player got a coin then, add it to their overall amount and update them. I'm sorry if I seem ignorant towards programming; packets just always go over my head.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

  • Author

So, to add gold to someone; I'd send a packet to the server to run the "addGold" method in my GoldKeeper class and that's it?

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

  • Author

Ok that's what slightly confuses me. When someone picks up an item, I would use that event and send the packet to the server, correct?

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

  • Author

But, would I need to send a packet to the client to update a onscreen gui?

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

  • Author

Ok, thanks! I kind of have an understanding of what to do. If I run into any more complex issues I'll just post it here. :)

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

  • Author

So one problem, I need to save a UUID of the player to the ByteBuf. How would I do this?

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

You don't.

 

To send entity reference through packet you want to use entity ID.

 

On IMessage (on server)

entity.getEntityId();

And write it into buffer (int).

 

On receiver client: (read from buffer)

Entity e = world.getEntityByID(msg.entityId);

 

As to your main question - UUID is a 2x long, you can get UUID.getLeastSignificant() and MostSignificant. Those are 2 longs, you can write them to NBT.

1.7.10 is no longer supported by forge, you are on your own.

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.