Skip to content

Commit 89c82c2

Browse files
committed
feat: add creaking data
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
1 parent 7f4b70e commit 89c82c2

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.spongepowered.api.block.entity.Banner;
3535
import org.spongepowered.api.block.entity.BlockEntity;
3636
import org.spongepowered.api.block.entity.CommandBlock;
37+
import org.spongepowered.api.block.entity.CreakingHeart;
3738
import org.spongepowered.api.block.entity.EndGateway;
3839
import org.spongepowered.api.block.entity.Jukebox;
3940
import org.spongepowered.api.block.entity.Lectern;
@@ -163,6 +164,7 @@
163164
import org.spongepowered.api.entity.living.golem.IronGolem;
164165
import org.spongepowered.api.entity.living.golem.Shulker;
165166
import org.spongepowered.api.entity.living.monster.Blaze;
167+
import org.spongepowered.api.entity.living.monster.Creaking;
166168
import org.spongepowered.api.entity.living.monster.Creeper;
167169
import org.spongepowered.api.entity.living.monster.Enderman;
168170
import org.spongepowered.api.entity.living.monster.Endermite;
@@ -208,6 +210,7 @@
208210
import org.spongepowered.api.entity.vehicle.minecart.Minecart;
209211
import org.spongepowered.api.entity.vehicle.minecart.MinecartLike;
210212
import org.spongepowered.api.entity.weather.LightningBolt;
213+
import org.spongepowered.api.event.cause.entity.damage.source.DamageSource;
211214
import org.spongepowered.api.event.cause.entity.damage.source.DamageSources;
212215
import org.spongepowered.api.fluid.FluidStackSnapshot;
213216
import org.spongepowered.api.fluid.FluidTypes;
@@ -763,6 +766,22 @@ public final class Keys {
763766
*/
764767
public static final Key<Value<Double>> COORDINATE_MULTIPLIER = Keys.key(ResourceKey.sponge("coordinate_multiplier"), Double.class);
765768

769+
/**
770+
* The coordinates of where a {@link Creaking} has
771+
* it's bonded {@link CreakingHeart home} set to. Can be
772+
* overridden.
773+
*
774+
* When a {@link Creaking} is spawned, it can
775+
* be considered linked to a heart or not.
776+
*/
777+
public static final Key<Value<Vector3i>> CREAKING_HOME_POSITION = Keys.key(ResourceKey.sponge("creaking_home_position"), Vector3i.class);
778+
779+
/**
780+
* Marks whether a {@link Creaking} is considered transient. When transient, it may be
781+
* invulnerable to most all {@link DamageSource}s. Note that this is not mutable.
782+
*/
783+
public static final Key<Value<Boolean>> CREAKING_IS_LINKED = Keys.key(ResourceKey.sponge("creaking_transient"), Boolean.class);
784+
766785
/**
767786
* Overrides whether a {@link WorldType} allows the {@link EnderDragon dragon} fight mechanic to spawn.
768787
* <p>By default, the dragon only spawns in the {@link DefaultWorldKeys#THE_END} world with {@link WorldTypes#THE_END} world type.</p>

src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,25 @@
2424
*/
2525
package org.spongepowered.api.entity.living.monster;
2626

27+
import org.spongepowered.api.data.Keys;
28+
import org.spongepowered.api.data.value.Value;
2729
import org.spongepowered.api.entity.living.Monster;
30+
import org.spongepowered.api.util.annotation.Experimental;
31+
import org.spongepowered.math.vector.Vector3i;
2832

33+
import java.util.Optional;
34+
35+
/**
36+
* A Creaking is a type of monster that originates from the {@link org.spongepowered.api.world.biome.Biomes#PALE_GARDEN}
37+
*/
38+
@Experimental("winter_drop")
2939
public interface Creaking extends Monster {
40+
41+
default Optional<Value.Mutable<Vector3i>> homePosition() {
42+
return this.getValue(Keys.CREAKING_HOME_POSITION).map(Value::asMutable);
43+
}
44+
45+
default Value.Immutable<Boolean> isLinked() {
46+
return this.requireValue(Keys.CREAKING_IS_LINKED).asImmutable();
47+
}
3048
}

src/main/java/org/spongepowered/api/world/biome/Biomes.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
*/
2525
package org.spongepowered.api.world.biome;
2626

27+
import org.jetbrains.annotations.ApiStatus;
2728
import org.spongepowered.api.ResourceKey;
2829
import org.spongepowered.api.registry.Registry;
2930
import org.spongepowered.api.registry.RegistryKey;
3031
import org.spongepowered.api.registry.RegistryReference;
3132
import org.spongepowered.api.registry.RegistryScope;
3233
import org.spongepowered.api.registry.RegistryScopes;
3334
import org.spongepowered.api.registry.RegistryTypes;
35+
import org.spongepowered.api.util.annotation.Experimental;
3436
import org.spongepowered.api.world.server.ServerWorld;
3537

3638
/**
@@ -118,6 +120,10 @@ public final class Biomes {
118120

119121
public static final RegistryReference<Biome> OLD_GROWTH_SPRUCE_TAIGA = Biomes.key(ResourceKey.minecraft("old_growth_spruce_taiga"));
120122

123+
@Experimental("winter_drop")
124+
@ApiStatus.Experimental
125+
public static final RegistryReference<Biome> PALE_GARDEN = Biomes.key(ResourceKey.minecraft("pale_garden"));
126+
121127
public static final RegistryReference<Biome> PLAINS = Biomes.key(ResourceKey.minecraft("plains"));
122128

123129
public static final RegistryReference<Biome> RIVER = Biomes.key(ResourceKey.minecraft("river"));

0 commit comments

Comments
 (0)