Jump to content

[1.7.2] Player not spawning where I tell it to


acid1103

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.