diff --git a/assets/cubyz/blocks/duckweed.zig.zon b/assets/cubyz/blocks/duckweed.zig.zon index b2fc8c71..3df5d9cf 100644 --- a/assets/cubyz/blocks/duckweed.zig.zon +++ b/assets/cubyz/blocks/duckweed.zig.zon @@ -19,6 +19,7 @@ .texture3 = "cubyz:duckweed/3", .item = .{ .texture = "duckweed.png", + .tags = .{.fluidPlaceable}, }, .lodReplacement = "cubyz:air", } diff --git a/assets/cubyz/blocks/lily_pad.zig.zon b/assets/cubyz/blocks/lily_pad.zig.zon index 76e59c78..fa77b654 100644 --- a/assets/cubyz/blocks/lily_pad.zig.zon +++ b/assets/cubyz/blocks/lily_pad.zig.zon @@ -12,6 +12,7 @@ .texture = "cubyz:lily_pad", .item = .{ .texture = "lily_pad.png", + .tags = .{.fluidPlaceable}, }, .lodReplacement = "cubyz:air", } diff --git a/src/renderer.zig b/src/renderer.zig index c6c57d83..ea186f4c 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -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(); diff --git a/src/tag.zig b/src/tag.zig index ca6b5832..787d59bc 100644 --- a/src/tag.zig +++ b/src/tag.zig @@ -25,6 +25,7 @@ pub const Tag = enum(u32) { air = 0, fluid = 1, sbbChild = 2, + fluidPlaceable = 3, _, pub fn resetTags() void {