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 my player to spawn on sand with a Y-value > 78. I have a WorldProvider (that is getting used. I mean, its methods are being called..) that has overridden the spawn checking methods. Regardless, Minecraft insists on spawning the player at a location that does not meet the previously mentioned requirements.

 

@Override
public boolean canCoordinateBeSpawn(int x, int z)
{
return worldObj.getTopBlock(x, z) == Blocks.sand && worldObj.getTopSolidOrLiquidBlock(x, z) > 78;
}

@Override
public ChunkCoordinates getRandomizedSpawnPoint()//Notice how, even whenever it's getting the randomized spawn point, I still check to see that it meets the requirements. I do so right down...
{
ChunkCoordinates chunkcoordinates = new ChunkCoordinates(this.worldObj.getSpawnPoint());
boolean isAdventure = worldObj.getWorldInfo().getGameType() == GameType.ADVENTURE;
int spawnFuzz = terrainType.getSpawnFuzz();
int spawnFuzzHalf = spawnFuzz / 2;
if (!hasNoSky && !isAdventure)
{
	do
	{
		chunkcoordinates.posX += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
		chunkcoordinates.posZ += this.worldObj.rand.nextInt(spawnFuzz) - spawnFuzzHalf;
		chunkcoordinates.posY = this.worldObj.getTopSolidOrLiquidBlock(chunkcoordinates.posX,
				chunkcoordinates.posZ);
	} while (!canCoordinateBeSpawn(chunkcoordinates.posX, chunkcoordinates.posY));//here.. But MC still seems to be ignoring them.
}
return chunkcoordinates;
}

Also, I know Minecraft isn't literally ignoring my code, so please don't correct me on that. I promise that I'm not that stupid.

I haven't played with this other than setting the spawn position, but are you sure this is used on respawn or is it used the very first time to find the spawn point every in a world?

 

Try deleting your entire world folder and starting fresh with your code in place and see what happens.

 

 

Long time Bukkit & Forge Programmer

Happy to try and help

  • Author

Actually, all I want is for the first time. So, either way, it doesn't really matter that much. And I have tried deleting the world and making a new one, but it still does not work.

You have a typo in

while (!canCoordinateBeSpawn(chunkcoordinates.posX, chunkcoordinates.posY));

Should probably be chunkcoordinates.posZ.

  • Author

You have a typo in

while (!canCoordinateBeSpawn(chunkcoordinates.posX, chunkcoordinates.posY));

Should probably be chunkcoordinates.posZ.

 

Thanks for finding that!... But it still isn't working.. :/

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.