Jump to content

[1.7.10] How to add gold?


HappyKiller1O1

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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

Announcements



×
×
  • Create New...

Important Information

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