Skip to content

Commit

Permalink
feat(data): add Wolf Sound Variants
Browse files Browse the repository at this point in the history
Wolf sound variants are now exposed through a Key on Wolves.

See https://minecraft.wiki/w/Wolf#Sound_variants_2
  • Loading branch information
gabizou committed Feb 23, 2025
1 parent 105ced1 commit 19616ee
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
import org.spongepowered.api.data.type.VillagerType;
import org.spongepowered.api.data.type.WallConnectionState;
import org.spongepowered.api.data.type.WireAttachmentType;
import org.spongepowered.api.data.type.WolfSoundVariant;
import org.spongepowered.api.data.type.WolfVariant;
import org.spongepowered.api.data.value.ListValue;
import org.spongepowered.api.data.value.MapValue;
Expand Down Expand Up @@ -3527,6 +3528,13 @@ public final class Keys {
*/
public static final Key<Value<WolfVariant>> WOLF_VARIANT = Keys.key(ResourceKey.sponge("wolf_variant"), WolfVariant.class);

/**
* The {@link WolfSoundVariant} of a {@link Wolf}.
*
* @see <a href="https://minecraft.wiki/w/Wolf#Sound_variants_2">Wolves wiki</a>
*/
public static final Key<Value<WolfSoundVariant>> WOLF_SOUND_VARIANT = Keys.key(ResourceKey.sponge("wolf_sound_variant"), WolfSoundVariant.class);

/**
* The {@link Sheep} who is being targeted by the {@link SpellTypes#WOLOLO}
* spell being casted by an {@link Evoker}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.data.type;

import org.spongepowered.api.registry.DefaultedRegistryValue;
import org.spongepowered.api.util.annotation.CatalogedBy;

@CatalogedBy(WolfSoundVariants.class)
public interface WolfSoundVariant extends DefaultedRegistryValue {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.data.type;

import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.registry.DefaultedRegistryReference;
import org.spongepowered.api.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;

@SuppressWarnings("unused")
@RegistryScopes(scopes = RegistryScope.ENGINE)
public final class WolfSoundVariants {

public static final DefaultedRegistryReference<WolfSoundVariant> ANGRY = WolfSoundVariants.key(ResourceKey.minecraft("angry"));

public static final DefaultedRegistryReference<WolfSoundVariant> BIG = WolfSoundVariants.key(ResourceKey.minecraft("big"));

public static final DefaultedRegistryReference<WolfSoundVariant> CLASSIC = WolfSoundVariants.key(ResourceKey.minecraft("classic"));

public static final DefaultedRegistryReference<WolfSoundVariant> CUTE = WolfSoundVariants.key(ResourceKey.minecraft("cute"));

public static final DefaultedRegistryReference<WolfSoundVariant> GRUMPY = WolfSoundVariants.key(ResourceKey.minecraft("grumpy"));

public static final DefaultedRegistryReference<WolfSoundVariant> PUGLIN = WolfSoundVariants.key(ResourceKey.minecraft("puglin"));

public static final DefaultedRegistryReference<WolfSoundVariant> SAD = WolfSoundVariants.key(ResourceKey.minecraft("sad"));

private WolfSoundVariants() {
}

public static Registry<WolfSoundVariant> registry() {
return Sponge.server().registry(RegistryTypes.WOLF_SOUND_VARIANT);
}

private static DefaultedRegistryReference<WolfSoundVariant> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.WOLF_SOUND_VARIANT, location).asDefaultedReference(Sponge::server);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.DyeColor;
import org.spongepowered.api.data.type.WolfSoundVariant;
import org.spongepowered.api.data.type.WolfVariant;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.Angerable;
Expand All @@ -43,6 +44,14 @@ default Value.Mutable<WolfVariant> variant() {
return this.requireValue(Keys.WOLF_VARIANT).asMutable();
}

/**
* {@link Keys#WOLF_SOUND_VARIANT}
* @return The wolf's sound variant
*/
default Value.Mutable<WolfSoundVariant> soundVariant() {
return this.requireValue(Keys.WOLF_SOUND_VARIANT).asMutable();
}

/**
* {@link Keys#DYE_COLOR}
* @return The collar color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
import org.spongepowered.api.data.type.VillagerType;
import org.spongepowered.api.data.type.WallConnectionState;
import org.spongepowered.api.data.type.WireAttachmentType;
import org.spongepowered.api.data.type.WolfSoundVariant;
import org.spongepowered.api.data.type.WolfVariant;
import org.spongepowered.api.effect.particle.ParticleOption;
import org.spongepowered.api.effect.particle.ParticleType;
Expand Down Expand Up @@ -530,6 +531,8 @@ public final class RegistryTypes {

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

public static final DefaultedRegistryType<WolfSoundVariant> WOLF_SOUND_VARIANT = RegistryTypes.spongeKeyInGame("wolf_sound_variant");

public static final DefaultedRegistryType<WireAttachmentType> WIRE_ATTACHMENT_TYPE = RegistryTypes.spongeKeyInGame("wire_attachment_type");

// @formatter:on
Expand Down

0 comments on commit 19616ee

Please sign in to comment.