Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/block/banner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"
)

// Banner is a tall decorative block that can be customized.
// Banner is a tall decorative block that can be customised.
type Banner struct {
empty
transparent
Expand Down
8 changes: 4 additions & 4 deletions server/block/banner_pattern_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package block

import "github.com/df-mc/dragonfly/server/item"

// BannerPatternType represents a type of banner pattern, used to customize banners.
// BannerPatternType represents a type of banner pattern, used to customise banners.
type BannerPatternType struct {
bannerPatternType
}
Expand Down Expand Up @@ -142,8 +142,8 @@ func StripeBottomBannerPattern() BannerPatternType {
return BannerPatternType{26}
}

// StripeCenterBannerPattern represents the 'Stripe Center' banner pattern type.
func StripeCenterBannerPattern() BannerPatternType {
// StripeCentreBannerPattern represents the 'Stripe Center' banner pattern type.
func StripeCentreBannerPattern() BannerPatternType {
return BannerPatternType{27}
}

Expand Down Expand Up @@ -247,7 +247,7 @@ func BannerPatternTypes() []BannerPatternType {
SquareTopRightBannerPattern(),
StraightCrossBannerPattern(),
StripeBottomBannerPattern(),
StripeCenterBannerPattern(),
StripeCentreBannerPattern(),
StripeDownLeftBannerPattern(),
StripeDownRightBannerPattern(),
StripeLeftBannerPattern(),
Expand Down
4 changes: 2 additions & 2 deletions server/block/banner_pattern_type_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var (
bannerPatternIDs = map[BannerPatternType]string{}
)

// init initializes all default banner patterns to the registry.
// init initialises all default banner patterns to the registry.
func init() {
registerBannerPattern("bo", BorderBannerPattern())
registerBannerPattern("bri", BricksBannerPattern())
Expand Down Expand Up @@ -34,7 +34,7 @@ func init() {
registerBannerPattern("tr", SquareTopRightBannerPattern())
registerBannerPattern("sc", StraightCrossBannerPattern())
registerBannerPattern("bs", StripeBottomBannerPattern())
registerBannerPattern("cs", StripeCenterBannerPattern())
registerBannerPattern("cs", StripeCentreBannerPattern())
registerBannerPattern("dls", StripeDownLeftBannerPattern())
registerBannerPattern("drs", StripeDownRightBannerPattern())
registerBannerPattern("ls", StripeLeftBannerPattern())
Expand Down
4 changes: 2 additions & 2 deletions server/block/blast_furnace.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"
)

// BlastFurnace is a block that smelts ores, raw metals, iron and gold armor and tools, similar to a furnace, but at
// twice the speed. It also serves as an armorer's job site block.
// BlastFurnace is a block that smelts ores, raw metals, iron and gold armour and tools, similar to a furnace, but at
// twice the speed. It also serves as an armourer's job site block.
// The empty value of BlastFurnace is not valid. It must be created using block.NewBlastFurnace(cube.Face).
type BlastFurnace struct {
solid
Expand Down
4 changes: 2 additions & 2 deletions server/block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ func (g gravityAffected) fall(b world.Block, pos cube.Pos, tx *world.Tx) {

// Flammable is an interface for blocks that can catch on fire.
type Flammable interface {
// FlammabilityInfo returns information about a block's behavior involving fire.
// FlammabilityInfo returns information about a block's behaviour involving fire.
FlammabilityInfo() FlammabilityInfo
}

// FlammabilityInfo contains values related to block behaviors involving fire.
// FlammabilityInfo contains values related to block behaviours involving fire.
type FlammabilityInfo struct {
// Encouragement is the chance a block will catch on fire during attempted fire spread.
Encouragement int
Expand Down
2 changes: 1 addition & 1 deletion server/block/enchanting_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// EnchantingTable is a block that allows players to spend their experience point levels to enchant tools, weapons,
// books, armor, and certain other items.
// books, armour, and certain other items.
type EnchantingTable struct {
transparent
bassDrum
Expand Down
6 changes: 3 additions & 3 deletions server/block/smelter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type smelter struct {
experience int
}

// newSmelter initializes a new smelter with the given remaining, maximum, and cook durations and XP, and returns it.
// newSmelter initialises a new smelter with the given remaining, maximum, and cook durations and XP, and returns it.
func newSmelter() *smelter {
s := &smelter{viewers: make(map[ContainerViewer]struct{})}
s.inventory = inventory.New(3, func(slot int, _, item item.Stack) {
Expand Down Expand Up @@ -189,13 +189,13 @@ func (s *smelter) tickSmelting(requirement, decrement time.Duration, lit bool, s
fuel, _ := s.inventory.Item(1)
product, _ := s.inventory.Item(2)

// Initialize some default smelt info, and update it if we can smelt the item.
// Initialise some default smelt info, and update it if we can smelt the item.
var inputInfo item.SmeltInfo
if i, ok := input.Item().(item.Smeltable); ok && supported(i.SmeltInfo()) {
inputInfo = i.SmeltInfo()
}

// Initialize some default fuel info, and update it if it can be used as fuel.
// Initialise some default fuel info, and update it if it can be used as fuel.
var fuelInfo item.FuelInfo
if f, ok := fuel.Item().(item.Fuel); ok {
fuelInfo = f.FuelInfo()
Expand Down
4 changes: 2 additions & 2 deletions server/block/vine.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,15 @@ func (Vines) canSpreadTo(tx *world.Tx, pos cube.Pos) bool {

// canSpread returns true if the vines can spread from the given position. Vines
// may only spread horizontally or upwards if there are fewer than 4 vines within
// a 9x9x3 area centered around the Vines.
// a 9x9x3 area centred around the Vines.
func (v Vines) canSpread(tx *world.Tx, pos cube.Pos) bool {
var count int
for x := -4; x <= 4; x++ {
for z := -4; z <= 4; z++ {
for y := -1; y <= 1; y++ {
if _, ok := tx.Block(pos.Add(cube.Pos{x, y, z})).(Vines); ok {
count++
// The center vine is counted, for a max of 4+1=5.
// The centre vine is counted, for a max of 4+1=5.
if count >= 5 {
return false
}
Expand Down
4 changes: 2 additions & 2 deletions server/item/armour.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type (
Armour interface {
// DefencePoints returns the defence points that the armour provides when worn.
DefencePoints() float64
// Toughness returns the toughness that the armor provides when worn. The toughness reduces defense reduction
// Toughness returns the toughness that the armour provides when worn. The toughness reduces defence reduction
// caused by increased damage.
Toughness() float64
// KnockBackResistance returns a number from 0-1 that decides the amount of knock back force that is
Expand All @@ -22,7 +22,7 @@ type (
// BaseDurability is the base durability of armour with this tier. This is otherwise the durability of
// the helmet with this tier.
BaseDurability() float64
// Toughness reduces the defense reduction caused by damage increases.
// Toughness reduces the defence reduction caused by damage increases.
Toughness() float64
// KnockBackResistance is a number from 0-1 that decides the amount of knock back force that is resisted
// upon being attacked. 1 knock back resistance point client-side translates to 10% knock back reduction.
Expand Down
2 changes: 1 addition & 1 deletion server/item/banner_pattern.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package item

// BannerPattern is an item used to customize banners inside looms.
// BannerPattern is an item used to customise banners inside looms.
type BannerPattern struct {
// Type represents the type of banner pattern. These types do not include all patterns that can be applied to a
// banner.
Expand Down
4 changes: 2 additions & 2 deletions server/item/inventory/armour.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ func (a *Armour) DamageReduction(dmg float64, src world.DamageSource) float64 {
dmg -= dmg * enchantment.ProtectionFactor(src, enchantments)
if src.ReducedByArmour() {
// Armour in Bedrock edition reduces the damage taken by 4% for each effective armour point. Effective
// armour point decreases as damage increases, with 1 point lost for every 2 HP of damage. The defense
// reduction is decreased by the toughness armor value. Effective armour points will at minimum be 20% of
// armour point decreases as damage increases, with 1 point lost for every 2 HP of damage. The defence
// reduction is decreased by the toughness armour value. Effective armour points will at minimum be 20% of
// armour points.
dmg -= dmg * 0.04 * math.Max(defencePoints*0.2, defencePoints-dmg/(2+toughness/4))
}
Expand Down
2 changes: 1 addition & 1 deletion server/item/iron_nugget.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package item

// IronNugget is a piece of iron that can be obtained by smelting iron tools/weapons or iron/chainmail armor.
// IronNugget is a piece of iron that can be obtained by smelting iron tools/weapons or iron/chainmail armour.
type IronNugget struct{}

// EncodeItem ...
Expand Down
2 changes: 1 addition & 1 deletion server/item/leather.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package item

// Leather is an animal skin used to make item frames, armor and books.
// Leather is an animal skin used to make item frames, armour and books.
type Leather struct{}

// EncodeItem ...
Expand Down
2 changes: 1 addition & 1 deletion server/item/resin_brick.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package item
import "github.com/sandertv/gophertunnel/minecraft/text"

// ResinBrick is an item used to create resin bricks. It can also be used as a
// smithing ingredient, giving orange details to pieces of armor.
// smithing ingredient, giving orange details to pieces of armour.
type ResinBrick struct{}

// EncodeItem ...
Expand Down
2 changes: 1 addition & 1 deletion server/player/debug/shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Shape interface {
}

// shape is a base type for all shapes that implements the Shape interface. It contains a unique identifier
// that is lazily initialized when the ShapeID method is called for the first time.
// that is lazily initialised when the ShapeID method is called for the first time.
type shape struct {
id *int
}
Expand Down
4 changes: 2 additions & 2 deletions server/player/playerdb/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
// InventoryData is a struct that contains all data of the player inventories.
type InventoryData struct {
// Items contains all the items in the player's main inventory.
// This excludes armor and offhand.
// This excludes armour and offhand.
Items []item.Stack
// Boots, Leggings, Chestplate, Helmet are armor pieces that belong to the slot corresponding to the name.
// Boots, Leggings, Chestplate, Helmet are armour pieces that belong to the slot corresponding to the name.
Boots item.Stack
Leggings item.Stack
Chestplate item.Stack
Expand Down
4 changes: 2 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func (srv *Server) startListening() {
}
}

// makeBlockEntries initializes the server's block components map using the
// makeBlockEntries initialises the server's block components map using the
// registered custom blocks. It allows block components to be created only once
// at startup.
func (srv *Server) makeBlockEntries() {
Expand All @@ -386,7 +386,7 @@ func (srv *Server) makeBlockEntries() {
}
}

// makeItemComponents initializes the server's item components map using the
// makeItemComponents initialises the server's item components map using the
// registered custom items. It allows item components to be created only once
// at startup
func (srv *Server) makeItemComponents() {
Expand Down
10 changes: 5 additions & 5 deletions server/session/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ func (s *Session) ViewChunk(pos world.ChunkPos, dim world.Dimension, blockEntiti
}

// ViewSubChunks ...
func (s *Session) ViewSubChunks(center world.SubChunkPos, offsets []protocol.SubChunkOffset, tx *world.Tx) {
func (s *Session) ViewSubChunks(centre world.SubChunkPos, offsets []protocol.SubChunkOffset, tx *world.Tx) {
r := tx.Range()

entries := make([]protocol.SubChunkEntry, 0, len(offsets))
transaction := make(map[uint64]struct{})
for _, offset := range offsets {
ind := int16(center.Y()) + int16(offset[1]) - int16(r[0])>>4
ind := int16(centre.Y()) + int16(offset[1]) - int16(r[0])>>4
if ind < 0 || ind > int16(r.Height()>>4) {
entries = append(entries, protocol.SubChunkEntry{Result: protocol.SubChunkResultIndexOutOfBounds, Offset: offset})
continue
}
col, ok := s.chunkLoader.Chunk(world.ChunkPos{
center.X() + int32(offset[0]),
center.Z() + int32(offset[2]),
centre.X() + int32(offset[0]),
centre.Z() + int32(offset[2]),
})
if !ok {
entries = append(entries, protocol.SubChunkEntry{Result: protocol.SubChunkResultChunkNotFound, Offset: offset})
Expand All @@ -55,7 +55,7 @@ func (s *Session) ViewSubChunks(center world.SubChunkPos, offsets []protocol.Sub
dim, _ := world.DimensionID(tx.World().Dimension())
s.writePacket(&packet.SubChunk{
Dimension: int32(dim),
Position: protocol.SubChunkPos(center),
Position: protocol.SubChunkPos(centre),
CacheEnabled: s.conn.ClientCacheEnabled(),
SubChunkEntries: entries,
})
Expand Down
2 changes: 1 addition & 1 deletion server/session/handler_enchanting.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func searchBookshelves(tx *world.Tx, pos cube.Pos) (shelves int) {
for z := -1; z <= 1; z++ {
for y := 0; y <= 1; y++ {
if x == 0 && z == 0 {
// Ignore the center block.
// Ignore the centre block.
continue
}
if _, ok := tx.Block(pos.Add(cube.Pos{x, y, z})).(block.Air); !ok {
Expand Down
4 changes: 2 additions & 2 deletions server/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ func (s *Session) sendAvailableEntities(w *world.World) {
for _, t := range w.EntityRegistry().Types() {
identifiers = append(identifiers, actorIdentifier{ID: t.EncodeEntity()})
}
serializedEntityData, err := nbt.Marshal(map[string]any{"idlist": identifiers})
serialisedEntityData, err := nbt.Marshal(map[string]any{"idlist": identifiers})
if err != nil {
panic("should never happen")
}
s.writePacket(&packet.AvailableActorIdentifiers{SerialisedEntityIdentifiers: serializedEntityData})
s.writePacket(&packet.AvailableActorIdentifiers{SerialisedEntityIdentifiers: serialisedEntityData})
}
2 changes: 1 addition & 1 deletion server/world/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (l *Loader) evictUnused(tx *Tx) {
// which chunks around the position the loader is now in should be loaded. Chunks are ordered to be loaded
// from the middle outwards.
func (l *Loader) populateLoadQueue() {
// We'll first load the chunk positions to load in a map indexed by the distance to the center (basically,
// We'll first load the chunk positions to load in a map indexed by the distance to the centre (basically,
// what precedence it should have), and put them in the loadQueue in that order.
queue := map[int32][]ChunkPos{}

Expand Down
2 changes: 1 addition & 1 deletion server/world/mcdb/leveldat/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Data struct {
BaseGameVersion string `nbt:"baseGameVersion"`
BiomeOverride string
ConfirmedPlatformLockedContent bool
CenterMapsToOrigin bool
CentreMapsToOrigin bool `nbt:"CenterMapsToOrigin"`
CheatsEnabled bool `nbt:"cheatsEnabled"`
DaylightCycle int32 `nbt:"daylightCycle"`
Difficulty int32
Expand Down
2 changes: 1 addition & 1 deletion server/world/mcdb/leveldat/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Version = 10
// required by the latest Minecraft data provider.
var minimumCompatibleClientVersion []int32

// init initializes the minimum compatible client version.
// init initialises the minimum compatible client version.
func init() {
fullVersion := append(strings.Split(protocol.CurrentVersion, "."), "0", "0")
for _, v := range fullVersion {
Expand Down
2 changes: 1 addition & 1 deletion server/world/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var _ Provider = (*NopProvider)(nil)

// NopProvider implements a Provider that does not perform any disk I/O. It generates values on the run and
// dynamically, instead of reading and writing data, and otherwise returns empty values. A Settings struct can be passed
// to initialize a world with specific settings. Since Settings is a pointer, using the same NopProvider for multiple
// to initialise a world with specific settings. Since Settings is a pointer, using the same NopProvider for multiple
// worlds means those worlds will share the same settings.
type NopProvider struct {
Set *Settings
Expand Down
2 changes: 1 addition & 1 deletion server/world/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ func (w *World) Spawn() cube.Pos {
}

// SetSpawn sets the spawn of the world to a different position. The player
// will be spawned in the center of this position when newly joining.
// will be spawned in the centre of this position when newly joining.
func (w *World) SetSpawn(pos cube.Pos) {
if w == nil {
return
Expand Down