Skip to content

Commit e4bae21

Browse files
committed
feat: Implement Vault and Trial States
1 parent 779d472 commit e4bae21

File tree

6 files changed

+175
-4
lines changed

6 files changed

+175
-4
lines changed
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.util.annotation.CatalogedBy;
28+
29+
@CatalogedBy(TrialSpawnerStates.class)
30+
public interface TrialSpawnerState extends Comparable<TrialSpawnerState>, StringRepresentable {
31+
32+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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.Registry;
31+
import org.spongepowered.api.registry.RegistryKey;
32+
import org.spongepowered.api.registry.RegistryTypes;
33+
34+
public final class TrialSpawnerStates {
35+
36+
public static final DefaultedRegistryReference<TrialSpawnerState> INACTIVE = TrialSpawnerStates.key(ResourceKey.sponge("INACTIVE"));
37+
38+
public static final DefaultedRegistryReference<TrialSpawnerState> WAITING_FOR_PLAYERS = TrialSpawnerStates.key(ResourceKey.sponge("WAITING_FOR_PLAYERS"));
39+
40+
public static final DefaultedRegistryReference<TrialSpawnerState> ACTIVE = TrialSpawnerStates.key(ResourceKey.sponge("ACTIVE"));
41+
42+
public static final DefaultedRegistryReference<TrialSpawnerState> WAITING_FOR_REWARD_EJECTION = TrialSpawnerStates.key(ResourceKey.sponge("WAITING_FOR_REWARD_EJECTION"));
43+
44+
public static final DefaultedRegistryReference<TrialSpawnerState> EJECTING_REWARD = TrialSpawnerStates.key(ResourceKey.sponge("EJECTING_REWARD"));
45+
46+
public static final DefaultedRegistryReference<TrialSpawnerState> COOLDOWN = TrialSpawnerStates.key(ResourceKey.sponge("COOLDOWN"));
47+
48+
49+
public static Registry<TrialSpawnerState> registry() {
50+
return Sponge.game().registry(RegistryTypes.TRIAL_SPAWNER_STATE);
51+
}
52+
53+
private static DefaultedRegistryReference<TrialSpawnerState> key(final ResourceKey location) {
54+
return RegistryKey.of(RegistryTypes.TRIAL_SPAWNER_STATE, location).asDefaultedReference(Sponge::game);
55+
}
56+
}
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.util.annotation.CatalogedBy;
28+
29+
@CatalogedBy(VaultStates.class)
30+
public interface VaultState extends Comparable<VaultState>, StringRepresentable {
31+
32+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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.Registry;
31+
import org.spongepowered.api.registry.RegistryKey;
32+
import org.spongepowered.api.registry.RegistryTypes;
33+
34+
public final class VaultStates {
35+
36+
public static final DefaultedRegistryReference<VaultState> INACTIVE = VaultStates.key(ResourceKey.sponge("inactive"));
37+
public static final DefaultedRegistryReference<VaultState> ACTIVE = VaultStates.key(ResourceKey.sponge("active"));
38+
public static final DefaultedRegistryReference<VaultState> UNLOCKING = VaultStates.key(ResourceKey.sponge("unlocking"));
39+
public static final DefaultedRegistryReference<VaultState> EJECTING = VaultStates.key(ResourceKey.sponge("ejecting"));
40+
41+
public static Registry<VaultState> registry() {
42+
return Sponge.game().registry(RegistryTypes.VAULT_STATE);
43+
}
44+
45+
private static DefaultedRegistryReference<VaultState> key(final ResourceKey location) {
46+
return RegistryKey.of(RegistryTypes.VAULT_STATE, location).asDefaultedReference(Sponge::game);
47+
}
48+
49+
}

src/main/java/org/spongepowered/api/state/EnumStateProperties.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
import org.spongepowered.api.data.type.StairShape;
4242
import org.spongepowered.api.data.type.StructureMode;
4343
import org.spongepowered.api.data.type.Tilt;
44+
import org.spongepowered.api.data.type.TrialSpawnerState;
45+
import org.spongepowered.api.data.type.VaultState;
4446
import org.spongepowered.api.data.type.WallConnectionState;
4547
import org.spongepowered.api.data.type.WireAttachmentType;
4648
import org.spongepowered.api.util.Axis;
@@ -179,11 +181,11 @@ public static EnumStateProperty<Tilt> property_TILT() {
179181
return EnumStateProperty.of("TILT");
180182
}
181183

182-
public static EnumStateProperty<?> property_TRIAL_SPAWNER_STATE() {
184+
public static EnumStateProperty<TrialSpawnerState> property_TRIAL_SPAWNER_STATE() {
183185
return EnumStateProperty.of("TRIAL_SPAWNER_STATE");
184186
}
185187

186-
public static EnumStateProperty<?> property_VAULT_STATE() {
188+
public static EnumStateProperty<VaultState> property_VAULT_STATE() {
187189
return EnumStateProperty.of("VAULT_STATE");
188190
}
189191

src/main/java/org/spongepowered/api/state/EnumStateProperty.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
@CatalogedBy(EnumStateProperties.class)
3737
public interface EnumStateProperty<E extends Comparable<E> & StringRepresentable> extends StateProperty<E> {
3838

39-
static <E extends Comparable<E>> EnumStateProperty<E> of(String name) {
39+
static <E extends Comparable<E> & StringRepresentable> EnumStateProperty<E> of(String name) {
4040
return Sponge.game().factoryProvider().provide(Factory.class).of(name);
4141
}
4242

4343
interface Factory {
4444

45-
<E extends Comparable<E>> EnumStateProperty<E> of(String name);
45+
<E extends Comparable<E> & StringRepresentable> EnumStateProperty<E> of(String name);
4646
}
4747
}

0 commit comments

Comments
 (0)