Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Adds destroyable/placeable key syntaxes

Open cheeezburga opened this issue 1 year ago • 10 comments

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

cheeezburga avatar Mar 14 '24 20:03 cheeezburga

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.

cheeezburga avatar Mar 14 '24 20:03 cheeezburga

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.

cheeezburga avatar Mar 15 '24 05:03 cheeezburga

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.

cheeezburga avatar Apr 07 '24 16:04 cheeezburga

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 :)

Moderocky avatar Apr 07 '24 16:04 Moderocky

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

sovdeeth avatar Apr 07 '24 16:04 sovdeeth

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 :)

cheeezburga avatar Apr 07 '24 17:04 cheeezburga

tests failing

sovdeeth avatar May 08 '24 20:05 sovdeeth

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?

cheeezburga avatar May 08 '24 21:05 cheeezburga

only java 21 would be failing if that was the case, the issue appears to be a class issue

Fusezion avatar May 08 '24 21:05 Fusezion

NamespacedKey still exists, and has since 1.13, I believe. the methods being removed will be slightly more annoying.

sovdeeth avatar May 09 '24 10:05 sovdeeth

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.

cheeezburga avatar May 16 '24 08:05 cheeezburga

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.

sovdeeth avatar May 30 '24 07:05 sovdeeth

Any updates here?

sovdeeth avatar Sep 15 '24 21:09 sovdeeth

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?

cheeezburga avatar Sep 16 '24 03:09 cheeezburga

Given the support just isn't there in the API, I think waiting is the better choice.

sovdeeth avatar Sep 16 '24 03:09 sovdeeth