Skip to content

EntityData Overhaul#7985

Merged
Absolutionism merged 36 commits intoSkriptLang:dev/featurefrom
Absolutionism:dev/EntityDataMultiLinedPatterns
Sep 30, 2025
Merged

EntityData Overhaul#7985
Absolutionism merged 36 commits intoSkriptLang:dev/featurefrom
Absolutionism:dev/EntityDataMultiLinedPatterns

Conversation

@Absolutionism
Copy link
Copy Markdown
Contributor

@Absolutionism Absolutionism commented Jul 1, 2025

Problem

  • Patterns for entities in the default.lang file became increasingly hard to read
    • The matchedPattern for abstract EntityData#init(...) is actually matchedCodeName
  • Some EntityData classes are outdated from current conventions
  • Some EntityData classes don't handle setting the EntityData#matchedPattern which is used for EntityData#toString
  • EntityData#matchedPattern gives the wrong impression of what exactly it is used for

Solution

  • Modifies EntityDataInfo for custom handling of multi lined patterns in the default.lang for code names.
    • Abstract EntityData#init(...) now passes the matchedCodeName (which is the same behavior as the previous matchedPattern)
      • matchedPattern has been refactored to pass along the actual matched pattern correlating to patterns of each code name
  • EntityData#matchedPattern has been renamed to codeNameIndex to be more specific and match these new changes
  • Multiple code names in the default.lang utilize the multi lined patterns section for improved readability
  • Updates 'Patterns"
    • Allows passing null values for general purposes rather than a specific type
    • Allows getting an array of matched patterns using the given typed object
    • Allows getting the matched pattern from the array with an arrayIndex
  • Updates conventions of EntityData classes
    • Remove existence checks for classes/methods that are available on all supported Minecraft versions of Skript
    • Classes using matchedPattern in their #init use matchedCodeName now
    • Classes that had extraneous checks for expressions have been reduced utilizing both the new matchedCodeName and matchedPattern
    • Classes use Patterns<T> for code names for EntityData#register
      • Allows setting a T data field using EntityPatterns#getInfo within #init using matchedCodeName
      • Allows getting matchedCodeName from T object using Patterns#getMatchedPattern
        • Allows setting EntityData#codeNameIndex within #init(Class, Entity) and constructors with parameters
    • Removes deprecated #deserialized
    • getSuperType now correctly get a data object with no special data
    • Renames SimpleEntityData#info -> simpleInfo to remove any confusion of EntityData#info
      • Also allows access to both without having to do super.info for EntityData#info

Misc Changes

  • Removes OcelotData as no supported versions of Minecraft still had Ocelot as Tameable thus not needing any special data and being moved to SimpleEntityData
  • Reordered entities section in default.lang to have the nodes be categorized by which EntityData class handles it
  • Added CondIsSpawnable to be able to check if an EntityData can be spawned
  • Overrode #canSpawn in DisplayData ensuring it wasn't DisplayType.ANY
  • Registers classes that EntityData classes use as fields and constructor parameters allowing to be stored in global variables

Misc Fixes

  • Some patterns for entities was incorrect, such as only having fox (kid|child[plural:ren]) for both red fox and snow fox but didn't have the leading red or snow, same was seen for Mooshrooms

Testing Completed

built-in tests
EntityData.sk

Supporting Information

N/A


Completes: none
Related: none

…taMultiLinedPatterns

# Conflicts:
#	src/main/resources/lang/default.lang
…taMultiLinedPatterns

# Conflicts:
#	src/main/java/ch/njol/skript/entity/BeeData.java
#	src/main/java/ch/njol/skript/entity/BoatChestData.java
#	src/main/java/ch/njol/skript/entity/BoatData.java
#	src/main/java/ch/njol/skript/entity/DroppedItemData.java
#	src/main/java/ch/njol/skript/entity/EntityData.java
#	src/main/java/ch/njol/skript/entity/LlamaData.java
#	src/main/java/ch/njol/skript/entity/ParrotData.java
#	src/main/java/ch/njol/skript/entity/PigData.java
#	src/main/java/ch/njol/skript/entity/SheepData.java
#	src/main/java/ch/njol/skript/entity/ThrownPotionData.java
#	src/main/java/ch/njol/skript/entity/TropicalFishData.java
#	src/main/resources/lang/default.lang
@Absolutionism
Copy link
Copy Markdown
Contributor Author

