Jump to content

[1.8] Issue setting Dimension spawnpoint


The_SlayerMC

Recommended Posts

I seem to not be able to set my dimensions spawn, Im adding an End like dimension (one floating island) and i spawn way out of where i should be. I've added these into my world provider but i still seem to spawn in at the same position that i would be in the overworld (coords carrying over from the overworld dimension)

@Override
    public boolean canCoordinateBeSpawn(int x, int z) {
        return this.worldObj.getGroundAboveSeaLevel(new BlockPos(x, 0, z)) == EssenceBlocks.corbaStone;
    }

@Override
public BlockPos getRandomizedSpawnPoint() {
	return new BlockPos(0, 63, 0);
}

@Override
public BlockPos getSpawnPoint() {
	return new BlockPos(0, 63, 0);
}

@Override
public void setSpawnPoint(BlockPos pos) {
	super.setSpawnPoint(new BlockPos(0, 63, 0));
}

@Override
    public BlockPos getSpawnCoordinate() {
        return new BlockPos(0, 63, 0);
    }

@Override
    public int getAverageGroundLevel() {
        return 63;
    }

 

I even got so desperate that i called an event:

@SubscribeEvent
public void transferDims(PlayerChangedDimensionEvent e) {
	if(e.toDim == Config.corba) {
		SlayerAPI.addChatMessage(e.player, "In corba");
		e.player.setLocationAndAngles(0, 63, 0, 0.0F, 0.0F);
	}
}

And it prints the message in chat, so why doesnt it set my location..?

 

As always, any help would be muchly appreciated :D

 

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Link to comment
Share on other sites

  • 2 months later...

I have a similar problem right now.

 

I am unable to set the bed spawn point except in 2 special circumstances.

 

I have tried using

player.setSpawnChunk(bedPos, true, playerDimension);

and

player.setSpawnPoint(bedPos, true);

 

The only times I can sucessfully set a bed spawn point is when

1. A new map where no bed point has been set.

or

2. A player death where an actual bed was slept in then destroyed or removed before the death.

This resets its ability to set a bed location with either function above.

 

Both functions seem to set a set of variables or a set of HashMap in EntityPlayer.  But these do not seem to be updating what Minecraft seems to be actually using to determine where to spawn players. 

 

This looks like a BUG either in Forge or Minecraft 1.8.

(ATTENTION FORGE DEV TEAM?)

 

I also tested for this problem in Minecraft 1.7.10 and that version works well.

 

I need this fixed now as well for one of my mods I am trying to sucessfully code for Minecraft 1.8.

http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/2131444

 

Link to comment
Share on other sites

I went there and read the rules

 

3 points down in first sections it says:

"This is a support forum for players, not for modders needing help with code. Modders go to the Modder Support forum."

 

This here seems to be the modder's support forum unless im confused.

 

Maybe there is a bug reporting thing somewhere.

 

Link to comment
Share on other sites

I have been studying the source code such as EntityPlayer.

 

Its seems right.  I did find a spot the needed a "return;" but doesnt hurt anything if its not there.  If you use setSpawnChunk(...) with a good playerPos in dimension 0 it should do a "return;" right after setting the spawnChunk and spawnForced variables.  BUT it drops past that and adds an entry in the hash map for other dimension bed spawns for dimension 0 but that shouldnt really bother anything.

 

When the player wakes it can call the setSpawnPoint(..) function.  This seems normal.

 

So my next thought is that when I respawn from death why does it send me to the bed location that is wrong? 

 

So where is the code for when "You died" screen shows up and you then hit the button "respawn" ?  Its not picking the right respawn location in every circumstance.

 

So I can set the bed spawn with setSpawnPoint or setSpawnChunk but that is NOT where the "respawn" button sends me.  Where is that code?  I need help. 

 

Link to comment
Share on other sites

On the Gui 'GuiGameOver', when you clickes Respawn button, It calls EntityPlayerSP#respawnPlayer().

It sends the packet 'C16PacketClientStatus' with the flag 'PERFORM_RESPAWN'.

When the Server gets the packet, it ensures that the player really died,

and call ServerConfigurationManager#recreatePlayerEntity(EntityPlayerMP playerIn, int dimension, boolean conqueredEnd)

There it removes the died player and create a 'clone' player.

 

At there, it gets the spawn position by EntityPlayer#getBedSpawnLocation(World worldIn, BlockPos bedLocation, boolean forceSpawn). (the bedLocation parameter is set to the EntityPlayer#getBedLocation(dimension) )

I inspected the code, and I cannot find any clue for the problem.

 

..Wait, where did you put EntityPlayer#setSpawnPoint(bedPos, true);

