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

World.func_152378_a(UUID) is supposed to return an EntityPlayer, but when I try to call it with a saved player ID (at world load, using NBT tags), it returns null. Does anyone know what I'm doing wrong?

World.func_152378_a(UUID) is supposed to return an EntityPlayer, but when I try to call it with a saved player ID (at world load, using NBT tags), it returns null. Does anyone know what I'm doing wrong?

1) Check that player is already logged in

2) Check that you're doing it in correct world (each dimension has different worlds)

How do I go about doing those things?

1) Do your thing after player logged in: if you can, do this when player joins the world...

2) Save dimension id where player was, and then get world via

World world = MinecraftServer.getServer().worldServerForDimension(dimId);

  • Author

I'm not sure I can, since the loading occurs in the entity class. Is there a way for me to check when the player logs in, inside of that class?

ย 

Just did the dimension saving thing; it made no difference, still returns null.

  • Author

In the Entity's readFromNBT(NBTTagCompound), line 196.

ย 

m_FollowAI.SetOwner(m_OwnerID, m_OwnerDimension);

  • Author

Oh, right! Now I get it. Thanks for clearing that up.

ย 

I pretty much copied the way EntityAIFollowOwner does it, except I don't use data watchers because I am not familiar with them.

ย 

A UUID is used in the Entity, because it is passed in from the egg it hatches from.

ย 

An EntityPlayer is used in the AI, because otherwise I'd be calling worldObj.func_152378_a(UUID) all the time to get one for the information required to move towards it.

  • Author

Has anyone got any idea why this might be happening?

ย 

Should I try switching the Entity to inherit from EntityTameable, and use the vanilla EntityAIFollowOwner?

If I did, how would I set the owner the moment the egg hatched, rather than when it was fed a certain item?

I have a question about the players UUID. How are they actually saved, Ive been looking at the Yggdrasil class with Ernio and we both got stumped by how/where the players uuid is actually being saved. I want to create a dynamic link between an entity and the player and so far I havent had any luck with this.

I have a question about the players UUID. How are they actually saved, Ive been looking at the Yggdrasil class with Ernio and we both got stumped by how/where the players uuid is actually being saved. I want to create a dynamic link between an entity and the player and so far I havent had any luck with this.

How:

uuid.toString returns string form uuid. UUID.fromString returns uuid from string. I hope you know how to save string, right?

ย 

Where:

EntityTameable.getOwner returns owner from watchable string (representing uuid) with id 17, that is saved and loaded like all data watchers....

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.