Skip to content

Commit

Permalink
Fix seed field
Browse files Browse the repository at this point in the history
  • Loading branch information
oq-x committed Sep 27, 2023
1 parent 6a698df commit 24f80a7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
4 changes: 3 additions & 1 deletion server/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"fmt"
"strings"

pk "github.com/aimjel/minecraft/packet"
"github.com/dynamitemc/dynamite/server/player"
Expand All @@ -28,7 +29,8 @@ func (ctx *CommandContext) Incomplete() {
}

func (ctx *CommandContext) Error(msg string) {
ctx.Reply(fmt.Sprintf("§c%s\n§7%s§r§c§o<--[HERE]", msg, ctx.FullCommand))
sp := strings.Split(ctx.FullCommand, " ")
ctx.Reply(fmt.Sprintf("§c%s\n§7%s§c§n%s§c§o<--[HERE]", msg, strings.Join(sp[:len(sp)-1], " "), sp[len(sp)-1]))
}

const (
Expand Down
5 changes: 5 additions & 0 deletions server/world/generator.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package world

func GenerateWorldData() worldData {
return worldData{}
}
17 changes: 11 additions & 6 deletions server/world/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ import (
"github.com/aimjel/minecraft/nbt"
)

type World struct {
nbt struct {
Data struct {
Seed int64 `nbt:"seed"`
DataVersion int32
type worldData struct {
Data struct {
WorldGenSettings struct {
Seed int64 `nbt:"seed"`
}
DataVersion int32
GameRules map[string]string
}
}

type World struct {
nbt worldData

entityIdCounter atomic.Value

Expand Down Expand Up @@ -51,7 +56,7 @@ func OpenWorld(name string) (*World, error) {
}

func (w *World) Seed() int64 {
return w.nbt.Data.Seed
return w.nbt.Data.WorldGenSettings.Seed
}

func (w *World) DefaultDimension() *Dimension {
Expand Down

0 comments on commit 24f80a7

Please sign in to comment.