Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way for custom world providers to resolve player spawn worlds themselves #900

Open
RestartFU opened this issue Jul 17, 2024 · 2 comments
Assignees
Labels
feature New feature or request
Milestone

Comments

@RestartFU
Copy link
Contributor

hey, recently, while working on my custom provider for dragonfly, I realized that when players get spawned in, they are always going to get spawned in using the server worlds (overworld, nether, end).

This is great but this means that we'd have to merge our dimensions into a single world. Not everybody wants to do that.

As you can see here: https://github.com/bedrock-gophers/provider/blob/master/provider/settings.go#L16-L19
I've made it so you can give a custom world "resolver", which you can use if you are using my custom player provider

here's how we use it on moyai:

func wrld(dim world.Dimension) *world.World {
	switch dim {
	case world.Overworld:
		return Overworld()
	case world.Nether:
		return Nether()
	case world.End:
		fmt.Println("end")
		return End()
	}
	return nil
}

func NewServer(config server.Config) *server.Server {
	providerSettings := provider.DefaultSettings()
	providerSettings.UseServerWorld = false
	providerSettings.World = wrld
	providerSettings.FlushRate = time.Minute * 10
	providerSettings.SaveEffects = false

	playerProvider = provider.NewProvider(&config, providerSettings)
	srv = config.New()
	return srv
}

I was wondering if the main developers would be OK with adding such a field to the server config
(only the world function I mean)

if so, please suggest field names so I can start working on a PR

@T14Raptor
Copy link
Member

This can already be done by providing a world using this field in the player's data.

@Sandertv
Copy link
Member

Player's data is not readily accessible to the user so there does need to be some other solution

@Sandertv Sandertv changed the title potentailly add a new field to the server config Add a way for custom world providers to resolve player spawn worlds themselves Nov 25, 2024
@Sandertv Sandertv self-assigned this Nov 25, 2024
@Sandertv Sandertv added the feature New feature or request label Nov 25, 2024
@Sandertv Sandertv modified the milestones: v0.11.0, v? Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants