diff --git a/assets/cubyz/blocks/air.zig.zon b/assets/cubyz/blocks/air.zig.zon index 0deaca8b10..8315d94d02 100644 --- a/assets/cubyz/blocks/air.zig.zon +++ b/assets/cubyz/blocks/air.zig.zon @@ -4,7 +4,7 @@ .transparent = true, .absorbedLight = 0x000000, .viewThrough = true, - .replacable = true, + .replaceable = true, .rotation = "cubyz:no_rotation", .degradable = true, .hasItem = false, diff --git a/assets/cubyz/blocks/bolete.zig.zon b/assets/cubyz/blocks/bolete.zig.zon index e0e8f1e63c..13c5cb34e8 100644 --- a/assets/cubyz/blocks/bolete.zig.zon +++ b/assets/cubyz/blocks/bolete.zig.zon @@ -4,7 +4,7 @@ .drops = .{ .{.items = .{.auto}}, }, - .replacable = true, + .replaceable = true, .viewThrough = true, .degradable = true, .absorbedLight = 0x010101, diff --git a/assets/cubyz/blocks/cold_grass_vegetation.zig.zon b/assets/cubyz/blocks/cold_grass_vegetation.zig.zon index 8bff04887f..7d9cd6aa4f 100644 --- a/assets/cubyz/blocks/cold_grass_vegetation.zig.zon +++ b/assets/cubyz/blocks/cold_grass_vegetation.zig.zon @@ -13,5 +13,6 @@ .item = .{ .texture = "cold_grass.png", }, + .replaceable = true, .lodReplacement = "cubyz:air", } diff --git a/assets/cubyz/blocks/dry_grass_vegetation.zig.zon b/assets/cubyz/blocks/dry_grass_vegetation.zig.zon index 56086057ea..d18f3f9bbd 100644 --- a/assets/cubyz/blocks/dry_grass_vegetation.zig.zon +++ b/assets/cubyz/blocks/dry_grass_vegetation.zig.zon @@ -13,5 +13,6 @@ .item = .{ .texture = "dry_grass.png", }, + .replaceable = true, .lodReplacement = "cubyz:air", } diff --git a/assets/cubyz/blocks/fern.zig.zon b/assets/cubyz/blocks/fern.zig.zon index 172adb5e53..f9585f1936 100644 --- a/assets/cubyz/blocks/fern.zig.zon +++ b/assets/cubyz/blocks/fern.zig.zon @@ -13,5 +13,6 @@ .item = .{ .texture = "fern.png", }, + .replaceable = true, .lodReplacement = "cubyz:air", } diff --git a/assets/cubyz/blocks/fog/_defaults.zig.zon b/assets/cubyz/blocks/fog/_defaults.zig.zon index 5826717d49..9e7d0d0765 100644 --- a/assets/cubyz/blocks/fog/_defaults.zig.zon +++ b/assets/cubyz/blocks/fog/_defaults.zig.zon @@ -5,7 +5,7 @@ .degradable = true, .transparent = true, .hasBackFace = true, - .replacable = true, + .replaceable = true, .collide = false, .model = "cubyz:cube", diff --git a/assets/cubyz/blocks/glimmergill.zig.zon b/assets/cubyz/blocks/glimmergill.zig.zon index 5673c9215c..1873320e72 100644 --- a/assets/cubyz/blocks/glimmergill.zig.zon +++ b/assets/cubyz/blocks/glimmergill.zig.zon @@ -4,7 +4,7 @@ .drops = .{ .{.items = .{.auto}}, }, - .replacable = true, + .replaceable = true, .degradable = true, .viewThrough = true, .absorbedLight = 0x010101, diff --git a/assets/cubyz/blocks/grass_vegetation.zig.zon b/assets/cubyz/blocks/grass_vegetation.zig.zon index d0bf2bbba6..c0d3ae0b24 100644 --- a/assets/cubyz/blocks/grass_vegetation.zig.zon +++ b/assets/cubyz/blocks/grass_vegetation.zig.zon @@ -13,5 +13,6 @@ .item = .{ .texture = "grass.png", }, + .replaceable = true, .lodReplacement = "cubyz:air", } diff --git a/assets/cubyz/blocks/lava.zig.zon b/assets/cubyz/blocks/lava.zig.zon index 6582b15208..54fad9fb25 100644 --- a/assets/cubyz/blocks/lava.zig.zon +++ b/assets/cubyz/blocks/lava.zig.zon @@ -2,7 +2,7 @@ .tags = .{.fluid}, .drops = .{}, .selectable = false, - .replacable = true, + .replaceable = true, .degradable = true, .transparent = true, .hasBackFace = true, diff --git a/assets/cubyz/blocks/lush_grass_vegetation.zig.zon b/assets/cubyz/blocks/lush_grass_vegetation.zig.zon index 67deb0a8a0..e291649482 100644 --- a/assets/cubyz/blocks/lush_grass_vegetation.zig.zon +++ b/assets/cubyz/blocks/lush_grass_vegetation.zig.zon @@ -13,5 +13,6 @@ .item = .{ .texture = "lush_grass.png", }, + .replaceable = true, .lodReplacement = "cubyz:air", } diff --git a/assets/cubyz/blocks/sulfur_torch.zig.zon b/assets/cubyz/blocks/sulfur_torch.zig.zon index 922568bbde..1074555cf0 100644 --- a/assets/cubyz/blocks/sulfur_torch.zig.zon +++ b/assets/cubyz/blocks/sulfur_torch.zig.zon @@ -4,7 +4,7 @@ .drops = .{ .{.items = .{.auto}}, }, - .replacable = true, + .replaceable = true, .emittedLight = 0x2b81b2, .viewThrough = true, .absorbedLight = 0x010101, diff --git a/assets/cubyz/blocks/toadstool.zig.zon b/assets/cubyz/blocks/toadstool.zig.zon index b721c0f9c5..ad1d2890ac 100644 --- a/assets/cubyz/blocks/toadstool.zig.zon +++ b/assets/cubyz/blocks/toadstool.zig.zon @@ -4,7 +4,7 @@ .drops = .{ .{.items = .{.auto}}, }, - .replacable = true, + .replaceable = true, .degradable = true, .viewThrough = true, .absorbedLight = 0x010101, diff --git a/assets/cubyz/blocks/torch.zig.zon b/assets/cubyz/blocks/torch.zig.zon index 46d331ccba..c7c84c0bcd 100644 --- a/assets/cubyz/blocks/torch.zig.zon +++ b/assets/cubyz/blocks/torch.zig.zon @@ -4,7 +4,7 @@ .drops = .{ .{.items = .{.auto}}, }, - .replacable = true, + .replaceable = true, .emittedLight = 0xa58d73, .viewThrough = true, .absorbedLight = 0x010101, diff --git a/assets/cubyz/blocks/water.zig.zon b/assets/cubyz/blocks/water.zig.zon index 370b8b59b7..af471684b6 100644 --- a/assets/cubyz/blocks/water.zig.zon +++ b/assets/cubyz/blocks/water.zig.zon @@ -2,7 +2,7 @@ .tags = .{.fluid}, .drops = .{}, .selectable = false, - .replacable = true, + .replaceable = true, .degradable = true, .transparent = true, .hasBackFace = true, diff --git a/mods/cubyz/rotation/branch.zig b/mods/cubyz/rotation/branch.zig index b7bb6eb4ef..7ced27962f 100644 --- a/mods/cubyz/rotation/branch.zig +++ b/mods/cubyz/rotation/branch.zig @@ -343,13 +343,13 @@ pub fn generateData( ) bool { const canConnectToNeighbor = currentBlock.mode() == neighborBlock.mode() and currentBlock.modeData() == neighborBlock.modeData(); - if(blockPlacing or canConnectToNeighbor or !neighborBlock.replacable()) { + if(blockPlacing or canConnectToNeighbor or !neighborBlock.replaceable()) { const neighborModel = blocks.meshes.model(neighborBlock).model(); var currentData = BranchData.init(currentBlock.data); // Branch block upon placement should extend towards a block it was placed // on if the block is solid or also uses branch model. - const targetVal = ((!neighborBlock.replacable() and (!neighborBlock.viewThrough() or canConnectToNeighbor)) and (canConnectToNeighbor or neighborModel.isNeighborOccluded[neighbor.?.reverse().toInt()])); + const targetVal = ((!neighborBlock.replaceable() and (!neighborBlock.viewThrough() or canConnectToNeighbor)) and (canConnectToNeighbor or neighborModel.isNeighborOccluded[neighbor.?.reverse().toInt()])); currentData.setConnection(neighbor.?, targetVal); const result: u16 = currentData.enabledConnections; @@ -371,7 +371,7 @@ pub fn updateData(block: *Block, neighbor: Neighbor, neighborBlock: Block) bool if(canConnectToNeighbor) { const neighborData = BranchData.init(neighborBlock.data); currentData.setConnection(neighbor, neighborData.isConnected(neighbor.reverse())); - } else if(neighborBlock.replacable()) { + } else if(neighborBlock.replaceable()) { currentData.setConnection(neighbor, false); } diff --git a/mods/cubyz/rotation/fence.zig b/mods/cubyz/rotation/fence.zig index 611100a1f5..92b9dab64e 100644 --- a/mods/cubyz/rotation/fence.zig +++ b/mods/cubyz/rotation/fence.zig @@ -107,7 +107,7 @@ pub fn updateData(block: *Block, neighbor: Neighbor, neighborBlock: Block) bool const blockBaseModelIndex = blocks.meshes.modelIndexStart(block.*); const neighborBaseModelIndex = blocks.meshes.modelIndexStart(neighborBlock); const neighborModel = blocks.meshes.model(neighborBlock).model(); - const targetVal = !neighborBlock.replacable() and !neighborBlock.transparent() and (blockBaseModelIndex == neighborBaseModelIndex or neighborModel.isNeighborOccluded[neighbor.reverse().toInt()]); + const targetVal = !neighborBlock.replaceable() and !neighborBlock.transparent() and (blockBaseModelIndex == neighborBaseModelIndex or neighborModel.isNeighborOccluded[neighbor.reverse().toInt()]); var currentData: FenceData = @bitCast(@as(u4, @truncate(block.data))); switch(neighbor) { .dirNegX => { diff --git a/mods/cubyz/rotation/hanging.zig b/mods/cubyz/rotation/hanging.zig index 71d9632dfa..7f9fdc2331 100644 --- a/mods/cubyz/rotation/hanging.zig +++ b/mods/cubyz/rotation/hanging.zig @@ -39,7 +39,7 @@ pub fn generateData(_: *main.game.World, _: Vec3i, _: Vec3f, _: Vec3f, _: Vec3i, if(neighbor != Neighbor.dirUp) return false; if(!sameBlock) { const neighborModel = neighborBlock.mode().model(neighborBlock).model(); - const support = !neighborBlock.replacable() and neighborModel.neighborFacingQuads[Neighbor.dirDown.toInt()].len != 0; + const support = !neighborBlock.replaceable() and neighborModel.neighborFacingQuads[Neighbor.dirDown.toInt()].len != 0; if(!support) return false; } currentData.data = 1; diff --git a/mods/cubyz/rotation/log.zig b/mods/cubyz/rotation/log.zig index 142f4f52ac..556da02db6 100644 --- a/mods/cubyz/rotation/log.zig +++ b/mods/cubyz/rotation/log.zig @@ -196,13 +196,13 @@ pub fn generateData( ) bool { const canConnectToNeighbor = currentBlock.mode() == neighborBlock.mode(); - if(blockPlacing or canConnectToNeighbor or !neighborBlock.replacable()) { + if(blockPlacing or canConnectToNeighbor or !neighborBlock.replaceable()) { const neighborModel = blocks.meshes.model(neighborBlock).model(); var currentData = LogData.init(currentBlock.data); // Log block upon placement should extend towards a block it was placed // on if the block is solid or also uses log model. - const targetVal = ((!neighborBlock.replacable() and (!neighborBlock.viewThrough() or canConnectToNeighbor)) and (canConnectToNeighbor or neighborModel.isNeighborOccluded[neighbor.?.reverse().toInt()])); + const targetVal = ((!neighborBlock.replaceable() and (!neighborBlock.viewThrough() or canConnectToNeighbor)) and (canConnectToNeighbor or neighborModel.isNeighborOccluded[neighbor.?.reverse().toInt()])); currentData.setConnection(neighbor.?, targetVal); for(Neighbor.iterable) |side| { diff --git a/mods/cubyz/rotation/torch.zig b/mods/cubyz/rotation/torch.zig index 270fec3537..db44caec19 100644 --- a/mods/cubyz/rotation/torch.zig +++ b/mods/cubyz/rotation/torch.zig @@ -123,7 +123,7 @@ pub fn rotateZ(data: u16, angle: Degrees) u16 { pub fn generateData(_: *main.game.World, _: Vec3i, _: Vec3f, _: Vec3f, relativeDir: Vec3i, neighbor: ?Neighbor, currentData: *Block, neighborBlock: Block, _: bool) bool { if(neighbor == null) return false; const neighborModel = blocks.meshes.model(neighborBlock).model(); - const neighborSupport = !neighborBlock.replacable() and neighborModel.neighborFacingQuads[neighbor.?.reverse().toInt()].len != 0; + const neighborSupport = !neighborBlock.replaceable() and neighborModel.neighborFacingQuads[neighbor.?.reverse().toInt()].len != 0; if(!neighborSupport) return false; var data: TorchData = @bitCast(@as(u5, @truncate(currentData.data))); if(relativeDir[0] == 1) data.posX = true; @@ -141,7 +141,7 @@ pub fn generateData(_: *main.game.World, _: Vec3i, _: Vec3f, _: Vec3f, relativeD pub fn updateData(block: *Block, neighbor: Neighbor, neighborBlock: Block) bool { const neighborModel = blocks.meshes.model(neighborBlock).model(); - const neighborSupport = !neighborBlock.replacable() and neighborModel.neighborFacingQuads[neighbor.reverse().toInt()].len != 0; + const neighborSupport = !neighborBlock.replaceable() and neighborModel.neighborFacingQuads[neighbor.reverse().toInt()].len != 0; var currentData: TorchData = @bitCast(@as(u5, @truncate(block.data))); switch(neighbor) { .dirNegX => { diff --git a/src/blocks.zig b/src/blocks.zig index 8b10fcf9eb..d95aa50b7e 100644 --- a/src/blocks.zig +++ b/src/blocks.zig @@ -59,7 +59,7 @@ var _blockHealth: [maxBlockCount]f32 = undefined; var _blockResistance: [maxBlockCount]f32 = undefined; /// Whether you can replace it with another block, mainly used for fluids/gases -var _replacable: [maxBlockCount]bool = undefined; +var _replaceable: [maxBlockCount]bool = undefined; var _selectable: [maxBlockCount]bool = undefined; var _blockDrops: [maxBlockCount][]BlockDrop = undefined; /// Meaning undegradable parts of trees or other structures can grow through this block. @@ -118,7 +118,7 @@ pub fn register(_: []const u8, id: []const u8, zon: ZonElement) u16 { _absorption[size] = zon.get(u32, "absorbedLight", 0xffffff); _degradable[size] = zon.get(bool, "degradable", false); _selectable[size] = zon.get(bool, "selectable", true); - _replacable[size] = zon.get(bool, "replacable", false); + _replaceable[size] = zon.get(bool, "replaceable", false); _onInteract[size] = blk: { break :blk ClientBlockCallback.init(zon.getChildOrNull("onInteract") orelse break :blk .noop) orelse { std.log.err("Failed to load onInteract event for block {s}", .{id}); @@ -336,8 +336,8 @@ pub const Block = packed struct { // MARK: Block } /// Whether you can replace it with another block, mainly used for fluids/gases - pub inline fn replacable(self: Block) bool { - return _replacable[self.typ]; + pub inline fn replaceable(self: Block) bool { + return _replaceable[self.typ]; } pub inline fn selectable(self: Block) bool { diff --git a/src/renderer.zig b/src/renderer.zig index e0403f7e1d..23bddebfff 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -1017,7 +1017,7 @@ pub const MeshSelection = struct { // MARK: MeshSelection return; } } else { - if(!block.replacable()) return; + if(!block.replaceable()) return; block.typ = itemBlock; block.data = 0; if(rotationMode.generateData(main.game.world.?, neighborPos, relPos, lastDir, neighborDir, neighborOfSelection, &block, neighborBlock, true)) { diff --git a/src/rotation.zig b/src/rotation.zig index 0137d54a95..d99c7e0160 100644 --- a/src/rotation.zig +++ b/src/rotation.zig @@ -99,7 +99,7 @@ pub const RotationMode = struct { // MARK: RotationMode shouldDropSourceBlockOnSuccess.* = true; if(oldBlock == newBlock) return .no; if(oldBlock.typ == newBlock.typ) return .yes; - if(!oldBlock.replacable()) { + if(!oldBlock.replaceable()) { var damage: f32 = main.game.Player.defaultBlockDamage; const isTool = item.item != null and item.item.? == .tool; if(isTool) {