Skip to content

Commit

Permalink
dragonfly: Update to 1.21.20
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC committed Aug 14, 2024
1 parent ee6f37f commit 13b68f1
Show file tree
Hide file tree
Showing 31 changed files with 168 additions and 180 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ require (
github.com/cespare/xxhash/v2 v2.2.0
github.com/df-mc/atomic v1.10.0
github.com/df-mc/goleveldb v1.1.9
github.com/df-mc/worldupgrader v1.0.15
github.com/df-mc/worldupgrader v1.0.16
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.39.3
github.com/sandertv/gophertunnel v1.40.1
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 @@ -9,8 +9,8 @@ github.com/df-mc/atomic v1.10.0 h1:0ZuxBKwR/hxcFGorKiHIp+hY7hgY+XBTzhCYD2NqSEg=
github.com/df-mc/atomic v1.10.0/go.mod h1:Gw9rf+rPIbydMjA329Jn4yjd/O2c/qusw3iNp4tFGSc=
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.15 h1:kR/nYWQbFvmR5LqPncpBXtXKGyiRBPc9NPkBKlLSAIk=
github.com/df-mc/worldupgrader v1.0.15/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
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/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 @@ -44,8 +44,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.39.3 h1:oc0PPOhrB9utScy8SEYJTWQIFexzf8CVizmB5MLsb6A=
github.com/sandertv/gophertunnel v1.39.3/go.mod h1:uSaX7RbVaCcxsGAx2vyZnkT0M6kZFGCdAqLn0+wuKyY=
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/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
5 changes: 2 additions & 3 deletions server/block/anvil.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ func (Anvil) Landed(w *world.World, pos cube.Pos) {

// EncodeItem ...
func (a Anvil) EncodeItem() (name string, meta int16) {
return "minecraft:anvil", int16(a.Type.Uint8() * 4)
return "minecraft:" + a.Type.String(), 0
}

// EncodeBlock ...
func (a Anvil) EncodeBlock() (string, map[string]any) {
return "minecraft:anvil", map[string]any{
"damage": a.Type.String(),
return "minecraft:" + a.Type.String(), map[string]any{
"minecraft:cardinal_direction": a.Facing.String(),
}
}
Expand Down
6 changes: 3 additions & 3 deletions server/block/anvil_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ func (a anvil) Uint8() uint8 {
func (a anvil) String() string {
switch a {
case 0:
return "undamaged"
return "anvil"
case 1:
return "slightly_damaged"
return "chipped_anvil"
case 2:
return "very_damaged"
return "damaged_anvil"
}
panic("should never happen")
}
8 changes: 4 additions & 4 deletions server/block/dirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ func (d Dirt) Shovel() (world.Block, bool) {
// EncodeItem ...
func (d Dirt) EncodeItem() (name string, meta int16) {
if d.Coarse {
meta = 1
return "minecraft:coarse_dirt", 0
}
return "minecraft:dirt", meta
return "minecraft:dirt", 0
}

// EncodeBlock ...
func (d Dirt) EncodeBlock() (string, map[string]any) {
if d.Coarse {
return "minecraft:dirt", map[string]any{"dirt_type": "coarse"}
return "minecraft:coarse_dirt", nil
}
return "minecraft:dirt", map[string]any{"dirt_type": "normal"}
return "minecraft:dirt", nil
}

// supportsVegetation checks if the vegetation can exist on the block.
Expand Down
2 changes: 1 addition & 1 deletion server/block/flower_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (f flower) Name() string {
func (f flower) String() string {
switch f {
case 0:
return "yellow_flower"
return "dandelion"
case 1:
return "poppy"
case 2:
Expand Down
5 changes: 3 additions & 2 deletions server/block/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package block
import (
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/world"
"strconv"
)

// Light is an invisible block that can produce any light level.
Expand All @@ -24,7 +25,7 @@ func (Light) SideClosed(cube.Pos, cube.Pos, *world.World) bool {

// EncodeItem ...
func (l Light) EncodeItem() (name string, meta int16) {
return "minecraft:light_block", int16(l.Level)
return "minecraft:light_block_" + strconv.Itoa(l.Level), 0
}

// LightEmissionLevel ...
Expand All @@ -34,7 +35,7 @@ func (l Light) LightEmissionLevel() uint8 {

// EncodeBlock ...
func (l Light) EncodeBlock() (name string, properties map[string]any) {
return "minecraft:light_block", map[string]any{"block_light_level": int32(l.Level)}
return "minecraft:light_block_" + strconv.Itoa(l.Level), nil
}

// allLight returns all possible light blocks.
Expand Down
4 changes: 2 additions & 2 deletions server/block/prismarine.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ func (p Prismarine) BreakInfo() BreakInfo {

// EncodeItem ...
func (p Prismarine) EncodeItem() (id string, meta int16) {
return "minecraft:prismarine", int16(p.Type.Uint8())
return "minecraft:" + p.Type.String(), 0
}

// EncodeBlock ...
func (p Prismarine) EncodeBlock() (name string, properties map[string]any) {
return "minecraft:prismarine", map[string]any{"prismarine_block_type": p.Type.String()}
return "minecraft:" + p.Type.String(), nil
}

// allPrismarine returns a list of all prismarine block variants.
Expand Down
6 changes: 3 additions & 3 deletions server/block/prismarine_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ func (s prismarine) Name() string {
func (s prismarine) String() string {
switch s {
case 0:
return "default"
return "prismarine"
case 1:
return "dark"
return "dark_prismarine"
case 2:
return "bricks"
return "prismarine_bricks"
}
panic("unknown prismarine type")
}
Expand Down
14 changes: 7 additions & 7 deletions server/block/quartz.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,37 +68,37 @@ func (q Quartz) SmeltInfo() item.SmeltInfo {
// EncodeItem ...
func (q Quartz) EncodeItem() (name string, meta int16) {
if q.Smooth {
return "minecraft:quartz_block", 3
return "minecraft:smooth_quartz", 0
}
return "minecraft:quartz_block", 0
}

// EncodeItem ...
func (c ChiseledQuartz) EncodeItem() (name string, meta int16) {
return "minecraft:quartz_block", 1
return "minecraft:chiseled_quartz_block", 0
}

// EncodeItem ...
func (q QuartzPillar) EncodeItem() (name string, meta int16) {
return "minecraft:quartz_block", 2
return "minecraft:quartz_pillar", 0
}

// EncodeBlock ...
func (q Quartz) EncodeBlock() (name string, properties map[string]any) {
if q.Smooth {
return "minecraft:quartz_block", map[string]any{"chisel_type": "smooth", "pillar_axis": "y"}
return "minecraft:smooth_quartz", map[string]any{"pillar_axis": "y"}
}
return "minecraft:quartz_block", map[string]any{"chisel_type": "default", "pillar_axis": "y"}
return "minecraft:quartz_block", map[string]any{"pillar_axis": "y"}
}

// EncodeBlock ...
func (ChiseledQuartz) EncodeBlock() (name string, properties map[string]any) {
return "minecraft:quartz_block", map[string]any{"chisel_type": "chiseled", "pillar_axis": "y"}
return "minecraft:chiseled_quartz_block", map[string]any{"pillar_axis": "y"}
}

// EncodeBlock ...
func (q QuartzPillar) EncodeBlock() (name string, properties map[string]any) {
return "minecraft:quartz_block", map[string]any{"pillar_axis": q.Axis.String(), "chisel_type": "lines"}
return "minecraft:quartz_pillar", map[string]any{"pillar_axis": q.Axis.String()}
}

// allQuartz ...
Expand Down
6 changes: 3 additions & 3 deletions server/block/sand.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ func (Sand) SmeltInfo() item.SmeltInfo {
// EncodeItem ...
func (s Sand) EncodeItem() (name string, meta int16) {
if s.Red {
return "minecraft:sand", 1
return "minecraft:red_sand", 0
}
return "minecraft:sand", 0
}

// EncodeBlock ...
func (s Sand) EncodeBlock() (string, map[string]any) {
if s.Red {
return "minecraft:sand", map[string]any{"sand_type": "red"}
return "minecraft:red_sand", nil
}
return "minecraft:sand", map[string]any{"sand_type": "normal"}
return "minecraft:sand", nil
}
9 changes: 7 additions & 2 deletions server/block/sandstone.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ func (s Sandstone) EncodeItem() (name string, meta int16) {

// EncodeBlock ...
func (s Sandstone) EncodeBlock() (string, map[string]any) {
var prefix string
if s.Type != NormalSandstone() {
prefix = s.Type.String() + "_"
}
suffix := "sandstone"
if s.Red {
return "minecraft:red_sandstone", map[string]any{"sand_stone_type": s.Type.String()}
suffix = "red_sandstone"
}
return "minecraft:sandstone", map[string]any{"sand_stone_type": s.Type.String()}
return "minecraft:" + prefix + suffix, nil
}

// SmeltInfo ...
Expand Down
2 changes: 1 addition & 1 deletion server/block/sandstone_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (s sandstone) String() string {
case 1:
return "cut"
case 2:
return "heiroglyphs"
return "chiseled"
case 3:
return "smooth"
}
Expand Down
28 changes: 5 additions & 23 deletions server/block/slab.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,38 +151,20 @@ func (s Slab) Model() world.BlockModel {

// EncodeItem ...
func (s Slab) EncodeItem() (string, int16) {
id, slabType, meta, _ := encodeSlabBlock(s.Block)
if slabType != "" {
return "minecraft:" + encodeLegacySlabId(slabType), meta
}
return "minecraft:" + id + "_slab", meta
return "minecraft:" + encodeSlabBlock(s.Block) + "_slab", 0
}

// EncodeBlock ...
func (s Slab) EncodeBlock() (string, map[string]any) {
id, slabType, _, halfFlattened := encodeSlabBlock(s.Block)
side := "bottom"
if s.Top {
side = "top"
}
properties := map[string]any{"minecraft:vertical_half": side}
if slabType != "" && !halfFlattened {
properties[slabType] = id
id = encodeLegacySlabId(slabType)
if s.Double {
id = "double_" + id
}
} else if s.Double {
if halfFlattened {
properties[slabType] = id
id = "double_" + encodeLegacySlabId(slabType)
} else {
id = id + "_double_slab"
}
} else {
id = id + "_slab"
suffix := "_slab"
if s.Double {
suffix = "_double_slab"
}
return "minecraft:" + id, properties
return "minecraft:" + encodeSlabBlock(s.Block) + suffix, map[string]any{"minecraft:vertical_half": side}
}

// allSlabs ...
Expand Down
Loading

0 comments on commit 13b68f1

Please sign in to comment.