diff --git a/src/main/java/org/spongepowered/api/block/entity/DecoratedPot.java b/src/main/java/org/spongepowered/api/block/entity/DecoratedPot.java new file mode 100644 index 0000000000..1c2e1961dc --- /dev/null +++ b/src/main/java/org/spongepowered/api/block/entity/DecoratedPot.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.block.entity; + +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.item.ItemType; + +public interface DecoratedPot extends BlockEntity { + + default Value.Mutable front() { + return this.requireValue(Keys.POT_FRONT_DECORATION).asMutable(); + } + + default Value.Mutable back() { + return this.requireValue(Keys.POT_BACK_DECORATION).asMutable(); + } + + + default Value.Mutable left() { + return this.requireValue(Keys.POT_LEFT_DECORATION).asMutable(); + } + + default Value.Mutable right() { + return this.requireValue(Keys.POT_RIGHT_DECORATION).asMutable(); + } + +} diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java index 09e24ae1fd..03d915c140 100644 --- a/src/main/java/org/spongepowered/api/data/Keys.java +++ b/src/main/java/org/spongepowered/api/data/Keys.java @@ -35,6 +35,7 @@ import org.spongepowered.api.block.entity.BlockEntity; import org.spongepowered.api.block.entity.CommandBlock; import org.spongepowered.api.block.entity.CreakingHeart; +import org.spongepowered.api.block.entity.DecoratedPot; import org.spongepowered.api.block.entity.EndGateway; import org.spongepowered.api.block.entity.Jukebox; import org.spongepowered.api.block.entity.Lectern; @@ -236,6 +237,7 @@ import org.spongepowered.api.item.merchant.Merchant; import org.spongepowered.api.item.merchant.TradeOffer; import org.spongepowered.api.item.potion.PotionType; +import org.spongepowered.api.item.recipe.smithing.ArmorTrim; import org.spongepowered.api.map.MapCanvas; import org.spongepowered.api.map.MapInfo; import org.spongepowered.api.map.decoration.MapDecoration; @@ -411,6 +413,11 @@ public final class Keys { */ public static final Key> ARMOR_MATERIAL = Keys.key(ResourceKey.sponge("armor_material"), ArmorMaterial.class); + /** + * The {@link ArmorTrim} of an armor {@link ItemStackLike ItemStack}. Can be modified. + */ + public static final Key> ARMOR_TRIM = Keys.key(ResourceKey.sponge("armor_trim"), ArmorTrim.class); + /** * The type of {@link ArtType} shown by {@link Painting}s. */ @@ -2642,6 +2649,34 @@ public final class Keys { */ public static final Key> PORTION_TYPE = Keys.key(ResourceKey.sponge("portion_type"), PortionType.class); + /** + * The {@link ItemType decoration} for a {@link DecoratedPot}. + * + * @see Pottery Sherd + */ + public static final Key> POT_FRONT_DECORATION = Keys.key(ResourceKey.sponge("pot_front_decoration"), ItemType.class); + + /** + * The {@link ItemType decoration} for a {@link DecoratedPot}. + * + * @see Pottery Sherd + */ + public static final Key> POT_LEFT_DECORATION = Keys.key(ResourceKey.sponge("pot_left_decoration"), ItemType.class); + + /** + * The {@link ItemType decoration} for a {@link DecoratedPot}. + * + * @see Pottery Sherd + */ + public static final Key> POT_RIGHT_DECORATION = Keys.key(ResourceKey.sponge("pot_right_decoration"), ItemType.class); + + /** + * The {@link ItemType decoration} for a {@link DecoratedPot}. + * + * @see Pottery Sherd + */ + public static final Key> POT_BACK_DECORATION = Keys.key(ResourceKey.sponge("pot_back_decoration"), ItemType.class); + /** * The potential max speed of a {@link Minecart}. */ diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/ArmorTrim.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/ArmorTrim.java new file mode 100644 index 0000000000..64b43437e2 --- /dev/null +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/ArmorTrim.java @@ -0,0 +1,69 @@ +/* + * 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.item.recipe.smithing; + +import org.spongepowered.api.Sponge; + +import java.util.function.Supplier; + +public interface ArmorTrim { + + static ArmorTrim of(TrimMaterial material, TrimPattern pattern) { + return Sponge.game().factoryProvider().provide(Factory.class).create(material, pattern); + } + + static ArmorTrim of(Supplier material, Supplier pattern) { + return Sponge.game().factoryProvider().provide(Factory.class).create(material, pattern); + } + static ArmorTrim of(TrimMaterial material, Supplier pattern) { + return Sponge.game().factoryProvider().provide(Factory.class).create(material, pattern); + } + + static ArmorTrim of(Supplier material, TrimPattern pattern) { + return Sponge.game().factoryProvider().provide(Factory.class).create(material, pattern); + } + + TrimMaterial material(); + + TrimPattern pattern(); + + interface Factory { + + ArmorTrim create(TrimMaterial material, TrimPattern pattern); + + default ArmorTrim create(Supplier material, Supplier pattern) { + return create(material.get(), pattern.get()); + } + + default ArmorTrim create(Supplier material, TrimPattern pattern) { + return create(material.get(), pattern); + } + + default ArmorTrim create(TrimMaterial material, Supplier pattern) { + return create(material, pattern.get()); + } + + } +} diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterial.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterial.java new file mode 100644 index 0000000000..88585747ec --- /dev/null +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterial.java @@ -0,0 +1,33 @@ +/* + * 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.item.recipe.smithing; + +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(TrimMaterials.class) +public interface TrimMaterial extends DefaultedRegistryValue { + +} diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterials.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterials.java new file mode 100644 index 0000000000..c536f03443 --- /dev/null +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterials.java @@ -0,0 +1,70 @@ +/* + * 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.item.recipe.smithing; + +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 TrimMaterials { + + public static final DefaultedRegistryReference AMETHYST = TrimMaterials.key(ResourceKey.minecraft("amethyst")); + + public static final DefaultedRegistryReference COPPER = TrimMaterials.key(ResourceKey.minecraft("copper")); + + public static final DefaultedRegistryReference DIAMOND = TrimMaterials.key(ResourceKey.minecraft("diamond")); + + public static final DefaultedRegistryReference EMERALD = TrimMaterials.key(ResourceKey.minecraft("emerald")); + + public static final DefaultedRegistryReference GOLD = TrimMaterials.key(ResourceKey.minecraft("gold")); + + public static final DefaultedRegistryReference IRON = TrimMaterials.key(ResourceKey.minecraft("iron")); + + public static final DefaultedRegistryReference LAPIS = TrimMaterials.key(ResourceKey.minecraft("lapis")); + + public static final DefaultedRegistryReference NETHERITE = TrimMaterials.key(ResourceKey.minecraft("netherite")); + + public static final DefaultedRegistryReference QUARTZ = TrimMaterials.key(ResourceKey.minecraft("quartz")); + + public static final DefaultedRegistryReference REDSTONE = TrimMaterials.key(ResourceKey.minecraft("redstone")); + + private TrimMaterials() { + } + + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.TRIM_MATERIAL); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.TRIM_MATERIAL, location).asDefaultedReference(Sponge::server); + } +} diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPattern.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPattern.java new file mode 100644 index 0000000000..5846c44fb9 --- /dev/null +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPattern.java @@ -0,0 +1,32 @@ +/* + * 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.item.recipe.smithing; + +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(TrimPatterns.class) +public interface TrimPattern extends DefaultedRegistryValue { +} diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPatterns.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPatterns.java new file mode 100644 index 0000000000..228aa00632 --- /dev/null +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPatterns.java @@ -0,0 +1,86 @@ +/* + * 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.item.recipe.smithing; + +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 TrimPatterns { + + public static final DefaultedRegistryReference BOLT = TrimPatterns.key(ResourceKey.minecraft("bolt")); + + public static final DefaultedRegistryReference COAST = TrimPatterns.key(ResourceKey.minecraft("coast")); + + public static final DefaultedRegistryReference DUNE = TrimPatterns.key(ResourceKey.minecraft("dune")); + + public static final DefaultedRegistryReference EYE = TrimPatterns.key(ResourceKey.minecraft("eye")); + + public static final DefaultedRegistryReference FLOW = TrimPatterns.key(ResourceKey.minecraft("flow")); + + public static final DefaultedRegistryReference HOST = TrimPatterns.key(ResourceKey.minecraft("host")); + + public static final DefaultedRegistryReference RAISER = TrimPatterns.key(ResourceKey.minecraft("raiser")); + + public static final DefaultedRegistryReference RIB = TrimPatterns.key(ResourceKey.minecraft("rib")); + + public static final DefaultedRegistryReference SENTRY = TrimPatterns.key(ResourceKey.minecraft("sentry")); + + public static final DefaultedRegistryReference SHAPER = TrimPatterns.key(ResourceKey.minecraft("shaper")); + + public static final DefaultedRegistryReference SILENCE = TrimPatterns.key(ResourceKey.minecraft("silence")); + + public static final DefaultedRegistryReference SNOUT = TrimPatterns.key(ResourceKey.minecraft("snout")); + + public static final DefaultedRegistryReference SPIRE = TrimPatterns.key(ResourceKey.minecraft("spire")); + + public static final DefaultedRegistryReference TIDE = TrimPatterns.key(ResourceKey.minecraft("tide")); + + public static final DefaultedRegistryReference VEX = TrimPatterns.key(ResourceKey.minecraft("vex")); + + public static final DefaultedRegistryReference WARD = TrimPatterns.key(ResourceKey.minecraft("ward")); + + public static final DefaultedRegistryReference WAYFINDER = TrimPatterns.key(ResourceKey.minecraft("wayfinder")); + + public static final DefaultedRegistryReference WILD = TrimPatterns.key(ResourceKey.minecraft("wild")); + + private TrimPatterns() { + } + + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.TRIM_PATTERN); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.TRIM_PATTERN, location).asDefaultedReference(Sponge::server); + } +} diff --git a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java index 7f13c67319..27f6b12083 100644 --- a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java +++ b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java @@ -133,6 +133,8 @@ import org.spongepowered.api.item.potion.PotionType; import org.spongepowered.api.item.recipe.Recipe; import org.spongepowered.api.item.recipe.RecipeType; +import org.spongepowered.api.item.recipe.smithing.TrimMaterial; +import org.spongepowered.api.item.recipe.smithing.TrimPattern; import org.spongepowered.api.map.color.MapColorType; import org.spongepowered.api.map.color.MapShade; import org.spongepowered.api.map.decoration.MapDecorationType; @@ -278,6 +280,10 @@ public final class RegistryTypes { public static final DefaultedRegistryType> TRIGGER = RegistryTypes.minecraftKeyInGame("trigger_type"); + public static final DefaultedRegistryType TRIM_MATERIAL = RegistryTypes.minecraftKeyInServer("trim_material"); + + public static final DefaultedRegistryType TRIM_PATTERN = RegistryTypes.minecraftKeyInServer("trim_pattern"); + public static final DefaultedRegistryType VILLAGER_TYPE = RegistryTypes.minecraftKeyInGame("villager_type"); public static final DefaultedRegistryType WORLD_TYPE = RegistryTypes.minecraftKeyInServer("dimension_type");