-
-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block data stuff #7071
base: dev/feature
Are you sure you want to change the base?
Block data stuff #7071
Conversation
- Allows getting the block data of valid itemtypes - Adds some methods to get the tags and values of a block data - Adds a block data tags expression - Adds block -> block data converter - Changes some variable names in ExprBlockData test
- toBlock(ItemStack): returns the item as a material, or block material - toValidBlock(ItemStack): returns a material or null if the material wouldn't be a block - getValue(BlockData, String): returns the value of the tag on the blockdata if it exists, or null otherwise. Also tries to convert to boolean and integer
- Adds some new examples - Uses new toValidBlock method from BlockDataUtils - Fixes some logic with the get and change methods
Might be worth putting this #6087 as a related issue, I don't believe Nylhus is still working on it after about a year |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new methods need javadocs!
src/test/skript/tests/syntaxes/expressions/ExprBlockDataTags.sk
Outdated
Show resolved
Hide resolved
src/test/skript/tests/syntaxes/expressions/ExprBlockDataTags.sk
Outdated
Show resolved
Hide resolved
src/test/skript/tests/syntaxes/expressions/ExprBlockDataTags.sk
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and yes this pr should have manipulation of tag support
src/main/java/ch/njol/skript/expressions/ExprBlockDataTags.java
Outdated
Show resolved
Hide resolved
src/main/java/ch/njol/skript/expressions/ExprBlockDataTags.java
Outdated
Show resolved
Hide resolved
- getValue will now try to match the value to a regex before trying to parse it as an int
Description
This PR adds some more basic block data support and block data tags to Skript. It introduces a block -> block data converter, which I'm happy to take feedback on.
Stuff that this PR adds:
Stuff that will probably also make it into this PR:
The code in this PR was created without knowledge of SkBee's implementation. At the very end I compared the two, just to see if I had missed anything big, which I (sort of) had. SkBee uses a method,
toBlockForm
, which converts some itemstacks whose material isn't a valid block to their respective block form (e.g. wheat seeds -> wheat). I couldn't think of any other way to do this, so it was implemented with Shane's permission.Target Minecraft Versions: 1.13+
Requirements: none
Related Issues: #6087