* Buildscript changes
* Particle API: port and some refactor
* Add support for Ingredient in FabricBrewingRecipeRegistry
* Add private ctor to ClientPlayerBlockBreakEvents
Not related to port, but something I've found during the process.
Also adds final to CommonLifecycleEvents.
* Fix Sound API testmod
* Fix broken javadocs
* Codec-related changes
* Document behavior of SUCCESS_NO_ITEM_USED in UseEntityCallback
* Add getEnabledFeatures
* checkstyle
* First pass on transfer API
* More fixes
* Another fix
* Small fixes
* Move transfer API tests to junit
* Fix client run
* Small fixes
* Copy stack when component changes
* Small improvement
* More tests and docs fixes
* Mutate existing stack
* 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>
* Data Attachment API
* javadoc
* Remove AttachmentSerializer & independent syncability and persistence
- removed AttachmentSerializer in favor of codecs
- renamed serializability to "persistence"
- made persistence and syncability independent switches
- reworked convenience registry methods to use Suppliers from the get-go
* Move some serialization-related methods to impl
- changed logger name
* rename Attachment to AttachmentType
* Added DefaultedAttachmentType and reworded Javadoc
* add warning in getAttached
* javadoc
* fix defaulted API
* Add unit tests
* remove DefaultedAttachmentType, add helper methods
bikeshedding inbound
* add more unit tests
* add testmod
it works
* stash syncing for a further PR
* missed license header
* address most reviews
* more reviews
* naming convention
* fix tyop
* fix invalid file name error
* simplify API in the absence of sync
It was established that the presence of a codec might be useful for other things than persistence, and while this seems to couple the two, the API can be changed later in a backward-compatible way if need be.
* couple codec with persistence
committing to the change I mentioned previously
* little fixes
* Fix mixins + requests
- Copy attachments on entity copy,& with a customizable flag in the case of player respawn
- Call relevant change-notifying methods when calling setAttached on BEs and chunks
- Change persistence key
- Fix mixin visibility
* Write tests for entity copy
* replace mixin by COPY_FROM event
* missed license header
* more advanced copy mechanics
- attachments require an EntityCopyHandler to be copied across entities
- a copy handler is automatically derived if there's a codec
- updated javadoc for chunk and BE targets
* Revert "more advanced copy mechanics"
This reverts commit 3f53b554fb.
* replaced complicated API by a stern warning
- also handled cross-world entity teleportation
* add gametest
* fix compilation
* flipped boolean
* forgot some more bools to flip
* requests
* fix FMJ
* fix BE mixin and add gametest
* add client player entity copying
* Use new mob conversion event
---------
Co-authored-by: modmuss <modmuss50@gmail.com>
(cherry picked from commit 25e1b4769d)
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>
* Fabric custom ingredient API
* More Ingredient API work
* Optimize shapeless matching logic
* Fix all the things
* Move custom ingredient network serialization to account for ingredient extension API
* Apply suggestions from code review
Co-authored-by: apple502j <33279053+apple502j@users.noreply.github.com>
* Address 🍎 review
* Get rid of the @Overwrite
* Implement graceful fallback for clients not supporting some custom ingredients
* Move custom ingredient code to new Recipe API module
* Fix client package change
* Address review comments
- And/Or -> All/Any
- Move builtin ingredient registration to entrypoint
- Initial protocol version is 1
- Misc other changes
* Add testing instructions
* Use a List for `getMatchingStacks`
* Overengineer ingredient query a bit
Co-authored-by: apple502j <33279053+apple502j@users.noreply.github.com>
Co-authored-by: modmuss50 <modmuss50@gmail.com>
* Add block appearance API
* Add class javadoc for FabricBlock and FabricBlockState
* Address reviews
* Remove OverrideOnly from getAppearance
* Fix javadoc issues
* Allow sound instances to play custom audio streams
Adds a new interface FabricSoundInstance, which is injected into
vanilla's SoundInstance interface.
When loading an audio stream, the SoundSystem now calls
FabricSoundInstance.getAudioStream, allowing mods to provide their
own audio streams.
* Some post-review cleanup
- Manually add the client sources as an interface injection source set,
allowing us to put everything in the src/client dir (<3 modmuss50).
- Apply some formatting changes from apple502j.
* Document the empty sound and its usage in sounds.json
* Fix one remaining @literal -> @code
* Fix checkstyle issues
* Initial skeleton
* Fabric Chat API v1 (experimental)
* Run checkstyle
* Fix checkstyle (testmod)
* Support 1.19-pre1
* Fix spotless
* Fixes
* Remove caching of messages
This is hard to maintain and has several edge cases. Mods should cache themselves when needed.
* Make constructor private
* Add ServerChatEvents
* Update mappings
* Prepare for the rename
* Include chat decorator in exception
* Add support for blocking messages
* Rename to fabric-message-api-v1
* Update to 1.19-pre2
* Use fabric namespace
* Rename ChatDecoratorEvent
* Rename events and add more javadoc
* Rename ServerChatEvents
* Rename ChatDecorator
* Only block bad respawn point death in testmod
* Fix wrong word in javadoc
* Improve javadoc
Co-authored-by: modmuss50 <modmuss50@gmail.com>
- 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>
* 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.
* Add framework for common-tags-v1
* Add javadoc to fabric tool tags
* Fix wrong package arrangement
* Add some more tags
* Add more biome tags
Thanks to TelepathicGrunt for the suggestions
* Update fabric-common-tags-api-v1/src/main/java/net/fabricmc/fabric/api/tags/v1/CommonEnchantmentTags.java
Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
* Update fabric-common-tags-api-v1/src/main/java/net/fabricmc/fabric/api/tags/v1/CommonEnchantmentTags.java
Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
* Clarify enchantment tags
* Add no-shulker tag
* Add minecart tag
* Begin work on datagen and populating tags
* Add bucket tags
* First pass at populating biome tags
* Add boat tag
* Fix missing inclusion of f:shears into c:shears
* Hide fabric tool tags in datagen
* Add weapon damage enhancement tag
* Change impl package name to be inline with rest of fapi
* Rename enchantment tags
* Some cleanup
* Populate blocktag datagen
Remove crops tag
* Add javadoc links to vanilla counterparts
* Move datagen to its own sourceset
* Fix package names for checkstyle
* Populate more entries
* Remove exclusion tag
* Add license headers
Fix checkstyle
* Add missing nether quarts to ores tag
* Use `worldgen/biome` instead of `biomes` for biome tags
Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
* Manually include all biomes for overworld
* Remove ancient debris from NetheriteOres
* Add and populate glass tags
* Add and populate movement enhancement
* Break up item tags
* Add armour damage reduction tag
* Add missing ore and related tags
* Fix quartz tags
* Add floral tag
* Add golden carrot
* Correct some biome tag issues
* Separate SNOWY_PLAINS and PLAINS
* Add SNOWY tag and remove snowy biomes from ICY
* Correct enchantment tag
Remove silk touch tag
* Fix more biome issues
* Add deep and shllow ocean tags
* Add no-move tag
* Remove netherite ores
* Add shulker tags
* Add raw ore
* Add dye tags
* Fif dye tags
* Fix typo
* Document some biome tags where the naming may not be clear
* Remove tag mirroring for blocks and items
* Rename module
Remove unused methods
* Rename impl package
* Rename packages and module
* Rename folder
* Rename api classes
* Add generateResources task to cover all resource generation tasks.
* Add generated tags to repo
* Fix ocean tag excluding shallow ocean
* Iterate registry to generate foods tag
* Remove cache, add to gitignore
* Rename generated folder
Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
Co-authored-by: modmuss50 <modmuss50@gmail.com>
* Add transitive AW module with block constructors
* Add various registries to transitive AW module
* Fix module name in README, add skip flags to class reading
* Add reasons for TAWs, document Block ctor finding algorithm
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.
* Mining Level API, part 1
* Fix incorrect netherite mining level in MiningLevelManager docs
* Add some format checks in dynamic mining level tag checking
* Add mining level API test mod
* Grammar
* Add cursed basic support for the tool attribute api
* Fix tool attribute JD
* Add proper compat for tool attribute api
Also fixes the remaining bugs in it!
* Update license headers
* stuff
* better comments
* more test mod work
* more
* Fix test mod
* i'm done with this module
* Address some code review things
* Use Reference2IntMap (basically IdentityHashMap for int values)
* Prefix mixin handlers with fabric$
* Add missing license header
* Update fabric-object-builder-api-v1/src/main/java/net/fabricmc/fabric/api/object/builder/v1/block/FabricBlockSettings.java
* Resolve liach's comment
* Update to use TagFactory
* First proof of concept pass
* Cleanup and fixes.
* Checkstyle
* Fix running.
* Updated
* Fix build
* Cleanup + fixes.
* Fix package
* and test package
* game-test -> gametest
* Fix exclusion
* Review feedback and fixes.
* Remove comment
* Review feedback.
* Don't set the game instance
* Fix
* Work around shadowed fields from super classes not getting remapped... dejavu anyone?
See: 2e359e933a (diff-0956caa3cd38a54f5910979f0cfd98198a93e4d585e111300f2f7ab7301ad122)
* Add mixin to exit with a non-zero exit code in case the test server fails to start.
* Enable JUnit XML report generation.
Co-authored-by: Sebastian Hartte <sebastian@hartte.de>
* Original fluid API design
* Rework the transaction system
* First javadoc pass
* Add a testmod, a base implementation for fluid storages and fix some little bugs
* Fix checkstyle
* Make Movement#move extract from the view and not the whole Storage
* Document and update FluidPreconditions
* Use for-each in CombinedStorage and document a little
* Remove useless overrides in Insertion/ExtractionOnlyStorage
* Move SnapshotParticipant#snapshots to the top of the class, and make updateSnapshots public
* Fix garbage collection of unused CauldronWrappers
* Use ArrayList directly
* Remove locking, reorganize transaction implementation, and add outer close callback
* Add more javadoc
* Rework Storage#forEach into Storage#iterator
* Add a few missing `transaction.addCloseCallback(iterator)`
* Add anyView(), exactView(), capacity() and isEmpty()
* Add Storage#iterable to make iteration friendlier to for loops
* Storages may now have multiple open iterators
Co-authored-by: Devan-Kerman <dev.sel20@gmail.com>
* Make CombinedStorage#supportsInsertion/Extraction iterate through the parts
* Block updates should be used when the supportsInsertion/Extraction status changes
* Fluid -> FluidKey
* Remove all references to ItemKey inside FluidKey, and other minor tweaks
* Cache FluidKeys with a null tag inside Fluid directly
* Fluid unit convention
* Add FluidKeyRendering and RenderHandler
* Bump version for more testing (also published to my maven)
* Add SingleViewIterator, massively reduce code duplication!
* Make API experimental, and add README
* Bump version
* Apparently Fluids.EMPTY is flowing
* Add package info
* Minor adjustements
* 1.17 port, cauldron support, add ResourceKey
* Checkstyle, gas rendering, use record for ResourceAmount
* Add a few helpers, rename some stuff
* Remove anyView, allow nullable in StorageUtil#find*, fix missing try block
* Slight findStoredResource cleanup
* Slightly improve implementation
* Bump version
* Fix wrong transaction
* I wrote in a comment that this could happen...
* Fix SingleFluidStorage bugs, add tests in the testmod, add testmod assets
* Add extract stick
* Rename a few things
* `ResourceKey<T>` -> `TransferKey<O>`
* `ResourceKey#getResource()` -> `TransferKey#getObject()` as resource is already widely used through the API for the keys themselves.
* `tag` -> `nbt`
* Add `get` prefixes to `StorageView` functions
* Bump version
* FluidKey -> FluidVariant
* Bump version
* Expand getVersion() documentation, make it thread-safe and use long.
Co-authored-by: Player <player@player.to>
* empty resource -> blank resource, and update SingleFluidStorage
Co-authored-by: Player <player@player.to>
* Make CauldronFluidContent a final class instead of a record.
Co-authored-by: Player <player@player.to>
* Get rid of CauldronFluidContent#minLevel (was always 1)
* Fix nested commits. (Thanks @warjort!)
* Separate Transaction and TransactionContext
Co-authored-by: Devan-Kerman <dev.sel20@gmail.com>
Co-authored-by: Player <player@player.to>
* Change WorldLocation into a private record
* Bump version
* Guard against exceptions thrown in close callbacks
* Make sure blank fluid variants don't have a tag
* Add documentation, make CauldronStorage clearer
Co-authored-by: frqnny <45723631+frqnny@users.noreply.github.com>
* Allow null storages in StorageUtil#move, and clarify sidedness of FluidStorage
* Add explicit hashCode and equals for transfer variants
* Remove ugly equals and hashCode overrides, and add constant time hashcode spec
Co-authored-by: Devan-Kerman <dev.sel20@gmail.com>
Co-authored-by: liach <liach@users.noreply.github.com>
Co-authored-by: Player <player@player.to>
Co-authored-by: frqnny <45723631+frqnny@users.noreply.github.com>