From acb44bc520d700799fdb49bc8050f51e31902d57 Mon Sep 17 00:00:00 2001 From: kashike Date: Wed, 12 Apr 2017 07:01:58 -0700 Subject: [PATCH] SQUAWK (Add Parrot) --- build.gradle | 1 + .../org/spongepowered/api/CatalogTypes.java | 2 + .../org/spongepowered/api/data/key/Keys.java | 8 +++ .../immutable/entity/ImmutableParrotData.java | 38 +++++++++++++ .../mutable/entity/ParrotData.java | 38 +++++++++++++ .../api/data/type/ParrotVariant.java | 37 ++++++++++++ .../api/data/type/ParrotVariants.java | 50 ++++++++++++++++ .../api/entity/living/animal/Parrot.java | 57 +++++++++++++++++++ 8 files changed, 231 insertions(+) create mode 100644 src/main/java/org/spongepowered/api/data/manipulator/immutable/entity/ImmutableParrotData.java create mode 100644 src/main/java/org/spongepowered/api/data/manipulator/mutable/entity/ParrotData.java create mode 100644 src/main/java/org/spongepowered/api/data/type/ParrotVariant.java create mode 100644 src/main/java/org/spongepowered/api/data/type/ParrotVariants.java create mode 100644 src/main/java/org/spongepowered/api/entity/living/animal/Parrot.java diff --git a/build.gradle b/build.gradle index 80df4fe28ad..23886d6ecd0 100644 --- a/build.gradle +++ b/build.gradle @@ -134,6 +134,7 @@ sortClassFields { add 'main', 'org.spongepowered.api.data.type.LogAxes' add 'main', 'org.spongepowered.api.data.type.NotePitches' add 'main', 'org.spongepowered.api.data.type.OcelotTypes' + add 'main', 'org.spongepowered.api.data.type.ParrotVariants' add 'main', 'org.spongepowered.api.data.type.PickupRules' add 'main', 'org.spongepowered.api.data.type.PistonTypes' add 'main', 'org.spongepowered.api.data.type.PlantTypes' diff --git a/src/main/java/org/spongepowered/api/CatalogTypes.java b/src/main/java/org/spongepowered/api/CatalogTypes.java index 18882f079ba..e679e11bc05 100644 --- a/src/main/java/org/spongepowered/api/CatalogTypes.java +++ b/src/main/java/org/spongepowered/api/CatalogTypes.java @@ -213,6 +213,8 @@ public final class CatalogTypes { public static final Class OCELOT_TYPE = OcelotType.class; + public static final Class PARROT_VARIANT = ParrotVariant.class; + public static final Class PARTICLE_OPTION = ParticleOption.class; public static final Class PARTICLE_TYPE = ParticleType.class; diff --git a/src/main/java/org/spongepowered/api/data/key/Keys.java b/src/main/java/org/spongepowered/api/data/key/Keys.java index 8768735cf83..9fb70c88ab8 100644 --- a/src/main/java/org/spongepowered/api/data/key/Keys.java +++ b/src/main/java/org/spongepowered/api/data/key/Keys.java @@ -57,6 +57,7 @@ import org.spongepowered.api.entity.living.animal.Horse; import org.spongepowered.api.entity.living.animal.Llama; import org.spongepowered.api.entity.living.animal.Mule; +import org.spongepowered.api.entity.living.animal.Parrot; import org.spongepowered.api.entity.living.animal.RideableHorse; import org.spongepowered.api.entity.living.animal.SkeletonHorse; import org.spongepowered.api.entity.living.animal.ZombieHorse; @@ -1468,6 +1469,13 @@ public final class Keys { */ public static final Key> OPEN = KeyFactory.fake("OPEN"); + /** + * Represents the {@link ParrotVariant variant} of a {@link Parrot}. + * + * @see ParrotData#type() + */ + public static final Key> PARROT_VARIANT = KeyFactory.fake("PARROT_VARIANT"); + /** * Represents the {@link Key} for the amount of ticks a {@link Furnace} has * already been burning with the current fuel item. diff --git a/src/main/java/org/spongepowered/api/data/manipulator/immutable/entity/ImmutableParrotData.java b/src/main/java/org/spongepowered/api/data/manipulator/immutable/entity/ImmutableParrotData.java new file mode 100644 index 00000000000..77322ebd30f --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/manipulator/immutable/entity/ImmutableParrotData.java @@ -0,0 +1,38 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.manipulator.immutable.entity; + +import org.spongepowered.api.data.manipulator.immutable.ImmutableVariantData; +import org.spongepowered.api.data.manipulator.mutable.entity.ParrotData; +import org.spongepowered.api.data.type.ParrotVariant; +import org.spongepowered.api.entity.living.animal.Parrot; + +/** + * A type of {@link ImmutableVariantData} for {@link ParrotVariant}s belonging + * to an {@link Parrot}. + */ +public interface ImmutableParrotData extends ImmutableVariantData { + +} diff --git a/src/main/java/org/spongepowered/api/data/manipulator/mutable/entity/ParrotData.java b/src/main/java/org/spongepowered/api/data/manipulator/mutable/entity/ParrotData.java new file mode 100644 index 00000000000..7b2302fe99b --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/manipulator/mutable/entity/ParrotData.java @@ -0,0 +1,38 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.manipulator.mutable.entity; + +import org.spongepowered.api.data.manipulator.immutable.entity.ImmutableParrotData; +import org.spongepowered.api.data.manipulator.mutable.VariantData; +import org.spongepowered.api.data.type.ParrotVariant; +import org.spongepowered.api.entity.living.animal.Parrot; + +/** + * A type of {@link VariantData} for {@link ParrotVariant}s belonging + * to an {@link Parrot}. + */ +public interface ParrotData extends VariantData { + +} diff --git a/src/main/java/org/spongepowered/api/data/type/ParrotVariant.java b/src/main/java/org/spongepowered/api/data/type/ParrotVariant.java new file mode 100644 index 00000000000..5b5d9359596 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ParrotVariant.java @@ -0,0 +1,37 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.CatalogType; +import org.spongepowered.api.entity.living.animal.Parrot; +import org.spongepowered.api.util.annotation.CatalogedBy; + +/** + * Represents the variant of a {@link Parrot}. + */ +@CatalogedBy(ParrotVariants.class) +public interface ParrotVariant extends CatalogType { + +} diff --git a/src/main/java/org/spongepowered/api/data/type/ParrotVariants.java b/src/main/java/org/spongepowered/api/data/type/ParrotVariants.java new file mode 100644 index 00000000000..59315104e10 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ParrotVariants.java @@ -0,0 +1,50 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.util.generator.dummy.DummyObjectProvider; + +/** + * An enumeration of known vanilla {@link OcelotType}s. + */ +public final class ParrotVariants { + + // SORTFIELDS:ON + + public static final ParrotVariant BLUE = DummyObjectProvider.createFor(ParrotVariant.class, "BLUE"); + + public static final ParrotVariant CYAN = DummyObjectProvider.createFor(ParrotVariant.class, "CYAN"); + + public static final ParrotVariant GRAY = DummyObjectProvider.createFor(ParrotVariant.class, "GRAY"); + + public static final ParrotVariant GREEN = DummyObjectProvider.createFor(ParrotVariant.class, "GREEN"); + + public static final ParrotVariant RED = DummyObjectProvider.createFor(ParrotVariant.class, "RED"); + + // SORTFIELDS:OFF + + private ParrotVariants() { + } +} diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/Parrot.java b/src/main/java/org/spongepowered/api/entity/living/animal/Parrot.java new file mode 100644 index 00000000000..3999f7fc0ef --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/animal/Parrot.java @@ -0,0 +1,57 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.entity.living.animal; + +import org.spongepowered.api.data.key.Keys; +import org.spongepowered.api.data.manipulator.mutable.entity.ParrotData; +import org.spongepowered.api.data.type.ParrotVariant; +import org.spongepowered.api.data.value.mutable.Value; + +/** + * Represents a parrot. + */ +public interface Parrot extends Animal { + + /** + * Gets a copy of the current {@link ParrotData} being represented by + * this {@link Parrot}. + * + * @return A copy of the current parrot data + */ + default ParrotData getParrotData() { + return this.get(ParrotData.class).get(); + } + + /** + * Gets the {@link Value} for the {@link ParrotVariant} of this + * {@link Parrot}. + * + * @return The parrot variant value + */ + default Value variant() { + return this.getValue(Keys.PARROT_VARIANT).get(); + } + +}