Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v1.18.0 #6

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
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 README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# expresso
> A library designed for hosting Minecraft: Java Edition listeners (currently for 1.17.1).
> A library designed for hosting Minecraft: Java Edition listeners (currently for 1.18.0).

## Features
- [X] Hosting listeners.
Expand Down
126 changes: 0 additions & 126 deletions expresso/protocol/chunk.go

This file was deleted.

47 changes: 47 additions & 0 deletions expresso/protocol/chunk_section.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package protocol

// air is the ID of air in Minecraft.
const air = 0

// ChunkSection represents a modern implementation of a Minecraft chunk section.
type ChunkSection struct {
// blockCount contains the amount of blocks that aren't air in this section.
blockCount int16
// chunkData contains the chunk data for this section.
chunkData *DataPalette
// biomeData contains the biome data for this section.
biomeData *DataPalette
}

// NewEmptyChunkSection creates a new empty chunk section.
func NewEmptyChunkSection() *ChunkSection {
return &ChunkSection{
chunkData: NewEmptyChunkDataPalette(),
biomeData: NewBiomeDataPalette(4),
}
}

// GetBlockState returns the block state for the given block coordinates.
func (c *ChunkSection) GetBlockState(pos BlockPos) (int32, error) {
return c.chunkData.GetBlockState(pos)
}

// SetBlockState sets the block state for the given block coordinates.
func (c *ChunkSection) SetBlockState(pos BlockPos, state int32) error {
curr, err := c.chunkData.SetBlockState(pos, state)
if err != nil {
return err
}

if state != air && curr == air {
c.blockCount++
} else if state == air && curr != air {
c.blockCount--
}
return nil
}

// Empty returns true if this chunk section is empty.
func (c *ChunkSection) Empty() bool {
return c.blockCount == 0
}
69 changes: 0 additions & 69 deletions expresso/protocol/column.go

This file was deleted.

Loading