Skip to content

BlockData Support - #8836

Open
Absolutionism wants to merge 3 commits into
SkriptLang:dev/featurefrom
Absolutionism:dev/BlockDataSupport
Open

BlockData Support#8836
Absolutionism wants to merge 3 commits into
SkriptLang:dev/featurefrom
Absolutionism:dev/BlockDataSupport

Conversation

@Absolutionism

Copy link
Copy Markdown
Contributor

Problem

Skript currently does not support retrieving, changing, and resetting blockdata tags of blocks

Solution

  • ExprBlockDataTags:

    • Gets all tags of a block or block related object
    • Reset all tags to default
  • ExprBlockDataValues:

    • Gets the tag values of a block or block related object
    • Set or Reset the tag values
    • Extensive error handling and informative error output
  • ExprBlockData (Updated):

    • Gets BlockData of block related objects
    • Reset BlockData to default
  • BlockDataHolder:

    • All current types that support retrieving BlockData from and changing
  • BlockDataValueType:

    • All typed values that support retrieving as and being changed to

Testing Completed

quickTest, manual testing

Supporting Information

N/A


Completes: none
Related: none
AI assistance: none

@Absolutionism
Absolutionism requested a review from a team as a code owner August 13, 2026 17:45
@Absolutionism
Absolutionism requested review from Efnilite and cheeezburga and removed request for a team August 13, 2026 17:45

@AnOwlBe AnOwlBe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from a quick glance (mostly just my thoughts)

nothing major though

}

@Override
public BlockData getBlockData(ItemType itemType) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a safe cast 100% of the time? I didn't really look into it too much though

Comment thread src/main/java/ch/njol/skript/classes/data/BukkitClasses.java
CondBlockDataTag::new,
types + " (has|have) [the] block[ ]data [tag[s]] %strings%",
types + " (is|are) tagged with [the] block[ ]data [tag[s]] %strings%",
types + "(is|are) tagged with %strings% block[ ]data",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this pattern in specific is confusing to me
would it not be better to say if {b} has "axis" block data? I think you are over-emphasizing "tags" in these patterns

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just adding more options, as Mug had preferred the "is tagged" and Pickle said both would be fine.

@skriptlang-automation skriptlang-automation Bot added the needs reviews A PR that needs additional reviews label Aug 16, 2026
@Absolutionism
Absolutionism requested a review from sovdeeth August 16, 2026 22:42
import java.util.Arrays;

@Name("Has Block Data")
@Description("Whether the blockdata of a block or block related object has the specified tag.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Description("Whether the blockdata of a block or block related object has the specified tag.")
@Description("Whether the blockdata of a block or block-related object has the specified tag.")

CondBlockDataTag::new,
types + " (has|have) [the] block[ ]data [tag[s]] %strings%",
types + " (is|are) tagged with [the] block[ ]data [tag[s]] %strings%",
types + "(is|are) tagged with %strings% block[ ]data",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
types + "(is|are) tagged with %strings% block[ ]data",
types + " (is|are) tagged with %strings% block[ ]data",

- tag "pickles" will always return an integer value, and can be changed to an integer value or string of an integer: "1"
""")
@Example("""
set blockdata "waterlogged" of {_campfire} to false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set blockdata "waterlogged" of {_campfire} to false
set blockdata "waterlogged" of {_campfire} to false


@Override
public @Nullable Integer parse(String string) {
return string.matches("\\d+") ? Integer.parseInt(string) : null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this also accept negative values?

Comment on lines +25 to +27
/**
* @author Peter Güttinger
*/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* @author Peter Güttinger
*/

@skriptlang-automation skriptlang-automation Bot removed the needs reviews A PR that needs additional reviews label Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants