From 6eb0d9b2e30440ac5c2d7f57bb0dd7c2fa635047 Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Mon, 3 Jun 2024 20:11:23 -0700 Subject: [PATCH] feat: Add Vault and Trial states --- .../api/data/type/TrialSpawnerState.java | 32 +++++++++++ .../api/data/type/TrialSpawnerStates.java | 56 +++++++++++++++++++ .../api/data/type/VaultState.java | 32 +++++++++++ .../api/data/type/VaultStates.java | 49 ++++++++++++++++ .../api/state/EnumStateProperties.java | 6 +- 5 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java create mode 100644 src/main/java/org/spongepowered/api/data/type/TrialSpawnerStates.java create mode 100644 src/main/java/org/spongepowered/api/data/type/VaultState.java create mode 100644 src/main/java/org/spongepowered/api/data/type/VaultStates.java diff --git a/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java new file mode 100644 index 0000000000..504d2ecacc --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.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.data.type; + +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(TrialSpawnerStates.class) +public interface TrialSpawnerState extends Comparable, StringRepresentable { + +} diff --git a/src/main/java/org/spongepowered/api/data/type/TrialSpawnerStates.java b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerStates.java new file mode 100644 index 0000000000..7724165f31 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerStates.java @@ -0,0 +1,56 @@ +/* + * 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.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.RegistryTypes; + +public final class TrialSpawnerStates { + + public static final DefaultedRegistryReference INACTIVE = TrialSpawnerStates.key(ResourceKey.sponge("INACTIVE")); + + public static final DefaultedRegistryReference WAITING_FOR_PLAYERS = TrialSpawnerStates.key(ResourceKey.sponge("WAITING_FOR_PLAYERS")); + + public static final DefaultedRegistryReference ACTIVE = TrialSpawnerStates.key(ResourceKey.sponge("ACTIVE")); + + public static final DefaultedRegistryReference WAITING_FOR_REWARD_EJECTION = TrialSpawnerStates.key(ResourceKey.sponge("WAITING_FOR_REWARD_EJECTION")); + + public static final DefaultedRegistryReference EJECTING_REWARD = TrialSpawnerStates.key(ResourceKey.sponge("EJECTING_REWARD")); + + public static final DefaultedRegistryReference COOLDOWN = TrialSpawnerStates.key(ResourceKey.sponge("COOLDOWN")); + + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.TRIAL_SPAWNER_STATE); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.TRIAL_SPAWNER_STATE, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/VaultState.java b/src/main/java/org/spongepowered/api/data/type/VaultState.java new file mode 100644 index 0000000000..c8166c87f2 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/VaultState.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.data.type; + +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(VaultStates.class) +public interface VaultState extends Comparable, StringRepresentable { + +} diff --git a/src/main/java/org/spongepowered/api/data/type/VaultStates.java b/src/main/java/org/spongepowered/api/data/type/VaultStates.java new file mode 100644 index 0000000000..e017753800 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/VaultStates.java @@ -0,0 +1,49 @@ +/* + * 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.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.RegistryTypes; + +public final class VaultStates { + + public static final DefaultedRegistryReference INACTIVE = VaultStates.key(ResourceKey.sponge("inactive")); + public static final DefaultedRegistryReference ACTIVE = VaultStates.key(ResourceKey.sponge("active")); + public static final DefaultedRegistryReference UNLOCKING = VaultStates.key(ResourceKey.sponge("unlocking")); + public static final DefaultedRegistryReference EJECTING = VaultStates.key(ResourceKey.sponge("ejecting")); + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.VAULT_STATE); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.VAULT_STATE, location).asDefaultedReference(Sponge::game); + } + +} diff --git a/src/main/java/org/spongepowered/api/state/EnumStateProperties.java b/src/main/java/org/spongepowered/api/state/EnumStateProperties.java index 3300563ee1..8cdaa8c716 100644 --- a/src/main/java/org/spongepowered/api/state/EnumStateProperties.java +++ b/src/main/java/org/spongepowered/api/state/EnumStateProperties.java @@ -41,6 +41,8 @@ import org.spongepowered.api.data.type.StairShape; import org.spongepowered.api.data.type.StructureMode; import org.spongepowered.api.data.type.Tilt; +import org.spongepowered.api.data.type.TrialSpawnerState; +import org.spongepowered.api.data.type.VaultState; import org.spongepowered.api.data.type.WallConnectionState; import org.spongepowered.api.data.type.WireAttachmentType; import org.spongepowered.api.util.Axis; @@ -179,11 +181,11 @@ public static EnumStateProperty property_TILT() { return EnumStateProperty.of("TILT"); } - public static EnumStateProperty property_TRIAL_SPAWNER_STATE() { + public static EnumStateProperty property_TRIAL_SPAWNER_STATE() { return EnumStateProperty.of("TRIAL_SPAWNER_STATE"); } - public static EnumStateProperty property_VAULT_STATE() { + public static EnumStateProperty property_VAULT_STATE() { return EnumStateProperty.of("VAULT_STATE"); }