From bc8967ba638a692280f9471146e4160eaefe86e9 Mon Sep 17 00:00:00 2001 From: DaPigGuy Date: Tue, 12 Nov 2024 01:13:08 -0800 Subject: [PATCH 1/3] block/skull.go: Fix skulls not being correctly registered --- cmd/blockhash/main.go | 2 +- server/block/hash.go | 2 +- server/block/skull.go | 13 ++++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cmd/blockhash/main.go b/cmd/blockhash/main.go index 9a8e8f51f..1f4084a06 100644 --- a/cmd/blockhash/main.go +++ b/cmd/blockhash/main.go @@ -246,7 +246,7 @@ func (b *hashBuilder) ftype(structName, s string, expr ast.Expr, directives map[ case "WoodType", "FlowerType", "DoubleFlowerType", "Colour": // Assuming these were all based on metadata, it should be safe to assume a bit size of 4 for this. return "uint64(" + s + ".Uint8())", 4 - case "CoralType": + case "CoralType", "SkullType": return "uint64(" + s + ".Uint8())", 3 case "AnvilType", "SandstoneType", "PrismarineType", "StoneBricksType", "NetherBricksType", "FroglightType", "WallConnectionType", "BlackstoneType", "DeepslateType", "TallGrassType": return "uint64(" + s + ".Uint8())", 2 diff --git a/server/block/hash.go b/server/block/hash.go index a00692ba3..05bf16d68 100644 --- a/server/block/hash.go +++ b/server/block/hash.go @@ -748,7 +748,7 @@ func (s Sign) Hash() (uint64, uint64) { } func (s Skull) Hash() (uint64, uint64) { - return hashSkull, uint64(s.Attach.FaceUint8()) + return hashSkull, uint64(s.Type.Uint8()) | uint64(s.Attach.FaceUint8())<<3 } func (s Slab) Hash() (uint64, uint64) { diff --git a/server/block/skull.go b/server/block/skull.go index 414fab5d3..62621dabd 100644 --- a/server/block/skull.go +++ b/server/block/skull.go @@ -115,10 +115,13 @@ func (s Skull) EncodeBlock() (string, map[string]interface{}) { // allSkulls ... func allSkulls() (skulls []world.Block) { - for _, f := range cube.HorizontalFaces() { - // A direction of -2 and -1 isn't actually valid, but when encoding the block these are encoded as 0 and 1. We - // can't otherwise represent this properly in an Attachment type. - skulls = append(skulls, Skull{Attach: WallAttachment(f.Direction())}) + for _, t := range SkullTypes() { + for _, f := range cube.HorizontalFaces() { + // A direction of -2 and -1 isn't actually valid, but when encoding the block these are encoded as 0 and 1. We + // can't otherwise represent this properly in an Attachment type. + skulls = append(skulls, Skull{Type: t, Attach: WallAttachment(f.Direction())}) + } + skulls = append(skulls, Skull{Type: t, Attach: StandingAttachment(0)}) } - return append(skulls, Skull{Attach: StandingAttachment(0)}) + return } From 3e18596982bda0024ce9ac159ea61f97c45d75d2 Mon Sep 17 00:00:00 2001 From: DaPigGuy Date: Tue, 12 Nov 2024 01:34:21 -0800 Subject: [PATCH 2/3] block/skull.go: Remove pointless conversion of cube.Face to cube.Direction --- server/block/skull.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/block/skull.go b/server/block/skull.go index 62621dabd..aecb468f0 100644 --- a/server/block/skull.go +++ b/server/block/skull.go @@ -116,10 +116,8 @@ func (s Skull) EncodeBlock() (string, map[string]interface{}) { // allSkulls ... func allSkulls() (skulls []world.Block) { for _, t := range SkullTypes() { - for _, f := range cube.HorizontalFaces() { - // A direction of -2 and -1 isn't actually valid, but when encoding the block these are encoded as 0 and 1. We - // can't otherwise represent this properly in an Attachment type. - skulls = append(skulls, Skull{Type: t, Attach: WallAttachment(f.Direction())}) + for _, d := range cube.Directions() { + skulls = append(skulls, Skull{Type: t, Attach: WallAttachment(d)}) } skulls = append(skulls, Skull{Type: t, Attach: StandingAttachment(0)}) } From c5d09f3bba3adec16fc3598eedb0c354653d0ea1 Mon Sep 17 00:00:00 2001 From: Darya Markova <122279000+Dasciam@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:55:19 +0500 Subject: [PATCH 3/3] player/type.go: Increased player position network offset (#931) --- server/player/type.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/player/type.go b/server/player/type.go index 1f1a2c17d..1b3f294df 100644 --- a/server/player/type.go +++ b/server/player/type.go @@ -9,7 +9,7 @@ import ( type Type struct{} func (Type) EncodeEntity() string { return "minecraft:player" } -func (Type) NetworkOffset() float64 { return 1.62 } +func (Type) NetworkOffset() float64 { return 1.621 } func (Type) BBox(e world.Entity) cube.BBox { p := e.(*Player) s := p.Scale()