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

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.

What Minecraft version?

 

In 1.7.10, there is EntityLiving#onSpawnWithEgg, and in 1.8 it was renamed to #onInitialSpawn and takes an extra parametr.

 

Yes, you can change the entity's position from there, but why would you want to make the entity always spawn at one specific location?

  • Author

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.

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

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.