Posted May 16, 201510 yr 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?
May 16, 201510 yr 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) Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 16, 201510 yr 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); Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 16, 201510 yr 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.
May 16, 201510 yr Author Here's the Entity: http://pastebin.com/QVCgMT4A And here's the following AI, where the owner is being set: http://pastebin.com/gDmMyiqa
May 16, 201510 yr Author In the Entity's readFromNBT(NBTTagCompound), line 196. m_FollowAI.SetOwner(m_OwnerID, m_OwnerDimension);
May 16, 201510 yr 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.
May 21, 201510 yr 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?
May 21, 201510 yr 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.
May 21, 201510 yr 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.... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
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.