Skip to content

Commit

Permalink
feat: add creaking data
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
  • Loading branch information
gabizou committed Oct 15, 2024
1 parent 7f4b70e commit 43c7dd0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -763,6 +766,22 @@ public final class Keys {
*/
public static final Key<Value<Double>> 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<Value<Vector3i>> 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<Value<Boolean>> 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.
* <p>By default, the dragon only spawns in the {@link DefaultWorldKeys#THE_END} world with {@link WorldTypes#THE_END} world type.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Value.Mutable<Vector3i>> homePosition() {
return this.getValue(Keys.CREAKING_HOME_POSITION).map(Value::asMutable);
}

default Value.Immutable<Boolean> isLinked() {
return this.requireValue(Keys.CREAKING_IS_LINKED).asImmutable();
}
}

0 comments on commit 43c7dd0

Please sign in to comment.