Skip to content

Commit

Permalink
dragonfly/server: Update to support 1.21.30
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC committed Sep 18, 2024
1 parent 3fb5f57 commit db26a06
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 50 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ require (
github.com/brentp/intintmap v0.0.0-20190211203843-30dc0ade9af9
github.com/cespare/xxhash/v2 v2.2.0
github.com/df-mc/goleveldb v1.1.9
github.com/df-mc/worldupgrader v1.0.16
github.com/df-mc/worldupgrader v1.0.17
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/rogpeppe/go-internal v1.11.0
github.com/sandertv/gophertunnel v1.40.1
github.com/sandertv/gophertunnel v1.41.0
github.com/segmentio/fasthash v1.0.3
github.com/sirupsen/logrus v1.9.3
golang.org/x/exp v0.0.0-20230206171751-46f607a40771
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.16 h1:3n9yvLFNCe8IDJnUEliTGbhDvV1frjtPX/y5zl3Q5EE=
github.com/df-mc/worldupgrader v1.0.16/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
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/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 @@ -43,8 +43,8 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/sandertv/go-raknet v1.14.1 h1:V2Gslo+0x4jfj+p0PM48mWxmMbYkxSlgeKy//y3ZrzI=
github.com/sandertv/go-raknet v1.14.1/go.mod h1:/yysjwfCXm2+2OY8mBazLzcxJ3irnylKCyG3FLgUPVU=
github.com/sandertv/gophertunnel v1.40.1 h1:foWxpIEXm/pCqik8r8TmcIlQyG8Vpe98JJwFKurdb/4=
github.com/sandertv/gophertunnel v1.40.1/go.mod h1:uSaX7RbVaCcxsGAx2vyZnkT0M6kZFGCdAqLn0+wuKyY=
github.com/sandertv/gophertunnel v1.41.0 h1:PGqqALaatGqcZ+qWXOcR4+CHPhQohnm/ZrnHdhWRtNw=
github.com/sandertv/gophertunnel v1.41.0/go.mod h1:uSaX7RbVaCcxsGAx2vyZnkT0M6kZFGCdAqLn0+wuKyY=
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/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down
4 changes: 2 additions & 2 deletions server/block/purpur.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (p Purpur) EncodeItem() (name string, meta int16) {

// EncodeBlock ...
func (p Purpur) EncodeBlock() (name string, properties map[string]interface{}) {
return "minecraft:purpur_block", map[string]interface{}{"chisel_type": "default", "pillar_axis": "y"}
return "minecraft:purpur_block", map[string]interface{}{"pillar_axis": "y"}
}

// UseOnBlock ...
Expand All @@ -62,7 +62,7 @@ func (p PurpurPillar) EncodeItem() (name string, meta int16) {

// EncodeBlock ...
func (p PurpurPillar) EncodeBlock() (name string, properties map[string]interface{}) {
return "minecraft:purpur_block", map[string]interface{}{"chisel_type": "lines", "pillar_axis": p.Axis.String()}
return "minecraft:purpur_pillar", map[string]interface{}{"pillar_axis": p.Axis.String()}
}

// allPurpurs ...
Expand Down
8 changes: 4 additions & 4 deletions server/block/sponge.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ func (s Sponge) SmeltInfo() item.SmeltInfo {
// EncodeItem ...
func (s Sponge) EncodeItem() (name string, meta int16) {
if s.Wet {
meta = 1
return "minecraft:wet_sponge", 0
}
return "minecraft:sponge", meta
return "minecraft:sponge", 0
}

// EncodeBlock ...
func (s Sponge) EncodeBlock() (string, map[string]any) {
if s.Wet {
return "minecraft:sponge", map[string]any{"sponge_type": "wet"}
return "minecraft:wet_sponge", nil
}
return "minecraft:sponge", map[string]any{"sponge_type": "dry"}
return "minecraft:sponge", nil
}

// UseOnBlock places the sponge, absorbs nearby water if it's still dry and flags it as wet if any water has been
Expand Down
2 changes: 1 addition & 1 deletion server/block/tnt.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (t TNT) EncodeItem() (name string, meta int16) {

// EncodeBlock ...
func (t TNT) EncodeBlock() (name string, properties map[string]interface{}) {
return "minecraft:tnt", map[string]interface{}{"allow_underwater_bit": false, "explode_bit": false}
return "minecraft:tnt", map[string]interface{}{"explode_bit": false}
}

// spawnTnt creates a new TNT entity at the given position with the given fuse duration.
Expand Down
13 changes: 3 additions & 10 deletions server/block/wall.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ type Wall struct {

// EncodeItem ...
func (w Wall) EncodeItem() (string, int16) {
name, meta := encodeWallBlock(w.Block)
if meta == 0 {
return "minecraft:" + name + "_wall", 0
}
return "minecraft:cobblestone_wall", meta
name := encodeWallBlock(w.Block)
return "minecraft:" + name + "_wall", 0
}

// EncodeBlock ...
Expand All @@ -49,11 +46,7 @@ func (w Wall) EncodeBlock() (string, map[string]any) {
"wall_connection_type_west": w.WestConnection.String(),
"wall_post_bit": boolByte(w.Post),
}
name, meta := encodeWallBlock(w.Block)
if meta > 0 || name == "cobblestone" {
properties["wall_block_type"] = name
name = "cobblestone"
}
name := encodeWallBlock(w.Block)
return "minecraft:" + name + "_wall", properties
}

Expand Down
46 changes: 23 additions & 23 deletions server/block/wall_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,77 @@ package block
import "github.com/df-mc/dragonfly/server/world"

// encodeWallBlock encodes the provided block in to an identifier and meta value that can be used to encode the wall.
func encodeWallBlock(block world.Block) (string, int16) {
func encodeWallBlock(block world.Block) string {
switch block := block.(type) {
case Andesite:
if !block.Polished {
return "andesite", 4
return "andesite"
}
case Blackstone:
if block.Type == NormalBlackstone() {
return "blackstone", 0
return "blackstone"
} else if block.Type == PolishedBlackstone() {
return "polished_blackstone", 0
return "polished_blackstone"
}
case Bricks:
return "brick", 6
return "brick"
case Cobblestone:
if block.Mossy {
return "mossy_cobblestone", 1
return "mossy_cobblestone"
}
return "cobblestone", 0
return "cobblestone"
case Deepslate:
if block.Type == CobbledDeepslate() {
return "cobbled_deepslate", 0
return "cobbled_deepslate"
} else if block.Type == PolishedDeepslate() {
return "polished_deepslate", 0
return "polished_deepslate"
}
case DeepslateBricks:
if !block.Cracked {
return "deepslate_brick", 0
return "deepslate_brick"
}
case DeepslateTiles:
if !block.Cracked {
return "deepslate_tile", 0
return "deepslate_tile"
}
case Diorite:
if !block.Polished {
return "diorite", 3
return "diorite"
}
case EndBricks:
return "end_brick", 10
return "end_stone_brick"
case Granite:
if !block.Polished {
return "granite", 2
return "granite"
}
case MudBricks:
return "mud_brick", 0
return "mud_brick"
case NetherBricks:
if block.Type == NormalNetherBricks() {
return "nether_brick", 9
return "nether_brick"
} else if block.Type == RedNetherBricks() {
return "red_nether_brick", 13
return "red_nether_brick"
}
case PolishedBlackstoneBrick:
if !block.Cracked {
return "polished_blackstone_brick", 0
return "polished_blackstone_brick"
}
case Prismarine:
if block.Type == NormalPrismarine() {
return "prismarine", 11
return "prismarine"
}
case Sandstone:
if block.Type == NormalSandstone() {
if block.Red {
return "red_sandstone", 12
return "red_sandstone"
}
return "sandstone", 5
return "sandstone"
}
case StoneBricks:
if block.Type == NormalStoneBricks() {
return "stone_brick", 7
return "stone_brick"
} else if block.Type == MossyStoneBricks() {
return "mossy_stone_brick", 8
return "mossy_stone_brick"
}
}
panic("invalid block used for wall")
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.
16 changes: 12 additions & 4 deletions server/session/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ func (s *Session) SendSpeed(speed float64) {
Value: float32(speed),
Max: math.MaxFloat32,
},
Default: 0.1,
DefaultMax: math.MaxFloat32,
Default: 0.1,
}},
})
}
Expand All @@ -345,22 +346,25 @@ func (s *Session) SendFood(food int, saturation, exhaustion float64) {
Value: float32(food),
Max: 20,
},
Default: 20,
DefaultMax: 20,
Default: 20,
},
{
AttributeValue: protocol.AttributeValue{
Name: "minecraft:player.saturation",
Value: float32(saturation),
Max: 20,
},
Default: 20,
DefaultMax: 20,
Default: 20,
},
{
AttributeValue: protocol.AttributeValue{
Name: "minecraft:player.exhaustion",
Value: float32(exhaustion),
Max: 5,
},
DefaultMax: 5,
},
},
})
Expand Down Expand Up @@ -469,7 +473,8 @@ func (s *Session) SendHealth(health *entity.HealthManager) {
Value: float32(math.Ceil(health.Health())),
Max: float32(math.Ceil(health.MaxHealth())),
},
Default: 20,
DefaultMax: 20,
Default: 20,
}},
})
}
Expand All @@ -484,6 +489,7 @@ func (s *Session) SendAbsorption(value float64) {
Value: float32(math.Ceil(value)),
Max: float32(math.MaxFloat32),
},
DefaultMax: float32(math.MaxFloat32),
}},
})
}
Expand Down Expand Up @@ -747,13 +753,15 @@ func (s *Session) SendExperience(e *entity.ExperienceManager) {
Value: float32(level),
Max: float32(math.MaxInt32),
},
DefaultMax: float32(math.MaxInt32),
},
{
AttributeValue: protocol.AttributeValue{
Name: "minecraft:player.experience",
Value: float32(progress),
Max: 1,
},
DefaultMax: 1,
},
},
})
Expand Down
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.

0 comments on commit db26a06

Please sign in to comment.