* Deprecate FabricBlockSettings
* Deprecate FabricItemSettings
* Start on 24w03a
* Main menu :)
* Update mappings
* PayloadTypeRegistry
* Networking part 2 of many
* Networking part 3 of many
* Networking part 4 of many
* Recipe api
* Port Item API to 1.20.5
* Is this even right?
* Port FabricParticleTypes to 1.20.5
* Remove redundant fuel caching logic
* Remove fabric-containers-v0, deprecated since 2020
* Regsync work
* Adapt screen handler to new networking
* Update yarn + more work
* More mapping updates
* Compile fixes
* Checkstyle + small fixes
* Single and multiplayer fixes
* Handle play packets on main thread.
* Update mappings
* Even more networking
* Networking tests
* Fix todo's
* Update javadocs
* Networking API improvements
* Some small regsync refactors
* Fix handling of null NBT in NbtIngredient
* Update fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java
Co-authored-by: ErrorCraft <51973682+ErrorCraft@users.noreply.github.com>
* Update fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java
Co-authored-by: ErrorCraft <51973682+ErrorCraft@users.noreply.github.com>
* Add context objects
* ChannelInfoHolder.getPendingChannelsNames -> fabric_getPendingChannelsNames
* Fix crash
* send `c:register` packet for play phase instead of config (#3544)
* Bump version
---------
Co-authored-by: ErrorCraft <51973682+ErrorCraft@users.noreply.github.com>
Co-authored-by: apple502j <33279053+apple502j@users.noreply.github.com>
Co-authored-by: Drex <nicknamedrex@gmail.com>
Co-authored-by: deirn <deirn@bai.lol>
Breaking changes:
- `FabricBrewingRecipeRegistry.registerPotionRecipe` takes `RegistryEntry<Potion>` instead of `Potion`
- `SculkSensorFrequencyRegistry.regster` takes `RegistryKey<GameEvent>` instead of `GameEvent`
- `FabricLanguageProvider.add` takes `RegistryEntry<EntityAttribute>` instead of `EntityAttribute`
- `FabricTagProvider.GameEventTagProvider` was removed replace with `FabricTagProvider<GameEvent>`
- `FabricItem.getAttributeModifiers` returns a Multimap with a key of `RegistryEntry<EntityAttribute>` instead of `EntityAttribute`
- `ModifyItemAttributeModifiersCallback.modifyAttributeModifiers` takes Multimap with a key of `RegistryEntry<EntityAttribute>` instead of `EntityAttribute`
* 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
This PR deprecates and supersedes the old `fabric-models-v0` module.
## Refactors compared to v0
### Model loading hooks
Mods now register a single `ModelLoadingPlugin` for any change they want to make to the model loading process. (Or multiple plugins if they want to). This replaces the old `ModelLoadingRegistry`.
Here is an example:
```java
ModelLoadingPlugin.register(pluginContext -> {
// ResourceManager access is provided like in the v0 API, but in a central place, and can be used for shared processing in the plugin.
ResourceManager manager = pluginContext.resourceManager();
// Model resource providers still exist, but they are called model resolvers now
pluginContext.resolveModel().register(context -> {
// ...
});
});
```
#### `ModelVariantProvider` -> `BlockStateResolver`
`ModelVariantProvider` was heavily reworked, and is now replaced by the `BlockStateResolver`, with a much better defined contract.
#### `ModelResourceProvider` -> `ModelResolver`
The resource provider is mostly unchanged. The biggest difference is that it is now registered as an event listener. This allows mods to use event phases for ordering between conflicting ~~providers~~ resolvers.
#### Removed custom exception
Additionally, `ModelProviderException` could be thrown by a variant or resource provider in the v0 API. This was not explained in the documentation, and would according to the code stop further processing of the providers and log an error.
In the new API, any `Exception` is caught and logged. If that happens, the other resolvers are still processed. There is no custom `Exception` subclass anymore.
### Helper method to get a `BakedModel` by `Identifier` from the manager
The v0 had such a method in a helper class: `BakedModelManagerHelper#getBakedModel`. It is now interface-injected instead. See `FabricBakedModelManager`.
## New model wrapping hooks
New hooks are added for the various needs of mods that want to override or wrap specific models. Thanks to @embeddedt for contributing an initial version of them!
Here is an example of wrapping the gold model to remove the bottom quads, for example:
```java
ModelLoadingPlugin.register(pluginContext -> {
// remove bottom face of gold blocks
pluginContext.modifyModelAfterBake().register(ModelModifier.WRAP_PHASE, (model, context) -> {
if (context.identifier().getPath().equals("block/gold_block")) {
return new DownQuadRemovingModel(model);
} else {
return model;
}
});
});
```
There are 3 events, for the following use cases:
- Wrapping `UnbakedModel`s right when they are loaded. This allows replacing them entirely in dependent models too.
- Wrapping `UnbakedModel`s right before they are baked. This allows replacing them without affecting dependent models (which might not be expecting a model class change).
- Wrapping `BakedModel`s right when they are baked.
Multiple mods have implemented their own version of them. Providing them in Fabric API will make it easier on these mods, and will additionally allow optimization mods that perform on-demand model loading to simply fire the hooks themselves instead of working around injections performed by other mods.
Co-authored-by: embeddedt <42941056+embeddedt@users.noreply.github.com>
Co-authored-by: PepperCode1 <44146161+PepperCode1@users.noreply.github.com>
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
* 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)
- Deprecates all classes and methods that use outdated Yarn names.
- Adds FabricLootTable and FabricLootTableBuilder to replace
the LootSupplier naming variants.
- Deprecates LootEntryTypeRegistry and LootJsonParser
as their functionality is exposed in vanilla now.
- Adds methods to FabricLootPoolBuilder for working
with collections as builder parameters.
- FabricLootPool and FabricLootTable/Supplier now return immutable lists
instead of modifiable fixed-size ones.
Co-authored-by: i509VCB <i509vcb@gmail.com>
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.
* Update command registration API to reflect vanilla changes
* Allow module versions in impl+mixin packages
* Use v2 module, keeping v1 for server commands at least
* update, address review
Co-authored-by: modmuss50 <modmuss50@gmail.com>
* Move deprecated modules to a sub directory.
Remove deprecated modules from the default maven pom
Create a new "fabric-api-legacy" bom with the deprecated modules.
* Fix main "fabric" project not beign a dep for the legacy bom.
* rename artifact to fabric-api-deprecated
* Spotless
* Use the latest version of spotless.