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

So, after a few more attempts at using datawatchers, I finally figured out I was doing them wrong. So after doing some searching and reading through some other posts, I have come to somewhat understand datawatchers. There are three main portions to using a datawatcher:

 

addObject, which establishes want you are wanting watched obviously.

getWatchableObject, that instructs it as to where to start watching.

updateObject, which updates what is being watched.

 

Now is where my flood of questions come in.

 

The first question goes back to the addObject.

dataWatcher.addObject(2, "");

 

The 2,"" would be the int and the object, correct? I was told that Minecraft already uses 0,1,and 8. So if this is true, all other ints from 2 to 31 should be usable for anything I need watched, correct?

 

Also, is it possible for booleans to be watched?

 

Bonus points: In case anyone is feeling extremely helpful.

 

 

public void tame(EntityPlayer player)
    {
    	
         tamerName=player.username;
         sitting = true;
         motionX = 0;
         motionY = 0;
         motionZ = 0;
         tamed = true;
         exp = 0;
         atHome = false;
         hostile = false;
         rival = null;
         health = getMaxHealth();

        \    }

 

 

 

Here is my tame code that I have put up in so many other posts :P These are the things that need saving, and therefore need datawatchers.

 

These stats are only used once the entity is tamed though. So should I be sticking the updateObject into the tame function?

 

Last question for now: Will I be needing a separate datawatcher for each of these? I would assume so, but figured I would ask if there is a way to have one datawatcher be watching all of them at once.

 

 

Thanks for any help you may be able to provide!

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.