Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] Setting player spawn


CupOfTea
 Share

Recommended Posts

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.

Link to comment
Share on other sites

The method sets the spawn position for the given dimension, should the player respawn there. So if you set the spawnpoint for dimension 1 but the player respawns in dimension 0 (overworld, the default) your spawn position doesn't do anything.

 

The respawn dimension is determined by the world type. The game will first try to respawn the player in their current dimension, unless that dimension is specified to not allow respawns (nether, the end). In that case the world type specifies the respawn dimension (in case of nether and end: the overworld).

 

At the moment there is no way for you to intercept this behavior for dimensions that are not yours.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • yeah it should, this is the logic of the vanilla SuspiciousStewItem
    • And doing that should fix the effect triggering twice every time a food is eaten?
    • I am trying to install Forge Client for Minecraft 1.18.2 and I have Java 18. But while "Building Processors", it gives me an error. The error is: Failed to run processor: javax.net.ssl.SSLHandshakeException:PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target See log for more details. Log: https://pastebin.com/zFSzP9Ux
    • So I've been able to run a forge server with mods and everything just fine on this computer before, I'm not sure what happened (I just came back to play after a year long hiatus), there must be some step I'm missing. C:\Users\(My Name)\Desktop\Clockwise server>java -Xmx2048M -Xms2048M -jar forgeserver.jar nogui 2022-05-26 09:20:31,218 main WARN Advanced terminal features are not available in this environment [09:20:31] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.1.0, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, nogui] [09:20:31] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 18.0.1.1 by Oracle Corporation Exception in thread "main" java.lang.IllegalAccessError: class cpw.mods.modlauncher.SecureJarHandler (in unnamed module @0x2aece37d) cannot access class sun.security.util.ManifestEntryVerifier (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x2aece37d         at cpw.mods.modlauncher.SecureJarHandler.lambda$static$1(SecureJarHandler.java:41)         at cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck(LamdbaExceptionUtils.java:95)         at cpw.mods.modlauncher.SecureJarHandler.<clinit>(SecureJarHandler.java:41)         at cpw.mods.modlauncher.Launcher.lambda$new$6(Launcher.java:55)         at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:52)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:47)         at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(Environment.java:62)         at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:55)         at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)         at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63)         at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60)         at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) C:\Users\(My Name)\Desktop\Clockwise server>PAUSE Press any key to continue . . . I'm following this tutorial https://www.youtube. com/watch?v=bIjisWyxU-8 (just need to remove the space between youtube. and com) Any help is greatly appreciated.  
    • it is quite possible that no one has ever done that successfully.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.