Skript icon indicating copy to clipboard operation
Skript copied to clipboard

add environment expression

Open UnderscoreTud opened this issue 2 years ago • 7 comments

Description

This PR adds a way to get the environment of a world, (get if the world is an overworld, nether or end)


Target Minecraft Versions: any Requirements: none Related Issues: https://github.com/SkriptLang/Skript/issues/3673

UnderscoreTud avatar Aug 29 '22 10:08 UnderscoreTud

Related issue:

  • #3673

AyhamAl-Ali avatar Aug 29 '22 11:08 AyhamAl-Ali

You also need to respect the original enum name. Normal is also not in the default.lang for the enum environments.normal.

A test can be added for this. The main world of the test runner is a super flat world, along with the end being enabled. A super flat is defined as normal and not custom, as environment is different from world generation, hence why normal should be an accepted enum.

test "world environment":
	assert environment of world "world" is normal with "main overworld was not environment ""normal"""
	assert environment of world "world_the_end" is the end with "world_the_end was not environment ""the end"""
	set {_environment} to environment of world "world"
	assert {_environment} is overworld with "environment of world didn't compare with a variable"

TheLimeGlass avatar Sep 16 '22 02:09 TheLimeGlass

You also need to respect the original enum name. Normal is also not in the default.lang for the enum environments.normal.

A test can be added for this. The main world of the test runner is a super flat world, along with the end being enabled. A super flat is defined as normal and not custom, as environment is different from world generation, hence why normal should be an accepted enum.

test "world environment":
	assert environment of world "world" is normal with "main overworld was not environment ""normal"""
	assert environment of world "world_the_end" is the end with "world_the_end was not environment ""the end"""
	set {_environment} to environment of world "world"
	assert {_environment} is overworld with "environment of world didn't compare with a variable"

it is there, it's just called "overworld" as it makes more sense

UnderscoreTud avatar Sep 16 '22 03:09 UnderscoreTud

it is there, it's just called "overworld" as it makes more sense

The type normal refers to the sky (and a few other details like temperature etc), sure overworld works, but normal is the literal name used for the enum and if someone knows the Environment enum like me, I would instinctively use normal.

TheLimeGlass avatar Sep 16 '22 03:09 TheLimeGlass

The type normal refers to the sky (and a few other details like temperature etc), sure overworld works, but normal is the literal name used for the enum and if someone knows the Environment enum like me, I would instinctively use normal.

Should i replace overworld with normal or just add it?

UnderscoreTud avatar Sep 16 '22 17:09 UnderscoreTud

The type normal refers to the sky (and a few other details like temperature etc), sure overworld works, but normal is the literal name used for the enum and if someone knows the Environment enum like me, I would instinctively use normal.

Should i replace overworld with normal or just add it?

Just adding, overworld is fine as an aliases.

TheLimeGlass avatar Sep 16 '22 17:09 TheLimeGlass

Wait a test script should be added. I wrote an example that's tested

oh right, i forgot to add that, ill do it later :grin:

UnderscoreTud avatar Sep 16 '22 19:09 UnderscoreTud