Commit graph

1549 commits

Author SHA1 Message Date
ErrorCraft
bbae80faea Add a method to data generator entrypoints to register custom keys with priorities (#3087)
* Add JsonKeySortOrderCallback

* Use an entry point rather than an event for sort keys and priorities

* Resolve static imports

* Add a bit of javadoc

* Check if a key is null and modify the javadoc

* Add a field reference in the javadoc

* Rename JsonKeySortOrderAdder to JsonKeySortOrderCallback

(cherry picked from commit 0883a8d4d9)
2023-09-18 16:13:49 +01:00
modmuss50
5c133856b8 1.20.2-rc2 2023-09-18 16:13:25 +01:00
modmuss50
daef22a2cb 1.20.2-rc1 2023-09-15 15:27:05 +01:00
modmuss50
109a65e5af 1.20.2-pre4 2023-09-13 17:22:35 +01:00
modmuss50
3bafade3d1 1.20.2-pre2 2023-09-07 15:23:20 +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
435112151c 1.20.2-pre1 2023-09-05 16:31:02 +01:00
modmuss50
462ea84f7d Bump version 2023-09-03 21:54:51 +01:00
PepperCode1
b680c0d222 Implement RenderAttachedBlockView on ChunkRendererRegion (#3300)
(cherry picked from commit 9f8c23c7dc)
2023-09-03 21:53:07 +01:00
modmuss50
22fb02c315 Bump version 2023-09-03 13:34:17 +01:00
PepperCode1
73761d2e2d BlockView API v2 (#3268)
* Fabric BlockView API v2

* Fix dependency on nonexistent module

* Add test for biome getter

* Improve getBiomeFabric documentation

* Simplify javadoc

(cherry picked from commit 92a0d36746)
2023-09-03 13:13:56 +01:00
deirn
ceabd7613a Mark SidedStorageBlockEntity's side as nullable (#3281)
(cherry picked from commit 195226a756)
2023-09-03 13:07:10 +01:00
modmuss50
0287208bff Update mod publish plugin. 2023-08-31 12:54:59 +01:00
modmuss
fce67b32cf
23w35a (#3292) 2023-08-31 12:50:38 +01:00
apple502j
017b9d93e2
Networking API javadoc fixes and small refactors (#3285)
* Mark events class constructor as private

* Enhance FabricServerConfigurationNetworkHandler javadoc

* Expand package-info

* Mark some interfaces as non-extendable

* Refactor PlayerLookup and fix javadoc

The example about block entities was removed. This is not the proper way to
do it anymore; you should use `BlockEntity#markDirty` and the built-in syncing.

* Fix missing period

* Fix typos

* Fix checkstyle.

---------

Co-authored-by: modmuss50 <modmuss50@gmail.com>
2023-08-30 16:23:17 +01:00
modmuss50
f091af96c5 23w33a 2023-08-17 16:51:04 +01:00
modmuss
839aeb4e2c
Misc networking API cleanup + fixes (#3265) 2023-08-17 16:46:30 +01:00
modmuss50
11da534fdc Bump version 2023-08-13 16:26:33 +01:00
PepperCode1
736900a307 Improve Indigo and FRAPI Test Mod (#3208)
* Improve flat shade

- Use AO mode to make flat shade calculation consistent with shade applied by smooth lighting
- Use face normal to calculate shade if necessary
- Use normal shade even if no custom normals are set

* Improve FRAPI test mod

- Add octagonal column to test irregular face lighting
- Use obsidian sprite instead of missing sprite for frame mesh
- Simplify and organize registration
- Inline `simple` package

* Fix crumbling on 45 degree faces

- Fix checkstyle
- Give octagonal column a non-zero hardness

* Fix checkstyle

* Improve PillarBakedModel to fully support custom block appearance

* Explain OverlayVertexConsumer fix
2023-08-13 16:14:49 +01:00
qouteall
b1229956f3 Make DFU error-tolerant to mod custom generator types (#3213)
* Make DFU error-tolerant to mod custom generator types.

* Fix license. Rename mixin.

* Fix license.

* Disable remap in Schema2832Mixin
2023-08-13 16:14:21 +01:00
modmuss
db99c88865 Make deprecated modules opt-out instead of opt-in (#3246)
* Make deprecated modules opt-out instead of opt-in

* Add comment

* Update build.gradle

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

---------

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
2023-08-13 16:14:12 +01:00
modmuss
96274c18fc Fix #3255 (#3257) 2023-08-13 16:14:09 +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
a336222d5a Fix publishMods dryRun 2023-08-09 18:10:52 +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
modmuss50
d9acd820fc Bump version 2023-07-25 14:55:57 +01:00
apple502j
1e61dba1a0
Fix data generation for custom dynamic registry (#3216)
* Fix datagen for custom dynamic registry

* Test datagen for custom dynamic registry

* Check if the dynamic registry is registered with Fabric API

* Cleanup testmod

* Don't apply to registries not added using the fabric api.

---------

Co-authored-by: modmuss50 <modmuss50@gmail.com>
2023-07-25 14:21:33 +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
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
modmuss
23d91081b6
Sort item groups to ensure they are in a deterministic order between runs. (#3222) 2023-07-25 14:03:30 +01:00
modmuss50
e3d1b5f3d8 Bump version 2023-07-18 13:55:53 +01:00
Technici4n
cdf060b274
A few transfer API improvements and deprecations (#3204)
* A few transfer API improvements and deprecations

* Forward implementation of deprecated methods
2023-07-18 12:56:03 +01:00
Un roman
132c48c1fd
Ukrainian translations (#3169)
* Add files via upload

* Add files via upload
2023-07-18 12:55:27 +01:00
maityyy
a1a980dacd
Add the cherry grove to the floral biome tag (#3202) 2023-07-18 12:55:04 +01:00
Shnupbups
6c31357e16
Some more TAWs for block creation and block loot tables (#3201)
* Some more TAWs

Added some TAWs for various methods in `Blocks` used to create certain types of blocks that mods may want to also create. Using these methods will allow them to ensure they have all the right block settings they need to stay consistent with vanilla blocks that use the same methods.

* Add some fields from BlockLootTableGenerator

useful fields from BlockLootTableGenerator. also cleaned up the datagen api's accesswidener file
2023-07-18 12:54:51 +01:00
Technici4n
9172968c53
Fix Indigo handling of sculk sensor AO (#3200)
* Fix Indigo handling of sculk sensor AO. Fixes #3153

* Split offset and mean formula lighting config options
2023-07-18 12:54:39 +01:00
Jonathan Coates
e91849a835
Fix crash when beehive is broken by fake player (#3190)
* Fix crash when beehive is broken by fake player

When a beehive is broken, every nearby bee targets a random player.
However, if there are no nearby players, the game crashes.

This should not occur under normal (vanilla) conditions. However, if a
beehive is broken by a fake player there are no players in range, and so
we see a crash.

* Checkstyle, my beloved

* Remove public modifier

* See see see
2023-07-18 12:54:27 +01:00
Technici4n
7abfd5154a
Make event phase ordering logic usable in other contexts (internally only) (#3183)
* Make event phase ordering logic usable in other contexts (internally only)

* Rename and move to toposort package
2023-07-18 12:54:12 +01:00
Kevin
32651619ee
Fix incorrect behavior with ClientMessageEvents and CommandApi (#3182) 2023-07-18 12:54:01 +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
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
modmuss50
1ac061308b Bump version 2023-07-03 14:05:25 +01:00
Julian Burner
e3d6ed250b
Fix injected resources not overriding certain vanilla resources (1.20) (#3164)
* Fix injected resources not overriding certain vanilla resources

* Adjust comment

* Add test blocks for High Contrast pack, too

* Fix `GroupResourcePack`

* Deduplicate logic between `GroupResourcePack` and `FabricWrappedVanillaResourcePack`

* Fix checkstyle

* Delete gravel texture override, change dirt to diamond block
2023-07-03 13:54:38 +01:00
Juuz
201a23a0e9
Add event for preventing particle tinting for colored blocks (#3146)
- Adds an event, `ParticleRenderEvents.ALLOW_BLOCK_DUST_TINT`, that checks
  if a block dust particle of a specific block can be tinted.
- Bumps Fabric Loader requirement of fabric-particles-v1 to latest to
  disable Loader's mixin compatibility mode that ignores slices for
  certain At annotations.
2023-07-03 13:11:13 +01:00
Technici4n
43a3fedd62
Fix default fluid names for non-placeable fluids, clarify Storage iterator lifecycle with modification (#3141)
* Fix default fluid names for non-placeable fluids, clarify Storage iterator lifecycle with modification

* Fix blank variant translation accidentally changing
2023-07-03 13:11:03 +01:00
Deximus-Maximus
97bb207586
Add support for partially synced client tags (#3118)
* Draft v1.1.0

* Resolve some comments

* Add javadoc

* Remove old behavior

* Minor cleanup

* Add test for partially synced tags

* Address nitpick

* Fix checkstyle

* Hard fail when datapack fails to regsiter

Co-authored-by: modmuss <modmuss50@gmail.com>

* Fix missing import

* Refactor
Don't recurse through tag hierarchy

* Add note for test

* Adjustments to logic to handle server-missing nested tags

* Restore recursive search, add tracking of checked tags

* Cleanup

---------

Co-authored-by: modmuss <modmuss50@gmail.com>
2023-07-03 13:10:52 +01:00
Shnupbups
6beca848ff
Add builders for BlockSetType and WoodType to replace registries (#3115)
* Add builders for BlockSetType and WoodType to replace registries

Adds `BlockSetTypeBuilder` and `WoodTypeBuilder` to replace `BlockSetTypeRegistry` and `WoodTypeRegistry` respectively.

* whoops

* double whoops

* Register and Build now separate methods

Separated the register and build methods, with the former calling the latter. Their relationship is explained in the javadoc.

* Update BlockSetTypeBuilder.java
2023-07-03 13:10:39 +01:00