Reviews are still welcome while in draft

@APickledWalrus APickledWalrus self-requested a review July 1, 2025 01:58
…taMultiLinedPatterns

# Conflicts:
#	.github/CODEOWNERS
#	src/main/java/ch/njol/skript/lang/SkriptParser.java
@Absolutionism Absolutionism added enhancement Feature request, an issue about something that could be improved, or a PR improving something. breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) labels Jul 3, 2025
@Absolutionism Absolutionism marked this pull request as ready for review July 3, 2025 11:20
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jul 3, 2025
…taMultiLinedPatterns

# Conflicts:
#	src/main/java/ch/njol/skript/entity/PigData.java
@Absolutionism Absolutionism requested a review from sovdeeth July 9, 2025 13:21
@TheLimeGlass
Copy link
Copy Markdown
Contributor

TheLimeGlass commented Jul 16, 2025

Can you work on fixing give all players pig with entity data converting to inventory, the entity data isn't spawned yet, so it shouldn't be converted to an inventory.

Also entity type is just multiples of an entity and can be done within entity data

@Absolutionism Absolutionism added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Jul 22, 2025
Copy link
Copy Markdown
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

looks good with pickle's changes

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Jul 28, 2025
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jul 30, 2025
Copy link
Copy Markdown
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

I would go through and change most of the other occurrences of orElse(0) as they should likely be orElseThrow() (when there is no expectation that the optional would be empty)

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Jul 30, 2025
…taMultiLinedPatterns

# Conflicts:
#	src/main/java/ch/njol/skript/classes/data/BukkitClasses.java
…taMultiLinedPatterns

# Conflicts:
#	.github/CODEOWNERS
@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.13 Releases Sep 30, 2025
@Absolutionism Absolutionism merged commit b58c01d into SkriptLang:dev/feature Sep 30, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.13 Releases Sep 30, 2025
@sovdeeth sovdeeth moved this from Done - Awaiting Release to Done - Released in 2.13 Releases Oct 15, 2025
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
* Initial Commit

* Additional Cleanup

* Update default.lang

* Initial Commit

* Follow Up Commit

* Language Map Update

* EntityDataInfo and EnitityData Update

* Overhaul

* Enum->Interface Fixes

* Added states and test

* Update EntityData.java

* Update EntityData.sk

* Fix test

* Kleenean Changes

* Update EntityData.sk

* Efy's Requested Changes

* Efy's Requested Changes  -2

* Sovdes Requested Changes

Move EntityPatterns into Patterns
Add getMatchedPattern to Patterns
Add kleeneanMatch to EntityData
add dataMatch to EntityData

* FieldHandler

* Massive Fixes/Changes

* Update EntityData.sk

* Requested Changes

* Requested Changes

* Approving Changes
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
* Initial Commit

* Additional Cleanup

* Update default.lang

* Initial Commit

* Follow Up Commit

* Language Map Update

* EntityDataInfo and EnitityData Update

* Overhaul

* Enum->Interface Fixes

* Added states and test

* Update EntityData.java

* Update EntityData.sk

* Fix test

* Kleenean Changes

* Update EntityData.sk

* Efy's Requested Changes

* Efy's Requested Changes  -2

* Sovdes Requested Changes

Move EntityPatterns into Patterns
Add getMatchedPattern to Patterns
Add kleeneanMatch to EntityData
add dataMatch to EntityData

* FieldHandler

* Massive Fixes/Changes

* Update EntityData.sk

* Requested Changes

* Requested Changes

* Approving Changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something.

Projects

No open projects
Status: Done - Released

Development

Successfully merging this pull request may close these issues.

5 participants