Skip to content

Commit 19616ee

Browse files
committed
feat(data): add Wolf Sound Variants
Wolf sound variants are now exposed through a Key on Wolves. See https://minecraft.wiki/w/Wolf#Sound_variants_2
1 parent 105ced1 commit 19616ee

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
import org.spongepowered.api.data.type.VillagerType;
100100
import org.spongepowered.api.data.type.WallConnectionState;
101101
import org.spongepowered.api.data.type.WireAttachmentType;
102+
import org.spongepowered.api.data.type.WolfSoundVariant;
102103
import org.spongepowered.api.data.type.WolfVariant;
103104
import org.spongepowered.api.data.value.ListValue;
104105
import org.spongepowered.api.data.value.MapValue;
@@ -3527,6 +3528,13 @@ public final class Keys {
35273528
*/
35283529
public static final Key<Value<WolfVariant>> WOLF_VARIANT = Keys.key(ResourceKey.sponge("wolf_variant"), WolfVariant.class);
35293530

3531+
/**
3532+
* The {@link WolfSoundVariant} of a {@link Wolf}.
3533+
*
3534+
* @see <a href="https://minecraft.wiki/w/Wolf#Sound_variants_2">Wolves wiki</a>
3535+
*/
3536+
public static final Key<Value<WolfSoundVariant>> WOLF_SOUND_VARIANT = Keys.key(ResourceKey.sponge("wolf_sound_variant"), WolfSoundVariant.class);
3537+
35303538
/**
35313539
* The {@link Sheep} who is being targeted by the {@link SpellTypes#WOLOLO}
35323540
* spell being casted by an {@link Evoker}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) SpongePowered <https://www.spongepowered.org>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
package org.spongepowered.api.data.type;
26+
27+
import org.spongepowered.api.registry.DefaultedRegistryValue;
28+
import org.spongepowered.api.util.annotation.CatalogedBy;
29+
30+
@CatalogedBy(WolfSoundVariants.class)
31+
public interface WolfSoundVariant extends DefaultedRegistryValue {
32+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) SpongePowered <https://www.spongepowered.org>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
package org.spongepowered.api.data.type;
26+
27+
import org.spongepowered.api.ResourceKey;
28+
import org.spongepowered.api.Sponge;
29+
import org.spongepowered.api.registry.DefaultedRegistryReference;
30+
import org.spongepowered.api.registry.Registry;
31+
import org.spongepowered.api.registry.RegistryKey;
32+
import org.spongepowered.api.registry.RegistryScope;
33+
import org.spongepowered.api.registry.RegistryScopes;
34+
import org.spongepowered.api.registry.RegistryTypes;
35+
36+
@SuppressWarnings("unused")
37+
@RegistryScopes(scopes = RegistryScope.ENGINE)
38+
public final class WolfSoundVariants {
39+
40+
public static final DefaultedRegistryReference<WolfSoundVariant> ANGRY = WolfSoundVariants.key(ResourceKey.minecraft("angry"));
41+
42+
public static final DefaultedRegistryReference<WolfSoundVariant> BIG = WolfSoundVariants.key(ResourceKey.minecraft("big"));
43+
44+
public static final DefaultedRegistryReference<WolfSoundVariant> CLASSIC = WolfSoundVariants.key(ResourceKey.minecraft("classic"));
45+
46+
public static final DefaultedRegistryReference<WolfSoundVariant> CUTE = WolfSoundVariants.key(ResourceKey.minecraft("cute"));
47+
48+
public static final DefaultedRegistryReference<WolfSoundVariant> GRUMPY = WolfSoundVariants.key(ResourceKey.minecraft("grumpy"));
49+
50+
public static final DefaultedRegistryReference<WolfSoundVariant> PUGLIN = WolfSoundVariants.key(ResourceKey.minecraft("puglin"));
51+
52+
public static final DefaultedRegistryReference<WolfSoundVariant> SAD = WolfSoundVariants.key(ResourceKey.minecraft("sad"));
53+
54+
private WolfSoundVariants() {
55+
}
56+
57+
public static Registry<WolfSoundVariant> registry() {
58+
return Sponge.server().registry(RegistryTypes.WOLF_SOUND_VARIANT);
59+
}
60+
61+
private static DefaultedRegistryReference<WolfSoundVariant> key(final ResourceKey location) {
62+
return RegistryKey.of(RegistryTypes.WOLF_SOUND_VARIANT, location).asDefaultedReference(Sponge::server);
63+
}
64+
}

src/main/java/org/spongepowered/api/entity/living/animal/Wolf.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import org.spongepowered.api.data.Keys;
2828
import org.spongepowered.api.data.type.DyeColor;
29+
import org.spongepowered.api.data.type.WolfSoundVariant;
2930
import org.spongepowered.api.data.type.WolfVariant;
3031
import org.spongepowered.api.data.value.Value;
3132
import org.spongepowered.api.entity.Angerable;
@@ -43,6 +44,14 @@ default Value.Mutable<WolfVariant> variant() {
4344
return this.requireValue(Keys.WOLF_VARIANT).asMutable();
4445
}
4546

47+
/**
48+
* {@link Keys#WOLF_SOUND_VARIANT}
49+
* @return The wolf's sound variant
50+
*/
51+
default Value.Mutable<WolfSoundVariant> soundVariant() {
52+
return this.requireValue(Keys.WOLF_SOUND_VARIANT).asMutable();
53+
}
54+
4655
/**
4756
* {@link Keys#DYE_COLOR}
4857
* @return The collar color

src/main/java/org/spongepowered/api/registry/RegistryTypes.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
import org.spongepowered.api.data.type.VillagerType;
100100
import org.spongepowered.api.data.type.WallConnectionState;
101101
import org.spongepowered.api.data.type.WireAttachmentType;
102+
import org.spongepowered.api.data.type.WolfSoundVariant;
102103
import org.spongepowered.api.data.type.WolfVariant;
103104
import org.spongepowered.api.effect.particle.ParticleOption;
104105
import org.spongepowered.api.effect.particle.ParticleType;
@@ -530,6 +531,8 @@ public final class RegistryTypes {
530531

531532
public static final DefaultedRegistryType<WolfVariant> WOLF_VAIRANT = RegistryTypes.minecraftKeyInServer("wolf_vairant");
532533

534+
public static final DefaultedRegistryType<WolfSoundVariant> WOLF_SOUND_VARIANT = RegistryTypes.spongeKeyInGame("wolf_sound_variant");
535+
533536
public static final DefaultedRegistryType<WireAttachmentType> WIRE_ATTACHMENT_TYPE = RegistryTypes.spongeKeyInGame("wire_attachment_type");
534537

535538
// @formatter:on

0 commit comments

Comments
 (0)