From 9d64075c32b69acf0c21802432ac156501cf43e9 Mon Sep 17 00:00:00 2001 From: ch-yx Date: Mon, 16 Oct 2023 20:32:22 +0800 Subject: [PATCH 1/5] remove sound exception? --- src/main/java/carpet/script/api/Auxiliary.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 6fc6a1a42..bcc4e94bf 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -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 soundHolder = Holder.direct(SoundEvent.createVariableRangeEvent(soundName)); float volume = 1.0F; float pitch = 1.0F; From da6e9eaa7f0055554171353b232073ef632c2e96 Mon Sep 17 00:00:00 2001 From: ch-yx Date: Sun, 22 Oct 2023 18:16:07 +0800 Subject: [PATCH 2/5] remove that in document too --- docs/scarpet/api/Auxiliary.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/scarpet/api/Auxiliary.md b/docs/scarpet/api/Auxiliary.md index 0d264bd8d..2e4197639 100644 --- a/docs/scarpet/api/Auxiliary.md +++ b/docs/scarpet/api/Auxiliary.md @@ -14,7 +14,6 @@ and `voice`. `pos` can be either a block, triple of coords, or a list of three n Used with no arguments, return the list of available sound names. -Throws `unknown_sound` if sound doesn't exist. ## Particles From c4fca3d2c5d9fda7f476c916fee35c58b6f2a83a Mon Sep 17 00:00:00 2001 From: ch-yx Date: Sun, 22 Oct 2023 18:44:09 +0800 Subject: [PATCH 3/5] seems that it is no longer needed? --- src/main/java/carpet/script/exception/Throwables.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/carpet/script/exception/Throwables.java b/src/main/java/carpet/script/exception/Throwables.java index 7d399dfa9..0b2d3cee4 100644 --- a/src/main/java/carpet/script/exception/Throwables.java +++ b/src/main/java/carpet/script/exception/Throwables.java @@ -21,7 +21,7 @@ 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_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); From 933367f630205f77853dea4234928004a527f92a Mon Sep 17 00:00:00 2001 From: ch-yx Date: Sun, 22 Oct 2023 23:54:37 +0800 Subject: [PATCH 4/5] ok... --- docs/scarpet/api/Auxiliary.md | 1 + src/main/java/carpet/script/exception/Throwables.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/scarpet/api/Auxiliary.md b/docs/scarpet/api/Auxiliary.md index 2e4197639..157f8aad5 100644 --- a/docs/scarpet/api/Auxiliary.md +++ b/docs/scarpet/api/Auxiliary.md @@ -14,6 +14,7 @@ and `voice`. `pos` can be either a block, triple of coords, or a list of three n Used with no arguments, return the list of available sound names. +However, the client may still play the sound normally, even if the name of the sound to be played is not in that list above. ## Particles diff --git a/src/main/java/carpet/script/exception/Throwables.java b/src/main/java/carpet/script/exception/Throwables.java index 0b2d3cee4..ab345946e 100644 --- a/src/main/java/carpet/script/exception/Throwables.java +++ b/src/main/java/carpet/script/exception/Throwables.java @@ -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); From b86d0e0553a28938a0bdaa9c1bf9e4a3ed7077e7 Mon Sep 17 00:00:00 2001 From: altrisi Date: Thu, 18 Jan 2024 18:01:18 +0100 Subject: [PATCH 5/5] Mention returned list may not be complete --- docs/scarpet/api/Auxiliary.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/scarpet/api/Auxiliary.md b/docs/scarpet/api/Auxiliary.md index 157f8aad5..8427523e5 100644 --- a/docs/scarpet/api/Auxiliary.md +++ b/docs/scarpet/api/Auxiliary.md @@ -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. - -However, the client may still play the sound normally, even if the name of the sound to be played is not in that list above. +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