Commit graph

82 commits

Author SHA1 Message Date
modmuss
3f89f5a5c6
fabric-loot-api-v3 (#3903)
* fabric-loot-api-v3

* Review fixes

* Fix tests

* More fixes
2024-07-07 13:52:31 +01:00
PepperCode1
fe474d6b05
Port Model Loading API v1 to 1.21 (#3824)
* Port Model Loading API v1

* Fix checkstyle and address review comments
2024-06-08 14:02:54 +01:00
modmuss
b55973447a
1.21-pre1 port (#3811)
* 1.21-pre1 port

* Bump version
2024-05-29 16:25:22 +01:00
TelepathicGrunt
7f945d5bb6
Refactor convention tags (#3310) 2024-04-16 18:01:57 +01:00
apple502j
c5fc38b3f7
Finish port to 1.20.5-pre1 (#3706)
* 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
2024-04-14 13:26:09 +01:00
modmuss
74e2f560d5
1.20.5-pre1 (#3700)
* 1.20.5-pre1

* BrewingRecipeRegistryBuilderCallback

* Remove debug line

* Fix build

* Bump version
2024-04-10 19:02:33 +01:00
apple502j
9b3069f652
Fully port to 24w12a (#3664)
* Bump yarn

* Apply yarn update

* Sync map decorations type registry

* Remove Mining Level API

* Port loot API

* whoops

* Rename LootManagerMixin

* Fix javadoc

* Fix registerGiftLootTable

* RegistryKey is traditionally compared using identity

* Fix wrong loot source being used
2024-03-27 16:47:29 +00:00
modmuss
e9d2a72b4f
24w12a (#3658)
# Removed
- FabricItemStack.isSuitableFor (replaced with vanilla component)
- FabricItemStack.getFoodComponent (replaced with vanilla component)
- ResourceReloadListenerKeys.LOOT_TABLES
- fabric-resource-conditions-api-v1 support for loot tables

# Disabled modules
- fabric-loot-api-v2
- fabric-mining-level-api-v1
2024-03-20 19:08:34 +00:00
modmuss
9d6d003f62
24w09a - Transfer API (#3626)
* 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
2024-03-01 17:46:49 +00:00
modmuss
1172e89799
24w09a (#3623)
* In game

* More fixes

* Small fixes + changes

* Rename

* Fix test
2024-02-29 19:16:35 +00:00
modmuss
7b70ea8a7a
Port to 24w03b (#3537)
* 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>
2024-01-22 18:24:37 +00:00
Syst3ms
93072209fd Data Attachment API (#3476)
* 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)
2024-01-19 11:15:42 +00:00
Jason Penilla
22fe817d10 add fabric-api-bom and fabric-api-catalog (#3487)
* feat: add fabric-api-bom and fabric-api-catalog

* spotlessApply

* Apply suggestions from code review

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

---------

Co-authored-by: modmuss <modmuss50@gmail.com>
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
(cherry picked from commit 679aae3c9a)
2024-01-11 15:50:48 +00:00
PepperCode1
73761d2e2d BlockView API v2 (#3268)
* Fabric BlockView API v2

* Fix dependency on nonexistent module

* Add test for biome getter

* Improve getBiomeFabric documentation

* Simplify javadoc

(cherry picked from commit 92a0d36746)
2023-09-03 13:13:56 +01:00
modmuss50
0ba8e9ce03 23w32a 2023-08-09 18:04:04 +01:00
modmuss
86b12645b9
23w31a 2023-08-07 09:09:38 +01:00
Technici4n
9386d8a793
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>
2023-07-18 12:53:13 +01:00
Technici4n
5176f73dbb
add fabric-recipe-api-v1: Custom ingredients (#2586)
* 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>
2023-01-05 12:49:19 +00:00
modmuss50
fbde993d15 22w46a 2022-11-16 16:15:34 +00:00
modmuss50
28cc6cc789 Merge remote-tracking branch 'origin/1.19.2' into 1.19.3
# Conflicts:
#	gradle.properties
2022-11-07 19:01:58 +00:00
Technici4n
12bfe4ea1a
Add a block appearance API (#2579)
* Add block appearance API

* Add class javadoc for FabricBlock and FabricBlockState

* Address reviews

* Remove OverrideOnly from getAppearance

* Fix javadoc issues
2022-11-07 18:29:51 +00: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
Jonathan Coates
c4f28df547
Add Sound API to allow sound instances to play custom audio streams (#2558)
* 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
2022-10-16 15:09:44 +01:00
Deximus-Maximus
b35fea83d3
Add client tags module (#2308)
* Add client tags module

* Fix not actually returning the tag eval. for dynamic registry fallback

* Use dynamic registry where needed

* Make ClientTags uninititializable

* Resolve feedback

* Change package

Co-authored-by: deirn <deirn@bai.lol>

* Change package

Co-authored-by: deirn <deirn@bai.lol>

* Remove unused dep. block

Co-authored-by: deirn <deirn@bai.lol>

* Fix imports

* Move the files to match new package

* Apply feedback

* Apply feedback

* Add test mod

* Fix CME

* Fix checkstyle

* Apply feedback

* Apply feedback

* Apply feedback

* Fix checkstyle

Co-authored-by: deirn <deirn@bai.lol>
2022-08-06 19:02:27 +01:00
apple502j
513f4a5977
Fabric Message API v1 (experimental) (#2220)
* 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>
2022-06-02 16:00:15 +01:00
Juuxel
9e7660c677 Loot table API v2
- 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>
2022-05-31 13:09:54 +01:00
Player
f71b366fb1
Update command registration API to reflect 1.19 vanilla changes (#2227)
* 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>
2022-05-20 18:39:10 +01:00
modmuss50
df3654b364
Move deprecated modules, create own maven BOM for the deprecated modules. (#2171)
* 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.
2022-05-01 15:44:16 +01:00
Deximus-Maximus
614e540081 Add fabric-convention-tags-v1 (#2063)
* 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>
2022-04-17 19:49:14 +01:00
Juuxel
40c91ec8c3
Create transitive AW module (#2044)
* 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
2022-03-13 13:52:38 +00:00
modmuss50
420242637b Update to stable 1.18.2. Remove previously disabled 'fabric-structure-api-v1' module. 2022-03-02 17:07:42 +00:00
modmuss50
58afd26713
1.18.2-pre1 Biome API (#2010)
* Fix BiomeSelectors.tag

* Update fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeSelectionContext.java

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

* Checkstyle

* Port Biome API

Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
2022-02-21 11:58:35 +00:00
modmuss50
0ef16df861 1.18.2-pre1 2022-02-18 18:27:44 +00:00
modmuss50
5a05a77ac9 22w07a 2022-02-16 19:24:00 +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
Technici4n
12540453db Fabric Resource Conditions (#1656)
* First completed draft

* Update PR, should be close to ready now

* Add fluid/item_tags_populated conditions

* Log processed resource with trace log level

* Use debug instead of trace log level

* Apply suggestions from code review

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

* Code review suggestions

* writeAdditional -> writeParameters

* Apply suggestions from code review
Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>

* CONDITION_ID -> CONDITION_ID_KEY
2022-01-14 15:10:43 +00:00
modmuss50
3fec4ad922
Fabric Data Generation API (#1824)
* First look at datagen

* First pass on item/block models

* Tags

* Advancements + BlockFamilies

* Loot tables

* Cleanup

* Start on javadocs, and cleanup

* Update for new mappings.

* Added client-side entrypoint and more logging.

* Complete javadoc, add modid filter and misc fixes/cleanup.

* Minor fixes.

* Renames and misc changes.

* Strict validation fixes.

* Apply suggestions from code review

Co-authored-by: Shnupbups <shnupbups@gmail.com>

* Update fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/FabricDataGenerator.java

Co-authored-by: Shnupbups <shnupbups@gmail.com>

* Update fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/FabricDataGenerator.java

Co-authored-by: Shnupbups <shnupbups@gmail.com>

* Review fixes.

* Set generated dir as resources not sources.

Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com>
Co-authored-by: Shnupbups <shnupbups@gmail.com>
2021-12-03 13:35:29 +00:00
shartte
0f02669fd0
Restored the state of the biome api to what it was during the snapshots. Migrated from accessors to AWs. (#1834) 2021-11-16 18:45:37 +00:00
modmuss50
2e160e0f26 1.18-pre1: without the biome api 2021-11-11 19:01:49 +00:00
Juuxel
d2f76b0fdf Add tag-based mining level API, fix and deprecate FabricBlockSettings.breakByTool (#1629)
* 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
2021-11-05 15:50:11 +00:00
shartte
f83e2d93ab
Forgot to include biome-api (#1735) 2021-09-21 12:51:53 +01:00
modmuss50
5553aff888 21w37a: Compile pass 2021-09-17 18:42:42 +01:00
modmuss50
fe42ded042
Fabric Game Test API (#1622)
* 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>
2021-08-31 13:59:35 +01:00
Technici4n
c09be4c48a
Fabric Transfer API: "fluid only" edition (#1356)
* 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>
2021-07-12 18:28:33 +01:00
actuallyasmartname
14efdf6ee6
Add missing metadata to dimensions api, remove JCenter (#1428) 2021-04-25 20:29:06 +00:00
Technici4n
f995ab4233 Fabric API Lookup (#1234)
# Fabric API Lookup API v1
## Introduction
This module allows Api instances to be associated with game objects without specifying how the association is implemented. This is useful when the same Api could be implemented more than once or implemented in different ways.

Many thanks to @Grondag for providing the original concept (#1072).
Thanks also go to @i509VCB, @Pyrofab, @sfPlayer1 and the others who were involved with the design of this module.

This is the foundation upon which can be built for example a fluid transfer api (#1166). Closes #1199.

## Flexible Api Querying
## Block Api Usage example
## Building blocks
This PR was changed a lot, please have a look at the README, the package info, and the javadoc for `BlockApiLookup` and `ApiLookupMap` for up-to-date documentation.

## More usage examples
FastTransferLib (https://github.com/Technici4n/FastTransferLib) is an experiment to build an item, fluid and energy transfer api on top of this module. (Which was until recently called `fabric-provider-api-v1`.)

## Missing things?
~~I could add an overload of `BlockApiLookup#find` with nullable `BlockState` and `BlockEntity` parameters, so that the caller can directly provide them if they are available for some reason.~~ Added in later commits.

There is no module to retrieve apis from items or entities yet because there were unsolved issues with those. The community can use the provided building blocks to experiment with their own implementations of `ItemStackApiLookup` and `EntityApiLookup` until the way forward becomes clear, but let's please not delay the `BlockApiLookup` because of that.

Co-authored-by: i509VCB <git@i509.me>
Co-authored-by: PepperBell <44146161+PepperCode1@users.noreply.github.com>
(cherry picked from commit dc716ea167)
2021-03-08 20:35:40 +00:00
i509VCB
9af2c302f9 Screen API v1 (#645)
* Implement screen api

* Actually update to 20w27a

* Split render and tick events to before and after

* Rename and update

* A bit of javadoc and profiler name fixes

* Add functional interface annotations, move render and ticking events to actual FabricScreen instance.

* Add after screen resize event

* Implement key and mouse click/press and release events.

* Move keyboard and mouse events to their own pojos

* Init and resize are the same thing. Maybe Screen#init needs a rename

* Add mouse scroll events

* checkstyle

* Refresh event instances after init

* Before init is nessecary to listen to addition/removal of child elements

* Polish up the javadoc and do a rename to the public api interface.

* Mappings updates on testmod

* javadoc formatting again

* Rework screen api design to be more ergonomic.

* Add remove event, some javadoc

* Add allow phase

* Module dependencies

* Fix null ticking when no screen is open

* Refer to GLFW constants in mouse click/release events

* Keyboard event GLFW constant javadoc

* Remove redundant qualifier

* Some docs, degetterifying

* Because global go brr add screen params back around

* Add module lifecycle to FMJ

(cherry picked from commit 8e23c1d877)
2021-01-25 18:19:58 +00:00
i509VCB
1d561d2678 Entity Events v1 (#957)
* Entity Events v1.

First up is an event fired after a living entity is damaged. All vanilla living entities except armor stands work with this event.

* Events related to killing of entities, changing world, player respawn/copyFrom

Death related:
an entity killing something and an entity being killed by an adversary

Player related:
After respawn, copy to

* Adversary stuff isn't needed

* checkstyle again

* Call AFTER_KILLED_OTHER on a ServerPlayerEntity upon death.

* Add event which is fired when a player first joined a server and add functional interface annotations

* Update build.gradle

* mispelled

* Some renames, test events, drop damage event

Damage events need further consideration in future

* Comments and null check

* Update for mappings

* Warning comment

* Remove first join event and teleport helper

First join does not work atm and teleport is in dimensions pr

* Module dependencies

* Javadoc tweaks

* The serverening

(cherry picked from commit 79b23bee5b)
2020-12-30 17:10:56 +00:00
i509VCB
fd11873744 Fabric Networking API V1 (#1081)
* Networking api v1

Some final docs?

Licenses and testmod

Fix a bunch o imports and make things work for v1 (v0 is bork)

Make the testmod pass checkstyle and work

Docs for v1

* Deprecate v0 and implement using v1

* Drop files down one package due to package check error

* Fix issue with channel registration, add another testmod

* jaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaavadoc

* Make javadoc use `code`, move impl interface to package access

* this things

* Rename a few internal methods

* Mark all client side stuff client only, move client mixins

* Add null checks around the place, clarify some javadoc and method names

* Make FutureListeners uninstantiable

* Some internal nullable annotations

* An impl class I forgot to rename

* Some comments and clarify some client login handler javadoc

* Add a missing FunctionalInterface annotation

* Split play and login, move client stuff to right package

* No interface left behind

* Inline channel registries in api

* Login and play subpackages not needed

* Add helper method to create play custom packets

* hasGlobalChannel -> hasGlobalReceiver

* Just rename the collection method for now

* Inline PlayPacketSender into static methods

* Start on testmod idea for verifying dynamic registration

* Add client login events

* You don't say hello when talking to yourself.

Also more testmod stuff

* Make event names present tense

* Some javadoc and impl interface rename

* Change the test keybinding

* Begin working on dynamic reg

* Dynamic reg works, just need a lot of cleanup and reimpling global

* A few renames, readd global methods

* Try to reduce the amount of duplicate registration logic

* Reimplement dynamic accessors

* More impl

* Start reimplementing global receivers. Still very hacky solution.

* Reimplement some server global reciever stuff

* Add login init event for server login.

* Implement client login query start event

* Move event invocations into addon, don't dual register global recievers

* Finally reimplement global recievers for all networking phases

* A revelation: Send packets properly

This also finds the issue with screen getting the proper S2C channels, current on TODO list.

* Disconnect event does not need a packet sender

* Clarify, add methods to get channels net handler can recieve on client

* Unregister actually works now

* Bunch of null checks, add simpler login delay test for vanilla clients

* Add some debug logging entries, fix unregister on client's session reg

* Play channel event javadoc and rename login query handlers

* More channel -> channelName

* thisening

* Introduce the basics infrastructure for tracking global receivers

* Add more substantial javadoc to login connection events

* Javadoc, reimplement unreg methods on v0, 1 impl fix

* Implement tracking for global recievers

* Dont forget to start tracked sessions in 3/4 cases

* Global receiver docs and move methods in classes

* Complete null checks

* big boi javadoc part 1

* Finish the main javadoc, usage javadoc is left

* Set so has method is not needed

* Rename receiveable and sendable methods

* Add the two missing private ctors

* buildscript update to upstream

* Split out player finding stuff to networking player tracking API v1

Signed-off-by: liach <liach@users.noreply.github.com>

Forward v0 PlayerStream to new module, add entity track events

Rename module to player tracking

Well javadoc can make sense

Decide on tracking for the name

Update fabric-player-tracking-api-v1/src/main/java/net/fabricmc/fabric/api/networking/player/tracking/v1/package-info.java

Co-authored-by: Erlend Åmdal <erlend@aamdal.com>
Remove exceptions from javadoc that are not thrown

javadoc fix again

Handle a case where the player manager happens to be null

rename player tracking to player lookup

Yeet

* Cherrypick #1092

* Remove some redundant client networking methods, rename `(un)register` to `(un)registerReceiver`

* Simplify access to dynamic reg on client

* Param shifting, let users get sender.

* Warning about time and distance units

* Make sure these are client only

* Fix control flow in ClientPlayNetworking#send

* Correct example code javadoc

* javadoc correction in server login

* Put login delay tests behind system property

Also remove unnecessary junk added by old module that was merged together.

* Fix ordering so channel registrations during `PHASE`_INIT work

* Fix prod bug and an oversight

* Fix login when connecting to dedicated server

* Update registry sync to v0 to prevent issue with reg sync hanging client

* this is done
2020-12-09 18:49:22 +00:00
Waterpicker
bbf4c01986 Update the Dimension API (#1172)
* Reimplement Dimension API

* Forgot to update dimension-api mixins.json

* Did suggested changes.

* Move Nullable import.

* Remove unneeded whitespace

* Added automatic testing testmod feature.

* ...Removed unused imports...

* And other stuff the auto style system complains about...

* ...

* Drop Networking

* Completed suggested changes.

* Revert "Completed suggested changes."

This reverts commit 97740e6134.

* Did requested changes.

* Forgot colon

* Turn plural to singular

Co-authored-by: i509VCB <git@i509.me>
2020-11-28 19:50:27 +00:00