Skip to content

Commit

Permalink
Move bow module to extension module
Browse files Browse the repository at this point in the history
* PR Policy (QuiltMC#39)

* Create QSL PR Policy

* Update CONTRIBUTING.md

* Clarify, add exemption for trivial fixes

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Item Setting API module (QuiltMC#18)

* Port item api

* Fix some missed issues in item api port

* Add item group api

* Update library/items/item-group/src/main/java/org/quiltmc/qsl/itemgroup/impl/QuiltCreativeGuiComponents.java

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* Update library/items/item-group/src/main/java/org/quiltmc/qsl/itemgroup/mixin/client/CreativePlayerInventoryGuiMixin.java

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* Add qsl$ prefix to mixin methods, fix some naming, and change ItemGroup builder api

* Make it so that appending stacks doesnt remove items added via their settings

* Custom Item Settings and Recipe Remainder API (#1)

* Add support for custom item settings

* Add recipe remainder API

* Some renames. Thanks to @Platymemo for helping with the ports

* Make some changes to QuiltItemGroup extensions

* LambdAurora's new suggestions

* Remove Item Group API

* Clean up some of the item setting code. might be good, might be bad, especially the recipe remainder stuff, please review

* Moved to `item` from `items`

* Update library/item/item/build.gradle

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* temp commit

* nuke remainder API

* Cleanups

* Move into clearer `item_setting` module and javadoc fix

* Merge in 1.18

* @TheGlitch76's suggestions

* itemsetting -> item.setting, fix mod manifest.

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>
Co-authored-by: Whangd00dle <67663207+Platymemo@users.noreply.github.com>

* Update to 1.18.2-rc1.

* Update to 1.18.2.

* Port and rewrite Tag API to 22w06a. (QuiltMC#76)

* Port and rewrite Tag API to 22w06a.

* Fix mod manifest with Gradle process resources.

* Remove loom interface injection on TagKey.

* Make TagRegistry a final class.

* Apply suggestions from code review

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Update library/data/tags/src/main/java/org/quiltmc/qsl/tag/api/TagType.java

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Apply more javadoc suggestions.

* Update to 22w07a.

* Add InjectedInterface annotation.

* Improve TagTypes documentation.

* Update library/data/tags/src/main/java/org/quiltmc/qsl/tag/api/QuiltTagBuilder.java

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Add TODOs.

* Update tag API to 1.18.2-rc1.

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Fix critical issue in resource loader: bad remap property.

* Registry Module/Events (QuiltMC#38)

* Add basic registry entry add event

* Refactor tests, add registry monitor (a more advanced alternative to the registry event)

* Move packages to match the organization of other modules, add the ability to chain filters for registry monitors

* Use "this." to clarify some method calls in RegistryMonitor

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* Very experimental changes in order to ideally speed up registry iteration, potentially assisting with monitoring larger registries

* Document classes

* Clean up docs, prefix accessor method in SimpleRegistryAccessor

* Follow Javadoc conventions

* Mark impl classes as ApiStatus.Internal, use inline return JD tags for getter methods

* Fix doc and update to new module naming

* Update to 1.18, add icon

* Tweak and update to 22w06a.

* Improve RegistryMonitor test.

* Update library/core/registry/src/testmod/java/org/quiltmc/qsl/registry/test/RegistryLibMonitorTest.java

Co-authored-by: Eli Orona <eliorona@live.com>

* Improve javadoc and change injection point for registry event storage.

* Update library/core/registry/src/main/java/org/quiltmc/qsl/registry/api/event/RegistryEntryContext.java

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Improve documentation.

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>
Co-authored-by: LambdAurora <email@lambdaurora.dev>
Co-authored-by: Eli Orona <eliorona@live.com>
Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Fix registry module mixins.

* Migrate to quilt-gradle-licenser.

* Update mappings.

* Fix MC-197259. (QuiltMC#84)

* Update licenser plugin.

* Update Quilt Gradle Licenser plugin to ensure license checks.

* Fix QuiltMC#85.

* Fix registry monitor with registration in 1.18.2, fix Block.asItem() … (QuiltMC#89)

* Fix registry monitor with registration in 1.18.2, fix Block.asItem() with modded.

* Apparently syncing failed.

* More consistent behavior.

* Typo and anchor fixes in CONTRIBUTING.md (QuiltMC#92)

* Fix ordering issue in RegistryMonitor#forAll.

* Make RegistryMonitor#forAll implementation slightly cleaner.

* Make resource pack streaming flattened. (QuiltMC#93)

* Make resource pack streaming flattened.

* Use mapMulti instead of flatMap.

* Fix CONTRIBUTING.md formatting.

* Dimension API (QuiltMC#91)

* Worldgen dimension API

* Javadocs

* copyright header

* relocate mixin

* Port test command for players

* Make the test mod not fill up my logs

* add newline after license...

* Address comments

* Nice catch

* Make testmod depend on resource_loader

* Don't spawn end portal underneath players' feet

I forgot to port this one from fabric

* Address comments

* oops

* Command module: add server-side argument types (QuiltMC#68)

* Command module: add server-side argument types

Basically an almost-direct port of the Colonel API (https://gitlab.com/stellardrift/colonel), minus syncing stuff (which requires networking, and such depends on QuiltMC#34).

* Add Colonel licenses to all files sourced from Colonel

* Add enum argument type

This functions as a test of the ServerArgumentType API, and is also pretty convenient, IMO
The serializer leaves much to be desired, though...

* EnumArgumentType: rewrite to make less horrible

* EnumArgumentType: add translation for "unknown value" exception

* EnumArgumentType: add sanity checks

* Implement known argument type syncing

* license

also add missing ApiStatus.Internal annotations

* ID -> identifier

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* EnumArgumentType: add javadoc

add EnumArgumentType.getEnum to match other ArgumentType classes

* ServerArgumentTypeImpl: use spaces for record definition indentation

there, now it doesn't look godawful on GitHub

* Move PreLaunchHacks, add server arg testmod, fix up some issues.

* EnumArgumentType: unclunkify vanilla support notice

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* CommandManagerMixin: add details to Colonel section

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* PreLaunchInitializer: add note to remove once QLoader is targeted

* Initializers: log networking support status

* EnumArgumentType: getEnumConstant: verify enum class

enumConstant: cache returned arg types

* ServerArgumentTypes: don't resend commands unless known argument types have changed

* [NOT WORKING] Sync known argument types earlier to avoid resending command tree

...yeah I somehow broke it
I have no idea how or why, but Vanilla clients can't connect now because they end up parsing a bad identifier somewhere

KnownArgTypesSync: Vanilla clients now get empty set instead of set being null

* [IT WORKS NOW] restore FMJ changes

this indirectly caused Vanilla clients to not be able to connect...
because when Minecraft fails when serializing an argument type, *it sends an empty identifier*, which the client promptly chokes on.
(MC fails to serialize an argument type if it's not registered - and the code that registers EnumArgumentType wasn't running because
I accidentally ran over the FMJ file.)

Great job, Mojang.

* Fix getEnumConstant.

* Reformat ServerArgumentTypeImpl

Co-authored-by: William Bradford Larcombe <william@williambl.com>

* Make local capture fail hard

Co-authored-by: LambdAurora <email@lambdaurora.dev>
Co-authored-by: LambdAurora <aurora42lambda@gmail.com>
Co-authored-by: Glitch <glitch.g3431@gmail.com>
Co-authored-by: William Bradford Larcombe <william@williambl.com>

* Add a method for quick registration in RegistryEntryContext. (QuiltMC#90)

* Add a method for quick registration in RegistryEntryContext.

* Apply suggestions from code review

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Swap out primary suggestion.

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Fix code style issues.

* Migrate to Quilt Loader, auto-generate `quilt.mod.json` (QuiltMC#78)

* Use Quilt Loader

* use the right loader version

* qmj generation experiment

* Finish converting modules to the new system

* band-aid fix for dependencies

* Fix build on case-sensitive filesystems

* Start using release version of Loader

* Add QslModuleExtension as an API

* Some fixes

* Update build.gradle

Co-authored-by: Eli Orona <eliorona@live.com>

* Apply suggestions from code review

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* Restore setupModuleDependencies method

* Prepare for merge!

* update loom

* more fixes

Co-authored-by: Eli Orona <eliorona@live.com>
Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* Add missing entrypoint

* Use Quilt Loader's ModContainer and compile.

* Fix build + hopefully fix access widener bug

* Fix sending garbage to the quilt maven

* Fix publishing some more

Fix publishing some more

* Fix oversights in QMJ dependency declaration

* Fix misdeclaration of entrypoints in tooltip module.

* Fix QSL in production.

* Fix icon of QSL parent mod.

* QSL Versioning, initial draft (QuiltMC#96)

* versioning draft

* Change main artifact to `org.quiltmc:qsl` to match libs...

...remove hashes, fix bad merge

* Don't worry about handling snapshot builds for now

* Fix the publish action

* Recipe API (QuiltMC#77)

* Recipe API.

* Add package-info.

* Reword last sentence in package-info.

* Update library/data/recipe/src/main/java/org/quiltmc/qsl/recipe/impl/RecipeManagerImpl.java

Co-authored-by: ADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Eli Orona <eliorona@live.com>

* Split up big classes, move a bit more to implementation, fix a lot of wording.

* Apply suggestions from code review

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Clarify javadocs and fix some issues.

* Update library/data/recipe/src/main/java/org/quiltmc/qsl/recipe/api/RecipeManagerHelper.java

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Add missing QuiltRecipeSerializer implementations and add warning in dev env.

* Port to Quilt Loader stuff.

Co-authored-by: ADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>
Co-authored-by: Eli Orona <eliorona@live.com>
Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Fix buildscript and javadoc.

* Update version.

* Fix a minor QMJ issue and fix a forgotten reference to FabricLoader.

* Fix testmods not using QMJs, and fix crash report mod list order.

* Registry Entry Attachment API (QuiltMC#29)

* Registry Item Attributes API

Half-completed code-based path, no data-based path yet

* Get data-based path working

* Make resource reloader async

Values are now deserialized during the load phase rather than the apply phase to allow for better error messages

* Implement code-based path for setting attributes

Attributes set via code are "built-in", and are always overriden by values set via data

* Added methods for common attribute types

* Add comments so the code is less... uh, dense

* Spaces and braces

* god I suck at organizing code

* Initial package-info

* Add dispatched utilities

Misc style/JD fixes

* Item -> Entry, part 1

* Item -> Entry, part 2

* Item -> Entry, part 3

* Rename QuiltRegistryInternals methods to be less confusing

* Stick combined attribute holder in RegistryMixin

* i5 review

package-info: Add example for attribute map file
BuiltinRegistryEntryAttributeHolder: Remove explicit super call

* L I C E N S E

* Update library/data/registry-entry-attributes/src/main/java/org/quiltmc/qsl/registry/attribute/api/package-info.java

Co-authored-by: BasiqueEvangelist <basiqueevangelist@yandex.ru>

* Basique review

DispatchedType: type is now an Identifier
RegistryExtensions.registerWithAttributes: returns registered entry
Removed EmptyRegistryEntryAttributeHolder, since Combined works if both are null
Replace dumb Table.rowMap().get() with Table.get()
package-info: Extended data-driven example
RegistryEntryAttributeReloader: namespace is no longer dropped from registry IDs
RegistryEntryAttributeReloader: catch exceptions from JSON parsing
Yeet BuiltinRegistryEntryAttributeHolder, instead registered attributes are stored directly in QuiltRegistryInternals/RegistryMixin

* RegistryEntryAttribute: add methods for String attributes

* CombinedRegistryEntryAttributeHolder: respect default value when both are null

* RegistryEntryAttribute.createDispatched: Use Function instead of Map

Using Map implies that it gets stored - which it doesn't (AFAIK, anyway)

* CombinedRegistryEntryAttributeHolder: Fix built-in value always being hidden by default value

* javadoc!

* forgot some C's

* remove useless null check

* package-info fixes

* RegistryEntryAttributeHolderImpl: Optimize table storage

Instead of mapping entry -> attribute -> value, it now maps attribute -> entry -> value
This makes it so that we have a lesser amount of large maps, rather than a greater amount of small maps

* I love Java generics

* Add RegistryEntryAttribute.getValue utility method

Also rename value type parameter to V because it makes sense in my ape brain

* All my homies hate RegistryKey

Attributes now store the registry they're attached to directly rather than its key
The attribute won't work if the registry isn't present, so using keys offers no advantage AFAIK

Also more of that "RegistryEntryAttribute<V>" refactor from last commit oops

* Forgot to refactor SimpleAttributeTest, oops

* Fix this embarrassing control flow error

* Add dispatched/polymorphic attribute test

* Forgot to upadte this method's JD

* fix indent

* Add command to dump builtin values

* RegistryEntryAttributeReloader: registry item -> registry entry

* license apply thing

* DispatchedType: fix JD link to createDispatched

* Apply suggestions from code review

Co-authored-by: i509VCB <i509vcb@gmail.com>
Co-authored-by: BasiqueEvangelist <basiqueevangelist@yandex.ru>

* Merge RegistryEntryAttribute and its implementation

* Clear up default vs no default attribute factory methods

* RegistryExtensions: Rename AttributeSetter to DefaultAttributesBuilder

* Fix null attribute holder if no attributes are registered for a registry

* Make type var javadoc a bit clearer

* SimpleAttributeTest: Fix impossible failure condition

* Fix attributes not being registered on creation

* Fix missing import here

* Forgot to update this, oops

* Improve DispatchedType JD

* Register our custom registry argument type

I have no idea if this is required or not since the game did run before I added this, but there seems to be validation for this, so...

* right, this should be a codec registry

* Add NotExtendable to AttributeHolder

* Hide RegistryEntryAttributeHolder as impl detail

* Nullable annotations

* RegistryExtensions.registerWithAttributes: fix JD

* Client-side attributes

* forgot to register attributes _again_

also removed link to impl interface

* Fix testmod package

* Fix common attribute values possibly being loaded from assets

* Fix assets attributes always being cleared

Add testmod
Yeet CombinedRegistryEntryAttributeHolder in favor of putting the behavior into RegistryEntryAttribute.getValue
Merge RegistryEntryAttributeHolder and its implementation

* Add missing javadoc

* DumpBuiltinAttributesCommand: dump to assets/data depending on side

* Update package-info.java

* Client testmod: remove dumb cast

Rename attribute

* DispatchedType: fix example snippet

* Use ResourceType instead of ambiguous boolean

* Add missing license headers

* a

* Mark impl classes as internal

* Split impl details from RegistryEntryAttribute

* Prevent attributes from being replaced

Add method to retrieve already-registered attribute

* Weaken typing here

* Convert test comments to javadoc

* Fix compilation

* Stick Internal annotation on attribute impl class

* Snakify folder name

* Snakify module name as well

(forgot it should be synced with folder name)

* Add missing value function

Remove default value getter from interface, it's an impl detail now

* Snakify this dependency

* Lock "dump builtin attributes" command behind system property

Add "-Dquilt.data.registry_entry_attributes.dumpbuiltin_command=true" to your run args to re-enable it

* Correct mixin prefix

* Don't use default value if missing value function is set

* RegistryEntryAttributeReloader: missing continue

* Use Boolean.getBoolean

* Fix up licenses

* Fix licenses AGAIN

* excuse me mr. backslash how tf did you get there

* murder spaces in licenses

* Make raw Javadoc easier on the eyes

* Add support for optional entries

* Remove Quilt Loader dependency

* Update Mixin compatability level

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* add a newline

* Prevent use of assets-based attributes on dedicated server

(technically they exist fine on it, they just never get a value since there's no assets reloader)

* Fix this check to not break everything oops

* limcensses

* Make reloader ID more descriptive

Make data and assets reloaders have different IDs

* Start working on tag support

* Pretty up AttributeMap a bit

License stuff

* Fix "dump builtin attrs" command

No longer always fails on dedicated servers if a client attribute is registered

* AttributeTarget.Tagged: abstract no more!

* checkstyle

* Add missing metadata to fabric.mod.json

* Fix up javadoc

* AttributeMap: make handleArray method less stupid

Rather than using an enhanced for loop AND keeping track of an index, just use a standard for loop you dingus

* Possibly implement tag support

This is completely untested!

* Rename to Registry Dictionaries API

* Redo "missingValueFunction"

* Propagate rename to Javadoc and logging, too

Actually rename the folder dict maps are loaded from (it was changed in the javadoc, but not in the code itself)
also rename a bunch of local vars

* Add test for tags

* Fix assets-based dicts not loading

Turns out you can't depend on tags loading for resource stuff...
New issue: can't reference data tags from assets since assets get loaded first

Fix SimpleDictTest

* FORGOT A LICENSE AAA

* Fix optional entries and tags

* Mark RegistryDict as non-extendable

* Make defaultValue and computeFunction explicitly mutually exclusive

* IDEA lied to me :(

* RegistryDict: add value class

For now, this is only used by RegistryDict.get

* if only applyLicenses wasn't broken

* fix buildscript

* DumpBuiltinDictsCommand: use Command module

remove custom RegistryArgumentType and use vanilla IdentifierArgumentType instead

* Sync v1

* limcensme

* specify config for compileOnly dep

* ComputeFunction: rename to DefaultValueProvider

use Result wrapper instead of exception for logic flow

* RegistryExtensions: rename registerWithDictValues to register

Add overloads to register to avoid clumsy builder-consumer

* Remove WrongValueClassException

* RegistryDictImpl: split

* RegistryDict: rename compute function in javadoc, too

* DispatchedDictTest: move inner classes to their own files

* Log4J -> SLF4J

* Update build.gradle

Use QSL Base's init entrypoints

* DumpBuiltinDictsCommand: Log4J -> SLF4J

* Fix tag support

DictMap: add type params
RegistryDictReloader, DictMap: Log4J -> SLF4J

* DictMap: remove resolved FIXME

* RegistryDict -> RegistryEntryAttachment

* DefaultValueProvider.Result: add explicit hasFailed flag

ComputedDefaultRegistryEntryAttachmentImpl: fix flipped if

* RegistryEntryAttachmentSync: consolidate all sync-related methods

Actually send sync packets (forgot to call an important method, oops)
Add Environment annotations to all client-only classes/methods

* Update minimum Minecraft version

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* ClientInitializer: move to client subpackage

* Convert registry entry attachments to Quilt Loader setup.

Co-authored-by: BasiqueEvangelist <basiqueevangelist@yandex.ru>
Co-authored-by: i509VCB <i509vcb@gmail.com>
Co-authored-by: LambdAurora <aurora42lambda@gmail.com>
Co-authored-by: LambdAurora <email@lambdaurora.dev>

* Bump versions.

* Fix a critical issue with registry entry attachments API.

* Remove cotton maven as unneeded now.

* Add missing InjectedInterface annotation on QuiltTagKey.

* Block access widening. (QuiltMC#104)

* Block access widening.

* Add block extensions README.

* Bump version.

* Fix issues with the recipe API. (QuiltMC#109)

* Fix issues with the recipe API.

* Fix some very minor issues with ShapedRecipeBuilder.

* Rename command library to management library. (QuiltMC#110)

* Bump version.

* Fix Transitive Dependencies at compile and runtime (QuiltMC#107)

* Fix transitive api dependencies not applying

* Update build-logic/src/main/java/qsl/internal/extension/QslModuleExtensionImpl.java

* missed some lines

* Documentation

* Screen API (QuiltMC#81)

* Screen Api

* Screen Api: Update fmj

* Screen API: Fixes

* Screen API: change "Screens" to an injected interface

* Screen API: Injected Interface fix and cleanup

* Update library/gui/screen/src/testmod/java/org/quiltmc/qsl/screen/test/client/ScreenTests.java

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

* Screen API: Fix fully qualified name

* Apply suggestions from code review

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Screen API: Most of Glitch's Review, and Pepper's Refactor

* Screen API: Fix build and broken quilt loader

* Apply suggestions from code review

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Screen API: Fix build and make changes from glitch's review

* Screen API: Use TriState and fix javadoc

* Apply suggestions from code review

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>

Co-authored-by: LambdAurora <aurora42lambda@gmail.com>
Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Update Loader; bump version

* Add a way to register new resource pack providers. (QuiltMC#87)

* Add a way to register new resource pack providers.

* Update library/core/resource_loader/src/main/java/org/quiltmc/qsl/resource/loader/api/QuiltResourcePack.java

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Attempt to temporarily fix loom's jankness.

* Fix testmod.

* Add InjectedInterface annotation.

* Add dummy display name implementation to avoid compilation issues.

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Bump version and clean up some leftovers.

* Fix Screen API crash and testmod.

* Fix QuiltMC#111: license headers match_from does not work properly on Windows.

* Fix missing spacing in build.gradle.

* Add better handling of Minecraft versions.

* Fix some minor inconsistencies and formatting in resource loader.

* Fix missing test entrypoint in resource loader.

* Fix crash involving Resource Loader's Overwrites (QuiltMC#113)

* Bump versions.

* hotfix: Fix jank in RenderLayersMixin. causing blocks to not render properly in certain situations

* Add missing null checks as asked from @OroArmor.

* Create a fat, remapped testmod jar (QuiltMC#114)

Remapped testmod jars that you can throw into your favorite launcher are created on the module, library, and root levels.
They are not published to maven, but can be downloaded through Github Actions

* Javadoc Improvements (QuiltMC#102)

* Add Minecraft javadocs and add combined javadocs

* remove println

* Create CODEOWNERS, update PR Policy (QuiltMC#119)

* Create CODEOWNERS

* Update CODEOWNERS

* Update CONTRIBUTING.md

* Revert to class init, change to lambdas (QuiltMC#116)

* "Fix" and polish the Quilt Screen API (QuiltMC#117)

Clean up and a tiny refactor on where it made sense on the Screen API (can't have breaking changes if the last few QSL releases are broken anyway), and also finally fixes a crash involving its injected interface. Unfortunately, the "fix" was to temporarily disable the injection until the refmap issues are no more

* Bump version.

* Activate GUI team

* [REA] Fix DefaultValueProvider.Result.error() (QuiltMC#121)

gosh darn it, past me - Leo, 2022

* Add better tag support to Registry Attachment (QuiltMC#106)

* Improve tag handling around Registry Attachment API

* Fix headers and some names

* Clean ups

* Fix some issues + clarity

* Apply suggestions from code review

Co-authored-by: Ennui Langeweile <85590273+EnnuiL@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ennui Langeweile <85590273+EnnuiL@users.noreply.github.com>

* Fix incorrect conditional

Co-authored-by: Ennui Langeweile <85590273+EnnuiL@users.noreply.github.com>

* Bump version

* Port Dimensions fast path + bug fix from upstream (QuiltMC#120)

* Port Dimensions fast path + bug fix from upstream

* Fix some checkstyle/license issues.

Co-authored-by: LambdAurora <email@lambdaurora.dev>

* Initial Port of Fabric Biome API (QuiltMC#94)

* Inital Commit - Testmod Acting Funky?

* Edit Test

* Remove Event Listener

Signed-off-by: peaceheis <69596656+peaceheis@users.noreply.github.com>

* Fix build.gradle for Biome API PR

Signed-off-by: peaceheis <69596656+peaceheis@users.noreply.github.com>

* fix build.gradle

* fix the fix

* fix the fixed fix

* Fix BiomeTest (Wrong ModContainer Import)

* Some Code Refactors

* Update build.gradle

* Hopefully last step in making Biome API build

Signed-off-by: peaceheis <69596656+peaceheis@users.noreply.github.com>

* Fix AccessWideners

* Fix Biome Fog

* Fix License

* Removed Wildcards

* Yeet FMJ for Biome API, fix BiomeTest wildcard

Signed-off-by: peaceheis <69596656+peaceheis@users.noreply.github.com>

* Last Minute BiomeTest fixes, add QMJ that works

Signed-off-by: peaceheis <69596656+peaceheis@users.noreply.github.com>

* Implement changes from Oro's Biome API Review

Signed-off-by: peaceheis <69596656+peaceheis@users.noreply.github.com>

* Variable naming changes

* more this.

* Fix Biome API Testmod QMJ

Signed-off-by: peaceheis <69596656+peaceheis@users.noreply.github.com>

Co-authored-by: zOnlyKroks <finnrades@gmail.com>
Co-authored-by: Glitch <glitch.g3431@gmail.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Ennui Langeweile <85590273+EnnuiL@users.noreply.github.com>

* Fix some small mistakes.

* Cleanup Biomes Modifications API javadoc.

* Run code auto formatter on all of QSL.

* Make mixin naming more consistent.

* Fix javadoc generation.

* Fix javadoc link in build.gradle.

* Update gradle wrapper and fix some header issues.

* Quilt Biome API Mixin Fix + Minor QuiltBiomeTest tweaks (QuiltMC#123)

* Update QuiltBiomeTest with minor tweaks

* Use Complete Descriptor in QuiltBiomes Mixin

* Backport 1.19 biome testmod tags.

* Bump version.

* Fix logic error in Recipe API addition phase.

* Rename a mixin in Tags API to reflect mapping names.

* REA: fix missing profiler pop and unclosed resource.

* Fix release workflow misfiling the QSL version field.

* Override the experimental warning screen with opt-out. (QuiltMC#124)

* Fixes QuiltMC#131: a possible tooltip events class-loading race. (QuiltMC#133)

* Fix possible tooltip events class-loading race.

This addresses QuiltMC#131.

* Fix wording.

Co-authored-by: Glitch <glitch.g3431@gmail.com>

Co-authored-by: Glitch <glitch.g3431@gmail.com>

* Bump version.

* Bump loader version.

* Add stuff to check whether dynamic registry entries exist. (QuiltMC#134)

* Add stuff to check whether dynamic registry entries exist.

* Replace getBiomeRegistry with getBiomeHolder.

* Port Biome API fixes from Fabric API (QuiltMC#137)

* Bump version

* Add mod resource packs caching for faster reloads. (QuiltMC#138)

* Add mod resource packs caching for faster reloads.

Also use the java.io.File API when possible instead of NIO exists.

* Use some more ternaries.

* Improve documentation after a talk with native speakers in Quilt.

* [REA] Fix reloader never running (QuiltMC#144)

* REA: Backport make dump_builtin_attachments dump tags too (QuiltMC#126)

* Bump version.

* Update checkstyle.

* Add Block Entity API module. (QuiltMC#135)

* Add Block Entity API module.

* Improve sync errors following feedback.

* Fill missing javadoc.

* Update library/block/block_entity/src/main/java/org/quiltmc/qsl/block/entity/impl/QuiltBlockEntityImpl.java

Co-authored-by: BasiqueEvangelist <basiqueevangelist@yandex.ru>

* Apply suggestions from code review.

* Fix todo wording.

* Replace the Preconditions call with a Java built-in method.

* Apply suggestions from Ennui's code review.

Co-authored-by: BasiqueEvangelist <basiqueevangelist@yandex.ru>

* Fix wording.

* Add missing icon to the Quilt Block Entity API.

* Remove interface injection of QuiltBlockEntity.

* Rename bows module to extension

* Move injected interfaces to impl and projectile modifying items now auto-register

* apply licenses

Co-authored-by: Glitch <glitch.g3431@gmail.com>
Co-authored-by: Eli Orona <eliorona@live.com>
Co-authored-by: LambdAurora <aurora42lambda@gmail.com>
Co-authored-by: LambdAurora <email@lambdaurora.dev>
Co-authored-by: FoundationGames <43485105+FoundationGames@users.noreply.github.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: ADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>
Co-authored-by: William Bradford Larcombe <william@williambl.com>
Co-authored-by: BasiqueEvangelist <basiqueevangelist@yandex.ru>
Co-authored-by: i509VCB <i509vcb@gmail.com>
Co-authored-by: Boxed <62370320+maximumpower55@users.noreply.github.com>
Co-authored-by: Ennui Langeweile <85590273+EnnuiL@users.noreply.github.com>
Co-authored-by: CheaterCodes <49926638+CheaterCodes@users.noreply.github.com>
Co-authored-by: peaceheis <69596656+peaceheis@users.noreply.github.com>
Co-authored-by: zOnlyKroks <finnrades@gmail.com>
  • Loading branch information
16 people committed Jul 29, 2022
1 parent 2f73455 commit 35a5fee
Show file tree
Hide file tree
Showing 22 changed files with 1,009 additions and 0 deletions.
23 changes: 23 additions & 0 deletions library/item/extension/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
id("qsl.module")
}

qslModule {
name = "Quilt Item Extension API"
moduleName = "extension"
id = "quilt_extension"
description = "An API for extending various vanilla items that would be difficult to otherwise. " +
"Also provides relevant events for these items."
library = "item"
moduleDependencies {
core {
api("qsl_base")
}
}
injectedInterface("net/minecraft/class_1753") {
values = ["org/quiltmc/qsl/item/extension/impl/BowExtensions"]
}
injectedInterface("net/minecraft/class_1764") {
values = ["org/quiltmc/qsl/item/extension/impl/CrossbowExtensions"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2022 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.quiltmc.qsl.item.extension.api;

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.projectile.PersistentProjectileEntity;
import net.minecraft.item.BowItem;
import net.minecraft.item.ItemStack;
import org.quiltmc.qsl.item.extension.impl.BowExtensions;

/**
* This is the default implementation for {@link BowExtensions}, allowing for the easy creation of new bows with no new modded functionality.
* <p>
* This bow automatically registers itself to modify its arrows with {@link ProjectileModifyingBowItem#onProjectileShot(ItemStack, ItemStack, LivingEntity, float, PersistentProjectileEntity)}</p>
*/
public class ProjectileModifyingBowItem extends BowItem implements ShotProjectileEvents.ModifyProjectileFromBow {
public ProjectileModifyingBowItem(Settings settings) {
super(settings);
ShotProjectileEvents.BOW_MODIFY_SHOT_PROJECTILE.register(this);
}

@Override
public final void modifyProjectileShot(ItemStack bowStack, ItemStack arrowStack, LivingEntity user, float pullProgress, PersistentProjectileEntity projectile) {
if (bowStack.getItem() == this) {
this.onProjectileShot(bowStack, arrowStack, user, pullProgress, projectile);
}
}

public void onProjectileShot(ItemStack bowStack, ItemStack arrowStack, LivingEntity user, float pullProgress, PersistentProjectileEntity projectile) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2022 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.quiltmc.qsl.item.extension.api;

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.projectile.PersistentProjectileEntity;
import net.minecraft.item.CrossbowItem;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.quiltmc.qsl.item.extension.impl.CrossbowExtensions;

/**
* This is the default implementation for {@link CrossbowExtensions}, allowing for the easy creation of new crossbows with no new modded functionality.
* <p>
* This crossbow automatically registers itself to modify its projectiles with {@link ProjectileModifyingCrossbowItem#onProjectileShot(ItemStack, ItemStack, LivingEntity, PersistentProjectileEntity)}</p>
*/
public class ProjectileModifyingCrossbowItem extends CrossbowItem implements ShotProjectileEvents.ModifyProjectileFromCrossbow {
public ProjectileModifyingCrossbowItem(Settings settings) {
super(settings);
ShotProjectileEvents.CROSSBOW_MODIFY_SHOT_PROJECTILE.register(this);
}

@Override
public final void modifyProjectileShot(ItemStack crossbowStack, ItemStack projectileStack, LivingEntity user, @NotNull PersistentProjectileEntity persistentProjectileEntity) {
if (crossbowStack.getItem() == this) {
this.onProjectileShot(crossbowStack, projectileStack, user, persistentProjectileEntity);
}
}

public void onProjectileShot(ItemStack crossbowStack, ItemStack arrowStack, LivingEntity user, PersistentProjectileEntity persistentProjectileEntity) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*
* Copyright 2022 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.quiltmc.qsl.item.extension.api;

import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.projectile.PersistentProjectileEntity;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.quiltmc.qsl.base.api.event.Event;

public final class ShotProjectileEvents {
/**
* This event modifies the projectile entity. Returning a new entity will not change the entity that is spawned in.
*/
public static final Event<ModifyProjectileFromBow> BOW_MODIFY_SHOT_PROJECTILE = Event.create(ModifyProjectileFromBow.class, callbacks -> (bowStack, arrowStack, user, pullProgress, projectile) -> {
for (ModifyProjectileFromBow callback : callbacks) {
callback.modifyProjectileShot(bowStack, arrowStack, user, pullProgress, projectile);
}
});

/**
* This event replaces the projectile entity. Any modifications done in this step without returning a new entity can be erased.
* Do not use this event to only modify the arrow entity, as {@link ShotProjectileEvents#BOW_MODIFY_SHOT_PROJECTILE} is the proper event.
*/
public static final Event<ReplaceProjectileFromBow> BOW_REPLACE_SHOT_PROJECTILE = Event.create(ReplaceProjectileFromBow.class, callbacks -> (bowStack, arrowStack, user, pullProgress, projectile) -> {
for (ReplaceProjectileFromBow callback : callbacks) {
PersistentProjectileEntity replacedEntity = callback.replaceProjectileShot(bowStack, arrowStack, user, pullProgress, projectile);

if (replacedEntity != null) {
return replacedEntity;
}
}

return projectile;
});

/**
* This event modifies the projectile entity shot from a crossbow.
*/
public static final Event<ModifyProjectileFromCrossbow> CROSSBOW_MODIFY_SHOT_PROJECTILE = Event.create(ModifyProjectileFromCrossbow.class, callbacks -> (bowStack, projectileStack, user, persistentProjectileEntity) -> {
for (ModifyProjectileFromCrossbow callback : callbacks) {
callback.modifyProjectileShot(bowStack, projectileStack, user, persistentProjectileEntity);
}
});

/**
* This event replaces the projectile entity shot from a crossbow. Any modifications done in this step without returning a new entity can be erased.
* Do not use this event to only modify the arrow entity, as {@link ShotProjectileEvents#CROSSBOW_MODIFY_SHOT_PROJECTILE} is the proper event.
*/
public static final Event<ReplaceProjectileFromCrossbow> CROSSBOW_REPLACE_SHOT_PROJECTILE = Event.create(ReplaceProjectileFromCrossbow.class, callbacks -> (bowStack, projectileStack, user, persistentProjectileEntity) -> {
for (ReplaceProjectileFromCrossbow callback : callbacks) {
PersistentProjectileEntity replacedEntity = callback.replaceProjectileShot(bowStack, projectileStack, user, persistentProjectileEntity);

if (replacedEntity != null) {
return replacedEntity;
}
}

return persistentProjectileEntity;
});

private ShotProjectileEvents() {
}

public interface ReplaceProjectileFromCrossbow {
/**
* In this method you can replace the arrow shot from your custom crossbow. Applies all of the vanilla arrow modifiers first.
*
* @param crossbowStack the ItemStack for the Crossbow Item
* @param projectileStack the ItemStack for the projectile currently being shot
* @param user the user of the crossbow
* @param persistentProjectileEntity the arrow entity to be spawned
* @return the new projectile entity. Return {@code null} if you do not change the entity.
*/
PersistentProjectileEntity replaceProjectileShot(ItemStack crossbowStack, ItemStack projectileStack, LivingEntity user, @NotNull PersistentProjectileEntity persistentProjectileEntity);
}

public interface ModifyProjectileFromCrossbow {
/**
* In this method you can modify the behavior of arrows shot from your custom crossbow. Applies all the vanilla arrow modifiers first.
*
* @param crossbowStack the ItemStack for the Crossbow Item
* @param projectileStack the ItemStack for the projectile currently being shot
* @param user the user of the crossbow
* @param persistentProjectileEntity the arrow entity to be spawned
*/
void modifyProjectileShot(ItemStack crossbowStack, ItemStack projectileStack, LivingEntity user, @NotNull PersistentProjectileEntity persistentProjectileEntity);
}

public interface ReplaceProjectileFromBow {
/**
* In this method you can replace the arrow shot from your custom bow. Applies all of the vanilla arrow modifiers first.
*
* @param bowStack the ItemStack for the Bow Item
* @param arrowStack the ItemStack for the arrows
* @param user the user of the bow
* @param pullProgress the pull progress of the bow from 0.0 to 1.0
* @param projectile the arrow entity to be spawned
* @return the arrow entity, either new or {@code null} to signify no changes occurred
*/
@Nullable PersistentProjectileEntity replaceProjectileShot(ItemStack bowStack, ItemStack arrowStack, LivingEntity user, float pullProgress, PersistentProjectileEntity projectile);
}

public interface ModifyProjectileFromBow {
/**
* In this method you can modify the behavior of arrows shot from your custom bow. Applies all of the vanilla arrow modifiers first.
*
* @param bowStack the ItemStack for the Bow Item
* @param arrowStack the ItemStack for the arrows
* @param user the user of the bow
* @param pullProgress the pull progress of the bow from 0.0 to 1.0
* @param projectile the arrow entity to be spawned
*/
void modifyProjectileShot(ItemStack bowStack, ItemStack arrowStack, LivingEntity user, float pullProgress, PersistentProjectileEntity projectile);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2022 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.quiltmc.qsl.item.extension.impl;

import net.minecraft.item.BowItem;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.quiltmc.qsl.base.api.util.InjectedInterface;
import org.quiltmc.qsl.item.extension.api.ProjectileModifyingBowItem;
import org.quiltmc.qsl.item.extension.api.ShotProjectileEvents;

/**
* An interface to implement for all custom bows in Quilt.
* <p>
* This is meant to be used on a {@link net.minecraft.item.BowItem} class. Unless similar functionality is implemented on your custom item, most functionality will not work.</p>
* <p>
* In order to modify the projectile shot from your bow, implementing and registering {@link ShotProjectileEvents.ModifyProjectileFromBow} is recommended.</p>
*
* @see ProjectileModifyingBowItem
*/
@ApiStatus.Internal
@InjectedInterface(BowItem.class)
public interface BowExtensions {
/**
* Returns the draw progress of the bow between 0 and 1.
*
* @param useTicks the number of ticks the bow has been drawn.
* @param bowStack the ItemStack for the bow
* @return the progress of the pull from {@code 0.0f} to {@code 1.0f}.
*/
default float getCustomPullProgress(int useTicks, ItemStack bowStack) {
return BowItem.getPullProgress(useTicks);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2022 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.quiltmc.qsl.item.extension.impl;

import net.minecraft.entity.LivingEntity;
import net.minecraft.item.CrossbowItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.quiltmc.qsl.base.api.util.InjectedInterface;
import org.quiltmc.qsl.item.extension.api.ProjectileModifyingCrossbowItem;
import org.quiltmc.qsl.item.extension.api.ShotProjectileEvents;
import org.quiltmc.qsl.item.extension.mixin.CrossbowItemAccessor;

/**
* An interface to implement for all custom crossbows in Quilt.
* <p>
* This is meant to be used on a {@link net.minecraft.item.CrossbowItem} class.</p>
* <p>
* In order to modify the projectile shot from your crossbow, implementing and registering {@link ShotProjectileEvents.ModifyProjectileFromCrossbow} is recommended.</p>
*
* @see ProjectileModifyingCrossbowItem
*/
@ApiStatus.Internal
@InjectedInterface(CrossbowItem.class)
public interface CrossbowExtensions {
/**
* Allows modifying the speed of the crossbow projectile. <p>
* To get the projectile from the crossbow, call {@link CrossbowItem#hasProjectile(ItemStack, Item)} passing in {@code stack} and the {@link Item} for the projectile. <p>
* The default implementation follows the vanilla values for projectiles
*
* @param stack the ItemStack for the crossbow
* @param entity the Entity shooting the crossbow
* @return the speed of the projectile
*/
default float getProjectileSpeed(ItemStack stack, LivingEntity entity) {
return CrossbowItemAccessor.quilt$getSpeed(stack);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2022 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.quiltmc.qsl.item.extension.mixin;

import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.RangedAttackMob;
import net.minecraft.entity.mob.AbstractSkeletonEntity;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.quiltmc.qsl.item.extension.impl.BowExtensions;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(AbstractSkeletonEntity.class)
public abstract class AbstractSkeletonEntityMixin extends MobEntity implements RangedAttackMob {
protected AbstractSkeletonEntityMixin(EntityType<? extends MobEntity> entityType, World world) {
super(entityType, world);
}

// Allows Skeletons to shoot custom bows by returning true
@Redirect(method = "updateAttackType", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isOf(Lnet/minecraft/item/Item;)Z"))
private boolean updateAttackType(ItemStack itemStack, Item item) {
return itemStack.getItem() instanceof BowExtensions;
}
}
Loading

0 comments on commit 35a5fee

Please sign in to comment.