Commit graph

1403 commits

Author SHA1 Message Date
Technici4n
602c17c74a Fix log spam with multiple calls to combinedItemApiProvider (#3387)
(cherry picked from commit d6f4a34e15)
(cherry picked from commit bb1ee60efb)
(cherry picked from commit 1bc31aeb60)
2023-11-02 10:36:01 +00:00
Estecka
3f657af28e Fix Doubles not being editable in the game-rule menu (#3397)
* Fix double gamerules rules not being editable in menu

* Updated `validate`'s javadoc

(cherry picked from commit a44e16a6dc)
(cherry picked from commit ae9f657a88)
2023-11-02 10:31:07 +00:00
modmuss50
bbbd917405 Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-10-08 13:34:30 +01:00
apple502j
6b24207967 Fix inconsistency of placed feature locations (#3369)
* Fix inconsistency of placed feature locations

`BiomeSource#getBiomes` mixin applies to all biome sources, including one for Overworld.
The return value is a set; however one caller in the worldgen code iterates over it: `PlacedFeatureIndexer`.
Using a hash set here randomizes the return value, affecting feature placement.
Use a linked hash set instead.

* Improve fix to only make changes when required.

---------

Co-authored-by: modmuss50 <modmuss50@gmail.com>
(cherry picked from commit 661cc8c6dc)
(cherry picked from commit 215bbe96c2)
2023-10-08 13:15:06 +01:00
modmuss50
85da0b3760 Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-08-13 16:26:06 +01:00
PepperCode1
90110d8d36 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

Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-08-13 16:11:28 +01:00
qouteall
44c9c86072 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:07:38 +01:00
modmuss
6603511d83 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:07:35 +01:00
modmuss
ae9c4c6acb Fix #3255 (#3257) 2023-08-13 16:07:33 +01:00
modmuss50
e99023d84f Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-07-25 14:55:45 +01:00
apple502j
26f09d40e0 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>
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-07-25 14:28:06 +01:00
PepperCode1
3a1ea2f107 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:25:03 +01:00
modmuss
95ae871652 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:25:00 +01:00
modmuss50
95a3e5738f Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-07-18 13:55:40 +01:00
Technici4n
7bf81db9d7 A few transfer API improvements and deprecations (#3204)
* A few transfer API improvements and deprecations

* Forward implementation of deprecated methods
2023-07-18 13:38:24 +01:00
Un roman
8400c67e36 Ukrainian translations (#3169)
* Add files via upload

* Add files via upload
2023-07-18 13:38:24 +01:00
maityyy
6d727b519d Add the cherry grove to the floral biome tag (#3202) 2023-07-18 13:38:24 +01:00
Shnupbups
1b5f819a7a 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 13:38:20 +01:00
Technici4n
0790259953 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 13:16:43 +01:00
Jonathan Coates
4b6b93f0b1 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 13:16:41 +01:00
Technici4n
737a6ee8bf 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 13:16:38 +01:00
Kevin
53c11dad6d Fix incorrect behavior with ClientMessageEvents and CommandApi (#3182) 2023-07-18 13:16:36 +01:00
Juuz
2c56a82ab4 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>
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-07-18 13:16:33 +01:00
Technici4n
a025543665 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>
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-07-18 13:16:17 +01:00
modmuss50
1e0223ee28 Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-07-03 14:05:12 +01:00
Julian Burner
d3afe6c355 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:51 +01:00
Juuz
86d48884d3 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.

Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-07-03 13:19:38 +01:00
Technici4n
c956c0e61d 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:13:56 +01:00
Deximus-Maximus
0eee1254b5 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:13:13 +01:00
Shnupbups
d63b52ea53 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

Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-07-03 13:13:08 +01:00
Juuz
d0403fca23 Update Finnish translation (#3166) 2023-07-03 13:12:04 +01:00
I_am_Vietnam
da41e1a998 Add vi_vn.json (#3167)
* Create vi_vn.json

* Create vi_vn.json
2023-07-03 13:12:01 +01:00
CoolChicken321
e617951038 Update Spanish translations 2023-07-03 13:11:59 +01:00
modmuss50
4a06bd12f2 Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-06-21 10:17:58 +01:00
PepperCode1
c6bbc80da8
Interface inject FabricBakedModel (#3099)
### API Changes
- Interface inject `FabricBakedModel`
This change was done to eliminate the constant need to cast `BakedModel` to `FabricBakedModel`, especially when rendering sub-models. The implementations for the methods of `FabricBakedModel` were moved from `BakedModelMixin` to `FabricBakedModel` as default implementations. Some javadoc was updated to reflect this change.
- Deprecate the mesh consumer (`Consumer<Mesh>` retrieved from `RenderContext`)
This change was done to ensure consistency across all current and future contexts in which a mesh may need to be output to a quad emitter. The preferred direct replacement is the new method `Mesh#outputTo(QuadEmitter)`. Some javadoc was updated to reflect this change.
- Deprecate the baked model consumer (`BakedModelConsumer` retrieved from `RenderContext`)
This change was done to ensure consistent rendering of sub-models and to eliminate assumptions about what features a model uses. The preferred direct replacement is to use the appropriate `emit` method in `FabricBakedModel`. Some javadoc was updated to reflect this change.
Even though the consumer is now deprecated, the default `FabricBakedModel` method implementations still use it and renderers must still implement the getter. This is because Indigo and Indium sometimes apply smooth lighting differently based on if the quad came from a vanilla model or not. The eventual solution to allow all baked model consumer usage to be removed is to allow renderers to override the default `BakedModelMixin` and handle default vanilla models directly.
- Fix `QuadView#toVanilla`'s javadoc reporting the wrong minimum array size

### Implementation Changes
- Restructure `RenderContext` implementations
This change was done to reduce code duplication, improve standardization, and improve readability. Most code of `AbstractQuadRenderer` was moved into a new class called `AbstractBlockRenderContext` (which `BlockRenderContext` and `TerrainRenderContext` now extend), with the main buffering method being moved to `AbstractRenderContext`.
- Remove red blue color swap
It is unclear why this code was necessary in the first place. Indigo stores vertex color in ARGB format, then converts it to ABGR format only if the native byte order is little endian, and then reads the vertex color in ABGR format when buffering vertex data. This would mean that on big endian systems, all red and blue color components would be swapped.
Now, color is read in ARGB format when buffering and no color format conversion or swapping is done.
- Encode face normal
This change was done to improve the performance of meshes. Meshes already encoded all other geometry data, but the face normal would still have to be recomputed every time a mesh quad was rendered. Now, it is stored in the quad data header, so it is simply decoded, which is significantly faster.
- Fix some bugs
  - Outputting a mesh via the mesh consumer would result in the emitter retaining the data of the last quad in the mesh.
  - In non-terrain block rendering, the baked model consumer would incorrectly use the random seed provided by the block state instead of the passed random seed argument.
  - When converting to or from vanilla quad data, the color would not be converted. Indigo uses ARGB format to store color, while vanilla quads use ABGR or RGBA. See the comment near the bottom of `ColorHelper` for more information.
  - Fix TerrainRenderContext using incorrect overlay value of `0` instead of `OverlayTexture.DEFAULT_UV`.
- Improve performance of some code
  - `QuadViewImpl#computeGeometry()` was being called before transforms and the cull test were applied. These operations can change the geometry and invalidate computed geometry data or cancel the quad outright. Calling the method explicitly in those contexts was also not necessary in the first place.
  - A single `Vector4f` instance is now reused to transform the vertex position instead of allocating a new `Vector4f` for each vertex.
  - The random seed lazy computation now uses a separate boolean instead of checking if the seed is `-1`.
2023-06-21 09:58:54 +01:00
modmuss50
88323df583 Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-05-30 13:41:01 +01:00
modmuss
10ce000fa5 Setup unit tests & format gradle files. (#3073) 2023-05-30 13:10:24 +01:00
Maity
cd417cfcaf fix: floral tag missing meadow biome (#3078)
* floral tag missing meadow biome

* run datagen
2023-05-30 13:10:19 +01:00
modmuss
cd545891bb Set player.currentScreenHandler before invoking ExtendedScreenHandlerFactory (#3077)
* Set player.currentScreenHandler before invoking ExtendedScreenHandlerFactory

* Add comment

* Cleanup code
2023-05-30 13:10:17 +01:00
Technici4n
cff5633a65 Fix FabricBlockLootTableProvider breaking depending on the mapping set (#3070)
* Initial fix for FabricBlockLootTableProvider depending on mappings

* Remove internal implementation methods from  interface

Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-05-30 13:10:06 +01:00
Roman / Linnea Gräf
aba27ca29f Add metadata information to POMs (#3074)
* Add metadata information to POMs

* Add name, description, url and issue management

Also update the license name and an url to the fabric website
Pulls name and description from the fabric.mod.json

* Fix imports and make git optional

* Remove commit from maven metadata
2023-05-30 13:07:48 +01:00
Technici4n
86f2414baa
Move injection point of TooltipComponentCallback (#3085) 2023-05-30 12:59:06 +01:00
qouteall
5f4a2056f3
Add an event that fires when client player left-clicks (#3043)
The ClientPreAttackCallback will fire every tick when the attack key is pressed, before vanilla attack handling. If the callback returns true, then the vanilla handling (breaking block, attacking entity, swining hand) will be cancelled. For multiple callbacks, if the former callback returns true, the later callback won't execute.

This event does not consider attack cooldown.
2023-05-30 12:51:38 +01:00
modmuss50
9b1d9bbd0e Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-05-24 21:22:08 +01:00
PepperCode1
52cca24e15
Material inspection (#3066)
* Material inspection

- Add MaterialView to get material properties from RenderMaterial and MaterialFinder
- Add MaterialFinder#copyFrom to copy properties from another MaterialView
- Finish todo in QuadView#toBakedQuad
- Move material impl classes to material package

* Add glint material property

- Allow force enabling or force disabling glint on items
- Force enable glint on horizontal sides of pillar item model in test mod

* Fix imports

* Add documentation

* Do not create invalid materials

- Ensure material bits are valid before creating material
- Assert that default MaterialFinder bits are valid
- Remove ordinal checks in MaterialViewImpl since bits are now guaranteed to be valid
- Set default glint mode to default instead of false
- Remove getter overrides in RenderMaterialImpl

* Add MutableQuadView#copyFrom

- Deprecate QuadView#copyTo

* Add missing nullability annotations
2023-05-24 17:30:12 +02:00
Technici4n
2198ff13ff Bump version 2023-05-15 21:35:10 +02:00
Maity
fe8721be1f Add #c:flower_forests to #c:floral convention tag (#3065) 2023-05-15 21:05:59 +02:00
Maity
b4a333d661 Fix last few transitive access wideners missing the transitive- prefix (#3064)
Also add validation to make sure that the generated `.accesswidener` has only transitive access modifiers.
2023-05-15 21:05:59 +02:00
modmuss50
7e532d225e Bump version
Signed-off-by: modmuss50 <modmuss50@gmail.com>
2023-05-14 15:15:33 +01:00
Technici4n
c98e6b2742
Convention Tags Improvements (#3051)
* First pass: refactor a bit, add missing item tags that have block tags, add resource category tags and wooden_barrels

* Fix #2831: Move entity buckets to c:entity_water_buckets

* Add villager_job_sites and sandstone tags

* Add alternative cauldrons to villager job sites.

Signed-off-by: modmuss50 <modmuss50@gmail.com>

---------

Signed-off-by: modmuss50 <modmuss50@gmail.com>
Co-authored-by: modmuss50 <modmuss50@gmail.com>
2023-05-14 15:00:30 +01:00