ignore entitiy remove
This commit is contained in:
parent
7a6061dba2
commit
a2653cffad
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ go 1.20
|
|||
replace github.com/sandertv/gophertunnel => github.com/olebeck/gophertunnel v1.27.4-3
|
||||
|
||||
//replace github.com/df-mc/dragonfly => ./dragonfly
|
||||
replace github.com/df-mc/dragonfly => github.com/olebeck/dragonfly v0.9.3-3
|
||||
replace github.com/df-mc/dragonfly => github.com/olebeck/dragonfly v0.9.3-5
|
||||
|
||||
require (
|
||||
gioui.org v0.0.0-20221219171716-c455f0f342ef
|
||||
|
|
|
@ -44,10 +44,6 @@ func (t serverEntityType) EncodeNBT(e world.Entity) map[string]any {
|
|||
return t.NBT
|
||||
}
|
||||
|
||||
func (t serverEntityType) UniqueID() int64 {
|
||||
return t.NBT["UniqueID"].(int64)
|
||||
}
|
||||
|
||||
type serverEntity struct {
|
||||
world.Entity
|
||||
EntityType serverEntityType
|
||||
|
@ -138,7 +134,6 @@ func (w *WorldState) ProcessEntityPackets(pk packet.Packet) packet.Packet {
|
|||
case *packet.AddActor:
|
||||
w.processAddActor(pk)
|
||||
case *packet.RemoveActor:
|
||||
delete(w.entities, uint64(pk.EntityUniqueID))
|
||||
case *packet.SetActorData:
|
||||
e, ok := w.entities[pk.EntityRuntimeID]
|
||||
if ok {
|
||||
|
|
|
@ -48,6 +48,7 @@ type WorldState struct {
|
|||
bp *behaviourpack.BehaviourPack
|
||||
|
||||
// save state
|
||||
ChunkRadius int
|
||||
chunks map[protocol.ChunkPos]*chunk.Chunk
|
||||
blockNBT map[protocol.SubChunkPos][]map[string]any
|
||||
openItemContainers map[byte]*itemContainer
|
||||
|
@ -167,6 +168,11 @@ func (c *WorldCMD) Execute(ctx context.Context, ui utils.UI) error {
|
|||
pk = w.processMapPacketsClient(pk, &forward)
|
||||
} else {
|
||||
// from server
|
||||
switch pk := pk.(type) {
|
||||
case *packet.ChunkRadiusUpdated:
|
||||
w.ChunkRadius = int(pk.ChunkRadius)
|
||||
pk.ChunkRadius = 80
|
||||
}
|
||||
pk = w.processItemPacketsServer(pk)
|
||||
pk = w.ProcessChunkPackets(pk)
|
||||
pk = w.ProcessEntityPackets(pk)
|
||||
|
@ -499,6 +505,8 @@ func (w *WorldState) SaveAndReset() {
|
|||
f.Close()
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
|
||||
// zip it
|
||||
filename := folder + ".mcworld"
|
||||
if err := utils.ZipFolder(filename, folder); err != nil {
|
||||
|
@ -517,6 +525,7 @@ func (w *WorldState) OnConnect(proxy *utils.ProxyContext, err error) bool {
|
|||
}
|
||||
w.proxy = proxy
|
||||
gd := w.proxy.Server.GameData()
|
||||
w.ChunkRadius = int(gd.ChunkRadius)
|
||||
|
||||
world.InsertCustomItems(gd.Items)
|
||||
|
||||
|
@ -594,5 +603,9 @@ func (w *WorldState) OnConnect(proxy *utils.ProxyContext, err error) bool {
|
|||
},
|
||||
})
|
||||
|
||||
if w.proxy.Client != nil {
|
||||
w.proxy.Client.WritePacket(&packet.ChunkRadiusUpdated{ChunkRadius: 80})
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue