Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into world-overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandertv committed Oct 29, 2024
2 parents 786d930 + 4bd82eb commit 8d7685b
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ require (
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9
github.com/cespare/xxhash/v2 v2.3.0
github.com/df-mc/goleveldb v1.1.9
github.com/df-mc/worldupgrader v1.0.17
github.com/df-mc/worldupgrader v1.0.18
github.com/go-gl/mathgl v1.1.0
github.com/google/uuid v1.6.0
github.com/pelletier/go-toml v1.9.5
github.com/sandertv/gophertunnel v1.41.1
github.com/sandertv/gophertunnel v1.42.0
github.com/segmentio/fasthash v1.0.3
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
golang.org/x/mod v0.21.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/df-mc/goleveldb v1.1.9 h1:ihdosZyy5jkQKrxucTQmN90jq/2lUwQnJZjIYIC/9YU=
github.com/df-mc/goleveldb v1.1.9/go.mod h1:+NHCup03Sci5q84APIA21z3iPZCuk6m6ABtg4nANCSk=
github.com/df-mc/worldupgrader v1.0.17 h1:9NRTihn8/KFL+ajUHDc+KikZcsrhoxR/Tq2ekA5ZR7k=
github.com/df-mc/worldupgrader v1.0.17/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
github.com/df-mc/worldupgrader v1.0.18 h1:Q34X9ID/hGuDyj9oiq+dpyjOaJdNxhVmVUepf/EPYDA=
github.com/df-mc/worldupgrader v1.0.18/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-gl/mathgl v1.1.0 h1:0lzZ+rntPX3/oGrDzYGdowSLC2ky8Osirvf5uAwfIEA=
github.com/go-gl/mathgl v1.1.0/go.mod h1:yhpkQzEiH9yPyxDUGzkmgScbaBVlhC06qodikEM0ZwQ=
Expand Down Expand Up @@ -41,8 +41,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sandertv/go-raknet v1.14.2 h1:UZLyHn5yQU2Dq2GVq/LlxwAUikaq4q4AA1rl/Pf3AXQ=
github.com/sandertv/go-raknet v1.14.2/go.mod h1:/yysjwfCXm2+2OY8mBazLzcxJ3irnylKCyG3FLgUPVU=
github.com/sandertv/gophertunnel v1.41.1 h1:6JoDLzw9CGA3+KVSBUxnectmpaEdH2JwiShCM5dA+Cg=
github.com/sandertv/gophertunnel v1.41.1/go.mod h1:krvLSeRUNQ2iEYJNEgzrKtWO8W5ybZxN5lFfSCkHoNk=
github.com/sandertv/gophertunnel v1.42.0 h1:qOc/Dht/Kvh67uxJ6sgkL0oP+jhuXkVwk7KEf3d1p9M=
github.com/sandertv/gophertunnel v1.42.0/go.mod h1:krvLSeRUNQ2iEYJNEgzrKtWO8W5ybZxN5lFfSCkHoNk=
github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
14 changes: 9 additions & 5 deletions server/block/skull.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ func (s Skull) BreakInfo() BreakInfo {

// EncodeItem ...
func (s Skull) EncodeItem() (name string, meta int16) {
return "minecraft:skull", int16(s.Type.Uint8())
return "minecraft:" + s.Type.String(), 0
}

// DecodeNBT ...
func (s Skull) DecodeNBT(data map[string]interface{}) interface{} {
s.Type = SkullType{skull(nbtconv.Uint8(data, "SkullType"))}
if t := skull(nbtconv.Uint8(data, "SkullType")); t != 255 {
// Used to upgrade pre-1.21.40 skulls after their flattening. Any skull placed since will set
// SkullType to 255.
s.Type = SkullType{t}
}
s.Attach.o = cube.OrientationFromYaw(float64(nbtconv.Float32(data, "Rotation")))
if s.Attach.facing >= 0 {
s.Attach.hanging = true
Expand All @@ -98,15 +102,15 @@ func (s Skull) DecodeNBT(data map[string]interface{}) interface{} {

// EncodeNBT ...
func (s Skull) EncodeNBT() map[string]interface{} {
return map[string]interface{}{"id": "Skull", "SkullType": s.Type.Uint8(), "Rotation": float32(s.Attach.o.Yaw())}
return map[string]interface{}{"id": "Skull", "SkullType": uint8(255), "Rotation": float32(s.Attach.o.Yaw())}
}

// EncodeBlock ...
func (s Skull) EncodeBlock() (string, map[string]interface{}) {
if s.Attach.hanging {
return "minecraft:skull", map[string]interface{}{"facing_direction": int32(s.Attach.facing) + 2}
return "minecraft:" + s.Type.String(), map[string]interface{}{"facing_direction": int32(s.Attach.facing) + 2}
}
return "minecraft:skull", map[string]interface{}{"facing_direction": int32(1)}
return "minecraft:" + s.Type.String(), map[string]interface{}{"facing_direction": int32(1)}
}

// allSkulls ...
Expand Down
14 changes: 7 additions & 7 deletions server/block/skull_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ func (s skull) Name() string {
func (s skull) String() string {
switch s {
case 0:
return "skeleton"
return "skeleton_skull"
case 1:
return "wither_skeleton"
return "wither_skeleton_skull"
case 2:
return "zombie"
return "zombie_head"
case 3:
return "player"
return "player_head"
case 4:
return "creeper"
return "creeper_head"
case 5:
return "dragon"
return "dragon_head"
case 6:
return "piglin"
return "piglin_head"
}
panic("unknown skull type")
}
7 changes: 1 addition & 6 deletions server/block/wood.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ func (w Wood) EncodeItem() (name string, meta int16) {
// EncodeBlock ...
func (w Wood) EncodeBlock() (name string, properties map[string]any) {
switch w.Wood {
case OakWood(), SpruceWood(), BirchWood(), JungleWood(), AcaciaWood(), DarkOakWood():
if w.Stripped {
return "minecraft:stripped_" + w.Wood.String() + "_wood", map[string]any{"pillar_axis": w.Axis.String()}
}
return "minecraft:" + w.Wood.String() + "_wood", map[string]any{"pillar_axis": w.Axis.String()}
case CrimsonWood(), WarpedWood():
if w.Stripped {
return "minecraft:stripped_" + w.Wood.String() + "_hyphae", map[string]any{"pillar_axis": w.Axis.String()}
Expand All @@ -100,7 +95,7 @@ func (w Wood) EncodeBlock() (name string, properties map[string]any) {
if w.Stripped {
return "minecraft:stripped_" + w.Wood.String() + "_wood", map[string]any{"pillar_axis": w.Axis.String()}
}
return "minecraft:" + w.Wood.String() + "_wood", map[string]any{"pillar_axis": w.Axis.String(), "stripped_bit": uint8(0)}
return "minecraft:" + w.Wood.String() + "_wood", map[string]any{"pillar_axis": w.Axis.String()}
}
}

Expand Down
Binary file modified server/item/creative/creative_items.nbt
Binary file not shown.
Binary file modified server/item/recipe/crafting_data.nbt
Binary file not shown.
Binary file modified server/item/recipe/furnace_data.nbt
Binary file not shown.
2 changes: 1 addition & 1 deletion server/session/enchantment_texts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified server/world/block_states.nbt
Binary file not shown.
Binary file modified server/world/item_runtime_ids.nbt
Binary file not shown.
2 changes: 1 addition & 1 deletion server/world/mcdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (db *DB) LoadColumn(pos world.ChunkPos, dim world.Dimension) (*chunk.Column
return col, nil
}

const chunkVersion = 40
const chunkVersion = 41

func (db *DB) column(k dbKey) (*chunk.Column, error) {
var cdata chunk.SerialisedData
Expand Down

0 comments on commit 8d7685b

Please sign in to comment.