Commit graph

37 commits

Author SHA1 Message Date
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
shartte
c29459abaf
Ported 1.16.1 biomes-api-v1 to 1.16.2 (#1053)
* Ported 1.16.1 biomes-api-v1 to 1.16.2.
Public API changes:
- Removed flagging biomes as suitable for player spawns since that is now handled in the Biome Builder.
- Changed API over to RegistryKey's, not because it's necessary, but because it is more ergonomic since Vanilla Biomes in BuiltInBiomes are now all exposed as keys, rather than instances.

* Changed to CheaterCode's mixin for modifying the nether biomes, saving us one accessor.

* Move Bonanza

* Finished moving and updating of the module, added experimental markers.

* Adjusted experimental notes.

* Finished rename from biomes-v1 to biome-api-v1

* Reverted memory settings in preparation for loom-0.5
2020-09-18 18:11:51 +01:00
Joseph Burton
516ece7c6e
Structures API (#917)
* Initial structures API implementation

* Improve generics + add a superflatFeature helper method

* Initialize StructuresConfig class early to prevent its assertion failing

* Add a testmod

* Documentation and null assertions

* Apply review suggestions

* Update fabric-structure-api-v1/src/main/java/net/fabricmc/fabric/api/structure/v1/FabricStructureBuilder.java

Co-authored-by: shartte <shartte@users.noreply.github.com>

* Apply review suggestions

* Update to 1.16.2

Co-authored-by: shartte <shartte@users.noreply.github.com>
2020-08-21 17:22:57 +01:00
modmuss50
91555cd1f0 1.16.2-pre2 - no biomes for now 2020-08-05 20:00:37 +01:00
i509VCB
d532d74b83
Create Game Rule API (#641)
* Create GameRule API

* Some tweaks

* gamerule -> game-rule

* Fix translation keys and update to 20w22a

* Command results and remove unnessecary factory method

* Update to 1.16-pre1

* Update fabric-game-rule-api-v1/src/main/java/net/fabricmc/fabric/api/gamerule/v1/FabricRuleTypeConsumer.java

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* I like final things

* Update to 1.16-pre3, change enum button style

* checkstyle

* use right min values

* Document ValidatableRule

* Document LiteralRule, clarify generics

* Update to 20w27a

* Rename some parts to compensate for future yarn renames.

Flatten some logic related to EnumRules

* forgot one

* javadoc galore

* finish javadoc

* Start things

* Update to 20w29a, drop float rule

* Make cycle naming more accurate

* Convert colors to hex

Co-authored-by: Erlend Åmdal <erlend@aamdal.com>

* Update to 20w30a

* imports again

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
Co-authored-by: Erlend Åmdal <erlend@aamdal.com>
2020-07-24 16:25:09 +01:00
Draylar
08834d9e76
20w28a Biome Module fixes (#874)
* 20w28a biome module fixes

* update version to 0.3.0

* major version bump to 1.0.0

* Update mappings

* Fix nether biome test's

* Fix nether biome's on the server
Closes https://github.com/FabricMC/fabric/issues/861

* Accessor name changes

Co-authored-by: modmuss50 <modmuss50@gmail.com>
2020-07-09 22:49:30 +01:00
modmuss50
35e08e3387 20w28a - no biomes or dimensions 2020-07-08 19:31:01 +01:00
i509VCB
16acbe5bfd
Lifecycle Events V1 [1.16] (#681)
* Lifecycle Events V1 (1.16)

Now includes Chunk and (Block)Entity (un)load events

(cherry picked from commit 82b372873fd930dd07768331f7b70f6f9d3d441d)

* Move around code to work on 1.16

* Checkstyle

* Remove primary server getters

(cherry picked from commit c84f36209d)

* IJ DO YOU SPEAK RESOLVING IMPORTS

* Prune the tests that shouldn't exist

(cherry picked from commit a5112223ca)

* Listen here checkstyle you bugger

* Split up events to individual interfaces. Make Chunk events use WorldChunk instead.

(cherry picked from commit 3431c0d894)
2020-06-25 22:28:21 +01:00
Juuxel
045df74fe0
Screen handler API (#584)
* Add screen handler API

* Use more descriptive letters for FabricHandledScreens generics

* Add missing Deprecated annotations

* Bump fabric-containers-v0 version

* Remove unused ServerPlayerEntityAccessor

* Remove [Fabric] from log messages

* Convert FabricHandledScreens to a class

* Add dependency on networking-v0

* Resolve threading issues with NetworkingClient

* Use Identifiers instead of int IDs, make ScreenHandlers a class

Also added a private constructor to FabricHandledScreens.

* NetworkingClient -> ClientNetworking

* Use more descriptive names for injections

* Use ID parameter instead of fetching again

* Add clarifying comment

* Port changes from FabLabs

* Fix compilation

* Replace the content of links in FabricHandledScreens for readability

* Sync with FabLabs

* Add test mod

* I suppose IInv shouldn't have CC0 anymore 👀

* Improve logging

- Networking now uses a logger instead of an exception
- The loggers are now suffixed with their side
- Fixed the client unregistered screen message using the title instead of the ID

* Fix test mod on 20w21a

* Fix ExtendedScreenHandlerFactory javadoc referencing old names

* Update test mod to 1.16-pre2

Just a simple mapping update. :)

* Fix incorrect javadoc references to screen-handler-api in containers-v0

* Remove Minecraft exclusion from build.gradle (thanks to Loom 0.4) + testmod change

Resource loader v0 is now testmodRuntimeOnly as it's not needed for compiling.
2020-06-15 22:00:54 +01:00
shedaniel
3fa9f7c5f8 migrate to fabric-keybindings-v1 and remove builder (#615)
* Edited Clone of #244
- Fixed checkstyle issues
- Migrated to fabric-keybindings-v1
- Removed sticky keybindings from #244 as it sounds useless and you can just around it by simply adding that functionality yourself, I might add it back if someone can tell me the advantages of sticky keys except bloat
- Added a test mod
- Added FabricKeyBinding#getBoundKeyOf for getting vanilla bound keys with ease
- Renamed `registered` to `automaticallyRegister` as that is more of a better name
- Added a couple Objects.requireNonNull validations

* Add back StickyFabricKeyBinding as it is in vanilla, did not notice.

* Remove extra "key."

* Bump to 1.0.0

* build().register()

* Remove `register()`

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Fix test

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Rename module

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Fix checkstyle violation

Signed-off-by: shedaniel <daniel@shedaniel.me>

* major refactor

Signed-off-by: shedaniel <daniel@shedaniel.me>

* revert some stuff

Signed-off-by: shedaniel <daniel@shedaniel.me>

* fix build

Signed-off-by: shedaniel <daniel@shedaniel.me>

* major stuff

Signed-off-by: shedaniel <daniel@shedaniel.me>

* fix license, of course

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Add resource loader v0

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Let's not break the api.

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Rename to buildAndRegister

Signed-off-by: shedaniel <daniel@shedaniel.me>

* resolve reviews

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Use GLFW

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Dump the builder entirely

Signed-off-by: shedaniel <daniel@shedaniel.me>

* Rename to Key Binding

Signed-off-by: shedaniel <daniel@shedaniel.me>
2020-06-12 11:20:31 +01:00
modmuss50
a71b3053ad
Rework Dimensions for 1.16 (#627)
* dim api initial port

* A whole bunch of work

* Checkstyle :)

* Minor tweaks based on feedback

* Update to latest snapshot

* Checkstyle ;)

* Some more dim work

* Re add default placer's, the example mod includes a test dim that currently marks the world as experimental

* license

* Fixup javadoc
2020-06-11 11:38:38 +01:00
modmuss50
4a08d6b285 20w21a initial port 2020-05-20 19:39:37 +01:00
i509VCB
c38e8d9e1e
Object builders v0->v1 migration (#537)
* Migrate object builders from v0 -> v1

* Port entity attribute registry to v1
2020-04-29 22:48:08 +01:00
i509VCB
52d30836ba Migrate commands to v1 (#539)
* Migrate commands to v1

* Update fabric-commands-v1/src/main/resources/fabric.mod.json

Co-Authored-By: liach <7806504+liach@users.noreply.github.com>

* Update fabric-commands-v1/src/main/java/net/fabricmc/fabric/api/command/v1/CommandRegistrationCallback.java

Co-Authored-By: liach <7806504+liach@users.noreply.github.com>

* commands -> command and improved javadoc.

* Fix the stragglers

* swap dedicated and dispatcher params

* Update fabric-command-v1/src/main/java/net/fabricmc/fabric/api/command/v1/CommandRegistrationCallback.java

Whoops forgot that one

Co-Authored-By: Juuxel <6596629+Juuxel@users.noreply.github.com>

* module name order has been restored.

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
2020-04-29 22:15:05 +01:00
Meredith Espinosa
b764ce9905 fabric-mining-levels-v0 -> fabric-tool-attribute-api-v1 (1.15 edition) (#460)
Moves the ToolManager and tool tags declared in fabric-mining-levels-v0 to a new fabric-tool-attributes-v1, along with adding new interfaces to be implemented on tools so that mining speed, mining level, and entity attribute modifiers can be decided by the itemstack.
2020-04-22 09:49:29 +02:00
shedaniel
5341049050 fabric-rendering-v1 module & added HudRenderCallback (#359) 2019-12-28 15:29:04 +00:00
grondag
32ac36d518
1.14 Updates and Render Fixes (#394)
* Fix EntityRenderDispatcher hook (again)

* Add fabric-particles-v1

* Add a sync() method to BlockEntityClientSerializable

* Prevent CME due to off-thread block entity updates (#367)

* Restore rendering features disabled in first 19w39a release

* Remove rendering stuffs no longer needed due to snapshots

* Bump versions as needed
2019-09-29 18:21:38 -07:00
Modmuss50
9c45b1ef78 Wip 19w39a (#386)
* 19w39a fixes (#387)

* Bump versions

* Breaks: BlockEntityRendererRegistry and EntityRendererRegistry

* Remove broken parts of rendering, bump major version

* Add renderer-registries, replaces broken parts of rendering api

* Slap a band-aid on renderer/Indigo - won't render properly, but runs

* Bump distribution versions, add renderer-registries to main build

* Clean up blockrenderlayer implementation package name
2019-09-28 18:07:04 -07:00
grondag
96946203be
Bring dimension API to 1.15 branch (#373)
* Update versioning to match 1.15 branch

* Fix builtin mods being added as resource packs

* Update fabric-loader to replace deprecated methods

* Add more metadata to the modules (#353)

* Add fabric-api-base as a dep to fabric-networking-v0

* Allow for running fabric-api-base on the server-side environment (#360)

* Set curse version to 1.14.4
Also forces it to build again

* Fix NPE in fluid renderer mixin (#361)

* Fix NPE in fluid renderer mixin
* Ensure state, view, and pos are never null
* Bump fabric-rendering-fluids-v1 version

* Cooler dimension API, #309 (#319)

* pyro API

* Update fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/EntityPlacer.java

clarify portalDir param

Co-Authored-By: Pyrofab <redstoneinfire@gmail.com>

* Update fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/EntityPlacer.java

rename & clarify verticalOffset param

Co-Authored-By: Pyrofab <redstoneinfire@gmail.com>

* Update fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/FabricDimensions.java

Co-Authored-By: Pyrofab <redstoneinfire@gmail.com>

* Update fabric-dimensions-v1/src/main/java/net/fabricmc/fabric/api/dimension/EntityPlacer.java

Co-Authored-By: Pyrofab <redstoneinfire@gmail.com>

* update parameter

* Add fabric-networking and fabric-registry-sync to dependencies

* Refactor FabricDimensionType to use a builder

Also adds a desiredRawId field separate from the actual raw
id fixed internally. The fixedRawId field is now set by
DimensionIdsFixer through reflection.
This change addresses concerns about the ability for any mod
to set a FabricDimensionType's raw id at any time.

* Improve javadoc of FabricDimensions#teleport

* Add an overload for FabricDimensions#teleport

* Update javadoc on DimensionIdsFixer

* Inline clientside packet handling

* Add side assertions to FabricDimensions#teleport

* Nuke minecraft's attempts to overwrite bad level properties

* Add license headers

* Reformat dimension API source code

* Update FabricDimensionType javadoc

* Remove redundant ThreadLocal from FabricDimensionInternals

* Fix crash on dedicated servers

* Fix Illegal Access during remapping

* Fix dimension remap exception propagation

* clarify EntityPlacer docs

* spacing fixes

* api.dimension -> api.dimension.v1

* Increment API patch version

Signifies inclusion of new Dimension API

* Partial fix to FabricDimensionType

* Bump dimension version

* Updates based on feedback
2019-09-22 08:32:08 -07:00
grondag
d2ac651a7a
19w38b API Fixes (#370)
* Fix compilation errors (untested)

* Random fixes

* Various modded rendering fixes

* Restore contract of RenderAttachedBlockView

* Bump versions as needed

* Add API for BlockRenderLayer

* Minor format / name cleanup

Will do a more comprehensive pass as part of separate refactor PR

* Bump versions not handled earlier

* Bump loader/mc bounds for dependent modules

* Update fabric-blockrenderlayer-v1/src/main/java/net/fabricmc/fabric/impl/blockrenderlayer/v1/BlockRenderLayerMapImpl.java

Co-Authored-By: liach <7806504+liach@users.noreply.github.com>

* Update fabric-blockrenderlayer-v1/src/main/java/net/fabricmc/fabric/impl/blockrenderlayer/v1/BlockRenderLayerMapImpl.java

Co-Authored-By: liach <7806504+liach@users.noreply.github.com>

* Minor clean ups

* Improve docs, minor format corrections.

* Update MC dependency
2019-09-20 16:50:49 -07:00
modmuss50
d32291da65 Fix resource-loader 2019-09-18 23:24:15 +01:00
modmuss50
9c15c890d1 Update mappings 2019-09-18 19:01:22 +01:00
valoeghese
896c7fbb2d Fabric Biomes API (#200)
Co-authored-by: Prospector <prospectordev@gmail.com>
Co-authored-by: coderbot16 <coderbot16@gmail.com>
2019-07-03 20:53:42 +02:00
Juuxel
05f11b75e4 Loot table manipulation API (#160) 2019-06-09 21:47:28 +02:00
Adrian Siekierka
02a46d5b29
[#65] Renderer API + Indigo (#189)
Big thanks to Grondag and Player for all the pain and trouble we all went through.
2019-05-18 22:25:27 +02:00
asie
76d184ea21 [#111] fluid rendering hooks 2019-05-17 23:28:03 +02:00
Adrian Siekierka
f16189181b final module name refactor prior to release, hopefully 2019-05-11 23:48:33 +02:00
Adrian Siekierka
6d9076e392 fabric-client-registries -> fabric-keybindings, fabric-rendering-hooks 2019-04-27 22:05:18 +02:00
Adrian Siekierka
99acb0615e build to fabric-api 2019-04-24 19:15:08 +02:00
asie
f162522ac7 rename: -> fabric-item-groups 2019-04-24 00:27:12 +02:00
Adrian Siekierka
26bd1b52fa push correct settings.gradle 2019-04-24 00:56:30 +02:00
Adrian Siekierka
e546c30ba0 fix build, update to 1.14 release 2019-04-24 00:51:01 +02:00
Adrian Siekierka
dff44ec84f [#148] Migrate to a modular JAR-in-JAR system, update to Loader 0.4.x 2019-04-24 00:47:39 +02:00