Corosus

SMP Entity datawatcher usage

Jul 20th, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. //For _both_ client and server entity file, have this in your constructor, using health integer for example
  2.  
  3. //18 is the id (the max is 31)
  4. dataWatcher.addObject(18, new Integer(health));
  5.  
  6.  
  7. //then simply access and set the variable using 2 functions
  8.  
  9. //get
  10. dataWatcher.getWatchableObjectInt(18)
  11.  
  12. //set
  13. dataWatcher.updateObject(18, Integer.valueOf(health));
  14.  
  15.  
  16.  
  17. //and thats it, the rest is magic :D
Add Comment
Please, Sign In to add comment