Place certain blocks on water (#1672)

Fixes #1218

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
This commit is contained in:
codemob 2025-07-20 05:10:16 -04:00 committed by GitHub
parent 32760169f7
commit f2dc3faec2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,7 @@
.texture3 = "cubyz:duckweed/3",
.item = .{
.texture = "duckweed.png",
.tags = .{.fluidPlaceable},
},
.lodReplacement = "cubyz:air",
}

View File

@ -12,6 +12,7 @@
.texture = "cubyz:lily_pad",
.item = .{
.texture = "lily_pad.png",
.tags = .{.fluidPlaceable},
},
.lodReplacement = "cubyz:air",
}

View File

@ -917,8 +917,9 @@ pub const MeshSelection = struct { // MARK: MeshSelection
while(total_tMax < closestDistance) {
const block = mesh_storage.getBlock(voxelPos[0], voxelPos[1], voxelPos[2]) orelse break;
if(block.typ != 0) blk: {
const fluidPlaceable = item != null and item.? == .baseItem and item.?.baseItem.hasTag(.fluidPlaceable);
for(block.blockTags()) |tag| {
if(tag == .fluid or tag == .air) break :blk; // TODO: Buckets could select fluids
if(tag == .fluid and !fluidPlaceable or tag == .air) break :blk; // TODO: Buckets could select fluids
}
const relativePlayerPos: Vec3f = @floatCast(pos - @as(Vec3d, @floatFromInt(voxelPos)));
if(block.mode().rayIntersection(block, item, relativePlayerPos, _dir)) |intersection| {
@ -1047,6 +1048,9 @@ pub const MeshSelection = struct { // MARK: MeshSelection
currentBlockProgress = 0;
}
const block = mesh_storage.getBlock(selectedPos[0], selectedPos[1], selectedPos[2]) orelse return;
if(block.hasTag(.fluid) or block.hasTag(.air)) {
return;
}
const relPos: Vec3f = @floatCast(lastPos - @as(Vec3d, @floatFromInt(selectedPos)));
main.items.Inventory.Sync.ClientSide.mutex.lock();

View File

@ -25,6 +25,7 @@ pub const Tag = enum(u32) {
air = 0,
fluid = 1,
sbbChild = 2,
fluidPlaceable = 3,
_,
pub fn resetTags() void {