MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / SetBlockEntity

Method SetBlockEntity

server/world/chunk/chunk.go:133–148  ·  view source on GitHub ↗

This function does not update the block for the players, so it should not be used. All of the position values should be absolute (aka (chunkPos<<4)+pos

(x, y, z int32, be BlockEntity)

Source from the content-addressed store, hash-verified

131
132// This function does not update the block for the players, so it should not be used. All of the position values should be absolute (aka (chunkPos<<4)+pos
133func (chunk *Chunk) SetBlockEntity(x, y, z int32, be BlockEntity) {
134 //c.LastModified = time.Now().UnixMilli()
135 var index int = -1
136 be.X, be.Y, be.Z = x, y, z
137 for i, entity := range chunk.BlockEntities {
138 if entity.X == x && entity.Y == y && entity.Z == z {
139 index = i
140 break
141 }
142 }
143 if index == -1 {
144 chunk.BlockEntities = append(chunk.BlockEntities, be)
145 return
146 }
147 chunk.BlockEntities[index] = be
148}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected