-
Notifications
You must be signed in to change notification settings - Fork 155
implement beds , respawn anchors #938
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed a few problems after a quick look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a few of my previous comments that have not been addressed, found some more issues after another look through
server/block/bed.go
Outdated
// SpawnBlock represents a block using which player can set his spawn point. | ||
type SpawnBlock interface { | ||
SpawnBlock() bool | ||
Update(pos cube.Pos, u item.User, w *world.World) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use proper grammer in the docs and also document the methods of the interface. Update is a very ambiguous name and doesn't hint towards being related to spawn points
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have changed the method name but the documentation is still needing to be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have had another look, there are still unresolved comments that I have previously provided. I am not going to review this PR anymore until every single comment has been acted on or you've replied with a valid counter argument. I have gone through and resolved all the comments you have addressed but there are still many that remain
Please fix merge conflicts |
bro , I'm dead ☠️ |
# Conflicts: # server/player/handler.go # server/player/player.go # server/session/session.go # server/world/tick.go # server/world/world.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of the pr looks good just from a quick glance saw this issue
# Conflicts: # server/player/player.go # server/session/session.go
type RespawnAnchor struct { | ||
solid | ||
bassDrum | ||
Charge int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document this
after making Bed.Sleeper as *world.EntityHandle appeared dead locks when placing, breaking and sleeping |
This reverts commit 737c961. I'm stupid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have had another look over and found some inconsistencies with your implementation compared to vanilla, or at least what is documented on the wiki. If any of this is incorrect for Bedrock then I am happy to ignore those. There are also still multiple unresolved comments that myself and @DaPigGuy have left previously, please make sure you scroll through https://github.com/df-mc/dragonfly/pull/938/files and look at any unresolved comment and either make the requested changes or reply with a counter reason
|
||
sleeper := headSide.Sleeper | ||
if sleeper != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary whitespace
// MaxCount returns the maximum number of items that a stack may be composed of. The number returned must | ||
// MaxCount returns the maximum number of items a stack may be composed of. The number returned must |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is irrelevant, please remove it
// Sleep makes the player sleep at the given position. If the position does not map to a bed (specifically the head side), | ||
// the player will not sleep. | ||
func (p *Player) Sleep(pos cube.Pos) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary whitespace
b.Sleeper = p.H() | ||
tx.SetBlock(pos, b, nil) | ||
|
||
tx.World().SetRequiredSleepDuration(time.Second * 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be time.Millisecond * 5050
A player sleeps in a bed for 101 in-game ticks, or 5.05 seconds before the time skips to the next day.
} | ||
|
||
time := w.Time() % world.TimeFull | ||
if (time < world.TimeNight || time >= world.TimeSunrise) && !tx.ThunderingAt(pos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic does not match the behaviour documented on the wiki:
A player sleeps by using a bed during a thunderstorm, or at night (between 12542 and 23459 ticks in clear weather, when stars appear in the sky, or between 12010 and 23991 ticks in rainy weather). Players can sleep during a thunderstorm even if they are in a biome where it does not rain (i.e. desert)
// spawnLocation returns position and world where player should be spawned. | ||
func (p *Player) spawnLocation() (playerSpawn cube.Pos, w *world.World, spawnBlockBroken bool, previousDimension world.Dimension) { | ||
tx := p.tx | ||
w = tx.World() | ||
previousDimension = w.Dimension() | ||
playerSpawn = w.PlayerSpawn(p.UUID()) | ||
if b, ok := tx.Block(playerSpawn).(block.RespawnBlock); ok && b.CanRespawnOn() { | ||
return playerSpawn, w, false, previousDimension | ||
} | ||
|
||
// We can use the principle here that returning through a portal of a specific dimension inside that dimension will | ||
// always bring us back to the overworld. | ||
w = w.PortalDestination(w.Dimension()) | ||
worldSpawn := w.Spawn() | ||
return worldSpawn, w, playerSpawn != worldSpawn, previousDimension | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function does not return accurate spawn positions. block.RespawnBlock should have a method which returns the position where the player should respawn since it's not at the same place where the bed/respawn anchor is located.
https://minecraft.wiki/w/Bed#Setting_the_spawn_point
https://minecraft.wiki/w/Respawn_Anchor#Respawning
@TwistedAsylumMC are these changes above all that need to be altered before this PR is ready for master? I might be able to get these done relatively quickly |
No description provided.