Skip to content

Conversation

@Flonja
Copy link
Contributor

@Flonja Flonja commented Jul 7, 2025

Check if the data in a block entity is nil, so that there won't be an assign to nil map panic

Schematic: https://mcbuild.org/schematics/18554:lighthouse
Test code:

file, err := os.Open("test.schematic")
if err != nil {
	panic(err)
}
s, err := schematic.FromReader(file)
if err != nil {
	panic(err)
}

w := srv.World()
<-w.Exec(func(tx *world.Tx) {
	tx.BuildStructure(cube.Pos{}, s)
})

@schphe
Copy link
Contributor

schphe commented Jul 7, 2025

problem still seems to persist with uninitialized block entities getting ticked

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x32f428]

goroutine 78 [running]:
github.com/df-mc/dragonfly/server/block.BrewingStand.Tick({{}, {}, 0x0, 0x0, 0x0, 0x0}, 0x28a12c?, {0x12f, 0x73, 0x135}, ...)
/home/schphe/test/dragonfly/server/block/brewing_stand.go:47 +0x38
github.com/df-mc/dragonfly/server/world.ticker.tickBlocksRandomly({0x40013fbda0?}, 0x404a20db90, {0x4046e05b88, 0x1, 0x0?}, 0x1df)
/home/schphe/test/dragonfly/server/world/tick.go:169 +0x564
github.com/df-mc/dragonfly/server/world.ticker.tick({0x4046423101?}, 0x404a20db90)
/home/schphe/test/dragonfly/server/world/tick.go:82 +0x354
github.com/df-mc/dragonfly/server/world.normalTransaction.Run(...)
/home/schphe/test/dragonfly/server/world/tx.go:243
github.com/df-mc/dragonfly/server/world.(*World).handleTransactions(0x40001a69c0)
/home/schphe/test/dragonfly/server/world/world.go:133 +0x34
created by github.com/df-mc/dragonfly/server/world.Config.New in goroutine 1
/home/schphe/test/dragonfly/server/world/conf.go:110 +0x4f0
exit status 2

@Flonja
Copy link
Contributor Author

Flonja commented Jul 7, 2025

I'd like to get your schematic that you used then

@Flonja
Copy link
Contributor Author

Flonja commented Jul 8, 2025

privately resolved @schphe's issue and is fixed in df-mc/schematic#3 and #1100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants