diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java index 9032d917f0..07b6bc53ec 100644 --- a/src/main/java/org/spongepowered/api/data/Keys.java +++ b/src/main/java/org/spongepowered/api/data/Keys.java @@ -77,6 +77,7 @@ import org.spongepowered.api.data.type.PistonType; import org.spongepowered.api.data.type.PortionType; import org.spongepowered.api.data.type.ProfessionType; +import org.spongepowered.api.data.type.PushReaction; import org.spongepowered.api.data.type.RabbitType; import org.spongepowered.api.data.type.RailDirection; import org.spongepowered.api.data.type.SculkSensorState; @@ -562,6 +563,12 @@ public final class Keys { */ public static final Key> BREEDING_COOLDOWN = Keys.key(ResourceKey.sponge("breeding_cooldown"), Ticks.class); + /** + * Whether a {@link BlockState} can be lit on fire by things like spreading lava, + * or sometimes a {@link ServerLocation} to be directionally specific. + */ + public static final Key> BURNABLE = Keys.key(ResourceKey.sponge("burnable"), Boolean.class); + /** * The burntime of an {@link ItemStack} fuel in a furnace. * See {@link #FUEL} for the time @@ -2608,6 +2615,12 @@ public final class Keys { */ public static final Key> PROFESSION_LEVEL = Keys.key(ResourceKey.sponge("profession_level"), Integer.class); + /** + * The {@link Entity} or {@link BlockState} push reaction when a {@link Piston} pushes it. + * Readonly + */ + public static final Key> PUSH_REACTION = Keys.key(ResourceKey.sponge("push_reaction"), PushReaction.class); + /** * Whether pvp combat is enabled in a world of a {@link WorldTemplate} or {@link ServerWorldProperties} * Readonly diff --git a/src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java b/src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java index 1e8cf2101e..6c40aadf68 100644 --- a/src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java +++ b/src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java @@ -31,6 +31,6 @@ * Represents a block surface. */ @CatalogedBy(AttachmentSurfaces.class) -public interface AttachmentSurface extends DefaultedRegistryValue, Comparable { +public interface AttachmentSurface extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java b/src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java index 467d705b3b..f94c386171 100644 --- a/src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java +++ b/src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java @@ -32,6 +32,6 @@ * Represents the type of leaves of a {@link BlockTypes#BAMBOO} block. */ @CatalogedBy(BambooLeavesTypes.class) -public interface BambooLeavesType extends DefaultedRegistryValue, Comparable { +public interface BambooLeavesType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java b/src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java index 3083ad8bf2..106643793b 100644 --- a/src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java +++ b/src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java @@ -32,6 +32,6 @@ * Represents the attachment-type of a {@link BlockTypes#BELL} block. */ @CatalogedBy(BellAttachmentTypes.class) -public interface BellAttachmentType extends DefaultedRegistryValue, Comparable { +public interface BellAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java b/src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java index a4c7989c9c..d533040eda 100644 --- a/src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java +++ b/src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java @@ -34,6 +34,6 @@ * chests into a double chests. */ @CatalogedBy(ChestAttachmentTypes.class) -public interface ChestAttachmentType extends DefaultedRegistryValue, Comparable { +public interface ChestAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/ComparatorMode.java b/src/main/java/org/spongepowered/api/data/type/ComparatorMode.java index 63b995ddb0..02a2ab223d 100644 --- a/src/main/java/org/spongepowered/api/data/type/ComparatorMode.java +++ b/src/main/java/org/spongepowered/api/data/type/ComparatorMode.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(ComparatorModes.class) -public interface ComparatorMode extends DefaultedRegistryValue, Comparable { +public interface ComparatorMode extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/DoorHinge.java b/src/main/java/org/spongepowered/api/data/type/DoorHinge.java index 559c82a552..e24042f987 100644 --- a/src/main/java/org/spongepowered/api/data/type/DoorHinge.java +++ b/src/main/java/org/spongepowered/api/data/type/DoorHinge.java @@ -32,6 +32,6 @@ * Represents a side of a hinge. */ @CatalogedBy(DoorHinges.class) -public interface DoorHinge extends DefaultedRegistryValue, Cycleable, Comparable { +public interface DoorHinge extends DefaultedRegistryValue, Cycleable, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java b/src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java index 4ea07bd2ce..156051a015 100644 --- a/src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java +++ b/src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(DripstoneSegments.class) -public interface DripstoneSegment extends DefaultedRegistryValue, Comparable { +public interface DripstoneSegment extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/InstrumentType.java b/src/main/java/org/spongepowered/api/data/type/InstrumentType.java index 84a6d4eb9a..9d3d1649c1 100644 --- a/src/main/java/org/spongepowered/api/data/type/InstrumentType.java +++ b/src/main/java/org/spongepowered/api/data/type/InstrumentType.java @@ -32,7 +32,7 @@ * Represents a type of instrument. */ @CatalogedBy(InstrumentTypes.class) -public interface InstrumentType extends DefaultedRegistryValue, Comparable { +public interface InstrumentType extends DefaultedRegistryValue, Comparable, StringRepresentable { /** * Gets the {@link SoundType} that is used by diff --git a/src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java b/src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java index 7c117aab40..84cabb9c2c 100644 --- a/src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java +++ b/src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java @@ -33,7 +33,7 @@ * Represents the front and top orientation of {@link BlockTypes#JIGSAW} blocks. */ @CatalogedBy(JigsawBlockOrientations.class) -public interface JigsawBlockOrientation extends DefaultedRegistryValue, Comparable { +public interface JigsawBlockOrientation extends DefaultedRegistryValue, Comparable, StringRepresentable { /** * The front facing direction of a jigsaw block. diff --git a/src/main/java/org/spongepowered/api/data/type/PistonType.java b/src/main/java/org/spongepowered/api/data/type/PistonType.java index 1bb90ccdc5..a52e8c2f20 100644 --- a/src/main/java/org/spongepowered/api/data/type/PistonType.java +++ b/src/main/java/org/spongepowered/api/data/type/PistonType.java @@ -31,6 +31,6 @@ * Represents a "type" of piston. */ @CatalogedBy(PistonTypes.class) -public interface PistonType extends DefaultedRegistryValue, Comparable { +public interface PistonType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/PortionType.java b/src/main/java/org/spongepowered/api/data/type/PortionType.java index df57aceb2b..efac7f3021 100644 --- a/src/main/java/org/spongepowered/api/data/type/PortionType.java +++ b/src/main/java/org/spongepowered/api/data/type/PortionType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(PortionTypes.class) -public interface PortionType extends DefaultedRegistryValue, Comparable { +public interface PortionType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/PushReaction.java b/src/main/java/org/spongepowered/api/data/type/PushReaction.java new file mode 100644 index 0000000000..374eb454a1 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/PushReaction.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(PushReactions.class) +public interface PushReaction { + +} diff --git a/src/main/java/org/spongepowered/api/data/type/PushReactions.java b/src/main/java/org/spongepowered/api/data/type/PushReactions.java new file mode 100644 index 0000000000..681ec52667 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/PushReactions.java @@ -0,0 +1,52 @@ +/* + * 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.RegistryScope; +import org.spongepowered.api.registry.RegistryScopes; +import org.spongepowered.api.registry.RegistryTypes; + +@RegistryScopes(scopes = RegistryScope.GAME) +public final class PushReactions { + + public static final DefaultedRegistryReference NORMAL = key(ResourceKey.minecraft("NORMAL")); + public static final DefaultedRegistryReference DESTROY = key(ResourceKey.minecraft("DESTROY")); + public static final DefaultedRegistryReference BLOCK = key(ResourceKey.minecraft("BLOCK")); + public static final DefaultedRegistryReference IGNORE = key(ResourceKey.minecraft("IGNORE")); + public static final DefaultedRegistryReference PUSH_ONLY = key(ResourceKey.minecraft("PUSH_ONLY")); + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.PUSH_REACTION); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.PUSH_REACTION, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/RailDirection.java b/src/main/java/org/spongepowered/api/data/type/RailDirection.java index 2d7e68ef5d..4d21ad9d24 100644 --- a/src/main/java/org/spongepowered/api/data/type/RailDirection.java +++ b/src/main/java/org/spongepowered/api/data/type/RailDirection.java @@ -29,6 +29,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(RailDirections.class) -public interface RailDirection extends DefaultedRegistryValue, Cycleable, Comparable { +public interface RailDirection extends DefaultedRegistryValue, Cycleable, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/SculkSensorState.java b/src/main/java/org/spongepowered/api/data/type/SculkSensorState.java index e9b50d6c4f..2870604f94 100644 --- a/src/main/java/org/spongepowered/api/data/type/SculkSensorState.java +++ b/src/main/java/org/spongepowered/api/data/type/SculkSensorState.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(SculkSensorStates.class) -public interface SculkSensorState extends DefaultedRegistryValue, Comparable { +public interface SculkSensorState extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/SlabPortion.java b/src/main/java/org/spongepowered/api/data/type/SlabPortion.java index 2fdb64d5ef..af3853a2be 100644 --- a/src/main/java/org/spongepowered/api/data/type/SlabPortion.java +++ b/src/main/java/org/spongepowered/api/data/type/SlabPortion.java @@ -33,6 +33,6 @@ * example {@link BlockTypes#STONE_SLAB}. */ @CatalogedBy(SlabPortions.class) -public interface SlabPortion extends DefaultedRegistryValue, Comparable { +public interface SlabPortion extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/StairShape.java b/src/main/java/org/spongepowered/api/data/type/StairShape.java index 99bb8f11f0..a445a42913 100644 --- a/src/main/java/org/spongepowered/api/data/type/StairShape.java +++ b/src/main/java/org/spongepowered/api/data/type/StairShape.java @@ -31,6 +31,6 @@ * Represents a stair shape. */ @CatalogedBy(StairShapes.class) -public interface StairShape extends DefaultedRegistryValue, Comparable { +public interface StairShape extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/StringRepresentable.java b/src/main/java/org/spongepowered/api/data/type/StringRepresentable.java new file mode 100644 index 0000000000..dba958f291 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/StringRepresentable.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; + +/** + * Represents a type that has a stable string representation, usually an enumerated + * set of values, like most catalog types: + * {@link org.spongepowered.api.data.type.ArtType}, + * {@link RabbitType}, {@link RailDirection}, etc. + */ +public interface StringRepresentable { + + String serializationString(); + +} diff --git a/src/main/java/org/spongepowered/api/data/type/StructureMode.java b/src/main/java/org/spongepowered/api/data/type/StructureMode.java index 755c31d10f..7562aa8d9f 100644 --- a/src/main/java/org/spongepowered/api/data/type/StructureMode.java +++ b/src/main/java/org/spongepowered/api/data/type/StructureMode.java @@ -32,6 +32,6 @@ * Represents a mode that a {@link StructureBlock} may be in. */ @CatalogedBy(StructureModes.class) -public interface StructureMode extends DefaultedRegistryValue, Comparable { +public interface StructureMode extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/Tilt.java b/src/main/java/org/spongepowered/api/data/type/Tilt.java index bba46d8536..eeca1951d7 100644 --- a/src/main/java/org/spongepowered/api/data/type/Tilt.java +++ b/src/main/java/org/spongepowered/api/data/type/Tilt.java @@ -28,7 +28,7 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(Tilts.class) -public interface Tilt extends DefaultedRegistryValue, Comparable { +public interface Tilt extends DefaultedRegistryValue, Comparable, StringRepresentable { /** * {@return Whether a block entering this tilt state will trigger any 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..b80f20a53d --- /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/data/type/WallConnectionState.java b/src/main/java/org/spongepowered/api/data/type/WallConnectionState.java index a8ed41917b..2ea5feec8e 100644 --- a/src/main/java/org/spongepowered/api/data/type/WallConnectionState.java +++ b/src/main/java/org/spongepowered/api/data/type/WallConnectionState.java @@ -31,6 +31,6 @@ * Represents the type of wall BlockStates */ @CatalogedBy(WallConnectionStates.class) -public interface WallConnectionState extends DefaultedRegistryValue, Comparable { +public interface WallConnectionState extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java b/src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java index 3f18c8e87b..dc35ec8fb7 100644 --- a/src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java +++ b/src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(WireAttachmentTypes.class) -public interface WireAttachmentType extends DefaultedRegistryValue, Comparable { +public interface WireAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java index c313490b92..ad1d2d9724 100644 --- a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java +++ b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java @@ -77,6 +77,7 @@ import org.spongepowered.api.data.type.PistonType; import org.spongepowered.api.data.type.PortionType; import org.spongepowered.api.data.type.ProfessionType; +import org.spongepowered.api.data.type.PushReaction; import org.spongepowered.api.data.type.RabbitType; import org.spongepowered.api.data.type.RaidStatus; import org.spongepowered.api.data.type.RailDirection; @@ -87,7 +88,9 @@ 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.TropicalFishShape; +import org.spongepowered.api.data.type.VaultState; import org.spongepowered.api.data.type.VillagerType; import org.spongepowered.api.data.type.WallConnectionState; import org.spongepowered.api.data.type.WireAttachmentType; @@ -254,6 +257,8 @@ public final class RegistryTypes { public static final DefaultedRegistryType PROFESSION_TYPE = RegistryTypes.minecraftKeyInGame("villager_profession"); + public static final DefaultedRegistryType PUSH_REACTION = RegistryTypes.spongeKeyInGame("push_reaction"); + public static final DefaultedRegistryType POTION_TYPE = RegistryTypes.minecraftKeyInGame("potion"); public static final DefaultedRegistryType> RECIPE_TYPE = RegistryTypes.minecraftKeyInGame("recipe_type"); @@ -493,10 +498,14 @@ public final class RegistryTypes { public static final DefaultedRegistryType TRANSACTION_TYPE = RegistryTypes.spongeKeyInGame("transaction_type"); + public static final DefaultedRegistryType TRIAL_SPAWNER_STATE = RegistryTypes.spongeKeyInGame("trial_spawner_state"); + public static final DefaultedRegistryType TROPICAL_FISH_SHAPE = RegistryTypes.spongeKeyInGame("tropical_fish_shape"); public static final DefaultedRegistryType TILT = RegistryTypes.spongeKeyInGame("tilt"); + public static final RegistryType VAULT_STATE = RegistryTypes.spongeKeyInGame("vault_state"); + public static final DefaultedRegistryType VISIBILITY = RegistryTypes.spongeKeyInGame("visibility"); public static final DefaultedRegistryType WALL_CONNECTION_STATE = RegistryTypes.spongeKeyInGame("wall_connection_state"); 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"); } diff --git a/src/main/java/org/spongepowered/api/state/EnumStateProperty.java b/src/main/java/org/spongepowered/api/state/EnumStateProperty.java index 3b3679f0ca..5d5fb69431 100644 --- a/src/main/java/org/spongepowered/api/state/EnumStateProperty.java +++ b/src/main/java/org/spongepowered/api/state/EnumStateProperty.java @@ -25,6 +25,7 @@ package org.spongepowered.api.state; import org.spongepowered.api.Sponge; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.util.annotation.CatalogedBy; /** @@ -33,14 +34,14 @@ * may not be exposed in the API. */ @CatalogedBy(EnumStateProperties.class) -public interface EnumStateProperty> extends StateProperty { +public interface EnumStateProperty & StringRepresentable> extends StateProperty { - static > EnumStateProperty of(String name) { + static & StringRepresentable> EnumStateProperty of(String name) { return Sponge.game().factoryProvider().provide(Factory.class).of(name); } interface Factory { - > EnumStateProperty of(String name); + & StringRepresentable> EnumStateProperty of(String name); } } diff --git a/src/main/java/org/spongepowered/api/util/Axis.java b/src/main/java/org/spongepowered/api/util/Axis.java index 1c569851b7..4537059c7a 100644 --- a/src/main/java/org/spongepowered/api/util/Axis.java +++ b/src/main/java/org/spongepowered/api/util/Axis.java @@ -24,12 +24,13 @@ */ package org.spongepowered.api.util; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.math.vector.Vector3d; /** * Represents a three dimensional cartesian axis. */ -public enum Axis implements Cycleable { +public enum Axis implements Cycleable, StringRepresentable { X(new Vector3d(1, 0, 0)), Y(new Vector3d(0, 1, 0)), @@ -142,4 +143,10 @@ public Axis cycleNext() { } return Axis.X; } + + @Override + public String serializationString() { + return this.name(); + } + } diff --git a/src/main/java/org/spongepowered/api/util/Direction.java b/src/main/java/org/spongepowered/api/util/Direction.java index f88bfa412a..7ffc7dc87b 100644 --- a/src/main/java/org/spongepowered/api/util/Direction.java +++ b/src/main/java/org/spongepowered/api/util/Direction.java @@ -25,6 +25,7 @@ package org.spongepowered.api.util; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.math.GenericMath; import org.spongepowered.math.TrigMath; import org.spongepowered.math.vector.Vector3d; @@ -42,7 +43,7 @@ *
  • {@link #DOWN} targeting towards -Y
  • * */ -public enum Direction { +public enum Direction implements StringRepresentable { NORTH(new Vector3d(0, 0, -1), Division.CARDINAL), NORTH_NORTHEAST(new Vector3d(C.S8, 0, -C.C8), Division.SECONDARY_ORDINAL), NORTHEAST(new Vector3d(1, 0, -1), Division.ORDINAL), @@ -341,6 +342,11 @@ public Vector3i asBlockOffset() { return this.blockOffset; } + @Override + public String serializationString() { + return this.name(); + } + private interface C { double C8 = Math.cos(Math.PI / 8);