Since it seems that WorldProvider methods related with spawning is not automatically called when the spawn point is not set.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

my guess would be that the world's spawnpoint is only used for spawning in new players, and the player's bed location is used otherwise, and that may default to the world's spawnpoint. Just a guess from reading the thread, I don't have time to dig into code right now.

Link to comment
Share on other sites

 

SOLUTION FOUND!

 

Ok, so, lol.  I found the problem.  It was so small and so simple that I feel stupid.

 

In my defence: I did multiple checks of my code and studied Minecraft and Forge code for hours.  I learned a bit.  :)

 

The problem with the bug was totally mine and was NOT a bug in forge or minecraft at all.  When I upgraded my code to mc1.8 I changed 1 tiny little thing from a set of coordinates to a BlockPosition and it was wrong. LOL.  oops!  This will be released in a new version of SpawnCommands Teleport mod soon.

 

I actually learned a bit from studying the Minecraft and Forge source code.  It was long and fun.

 

Im adjusting to other minor things as well.  This may take a few days to get the update out for my mod as life does interfere with the coding fun.

 

My apologies and appreciation to those that make Mineraft and MinecraftForge!  :)

 

 

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Minecraft opened, but when I went to create a new world I got another error. https://pastebin.com/mmdNztmW
    • java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'terrablender'!     at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388) ~[fabric-loader-0.15.11.jar:?]     at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33) ~[fabric-loader-0.15.11.jar:?]     at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:386) ~[fabric-loader-0.15.11.jar:?]     at net.fabricmc.loader.impl.game.minecraft.Hooks.startServer(Hooks.java:63) ~[fabric-loader-0.15.11.jar:?]     at net.minecraft.server.Main.main(Main.java:112) ~[server-intermediary.jar:?]     at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.15.11.jar:?]     at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.15.11.jar:?]     at net.fabricmc.loader.impl.launch.knot.KnotServer.main(KnotServer.java:23) ~[fabric-loader-0.15.11.jar:?]     at net.fabricmc.loader.impl.launch.server.FabricServerLauncher.main(FabricServerLauncher.java:69) ~[fabric-loader-0.15.11.jar:?] Caused by: java.lang.NoSuchFieldError: Class me.lortseam.completeconfig.data.BooleanEntry does not have member field 'boolean checkbox'     at me.lortseam.completeconfig.data.BooleanEntry.<init>(BooleanEntry.java:25) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at me.lortseam.completeconfig.data.Entry.create(Entry.java:42) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at me.lortseam.completeconfig.data.EntrySet.lambda$resolve$1(EntrySet.java:31) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:212) ~[?:?]     at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:194) ~[?:?]     at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024) ~[?:?]     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:556) ~[?:?]     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:546) ~[?:?]     at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]     at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265) ~[?:?]     at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:611) ~[?:?]     at me.lortseam.completeconfig.data.EntrySet.resolve(EntrySet.java:32) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at me.lortseam.completeconfig.data.Parent.resolveContainer(Parent.java:58) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at me.lortseam.completeconfig.data.Parent.resolve(Parent.java:110) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at me.lortseam.completeconfig.data.Config.lambda$new$0(Config.java:51) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at me.lortseam.completeconfig.data.Config.deserialize(Config.java:94) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at me.lortseam.completeconfig.data.Config.load(Config.java:121) ~[completeconfig-base-2.5.0-cd5950f26b406f27.jar:?]     at io.github.uhq_games.regions_unexplored.RegionsUnexplored.onTerraBlenderInitialized(RegionsUnexplored.java:70) ~[RegionsUnexploredFabric-0.5.31.20.1.jar:?]     at terrablender.core.TerraBlenderFabric.lambda$onInitialize$0(TerraBlenderFabric.java:40) ~[TerraBlender-fabric-1.20.1-3.0.1.7.jar:?]     at java.util.ArrayList.forEach(ArrayList.java:1597) ~[?:?]     at terrablender.core.TerraBlenderFabric.onInitialize(TerraBlenderFabric.java:38) ~[TerraBlender-fabric-1.20.1-3.0.1.7.jar:?]     at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:384) ~[fabric-loader-0.15.11.jar:?]  
    • Hi, I have the oficial launcher using the version 1.21, and forge 51.0.13, as soon as I start the installation the games crashes and gives me "exit code: 1", I haven't put any mods yet in the folder. Its the second time that uninstall and install everything and nothing works, checket my graphics and they are updated. https://pastebin.com/STPgEiVs   thanks!
    • Ty very much it worked
    • no clue what is going on, you guys seem more knowledgeable than I am. So here's my log as well as my mod list. Error Folder On Google Drive  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.