Skip to content

Commit a495efc

Browse files
committed
feat(data): add axolotl variants
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
1 parent 5dde2cc commit a495efc

File tree

5 files changed

+110
-1
lines changed

5 files changed

+110
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import org.spongepowered.api.data.type.ArmorMaterial;
5555
import org.spongepowered.api.data.type.ArtType;
5656
import org.spongepowered.api.data.type.AttachmentSurface;
57+
import org.spongepowered.api.data.type.AxolotlVariant;
5758
import org.spongepowered.api.data.type.BoatType;
5859
import org.spongepowered.api.data.type.BodyPart;
5960
import org.spongepowered.api.data.type.BodyParts;
@@ -146,6 +147,7 @@
146147
import org.spongepowered.api.entity.living.Humanoid;
147148
import org.spongepowered.api.entity.living.Living;
148149
import org.spongepowered.api.entity.living.animal.Animal;
150+
import org.spongepowered.api.entity.living.animal.Axolotl;
149151
import org.spongepowered.api.entity.living.animal.Cat;
150152
import org.spongepowered.api.entity.living.animal.Chicken;
151153
import org.spongepowered.api.entity.living.animal.Fox;
@@ -471,6 +473,11 @@ public final class Keys {
471473
*/
472474
public static final Key<Value<Axis>> AXIS = Keys.key(ResourceKey.sponge("axis"), Axis.class);
473475

476+
/**
477+
* The {@link AxolotlVariant} of an {@link Axolotl}.
478+
*/
479+
public static final Key<Value<AxolotlVariant>> AXOLOTL_VARIANT = Keys.key(ResourceKey.sponge("axolotl_variant"), AxolotlVariant.class);
480+
474481
/**
475482
* The ticks until a {@link Ageable} turns into an adult.
476483
*/
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(AxolotlVariants.class)
31+
public interface AxolotlVariant extends DefaultedRegistryValue, StringRepresentable {
32+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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.RegistryKey;
31+
import org.spongepowered.api.registry.RegistryTypes;
32+
33+
/**
34+
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
35+
*/
36+
public class AxolotlVariants {
37+
38+
public static final DefaultedRegistryReference<AxolotlVariant> BLUE = AxolotlVariants.key(ResourceKey.sponge("blue"));
39+
40+
public static final DefaultedRegistryReference<AxolotlVariant> CYAN = AxolotlVariants.key(ResourceKey.sponge("cyan"));
41+
42+
public static final DefaultedRegistryReference<AxolotlVariant> GOLD = AxolotlVariants.key(ResourceKey.sponge("gold"));
43+
44+
public static final DefaultedRegistryReference<AxolotlVariant> LUCY = AxolotlVariants.key(ResourceKey.sponge("lucy"));
45+
46+
public static final DefaultedRegistryReference<AxolotlVariant> WILD = AxolotlVariants.key(ResourceKey.sponge("wild"));
47+
48+
49+
private static DefaultedRegistryReference<AxolotlVariant> key(final ResourceKey location) {
50+
return RegistryKey.of(RegistryTypes.AXOLOTL_VARIANT, location).asDefaultedReference(Sponge::game);
51+
}
52+
53+
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,23 @@
2424
*/
2525
package org.spongepowered.api.entity.living.animal;
2626

27+
import org.spongepowered.api.data.Keys;
28+
import org.spongepowered.api.data.type.AxolotlVariant;
29+
import org.spongepowered.api.data.value.Value;
30+
2731
/**
2832
* Represents an Axolotl.
2933
*/
3034
public interface Axolotl extends Animal {
35+
36+
/**
37+
* Gets the {@link AxolotlVariant} of this Axolotl. Can be
38+
* set back.
39+
*
40+
* @see org.spongepowered.api.data.type.AxolotlVariants
41+
* @return The AxolotlVariant of this Axolotl.
42+
*/
43+
default Value<AxolotlVariant> variant() {
44+
return this.requireValue(Keys.AXOLOTL_VARIANT);
45+
}
3146
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.spongepowered.api.data.type.ArmorMaterial;
4747
import org.spongepowered.api.data.type.ArtType;
4848
import org.spongepowered.api.data.type.AttachmentSurface;
49+
import org.spongepowered.api.data.type.AxolotlVariant;
4950
import org.spongepowered.api.data.type.BambooLeavesType;
5051
import org.spongepowered.api.data.type.BannerPatternShape;
5152
import org.spongepowered.api.data.type.BellAttachmentType;
@@ -83,7 +84,6 @@
8384
import org.spongepowered.api.data.type.RaidStatus;
8485
import org.spongepowered.api.data.type.RailDirection;
8586
import org.spongepowered.api.data.type.SalmonSize;
86-
import org.spongepowered.api.data.type.SalmonSizes;
8787
import org.spongepowered.api.data.type.SculkSensorState;
8888
import org.spongepowered.api.data.type.SkinPart;
8989
import org.spongepowered.api.data.type.SlabPortion;
@@ -207,6 +207,8 @@ public final class RegistryTypes {
207207

208208
public static final DefaultedRegistryType<AttributeType> ATTRIBUTE_TYPE = RegistryTypes.minecraftKeyInGame("attribute");
209209

210+
public static final DefaultedRegistryType<AxolotlVariant> AXOLOTL_VARIANT = RegistryTypes.spongeKeyInGame("axolotl_variant");
211+
210212
public static final DefaultedRegistryType<Biome> BIOME = RegistryTypes.minecraftKeyInServer("worldgen/biome");
211213

212214
public static final DefaultedRegistryType<BlockType> BLOCK_TYPE = RegistryTypes.minecraftKeyInGame("block");

0 commit comments

Comments
 (0)