Commit graph

172 commits

Author SHA1 Message Date
modmuss50
b83334a063 Split all duplicated packages (#2617)
* Move duplicated v0/v1 impl packages to v0 subpackages

Fixes #2616. The convention is adopted from the command API (v1)
whose impl classes have the v1 subpackage.

* Separate client code into its own packages everywhere

* Fix code style

* Fix code style, part 2

* Allow v0 in package names

* Allow v0 in package names (fixed)

(cherry picked from commit 9244241639)
2022-11-20 13:58:41 +00:00
modmuss50
49abcf7e64 Update mappings 2022-11-16 16:12:51 +00:00
modmuss50
f84bf2d968
22w45a (#2647) 2022-11-10 16:07:38 +00:00
modmuss50
f75bcd18f3
22w44a (#2632)
Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com>
2022-11-03 13:48:27 +00:00
apple502j
33c37e23ce
22w42a RegSync changes (#2608)
* Fix DynamicRegistrySetupCallback, add EndDynamicRegistrySetupCallback

`DynamicRegistrySetupCallback` did not work as intended because the injection
was too late. This moves the injection point to `RegistryLoader`, just before it
is loaded.

`EndDynamicRegistrySetupCallback` is a new event triggered when the loading is
finished. This has access to the combined DRM, allowing context-aware modification.

This also replaces `System.out.println` use in testmod.

* Remove useless force-init of BiomeKeys

* Remove now-unnecessary DynamicRegistryManagerMixin

* Fix crash in testmod

This caveat needs proper documentation.

* Add note to javadoc

* Mark impl as internal

* Remove EndDynamicRegistrySetupCallback

* Fix testmod checkstyle issues

* Add automated event call check

* Fix test

* Update javadoc

* Add `@see`

* Re-run actions
2022-10-28 18:24:56 +01:00
modmuss50
75e98211bd
22w42a 🐫 (#2599)
Co-authored-by: shartte <shartte@users.noreply.github.com>
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
2022-10-22 20:38:33 +01:00
modmuss50
c6af733cfb
Cleanup incorrect mixin shadow annotations/access 2022-09-25 14:46:29 +01:00
Benonardo
726b65209a
Fix crash when replacing SimpleRegistry contents (#2504)
* Fix crash when replacing SimpleRegistry contents

* Called .value() two more times
2022-09-11 14:16:32 +01:00
modmuss50
aeb40ebeab
Rename and validate Mixin class names. (#2450)
And update loom.
2022-08-15 18:59:19 +01:00
apple502j
23c4cfef68
Fix registry sync namespace check (#2356)
* Fix registry sync namespace check

* Remove bad test.

* Fix wrong comment

Co-authored-by: modmuss50 <modmuss50@gmail.com>
2022-06-23 20:16:58 +01:00
modmuss50
92cf9a3ec2
Sync new 1.19 registries as required. Closes #2205 (#2247)
* Sync new 1.19 registries as required. Closes #2205

* Comment fixes.
2022-05-24 15:04:15 +01:00
modmuss50
9ff28f4026
Split client only code into its own sourceset. (#2179)
A common source of crashes on modded Minecraft servers comes from modders accidently calling client only code from the client, this PR is another large step towards elimitating that.

This PR has been months in the making and years in the planning, requiring major changes to Loom & Loader. In recent Minecraft versions Mojang has made it easier than ever to cleanly split the jar, going against the status-quo of merging the client and server into one jar.

From the start we have designed Fabric to have a very clear split between client and common (client & server) code. Fabric has always encoraged keeping client only code seprate from the server, this can be seen at a fundamental level with the entrypoints in Loader. Fabric API's have all been designed with this mind.

This PR provides a compile safety net around Fabric API using client only code on the server. Even though there are almost 400 changed files, minimal changes beyond moving the files were required to achieve this in Fabric API, thanks to the effort of all contributors in the past.

These changes should not affect modders or players in anyway, a single "universal" jar is still produced. Im happy to awnswer any questions.
2022-05-21 16:26:46 +01:00
modmuss50
56447d9b95 22w17a 2022-04-27 20:48:57 +01:00
modmuss50
ec94c6f636
22w16b
Co-authored-by: Player <player@player.to>
2022-04-20 22:22:10 +01:00
Player
c8c49daef7 Update mappings 2022-03-23 01:15:45 +01:00
modmuss50
0d9ab37284
Fix a vanilla bug causing missing structures to reset chunks when upgrading a world from previous versions. (#2045) 2022-03-05 18:10:57 +00:00
modmuss50
ca4be9c944
Fix MC-197259 - Modded blocks not present in debug world type. (#2037)
Closes #2031

* Fix MC-197259 - Modded blocks not present in debug world type.

* Remove un-used method.
2022-03-03 18:17:21 +00:00
modmuss50
55dca1a4f3 Update mappings. 2022-02-16 18:14:59 +00:00
modmuss50
682a9b7c63 Fix crash when remapping registries with unused raw ids. 2022-02-11 18:14:32 +00:00
modmuss50
d882b91555
Port to 22w06a (#1989)
This snapshot is possibly one of the most impactful for API we have ever had. This PR is an inital port to support 22w06a, stuff will be missing and broken. 

# Removed modules:
- fabric-mining-levels-v0 - Previously deprecated
- fabric-object-builders-v0 - Previously deprecated
- fabric-tag-extensions-v0
- fabric-tool-attribute-api-v1

# Modules with API breaking changes:
- fabric-biome-api-v1
- fabric-content-registries-v0
- fabric-data-generation-api-v1
- fabric-mining-level-api-v1
- fabric-object-builder-api-v1
- fabric-resource-conditions-api-v1
- fabric-structure-api-v1

# Impactful API changes:
### fabric-object-builder-api-v1
- Removed - FabricBlockSettings.breakByHand
- Removed - FabricBlockSettings.breakByTool  - Previously deprecated

# Notable changes

- fabric-registry-sync-v0 moves vanilla's new registry freezing to a later point in time, allowing mods to add to the registry during init.

# Known issues:
- ServerBugfixMixin used to fix https://bugs.mojang.com/browse/MC-195468 has not yet been ported.
2022-02-11 17:02:44 +00:00
modmuss50
4ebd8b2d9f Reduce log level for message logged when a vanilla or outdated api client joins. 2022-02-02 18:50:34 +00:00
modmuss50
d7c144a830
Migrate to SLF4j and update loom (#1960)
* Migrate to SLF4j and update loom

* Update loom

* Update to latest loom
2022-01-30 21:37:23 +00:00
deirn
befed49ea3 Registry sync packet compression II (#1853)
* Optimize registry sync packet

* Make sure that the id map is sorted by the raw id
Send the difference of the first raw id and the last raw id from the bulk before

* Add packet size log prints

* Use Boolean.getBoolean
Don't send sync packet if the player is the server host

* Use generic Map

* Multiple raw id bulk test

* Group object namespace first before grouping raw ids

* Revert "Add packet size log prints"

This reverts commit fcb8b71e

* RegistrySyncPacket -> RegistryPacketSerializer
Move RegistryPacketSerializer singleton to the interface

* Packet size log prints

* Sort raw id on each namespace group

* Use Identifier.DEFAULT_NAMESPACE

* Slice to multiple packet if necessary

* Make MAX_PAYLOAD_SIZE configurable
Make testmod registry bigger
Print buffer size in equality test

* Move static packet handler instance to RegistrySyncManager
Release combinedBuf before discarding it
Discard syncedRegistryMap after it's accessed

* Use PacketByteBufs to create buffers
2022-01-02 19:36:03 +00:00
shartte
533be9ba91
Fixes #1921: Synchronize BlockEntityType to the client since mods use the Vanilla mechanism for block entity updates since 1.18. (#1923) 2021-12-22 17:08:02 +00:00
Player
3ac43d9577 Revert Mixin compatibilityLevel bump, bump versions 2021-11-17 03:29:11 +01:00
modmuss50
e77d3ea62f 1.18-pre2 & Java 17 2021-11-16 18:41:10 +00:00
modmuss50
b4f4f6cda4 Update Loom and Loader. Cleanup/improve buildscript. 2021-11-12 15:02:54 +00:00
modmuss50
2e160e0f26 1.18-pre1: without the biome api 2021-11-11 19:01:49 +00:00
modmuss50
65d505fc8a Bump versions
All of the version need to be bumped due to fabric-api-base being updated, this highlights the need for a better solution.
2021-11-05 17:09:48 +00:00
modmuss50
01912dd2c6 Fix Registry.GAME_EVENT not being synced. 2021-10-19 16:56:43 +01:00
modmuss50
bb09662468 21w41a
Remove SurfaceBuilder related APIs.

Remove PersistentDynamicRegistryHandler as the bug (MC-202036) it fixed was fixed a few weeks ago.
2021-10-13 18:55:15 +01:00
modmuss50
c683a6555f Bump version 2021-10-07 13:02:52 +01:00
BasiqueEvangelist
21f792c9f8 Fix handling of orphaned registry entries (#1759)
* Fix handling of orphaned registry entries

* Fix handling of orphaned registry entries in RegistrySyncManager
2021-10-07 12:29:04 +01:00
modmuss50
6eb8b35a31 21w39a 2021-09-29 20:03:16 +01:00
modmuss50
8f2c3e04fb Bump version 2021-09-21 11:41:06 +01:00
shartte
d7a7efac01
Fix running game tests / build [1.18] (#1731)
* Fix running game tests.

* Fix dimension api bugfix mixin. Of note: The Vanilla bug is still present, and the bugfix still needed.

* Fix references to unmatched RegistryOps method.
2021-09-17 23:32:44 +01:00
modmuss50
5553aff888 21w37a: Compile pass 2021-09-17 18:42:42 +01:00
modmuss50
e2961fee74 Fix datapack driven worldgen not working on dedicated servers. Closes #1478 2021-06-13 00:50:44 +01:00
modmuss50
a02b4463f9 21w19a 2021-05-12 20:23:04 +01:00
modmuss50
f08a69e19f 21w18a 2021-05-05 19:53:16 +01:00
modmuss50
413ddf6456 21w14a - Mappings update 2021-04-07 18:46:09 +01:00
modmuss50
23b3c92ea9 21w13a 2021-03-31 20:52:51 +01:00
modmuss50
03bff30f22 21w11a 2021-03-17 19:14:28 +00:00
modmuss50
92519afafe Version bump 2021-01-19 19:38:22 +00:00
i509VCB
f8cf2bb436 Add custom value denoting module lifecycles. (#1253)
* Add custom value denoting module lifecycles.

* Make the module validation work.

My hand has been forced - we must use buildSrc since JsonSlurper is not available in main buildscript.

* Apply task to each project and dont cross projects

* A horrible hack

* Wait what

* It works now.

* Not needed

* Drop unneeded maven repo, cache map lookup

(cherry picked from commit daa38b3d82)
2021-01-19 18:54:23 +00:00
modmuss50
836e66a3f5 Fix build.
Opps ;)
2020-12-16 19:13:16 +00:00
modmuss50
1a369faf20 20w51a 2020-12-16 19:06:02 +00:00
modmuss50
d591fc0a7e Bump version 2020-12-12 16:49:45 +00:00
modmuss50
bb826c2c5b Fix registry sync being applied when its not supposed to be.
Fixes #1217
Fixes #1216
2020-12-12 16:48:39 +00:00
modmuss50
bee3a886d0 Bump version 2020-12-10 18:34:17 +00:00
i509VCB
fd11873744 Fabric Networking API V1 (#1081)
* Networking api v1

Some final docs?

Licenses and testmod

Fix a bunch o imports and make things work for v1 (v0 is bork)

Make the testmod pass checkstyle and work

Docs for v1

* Deprecate v0 and implement using v1

* Drop files down one package due to package check error

* Fix issue with channel registration, add another testmod

* jaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaavadoc

* Make javadoc use `code`, move impl interface to package access

* this things

* Rename a few internal methods

* Mark all client side stuff client only, move client mixins

* Add null checks around the place, clarify some javadoc and method names

* Make FutureListeners uninstantiable

* Some internal nullable annotations

* An impl class I forgot to rename

* Some comments and clarify some client login handler javadoc

* Add a missing FunctionalInterface annotation

* Split play and login, move client stuff to right package

* No interface left behind

* Inline channel registries in api

* Login and play subpackages not needed

* Add helper method to create play custom packets

* hasGlobalChannel -> hasGlobalReceiver

* Just rename the collection method for now

* Inline PlayPacketSender into static methods

* Start on testmod idea for verifying dynamic registration

* Add client login events

* You don't say hello when talking to yourself.

Also more testmod stuff

* Make event names present tense

* Some javadoc and impl interface rename

* Change the test keybinding

* Begin working on dynamic reg

* Dynamic reg works, just need a lot of cleanup and reimpling global

* A few renames, readd global methods

* Try to reduce the amount of duplicate registration logic

* Reimplement dynamic accessors

* More impl

* Start reimplementing global receivers. Still very hacky solution.

* Reimplement some server global reciever stuff

* Add login init event for server login.

* Implement client login query start event

* Move event invocations into addon, don't dual register global recievers

* Finally reimplement global recievers for all networking phases

* A revelation: Send packets properly

This also finds the issue with screen getting the proper S2C channels, current on TODO list.

* Disconnect event does not need a packet sender

* Clarify, add methods to get channels net handler can recieve on client

* Unregister actually works now

* Bunch of null checks, add simpler login delay test for vanilla clients

* Add some debug logging entries, fix unregister on client's session reg

* Play channel event javadoc and rename login query handlers

* More channel -> channelName

* thisening

* Introduce the basics infrastructure for tracking global receivers

* Add more substantial javadoc to login connection events

* Javadoc, reimplement unreg methods on v0, 1 impl fix

* Implement tracking for global recievers

* Dont forget to start tracked sessions in 3/4 cases

* Global receiver docs and move methods in classes

* Complete null checks

* big boi javadoc part 1

* Finish the main javadoc, usage javadoc is left

* Set so has method is not needed

* Rename receiveable and sendable methods

* Add the two missing private ctors

* buildscript update to upstream

* Split out player finding stuff to networking player tracking API v1

Signed-off-by: liach <liach@users.noreply.github.com>

Forward v0 PlayerStream to new module, add entity track events

Rename module to player tracking

Well javadoc can make sense

Decide on tracking for the name

Update fabric-player-tracking-api-v1/src/main/java/net/fabricmc/fabric/api/networking/player/tracking/v1/package-info.java

Co-authored-by: Erlend Åmdal <erlend@aamdal.com>
Remove exceptions from javadoc that are not thrown

javadoc fix again

Handle a case where the player manager happens to be null

rename player tracking to player lookup

Yeet

* Cherrypick #1092

* Remove some redundant client networking methods, rename `(un)register` to `(un)registerReceiver`

* Simplify access to dynamic reg on client

* Param shifting, let users get sender.

* Warning about time and distance units

* Make sure these are client only

* Fix control flow in ClientPlayNetworking#send

* Correct example code javadoc

* javadoc correction in server login

* Put login delay tests behind system property

Also remove unnecessary junk added by old module that was merged together.

* Fix ordering so channel registrations during `PHASE`_INIT work

* Fix prod bug and an oversight

* Fix login when connecting to dedicated server

* Update registry sync to v0 to prevent issue with reg sync hanging client

* this is done
2020-12-09 18:49:22 +00:00
modmuss50
18e7e5e181 Bump version 2020-11-24 19:54:57 +00:00
modmuss50
1fec9da3c8 Assign a new ID to client only registry entries when syncing. (#1179)
* Assign a new ID to client only registry entries when syncing.

Fixes #1165

* Cleanup + review comments
2020-11-24 19:52:26 +00:00
modmuss50
d7dacf3db0 Bump version 2020-11-21 18:53:21 +00:00
modmuss50
16a3a4a49a Fix MC-202036 - Shifting biome IDs (#1168)
* First pass on PersistentDynamicRegistryHandler, not tested

* Extra debugging + fix it not working

* Fix build

* Minor tweaks

* checkstyle ;)

* Improve comments + fix issues with tag reading/writing

* Simplify mixin
2020-11-21 18:50:12 +00:00
Thalia Nero
9f7a7423f3 Add module dependencies to maven POM (#1104) 2020-11-15 19:46:01 +00:00
modmuss50
a4467d2a9c Bump version 2020-10-27 18:36:48 +00:00
i509VCB
eacb8ba396
Update yarn mappings (#1127) 2020-10-22 18:54:44 +01:00
modmuss50
9f0fb4b8a2 Bump version 2020-10-11 21:18:28 +01:00
CheaterCodes
888073d094 renamed event method 2020-10-01 23:37:40 +02:00
CheaterCodes
811b763fc3 removed redundant supressions 2020-10-01 22:58:14 +02:00
CheaterCodes
bf575bf013
Merge branch '1.16' into dynregman 2020-10-01 22:54:51 +02:00
modmuss50
3c53fe33fe Version bump 2020-09-29 18:55:16 +01:00
shartte
ff71903321
Cleaned up use of Generics in registry-sync-v0 and used Registry#getKey where possible instead of reverse-lookup of the registry key. (#1082) 2020-09-29 18:48:23 +01:00
modmuss50
f8ac1db2b1 Version bump 2020-09-27 12:38:48 +01:00
Deximus-Maximus
5f10696617
Add @Nullable and friends (#1007)
* Boost to Loom 0.5
Add null related annotations

* Rearrange nullable to be overline

* Fix anno sorting for picky

* Add imports

* Address feedback

* Fix import
2020-09-27 12:10:02 +01:00
modmuss50
c1aa8ed8d7 Version Bump 2020-09-18 18:48:09 +01:00
shartte
7490af87a1
Make BuiltInRegistries safe for Worldgen Registration during Mod Initialization (#1052)
* Adds a synchronisation for entries in BuiltInRegistries to the built-in DynamicRegistryManager, to a void class-loading DynamicRegistryManager during Mod initialization from messing up the Worldgen registrations of subsequently loaded mods.

* Changed to use updated Yarn mappings.
2020-09-18 18:10:47 +01:00
CheaterCodes
002bec9c05 updated mixin for new mappings 2020-09-13 13:17:51 +02:00
CheaterCodes
ea60ad8ae6 Changed the event to a more generic one 2020-09-13 13:04:59 +02:00
CheaterCodes
1d8aa64520 Fixed some generics 2020-09-13 13:04:16 +02:00
CheaterCodes
7953e09bd8 bumbed loader version, finalized DynamicRegistryEvents 2020-09-13 13:03:53 +02:00
CheaterCodes
a46b0be60a Added DynamicRegistryEntryAddedCallback 2020-09-13 13:03:53 +02:00
CheaterCodes
a0c9b80ef4 Added some javadoc and the license header 2020-09-13 13:02:21 +02:00
CheaterCodes
5610e94af4 Changed the event to a more generic one 2020-09-13 13:02:21 +02:00
CheaterCodes
1e30c89370 Fixed some generics 2020-09-13 13:02:21 +02:00
CheaterCodes
e5def8e7eb bumbed loader version, finalized DynamicRegistryEvents 2020-09-13 13:02:21 +02:00
CheaterCodes
e9c7de9661 Added DynamicRegistryEntryAddedCallback 2020-09-13 13:02:21 +02:00
modmuss50
fcdfdfa1c7 Fix server crash, closes #1058 2020-09-03 23:44:31 +01:00
modmuss50
fb0d9b0e7d Update mappings 2020-09-03 20:39:05 +01:00
modmuss50
e5d3217f0d Mappings update 2020-08-11 17:42:40 +01:00
modmuss50
91555cd1f0 1.16.2-pre2 - no biomes for now 2020-08-05 20:00:37 +01:00
modmuss50
847665c2f2 Fix crash when remapping registries. Closes #967 2020-07-29 20:16:13 +01:00
modmuss50
bf0e62bd42 1.16.2-pre1 2020-07-29 16:52:10 +01:00
modmuss50
5553fa5856 20w29a 2020-07-15 17:20:11 +01:00
modmuss50
35e08e3387 20w28a - no biomes or dimensions 2020-07-08 19:31:01 +01:00
modmuss50
7dba2d6c01 1.16-pre4 - just a mapping change. 2020-06-11 18:30:44 +01:00
modmuss50
059ea866ec update mappings 2020-06-09 22:29:07 +01:00
modmuss50
8779c4a30c Change log level or orphaned registry output 2020-06-05 15:33:41 +01:00
modmuss50
dd263cca8b
Fix some known issues with the registry sync module. (#525)
* Try to detect if a registry is modded, if its not it will left alone and no syncing or saving will take place.

* Some more work on moddable registries

* Checkstyle

* Fix licences

* Cleanup registry attributes

* Rework again

* Some small tweaks

* Yet another refactor

* Some minor style fixes

* Finish checking registries

* Start on a test mod, and apply some fixes.

* Checkstyle fixes

* Tweak the logic behind previously modded registries

* Use EnumSet

* Update fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/mixin/registry/sync/MixinRegistry.java

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Fix generics, add javadoc, add tests

* More changes

* Checkstyle fixes

* Minor fixes

* Remove hash stuff

* 20w21a - massive changes

* fix build

* Update fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/api/event/registry/FabricRegistryBuilder.java

Co-authored-by: Joseph Burton <burtonjae@hotmail.co.uk>

* Feedback and update mappings

* No longer apply mappings to vanilla registries, no longer save empty mapping data.

* Use Identifier in FabricRegistryBuilder over RegistryKey
Improve empty registry tag handling

* Reorder toTag empty checks

* Minor fixes

* Make FabricRegistryBuilder final

* Update registry attributes

* Fix compile issue

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: Joseph Burton <burtonjae@hotmail.co.uk>
Co-authored-by: Player <player@player.to>
2020-06-04 21:33:56 +01:00
modmuss50
346247d7d1 Checkstyle 2020-06-04 21:24:25 +01:00
modmuss50
0d474ec430 1.16-pre1 2020-06-04 21:20:20 +01:00
modmuss50
da175ad6ad 20w22a 2020-05-29 15:56:10 +01:00
modmuss50
4a08d6b285 20w21a initial port 2020-05-20 19:39:37 +01:00
modmuss50
d1e1b46ce9 Remove call to initShapeCache when registering blocks.
At some point in the 1.16 update cycle this was moved to be called after tags are (re)loaded and not when blocks are being registered.
2020-05-07 13:52:28 +01:00
modmuss50
686e6e57ad 20w18a 2020-04-29 17:49:19 +01:00
modmuss50
2fd224ca63 20w17a 2020-04-22 17:59:17 +01:00
modmuss50
eb276f9cfc 20w16a 2020-04-15 16:42:48 +01:00
modmuss50
372d827d5a 20w13a 2020-03-25 18:20:06 +00:00
modmuss50
d249f7b6d6 20w12a 2020-03-18 20:05:01 +00:00