Skip to content

Raw Name Entity Type Support - #8867

Open
erenkarakal wants to merge 3 commits into
SkriptLang:dev/featurefrom
erenkarakal:feature/entity-type-raw-name
Open

Raw Name Entity Type Support#8867
erenkarakal wants to merge 3 commits into
SkriptLang:dev/featurefrom
erenkarakal:feature/entity-type-raw-name

Conversation

@erenkarakal

Copy link
Copy Markdown
Member

Problem

Getting translate components for things that involve entity types requires the raw name of entity, but Skript doesn't support it

Solution

Added support for EntityDatas in ExprRawName.sk, made ExprRawName a PropertyExpression

Testing Completed

Added unit tests for single objects, single objects with spaces, plurals, and mixed plurals + in-game testing

Supporting Information


Completes: none
Related: none
AI assistance: none

@erenkarakal
erenkarakal requested a review from a team as a code owner September 1, 2026 19:06
@erenkarakal
erenkarakal requested review from Pesekjak and cheeezburga and removed request for a team September 1, 2026 19:06
@skriptlang-automation skriptlang-automation Bot added needs reviews A PR that needs additional reviews needs triage An issue that hasn't been classified or verified yet labels Sep 1, 2026
@skriptlang-automation

This comment has been minimized.

@skriptlang-automation skriptlang-automation Bot added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Sep 1, 2026
@skriptlang-automation skriptlang-automation Bot removed the needs triage An issue that hasn't been classified or verified yet label Sep 1, 2026
@skriptlang-automation skriptlang-automation Bot moved this to In Review in 2.17 Releases Sep 1, 2026
@erenkarakal erenkarakal added the don't merge me !! For pull requests that should not be merged due to some outstanding dispute, conflict or dependency. label Sep 1, 2026

static {
Skript.registerExpression(ExprRawName.class, String.class, ExpressionType.SIMPLE, "(raw|minecraft|vanilla) name[s] of %itemtypes%");
register(ExprRawName.class, String.class, "(raw|minecraft|vanilla) name[s]", "itemtypes/entitydatas");

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.

while you're here can you deprecate raw as an option? it's not a good name for it and pretty ambiguous compared to minecraft/vanilla

@Description("The raw Minecraft material name of the given item. Note that this is not guaranteed to give same results on all servers.")
@Description("""
The raw Minecraft material name of the given item or entity type.
This expression may return multiple names for item types, but always returns a single name per entity 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.

might want to specify what exact case this happens in (say, only with aliases?)

@Override
public boolean isSingle() {
return types.isSingle();
return getExpr().isSingle();

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 is wrong, a single item input can produce non-single output.
It's probably better for items to only produce 1:1 output overall though, and just return the first name.

Comment on lines +1 to +12
test "raw name - entity":
assert vanilla name of cow is "minecraft:cow"
assert vanilla name of cave spider is "minecraft:cave_spider"
assert vanilla names of cow and pig are "minecraft:cow" and "minecraft:pig"

test "raw name - item":
assert vanilla name of stone is "minecraft:stone"
assert vanilla name of oak planks is "minecraft:oak_planks"
assert vanilla names of grass block and dirt are "minecraft:grass_block" and "minecraft:dirt"

test "raw name - mixed":
assert vanilla names of stone, pig, grass block, cow are "minecraft:stone", "minecraft:pig", "minecraft:grass_block", "minecraft:cow"

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.

there's no testing of the 1 item - multiple names thing
no testing of raw/minecraft syntax options

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

Labels

don't merge me !! For pull requests that should not be merged due to some outstanding dispute, conflict or dependency. enhancement Feature request, an issue about something that could be improved, or a PR improving something. needs reviews A PR that needs additional reviews

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants