Adds destroyable/placeable key syntaxes
Description
This pull request implements a condition, expression, and effect, to allow for the destroyable/placeable keys of an item to be modified.
Here are some examples of the syntaxes:
# adding
add (stone, dirt, diamond ore) to destroyable restrictions of player's tool
allow {_item} to destroy (emerald block, oak wood planks) in adventure mode
# removing
remove sand from destroyable blocks of {_item} in adventure mode
prevent {_item} from being placed on (diamond ore, diamond block) in adventure
clear break restrictions of {_item}
# checking
send true if player's tool has any build restrictions else false
command /has specific destroyable keys:
trigger:
send true if {_item} is able to break (stone and dirt) in adventure mode else false
Target Minecraft Versions: any Requirements: none Related Issues: none
Was wondering while making these if they could each be merged into just one condition, expression, and effect? Like, all the classes which are for either destroyable or placeable keys are pretty much identical, obviously with just changes to the methods used.
I think, for the most part, a lot of those issues that were there before should be better, if not fixed, now. When I finish work I'll try combining the expressions and effects to just have one syntax each.
You should create tests for these syntax.
For sure, was just gonna wait for the syntax to be finished first. The condition doesnt work rn, and I think @sovdeeth was gonna have a look at it at some point.
For sure, was just gonna wait for the syntax to be finished first. The condition doesnt work rn, and I think @sovdeeth was gonna have a look at it at some point.
Right that's fine, it just seemed like a great place for tests :)
You should create tests for these syntax.
For sure, was just gonna wait for the syntax to be finished first. The condition doesnt work rn, and I think @sovdeeth was gonna have a look at it at some point.
right yeah may not get around to it today as promised
You should create tests for these syntax.
For sure, was just gonna wait for the syntax to be finished first. The condition doesnt work rn, and I think @sovdeeth was gonna have a look at it at some point.
right yeah may not get around to it today as promised
No stress :)
tests failing
tests failing
I think the reason tests are failing is because Paper just fully removed all the destroyable/placeable keys methods. And apparently got rid of the Namespaced class. What should I change so that the syntax still works on versions lower than 1.20.5 and the tests pass?
only java 21 would be failing if that was the case, the issue appears to be a class issue
NamespacedKey still exists, and has since 1.13, I believe. the methods being removed will be slightly more annoying.
This is my first time doing any reflection kind of stuff, so I'm not entirely sure if the way that I've done this is correct and/or good. Did some fairly limited testing with this new version and it seems to all work as intended.
So the thing that concerns me with this is that I don't think ItemType is a good analogy for the restrictions.
...
Here is a nice list of all the (current) tags: https://mcreator.net/wiki/minecraft-block-tags-list
oh interesting, I didn't realize it allowed those tags as well. Honestly, we may want to but this on the back burner for now, given that Paper has completely removed this api for 1.20.5+ in favor of some nebulous future api. We may want to wait and see how that one works before committing to an implementation.
Any updates here?
Any updates here?
See here for a small discussion on it, but basically it just seems like its still very subject to change, so might give it some more time. Do you reckon I should just finalize this with how its currently implemented, and then do another PR to fix it at a later date when Paper releases a final version? Or just leave it for now?
Given the support just isn't there in the API, I think waiting is the better choice.