Commit graph

65 commits

Author SHA1 Message Date
modmuss
78d798af9d
Update to loader 0.15 (#3451) 2023-12-08 15:19:17 +00:00
modmuss
9468a19de0
Configure spotless for imports, sort imports. (#3365)
* Configure spotless to also do imports. Allows for auto applying.

* Order imports
2023-10-22 13:35:58 +01:00
apple502j
285022b3bc
Content Registries: javadoc and small refactor (#3347) 2023-10-01 12:37:07 +01:00
modmuss50
0ba8e9ce03 23w32a 2023-08-09 18:04:04 +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
modmuss
b3afc78b68
Setup unit tests & format gradle files. (#3073) 2023-05-30 13:07:11 +01:00
modmuss50
b3f2574b16 23w17a 2023-04-26 18:18:06 +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
modmuss50
ae0966baae
Fix all valid Mixin AP warnings. (#2914) 2023-02-22 12:54:50 +00:00
Daomephsta
1d37d50279 API for brewing recipes which use Ingredients instead of Items (#2670)
* API for brewing recipes which use Ingredients instead of Items

* Improve comments and JavaDoc

* Update mixin compatibility level

* Replace accessor mixin with access widener

* Fix double space

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

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
(cherry picked from commit 7c6cd14d84)
2022-12-23 15:37:09 +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
Salvatore Peluso
6064db2ac8
Add way to specify the PathNodeType for a block, add missing tests in content registries testmod. (#2519)
* Added LandPathNodeTypesRegistry.

* Added test for LandPathNodeTypesRegistry.

* Added block state to PathNodeTypeProvider.getPathNodeType.

* Made LandPathNodeTypesRegistry final, removed unnecessary NotNull.

* Changed putIfAbsent with put to align with other registries.

* Cleanup.

Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>

* Removed unused import.

* Added possibility to specify the node type of block if the block is found in a neighbor position, improved documentation.

* Merged mixins cleanup.

* Changed CAPTURE_FAILEXCEPTION into CAPTURE_FAILHARD

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

* Specified some nullables, changed 2 parameter names.

* Added missing content registries tests, changed NODE_TYPES map to IdentityHashMap, improved docs.

* Moved PathNodeTypeProvider inside LandPathNodeTypesRegistry.

* Registry revised to make it possible to distinguish between blocks with dynamic and static node types, reduced LandPathNodeMakerMixin priority, applied suggested docs improvements.

* Changed INVOKE with shift, with INVOKE_ASSIGN.

* Merged all LandPathNodeTypesRegistry utility methods used to check the registration type into a single one.

* Inverted if sequence in LandPathNodeTypesRegistry.getPathNodeType, improved docs.

* Sealed PathNodeTypeProvider and made public, cleaned and simplified LandPathNodeTypesRegistry by removing useless mechanics.

* Improved docs.

* Improved docs (2).

Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>
Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
2022-10-18 13:52:44 +01:00
modmuss50
624e468e8a Revert "Add LandPathNodeTypesRegistry (#2437)"
This reverts commit 6a999b8eb9.
2022-09-11 15:02:15 +01:00
2ndDerivative
763dcebeb6
Added doc to SculkSensorRegistry (#2490)
* Added line to Doc to prevent misconception

Added line because people probably want to use their GameEvent for the Warden too.

* Update SculkSensorFrequencyRegistry.java
2022-09-11 14:15:53 +01:00
Salvatore Peluso
6a999b8eb9
Add LandPathNodeTypesRegistry (#2437)
* Added LandPathNodeTypesRegistry.

* Added test for LandPathNodeTypesRegistry.

* Added block state to PathNodeTypeProvider.getPathNodeType.

* Made LandPathNodeTypesRegistry final, removed unnecessary NotNull.

* Changed putIfAbsent with put to align with other registries.

* Cleanup.

Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>

* Removed unused import.

* Added possibility to specify the node type of block if the block is found in a neighbor position, improved documentation.

* Merged mixins cleanup.

* Changed CAPTURE_FAILEXCEPTION into CAPTURE_FAILHARD

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

* Specified some nullables, changed 2 parameter names.

* Added missing content registries tests, changed NODE_TYPES map to IdentityHashMap, improved docs.

* Moved PathNodeTypeProvider inside LandPathNodeTypesRegistry.

Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>
Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
2022-09-11 14:14:45 +01:00
modmuss50
aeb40ebeab
Rename and validate Mixin class names. (#2450)
And update loom.
2022-08-15 18:59:19 +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
Shnupbups
07df213ec3
Sculk Sensor Frequency Registry (#2279)
* Sculk Sensor Frequency Registry

- Mixin'd to `SculkSensorBlock` to make its `FREQUENCIES` map modifiable.
- Created `SculkSensorFrequencyRegistry` with a dedicated method for registering these frequencies, with all necessary checks to avoid issues, and javadoc to assist in understanding.
- Added tests to the test mod, as well as a block that emits a test event, to ensure it all works.

Unfortunately, the mixin currently uses a Redirect. If this is undesired, feel free to suggest other ways of achieving the end result of being able to modify the frequencies map.

* Update SculkSensorFrequencyRegistry.java

* cleaner javadoc

* Update fabric-content-registries-v0/src/main/resources/fabric-content-registries-v0.mixins.json

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

* Final touches

...get it?

(oh and removed that Dynamic because tech didn't like it)

* Whoops

Forgot to remove the Dynamic import
Also restored the actual contents of the dynamic, as javadoc.

Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
2022-06-28 19:21:04 +01:00
Technici4n
82552130ba Fix #2108: FlammableBlockRegistry ignores tags unless /reload (#2326) 2022-06-19 19:21:06 +01:00
modmuss50
4a3ec38482 Fix build. 2022-06-13 20:17:48 +01:00
aws404
e8b09dcb10 Add registries for villager interactions to fabric-content-registries module (#2193)
* Add VillagerFoodRegistry

* Fix style

* Add VillagerCompostingRegistry and separate CollectablesRegistry from FoodRegistry

* Add VillagerPlantableRegistry

* Add warning when registering a non-compostable item as a villager compostable

* Rename some registries, use block placement sound

* Add VillagerHeroGiftRegistry

* Add javadoc

* Combined all registries into one API class

* Remove now redundant class

* Change registries to a static method

* Combine into VillagerInteractionRegistries class

* Fix typo

* Move ImmutableCollectionUtils to impl

* Add isEmpty check to plantables, prefix mixin methods with fabric_

* VillagerPlantableRegistry Rework

* Remove dangling comment

* notNulls, included vanilla items in plantable registry, checkstyle fix

(cherry picked from commit 6f01bfd847)
2022-06-13 20:00:17 +01:00
modmuss50
33fbc73844 Add SyncDataPackContents and TagsLoaded lifecycle events (#2265)
* Add SyncDataPackContents and TagsLoaded lifecycle events

* tagsLoaded -> onTagsLoaded, isClient -> client

* Compile error in testmod

* Make SyncDataPackContents fire for every player

* syncDataPackContents -> onSyncDataPackContents

(cherry picked from commit cc71601c72)
2022-06-13 19:59:24 +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
modmuss50
d82b939204
Fix Block2ObjectMap not using TagKey (#2028) 2022-02-24 11:17:53 +00:00
modmuss50
55dca1a4f3 Update mappings. 2022-02-16 18:14:59 +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
modmuss50
6f53a73db5 Bump versions 2021-11-23 18:54:18 +00:00
Shnupbups
f7c1d59979 Oxidizable and Waxable Blocks registries (#1832)
* Oxidizable Blocks registry

* Allow waxable blocks to be registered outside of OxidizableFamilies

* Refactor

Separated OxidizableBlocksRegistry and WaxableBlocksRegistry
Separated OxidizableFamily and WaxableBlockPair
Added null check to WaxableBlockPair
Added several methods

* whoops lol

* Apply suggestions from code review

Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>

* Update ContentRegistryTest.java

* Refactor again lol

Now uses mixins to change the vanilla ImmutableBiMaps to HashBiMaps and adds to them instead of keeping separate maps and having methods of their own. Much cleaner!

* gutted everything lol

removed all the charm and character- uh, i mean, superfluous stuff and reduced the api to the bare basics
oh and also one-way methods which is neat i guess if you're into that sort of thing

* 🦀one way methods are gone🦀

all my homies hate one way methods
maps are linked again

* re-merged oxidizable and waxable registry classes

* Update ContentRegistryTest.java

* implement suggestions by @Juuxel

* Oxidization -> Oxidation

as per https://github.com/FabricMC/yarn/pull/2837

* Improve Dynamics

Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
2021-11-23 17:23:55 +00:00
Player
3ac43d9577 Revert Mixin compatibilityLevel bump, bump versions 2021-11-17 03:29:11 +01:00
modmuss50
e77d3ea62f 1.18-pre2 & Java 17 2021-11-16 18:41:10 +00:00
modmuss50
b4f4f6cda4 Update Loom and Loader. Cleanup/improve buildscript. 2021-11-12 15:02:54 +00:00
modmuss50
c3150579ea Bump version 2021-11-06 20:31:21 +00:00
modmuss50
8a8e3d81de Ensure that API implementations can never be null. 2021-11-06 20:12:45 +00:00
modmuss50
65d505fc8a Bump versions
All of the version need to be bumped due to fabric-api-base being updated, this highlights the need for a better solution.
2021-11-05 17:09:48 +00:00
modmuss50
cbda9318cd
Update Gradle/Loom and mappings. (#1692)
* Update Gradle/Loom and mappings.

* Fix deprecations and enforce

* Review feedback

* More cleanup and deprecation fixes.
2021-08-31 14:00:20 +01:00
Juuxel
211ddf95aa
Add flattening, stripping and tilling registries (#1632)
* Add flattening, stripping and tilling registries

* Where'd the spaces come from?

* Clarify docs

* Better overloads for TillableBlockRegistry.register

* Mutablise AxeItem.STRIPPED_BLOCKS if needed

* Remove simplest TillableBlockRegistry.register overload because the default predicate is for farmland

* Add test mod

* Update fabric-content-registries-v0/src/main/java/net/fabricmc/fabric/api/registry/TillableBlockRegistry.java

Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>

Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
2021-08-24 17:44:06 +01:00
modmuss50
2e8bd82f1c Bump version 2021-08-08 18:39:30 +01:00
Juuxel
1b48b75b18
Fix FuelRegistry not following vanilla checks for valid fuels (#1554) 2021-08-08 18:18:01 +01:00
modmuss50
a02b4463f9 21w19a 2021-05-12 20:23:04 +01:00
modmuss50
23b3c92ea9 21w13a 2021-03-31 20:52:51 +01:00
modmuss50
92519afafe Version bump 2021-01-19 19:38:22 +00:00
i509VCB
f8cf2bb436 Add custom value denoting module lifecycles. (#1253)
* Add custom value denoting module lifecycles.

* Make the module validation work.

My hand has been forced - we must use buildSrc since JsonSlurper is not available in main buildscript.

* Apply task to each project and dont cross projects

* A horrible hack

* Wait what

* It works now.

* Not needed

* Drop unneeded maven repo, cache map lookup

(cherry picked from commit daa38b3d82)
2021-01-19 18:54:23 +00:00
modmuss50
880269e646 Bump version 2020-11-28 20:34:56 +00:00
Technici4n
fddcc0d88f Cache the fuel time map in the fuel registry (#1108)
* Cache the fuel time map in the fuel registry

* Use a faster map for the fuel times

* Rebuild the fuel times map on the client side too

* Use more compatible mixins

* Replace a function overwrite by a TAIL inject

* Mixin formatting

* Indentation

* Make cache thread-safe, switch to boxed collection (IHM) since most
uses yield boxed results, refactor cache clearing

* fix import formatting

Co-authored-by: Player <player@player.to>
2020-11-28 19:48:27 +00:00
Thalia Nero
9f7a7423f3 Add module dependencies to maven POM (#1104) 2020-11-15 19:46:01 +00:00