Commit graph

19 commits

Author SHA1 Message Date
modmuss50
c47b9d4307 Update Fabric Loader 2024-10-15 15:12:08 +01:00
modmuss50
9ed063b333 24w37a
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-11 17:28:45 +01:00
modmuss
d48ec150ba
24w36a (#4068)
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
* 24w36a

* Some fixes

* More work

* Fixes

* Update yarn

* Update fabric loader

* Bump versions
2024-09-05 11:42:30 +01:00
modmuss
6c0945c34f
Update Fabric Loader and re-enable server test (#4056) 2024-08-29 17:55:03 +01:00
apple502j
01f3a03986
24w34a porting fixes (#4054)
* Fix elytra events not working

* Add note on paused dedicated server

* Add note on thrown tridents in `CustomDamageHandler`

Thrown tridents are handled in a different method to ensure they do not break after
successful use (you cannot throw tridents that are almost broken). To make the API simple
(as you cannot use this with vanilla items anyway), exclude them from coverage.

* Fix javadoc in VillagerInteractionRegistries

* Fix javadoc
2024-08-26 12:02:31 +01:00
modmuss
2be899094a
24w34a (#4046)
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
Co-authored-by: PepperCode1 <44146161+peppercode1@users.noreply.github.com>
2024-08-21 18:25:15 +01:00
PepperCode1
236902d814
Finish porting Model Loading, FRAPI, and Indigo (#4043) 2024-08-21 16:05:05 +01:00
modmuss
1bb677a646 Port to 24w33a (#4033)
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
Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
Co-authored-by: hypherionmc <hypherionmc@gmail.com>
(cherry picked from commit 952fb19a0df7354e8352ef0c993a956b2bed32c2)
2024-08-18 19:16:27 +01:00
PepperCode1
fe474d6b05
Port Model Loading API v1 to 1.21 (#3824)
* Port Model Loading API v1

* Fix checkstyle and address review comments
2024-06-08 14:02:54 +01:00
modmuss
b55973447a
1.21-pre1 port (#3811)
* 1.21-pre1 port

* Bump version
2024-05-29 16:25:22 +01:00
modmuss
6573ed8ccc
24w21b (#3789)
Co-authored-by: Drex <nicknamedrex@gmail.com>
Co-authored-by: embeddedt <42941056+embeddedt@users.noreply.github.com>
2024-05-23 10:20:54 +01:00
modmuss
0af3f5a702
24w18a (#3757)
Co-authored-by: Drex <nicknamedrex@gmail.com>
2024-05-04 14:28:29 +01:00
modmuss50
80f8cf516f Update Fabric Loader 2024-01-17 17:15:38 +00:00
modmuss
3434862fbd
Port to 23w51b (#3474)
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`
2023-12-18 18:47:42 +00:00
modmuss
78d798af9d
Update to loader 0.15 (#3451) 2023-12-08 15:19:17 +00:00
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
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
PepperCode1
709a9871d4
Clarify nullability of ModelModifier.AfterBake (#3212)
* Clarify nullability of AfterBake modifier

* Fix documentation

Null baked models are cached, but only in the inner cache, which is not accessible after all baking is finished. The term "cache" is also ambiguous, so its use has been removed.

* Add breaks for v0 <0.4.0
2023-07-25 14:04:00 +01:00
Technici4n
9386d8a793
Model Loading API v1 (#3145)
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>
2023-07-18 12:53:13 +01:00