Jump to content

Recommended Posts

Posted

I want to know if is there some function to execute code when you spawn for the first time on a new world.

 

At the same time, is it possible to set the spawn point to a new place and make it exact point, for example X=0, Y=75, Z=0? And always be that point, and not around that area.

Posted

Hi CoolAlias thanks for the answer.

 

Yes I forgot, I'm talking about 1.7.10

 

It's not an entity (Mobs), but the player. Basically when you spawn in a new world I want to "move" the player into a room, and if he dies once he is out on the world he would have to spawn in this room again.

 

Also thinking about sending them to a new "Void" dimension containing only this room, but that's something I will work on later on.

Posted

I think that's not what he wanted. EDIT: OP was faster :D

 

You want to do something when player spawns in world for the 1st time right?

 

You will need IExtendedEntityProperties - assign them to EntityPlayer on EntityConstructing event and save boolean there.

Then use PlayerLoggedInEvent - check if boolean is false - if it is - do stuff and change to true.

 

Yes, this is the only way to perform one-time action (you need to save it).

 

EDIT

As you mentioned teleporting on respawn - you will need to know it:

Every player has EntityPlayer. Whem player dies, his entity will be assigned to "him" until he either leaves game or server OR click respawn button - on that moment, old Entity is lost and new one is created.

If you want to move player (tp) after respawn you can use EntityJoinedWorldEvent or PlayerEvent.PlayerRespawnEvent. (EDIT)

Try it.

1.7.10 is no longer supported by forge, you are on your own.

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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