Commit graph

146 commits

Author SHA1 Message Date
modmuss
9468a19de0
Configure spotless for imports, sort imports. (#3365)
* Configure spotless to also do imports. Allows for auto applying.

* Order imports
2023-10-22 13:35:58 +01:00
modmuss50
10292b95f5 23w40a 2023-10-05 09:45:32 +01:00
apple502j
34a3e0e2cb
Include namespace in modded registry tag path (#3303)
* Include namespace in modded registry tag path

* Document tag namespace change
2023-09-07 15:09:08 +01:00
modmuss50
f091af96c5 23w33a 2023-08-17 16:51:04 +01:00
modmuss50
09816d0313 Fix createAndPopulateRegistryMap() always returning null, preventing registry sync.
This was caused by the changes in the port to 23w32a
2023-08-11 12:14:20 +01:00
modmuss50
0ba8e9ce03 23w32a 2023-08-09 18:04:04 +01:00
modmuss
0b2eb405dc
[1.20.2] Support common registration packets. Add configuration task API (#3244)
* Config networking refactor :)

* Add some unit tests for common packets.

* write FabricPacket on network thread.
Split ServerConfigurationConnectionEvents into two.

* Fixes

* Rename event

* Add a testmod + ssome docs

* Improve registry sync fixing deadlock in a number of cases.

* Cleanup channel events.

* Review feedback and fixes.
2023-08-09 16:30:51 +01:00
modmuss
86b12645b9
23w31a 2023-08-07 09:09:38 +01:00
modmuss
f4b7e42468
Update to loom 1.3 and use Mod Publish Plugin (#3158)
* Update to loom 1.3

* Fix more 1.3 deprecations

* Opps

* Move to mod publish plugin

* Revert some changes

* Fix some more Gradle deprecations

* Fix names

* Remove extra stuff

* Cleanup
2023-08-02 18:51:21 +01:00
modmuss
4df89eb2a6
Fix #3215 - Only add namespace to registries added using the Fabric API. (#3219)
* Fix #3215 - Only add namespace to registries added using the Fabric API.

* Cleanup
2023-07-25 14:03:45 +01:00
Juuz
2e061fd481
Add dynamic registry API (#3163)
* Add API for adding custom dynamic registries

Closes #1012, supersedes #1031 and #2719.

* Add missing license headers

* Clarify RegistryLoaderMixin namespace injection

* Replace event with static registration, add skeleton for sorting registries

* Fix typo

* Refactor event phase sorting system for use with dynamic registries (#1)

* Make minor changes to Technici4n's PR

* Add test for nested dynamic objects

* Revert "Add test for nested dynamic objects"

This reverts commit 486e3e1ce0.

* Revert "Make minor changes to Technici4n's PR"

This reverts commit 741bd52c1e.

* Revert "Refactor event phase sorting system for use with dynamic registries (#1)"

This reverts commit bb7c8b8790.

* Remove sorting API

* Add support for defaulted dynamic registries

* Re-add test for nested dynamic objects

* Add missing license headers

* Fix typo

* Remove defaulted dynamic registries; flatten registration methods

* Remove last reference to registry sorting

* Add option to skip syncing for empty dynregs

* Update DynamicRegistrySyncOption docs

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

* Address review feedback

* Add registry namespace to tag paths for modded registries

* Move dynamic registry tests into their own class for readibility

* Finish DynamicRegistries doc

* Only apply tag change to dynamic registries

* Fix checkstyle

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

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

---------

Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>
2023-07-18 12:53:34 +01:00
modmuss
b3afc78b68
Setup unit tests & format gradle files. (#3073) 2023-05-30 13:07:11 +01:00
modmuss50
4d8536c91f
Add and test for missing method overrides in FabricBlockSettings (#3056) 2023-05-11 09:25:08 +01:00
modmuss50
ce75acf5fd
[1.20] Remove deprecated NbtRegistryPacketHandler (#3026)
* Remove deprecated NbtRegistryPacketHandler

* Remove more
2023-05-01 13:55:38 +01:00
modmuss50
b3f2574b16 23w17a 2023-04-26 18:18:06 +01:00
modmuss50
10328404b3 Improve missing local registry entries error message. (#3004) 2023-04-23 13:29:02 +01:00
modmuss50
eff26386be
23w16a (#3018)
# Breaking changes
- `VillagerPlantableRegistry` replaced with `ItemTags.VILLAGER_PLANTABLE_SEEDS`
- `FabricItemGroup.builder()` no longer takes an `Identifier`
- `FabricItemGroup.build()` no longer registers the ItemGroup, this now needs to go in the vanilla registry.
- `ItemGroupEvents.modifyEntriesEvent` now takes a `RegistryKey<ItemGroup>` in place of an `Identifier`
- `FabricLanguageProvider` now takes a `RegistryKey<ItemGroup>` in place of an `ItemGroup`
- `IdentifiableItemGroup` removed, replaced with vanilla registries.
- `FabricMaterialBuilder` removed, no replacement.
- `HudRenderCallback.onHudRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `ScreenEvents.beforeRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `ScreenEvents.afterRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `Screens.getItemRenderer()` removed. Replace with `MinecraftClient.getItemRenderer()`

`DrawableHelper` is likely to be renamed soon, see: https://github.com/FabricMC/yarn/pull/3548/
2023-04-20 20:03:32 +01:00
modmuss50
a383ab9763 Support creating FabricRegistryBuilder with a RegistryKey, deprecate Class based APIs. (#2905)
* Fix #846

* Update javadoc.

(cherry picked from commit f7b4d36421)
2023-02-23 10:15:09 +00:00
modmuss50
ae0966baae
Fix all valid Mixin AP warnings. (#2914) 2023-02-22 12:54:50 +00:00
modmuss50
a1ccd7bfed 23w04a 2023-01-24 16:59:43 +00:00
modmuss50
b69ba7fabe
23w03a (#2854)
* First look at 223w03a

* Fix login

* Support onboarding screen in client tests

* Fix AFTER_ENTITY_CHANGE_WORLD event

* Bump version
2023-01-18 21:21:41 +00:00
Technici4n
1134c5b850
Remove leftover @ApiStatus.Internal annotations and add annotation validation (#2825)
* Remove leftover `@ApiStatus.Internal` annotations and add annotation validation

* Simplify

* Simplify more

* Update gradle/validate-annotations.gradle

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
2023-01-05 12:50:15 +00:00
apple502j
2608564621
Pass DynamicRegistryView to DynamicRegistrySetupCallback (#2696)
* Pass DynamicRegistryView to DynamicRegistrySetupCallback

* Update fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/DynamicRegistryViewImpl.java

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
2022-11-26 20:00:04 +00:00
modmuss50
2894d6df22 1.19.3-pre1 2022-11-22 16:28:48 +00:00
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