Skip to content

Commit 5d8207c

Browse files
committed
feat: add WolfVariant
1 parent 2b5559f commit 5d8207c

File tree

5 files changed

+122
-0
lines changed

5 files changed

+122
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
import org.spongepowered.api.data.type.VillagerType;
9898
import org.spongepowered.api.data.type.WallConnectionState;
9999
import org.spongepowered.api.data.type.WireAttachmentType;
100+
import org.spongepowered.api.data.type.WolfVariant;
100101
import org.spongepowered.api.data.value.ListValue;
101102
import org.spongepowered.api.data.value.MapValue;
102103
import org.spongepowered.api.data.value.SetValue;
@@ -3449,6 +3450,11 @@ public final class Keys {
34493450
*/
34503451
public static final Key<ListValue<Entity>> WITHER_TARGETS = Keys.listKey(ResourceKey.sponge("wither_targets"), Entity.class);
34513452

3453+
/**
3454+
* The {@link WolfVariant} of a {@link Wolf}.
3455+
*/
3456+
public static final Key<Value<WolfVariant>> WOLF_VARIANT = Keys.key(ResourceKey.sponge("wolf_variant"), WolfVariant.class);
3457+
34523458
/**
34533459
* The {@link Sheep} who is being targeted by the {@link SpellTypes#WOLOLO}
34543460
* spell being casted by an {@link Evoker}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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(WolfVariants.class)
31+
public interface WolfVariant extends DefaultedRegistryValue {
32+
33+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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.registry.Registry;
29+
import org.spongepowered.api.registry.RegistryKey;
30+
import org.spongepowered.api.registry.RegistryReference;
31+
import org.spongepowered.api.registry.RegistryScope;
32+
import org.spongepowered.api.registry.RegistryScopes;
33+
import org.spongepowered.api.registry.RegistryTypes;
34+
import org.spongepowered.api.world.server.ServerWorld;
35+
36+
/**
37+
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
38+
*/
39+
@SuppressWarnings("unused")
40+
@RegistryScopes(scopes = RegistryScope.WORLD)
41+
public final class WolfVariants {
42+
43+
public static final RegistryReference<WolfVariant> ASHEN = WolfVariants.key(ResourceKey.minecraft("ashen"));
44+
45+
public static final RegistryReference<WolfVariant> BLACK = WolfVariants.key(ResourceKey.minecraft("black"));
46+
47+
public static final RegistryReference<WolfVariant> CHESTNUT = WolfVariants.key(ResourceKey.minecraft("chestnut"));
48+
49+
public static final RegistryReference<WolfVariant> PALE = WolfVariants.key(ResourceKey.minecraft("pale"));
50+
51+
public static final RegistryReference<WolfVariant> RUSTY = WolfVariants.key(ResourceKey.minecraft("rusty"));
52+
53+
public static final RegistryReference<WolfVariant> SNOWY = WolfVariants.key(ResourceKey.minecraft("snowy"));
54+
55+
public static final RegistryReference<WolfVariant> SPOTTED = WolfVariants.key(ResourceKey.minecraft("spotted"));
56+
57+
public static final RegistryReference<WolfVariant> STRIPED = WolfVariants.key(ResourceKey.minecraft("striped"));
58+
59+
public static final RegistryReference<WolfVariant> WOODS = WolfVariants.key(ResourceKey.minecraft("woods"));
60+
61+
private WolfVariants() {
62+
}
63+
64+
public static Registry<WolfVariant> registry(final ServerWorld world) {
65+
return world.registry(RegistryTypes.WOLF_VAIRANT);
66+
}
67+
68+
private static RegistryReference<WolfVariant> key(final ResourceKey location) {
69+
return RegistryKey.of(RegistryTypes.WOLF_VAIRANT, location).asReference();
70+
}
71+
}

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.WolfVariant;
2930
import org.spongepowered.api.data.value.Value;
3031
import org.spongepowered.api.entity.Angerable;
3132

@@ -34,6 +35,14 @@
3435
*/
3536
public interface Wolf extends TameableAnimal, Angerable {
3637

38+
/**
39+
* {@link Keys#WOLF_VARIANT}
40+
* @return The wolf's variant
41+
*/
42+
default Value.Mutable<WolfVariant> variant() {
43+
return this.requireValue(Keys.WOLF_VARIANT).asMutable();
44+
}
45+
3746
/**
3847
* {@link Keys#DYE_COLOR}
3948
* @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
@@ -94,6 +94,7 @@
9494
import org.spongepowered.api.data.type.VillagerType;
9595
import org.spongepowered.api.data.type.WallConnectionState;
9696
import org.spongepowered.api.data.type.WireAttachmentType;
97+
import org.spongepowered.api.data.type.WolfVariant;
9798
import org.spongepowered.api.effect.particle.ParticleOption;
9899
import org.spongepowered.api.effect.particle.ParticleType;
99100
import org.spongepowered.api.effect.potion.PotionEffectType;
@@ -512,6 +513,8 @@ public final class RegistryTypes {
512513

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

516+
public static final DefaultedRegistryType<WolfVariant> WOLF_VAIRANT = RegistryTypes.minecraftKeyInServer("wolf_vairant");
517+
515518
public static final DefaultedRegistryType<WireAttachmentType> WIRE_ATTACHMENT_TYPE = RegistryTypes.spongeKeyInGame("wire_attachment_type");
516519

517520
// @formatter:on

0 commit comments

Comments
 (0)