15018 Commits

Author SHA1 Message Date
Jürgen Rühle
f3de3eb1ab Clamp comparator block measurement to range [0,15] 2024-11-29 22:49:56 +00:00
Jürgen Rühle
71ed901272 Refactor block measuring
This prepares support for other measuring types besides inventory fullness.
Introduce table that maps node names to measuring function.

Implement support for small (trapped) chests and hoppers.
2024-11-29 22:49:56 +00:00
Elias Åström
934ccd35ea Make pistons be dug faster using pickaxe 2024-11-29 22:43:06 +00:00
Jürgen Rühle
0cddf2281a Preserve copper bulb preservation state when switching and digging 2024-11-29 22:39:57 +00:00
Jürgen Rühle
d880284a42 Fix copper bulb connection
Also unify update functions in on/off bulb variants.
2024-11-29 22:39:57 +00:00
Jürgen Rühle
e36958b8c0 Readd drop specification on lit copper bulb 2024-11-29 22:39:57 +00:00
cora
68d4a7bc31 Document mcl_armor on_place functionality 2024-11-29 22:39:36 +00:00
cora
a25a5e940e Move leather armor washing to mcl_armor 2024-11-29 22:39:36 +00:00
cora
d9e73574d3 Allow custom on_place function for armor sets 2024-11-29 22:39:36 +00:00
cora
190abc6b58 Reset lectern book item node meta when taking book out 2024-11-29 21:19:51 +00:00
cora
dfc5bac7ff Reset lectern infotext when taking book out 2024-11-29 21:19:51 +00:00
cora
04c82e1659 Don't set lectern infotext for writeable books 2024-11-29 21:19:51 +00:00
cora
6b021caa26 Stonecutter yields 4 copper grates 2024-11-29 15:13:53 +00:00
goblin_mode
d1a8b217a4
fix _on_unequip callback not being called 2024-11-28 20:48:51 +01:00
cora
2d54fba6ae Make active furnaces unmovable by piston 2024-11-27 19:52:42 +00:00
nooneatall
e3c3848cd6 Make piston pusher minable and drop correct piston type. 2024-11-27 11:12:46 +02:00
goblin_mode
b06b4dbaa2 make craftinguide logging be a warning instead 2024-11-26 15:45:20 +00:00
goblin_mode
faa3ae67b0 handle edgecase where ingredient is an item string 2024-11-26 15:45:20 +00:00
goblin_mode
d34ddce8a3 Revert custom crafting guide API removal 2024-11-26 15:45:20 +00:00
cora
4da948c9b4 Vaults: spawn loot items a little higher to prevent them getting stuck
in the vault
2024-11-24 17:14:26 +00:00
Jürgen Rühle
411bd48f6b Change auto activation to use node timer
Inactive vaults have a 1 second node timer started by on_construct, lbm,
or vault deactivation. Activating requires a player within distance 3
while deactivating only happens if there is no player within distance 5.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
7bca6fcce9 Only auto activate if player can open vault
Otherwise it wouldn't be useful to deactivate the vault after ejecting the
loot. This resolves the activate/deactivate cycle between auto activation
and active vault deactivation when no eligible player is near.

Also guard can_open and try_open against non player clickers.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
5cb18fed5e Slightly reduce visual_size of vault item entity
To prevent clipping into the node textures.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
ebc65e1516 Make mcl_enchanting support PcgRandom
mcl_enchanting.random(pr) assumed PseudoRandom's range of integer results.

TODO: discuss better solutions
2024-11-24 17:14:26 +00:00
Jürgen Rühle
f682a30281 Support generating no loot in mcl_loot.get_loot
This makes it easier to adapt MC loot tables that have a failure chance.

It was actually possible before, but this changes gives a way to suppress
the error message that appeared.

Also update the documentation.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
ea3aa4946d Verify vault and ominous vault loot table
Add failure chance to unique loot table, adapt potion levels and
enchantments to wiki values.

To compensate for the missing trident, slightly reduced the failure chance
for the unique loot. The missing trident enchantments now give a high
chance to create a mending book, which seems appropriate.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
351ac5c351 Auto activate vaults when a player is near
Don't require any other condition for activation.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
3e73e23605 Only activate inactive vaults
Provide node as bonus result from get_vault_def
2024-11-24 17:14:26 +00:00
Jürgen Rühle
2b613bba20 Fix vault loot getting lost on server shutdown
Store loot list in private node meta data, handle ejection in the item entity,
and recreate the entity for active and ejecting vaults in a LBM.

This also fixes active vaults having no item display after server restart and
ejecting vaults having display of the ejected items.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
eadef8efbf Add comment to ringbuffer:serialize 2024-11-24 17:14:26 +00:00
Jürgen Rühle
c79b249c8c Allow inserting false into ringbuffer
This was broken in the previous commit.  Also improve assert message.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
1b59a19050 Don't allow to insert nil values into ringbuffer
Otherwise index_of breaks. Also trim leading nil values when serializing.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
2b8c43428a Fix vault deactivating while ejecting
Vault item entity on_step must check for presence of active vault node
before swapping to inactive vault.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
d20857d062 Prevent nil values in serialized ringbuffer data 2024-11-24 17:14:26 +00:00
Jürgen Rühle
20c56e4263 Make ringbuffer into an actual ring buffer
Note that serialization/deserialization is always processing all elements.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
c722ecb41b Make vault looter ringbuffer size configurable
Note that currently the smallest supported size is 1, so in a singleplayer
world each vault can be looted at most once.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
40bc1513dc Provide default values in ringbuffer_class 2024-11-24 17:14:26 +00:00
Jürgen Rühle
01ba6bf061 Optionally register trial key in register_vault
Add (optipng-ed) ominous trial key image from
https://github.com/NovaWostra/Pixel-Perfection-Chorus-Eddit.git
2024-11-24 17:14:26 +00:00
Jürgen Rühle
4e30ee9657 Initialize all ringbuffer keys explicitly
Use false instead of nil.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
70a0070184 Refactor vaults api to use ringbuffer node meta handling 2024-11-24 17:14:26 +00:00
Jürgen Rühle
b29b5725e2 Add automatic handling of ringbuffer stored in node meta data
Initialization from node meta data and automatic update on insert.

This also adds weak caching to prevent repeated calls to deserialize; the
serialization still happens on every write access.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
2420172812 Refactor vaults api
Use constants for size and node meta key, ringbuffer.deserialize, and
return value from insert_if_not_exists to save extra can_open call.
2024-11-24 17:14:26 +00:00
Jürgen Rühle
5d8f0b606e Add ringbuffer.deserialize 2024-11-24 17:14:26 +00:00
Jürgen Rühle
871cfd3a77 ringbuffer.insert_if_not_exists returns whether it inserted the element 2024-11-24 17:14:26 +00:00
Jürgen Rühle
4b253cedf1 Truncate in ringbuffer.new if number of initial values exceeds size
Only retain the newest entries (having the highest indices).
2024-11-24 17:14:26 +00:00
Jürgen Rühle
9369c3ed76 Fix ominous vault bottom texture 2024-11-24 17:14:26 +00:00
cora
b088104961 Add ominous vaults 2024-11-24 17:14:26 +00:00
cora
29d647fe65 Don't show active and ejecting vault types in creative inventory 2024-11-24 17:14:26 +00:00
cora
53bb76288b Make vaults use ringbuffer class to only store the last 180 players 2024-11-24 17:14:26 +00:00
cora
0ad582839e Add ringbuffer class to mcl_util 2024-11-24 17:14:26 +00:00