* 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>
* Add block appearance API
* Add class javadoc for FabricBlock and FabricBlockState
* Address reviews
* Remove OverrideOnly from getAppearance
* Fix javadoc issues
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.
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.
* fix#1273
* Expand testmod to test multipart and weighted models with FRAPI submodels
Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>
* Fix#987, simplify geometry tracking, clean up scoping
* Bump indigo version
* Expose improved fromVanilla method
* Strip deprecations in non-API components
* bump renderer api version
* Clear tag for converted quads
Otherwise possible for tags added by transforms to pollute subsequent quads
* Borrow from Canvas - don't set nominal face twice, prevent header state leakage
This was done to keep mod compat and will be removed very shortly. I dont think they were used by many mods (only added in a recent 1.16 snapshot) so I think this is the best course of action.
* Fix EntityRenderDispatcher hook (again)
* Add fabric-particles-v1
* Add a sync() method to BlockEntityClientSerializable
* Prevent CME due to off-thread block entity updates (#367)
* Restore rendering features disabled in first 19w39a release
* Remove rendering stuffs no longer needed due to snapshots
* Bump versions as needed
* 19w39a fixes (#387)
* Bump versions
* Breaks: BlockEntityRendererRegistry and EntityRendererRegistry
* Remove broken parts of rendering, bump major version
* Add renderer-registries, replaces broken parts of rendering api
* Slap a band-aid on renderer/Indigo - won't render properly, but runs
* Bump distribution versions, add renderer-registries to main build
* Clean up blockrenderlayer implementation package name
* Fix compilation errors (untested)
* Random fixes
* Various modded rendering fixes
* Restore contract of RenderAttachedBlockView
* Bump versions as needed
* Add API for BlockRenderLayer
* Minor format / name cleanup
Will do a more comprehensive pass as part of separate refactor PR
* Bump versions not handled earlier
* Bump loader/mc bounds for dependent modules
* Update fabric-blockrenderlayer-v1/src/main/java/net/fabricmc/fabric/impl/blockrenderlayer/v1/BlockRenderLayerMapImpl.java
Co-Authored-By: liach <7806504+liach@users.noreply.github.com>
* Update fabric-blockrenderlayer-v1/src/main/java/net/fabricmc/fabric/impl/blockrenderlayer/v1/BlockRenderLayerMapImpl.java
Co-Authored-By: liach <7806504+liach@users.noreply.github.com>
* Minor clean ups
* Improve docs, minor format corrections.
* Update MC dependency
- Fix#199 Vanilla Bug: Glowstone creates AO shade
- Fix#289 Rendering on the Cutout and Transparent Layers together interferes with water rendering
- Fix#290 Smooth lighting breaks on continuous angled surfaces
- Fix#291 QuadEmitter not cleared on MeshBuilder.build()
- Fix#292 Render context QuadEmitter crash with flat lighting
- Fix#293 Relax vertex order requirements for modded quads
- Fix swapped color components for grass and other blocks
- Add option to partially support non-standard vertex formats