Jump to content



Recommended Posts

Generally speaking: Packets.


The real question is: Why are you creating an object to store player variables?  Use Capabilities.

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

Whole logic behind it:


* EntityPlayer has Capability assigned.

* Data is (on server) created fresh (1st join) or loaded from player's NBT (later joins).

* Data is parsed into your "Object".

* Use PlayerLoggedInEvent to send packet to player that will contain your serialized Object.

* Client handles packet and deserializes it into "Object" on client and puts it in client's Capability of player.


Points of interest:


* Caps: http://mcforge.readthedocs.org/en/latest/datastorage/capabilities/

* Setting up Caps: https://github.com/MinecraftForge/MinecraftForge/tree/1.9/src/test/java/net/minecraftforge/test

Note: One of them is NoBedTest.


* Packets: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html

* In 1.8+: http://greyminecraftcoder.blogspot.com.au/2015/01/thread-safety-with-network-messages.html


* Forge Events: @SubscribeEvent and registering (google).

* PlayerLoggedInEvent

* AttachCapabilityEvent.Entity (or similar name, lookL links before).


* NBT de-/serialization (Capability storage).


Other: This will take hours to write it well, and only if you know Java and had experience with some of it in past.

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.

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.


  • Create New...

Important Information

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