Skip to content

Commit

Permalink
feat: add WolfVariant
Browse files Browse the repository at this point in the history
  • Loading branch information
gabizou committed Jan 23, 2025
1 parent 2b5559f commit 5d8207c
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,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.WolfVariant;
import org.spongepowered.api.data.value.ListValue;
import org.spongepowered.api.data.value.MapValue;
import org.spongepowered.api.data.value.SetValue;
Expand Down Expand Up @@ -3449,6 +3450,11 @@ public final class Keys {
*/
public static final Key<ListValue<Entity>> WITHER_TARGETS = Keys.listKey(ResourceKey.sponge("wither_targets"), Entity.class);

/**
* The {@link WolfVariant} of a {@link Wolf}.
*/
public static final Key<Value<WolfVariant>> WOLF_VARIANT = Keys.key(ResourceKey.sponge("wolf_variant"), WolfVariant.class);

/**
* The {@link Sheep} who is being targeted by the {@link SpellTypes#WOLOLO}
* spell being casted by an {@link Evoker}
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/org/spongepowered/api/data/type/WolfVariant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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(WolfVariants.class)
public interface WolfVariant extends DefaultedRegistryValue {

}
71 changes: 71 additions & 0 deletions src/main/java/org/spongepowered/api/data/type/WolfVariants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* 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.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryReference;
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;
import org.spongepowered.api.world.server.ServerWorld;

/**
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
*/
@SuppressWarnings("unused")
@RegistryScopes(scopes = RegistryScope.WORLD)
public final class WolfVariants {

public static final RegistryReference<WolfVariant> ASHEN = WolfVariants.key(ResourceKey.minecraft("ashen"));

public static final RegistryReference<WolfVariant> BLACK = WolfVariants.key(ResourceKey.minecraft("black"));

public static final RegistryReference<WolfVariant> CHESTNUT = WolfVariants.key(ResourceKey.minecraft("chestnut"));

public static final RegistryReference<WolfVariant> PALE = WolfVariants.key(ResourceKey.minecraft("pale"));

public static final RegistryReference<WolfVariant> RUSTY = WolfVariants.key(ResourceKey.minecraft("rusty"));

public static final RegistryReference<WolfVariant> SNOWY = WolfVariants.key(ResourceKey.minecraft("snowy"));

public static final RegistryReference<WolfVariant> SPOTTED = WolfVariants.key(ResourceKey.minecraft("spotted"));

public static final RegistryReference<WolfVariant> STRIPED = WolfVariants.key(ResourceKey.minecraft("striped"));

public static final RegistryReference<WolfVariant> WOODS = WolfVariants.key(ResourceKey.minecraft("woods"));

private WolfVariants() {
}

public static Registry<WolfVariant> registry(final ServerWorld world) {
return world.registry(RegistryTypes.WOLF_VAIRANT);
}

private static RegistryReference<WolfVariant> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.WOLF_VAIRANT, location).asReference();
}
}
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.WolfVariant;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.entity.Angerable;

Expand All @@ -34,6 +35,14 @@
*/
public interface Wolf extends TameableAnimal, Angerable {

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

/**
* {@link Keys#DYE_COLOR}
* @return The collar color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,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.WolfVariant;
import org.spongepowered.api.effect.particle.ParticleOption;
import org.spongepowered.api.effect.particle.ParticleType;
import org.spongepowered.api.effect.potion.PotionEffectType;
Expand Down Expand Up @@ -512,6 +513,8 @@ public final class RegistryTypes {

public static final DefaultedRegistryType<WeatherType> WEATHER_TYPE = RegistryTypes.spongeKeyInGame("weather_type");

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

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

// @formatter:on
Expand Down

0 comments on commit 5d8207c

Please sign in to comment.