diff --git a/server/world/entity.go b/server/world/entity.go index 6744d682b..778fe9aba 100644 --- a/server/world/entity.go +++ b/server/world/entity.go @@ -112,7 +112,7 @@ func (e *EntityHandle) mustEntity(tx *Tx) Entity { if ent, ok := e.Entity(tx); ok { return ent } - panic("can't load Entity with Tx of different world") + panic("can't load entity with Tx of different world") } func (e *EntityHandle) UUID() uuid.UUID { @@ -136,7 +136,7 @@ func (e *EntityHandle) ExecWorld(f func(tx *Tx, e Entity)) { } func (e *EntityHandle) unsetAndLockWorld(tx *Tx) { - // If the Entity is in a tx created using ExecWorld, e.cond.L will already + // If the entity is in a tx created using ExecWorld, e.cond.L will already // be locked. Don't try to lock again in that case. if e.lockedTx.Load() != tx { e.cond.L.Lock() @@ -146,14 +146,14 @@ func (e *EntityHandle) unsetAndLockWorld(tx *Tx) { } func (e *EntityHandle) setAndUnlockWorld(w *World, tx *Tx) { - // If the Entity is in a tx created using ExecWorld, e.cond.L will already + // If the entity is in a tx created using ExecWorld, e.cond.L will already // be locked. Don't try to lock again in that case. if e.lockedTx.Load() != tx { e.cond.L.Lock() defer e.cond.L.Unlock() } if e.w != nil { - panic("cannot add Entity to new world before removing from old world") + panic("cannot add entity to new world before removing from old world") } e.w = w e.cond.Signal() @@ -269,7 +269,7 @@ func (conf EntityRegistryConfig) New(ent []EntityType) EntityRegistry { for _, e := range ent { name := e.EncodeEntity() if _, ok := m[name]; ok { - panic("cannot register the same Entity (" + name + ") twice") + panic("cannot register the same entity (" + name + ") twice") } m[name] = e } diff --git a/server/world/tick.go b/server/world/tick.go index cc2e90572..1001318c6 100644 --- a/server/world/tick.go +++ b/server/world/tick.go @@ -155,7 +155,7 @@ func (t ticker) tickBlocksRandomly(tx *Tx, loaders []*Loader, tick int64) { } // Generally we would want to make sure the block has its block entities, but provided blocks // with block entities are generally ticked already, we are safe to assume that blocks - // implementing the RandomTicker don't rely on additional block Entity data. + // implementing the RandomTicker don't rely on additional block entity data. if rid := sub.Layers()[0].At(x, y, z); randomTickBlocks[rid] { subY := (i + (tx.Range().Min() >> 4)) << 4 randomBlocks = append(randomBlocks, cube.Pos{cx + int(x), subY + int(y), cz + int(z)}) @@ -206,16 +206,16 @@ func (t ticker) tickEntities(tx *Tx, tick int64) { } if lastPos != chunkPos { - // The Entity was stored using an outdated chunk position. We update it and make sure it is ready + // The entity was stored using an outdated chunk position. We update it and make sure it is ready // for loaders to view it. tx.World().entities[handle] = chunkPos c.Entities = append(c.Entities, handle) var viewers []Viewer - // When changing an Entity's world, then teleporting it immediately, we could end up in a situation - // where the old chunk of the Entity was not loaded. In this case, it should be safe simply to ignore - // the loaders from the old chunk. We can assume they never saw the Entity in the first place. + // When changing an entity's world, then teleporting it immediately, we could end up in a situation + // where the old chunk of the entity was not loaded. In this case, it should be safe simply to ignore + // the loaders from the old chunk. We can assume they never saw the entity in the first place. if old, ok := tx.World().chunks[lastPos]; ok { old.Entities = sliceutil.DeleteVal(old.Entities, handle) viewers = old.viewers @@ -223,14 +223,14 @@ func (t ticker) tickEntities(tx *Tx, tick int64) { for _, viewer := range viewers { if sliceutil.Index(c.viewers, viewer) == -1 { - // First we hide the Entity from all loaders that were previously viewing it, but no + // First we hide the entity from all loaders that were previously viewing it, but no // longer are. viewer.HideEntity(e) } } for _, viewer := range c.viewers { if sliceutil.Index(viewers, viewer) == -1 { - // Then we show the Entity to all loaders that are now viewing the Entity in the new + // Then we show the entity to all loaders that are now viewing the entity in the new // chunk. showEntity(e, viewer) } diff --git a/server/world/weather.go b/server/world/weather.go index 37a5ef13e..f800084c7 100644 --- a/server/world/weather.go +++ b/server/world/weather.go @@ -203,8 +203,8 @@ func (w weather) adjustPositionToEntities(tx *Tx, vec mgl64.Vec3) mgl64.Vec3 { list := make([]mgl64.Vec3, 0, len(ent)/3) for _, e := range ent { if h, ok := e.(interface{ Health() float64 }); ok && h.Health() > 0 { - // Any (living) Entity that is positioned higher than the highest block at its position is eligible to be - // struck by lightning. We first save all Entity positions where this is the case. + // Any (living) entity that is positioned higher than the highest block at its position is eligible to be + // struck by lightning. We first save all entity positions where this is the case. pos := cube.PosFromVec3(e.Position()) if tx.HighestBlock(pos[0], pos[1]) < pos[2] { list = append(list, e.Position()) @@ -212,7 +212,7 @@ func (w weather) adjustPositionToEntities(tx *Tx, vec mgl64.Vec3) mgl64.Vec3 { } } // We then select one of the positions of entities higher than the highest block and adjust the position of the - // lightning to it, so that the Entity is struck directly. + // lightning to it, so that the entity is struck directly. if len(list) > 0 { vec = list[w.w.r.Intn(len(list))] } diff --git a/server/world/world.go b/server/world/world.go index 432bf7d1e..6f388901c 100644 --- a/server/world/world.go +++ b/server/world/world.go @@ -147,7 +147,7 @@ func (w *World) blockInChunk(c *Column, pos cube.Pos) Block { } rid := c.Block(uint8(pos[0]), int16(pos[1]), uint8(pos[2]), 0) if nbtBlocks[rid] { - // The block was also a block Entity, so we look it up in the map. + // The block was also a block entity, so we look it up in the map. if b, ok := c.BlockEntities[pos]; ok { return b } @@ -648,7 +648,7 @@ func (w *World) addEntity(tx *Tx, handle *EntityHandle) Entity { e := handle.mustEntity(tx) for _, v := range c.viewers { - // We show the Entity to all viewers currently in the chunk that the Entity is spawned in. + // We show the entity to all viewers currently in the chunk that the entity is spawned in. showEntity(e, v) } w.Handler().HandleEntitySpawn(e) @@ -665,7 +665,7 @@ func (w *World) removeEntity(e Entity, tx *Tx) *EntityHandle { handle := e.Handle() pos, found := w.entities[handle] if !found { - // The Entity currently isn't in this world. + // The entity currently isn't in this world. return nil } w.Handler().HandleEntityDespawn(e) @@ -702,7 +702,7 @@ func (w *World) entitiesWithin(tx *Tx, box cube.BBox, ignored func(Entity) bool) continue } if box.Vec3Within(handle.data.Pos) { - // The Entity position was within the BBox, so we add it to the slice to return. + // The entity position was within the BBox, so we add it to the slice to return. entities = append(entities, e) } } @@ -1213,12 +1213,12 @@ func columnFrom(c *chunk.Column, w *World) *Column { for _, e := range c.Entities { eid, ok := e.Data["identifier"].(string) if !ok { - w.conf.Log.Error("read column: Entity without identifier field", "ID", e.ID) + w.conf.Log.Error("read column: entity without identifier field", "ID", e.ID) continue } t, ok := w.conf.Entities.Lookup(eid) if !ok { - w.conf.Log.Error("read column: unknown Entity type", "ID", e.ID, "type", eid) + w.conf.Log.Error("read column: unknown entity type", "ID", e.ID, "type", eid) continue } col.Entities = append(col.Entities, entityFromData(t, e.ID, e.Data))