fix shadows on entities

This commit is contained in:
olebeck 2023-04-05 16:07:49 +02:00
parent 796a846b8e
commit 2e920a7bf0
4 changed files with 20 additions and 8 deletions

View File

@ -197,7 +197,7 @@ func (s *entityState) ToServerEntity() serverEntity {
Encoded: s.EntityType,
NBT: map[string]any{
"Pos": vec3float32(s.Position),
"Rotation": []float32{s.Yaw, s.Pitch},
"Rotation": []float32{s.HeadYaw, s.Pitch},
"Motion": vec3float32(s.Velocity),
"UniqueID": int64(s.UniqueID),
},

View File

@ -367,7 +367,7 @@ func (w *worldsHandler) playerData() (ret map[string]any) {
ret["Tags"] = []string{}
ret["OnGround"] = true
spawn := w.proxy.Server.GameData().PlayerPosition
spawn := w.serverState.PlayerPos.Position
ret["SpawnX"] = int32(spawn.X())
ret["SpawnY"] = int32(spawn.Y())

View File

@ -318,7 +318,7 @@ func (w *worldsHandler) SaveAndReset() {
logrus.Error(err)
}
playerPos := w.proxy.Server.GameData().PlayerPosition
playerPos := w.serverState.PlayerPos.Position
spawnPos := cube.Pos{int(playerPos.X()), int(playerPos.Y()), int(playerPos.Z())}
// write metadata

View File

@ -72,11 +72,23 @@ func (bp *BehaviourPack) AddEntity(entity EntityIn) {
"value": scale,
}
}
AlwaysShowName := entity.Meta.Flag(protocol.EntityDataKeyFlags, protocol.EntityDataFlagAlwaysShowName)
if AlwaysShowName {
entry.MinecraftEntity.Components["minecraft:nameable"] = map[string]any{
"always_show": true,
"allow_name_tag_renaming": false,
width, widthOk := entity.Meta[protocol.EntityDataKeyWidth].(float32)
height, heightOk := entity.Meta[protocol.EntityDataKeyHeight].(float32)
if widthOk || heightOk {
entry.MinecraftEntity.Components["minecraft:collision_box"] = map[string]any{
"width": width,
"height": height,
}
}
if _, ok := entity.Meta[protocol.EntityDataKeyFlags]; ok {
AlwaysShowName := entity.Meta.Flag(protocol.EntityDataKeyFlags, protocol.EntityDataFlagAlwaysShowName)
if AlwaysShowName {
entry.MinecraftEntity.Components["minecraft:nameable"] = map[string]any{
"always_show": true,
"allow_name_tag_renaming": false,
}
}
}