The following classes have been made final and unconstructible:
- All convention tags classes
- `FluidVariantAttributes`
- `FluidVariantRendering`
The following classes have been made unconstructible:
- `BiomeModifications`
- `ClientEntityEvents`
- `ClientTickEvents`
- `LootTableEvents`
- `FabricDefaultAttributeRegistry`
- `MinecartComparatorLogicRegistry`
- `StorageUtil`
The following classes have been explicitly marked as final. Note that actually extending such class has always been impossible due to missing public constructor:
- `VillagerInteractionRegistries`
- `VillagerPlantableRegistry`
- `ModelHelper`
- `StoragePreconditions`
While the first two are technically breaking changes, there is no actual or observed usage for any of those.
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.
- **(Slightly source-breaking change)** Change the return type of `Storage#iterator` and `Storage#iterable` from `Iterator<StorageView<T>>` to `Iterator<? extends StorageView<T>>` to allow returning a list directly. Most modders shouldn't be affected by this (this only broke one call site in the whole module).
- Precise that using the iterator or a view after the transaction is closed is "undefined behavior". Also specify that calling remove on the iterator is not allowed.
- Add `StorageView#getUnderlyingView` to be able to tell if some views are equal. This is useful to **compute the contents of multiple storage views without duplicates** (see testmod).
- Expose the lifecycle of the transaction manager cleanly with an enum.
- Definalize some methods in `SingleStackStorage` to allow custom implementations of some of them if needed.
- Add a note to `BlockApiLookup` to fix#1998.
- Play the composter empty sound when it is emptied through the transfer API, as a comment in the source code suggests.
Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
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 SingleVariantItemStorage extraction bug
* Inventory wrappers: reuse the original stack more aggressively
* Add some filtered overloads to StorageUtil methods
* Override PlayerInventoryStorage#insert to call #offer
* Add small comment regarding predicates
* Transfer API: continuous fluid-containing items and other base implementations
* Update player inventory storage TODO
* Add PlayerInventoryStorage test
* getHandSlot() and small fixes
* Use simulateExtract in findExtractableContent
* Apply review
* Post-rebase fixes
* Add tentative InventoryProvider support
Co-authored-by: Player <player@player.to>
* Allow fluid variant colors to depend on the position
Also add a smarter FluidVariantRendering#getTooltip.
* Add fluid variant rendering testmod
* 255/256 is not 1
* Actually it's in the top left
* 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>