1217 Commits

Author SHA1 Message Date
Krzysztof Wiśniewski
2e705d9cc9
Fix #1457 (#1459)
Resolves: #1457

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-20 19:51:43 +02:00
Krzysztof Wiśniewski
b79784a0aa
Add /replace command (#1424)
## 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 (#1284), blocks which match
will be affected
`<new>` - expression following pattern syntax (#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: #1214 
Depends on: #1337 
Depends on: #1284

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-20 19:03:12 +02:00
IntegratedQuantum
c52b231983
Make iron more elastic (#1472)
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.
2025-05-20 18:56:25 +02:00
ChibChi
0e1aa68174
Add random tick events (#1338)
This pull request adds random tick events for blocks. Tick events can be
added by using the `tickEvent` trait and contain the `name` of the
callback function and the probability ( `chance`).

Resolves: https://github.com/PixelGuys/Cubyz/issues/77

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-19 20:55:42 +02:00
OneAvargeCoder193
2f48161712
Add a SparseSet implementation (#1414) 2025-05-19 16:49:41 +02:00
IntegratedQuantum
a29bb3c3b9
Rename EntityDataClass to BlockEntityType (#1464)
I also removed the legacy (java) blockEntity references.

fixes #1454

@Argmaster since you wrote the original code in #1224, please review and
check if the new names are fine for you.
2025-05-18 19:20:51 +02:00
Krzysztof Wiśniewski
1f4d23464a
Add /mask command (#1337)
* Add masks

* Apply masks to /set

* Change char used for tags

* Remove mask command

* Revert "Remove mask command"

This reverts commit 83e8cdd9044452f11efdd4d515bee330491ea1f6.

* Fix use of BlockTag

* Fix use of BlockTag

* Move Pattern into Blueprint

* Improve error message on capture failure

* Change memory management

* Move EditMask to blueprint.zig

* Polish mask command

* Fix some fixes

* Fix block formatting

* Fix blueprint formatting

* Implement some of the suggestions

* Fix field renames

* Unstupidify Entry.initFromString inverse handling

* Use introspection to create Property enum

* Make or_ and_ inverse etc. private

* Use functions instead of generics

* Rename getBlockById parameter

* Update src/blueprint.zig

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

* Improve error names

* Add get method to Tag

* Improve error names

* Update src/blueprint.zig

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

* Change how block dispatch is done

* Add hasTag

* Quick fixes of small bugs

* Fix implementation of hasTag

* Remove redundant try from parseBlockLike

* Add test for inverse masks

* Fix inversed mask check

* Remove brush masks

* Remove unused imports

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-18 19:03:41 +02:00
IntegratedQuantum
f5fd3356d9 Reset the client-side inventory sync after leaving a world.
should fix #1461
2025-05-18 13:06:15 +02:00
Krzysztof Wiśniewski
6596835cf3
Tweak coal ore health (#1456) 2025-05-18 12:07:22 +02:00
IntegratedQuantum
5c68b2da2a Fix memory leak of world name
fixes #1458
2025-05-17 22:56:49 +02:00
Krzysztof Wiśniewski
53d6cc70e9
Add BaseItemIndex struct (#1445)
* Add BaseItemIndex struct

* Please fix

* Update src/Inventory.zig

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

* Sticks and stones may break my bones but pr will always need fixes

* Update src/assets.zig

* Replace break with return in Inventory.update

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-17 15:51:21 +02:00
Krzysztof Wiśniewski
f9a65a0681
Add modified test runner (#1294)
* Add modified test runner

* Add test runner to build.zig

* Fix build.zig formatting

* Merge master runner and changed runner

* Restore proper comment

* Update test/runner.zig

* Update test/runner.zig

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

* Update test/runner.zig

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

* Update test/runner.zig

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

* Update test/runner.zig

* Restore deleted line

* Restore deleted line

* Get rid of padding stuff

* Update test/runner.zig

* Colors

* doColors

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-15 17:58:17 +02:00
IntegratedQuantum
54ab3fc8ed Add sign rotation mode
a first step towards #367
2025-05-14 21:38:34 +02:00
IntegratedQuantum
824840a776 Fix formatting 2025-05-13 21:48:58 +02:00
IntegratedQuantum
73bbdcc033 Allow arbitrary and duplicate Save names.
This is done by replacing all illegal file name characters with `-`. Unicode is still preserved because it doesn't seem to be a problem for modern file systems.
The idea of file name encoding/decoding is discarded, instead the name is just stored in the zon
fixes #606
2025-05-13 21:10:14 +02:00
IntegratedQuantum
8bcc00f536 Sort the world list in save selection by least recently used.
Also did some further refactoring to make it easier to deal with different world paths (#606) in the future.
fixes #1311
2025-05-13 20:39:12 +02:00
IntegratedQuantum
ab4beca0f4 Rename the server thread to make it easier to distinguish in a profiler or debugger.
I would also rename the main thread, but that doesn't seem to be possible.
2025-05-13 19:54:48 +02:00
IntegratedQuantum
3db8c22b5d Fix number of indices
fixes #1437
2025-05-12 20:28:03 +02:00
IntegratedQuantum
4d62da9ae8 Rename solid to replacable
fixes #1358
2025-05-12 18:06:21 +02:00
IntegratedQuantum
48f67e19c2 Why did I test this after merging? 2025-05-12 17:51:37 +02:00
IntegratedQuantum
2f3a25dfb3
Draw a thicker selection box (#1435)
* Draw a thicker bounding box

* Draw an actual 3d model for the selection box.

This is done using a line model with a cubiod offset model.
2025-05-12 17:47:14 +02:00
IntegratedQuantum
e4840f7503 Limit the performance impact from freeing from the GPU buffer to 5 ms per frame
fixes #1416
this is a workaround until #1434 is implemented
2025-05-11 21:06:02 +02:00
IntegratedQuantum
1fbf5618b9 Set the placeholder biome before receiving the first biome packet from the server
fixes #1428
2025-05-11 19:54:25 +02:00
Krzysztof Wiśniewski
b0aa8ea6ea
Edit masks (#1284)
* Add masks

* Apply masks to /set

* Change char used for tags

* Remove mask command

* Fix use of BlockTag

* Move Pattern into Blueprint

* Improve error message on capture failure

* Change memory management

* Move EditMask to blueprint.zig

* Fix some fixes

* Fix block formatting

* Fix blueprint formatting

* Implement some of the suggestions

* Fix field renames

* Unstupidify Entry.initFromString inverse handling

* Use introspection to create Property enum

* Make or_ and_ inverse etc. private

* Use functions instead of generics

* Rename getBlockById parameter

* Update src/blueprint.zig

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

* Improve error names

* Add get method to Tag

* Improve error names

* Update src/blueprint.zig

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

* Change how block dispatch is done

* Add hasTag

* Quick fixes of small bugs

* Fix implementation of hasTag

* Remove redundant try from parseBlockLike

* Add test for inverse masks

* Fix inversed mask check

* Return Inner from parseBlockLike

* Apply review change requests

* Fix memory leak and add negative tests

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-11 15:31:17 +02:00
IntegratedQuantum
c04819c5af
Compile shaders in the CI, to validate that their syntax is correct (#1427)
* Move to glslang's convention for shader file suffix

* Update ci.yml

* Oops, a mistake in the shader, how could that happen?

* Does the command error on its own?

* Update ci.yml

* Revert "Oops, a mistake in the shader, how could that happen?"

This reverts commit 869c3323f3d3b5fa607b40e7847c389a12b01f33.

* Update ci.yml
2025-05-10 12:32:51 +02:00
Krzysztof Wiśniewski
102a60ad30
Fix #1345 (#1422) 2025-05-10 10:37:15 +02:00
IntegratedQuantum
ed99d940d2 Send updated biome information instantly back to the player, but only when the biome actually changed
fixes #478
2025-05-09 22:01:11 +02:00
IntegratedQuantum
ffab4407e9 Simplify stair chisel selection code, using the same technique as torches.
fixes #1360
2025-05-09 21:45:12 +02:00
IntegratedQuantum
74bf4b62c9 Don't print things when canceling an invite.
fixes #1312
2025-05-09 21:32:40 +02:00
IntegratedQuantum
a9a907313b Change cloth block tag to cloth
fixes #1095, the breaking speed was already adjusted previously
2025-05-09 17:53:43 +02:00
IntegratedQuantum
b08aff096c Round max durability and move durability clamping after modifiers.
fixes #1370
2025-05-09 17:05:51 +02:00
IntegratedQuantum
c7d938e965 Make tools with encased stone better at that stone type.
fixes #1398
2025-05-09 16:42:46 +02:00
IntegratedQuantum
2cbc6a79d2 Add a ComputePipeline and make Shader private
fixes #1417
2025-05-09 14:12:42 +02:00
IntegratedQuantum
82675434be Always allow localhost connections to join a game
fixes #1415
2025-05-08 22:04:11 +02:00
IntegratedQuantum
c8ee037027 Make stones (except sandstone) not fragile
they are already bad enough as it is, and having them fragile too makes them even less likely to be used (and we do want them to be used, see e.g. #1398)
2025-05-08 21:59:17 +02:00
IntegratedQuantum
c2b03ff437
Add an abstraction for the Graphics pipeline (#1405)
* Add the vulkan headers from the new Cubyz-libs version

* Add a GraphicsPipeline abstraction that's based on Vulkan's pipeline parameters.

This will help get rid of all the glEnable implicit state, and it will make #102 easier.

* I'm leaving out the viewport for now, it seems that it would make migration difficult

* Small fixes and rename graphics.GraphicsPipeline to just graphics.Pipeline

* Pipelinify the UI shaders

* Fix formatting

* Pipelines everywhere

* Fix the crosshair and remove remaining glEnable and related calls

* fix format

* How many more things does it need to clear the thing correctly?

* Fix selection

* Fix bloom
2025-05-08 19:37:26 +02:00
ikabod-kee
2991febe3f
Oak and Birch Tree Generators (#1382)
* Added Blueprints and SBBs for oak and birch trees

* Whoops! Added .zig to .zon

* Format Change (agh)

* Fixes to generators

* Changed nulls and put trees in Tree folder

* Removed Treefixes

* Update leaf_1.zig.zon

* Omitted chances

* 5 years

* Changed the two oak roots I had neglected
2025-05-07 18:37:45 +02:00
Carrie
93d5292338
Make iron darker, tweak copper, tweak gold block (#1411) 2025-05-07 18:20:11 +02:00
IntegratedQuantum
5a1a824e05
Add SPIR-V compilation to ensure our shaders remain SPIR-V compatible (#1404)
* Remove unused `directionalLight` uniform

* Add glslang libraries

* Update to the new Cubyz-libs version

* Dehardcode OS-dependent library file name stuff

* Audio somehow crashes on close, not sure why but I assume it's probably because of the library being compiled with a new zig version.

* Remove irrelevant uniforms from Window uniform list

* Remove unused itemdrop uniform

* Implement SPIR-V compilation code, the actual output is discarded

* Improve linking shader errors by passing a file path

* Fix formatting
2025-05-05 20:20:11 +02:00
Carrie
2cf88669e7
Removed unused block textures (#1402) 2025-05-05 17:21:10 +02:00
Krzysztof Wiśniewski
67135b433d
Add chat history accessible with up/down arrows (#1244)
* Add up down message history

* Deduplicate messages when inserting into history

* Add dedicated function for inserting strings into TextInput

* Fix formatting issues

* Change history behavior

* Rename inputString to setString

* Move clearing to setString

* Apply suggestions from code review

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

* Remove unused cursor capture

* Use FixedSizeCircularBuffer for history

* Restore large queue size

* Allow navigation to empty entry

* self.len must never be bigger than capacity

* Move optional callbacks into struct

* Use enum for moveCursorVertically return value

* WA attempt #1

* Fix edge case from review

* Update src/gui/windows/chat.zig

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

* Remove isEmpty and isFull

* Allow for empty history entry

* Change empty message handling some more

* Remove unused methods

* Go to hell with all of those edge cases <3

* WA for 4b

* Remove CircularBufferQueue methods

* Fix queue thing

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-04 12:57:25 +02:00
Carrie
7fed896a77
Permafrost, cold grass, and osier (+ biome changes) (#1369)
* Permafrost, cold grass, osier, cold taiga, tweaks

* Tweak osier and cold grass item

* formatting

* Move cold_taiga to taiga/cold and migrate taiga/base

* Fix subbiomes
2025-05-04 12:39:44 +02:00
Carrie
900b52a02c
Resin assets (#1383)
* Resin assets

* resin_block = .wood

* Make resin block more frictiony
2025-05-04 12:34:17 +02:00
Krzysztof Wiśniewski
e1fc8deef8
[Structure Building Block] Allow specifying empty / sentinel children (#1388)
* Allow sentinel child declarations

* Fix len check
2025-05-03 14:23:57 +02:00
IntegratedQuantum
1a1a503033 gl_DepthRange is not supported by SPIR-V
progress towards #1376
2025-05-02 17:04:21 +02:00
IntegratedQuantum
73d50720b4 Assign locations to all uniform declarations
progress towards #1376
2025-05-02 16:47:29 +02:00
Krzysztof Wiśniewski
61268fb374
Add Structure Building Blocks based Generator (#1227)
* Revert "Remove SBBGen"

This reverts commit b49048412f21c57d5638144da7f039753a94cafc.

* Revert "Remove example SBB"

This reverts commit afc5d6fed0ba92b558ccda91893fdb3fc63f69ec.

* Revert "Remove blueprint code"

This reverts commit 2553950adbdcef9c1c68afe4109f9247b74abb92.

* Fix compilation errors

* Fix compilation errors #2

* Fix test errors

* Fix rotateZ

* Resolve structure reference while instantiating SBBGen

* Fix formatting issues

* Add new trees to forest

* Add new trees to grassland

* Decrease forest density so you can find new trees

* Add degradable paste mode

* Remove substitutions

* Apply review suggestions

* Use lookup table for alignment

* Apply suggestions from code review

* Update src/server/terrain/simple_structures/_list.zig

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

* Fix inital SBB offset

* Never place air in placeInGeneration

* Integrate void block with paste

* Revert "Move hashInt and hashCombine to utils"

This reverts commit 9bb276f69f60ad60f1170d07ec30ebd02307a36a.

* Make PasteMode comptime

* Fix remaining issues with void block integration

* Fix formatting

* Apply review change requests

* Remove origin and child blocks while resolving sbbs

* Apply review change requests

* I hate indexing

* Fix example tree models

* Use single index for chunk and blueprint in pasteInGeneration

* Fix formatting

* Extract blueprintOffset

* Fix formatting

* Apply suggestions from code review

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

* Apply Quantums suggestion for Y and Z

* No cast

* Use pos instead of chunkOffset

* Remove test tree

* Apply suggestions from code review

---------

Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
2025-05-02 16:11:10 +02:00
IntegratedQuantum
3ba4d5fd14 Explicitly specify image bindings for all sampler uniforms.
progress towards #1376
2025-05-02 15:49:01 +02:00
IntegratedQuantum
9898db654b Specify the location of all shader in/out parameters.
also normalized the version and layout formatting
progress towards #1376
2025-05-02 14:53:57 +02:00
Krzysztof Wiśniewski
86e0a9ae4b
Move /set to be method on Blueprint (#1352)
* Move Pattern into Blueprint

* Improve error message on capture failure

* Change memory management
2025-05-02 10:21:25 +02:00