Commit Graph
108 Commits
Author SHA1 Message Date
altrisi 34e32973fa Use Fabric's newly exposed version APIs for app requirement parsing, expand it to allow wildcards and change load stopping to be a special exception (#1252) 2022-01-08 23:26:14 +01:00
gnembon 18c728db2e fixes #1172 lol 2021-11-27 20:11:05 +01:00
gnembon 229d0b037b events handling is disabled now when potentially triggered from the scarpet script preventing from recursive callbacks. 2021-09-06 02:37:08 -03:00
altrisi 7fb5e47da5 Use newer Java features in places where it makes sense and more (#1009) 2021-08-03 07:32:40 -03:00
gnembon 0e9df3701f rework for events and other stored functions. Fixes #984 2021-07-22 22:22:38 -03:00
gnembon 9a4e15da48 mappings 2021-06-29 17:28:58 -03:00
gnembon bd689b418a prevent events to be called when script server is gone. 2021-05-28 13:50:50 -03:00
gnembon 328ded0537 added /script remove app command 2021-05-27 01:54:26 -03:00
gnembon db9039c02a added app resources for apps from appstores 2021-05-25 00:41:06 -03:00
gnembon dbae5813f0 added framework for auto resource fetching for the apps 2021-05-21 22:31:02 -03:00
altrisi cc7a9c01be Annotated Scarpet (#772)
* Progress by now.

* Output conversions plus a few extra random things

* More progress, mostly list converting and a way to get converters

* Apply ValueConverters, refactor valueconverter getter to

accept types with annotations and generics, made listconverter pass
those params and annotations recursively. And probably more things.

* Some extra docs, the 100% most important thing

* Added MapConverter, strict Strings and Texts, some docs additions

and commented out heuristics

* Rework StrictParam to use SimpleTypeConverters and be saved in a map

* Minor changes and docs & added non-fully-functional context "converter"

* Added support for variable value count converters, multi-value eaters &

0 value eaters (Context).

* Docs update, enable Context converter, fix minor TODOs

* Move (most) parameter annotations into a single class,

remove deprecated ValueCaster#cast, update some docs.

* Small refactor of Param.Strict registering, added boolean to it

* Added PairConverter, moved Context and LV ValueConverters to Params

* Document public methods of AnnotationParser

* Add a lot more docs, make it ready for the first preview PR

* Move ValueConverter population outside of makeFunction,

check lv size for > max arguments, minor doc updates and workaround for
Mercury#28 until released

* Added optional parameters (declared using Java's Optional),

made evalAndConvert check for the presence of the next iteration,
updated test class

* Generalize Value OutputConverter

* ListConverter and MapConverter now follow ValueConverter contract of

incorrect value handling, returning a complete null for an incorrect
value anywhere. Also small fix to OptionalConverter and docs.
Getting ready for checking null in AnnotationParser!

* Change reflection's #invoke to a MethodHandle to boost speed by a lot

Commented

* Dedupe code, update and remove outdated todos, add 2 new ValueCasters

* Merge lambdas in display_title2 test function to be more accurate

* Check nulls somehow, I guess

* Move base function logic into a class to stop

passing hundreds of parameters into static functions and therefore simplify it

* Reduce visibility and fix a bug with PairConverter

* Hide Context provider in usage report

* Add support for primitive varargs

* Added TheLazyT converter

* Drop #getPrefixedTypeName and use 'something' as name of values

* Use value again because of varargs, document that

* Remove a completed TODO

* Remove old disabled heuristic value type name getter

* Fix TheLazyT

* Preparing locators before touching current Carpet infrastructure

* Add notes about non-implementedness of remaining locators

* Added APIs to register custom ValueConverters

* Mention new APIs in javadocs

* Adapt to new Carpet changes and deprecated non-implemented annotations

* Update example function for display_title()

* Better implementation for player_list example

* Fix example error message

* FunctionArgument no longer has generics

* Modernize Text converters

* OutputConverter is final, plus other small changes

* Few non-behavioural changes

* Rename LazyFunction to ScarpetFunction

* Drop LazyValue in parameters, not in return

Updating docs was a nightmare

* CARPET CHANGE - Make Fluff.AbstractLazyFunction.unpackArgs call unpackLazy (was duped)

* Make errors more like current Scarpet errors

* Allow customizing ContextType when evaluating arguments

* Add a few missing docs, comment out outdated ValueCaster doc

It's been a while, wow

* Fix for new Carpet signature :irritatered:

Please don't break API methods! Extensions may be using them, and they
will just crash the game or behave in unexpected ways else!

* Format all code to Carpet's. Powered by Eclipse

Reviewed to be sure it's ok. No functional changes, except from a small correction

* Always use full name for Context.Type

* Add parsing for all current Scarpet api and language classes

And remove test functions

* Allow void return type

* Fix no param methods

Whoops!

* Remove outdated comment and fix small javadoc linting problem

* Drop Param.TheLazyT in favour of just Context.Type type

And small performance improvement to varargs varargs since fastutil's toArray is crap

* Quote functions in error messages

* Make SimpleTypeConverter independent of ValueCaster

'Real world' usage demonstrated it can be annoying else, mostly for wrapper only values where you just want the wrapped object
2021-05-21 01:33:00 -03:00
altrisi be0635de82 Use primitive specific Predicates instead of Function (#859) 2021-05-15 18:54:16 -03:00
gnembon 06c9aea326 tracking module integrity when module composition changes 2021-04-29 02:17:02 -03:00
gnembon edca3fb131 using proper logger now 2021-04-22 22:30:45 -03:00
altrisiandgnembon b7b7667484 Allow apps to specify mod version requirements (#798)
* Allow apps to specify mod version requirements

* Allow a function in requires field and move to `readConfig()`

* Add `server_mods` to system_info()

* Add prefixes and default to `=`

* Added docs for `requires` and for `system_info('server_mods')`

* Better docs for requires (mention * and available prefixes)

* Update docs/scarpet/api/Overview.md

* Update docs/scarpet/api/Overview.md

* Update docs/scarpet/api/Overview.md

Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
2021-04-18 02:36:29 -03:00
gnembon 647a3a15b6 profiler rework 2021-04-06 00:41:12 -03:00
gnembon f0d044a49f added scarpet to the carpet profiler 2021-04-04 22:32:34 -03:00
gnembon ff4b292871 Merge pull request #742 from Ghoulboy78/draw_beta-upgrade
Update draw_beta.sc
2021-03-23 08:36:42 -03:00
gnembon 1a47f4333f refactored file IO and zupport for sips 2021-03-20 06:22:23 -03:00
gnembon 24e7c0fab9 command adding is due to the app refactor 2021-03-18 18:06:21 -03:00
altrisi 8a1c9f2d0b Fix symbolic links (#754) 2021-03-07 17:16:20 -04:00
Ghoulboy78 ae63c7be1d registering as built-in library (thx @altrisi) 2021-02-25 09:32:00 +01:00
gnembon 4c09d6b736 added __on_start and defined better meta-events 2021-02-08 18:08:38 -04:00
gnembon d99ab4fc24 limit depth of game_tick, just in case. 2020-12-20 22:58:41 -04:00
gnembon f54a098948 allow apps define their own command permission level, fixes #542 2020-12-07 16:03:42 -04:00
gnembon 522d971688 added startup and shutdown events. fixes #586 2020-12-07 01:11:55 -04:00
gnembon e8a6b8936f as per discussion, since scripts can now be stowed in the global bin, it makes sense for apps to behave like datapacks. fixes #613 2020-12-07 00:32:08 -04:00
gnembon ac6b3c7f48 apps can be organized in floders in your shared instance space. 2020-12-06 23:40:02 -04:00
gnembon 6e5af5bfc8 added list_files, fixes #589 2020-12-03 04:05:11 -04:00
gnembon d29f49967f rework of the event system, allowing apps to function more independently and allowing for player scoped apps to handle global events. fixes #596 2020-12-02 01:02:36 -04:00
altrisi 5dfd956ba2 Only allow globals in clients, fix potential issue and mention in docs 2020-11-29 21:45:53 +01:00
altrisi 210ad834f6 Allow loading apps from a global path 2020-11-29 15:49:28 +01:00
gnembon 209c3b9262 fixed issues with reload and missing command handler 2020-11-24 22:52:05 -04:00
gnembon 724b63df8a using beta as a indicator 2020-11-24 19:43:21 -04:00
Ghoulboyandaltrisi aeb3e382a6 Replacing draw and distance with apps (#553)
* added draw.sc app

Now working on distance app

* Adding apps as carpet rules

* adding distance app

Co-authored-by: altrisi <altrisi.trillosierra@gmail.com>
2020-11-24 19:40:55 -04:00
gnembon fee127a942 hide beta builtin apps 2020-11-24 19:38:38 -04:00
gnembon a297fd1441 Scarpet rules can provide multinary boolean permission level, fixes #572 2020-11-23 02:35:01 -04:00
altrisiandgnembon ba1071a8d1 Javadocs, cleanup, extension's client rules, built-in BundledModules generators, etc (#544)
* Add javadocs to many methods

* Added built-in ways to generate BundledModules and documented them

* Add Eclipse launch files to .gitignore and fix 11 warnings

* Remove many unused imports

* Remove some dead and unused code around app loading

* Allow extensions to have client-side rules in their SettingsManager

Also change tabs to spaces when those changed

* Remove unnecessary classloader param in BundledModule

* Change max tickwarp duration to Integer.MAX_VALUE

* Move RulePrinter into the source so it can be managed by the IDE

* Properly reset hopperCounters when changing worlds

Also change tabs to spaces again and minor tweaks to javadocs

* Run mergedocs even if Full.md was modified

* Update src/main/java/carpet/commands/TickCommand.java

Co-authored-by: gnembon <41132274+gnembon@users.noreply.github.com>
2020-11-16 09:30:59 -04:00
gnembon 5f9df1239a added strict command matching 2020-11-13 04:45:51 -04:00
gnembon 9f6771123f custom command trees, no validation so far 2020-11-12 02:55:18 -04:00
gnembon 55643632ca custom events, and low level event API 2020-11-11 02:06:45 -04:00
gnembon 9e8556f9d9 command arguments done 2020-11-09 03:04:26 -04:00
gnembon 79dc85274d revert some app changes preparing for release of 1.17 2020-11-04 20:11:21 -04:00
gnembon af668bfdbc custom arg types - WIP 2020-11-03 06:30:49 -04:00
gnembon 741edf1465 three things:
- logger is carpet, fixes #522
 - fixed fancy commands to functions - so could be used later with lambdas and functions that use different argument names
 - moved a few builtin apps to commands via /carpet
2020-11-03 04:45:08 -04:00
altrisi b9eee6e58b Allow rules to manage Scarpet apps (Scarpet Rules) (#519)
by altrisi
2020-11-02 21:52:21 -04:00
gnembon 8902cec747 make it more obscure 2020-11-02 16:28:00 -04:00
gnembon d9727862da wip 2020-11-02 16:27:03 -04:00
gnembon 1d81768c54 custom args WIP 2020-11-02 01:32:04 -04:00
gnembon 7ccd46433a entity load handler and rework of handling of events. 2020-10-30 22:59:27 -03:00