Posted April 28, 201411 yr 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.
April 28, 201411 yr 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
April 28, 201411 yr 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.
April 28, 201411 yr You have a typo in while (!canCoordinateBeSpawn(chunkcoordinates.posX, chunkcoordinates.posY)); Should probably be chunkcoordinates.posZ.
April 28, 201411 yr 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.