diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java index 454d9f681e..dc5fa5f608 100644 --- a/src/main/java/org/spongepowered/api/data/Keys.java +++ b/src/main/java/org/spongepowered/api/data/Keys.java @@ -34,6 +34,7 @@ import org.spongepowered.api.block.entity.Banner; 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.EndGateway; import org.spongepowered.api.block.entity.Jukebox; import org.spongepowered.api.block.entity.Lectern; @@ -163,6 +164,7 @@ import org.spongepowered.api.entity.living.golem.IronGolem; import org.spongepowered.api.entity.living.golem.Shulker; import org.spongepowered.api.entity.living.monster.Blaze; +import org.spongepowered.api.entity.living.monster.Creaking; import org.spongepowered.api.entity.living.monster.Creeper; import org.spongepowered.api.entity.living.monster.Enderman; import org.spongepowered.api.entity.living.monster.Endermite; @@ -208,6 +210,7 @@ import org.spongepowered.api.entity.vehicle.minecart.Minecart; import org.spongepowered.api.entity.vehicle.minecart.MinecartLike; import org.spongepowered.api.entity.weather.LightningBolt; +import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; import org.spongepowered.api.event.cause.entity.damage.source.DamageSources; import org.spongepowered.api.fluid.FluidStackSnapshot; import org.spongepowered.api.fluid.FluidTypes; @@ -763,6 +766,22 @@ public final class Keys { */ public static final Key> COORDINATE_MULTIPLIER = Keys.key(ResourceKey.sponge("coordinate_multiplier"), Double.class); + /** + * The coordinates of where a {@link Creaking} has + * it's bonded {@link CreakingHeart home} set to. Can be + * overridden. + * + * When a {@link Creaking} is spawned, it can + * be considered linked to a heart or not. + */ + public static final Key> CREAKING_HOME_POSITION = Keys.key(ResourceKey.sponge("creaking_home_position"), Vector3i.class); + + /** + * Marks whether a {@link Creaking} is considered transient. When transient, it may be + * invulnerable to most all {@link DamageSource}s. Note that this is not mutable. + */ + public static final Key> CREAKING_IS_LINKED = Keys.key(ResourceKey.sponge("creaking_transient"), Boolean.class); + /** * Overrides whether a {@link WorldType} allows the {@link EnderDragon dragon} fight mechanic to spawn. *

By default, the dragon only spawns in the {@link DefaultWorldKeys#THE_END} world with {@link WorldTypes#THE_END} world type.

diff --git a/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java b/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java index f22acd0cbc..d984309f0b 100644 --- a/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java +++ b/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java @@ -24,7 +24,25 @@ */ package org.spongepowered.api.entity.living.monster; +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.value.Value; import org.spongepowered.api.entity.living.Monster; +import org.spongepowered.api.util.annotation.Experimental; +import org.spongepowered.math.vector.Vector3i; +import java.util.Optional; + +/** + * A Creaking is a type of monster that originates from the {@link org.spongepowered.api.world.biome.Biomes#pale} + */ +@Experimental("winter_drop") public interface Creaking extends Monster { + + default Optional> homePosition() { + return this.getValue(Keys.CREAKING_HOME_POSITION).map(Value::asMutable); + } + + default Value.Immutable isLinked() { + return this.requireValue(Keys.CREAKING_IS_LINKED).asImmutable(); + } }