Commit Graph
382 Commits
Author SHA1 Message Date
gnembon 8fa54c8146 stack overflow in scripts shouldn't crash the game, fixes #934 2021-06-25 23:31:46 -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
gnembon 70a59ccedd cleanup 2020-10-15 03:20:10 -03:00
gnembon 33f400e904 refactor 2020-09-09 16:19:12 -03:00
gnembon 59575ec607 refactor breaking up API and language defs 2020-09-09 15:37:03 -03:00
gnembon 34d548523d making language elements statically defined. 2020-09-09 14:23:58 -03:00
gnembon 3105d5bb71 Events are defined statically in normal classes and added handler for extensions to add their built-ins 2020-09-08 23:47:31 -03:00
gnembon a7fcaaddf1 code fixes 2020-09-07 15:37:22 -03:00
gnembon 6bf1d46c50 Merge branch 'master' of https://github.com/gnembon/fabric-carpet 2020-09-07 15:20:07 -03:00
Ghoulboy 26169f042e Updating logger to support different types (#452) fixes #437
* Updating logger to support different types

* changing to ouptut info by default

* updating docs with air

* adding air modify definition
2020-09-07 15:19:28 -03:00
gnembon 7daac70f93 mappings 2020-09-07 15:16:15 -03:00
gnembon 81ae5bbb40 poi can query in square column as well. 2020-09-07 01:26:23 -03:00
gnembon 1006e0ac40 commands return integer value if possible, fixes #408
handle infinite values as infinities.
2020-09-05 02:06:59 -03:00
gnembon b48c52cce4 seed returns numbers now since they will not loose long precision. 2020-08-21 00:55:18 -03:00
gnembon 598219608b added WIP 'custom_dimension' to the API 2020-08-17 00:36:01 -03:00
gnembon 1a023c91be fixed chunks not updating properly, fixes #404 2020-08-06 02:48:58 -03:00
gnembon 1aadf361ec 1.16.2-pre2 2020-08-05 19:54:20 -03:00
gnembon 3ec5c209fd mappings 2020-07-27 01:44:42 -03:00
gnembon 4fe6a8d80f 20w30a 2020-07-22 17:15:26 -03:00
gnembon 49a88cb27f Merge branch 'master' into 1.16 2020-07-22 02:17:41 -03:00
gnembon a0e2fbb452 fixed precision of entity_area 2020-07-22 02:17:25 -03:00
gnembon 394904a187 update 2020-07-21 23:42:44 -03:00
gnembon e67ec14285 mappings 2020-07-20 21:06:03 -03:00
gnembon c22c7b991a adjusting to 1.16 2020-07-19 02:18:36 -03:00
gnembon 3b90bd5d3a mappings 2020-07-15 04:35:15 -03:00
gnembon 0e21942df7 Merge branch 'master' into 1.16 2020-07-13 00:41:34 -03:00
gnembon d90b4a306a specified interactive option for markers, fixes #372 2020-07-13 00:22:15 -03:00
gnembon 351cc9bb2e feature registry help 2020-07-12 16:18:37 -03:00
gnembon a0e0dc0f88 20w28a. Rewritten scarpet structure and plop API. Removed portalSuffocationFix, as its fixed. 2020-07-12 02:38:12 -03:00
gnembon c69f65e68e Merge branch 'master' into 1.16
# Conflicts:
#	src/main/java/carpet/script/CarpetExpression.java
2020-07-01 14:54:04 -03:00
gnembon 926375700a docs on reset_chunks 2020-07-01 14:49:22 -03:00
gnembon af35504016 Merge branch 'master' into 1.16
# Conflicts:
#	src/main/java/carpet/mixins/ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java
#	src/main/java/carpet/script/CarpetExpression.java
2020-07-01 01:54:39 -03:00
gnembon a7a37a3975 cleanup 2020-07-01 01:47:04 -03:00
gnembon 7067e59a21 Merge branch 'master' into light
# Conflicts:
#	src/main/resources/carpet.accesswidener
#	src/main/resources/fabric.mod.json
2020-07-01 00:11:35 -03:00
gnembon 66a02c06cd Merge branch 'master' into 1.16 2020-06-28 14:34:35 -03:00
gnembon 391c7b976e without_updates and in_dimension are now properly synchronized. 2020-06-28 14:25:19 -03:00
gnembon 8389a277fc Merge branch 'master' into 1.16 2020-06-23 02:13:48 -03:00
gnembon 0e3395e7bd command crash when they throw weird exceptions 2020-06-23 02:13:13 -03:00
gnembon cad8c0bbd1 structure lag, booyah 2020-06-23 01:15:12 -03:00
gnembon f50fa8cde2 Merge branch 'master' into 1.16
# Conflicts:
#	src/main/java/carpet/script/CarpetExpression.java
2020-06-23 00:35:44 -03:00
gnembon 0a5b6a5481 Merge branch 'master' of https://github.com/gnembon/fabric-carpet 2020-06-23 00:35:04 -03:00
gnembon 0e88f37b13 structure lag, booyah 2020-06-23 00:34:53 -03:00
gnembon 12309e9e2d making sure try, return etc. control flow doesn't leak through in_dimension. 2020-06-22 16:21:55 -03:00
gnembon 5cb019d5b5 there can be more than 3 dimensions, fixes #336 2020-06-20 11:18:39 -03:00
gnembon 3700377686 Merge branch 'master' into 1.16
# Conflicts:
#	src/main/java/carpet/script/utils/ShapesRenderer.java
#	src/main/java/carpet/script/value/BlockValue.java
2020-06-20 09:03:20 -03:00
gnembon ccd92c5957 added encode_nbt, added 'nbt' and 'nbt_merge' to modify entity API. 2020-06-20 02:19:20 -03:00
gnembon 4fe18a402c optimize a little 2020-06-18 22:22:49 -03:00
gnembon 98b95a74f4 Merge branch 'master' into 1.16 2020-06-18 20:11:50 -03:00
gnembon 4145280bcd added parse_nbt and ability for set to submit params in list, and block data. 2020-06-18 17:15:07 -03:00
gnembon 639283fce3 allow for more characters in file names. 2020-06-18 13:52:31 -03:00