Skip to content

Conversation

@Argmaster
Copy link
Owner

No description provided.

src/entity.zig Outdated
}

pub fn add(self: *ServerEntityManager, entity: main.server.Entity) u32 {
const id: u32 = @intCast(self.dense.items.len);
Copy link
Owner Author

@Argmaster Argmaster May 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const id: u32 = @intCast(self.dense.items.len);
const sparseId: u32 = @intCast(self.sparse.items.len);

src/entity.zig Outdated
Comment on lines 128 to 133
// The id can only be at most 1 greater then the length of the sparse list.
if (id == self.sparse.items.len) {
self.sparse.append(null);
}

self.sparse.items[id] = id;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// The id can only be at most 1 greater then the length of the sparse list.
if (id == self.sparse.items.len) {
self.sparse.append(null);
}
self.sparse.items[id] = id;
self.sparse.append(null);

src/entity.zig Outdated
Comment on lines 134 to 135
self.dense.append(entity);
self.dense.items[id].id = id;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.dense.append(entity);
self.dense.items[id].id = id;
const denseId = self.dense.items.len
self.sparse.items[id] = denseId;
self.dense.append(entity);
self.dense.items[denseId].id = sparseId;

src/entity.zig Outdated
self.dense.append(entity);
self.dense.items[id].id = id;

return id;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return id;
return sparseId;

src/entity.zig Outdated

pub const ServerEntityManager = struct {
dense: main.List(main.server.Entity),
sparse: main.List(?u32),
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sparse: main.List(?u32),
sparse: main.List(?u32),
free: main.ListUnmanaged(u32),

src/entity.zig Outdated
pub fn remove(self: *ServerEntityManager, id: u32) void {
if (!self.contains(id)) return;

const index = self.sparse.items[id] orelse return;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const index = self.sparse.items[id] orelse return;
const denseId = self.sparse.items[id] orelse return;

src/entity.zig Outdated
return id;
}

pub fn remove(self: *ServerEntityManager, id: u32) void {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn remove(self: *ServerEntityManager, id: u32) void {
pub fn remove(self: *ServerEntityManager, sparseId: u32) void {

OneAvargeCoder193 and others added 11 commits May 11, 2025 00:58
Currently Copper beats iron due to its low swing time.

This makes iron more elastic, giving it the same swing time as copper.
Both a copper-head and an iron-head pickaxe now have a swing time of
0.12s

This makes iron strictly better than copper, reducing it from the best
metal in the game to a step in the progression, it's still required to
mine iron. However the plan is to give it a come-back in the end game
due to its high conductivity.
## Description

This pull request adds `/replace` command. The main difference from
`/set` with `/mask global` is that mask specified for `/replace` is
inlined, local and positive, i.e. only blocks matching the mask
specified as part of `/replace` command will be affected. `/replace`
ignores global masks.

```
/replace <old> <new>
```

`<old>` - expression following mask syntax (PixelGuys#1284), blocks which match
will be affected
`<new>` - expression following pattern syntax (PixelGuys#1237) used to fill
blocks matched by `<old>`

## Examples

`/replace cubyz:air cubyz:void`
`/replace $leaf|cubyz:air cubyz:stone,cubyz:grass`

## Links

Related to: PixelGuys#1214 
Depends on: PixelGuys#1337 
Depends on: PixelGuys#1284

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
Resolves: PixelGuys#1457

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
@Argmaster Argmaster closed this Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants