Skip to content

Commit

Permalink
feat: add salmon size data
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Harris-Rouquette <gabizou@me.com>
  • Loading branch information
gabizou committed Oct 24, 2024
1 parent 30a5fb5 commit 4d78205
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
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.SalmonSize;
import org.spongepowered.api.data.type.SculkSensorState;
import org.spongepowered.api.data.type.SkinPart;
import org.spongepowered.api.data.type.SlabPortion;
Expand Down Expand Up @@ -161,6 +162,7 @@
import org.spongepowered.api.entity.living.animal.horse.llama.Llama;
import org.spongepowered.api.entity.living.animal.horse.llama.TraderLlama;
import org.spongepowered.api.entity.living.aquatic.Dolphin;
import org.spongepowered.api.entity.living.aquatic.fish.school.Salmon;
import org.spongepowered.api.entity.living.aquatic.fish.school.TropicalFish;
import org.spongepowered.api.entity.living.golem.IronGolem;
import org.spongepowered.api.entity.living.golem.Shulker;
Expand Down Expand Up @@ -2827,6 +2829,11 @@ public final class Keys {
*/
public static final Key<Value<Ticks>> ROARING_TIME = Keys.key(ResourceKey.sponge("roaring_time"), Ticks.class);

/**
* The {@link SalmonSize} of a {@link Salmon} entity.
*/
public static final Key<Value<SalmonSize>> SALMON_SIZE = Keys.key(ResourceKey.sponge("salmon_size"), SalmonSize.class);

/**
* The current saturation of a {@link Player}.
*
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/spongepowered/api/data/type/SalmonSize.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.spongepowered.api.data.type;

import org.spongepowered.api.registry.DefaultedRegistryValue;
import org.spongepowered.api.util.annotation.CatalogedBy;

@CatalogedBy(SalmonSizes.class)
public interface SalmonSize extends DefaultedRegistryValue, StringRepresentable {
}
20 changes: 20 additions & 0 deletions src/main/java/org/spongepowered/api/data/type/SalmonSizes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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.RegistryKey;
import org.spongepowered.api.registry.RegistryTypes;

public final class SalmonSizes {

public static final DefaultedRegistryReference<SalmonSize> LARGE = SalmonSizes.key(ResourceKey.sponge("large"));

public static final DefaultedRegistryReference<SalmonSize> MEDIUM = SalmonSizes.key(ResourceKey.sponge("medium"));

public static final DefaultedRegistryReference<SalmonSize> SMALL = SalmonSizes.key(ResourceKey.sponge("small"));

private static DefaultedRegistryReference<SalmonSize> key(ResourceKey key) {
return RegistryKey.of(RegistryTypes.SALMON_SIZE, key).asDefaultedReference(Sponge::game);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,14 @@
*/
package org.spongepowered.api.entity.living.aquatic.fish.school;

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.type.SalmonSize;
import org.spongepowered.api.data.value.Value;

public interface Salmon extends SchoolingFish {

default Value.Mutable<SalmonSize> size() {
return this.requireValue(Keys.SALMON_SIZE).asMutable();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
import org.spongepowered.api.data.type.RabbitType;
import org.spongepowered.api.data.type.RaidStatus;
import org.spongepowered.api.data.type.RailDirection;
import org.spongepowered.api.data.type.SalmonSize;
import org.spongepowered.api.data.type.SalmonSizes;
import org.spongepowered.api.data.type.SculkSensorState;
import org.spongepowered.api.data.type.SkinPart;
import org.spongepowered.api.data.type.SlabPortion;
Expand Down Expand Up @@ -469,6 +471,8 @@ public final class RegistryTypes {

public static final DefaultedRegistryType<Rotation> ROTATION = RegistryTypes.spongeKeyInGame("rotation");

public static final DefaultedRegistryType<SalmonSize> SALMON_SIZE = RegistryTypes.spongeKeyInGame("salmon_size");

public static final DefaultedRegistryType<SculkSensorState> SCULK_SENSOR_STATE = RegistryTypes.spongeKeyInGame("sculk_sensor_state");

public static final DefaultedRegistryType<SelectorSortAlgorithm> SELECTOR_SORT_ALGORITHM = RegistryTypes.spongeKeyInGame("selector_sort_algorithm");
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/org/spongepowered/api/world/biome/Biomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
*/
package org.spongepowered.api.world.biome;

import org.jetbrains.annotations.ApiStatus;
import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryReference;
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;
import org.spongepowered.api.util.annotation.Experimental;
import org.spongepowered.api.world.server.ServerWorld;

/**
Expand Down Expand Up @@ -120,10 +118,6 @@ public final class Biomes {

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

@Experimental("winter_drop")
@ApiStatus.Experimental
public static final RegistryReference<Biome> PALE_GARDEN = Biomes.key(ResourceKey.minecraft("pale_garden"));

public static final RegistryReference<Biome> PLAINS = Biomes.key(ResourceKey.minecraft("plains"));

public static final RegistryReference<Biome> RIVER = Biomes.key(ResourceKey.minecraft("river"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryTypes;

/**
* <!-- This file is automatically generated. Any manual changes will be overwritten. -->
*/
public final class ExplosionBlockInteractions {

public static final DefaultedRegistryReference<ExplosionBlockInteraction> DESTROY = ExplosionBlockInteractions.key(ResourceKey.sponge("destroy"));
Expand Down

0 comments on commit 4d78205

Please sign in to comment.