Posted August 13, 201510 yr Is there a Player method I could use to force players to spawn at a specific location in a dimension other than the Overworld? I've tried using the following public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { player.setSpawnChunk(pos, true, player.worldObj.provider.getDimensionId()); } return true; } It seems to only work in the Overworld though.
August 13, 201510 yr I've had problems with this in the past. setspawn and get spawn seem to report the same position no matter what world you are in. Change it in one, and it changes it in another. Probably something I did wrong and there is another way to get to the goal, but I finally implemented my own teleporter class that looks at a different place for spawnpoints per world and I made it so all teleports use my method instead. Long time Bukkit & Forge Programmer Happy to try and help
August 13, 201510 yr I think what I typed mislead what I meant. Let me try an example. - normal dimensions -1,0,1 - Add other world groups every 5 starting up at 30, so 30,31,32 : 35,36,37, ect. The first being the overworld. When you get the world object reprsented by say dimension 35 and setspawn, it seems to be the spawn for every dimention. If I search for getspawn from all the other dimensions (say 0, 30, 40, ect), they all report the spawnpoint just set for 35. That is what I meant by what I said. If that is the intended impact, so be it, but it seems weird. Long time Bukkit & Forge Programmer Happy to try and help
August 13, 201510 yr I don't want to drift off his topic. Only brought this up because it was relevant and I think this will work for him if used right (unlike what i'm doing). I'm going off memory, but I think it is world.getspawn. In 1.8 it returns a BlockPos. Also from memory, it goes into its WorldInfo to get the position. I've looked at a few times and been baffled as to why it doesn't work. It seems like it should be per dimension, but iterating through the worlds after setting it, seems to impact every dimension at the same time. I'll post the exact code later in a seperate post and let this one continue for just Mr Tea Cup Long time Bukkit & Forge Programmer Happy to try and help
August 13, 201510 yr oh, gotcha. That matches its behavior Is there a per dimension world-spawnpoint built in? Long time Bukkit & Forge Programmer Happy to try and help
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.