Skip to content

Commit

Permalink
Remove check for sound presence from Scarpet's sound function (#1834)
Browse files Browse the repository at this point in the history
  • Loading branch information
17183248569 authored Jan 18, 2024
1 parent 2fabf39 commit 4aec811
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
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.
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));
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

0 comments on commit 4aec811

Please sign in to comment.