Commit graph

1823 commits

Author SHA1 Message Date
fishshi
6da5ef698d Add AFTER_CLIENT_WORLD_CHANGE (#4173)
* add AFTER_CLIENT_WORLD_CHANGE

* fix

* move

* add description to README and change class to final with a private constructor

* revert the event name
2024-11-12 18:29:23 +00:00
Syst3ms
e9d2cfc835 Data Attachment Sync API (#4049)
Completes the data attachment API with client-server syncing capabilities.

## Motivation

The existing API works great for attaching data to game objects, be they serverside or clientside, but lacks any ability to synchronize between the two.

A mod that wants to add a "thirst" mechanic can easily do so on the server side by attaching an integer to every player. However, the mod may also want to use this information to render additional HUD elements on the client. Currently, informing the client of this data can only be done manually, which is cumbersome, error-prone, and is much better-suited as an API feature.

## API Changes

The API doesn't change a lot (at least compared to the implementation), with a few new methods and one new class.

One new method has been added to `AttachmentRegistry.Builder`, namely `syncWith`. It declares that an attachment type may be synchronized with some clients, and takes a `PacketCodec` to encode attachment data over the network, as well as an element of the new `AttachmentSyncPredicate` interface.

This interface extends `BiPredicate<AttachmentTarget, ServerPlayerEntity>` to allow for user-defined predicates, and provides some common presets:
* `all()`: attachment data will be synchronized with all clients (that track the target).
* `targetOnly()`: attachment data will only be synchronized with the target it is attached to, when it is a player. If the target is not a player, it won't be synchronized with any client.
* `allButTarget()`: reverse of the above. For non-player targets, attachment data will be synchronized with all clients.

**NOTE**: for a user-defined condition, whether attachment data is synchronized with a client can change at runtime (e.g. "sync only with operators" when a player changes operator status). A specialized method to "refresh" data was considered, but in the end discarded due to complexity. It falls to individual mods to handle these edge cases.

AttachmentType also gets one new `isSynced` method to know whether a given attachment type can be synced.

## Usage

Here is how one could register an attachment for a "thirst" meter like mentioned above.
```java
public static final AttachmentType<Integer> THIRST = AttachmentRegistry.<Integer>builder()
    .initializer(() -> 20) // start with a default value like hunger
    .persistent(Codec.INT) // persist across restarts
    .syncWith(PacketCodecs.VAR_INT.cast(), AttachmentSyncPredicate.targetOnly()) // only the player's own client needs the value for rendering
    .buildAndRegister(Identifier.of("modid", "thirst"));
```
2024-11-12 18:29:14 +00:00
modmuss50
a9aef6a748 Bump version
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
2024-11-08 13:56:03 +00:00
modmuss
825023f82e
Fix crash when none player entities are flying with an elytra. (#4218)
Fixes #4217
2024-11-08 13:53:09 +00:00
modmuss
fd37071f8b
Update Loom and Loader (#4188)
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
2024-10-27 09:44:05 +00:00
modmuss50
e14d62e1c0 Bump version
Some checks are pending
Build / build (21-ubuntu) (push) Waiting to run
Build / client_test (push) Waiting to run
Build / server_test (push) Waiting to run
Build / check_resources (push) Waiting to run
2024-10-26 17:09:02 +01:00
apple502j
e82f21f7e9
Fix overriding vanilla translations (#4187) 2024-10-26 15:54:53 +01:00
modmuss
89cb0a4eef
Revert "Prevent vanilla clients from joining servers that require modded registry entries. (#4169)" (#4184)
This reverts commit 56ec7ac6d8.
2024-10-26 15:54:42 +01:00
Jason Penilla
4402f4ee73
Add ServerChunkEvents.Generate (#4183)
* Add a new chunk generate event, fired alongside the chunk load event when a chunk is first upgraded to full status

* fix style

* Add logging test for generate event

After creating an SP world and waiting for all nearby chunks to generate (logging to stop), closing the SP world and opening it again should not log any fresh generation. Moving to an unexplored area will start logging again.
2024-10-26 15:54:31 +01:00
Alexander01998
d21566ae3c
Optimize screenshot delays in automated client test (#4178)
* Optimize screenshot delays

I've done multiple test runs on GitHub Actions and this seems to be as low as the timings can go while still reliably generating all of the screenshots correctly.

* Increase wait interval in waitFor to 50ms
2024-10-26 15:54:20 +01:00
SemmieDev
6c3b5d4971
Remove LevelProperties check (#4171) 2024-10-26 15:54:12 +01:00
Fabric Bot
1ff58ec271 New Crowdin updates (#4167)
* New translations en_us.json (German)

* New translations en_us.json (Italian)

* New translations en_us.json (Russian)

* New translations en_us.json (Polish)

* New translations en_us.json (Russian)

* New translations en_us.json (Korean)

(cherry picked from commit 7fd48375f5)
2024-10-26 15:53:49 +01:00
forgetmenot13579
d9873d8b91 AttachmentType Registration Enhancements (#4109)
* - Add new method AttachmentRegistry#create that allows configuration of the registered attachment type with a builder.
- Migrate existing creation methods to use the new one under the hood for consistency.
- Moves all null checking from AttachmentRegistry to AttachmentRegistryImpl.BuilderImpl (most of them happened there as well already and were thus redundant).

* - Adds the ability to initialize an AttachmentType with only a path, substituting the mod ID of the registrant via an entrypoint.

* - Add registration safety checks

* - Add missing copyright header

* - Remove lazy entrypoint initialization of attachment types.

* - Import fixes

* - Update javadoc.

* - Use expression lambdas.

* - Fix style checks

* - More style fixes

* - Fix line endings

* - Move WheelInfo and initialization to test package
- Deprecate AttachmentRegistry#builder
- Update existing tests to use #create rather than #builder

(cherry picked from commit e49211d8c6)
2024-10-26 15:53:46 +01:00
modmuss50
8cb06cc20b Allow running on 1.21.3 2024-10-23 14:40:16 +01:00
modmuss50
d1d444eb26 1.21.3 2024-10-23 14:34:40 +01:00
modmuss50
3a1ceae83c 1.21.2-rc2
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
2024-10-21 18:45:26 +01:00
Alexander01998
2127dc72fe
Fix title screen screenshot in automated client test (#4177)
* Fix title screen screenshot

* Use accessor to detect when background fade is done
2024-10-21 18:36:57 +01:00
modmuss50
7d94de05ff Bump version
Some checks are pending
Build / build (21-ubuntu) (push) Waiting to run
Build / client_test (push) Waiting to run
Build / server_test (push) Waiting to run
Build / check_resources (push) Waiting to run
2024-10-21 10:21:52 +01:00
modmuss50
43607aea07 1.21.2-rc1 2024-10-21 09:51:32 +01:00
Reece Mackie
e7c9ab6617 fix: Add operator tab to common group list and filter for visible tabs in getPageCount. (#4172)
(cherry picked from commit 6823f7cd48)
2024-10-21 09:40:28 +01:00
modmuss
56ec7ac6d8
Prevent vanilla clients from joining servers that require modded registry entries. (#4169)
* Prevent vanilla clients from joining servers that require modded registry entries. (#3992)

* Prevent vanilla clients from joining servers that require modded registry entries

(cherry picked from commit 8759e7555a)

* Add related namespaces

---------

Co-authored-by: Patbox <39821509+Patbox@users.noreply.github.com>
2024-10-21 09:38:55 +01:00
modmuss50
625ef35355 Bump version
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
2024-10-15 15:21:18 +01:00
modmuss50
c47b9d4307 Update Fabric Loader 2024-10-15 15:12:08 +01:00
modmuss50
24b7f3d9df 1.21.2-pre4 2024-10-15 14:37:57 +01:00
BasiqueEvangelist
4054068033
Add support for Item-containing Items (#4083)
* first steps toward container item support

* add bundle support

* Update fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/impl/transfer/item/ContainerComponentStorage.java

Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>

* address reviews + TIL ContainerItemContext#find exists

* address reviews of bundle code

---------

Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>
2024-10-15 13:26:25 +01:00
IThundxr
448d83ec11 Add Stripped Logs and Stripped Woods Tags (#4146)
* Add Stripped Logs and Stripped Woods Tags

* run spotless

* Address review

(cherry picked from commit 83a9d3130d)
2024-10-15 13:24:28 +01:00
TelepathicGrunt
1e12ea3cc3 Add more c fluid tags (#4134)
* Add more `c` fluid tags

* fixed a javadoc

* Cleaned up javadoc

* checkstyle

* removed space

* Adjust experience rate to more reasonable amount

* explain perfect extractions

* fixed javadoc

(cherry picked from commit dde8f6bb9c)
2024-10-15 13:24:25 +01:00
Fabric Bot
a270feb749 New Crowdin updates (#4124)
* New translations en_us.json (Polish)

* New translations en_us.json (Italian)

* New translations en_us.json (German)

* New translations en_us.json (Japanese)

(cherry picked from commit 487ccc21c8)
2024-10-15 13:24:23 +01:00
Joseph T. McQuigg
73659e28fd Add Pie Item Tag c:foods/pie (#4114)
Co-authored-by: modmuss <modmuss50@gmail.com>
(cherry picked from commit 29d3a7035e)
2024-10-15 13:24:20 +01:00
apple502j
3a50c93c8a
Update EquipmentSlotProvider javadoc for 1.21.2 (#4166)
* Update EquipmentSlotProvider javadoc

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/EquipmentSlotProvider.java
2024-10-15 13:20:49 +01:00
modmuss
771b444bdf
Don't try to resolve the choice type for modded entities. (#4165) 2024-10-15 13:20:38 +01:00
Aaron
6e4c084dbc
Fix After Translucent Render Event (#4155) 2024-10-15 13:20:27 +01:00
modmuss50
118941c0e0 Update Loom
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
2024-10-11 20:19:05 +01:00
modmuss50
7413c625af Bump versions
Some checks are pending
Build / build (21-ubuntu) (push) Waiting to run
Build / client_test (push) Waiting to run
Build / server_test (push) Waiting to run
Build / check_resources (push) Waiting to run
2024-10-11 15:27:09 +01:00
modmuss
a7830493b1
Update to loom 1.8 (#4122)
* Trial loom 1.8

* Fix testmod jar classpath

* Update
2024-10-11 15:19:40 +01:00
modmuss
47870f2cfa
Add script to only enable a subset of projects to aid development (#4126) 2024-10-11 15:18:38 +01:00
modmuss
6eee591dd4
Rename CustomIngredient.getMatchingStacks & add CustomIngredient.toDisplay (#4152)
* Add CustomIngredient.toDisplay

* Imports

* Rename to match yarn.
2024-10-11 15:15:12 +01:00
modmuss
90e7264282
Don't sync recipe serialisers (#4156)
* Don't sync recipe serialisers

* Suppress error

* Actually fix...
2024-10-11 15:02:55 +01:00
modmuss
e618fefd93
Add mixin audit unit test (#4153)
This is useful when porting to a new version as you don't need to wait for the game to load to check for mixin errors.
2024-10-11 15:02:46 +01:00
haykam821
c811259261
Update mod to Minecraft 1.21.2 pre-release 3 (#4157) 2024-10-11 15:02:38 +01:00
modmuss50
344e05376f Update with pre2 access wideners
Some checks are pending
Build / build (21-ubuntu) (push) Waiting to run
Build / client_test (push) Waiting to run
Build / server_test (push) Waiting to run
Build / check_resources (push) Waiting to run
2024-10-10 15:37:07 +01:00
modmuss50
488720f071 1.21.2-pre2
Just mappings
2024-10-10 15:29:13 +01:00
haykam821
57632285fa
Update mod to Minecraft 1.21.2 pre-release 1 (#4148)
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
* Update mod to Minecraft 1.21.2 pre-release 1

* Bump version

---------

Co-authored-by: modmuss50 <modmuss50@gmail.com>
2024-10-08 18:00:08 +01:00
haykam821
86ae0e5586
Update mod to Minecraft snapshot 24w40a (#4136)
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
* Update mod to Minecraft snapshot 24w40a

* Bump versions

* Add new items to tags

* Add more missing boats

* Turns out they werent missing

---------

Co-authored-by: modmuss50 <modmuss50@gmail.com>
2024-10-02 20:44:30 +01:00
modmuss50
8b2c555745 Bump version
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
2024-09-26 09:23:36 +01:00
haykam821
7dcfcf9c76
Update to Minecraft snapshot 24w39a (#4121) 2024-09-26 09:06:22 +01:00
modmuss50
e1e5711a24 Bump version
Some checks failed
Build / build (21-ubuntu) (push) Has been cancelled
Build / client_test (push) Has been cancelled
Build / server_test (push) Has been cancelled
Build / check_resources (push) Has been cancelled
2024-09-23 19:29:04 +01:00
modmuss50
7076b16a70 Fix post merge issues 2024-09-23 19:15:30 +01:00
haykam821
d38542c645
Add fuel registry events (#4038)
* Add fuel registry events

* Allow removing individual items from fuel registry builders

* Expand fuel registry events test coverage

* Fix incorrect fuel registry documentation

* Review changes

* Use a context object

* Checkstyle

---------

Co-authored-by: modmuss50 <modmuss50@gmail.com>
2024-09-23 18:49:11 +01:00
haykam821
464f0e851d
Fix vanilla storage game tests being sensitive to rotation (#4108) 2024-09-23 18:48:10 +01:00