Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove check for sound presence from Scarpet's sound function #1834

Merged
merged 6 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions docs/scarpet/api/Auxiliary.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ Valid mixer options are `master`, `music`, `record`, `weather`, `block`, `hostil
and `voice`. `pos` can be either a block, triple of coords, or a list of three numbers. Uses the same options as a
corresponding `playsound` command.

Used with no arguments, return the list of available sound names.

Throws `unknown_sound` if sound doesn't exist.
17183248569 marked this conversation as resolved.
Show resolved Hide resolved
Used with no arguments, returns a list of available sound names. Note that this list may not include all sounds that
clients will actually be able to receive (they may have more available via resourcepacks for example).

## Particles

Expand Down
5 changes: 1 addition & 4 deletions src/main/java/carpet/script/api/Auxiliary.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ public static void apply(Expression expression)
String rawString = lv.get(0).getString();
ResourceLocation soundName = InputValidator.identifierOf(rawString);
Vector3Argument locator = Vector3Argument.findIn(lv, 1);
if (cc.registry(Registries.SOUND_EVENT).get(soundName) == null)
{
throw new ThrowStatement(rawString, Throwables.UNKNOWN_SOUND);
}

Holder<SoundEvent> soundHolder = Holder.direct(SoundEvent.createVariableRangeEvent(soundName));
altrisi marked this conversation as resolved.
Show resolved Hide resolved
float volume = 1.0F;
float pitch = 1.0F;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/carpet/script/exception/Throwables.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class Throwables
public static final Throwables UNKNOWN_ITEM = register("unknown_item", VALUE_EXCEPTION);
public static final Throwables UNKNOWN_BLOCK = register("unknown_block", VALUE_EXCEPTION);
public static final Throwables UNKNOWN_BIOME = register("unknown_biome", VALUE_EXCEPTION);
public static final Throwables UNKNOWN_SOUND = register("unknown_sound", VALUE_EXCEPTION);
public static final Throwables UNKNOWN_PARTICLE = register("unknown_particle", VALUE_EXCEPTION);
public static final Throwables UNKNOWN_POI = register("unknown_poi", VALUE_EXCEPTION);
public static final Throwables UNKNOWN_DIMENSION = register("unknown_dimension", VALUE_EXCEPTION);
Expand Down