Commit graph

58 commits

Author SHA1 Message Date
modmuss50
fb8d95dacb Split test mods into client and common. (#3033) 2023-05-01 14:04:29 +01:00
modmuss50
b3f2574b16 23w17a 2023-04-26 18:18:06 +01:00
Technici4n
2e629d2646 Fix #3017: ComposterWrapper not always increasing on first insert (#3021) 2023-04-23 13:28:49 +01:00
modmuss50
eff26386be
23w16a (#3018)
# Breaking changes
- `VillagerPlantableRegistry` replaced with `ItemTags.VILLAGER_PLANTABLE_SEEDS`
- `FabricItemGroup.builder()` no longer takes an `Identifier`
- `FabricItemGroup.build()` no longer registers the ItemGroup, this now needs to go in the vanilla registry.
- `ItemGroupEvents.modifyEntriesEvent` now takes a `RegistryKey<ItemGroup>` in place of an `Identifier`
- `FabricLanguageProvider` now takes a `RegistryKey<ItemGroup>` in place of an `ItemGroup`
- `IdentifiableItemGroup` removed, replaced with vanilla registries.
- `FabricMaterialBuilder` removed, no replacement.
- `HudRenderCallback.onHudRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `ScreenEvents.beforeRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `ScreenEvents.afterRender` now passed a `DrawableHelper` in place of `MatrixStack`
- `Screens.getItemRenderer()` removed. Replace with `MinecraftClient.getItemRenderer()`

`DrawableHelper` is likely to be renamed soon, see: https://github.com/FabricMC/yarn/pull/3548/
2023-04-20 20:03:32 +01:00
Technici4n
f8daae03ea Transfer API: Add slotted storage and non-empty iterator (#2908)
* Transfer API: Add non-empty iterator

* Add SlottedStorage

* Add StorageUtil.extractAny

* Undeprecate ContainerItemContext.withInitial

* Add licenses

* Revert "Undeprecate ContainerItemContext.withInitial"

This reverts commit dcf123eb332ff642cdbd5fda0d8d2237794d93fc.

* Tweaks

* Make SlottedStorage#getSlots return a view, remove useless field, add UnmodifiableView annotations

* Remove useless @inheritDoc

* Fix infinite loop in the tests
2023-04-11 09:51:42 +01:00
modmuss50
158c189089 23w14a 2023-04-05 17:18:33 +01:00
modmuss50
9003cbe9c4 1.19.4-pre2
Just mapping updates
2023-02-27 16:56:40 +00:00
Technici4n
e7471eb7e4
Transfer API v3: Allow null directions, remove deprecated exactView override (#2909) 2023-02-23 10:12:57 +00:00
modmuss50
5da15ca1b9 1.19.4-pre1 2023-02-22 19:56:50 +00:00
modmuss50
e45f7c6532 23w07a 2023-02-15 19:54:58 +00:00
modmuss50
57338cbe24 23w06a 2023-02-08 17:54:34 +00:00
Technici4n
ccd377ba6b
Two Transfer API fixes (#2818)
* Fix #2810: Double chest wrapper not always updating both halves

* Fix #2522: Make creative ContainerItemContext give unique items to the play
2023-01-05 12:49:51 +00:00
apple502j
f1e4495b13
Javadoc and typo fixes (#2782) 2022-12-23 15:20:04 +00:00
modmuss50
99f9db8063
Cleanup Environment annotation usage. (#2755)
* Remove @Environment(EnvType.CLIENT) from BoundedIntRule.validate

* Move ItemTooltipCallback to client source set

* Remove @Environment(EnvType.CLIENT) annotation

* Remove @Environment(EnvType.SERVER) from WorldChunkMixin
2022-12-23 13:10:16 +00:00
modmuss50
82a27017d9 Update to 1.19.3 (from rc1) 2022-12-11 14:39:06 +00:00
modmuss50
28ac448f9c Update mappings
Use alternative fastutil javadoc link.
2022-11-24 15:46:56 +00:00
Technici4n
1c39312707 Add transfer API Chiseled Bookshelf support (#2685) 2022-11-24 15:06:49 +00:00
modmuss50
faff3b8448
Add automated client smoke tests. (#2678) 2022-11-22 16:49:00 +00:00
Juuz
e1cd40e0d6 Convert flowing fluids to still ones in fluid variants (#2679)
* Convert flowing fluids to still ones in fluid variants

Closes #2665.

* Improve error message

(cherry picked from commit 9d081d647b)
2022-11-22 16:37:55 +00:00
Juuz
48349a3f5f Generate package-info files for all impl and mixin packages (#2615)
* Generate package-info files for all impl and mixin packages

* Add javadoc to generated package-infos, use multiline string

* Simplify code

* Remove manual ApiStatus.Internal on impl classes

* Update CONTRIBUTING.md to remove ApiStatus.Internal for impl classes

* Fix Gradle deprecations

* Fix more Gradle deprecations

* Add task metadata

* Support client-main split

* Remove workaround for client packages

* Try to fix Gradle 8 deprecations

* Try to fix Gradle 8 deprecations, part 2

I'm hoping that using the SourceDirectorySet instead of converting it to a
Set<File> (which is pointless?) will carry the build dependencies over.

* Add clean packageInfo task

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

(cherry picked from commit 0d0f21023d)
2022-11-22 16:35:52 +00:00
Technici4n
5e8d4e2c03 Fix #2657: Transfer API edge case with bad isValid overrides (#2659)
Co-authored-by: modmuss50 <modmuss50@gmail.com>
(cherry picked from commit cd10d4fc03)
2022-11-20 13:47:10 +00:00
Jonathan Coates
4226ecdc12 Fix shulker boxes accepting other shulkers when using a directionless InventoryStorage (#2669)
* Fix shulker boxes accepting other shulkers

If a mod creates a directionless InventoryStorage, it only calls
Inventory.isValid and not SidedInventory.canInsert. However, shulker
boxes only override the latter, allowing shulkers to be inserted into
them.

* Check for insertion in inventorySlotWrapper instead

(cherry picked from commit c4b89cc4a6)
2022-11-20 13:45:06 +00:00
modmuss50
49abcf7e64 Update mappings 2022-11-16 16:12:51 +00:00
modmuss50
f84bf2d968
22w45a (#2647) 2022-11-10 16:07:38 +00:00
modmuss50
11ba9c3b22
22w43a (#2610)
Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>
2022-10-26 20:48:38 +01:00
modmuss50
75e98211bd
22w42a 🐫 (#2599)
Co-authored-by: shartte <shartte@users.noreply.github.com>
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
2022-10-22 20:38:33 +01:00
apple502j
93d8cb82e8
Fix many javadoc issues (#2526)
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
2022-09-25 14:45:12 +01:00
Technici4n
8f88597368
Transfer API improvements 4 (#2375)
* Transfer API improvements 4

* Actually copy the nbt in `copyOrCreateNbt`

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

* Add SingleFluidStorage.withFixedCapacity

* Remove unneeded iterator() overrides

* Add temporary workaround for bottle sounds

* Address review comments

* Change parameter name from compound to nbt

Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
2022-09-11 14:20:47 +01:00
apple502j
83a865928d
Make static-only classes final and unconstructible (#2421)
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.
2022-08-06 19:04:11 +01:00
modmuss50
e62f51a37f 1.19-rc1
Only mapping updates.
2022-06-02 15:41:09 +01:00
modmuss50
9ff28f4026
Split client only code into its own sourceset. (#2179)
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.
2022-05-21 16:26:46 +01:00
Technici4n
3572ae8d5f Fix #2164: Transfer API performance issues (#2189)
* Fix #2164: Transfer API performance issue

* Cache ItemStack in ItemVariantImpl

* Fix checkstyle

* Fix #2201

* Update comment in getCachedStack()

(cherry picked from commit f4563ac81e)
2022-05-20 18:21:50 +01:00
modmuss50
56447d9b95 22w17a 2022-04-27 20:48:57 +01:00
Technici4n
50e8465e2e
Transfer API improvements and breaking changes for 1.19 (#2139)
* Remove deprecated APIs

* Remove the transaction requirement for storage iteration

* Remove useless TransactionContext parameters in StorageUtil

* Improve SnapshotParticipant javadoc

* Fix tests

* Allow client-side SIDED item/fluid storage queries with a few caveats

* Add SidedStorageBlockEntity for easier block entity hierarchy registration
2022-04-27 18:38:29 +01:00
modmuss50
ec94c6f636
22w16b
Co-authored-by: Player <player@player.to>
2022-04-20 22:22:10 +01:00
modmuss50
0c7c3953f9 Merge remote-tracking branch 'origin/1.18.2' into 1.19 2022-04-10 17:20:49 +01:00
Technici4n
2373a54507 Transfer API improvements 3
- **(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>
2022-04-10 16:42:38 +01:00
Technici4n
dbb7b03f94
Add common (client/server) FluidVariant attributes (#2095)
* Add common (client/server) FluidVariant properties

* Remove density, move constants to FluidConstants, javadoc

* Javadoc, downgrade exception to LOGGER.warn

* attributes -> properties

* Property -> attribute

* Apply reviews

* Use optional sounds, mix into BucketItem

* Automatically implement Fluid#getBucketFillSound from the attribute

* Update fabric-transfer-api-v1/src/main/java/net/fabricmc/fabric/api/transfer/v1/fluid/FluidConstants.java

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

* Tests, a few fixes

* Add gametest for viscosity, isLighterThanAir -> flowsUpwards

* flowsUpwards -> isLighterThanAir

Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
2022-04-10 16:27:13 +01:00
deirn
82a21997c3
Change PlayerInventoryStorage#drop to use PlayerEntity#dropItem (#2098)
* change `PlayerInventoryStorage#drop` to use `PlayerEntity#dropItem`

* at -> from

* remainder
2022-04-10 16:27:07 +01:00
modmuss50
717abbc48a 22w14a 2022-04-06 21:49:45 +01:00
modmuss50
a67d2aa505 22w12a 2022-03-24 20:18:23 +00:00
Technici4n
cca23f938e Fix #1912 and #1972: inventory updates in transactions (#1979) 2022-03-03 18:15:40 +00:00
modmuss50
d882b91555
Port to 22w06a (#1989)
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.
2022-02-11 17:02:44 +00:00
modmuss50
d7c144a830
Migrate to SLF4j and update loom (#1960)
* Migrate to SLF4j and update loom

* Update loom

* Update to latest loom
2022-01-30 21:37:23 +00:00
Technici4n
d4df60101d Another wave of transfer API improvements (#1801)
* Another wave of transfer API improvements

* Cleaner implementation of FilteringStorage#...Of

* Undo colored name for water and lava variants
2021-11-05 15:53:07 +00:00
modmuss50
e14f9c8f05 21w44a 2021-11-03 18:57:29 +00:00
modmuss50
edf35c6176 Make dimension API stable. Remove usage of @Deprecated for experimental modules. 2021-10-31 10:59:59 +00:00
modmuss50
0b944752fc 21w43a 2021-10-27 20:48:33 +01:00
Technici4n
396dbf1cf1 Transfer API: bugfixes and improvements (#1762)
* 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
2021-10-07 12:29:07 +01:00
Technici4n
86bae2c0e9
Work around vanilla capturing ItemStack references (#1700) 2021-09-09 18:47:06 +01:00