Skip to content

Commit

Permalink
feat: add salmon size data
Browse files Browse the repository at this point in the history
  • Loading branch information
gabizou committed Oct 24, 2024
1 parent 30a5fb5 commit 9a0b4ce
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 6 deletions.
153 changes: 153 additions & 0 deletions src/main/java/org/spongepowered/api/data/BlockStateDataProvider.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* 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;

/**
* <!-- Copy to the register method of BlockStateDataProvider -->
*/
public final class BlockStateDataProvider {

private BlockStateDataProvider() {
}

public static void register() {
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AGE_1, BlockStateProperties.AGE_1);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AGE_15, BlockStateProperties.AGE_15);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AGE_2, BlockStateProperties.AGE_2);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AGE_25, BlockStateProperties.AGE_25);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AGE_3, BlockStateProperties.AGE_3);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AGE_4, BlockStateProperties.AGE_4);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AGE_5, BlockStateProperties.AGE_5);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AGE_7, BlockStateProperties.AGE_7);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.ATTACHED, BlockStateProperties.ATTACHED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.ATTACH_FACE, BlockStateProperties.ATTACH_FACE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.AXIS, BlockStateProperties.AXIS);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.BAMBOO_LEAVES, BlockStateProperties.BAMBOO_LEAVES);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.BED_PART, BlockStateProperties.BED_PART);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.BELL_ATTACHMENT, BlockStateProperties.BELL_ATTACHMENT);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.BERRIES, BlockStateProperties.BERRIES);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.BITES, BlockStateProperties.BITES);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.BLOOM, BlockStateProperties.BLOOM);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.BOTTOM, BlockStateProperties.BOTTOM);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CANDLES, BlockStateProperties.CANDLES);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CAN_SUMMON, BlockStateProperties.CAN_SUMMON);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CHEST_TYPE, BlockStateProperties.CHEST_TYPE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CHISELED_BOOKSHELF_SLOT_0_OCCUPIED, BlockStateProperties.CHISELED_BOOKSHELF_SLOT_0_OCCUPIED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CHISELED_BOOKSHELF_SLOT_1_OCCUPIED, BlockStateProperties.CHISELED_BOOKSHELF_SLOT_1_OCCUPIED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CHISELED_BOOKSHELF_SLOT_2_OCCUPIED, BlockStateProperties.CHISELED_BOOKSHELF_SLOT_2_OCCUPIED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CHISELED_BOOKSHELF_SLOT_3_OCCUPIED, BlockStateProperties.CHISELED_BOOKSHELF_SLOT_3_OCCUPIED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CHISELED_BOOKSHELF_SLOT_4_OCCUPIED, BlockStateProperties.CHISELED_BOOKSHELF_SLOT_4_OCCUPIED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CHISELED_BOOKSHELF_SLOT_5_OCCUPIED, BlockStateProperties.CHISELED_BOOKSHELF_SLOT_5_OCCUPIED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CONDITIONAL, BlockStateProperties.CONDITIONAL);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CRACKED, BlockStateProperties.CRACKED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CRAFTING, BlockStateProperties.CRAFTING);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.CREAKING, BlockStateProperties.CREAKING);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DELAY, BlockStateProperties.DELAY);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DISARMED, BlockStateProperties.DISARMED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DISTANCE, BlockStateProperties.DISTANCE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DOOR_HINGE, BlockStateProperties.DOOR_HINGE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DOUBLE_BLOCK_HALF, BlockStateProperties.DOUBLE_BLOCK_HALF);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DOWN, BlockStateProperties.DOWN);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DRAG, BlockStateProperties.DRAG);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DRIPSTONE_THICKNESS, BlockStateProperties.DRIPSTONE_THICKNESS);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.DUSTED, BlockStateProperties.DUSTED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.EAST, BlockStateProperties.EAST);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.EAST_REDSTONE, BlockStateProperties.EAST_REDSTONE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.EAST_WALL, BlockStateProperties.EAST_WALL);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.EGGS, BlockStateProperties.EGGS);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.ENABLED, BlockStateProperties.ENABLED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.EXTENDED, BlockStateProperties.EXTENDED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.EYE, BlockStateProperties.EYE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.FACING, BlockStateProperties.FACING);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.FACING_HOPPER, BlockStateProperties.FACING_HOPPER);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.FALLING, BlockStateProperties.FALLING);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.FLOWER_AMOUNT, BlockStateProperties.FLOWER_AMOUNT);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HALF, BlockStateProperties.HALF);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HANGING, BlockStateProperties.HANGING);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HAS_BOOK, BlockStateProperties.HAS_BOOK);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HAS_BOTTLE_0, BlockStateProperties.HAS_BOTTLE_0);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HAS_BOTTLE_1, BlockStateProperties.HAS_BOTTLE_1);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HAS_BOTTLE_2, BlockStateProperties.HAS_BOTTLE_2);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HAS_RECORD, BlockStateProperties.HAS_RECORD);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HATCH, BlockStateProperties.HATCH);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HORIZONTAL_AXIS, BlockStateProperties.HORIZONTAL_AXIS);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.HORIZONTAL_FACING, BlockStateProperties.HORIZONTAL_FACING);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.INVERTED, BlockStateProperties.INVERTED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.IN_WALL, BlockStateProperties.IN_WALL);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.LAYERS, BlockStateProperties.LAYERS);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.LEVEL, BlockStateProperties.LEVEL);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.LEVEL_CAULDRON, BlockStateProperties.LEVEL_CAULDRON);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.LEVEL_COMPOSTER, BlockStateProperties.LEVEL_COMPOSTER);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.LEVEL_FLOWING, BlockStateProperties.LEVEL_FLOWING);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.LEVEL_HONEY, BlockStateProperties.LEVEL_HONEY);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.LIT, BlockStateProperties.LIT);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.LOCKED, BlockStateProperties.LOCKED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.MODE_COMPARATOR, BlockStateProperties.MODE_COMPARATOR);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.MOISTURE, BlockStateProperties.MOISTURE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.NORTH, BlockStateProperties.NORTH);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.NORTH_REDSTONE, BlockStateProperties.NORTH_REDSTONE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.NORTH_WALL, BlockStateProperties.NORTH_WALL);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.NOTE, BlockStateProperties.NOTE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.NOTEBLOCK_INSTRUMENT, BlockStateProperties.NOTEBLOCK_INSTRUMENT);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.OCCUPIED, BlockStateProperties.OCCUPIED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.OMINOUS, BlockStateProperties.OMINOUS);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.OPEN, BlockStateProperties.OPEN);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.ORIENTATION, BlockStateProperties.ORIENTATION);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.PERSISTENT, BlockStateProperties.PERSISTENT);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.PICKLES, BlockStateProperties.PICKLES);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.PISTON_TYPE, BlockStateProperties.PISTON_TYPE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.POWER, BlockStateProperties.POWER);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.POWERED, BlockStateProperties.POWERED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.RAIL_SHAPE, BlockStateProperties.RAIL_SHAPE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.RAIL_SHAPE_STRAIGHT, BlockStateProperties.RAIL_SHAPE_STRAIGHT);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.RESPAWN_ANCHOR_CHARGES, BlockStateProperties.RESPAWN_ANCHOR_CHARGES);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.ROTATION_16, BlockStateProperties.ROTATION_16);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SCULK_SENSOR_PHASE, BlockStateProperties.SCULK_SENSOR_PHASE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SHORT, BlockStateProperties.SHORT);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SHRIEKING, BlockStateProperties.SHRIEKING);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SIGNAL_FIRE, BlockStateProperties.SIGNAL_FIRE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SLAB_TYPE, BlockStateProperties.SLAB_TYPE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SNOWY, BlockStateProperties.SNOWY);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SOUTH, BlockStateProperties.SOUTH);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SOUTH_REDSTONE, BlockStateProperties.SOUTH_REDSTONE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.SOUTH_WALL, BlockStateProperties.SOUTH_WALL);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.STABILITY_DISTANCE, BlockStateProperties.STABILITY_DISTANCE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.STAGE, BlockStateProperties.STAGE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.STAIRS_SHAPE, BlockStateProperties.STAIRS_SHAPE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.STRUCTUREBLOCK_MODE, BlockStateProperties.STRUCTUREBLOCK_MODE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.TILT, BlockStateProperties.TILT);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.TIP, BlockStateProperties.TIP);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.TRIAL_SPAWNER_STATE, BlockStateProperties.TRIAL_SPAWNER_STATE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.TRIGGERED, BlockStateProperties.TRIGGERED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.UNSTABLE, BlockStateProperties.UNSTABLE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.UP, BlockStateProperties.UP);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.VAULT_STATE, BlockStateProperties.VAULT_STATE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.VERTICAL_DIRECTION, BlockStateProperties.VERTICAL_DIRECTION);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.WATERLOGGED, BlockStateProperties.WATERLOGGED);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.WEST, BlockStateProperties.WEST);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.WEST_REDSTONE, BlockStateProperties.WEST_REDSTONE);
BlockStateDataProvider.registerProperty(registrator, BlockStateKeys.WEST_WALL, BlockStateProperties.WEST_WALL);
}
}
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
Loading

0 comments on commit 9a0b4ce

Please sign in to comment.