diff --git a/.github/workflows/check-spotless.yaml b/.github/workflows/check-spotless.yaml index b4742e6e56f..8ff8b992f96 100644 --- a/.github/workflows/check-spotless.yaml +++ b/.github/workflows/check-spotless.yaml @@ -10,5 +10,5 @@ jobs: call-check: uses: SpongePowered/.github/.github/workflows/shared-check-spotless.yaml@master with: - runtime_version: 17 + runtime_version: 21 secrets: inherit diff --git a/.github/workflows/check-style.yaml b/.github/workflows/check-style.yaml index c991e800c47..286cd11250a 100644 --- a/.github/workflows/check-style.yaml +++ b/.github/workflows/check-style.yaml @@ -10,5 +10,5 @@ jobs: call-check: uses: SpongePowered/.github/.github/workflows/shared-check-style.yaml@master with: - runtime_version: 17 + runtime_version: 21 secrets: inherit diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bccff70bb5f..b1d5d767ffe 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: call-build: uses: SpongePowered/.github/.github/workflows/shared-ci.yaml@master with: - runtime_version: 17 + runtime_version: 21 publish_snapshot_javadoc: true publishing_branch_regex: 'api-\d+' secrets: inherit diff --git a/README.md b/README.md index b761727a81b..8704b561390 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -SpongeAPI ![Build Status](https://github.com/SpongePowered/SpongeAPI/actions/workflows/ci.yaml/badge.svg?branch=api-10) +SpongeAPI ![Build Status](https://github.com/SpongePowered/SpongeAPI/actions/workflows/ci.yaml/badge.svg?branch=api-11) ============= A mature Minecraft plugin API (not including an implementation), licensed under the [MIT License]. @@ -11,7 +11,7 @@ A mature Minecraft plugin API (not including an implementation), licensed under * [Discord] `#plugins` ## Prerequisites -* [Java] 17 +* [Java] 21 ## Clone The following steps will ensure your project is cloned properly. @@ -24,7 +24,7 @@ __Note:__ If you do not have [Gradle] installed then use ./gradlew for Unix syst In order to build SpongeAPI you simply need to run the `gradle` command. You can find the compiled JAR file in `./build/libs` labeled similarly to 'spongeapi-x.x.x-SNAPSHOT.jar'. -Sponge will use a javac version of *at least* 17. If an older JDK is used to launch Gradle, JDK 17 will be downloaded automatically. +Sponge will use a javac version of *at least* 21. If an older JDK is used to launch Gradle, JDK 21 will be downloaded automatically. ## Contributing Are you a talented programmer looking to contribute some code? We'd love the help! diff --git a/build.gradle.kts b/build.gradle.kts index 9409899b2fe..95dda334e29 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -132,7 +132,7 @@ dependencies { tasks { genEventImpl { - sourceCompatibility = javaTarget + sourceCompatibility = "17" // TODO use javaTarget here destinationDirectory = project.layout.buildDirectory.dir("generated/event-factory") outputFactory = "org.spongepowered.api.event.SpongeEventFactory" diff --git a/gradle.properties b/gradle.properties index ce5b09031ea..5feddbda90e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ group=org.spongepowered -version=11.0.0-SNAPSHOT +version=11.1.0-SNAPSHOT organization=SpongePowered projectUrl=https://www.spongepowered.org projectDescription=A plugin API for Minecraft: Java Edition -javaTarget=17 +javaTarget=21 javadocPublishRoot=https://jd.spongepowered.org/ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0aa6e15d28a..e406cbbd736 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ format = { version = "1.1" } [versions] -adventure = "4.16.0" +adventure = "4.17.0" caffeine = "3.1.8" checker = "3.42.0" checkstyle = "10.12.7" @@ -13,7 +13,7 @@ guice = "5.0.1" ideaExt = "1.1.8" indra = "3.1.3" junit = "5.10.2" -log4j = "2.19.0" +log4j = "2.22.1" math = "2.0.1" mockito = "5.11.0" pluginSpi = "0.3.0" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 886a4ab3765..5b9cf0c0099 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -74,6 +74,11 @@ + + + + + @@ -84,11 +89,21 @@ + + + + + + + + + + @@ -171,6 +186,11 @@ + + + + + @@ -179,6 +199,17 @@ + + + + + + + + + + + @@ -632,6 +663,11 @@ + + + + + @@ -687,6 +723,21 @@ + + + + + + + + + + + + + + + @@ -748,6 +799,17 @@ + + + + + + + + + + + @@ -756,6 +818,14 @@ + + + + + + + + @@ -767,6 +837,17 @@ + + + + + + + + + + + @@ -778,6 +859,17 @@ + + + + + + + + + + + @@ -789,6 +881,17 @@ + + + + + + + + + + + @@ -800,6 +903,17 @@ + + + + + + + + + + + @@ -811,6 +925,17 @@ + + + + + + + + + + + @@ -822,6 +947,17 @@ + + + + + + + + + + + @@ -997,6 +1133,11 @@ + + + + + @@ -1154,6 +1295,11 @@ + + + + + @@ -1164,6 +1310,11 @@ + + + + + @@ -1175,11 +1326,24 @@ + + + + + + + + + + + + + @@ -1355,6 +1519,11 @@ + + + + + @@ -1423,6 +1592,11 @@ + + + + + @@ -1439,6 +1613,11 @@ + + + + + @@ -1582,6 +1761,9 @@ + + + @@ -1711,6 +1893,11 @@ + + + + + diff --git a/src/ap/java/org/spongepowered/plugin/processor/ListenerProcessor.java b/src/ap/java/org/spongepowered/plugin/processor/ListenerProcessor.java index 20d86b29eda..9f65589fbe1 100644 --- a/src/ap/java/org/spongepowered/plugin/processor/ListenerProcessor.java +++ b/src/ap/java/org/spongepowered/plugin/processor/ListenerProcessor.java @@ -58,7 +58,7 @@ import javax.tools.Diagnostic; @SupportedAnnotationTypes(ListenerProcessor.LISTENER_ANNOTATION_CLASS) -@SupportedSourceVersion(SourceVersion.RELEASE_17) +@SupportedSourceVersion(SourceVersion.RELEASE_21) public class ListenerProcessor extends AbstractProcessor { static final String LISTENER_ANNOTATION_CLASS = "org.spongepowered.api.event.Listener"; diff --git a/src/main/java/org/spongepowered/api/Server.java b/src/main/java/org/spongepowered/api/Server.java index 229aa001a5b..7f953b13a3b 100644 --- a/src/main/java/org/spongepowered/api/Server.java +++ b/src/main/java/org/spongepowered/api/Server.java @@ -26,6 +26,7 @@ import net.kyori.adventure.audience.Audience; import net.kyori.adventure.audience.ForwardingAudience; +import net.kyori.adventure.resource.ResourcePackRequest; import net.kyori.adventure.text.Component; import org.spongepowered.api.block.entity.CommandBlock; import org.spongepowered.api.command.manager.CommandManager; @@ -38,7 +39,6 @@ import org.spongepowered.api.map.MapStorage; import org.spongepowered.api.network.ServerSideConnection; import org.spongepowered.api.profile.GameProfileManager; -import org.spongepowered.api.resourcepack.ResourcePack; import org.spongepowered.api.scoreboard.Scoreboard; import org.spongepowered.api.service.ServiceProvider; import org.spongepowered.api.user.UserManager; @@ -131,11 +131,11 @@ public interface Server extends ForwardingAudience, Engine, LocaleSource { Component motd(); /** - * Gets the {@link ResourcePack pack} sent to clients when they join. + * Gets the {@link ResourcePackRequest pack} sent to clients when they join. * * @return The resource pack */ - Optional resourcePack(); + Optional resourcePack(); /** * Gets the player idle timeout, in minutes. diff --git a/src/main/java/org/spongepowered/api/advancement/criteria/trigger/Triggers.java b/src/main/java/org/spongepowered/api/advancement/criteria/trigger/Triggers.java index 5060b9e9630..e24f0e4e328 100644 --- a/src/main/java/org/spongepowered/api/advancement/criteria/trigger/Triggers.java +++ b/src/main/java/org/spongepowered/api/advancement/criteria/trigger/Triggers.java @@ -42,6 +42,8 @@ public final class Triggers { public static final DefaultedRegistryReference> ALLAY_DROP_ITEM_ON_BLOCK = Triggers.key(ResourceKey.minecraft("allay_drop_item_on_block")); + public static final DefaultedRegistryReference> ANY_BLOCK_USE = Triggers.key(ResourceKey.minecraft("any_block_use")); + public static final DefaultedRegistryReference> AVOID_VIBRATION = Triggers.key(ResourceKey.minecraft("avoid_vibration")); public static final DefaultedRegistryReference> BEE_NEST_DESTROYED = Triggers.key(ResourceKey.minecraft("bee_nest_destroyed")); @@ -58,8 +60,12 @@ public final class Triggers { public static final DefaultedRegistryReference> CONSUME_ITEM = Triggers.key(ResourceKey.minecraft("consume_item")); + public static final DefaultedRegistryReference> CRAFTER_RECIPE_CRAFTED = Triggers.key(ResourceKey.minecraft("crafter_recipe_crafted")); + public static final DefaultedRegistryReference> CURED_ZOMBIE_VILLAGER = Triggers.key(ResourceKey.minecraft("cured_zombie_villager")); + public static final DefaultedRegistryReference> DEFAULT_BLOCK_USE = Triggers.key(ResourceKey.minecraft("default_block_use")); + public static final DefaultedRegistryReference> EFFECTS_CHANGED = Triggers.key(ResourceKey.minecraft("effects_changed")); public static final DefaultedRegistryReference> ENCHANTED_ITEM = Triggers.key(ResourceKey.minecraft("enchanted_item")); @@ -70,6 +76,8 @@ public final class Triggers { public static final DefaultedRegistryReference> ENTITY_KILLED_PLAYER = Triggers.key(ResourceKey.minecraft("entity_killed_player")); + public static final DefaultedRegistryReference> FALL_AFTER_EXPLOSION = Triggers.key(ResourceKey.minecraft("fall_after_explosion")); + public static final DefaultedRegistryReference> FALL_FROM_HEIGHT = Triggers.key(ResourceKey.minecraft("fall_from_height")); public static final DefaultedRegistryReference> FILLED_BUCKET = Triggers.key(ResourceKey.minecraft("filled_bucket")); diff --git a/src/main/java/org/spongepowered/api/block/BlockTypes.java b/src/main/java/org/spongepowered/api/block/BlockTypes.java index 4be86c22e8c..cde1c5aabfc 100644 --- a/src/main/java/org/spongepowered/api/block/BlockTypes.java +++ b/src/main/java/org/spongepowered/api/block/BlockTypes.java @@ -896,6 +896,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference HAY_BLOCK = BlockTypes.key(ResourceKey.minecraft("hay_block")); + public static final DefaultedRegistryReference HEAVY_CORE = BlockTypes.key(ResourceKey.minecraft("heavy_core")); + public static final DefaultedRegistryReference HEAVY_WEIGHTED_PRESSURE_PLATE = BlockTypes.key(ResourceKey.minecraft("heavy_weighted_pressure_plate")); public static final DefaultedRegistryReference HONEY_BLOCK = BlockTypes.key(ResourceKey.minecraft("honey_block")); @@ -1940,6 +1942,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference TWISTING_VINES_PLANT = BlockTypes.key(ResourceKey.minecraft("twisting_vines_plant")); + public static final DefaultedRegistryReference VAULT = BlockTypes.key(ResourceKey.minecraft("vault")); + public static final DefaultedRegistryReference VERDANT_FROGLIGHT = BlockTypes.key(ResourceKey.minecraft("verdant_froglight")); public static final DefaultedRegistryReference VINE = BlockTypes.key(ResourceKey.minecraft("vine")); diff --git a/src/main/java/org/spongepowered/api/block/entity/BlockEntity.java b/src/main/java/org/spongepowered/api/block/entity/BlockEntity.java index 0b9874c9d7a..bc74a110b34 100644 --- a/src/main/java/org/spongepowered/api/block/entity/BlockEntity.java +++ b/src/main/java/org/spongepowered/api/block/entity/BlockEntity.java @@ -56,31 +56,16 @@ public interface BlockEntity extends SerializableDataHolder.Mutable, Locatable { /** - * Checks for whether the block entity is currently valid or not. + * Returns whether this block entity has been removed. * - *

Use this method to check if processing should be run on this - * {@link BlockEntity}. If it is valid, then processing can be run on it. - * If not, then processing should wait until it becomes valid or is - * destroyed.

- * - * @return True if the block entity is valid, false if not + * @return True if this block entity has been removed */ - boolean isValid(); + boolean isRemoved(); /** - * Changes the validation of this block entity. - * - *

If the block entity is invalid, no processing will be done on this - * {@link BlockEntity} until it either becomes valid or is reset on the next - * tick.

- * - *

If the block entity is valid, then processing can continue and this - * {@link BlockEntity} will not be reset on the next tick.

- * - * @param valid True if the block entity should be validated, or false if - * it should be invalidated + * Removes this block entity from the world and its corresponding block. */ - void setValid(boolean valid); + void remove(); /** * Gets the type of {@link BlockEntity} this is. diff --git a/src/main/java/org/spongepowered/api/block/entity/BlockEntityTypes.java b/src/main/java/org/spongepowered/api/block/entity/BlockEntityTypes.java index a768ed3d17f..9d1cf49f8ad 100644 --- a/src/main/java/org/spongepowered/api/block/entity/BlockEntityTypes.java +++ b/src/main/java/org/spongepowered/api/block/entity/BlockEntityTypes.java @@ -126,6 +126,8 @@ public final class BlockEntityTypes { public static final DefaultedRegistryReference TRIAL_SPAWNER = BlockEntityTypes.key(ResourceKey.minecraft("trial_spawner")); + public static final DefaultedRegistryReference VAULT = BlockEntityTypes.key(ResourceKey.minecraft("vault")); + private BlockEntityTypes() { } diff --git a/src/main/java/org/spongepowered/api/command/CommandExecutor.java b/src/main/java/org/spongepowered/api/command/CommandExecutor.java index b154f6f59bf..856e2c0e15a 100644 --- a/src/main/java/org/spongepowered/api/command/CommandExecutor.java +++ b/src/main/java/org/spongepowered/api/command/CommandExecutor.java @@ -27,6 +27,7 @@ import org.spongepowered.api.command.exception.CommandException; import org.spongepowered.api.command.parameter.CommandContext; + /** * Interface containing the method directing how a certain command will * be executed. diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java index 9ef65a1b3b7..8efdf7d0324 100644 --- a/src/main/java/org/spongepowered/api/data/Keys.java +++ b/src/main/java/org/spongepowered/api/data/Keys.java @@ -77,6 +77,7 @@ import org.spongepowered.api.data.type.PistonType; import org.spongepowered.api.data.type.PortionType; import org.spongepowered.api.data.type.ProfessionType; +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.SculkSensorState; @@ -87,6 +88,7 @@ import org.spongepowered.api.data.type.StairShape; import org.spongepowered.api.data.type.StructureMode; import org.spongepowered.api.data.type.Tilt; +import org.spongepowered.api.data.type.ToolRule; import org.spongepowered.api.data.type.TropicalFishShape; import org.spongepowered.api.data.type.VillagerType; import org.spongepowered.api.data.type.WallConnectionState; @@ -380,7 +382,6 @@ public final class Keys { /** * The set of {@link PotionEffect}s applied on use of an {@link ItemStack}. - * Readonly */ public static final Key> APPLICABLE_POTION_EFFECTS = Keys.weightedKey(ResourceKey.sponge("applicable_potion_effects"), PotionEffect.class); @@ -562,6 +563,12 @@ public final class Keys { */ public static final Key> BREEDING_COOLDOWN = Keys.key(ResourceKey.sponge("breeding_cooldown"), Ticks.class); + /** + * Whether a {@link BlockState} can be lit on fire by things like spreading lava, + * or sometimes a {@link ServerLocation} to be directionally specific. + */ + public static final Key> BURNABLE = Keys.key(ResourceKey.sponge("burnable"), Boolean.class); + /** * The burntime of an {@link ItemStack} fuel in a furnace. * See {@link #FUEL} for the time @@ -569,6 +576,11 @@ public final class Keys { */ public static final Key> BURN_TIME = Keys.key(ResourceKey.sponge("burn_time"), Integer.class); + /** + * Whether an {@link ItemStack} can always be eaten. + */ + public static final Key> CAN_ALWAYS_EAT = Keys.key(ResourceKey.sponge("can_always_eat"), Boolean.class); + /** * Whether an {@link Animal} can breed. * In Vanilla, animals can breed if their {@link Keys#BREEDING_COOLDOWN} is equal to 0. @@ -596,7 +608,8 @@ public final class Keys { public static final Key> CAN_GRIEF = Keys.key(ResourceKey.sponge("can_grief"), Boolean.class); /** - * The set of harvestable {@link BlockType}s with an {@link ItemStack}. {@link #EFFICIENCY} + * The set of harvestable {@link BlockType}s with an {@link ItemStack}. + * See {@link #TOOL_RULES} for the rules resulting in this set. * Readonly */ public static final Key> CAN_HARVEST = Keys.setKey(ResourceKey.sponge("can_harvest"), BlockType.class); @@ -642,6 +655,11 @@ public final class Keys { */ public static final Key> CAT_TYPE = Keys.key(ResourceKey.sponge("cat_type"), CatType.class); + /** + * The projectiles stored in an {@link ItemTypes#CROSSBOW}. + */ + public static final Key> CHARGED_PROJECTILES = Keys.listKey(ResourceKey.sponge("charged_projectiles"), ItemStackSnapshot.class); + /** * Whether a {@link ServerPlayer} can will see colours sent in messages. */ @@ -769,6 +787,11 @@ public final class Keys { */ public static final Key> CUSTOM_NAME = Keys.key(ResourceKey.sponge("custom_name"), Component.class); + /** + * The custom potion effects that are stored on an {@link ItemStack}. + */ + public static final Key> CUSTOM_POTION_EFFECTS = Keys.listKey(ResourceKey.sponge("custom_potion_effects"), PotionEffect.class); + /** * The damage absorbed by an armor {@link ItemStack}. * Readonly @@ -871,13 +894,14 @@ public final class Keys { public static final Key> DYE_COLOR = Keys.key(ResourceKey.sponge("dye_color"), DyeColor.class); /** - * The time a {@link Panda} has been eating (in ticks) + * The time a {@link Panda} has been eating (in ticks) or + * the time an {@link ItemStack} takes to eat. */ public static final Key> EATING_TIME = Keys.key(ResourceKey.sponge("eating_time"), Ticks.class); /** * The efficiency of an {@link ItemStack} tool. Affects mining speed of supported materials. {@link #CAN_HARVEST} - * Readonly + * Removing this from a tool makes it no longer a tool. */ public static final Key> EFFICIENCY = Keys.key(ResourceKey.sponge("efficiency"), Double.class); @@ -893,6 +917,12 @@ public final class Keys { */ public static final Key> EGG_TIME = Keys.key(ResourceKey.sponge("egg_time"), Ticks.class); + /** + * Whether the glint effect on an {@link ItemStack} is shown. + * This overrides the default behaviour when {@link #APPLIED_ENCHANTMENTS} or {@link #STORED_ENCHANTMENTS} are present. + */ + public static final Key> ENCHANTMENT_GLINT_OVERRIDE = Keys.key(ResourceKey.sponge("enchantment_glint_override"), Boolean.class); + /** * The age (in ticks) of an {@link EndGateway} */ @@ -1019,6 +1049,11 @@ public final class Keys { */ public static final Key> FIRE_DAMAGE_DELAY = Keys.key(ResourceKey.sponge("fire_damage_delay"), Ticks.class); + /** + * Whether an {@link ItemStack} will burn in fire. + */ + public static final Key> FIRE_RESISTANT = Keys.key(ResourceKey.sponge("fire_resistant"), Boolean.class); + /** * The amount of ticks an {@link Entity} is still burning. */ @@ -1369,6 +1404,16 @@ public final class Keys { */ public static final Key> HIDE_MISCELLANEOUS = Keys.key(ResourceKey.sponge("hide_miscellaneous"), Boolean.class); + /** + * Whether the {@link #STORED_ENCHANTMENTS} of an {@link ItemStack} are hidden. + */ + public static final Key> HIDE_STORED_ENCHANTMENTS = Keys.key(ResourceKey.sponge("hide_stored_enchantments"), Boolean.class); + + /** + * Whether the tooltip of an {@link ItemStack} is hidden. + */ + public static final Key> HIDE_TOOLTIP = Keys.key(ResourceKey.sponge("hide_tooltip"), Boolean.class); + /** * Whether {@link #IS_UNBREAKABLE} state of an {@link ItemStack} is hidden. */ @@ -1418,6 +1463,13 @@ public final class Keys { */ public static final Key> INSTRUMENT_TYPE = Keys.key(ResourceKey.sponge("instrument_type"), InstrumentType.class); + /** + * Whether a projectile {@link ItemStack} would be intangible when fired. + * Intangible {@link Projectile projectiles} have {@link org.spongepowered.api.data.type.PickupRules#CREATIVE_ONLY}. + * See {@link Keys#PICKUP_RULE}. + */ + public static final Key> INTANGIBLE_PROJECTILE = Keys.key(ResourceKey.sponge("intangible_projectile"), Boolean.class); + /** * The interpolation delay of a {@link DisplayEntity} */ @@ -1428,6 +1480,11 @@ public final class Keys { */ public static final Key> INTERPOLATION_DURATION = Keys.key(ResourceKey.sponge("interpolation_duration"), Ticks.class); + /** + * The {@link Inventory} held in an {@link ItemStack} such as {@link ItemTypes#SHULKER_BOX}. + */ + public static final Key> INVENTORY = Keys.key(ResourceKey.sponge("inventory"), Inventory.class); + /** * Whether a {@link BlockTypes#DAYLIGHT_DETECTOR} {@link BlockState} is inverted. */ @@ -1995,6 +2052,12 @@ public final class Keys { */ public static final Key> ITEM_DURABILITY = Keys.key(ResourceKey.sponge("item_durability"), Integer.class); + /** + * The default item name of an {@link ItemStack}. + *

May be overridden by {@link #CUSTOM_NAME}

+ */ + public static final Key> ITEM_NAME = Keys.key(ResourceKey.sponge("item_name"), Component.class); + /** * The rarity of an item. */ @@ -2112,6 +2175,11 @@ public final class Keys { */ public static final Key> LODESTONE = Keys.key(ResourceKey.sponge("lodestone"), ServerLocation.class); + /** + * Whether to remove the {@link #LODESTONE target location} when the {@link BlockTypes#LODESTONE} at that location is removed. + */ + public static final Key> LODESTONE_TRACKED = Keys.key(ResourceKey.sponge("lodestone_tracked"), Boolean.class); + /** * The displayed description ("lore") text of an {@link ItemStack}. * @@ -2213,7 +2281,6 @@ public final class Keys { /** * The maximum durability of an {@link ItemStack}. {@link #ITEM_DURABILITY} - * Readonly */ public static final Key> MAX_DURABILITY = Keys.key(ResourceKey.sponge("max_durability"), Integer.class); @@ -2243,6 +2310,13 @@ public final class Keys { */ public static final Key> MAX_FROZEN_TIME = Keys.key(ResourceKey.sponge("max_frozen_time"), Ticks.class); + /** + * The max growth stage of a {@link BlockState}. + * e.g. {@link BlockTypes#CACTUS} or {@link BlockTypes#WHEAT} etc. + * Readonly + */ + public static final Key> MAX_GROWTH_STAGE = Keys.key(ResourceKey.sponge("max_growth_stage"), Integer.class); + /** * The maximum health of a {@link Living}. * @@ -2347,6 +2421,12 @@ public final class Keys { */ public static final Key> NOTE_PITCH = Keys.key(ResourceKey.sponge("note_pitch"), NotePitch.class); + /** + * The sound played by a {@link ItemTypes#PLAYER_HEAD} {@link ItemStack} on a {@link BlockTypes#NOTE_BLOCK}. + * Value is the key of a {@link SoundType}. + */ + public static final Key> NOTE_BLOCK_SOUND = Keys.key(ResourceKey.sponge("note_block_sound"), ResourceKey.class); + /** * The notifier, usually of an {@link Entity}. It is up to the implementation to define. */ @@ -2540,6 +2620,12 @@ public final class Keys { */ public static final Key> PROFESSION_LEVEL = Keys.key(ResourceKey.sponge("profession_level"), Integer.class); + /** + * The {@link Entity} or {@link BlockState} push reaction when a {@link Piston} pushes it. + * Readonly + */ + public static final Key> PUSH_REACTION = Keys.key(ResourceKey.sponge("push_reaction"), PushReaction.class); + /** * Whether pvp combat is enabled in a world of a {@link WorldTemplate} or {@link ServerWorldProperties} * Readonly @@ -2611,15 +2697,18 @@ public final class Keys { */ public static final Key> REMAINING_SPAWN_DELAY = Keys.key(ResourceKey.sponge("remaining_spawn_delay"), Ticks.class); + /** + * The additional experience cost required to modify an {@link ItemStack} in an {@link BlockTypes#ANVIL}. + */ + public static final Key> REPAIR_COST = Keys.key(ResourceKey.sponge("repair_cost"), Integer.class); + /** * The amount of food a food {@link ItemStack} restores when eaten. - * Readonly */ public static final Key> REPLENISHED_FOOD = Keys.key(ResourceKey.sponge("replenished_food"), Integer.class); /** * The amount of saturation a food {@link ItemStack} provides when eaten. - * Readonly */ public static final Key> REPLENISHED_SATURATION = Keys.key(ResourceKey.sponge("replenished_saturation"), Double.class); @@ -3024,6 +3113,11 @@ public final class Keys { */ public static final Key> TARGET_POSITION = Keys.key(ResourceKey.sponge("target_position"), Vector3i.class); + /** + * The teleport duration of a {@link DisplayEntity} + */ + public static final Key> TELEPORT_DURATION = Keys.key(ResourceKey.sponge("teleport_duration"), Ticks.class); + /** * The {@link TemperatureModifier} of a {@link Biome}. * Readonly @@ -3053,6 +3147,17 @@ public final class Keys { */ public static final Key> TILT = Keys.key(ResourceKey.sponge("tilt"), Tilt.class); + /** + * The {@link #ITEM_DURABILITY} damage an {@link ItemStack} tool takes per block. + */ + public static final Key> TOOL_DAMAGE_PER_BLOCK = Keys.key(ResourceKey.sponge("tool_damage_per_block"), Integer.class); + + /** + * The {@link ToolRule rules} of an {@link ItemStack} tool. + * See {@link #CAN_HARVEST} for a list of {@link BlockType block types}. + */ + public static final Key> TOOL_RULES = Keys.listKey(ResourceKey.sponge("tool_rules"), ToolRule.class); + /** * The {@link ItemTier} of an {@link ItemStack} tool. * Readonly diff --git a/src/main/java/org/spongepowered/api/data/meta/BannerPatternLayer.java b/src/main/java/org/spongepowered/api/data/meta/BannerPatternLayer.java index 912e4e52bad..3e76743afb6 100644 --- a/src/main/java/org/spongepowered/api/data/meta/BannerPatternLayer.java +++ b/src/main/java/org/spongepowered/api/data/meta/BannerPatternLayer.java @@ -48,7 +48,7 @@ public interface BannerPatternLayer extends DataSerializable { * @param color The color * @return The new pattern layer */ - static BannerPatternLayer of(Supplier shape, DefaultedRegistryReference color) { + static BannerPatternLayer of(DefaultedRegistryReference shape, DefaultedRegistryReference color) { return BannerPatternLayer.of(shape.get(), color.get()); } @@ -60,7 +60,7 @@ static BannerPatternLayer of(Supplier shape, Defau * @param color The color * @return The new pattern layer */ - static BannerPatternLayer of(Supplier shape, DyeColor color) { + static BannerPatternLayer of(DefaultedRegistryReference shape, DyeColor color) { return BannerPatternLayer.of(shape.get(), color); } diff --git a/src/main/java/org/spongepowered/api/data/type/ArmorMaterials.java b/src/main/java/org/spongepowered/api/data/type/ArmorMaterials.java index 1a0d0f0dd6b..64170a17a4f 100644 --- a/src/main/java/org/spongepowered/api/data/type/ArmorMaterials.java +++ b/src/main/java/org/spongepowered/api/data/type/ArmorMaterials.java @@ -40,19 +40,21 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class ArmorMaterials { - public static final DefaultedRegistryReference CHAINMAIL = ArmorMaterials.key(ResourceKey.sponge("chainmail")); + public static final DefaultedRegistryReference ARMADILLO = ArmorMaterials.key(ResourceKey.minecraft("armadillo")); - public static final DefaultedRegistryReference DIAMOND = ArmorMaterials.key(ResourceKey.sponge("diamond")); + public static final DefaultedRegistryReference CHAINMAIL = ArmorMaterials.key(ResourceKey.minecraft("chainmail")); - public static final DefaultedRegistryReference GOLD = ArmorMaterials.key(ResourceKey.sponge("gold")); + public static final DefaultedRegistryReference DIAMOND = ArmorMaterials.key(ResourceKey.minecraft("diamond")); - public static final DefaultedRegistryReference IRON = ArmorMaterials.key(ResourceKey.sponge("iron")); + public static final DefaultedRegistryReference GOLD = ArmorMaterials.key(ResourceKey.minecraft("gold")); - public static final DefaultedRegistryReference LEATHER = ArmorMaterials.key(ResourceKey.sponge("leather")); + public static final DefaultedRegistryReference IRON = ArmorMaterials.key(ResourceKey.minecraft("iron")); - public static final DefaultedRegistryReference NETHERITE = ArmorMaterials.key(ResourceKey.sponge("netherite")); + public static final DefaultedRegistryReference LEATHER = ArmorMaterials.key(ResourceKey.minecraft("leather")); - public static final DefaultedRegistryReference TURTLE = ArmorMaterials.key(ResourceKey.sponge("turtle")); + public static final DefaultedRegistryReference NETHERITE = ArmorMaterials.key(ResourceKey.minecraft("netherite")); + + public static final DefaultedRegistryReference TURTLE = ArmorMaterials.key(ResourceKey.minecraft("turtle")); private ArmorMaterials() { } diff --git a/src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java b/src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java index 1e8cf2101ee..6c40aadf68c 100644 --- a/src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java +++ b/src/main/java/org/spongepowered/api/data/type/AttachmentSurface.java @@ -31,6 +31,6 @@ * Represents a block surface. */ @CatalogedBy(AttachmentSurfaces.class) -public interface AttachmentSurface extends DefaultedRegistryValue, Comparable { +public interface AttachmentSurface extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java b/src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java index 467d705b3b1..f94c386171c 100644 --- a/src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java +++ b/src/main/java/org/spongepowered/api/data/type/BambooLeavesType.java @@ -32,6 +32,6 @@ * Represents the type of leaves of a {@link BlockTypes#BAMBOO} block. */ @CatalogedBy(BambooLeavesTypes.class) -public interface BambooLeavesType extends DefaultedRegistryValue, Comparable { +public interface BambooLeavesType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/BannerPatternShapes.java b/src/main/java/org/spongepowered/api/data/type/BannerPatternShapes.java index b85746c74ff..6b93e14f419 100644 --- a/src/main/java/org/spongepowered/api/data/type/BannerPatternShapes.java +++ b/src/main/java/org/spongepowered/api/data/type/BannerPatternShapes.java @@ -37,7 +37,7 @@ * */ @SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.GAME) +@RegistryScopes(scopes = RegistryScope.ENGINE) public final class BannerPatternShapes { public static final DefaultedRegistryReference BASE = BannerPatternShapes.key(ResourceKey.minecraft("base")); @@ -126,10 +126,10 @@ private BannerPatternShapes() { } public static Registry registry() { - return Sponge.game().registry(RegistryTypes.BANNER_PATTERN_SHAPE); + return Sponge.server().registry(RegistryTypes.BANNER_PATTERN_SHAPE); } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.BANNER_PATTERN_SHAPE, location).asDefaultedReference(Sponge::game); + return RegistryKey.of(RegistryTypes.BANNER_PATTERN_SHAPE, location).asDefaultedReference(Sponge::server); } } diff --git a/src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java b/src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java index 3083ad8bf2a..106643793b5 100644 --- a/src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java +++ b/src/main/java/org/spongepowered/api/data/type/BellAttachmentType.java @@ -32,6 +32,6 @@ * Represents the attachment-type of a {@link BlockTypes#BELL} block. */ @CatalogedBy(BellAttachmentTypes.class) -public interface BellAttachmentType extends DefaultedRegistryValue, Comparable { +public interface BellAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java b/src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java index a4c7989c9c7..d533040edab 100644 --- a/src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java +++ b/src/main/java/org/spongepowered/api/data/type/ChestAttachmentType.java @@ -34,6 +34,6 @@ * chests into a double chests. */ @CatalogedBy(ChestAttachmentTypes.class) -public interface ChestAttachmentType extends DefaultedRegistryValue, Comparable { +public interface ChestAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/ComparatorMode.java b/src/main/java/org/spongepowered/api/data/type/ComparatorMode.java index 63b995ddb0c..02a2ab223d3 100644 --- a/src/main/java/org/spongepowered/api/data/type/ComparatorMode.java +++ b/src/main/java/org/spongepowered/api/data/type/ComparatorMode.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(ComparatorModes.class) -public interface ComparatorMode extends DefaultedRegistryValue, Comparable { +public interface ComparatorMode extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/DoorHinge.java b/src/main/java/org/spongepowered/api/data/type/DoorHinge.java index 559c82a5522..e24042f9870 100644 --- a/src/main/java/org/spongepowered/api/data/type/DoorHinge.java +++ b/src/main/java/org/spongepowered/api/data/type/DoorHinge.java @@ -32,6 +32,6 @@ * Represents a side of a hinge. */ @CatalogedBy(DoorHinges.class) -public interface DoorHinge extends DefaultedRegistryValue, Cycleable, Comparable { +public interface DoorHinge extends DefaultedRegistryValue, Cycleable, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java b/src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java index 4ea07bd2cef..156051a015a 100644 --- a/src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java +++ b/src/main/java/org/spongepowered/api/data/type/DripstoneSegment.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(DripstoneSegments.class) -public interface DripstoneSegment extends DefaultedRegistryValue, Comparable { +public interface DripstoneSegment extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/InstrumentType.java b/src/main/java/org/spongepowered/api/data/type/InstrumentType.java index 84a6d4eb9a3..9d3d1649c12 100644 --- a/src/main/java/org/spongepowered/api/data/type/InstrumentType.java +++ b/src/main/java/org/spongepowered/api/data/type/InstrumentType.java @@ -32,7 +32,7 @@ * Represents a type of instrument. */ @CatalogedBy(InstrumentTypes.class) -public interface InstrumentType extends DefaultedRegistryValue, Comparable { +public interface InstrumentType extends DefaultedRegistryValue, Comparable, StringRepresentable { /** * Gets the {@link SoundType} that is used by diff --git a/src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java b/src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java index 7c117aab408..84cabb9c2c1 100644 --- a/src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java +++ b/src/main/java/org/spongepowered/api/data/type/JigsawBlockOrientation.java @@ -33,7 +33,7 @@ * Represents the front and top orientation of {@link BlockTypes#JIGSAW} blocks. */ @CatalogedBy(JigsawBlockOrientations.class) -public interface JigsawBlockOrientation extends DefaultedRegistryValue, Comparable { +public interface JigsawBlockOrientation extends DefaultedRegistryValue, Comparable, StringRepresentable { /** * The front facing direction of a jigsaw block. diff --git a/src/main/java/org/spongepowered/api/data/type/PistonType.java b/src/main/java/org/spongepowered/api/data/type/PistonType.java index 1bb90ccdc50..a52e8c2f201 100644 --- a/src/main/java/org/spongepowered/api/data/type/PistonType.java +++ b/src/main/java/org/spongepowered/api/data/type/PistonType.java @@ -31,6 +31,6 @@ * Represents a "type" of piston. */ @CatalogedBy(PistonTypes.class) -public interface PistonType extends DefaultedRegistryValue, Comparable { +public interface PistonType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/PortionType.java b/src/main/java/org/spongepowered/api/data/type/PortionType.java index df57aceb2b8..efac7f30217 100644 --- a/src/main/java/org/spongepowered/api/data/type/PortionType.java +++ b/src/main/java/org/spongepowered/api/data/type/PortionType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(PortionTypes.class) -public interface PortionType extends DefaultedRegistryValue, Comparable { +public interface PortionType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/network/ServerPlayerConnection.java b/src/main/java/org/spongepowered/api/data/type/PushReaction.java similarity index 66% rename from src/main/java/org/spongepowered/api/network/ServerPlayerConnection.java rename to src/main/java/org/spongepowered/api/data/type/PushReaction.java index e7582d187f3..374eb454a12 100644 --- a/src/main/java/org/spongepowered/api/network/ServerPlayerConnection.java +++ b/src/main/java/org/spongepowered/api/data/type/PushReaction.java @@ -22,28 +22,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.network; +package org.spongepowered.api.data.type; -import org.spongepowered.api.entity.living.player.server.ServerPlayer; +import org.spongepowered.api.util.annotation.CatalogedBy; -/** - * Represents a connection of a client to the server where - * the {@link ServerPlayer} has successfully joined. - */ -public interface ServerPlayerConnection extends PlayerConnection, ServerSideConnection { - - /** - * Gets the associated {@link ServerPlayer player} for this connection. - * - * @return The associated player - */ - @Override - ServerPlayer player(); +@CatalogedBy(PushReactions.class) +public interface PushReaction { - /** - * Gets the connection latency. This is constantly calculated by the server. - * - * @return The latency - */ - int latency(); } diff --git a/src/main/java/org/spongepowered/api/data/type/PushReactions.java b/src/main/java/org/spongepowered/api/data/type/PushReactions.java new file mode 100644 index 00000000000..681ec52667e --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/PushReactions.java @@ -0,0 +1,52 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.type; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.registry.DefaultedRegistryReference; +import org.spongepowered.api.registry.Registry; +import org.spongepowered.api.registry.RegistryKey; +import org.spongepowered.api.registry.RegistryScope; +import org.spongepowered.api.registry.RegistryScopes; +import org.spongepowered.api.registry.RegistryTypes; + +@RegistryScopes(scopes = RegistryScope.GAME) +public final class PushReactions { + + public static final DefaultedRegistryReference NORMAL = key(ResourceKey.minecraft("NORMAL")); + public static final DefaultedRegistryReference DESTROY = key(ResourceKey.minecraft("DESTROY")); + public static final DefaultedRegistryReference BLOCK = key(ResourceKey.minecraft("BLOCK")); + public static final DefaultedRegistryReference IGNORE = key(ResourceKey.minecraft("IGNORE")); + public static final DefaultedRegistryReference PUSH_ONLY = key(ResourceKey.minecraft("PUSH_ONLY")); + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.PUSH_REACTION); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.PUSH_REACTION, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/RailDirection.java b/src/main/java/org/spongepowered/api/data/type/RailDirection.java index 2d7e68ef5da..4d21ad9d24a 100644 --- a/src/main/java/org/spongepowered/api/data/type/RailDirection.java +++ b/src/main/java/org/spongepowered/api/data/type/RailDirection.java @@ -29,6 +29,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(RailDirections.class) -public interface RailDirection extends DefaultedRegistryValue, Cycleable, Comparable { +public interface RailDirection extends DefaultedRegistryValue, Cycleable, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/SculkSensorState.java b/src/main/java/org/spongepowered/api/data/type/SculkSensorState.java index e9b50d6c4fc..2870604f94f 100644 --- a/src/main/java/org/spongepowered/api/data/type/SculkSensorState.java +++ b/src/main/java/org/spongepowered/api/data/type/SculkSensorState.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(SculkSensorStates.class) -public interface SculkSensorState extends DefaultedRegistryValue, Comparable { +public interface SculkSensorState extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/SlabPortion.java b/src/main/java/org/spongepowered/api/data/type/SlabPortion.java index 2fdb64d5ef3..af3853a2be8 100644 --- a/src/main/java/org/spongepowered/api/data/type/SlabPortion.java +++ b/src/main/java/org/spongepowered/api/data/type/SlabPortion.java @@ -33,6 +33,6 @@ * example {@link BlockTypes#STONE_SLAB}. */ @CatalogedBy(SlabPortions.class) -public interface SlabPortion extends DefaultedRegistryValue, Comparable { +public interface SlabPortion extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/StairShape.java b/src/main/java/org/spongepowered/api/data/type/StairShape.java index 99bb8f11f04..a445a429130 100644 --- a/src/main/java/org/spongepowered/api/data/type/StairShape.java +++ b/src/main/java/org/spongepowered/api/data/type/StairShape.java @@ -31,6 +31,6 @@ * Represents a stair shape. */ @CatalogedBy(StairShapes.class) -public interface StairShape extends DefaultedRegistryValue, Comparable { +public interface StairShape extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/network/PlayerConnection.java b/src/main/java/org/spongepowered/api/data/type/StringRepresentable.java similarity index 75% rename from src/main/java/org/spongepowered/api/network/PlayerConnection.java rename to src/main/java/org/spongepowered/api/data/type/StringRepresentable.java index 54e4c8c15d6..dba958f2912 100644 --- a/src/main/java/org/spongepowered/api/network/PlayerConnection.java +++ b/src/main/java/org/spongepowered/api/data/type/StringRepresentable.java @@ -22,20 +22,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.network; - -import org.spongepowered.api.entity.living.player.Player; +package org.spongepowered.api.data.type; /** - * Represents a connection of a client to the server where - * the {@link Player} has successfully joined. + * Represents a type that has a stable string representation, usually an enumerated + * set of values, like most catalog types: + * {@link org.spongepowered.api.data.type.ArtType}, + * {@link RabbitType}, {@link RailDirection}, etc. */ -public interface PlayerConnection extends EngineConnection { +public interface StringRepresentable { + + String serializationString(); - /** - * Gets the associated {@link Player player} for this connection. - * - * @return The associated player - */ - Player player(); } diff --git a/src/main/java/org/spongepowered/api/data/type/StructureMode.java b/src/main/java/org/spongepowered/api/data/type/StructureMode.java index 755c31d10f9..7562aa8d9f2 100644 --- a/src/main/java/org/spongepowered/api/data/type/StructureMode.java +++ b/src/main/java/org/spongepowered/api/data/type/StructureMode.java @@ -32,6 +32,6 @@ * Represents a mode that a {@link StructureBlock} may be in. */ @CatalogedBy(StructureModes.class) -public interface StructureMode extends DefaultedRegistryValue, Comparable { +public interface StructureMode extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/Tilt.java b/src/main/java/org/spongepowered/api/data/type/Tilt.java index bba46d8536e..eeca1951d71 100644 --- a/src/main/java/org/spongepowered/api/data/type/Tilt.java +++ b/src/main/java/org/spongepowered/api/data/type/Tilt.java @@ -28,7 +28,7 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(Tilts.class) -public interface Tilt extends DefaultedRegistryValue, Comparable { +public interface Tilt extends DefaultedRegistryValue, Comparable, StringRepresentable { /** * {@return Whether a block entering this tilt state will trigger any diff --git a/src/main/java/org/spongepowered/api/data/type/ToolRule.java b/src/main/java/org/spongepowered/api/data/type/ToolRule.java new file mode 100644 index 00000000000..aec0b1e332e --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ToolRule.java @@ -0,0 +1,183 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.type; + +import org.checkerframework.checker.nullness.qual.Nullable; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.block.BlockType; +import org.spongepowered.api.tag.Tag; + +import java.util.List; +import java.util.Optional; +import java.util.Set; + +/** + * A tool rule that applied via {@link org.spongepowered.api.data.Keys#TOOL_RULES} to an {@link org.spongepowered.api.item.inventory.ItemStack} + * determines what {@link BlockType block types} can be mined at what speed and whether they drop items. + */ +public interface ToolRule { + + + static ToolRule minesAndDrops(List blocks, double speed) { + return ToolRule.factory().minesAndDrops(blocks, speed); + } + + static ToolRule minesAndDrops(Tag blockTypeTag, double speed) { + return ToolRule.factory().minesAndDrops(blockTypeTag, speed); + } + + static ToolRule deniesDrops(List blocks) { + return ToolRule.factory().deniesDrops(blocks); + } + + static ToolRule deniesDrops(Tag blockTypeTag) { + return ToolRule.factory().deniesDrops(blockTypeTag); + } + + static ToolRule overrideSpeed(List blocks, double speed) { + return ToolRule.factory().overrideSpeed(blocks, speed); + } + + static ToolRule overrideSpeed(Tag blockTypeTag, double speed) { + return ToolRule.factory().overrideSpeed(blockTypeTag, speed); + } + + static ToolRule forBlocks(List blocks, @Nullable Double speed, @Nullable Boolean drops) { + return ToolRule.factory().forBlocks(blocks, speed, drops); + } + + static ToolRule forTag(Tag blockTypeTag, @Nullable Double speed, @Nullable Boolean drops) { + return ToolRule.factory().forTag(blockTypeTag, speed, drops); + } + + /** + * Returns the {@link BlockType block types} this rule applies to. + * + * @return the affected blocks + */ + Set blocks(); + + /** + * Returns the speed override. + *

If present overrides the default {@link org.spongepowered.api.data.Keys#EFFICIENCY mining speed}.

+ * + * @return the speed override + */ + Optional speed(); + + /** + * Returns the drops override. + *

If present determines whether a block mined with this rule drops its item

+ * + * @return the drops override + */ + Optional drops(); + + private static Factory factory() { + return Sponge.game().factoryProvider().provide(Factory.class); + } + + interface Factory { + + /** + * Generates a rule for mining and dropping given blocks at given speed. + * + * @param blocks the blocks + * @param speed the speed + * @return the generated rule + */ + ToolRule minesAndDrops(List blocks, double speed); + + /** + * Generates a rule for mining and dropping given block type tag at given speed. + * + * @param blockTypeTag the block type tag + * @param speed the speed + * + * @return the generated rule + */ + ToolRule minesAndDrops(Tag blockTypeTag, double speed); + + /** + * Generates a rule for preventing drops for given blocks. + * + * @param blocks the blocks + * + * @return the generated rule + */ + ToolRule deniesDrops(List blocks); + + /** + * Generates a rule for preventing drops for given block type tag. + * + * @param blockTypeTag the block type tag + * + * @return the generated rule + */ + ToolRule deniesDrops(Tag blockTypeTag); + + /** + * Generates a rule overriding mining speed drops for given blocks. + * + * @param blocks the blocks + * @param speed the speed + * + * @return the generated rule + */ + ToolRule overrideSpeed(List blocks, double speed); + + /** + * Generates a rule overriding mining speed drops for given block type tag. + * + * @param blockTypeTag the block type tag + * @param speed the speed + * + * @return the generated rule + */ + ToolRule overrideSpeed(Tag blockTypeTag, double speed); + + /** + * Generates a rule for blocks. Optionally overriding speed and/or drops. + * + * @param blocks the blocks + * @param speed the optional override speed + * @param drops the optional drops override + * + * @return the generated rule + */ + ToolRule forBlocks(List blocks, @Nullable Double speed, @Nullable Boolean drops); + + /** + * Generates a rule for a block type tag. Optionally overriding speed and/or drops. + * + * @param blockTypeTag the block type tag + * @param speed the optional override speed + * @param drops the optional drops override + * + * @return the generated rule + */ + ToolRule forTag(Tag blockTypeTag, @Nullable Double speed, @Nullable Boolean drops); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java new file mode 100644 index 00000000000..504d2ecacc0 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java @@ -0,0 +1,32 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.type; + +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(TrialSpawnerStates.class) +public interface TrialSpawnerState extends Comparable, StringRepresentable { + +} diff --git a/src/main/java/org/spongepowered/api/data/type/TrialSpawnerStates.java b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerStates.java new file mode 100644 index 00000000000..7724165f315 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerStates.java @@ -0,0 +1,56 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.type; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.registry.DefaultedRegistryReference; +import org.spongepowered.api.registry.Registry; +import org.spongepowered.api.registry.RegistryKey; +import org.spongepowered.api.registry.RegistryTypes; + +public final class TrialSpawnerStates { + + public static final DefaultedRegistryReference INACTIVE = TrialSpawnerStates.key(ResourceKey.sponge("INACTIVE")); + + public static final DefaultedRegistryReference WAITING_FOR_PLAYERS = TrialSpawnerStates.key(ResourceKey.sponge("WAITING_FOR_PLAYERS")); + + public static final DefaultedRegistryReference ACTIVE = TrialSpawnerStates.key(ResourceKey.sponge("ACTIVE")); + + public static final DefaultedRegistryReference WAITING_FOR_REWARD_EJECTION = TrialSpawnerStates.key(ResourceKey.sponge("WAITING_FOR_REWARD_EJECTION")); + + public static final DefaultedRegistryReference EJECTING_REWARD = TrialSpawnerStates.key(ResourceKey.sponge("EJECTING_REWARD")); + + public static final DefaultedRegistryReference COOLDOWN = TrialSpawnerStates.key(ResourceKey.sponge("COOLDOWN")); + + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.TRIAL_SPAWNER_STATE); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.TRIAL_SPAWNER_STATE, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/VaultState.java b/src/main/java/org/spongepowered/api/data/type/VaultState.java new file mode 100644 index 00000000000..b80f20a53df --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/VaultState.java @@ -0,0 +1,32 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.type; + +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(VaultStates.class) +public interface VaultState extends Comparable, StringRepresentable { + +} diff --git a/src/main/java/org/spongepowered/api/map/decoration/MapDecorationBannerType.java b/src/main/java/org/spongepowered/api/data/type/VaultStates.java similarity index 51% rename from src/main/java/org/spongepowered/api/map/decoration/MapDecorationBannerType.java rename to src/main/java/org/spongepowered/api/data/type/VaultStates.java index 019c6e50bc5..e017753800d 100644 --- a/src/main/java/org/spongepowered/api/map/decoration/MapDecorationBannerType.java +++ b/src/main/java/org/spongepowered/api/data/type/VaultStates.java @@ -22,22 +22,28 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.map.decoration; +package org.spongepowered.api.data.type; -import org.spongepowered.api.data.type.DyeColor; +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.registry.DefaultedRegistryReference; +import org.spongepowered.api.registry.Registry; +import org.spongepowered.api.registry.RegistryKey; +import org.spongepowered.api.registry.RegistryTypes; + +public final class VaultStates { + + public static final DefaultedRegistryReference INACTIVE = VaultStates.key(ResourceKey.sponge("inactive")); + public static final DefaultedRegistryReference ACTIVE = VaultStates.key(ResourceKey.sponge("active")); + public static final DefaultedRegistryReference UNLOCKING = VaultStates.key(ResourceKey.sponge("unlocking")); + public static final DefaultedRegistryReference EJECTING = VaultStates.key(ResourceKey.sponge("ejecting")); + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.VAULT_STATE); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.VAULT_STATE, location).asDefaultedReference(Sponge::game); + } -/** - * An extension of {@link MapDecorationType} that represents a banner, and provides - * the {@link org.spongepowered.api.data.type.DyeColor} of the banner it - * represents. - *

- * Not all {@link MapDecorationType MapDecorationTypes} are {@link MapDecorationBannerType}. - */ -public interface MapDecorationBannerType extends MapDecorationType { - /** - * Gets the corresponding {@link DyeColor} that this banner decoration type is. - * - * @return The {@link DyeColor} that this banner decoration type is. - */ - DyeColor bannerColor(); } diff --git a/src/main/java/org/spongepowered/api/data/type/WallConnectionState.java b/src/main/java/org/spongepowered/api/data/type/WallConnectionState.java index a8ed41917bb..2ea5feec8e5 100644 --- a/src/main/java/org/spongepowered/api/data/type/WallConnectionState.java +++ b/src/main/java/org/spongepowered/api/data/type/WallConnectionState.java @@ -31,6 +31,6 @@ * Represents the type of wall BlockStates */ @CatalogedBy(WallConnectionStates.class) -public interface WallConnectionState extends DefaultedRegistryValue, Comparable { +public interface WallConnectionState extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java b/src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java index 3f18c8e87b8..dc35ec8fb77 100644 --- a/src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java +++ b/src/main/java/org/spongepowered/api/data/type/WireAttachmentType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(WireAttachmentTypes.class) -public interface WireAttachmentType extends DefaultedRegistryValue, Comparable { +public interface WireAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/effect/Viewer.java b/src/main/java/org/spongepowered/api/effect/Viewer.java index b79025d0912..d0e23ae2a98 100644 --- a/src/main/java/org/spongepowered/api/effect/Viewer.java +++ b/src/main/java/org/spongepowered/api/effect/Viewer.java @@ -161,4 +161,52 @@ default void resetBlockChange(final Vector3i position) { */ void resetBlockChange(int x, int y, int z); + /** + * Sends a client-only block breaking progress. + * + * @param position The position + * @param progress The breaking progress from 0 to 1 + */ + default void sendBlockProgress(final Vector3i position, final double progress) { + Objects.requireNonNull(position, "position"); + this.sendBlockProgress(position.x(), position.y(), position.z(), progress); + } + + /** + * Sends a client-only block breaking progress. + * + * @param x The x position + * @param y The y position + * @param z The z position + * @param progress The breaking progress from 0 to 1 + */ + void sendBlockProgress(int x, int y, int z, double progress); + + /** + * Resets the client's view of the provided position to actual + * breaking progress. + * + *

This is useful for resetting what the client sees + * after sending a {@link #sendBlockProgress block progress}.

+ * + * @param position The position + */ + default void resetBlockProgress(final Vector3i position) { + Objects.requireNonNull(position, "position"); + this.resetBlockProgress(position.x(), position.y(), position.z()); + } + + /** + * Resets the client's view of the provided position to actual + * breaking progress. + * + *

This is useful for resetting what the client sees + * after sending a {@link #sendBlockProgress block progress}.

+ * + * @param x The x position + * @param y The y position + * @param z The z position + */ + void resetBlockProgress(int x, int y, int z); + } diff --git a/src/main/java/org/spongepowered/api/effect/particle/ParticleOptions.java b/src/main/java/org/spongepowered/api/effect/particle/ParticleOptions.java index f7debab78e6..36f8859c20b 100644 --- a/src/main/java/org/spongepowered/api/effect/particle/ParticleOptions.java +++ b/src/main/java/org/spongepowered/api/effect/particle/ParticleOptions.java @@ -68,7 +68,6 @@ public final class ParticleOptions { * {@link ParticleType}s this option is applicable to are: * *
    - *
  • {@link ParticleTypes#AMBIENT_ENTITY_EFFECT}
  • *
  • {@link ParticleTypes#ENTITY_EFFECT}
  • *
  • {@link ParticleTypes#DUST}
  • *
diff --git a/src/main/java/org/spongepowered/api/effect/particle/ParticleTypes.java b/src/main/java/org/spongepowered/api/effect/particle/ParticleTypes.java index 369074ea395..06fa3d1930c 100644 --- a/src/main/java/org/spongepowered/api/effect/particle/ParticleTypes.java +++ b/src/main/java/org/spongepowered/api/effect/particle/ParticleTypes.java @@ -40,8 +40,6 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class ParticleTypes { - public static final DefaultedRegistryReference AMBIENT_ENTITY_EFFECT = ParticleTypes.key(ResourceKey.minecraft("ambient_entity_effect")); - public static final DefaultedRegistryReference ANGRY_VILLAGER = ParticleTypes.key(ResourceKey.minecraft("angry_villager")); public static final DefaultedRegistryReference ASH = ParticleTypes.key(ResourceKey.minecraft("ash")); @@ -94,6 +92,8 @@ public final class ParticleTypes { public static final DefaultedRegistryReference DUST_COLOR_TRANSITION = ParticleTypes.key(ResourceKey.minecraft("dust_color_transition")); + public static final DefaultedRegistryReference DUST_PILLAR = ParticleTypes.key(ResourceKey.minecraft("dust_pillar")); + public static final DefaultedRegistryReference DUST_PLUME = ParticleTypes.key(ResourceKey.minecraft("dust_plume")); public static final DefaultedRegistryReference EFFECT = ParticleTypes.key(ResourceKey.minecraft("effect")); @@ -148,18 +148,22 @@ public final class ParticleTypes { public static final DefaultedRegistryReference GUST = ParticleTypes.key(ResourceKey.minecraft("gust")); - public static final DefaultedRegistryReference GUST_DUST = ParticleTypes.key(ResourceKey.minecraft("gust_dust")); + public static final DefaultedRegistryReference GUST_EMITTER_LARGE = ParticleTypes.key(ResourceKey.minecraft("gust_emitter_large")); - public static final DefaultedRegistryReference GUST_EMITTER = ParticleTypes.key(ResourceKey.minecraft("gust_emitter")); + public static final DefaultedRegistryReference GUST_EMITTER_SMALL = ParticleTypes.key(ResourceKey.minecraft("gust_emitter_small")); public static final DefaultedRegistryReference HAPPY_VILLAGER = ParticleTypes.key(ResourceKey.minecraft("happy_villager")); public static final DefaultedRegistryReference HEART = ParticleTypes.key(ResourceKey.minecraft("heart")); + public static final DefaultedRegistryReference INFESTED = ParticleTypes.key(ResourceKey.minecraft("infested")); + public static final DefaultedRegistryReference INSTANT_EFFECT = ParticleTypes.key(ResourceKey.minecraft("instant_effect")); public static final DefaultedRegistryReference ITEM = ParticleTypes.key(ResourceKey.minecraft("item")); + public static final DefaultedRegistryReference ITEM_COBWEB = ParticleTypes.key(ResourceKey.minecraft("item_cobweb")); + public static final DefaultedRegistryReference ITEM_SLIME = ParticleTypes.key(ResourceKey.minecraft("item_slime")); public static final DefaultedRegistryReference ITEM_SNOWBALL = ParticleTypes.key(ResourceKey.minecraft("item_snowball")); @@ -180,10 +184,14 @@ public final class ParticleTypes { public static final DefaultedRegistryReference NOTE = ParticleTypes.key(ResourceKey.minecraft("note")); + public static final DefaultedRegistryReference OMINOUS_SPAWNING = ParticleTypes.key(ResourceKey.minecraft("ominous_spawning")); + public static final DefaultedRegistryReference POOF = ParticleTypes.key(ResourceKey.minecraft("poof")); public static final DefaultedRegistryReference PORTAL = ParticleTypes.key(ResourceKey.minecraft("portal")); + public static final DefaultedRegistryReference RAID_OMEN = ParticleTypes.key(ResourceKey.minecraft("raid_omen")); + public static final DefaultedRegistryReference RAIN = ParticleTypes.key(ResourceKey.minecraft("rain")); public static final DefaultedRegistryReference REVERSE_PORTAL = ParticleTypes.key(ResourceKey.minecraft("reverse_portal")); @@ -200,6 +208,8 @@ public final class ParticleTypes { public static final DefaultedRegistryReference SMALL_FLAME = ParticleTypes.key(ResourceKey.minecraft("small_flame")); + public static final DefaultedRegistryReference SMALL_GUST = ParticleTypes.key(ResourceKey.minecraft("small_gust")); + public static final DefaultedRegistryReference SMOKE = ParticleTypes.key(ResourceKey.minecraft("smoke")); public static final DefaultedRegistryReference SNEEZE = ParticleTypes.key(ResourceKey.minecraft("sneeze")); @@ -224,10 +234,16 @@ public final class ParticleTypes { public static final DefaultedRegistryReference TOTEM_OF_UNDYING = ParticleTypes.key(ResourceKey.minecraft("totem_of_undying")); + public static final DefaultedRegistryReference TRIAL_OMEN = ParticleTypes.key(ResourceKey.minecraft("trial_omen")); + public static final DefaultedRegistryReference TRIAL_SPAWNER_DETECTION = ParticleTypes.key(ResourceKey.minecraft("trial_spawner_detection")); + public static final DefaultedRegistryReference TRIAL_SPAWNER_DETECTION_OMINOUS = ParticleTypes.key(ResourceKey.minecraft("trial_spawner_detection_ominous")); + public static final DefaultedRegistryReference UNDERWATER = ParticleTypes.key(ResourceKey.minecraft("underwater")); + public static final DefaultedRegistryReference VAULT_CONNECTION = ParticleTypes.key(ResourceKey.minecraft("vault_connection")); + public static final DefaultedRegistryReference VIBRATION = ParticleTypes.key(ResourceKey.minecraft("vibration")); public static final DefaultedRegistryReference WARPED_SPORE = ParticleTypes.key(ResourceKey.minecraft("warped_spore")); diff --git a/src/main/java/org/spongepowered/api/effect/potion/PotionEffectTypes.java b/src/main/java/org/spongepowered/api/effect/potion/PotionEffectTypes.java index d21bc70ae0d..a882041b5e5 100644 --- a/src/main/java/org/spongepowered/api/effect/potion/PotionEffectTypes.java +++ b/src/main/java/org/spongepowered/api/effect/potion/PotionEffectTypes.java @@ -64,6 +64,8 @@ public final class PotionEffectTypes { public static final DefaultedRegistryReference HUNGER = PotionEffectTypes.key(ResourceKey.minecraft("hunger")); + public static final DefaultedRegistryReference INFESTED = PotionEffectTypes.key(ResourceKey.minecraft("infested")); + public static final DefaultedRegistryReference INSTANT_DAMAGE = PotionEffectTypes.key(ResourceKey.minecraft("instant_damage")); public static final DefaultedRegistryReference INSTANT_HEALTH = PotionEffectTypes.key(ResourceKey.minecraft("instant_health")); @@ -82,8 +84,12 @@ public final class PotionEffectTypes { public static final DefaultedRegistryReference NIGHT_VISION = PotionEffectTypes.key(ResourceKey.minecraft("night_vision")); + public static final DefaultedRegistryReference OOZING = PotionEffectTypes.key(ResourceKey.minecraft("oozing")); + public static final DefaultedRegistryReference POISON = PotionEffectTypes.key(ResourceKey.minecraft("poison")); + public static final DefaultedRegistryReference RAID_OMEN = PotionEffectTypes.key(ResourceKey.minecraft("raid_omen")); + public static final DefaultedRegistryReference REGENERATION = PotionEffectTypes.key(ResourceKey.minecraft("regeneration")); public static final DefaultedRegistryReference RESISTANCE = PotionEffectTypes.key(ResourceKey.minecraft("resistance")); @@ -98,12 +104,18 @@ public final class PotionEffectTypes { public static final DefaultedRegistryReference STRENGTH = PotionEffectTypes.key(ResourceKey.minecraft("strength")); + public static final DefaultedRegistryReference TRIAL_OMEN = PotionEffectTypes.key(ResourceKey.minecraft("trial_omen")); + public static final DefaultedRegistryReference UNLUCK = PotionEffectTypes.key(ResourceKey.minecraft("unluck")); public static final DefaultedRegistryReference WATER_BREATHING = PotionEffectTypes.key(ResourceKey.minecraft("water_breathing")); public static final DefaultedRegistryReference WEAKNESS = PotionEffectTypes.key(ResourceKey.minecraft("weakness")); + public static final DefaultedRegistryReference WEAVING = PotionEffectTypes.key(ResourceKey.minecraft("weaving")); + + public static final DefaultedRegistryReference WIND_CHARGED = PotionEffectTypes.key(ResourceKey.minecraft("wind_charged")); + public static final DefaultedRegistryReference WITHER = PotionEffectTypes.key(ResourceKey.minecraft("wither")); private PotionEffectTypes() { diff --git a/src/main/java/org/spongepowered/api/effect/sound/SoundTypes.java b/src/main/java/org/spongepowered/api/effect/sound/SoundTypes.java index 70a373aec43..7c21e16ec20 100644 --- a/src/main/java/org/spongepowered/api/effect/sound/SoundTypes.java +++ b/src/main/java/org/spongepowered/api/effect/sound/SoundTypes.java @@ -422,6 +422,16 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_CHORUS_FLOWER_GROW = SoundTypes.key(ResourceKey.minecraft("block.chorus_flower.grow")); + public static final DefaultedRegistryReference BLOCK_COBWEB_BREAK = SoundTypes.key(ResourceKey.minecraft("block.cobweb.break")); + + public static final DefaultedRegistryReference BLOCK_COBWEB_FALL = SoundTypes.key(ResourceKey.minecraft("block.cobweb.fall")); + + public static final DefaultedRegistryReference BLOCK_COBWEB_HIT = SoundTypes.key(ResourceKey.minecraft("block.cobweb.hit")); + + public static final DefaultedRegistryReference BLOCK_COBWEB_PLACE = SoundTypes.key(ResourceKey.minecraft("block.cobweb.place")); + + public static final DefaultedRegistryReference BLOCK_COBWEB_STEP = SoundTypes.key(ResourceKey.minecraft("block.cobweb.step")); + public static final DefaultedRegistryReference BLOCK_COMPARATOR_CLICK = SoundTypes.key(ResourceKey.minecraft("block.comparator.click")); public static final DefaultedRegistryReference BLOCK_COMPOSTER_EMPTY = SoundTypes.key(ResourceKey.minecraft("block.composter.empty")); @@ -692,6 +702,16 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_HANGING_SIGN_WAXED_INTERACT_FAIL = SoundTypes.key(ResourceKey.minecraft("block.hanging_sign.waxed_interact_fail")); + public static final DefaultedRegistryReference BLOCK_HEAVY_CORE_BREAK = SoundTypes.key(ResourceKey.minecraft("block.heavy_core.break")); + + public static final DefaultedRegistryReference BLOCK_HEAVY_CORE_FALL = SoundTypes.key(ResourceKey.minecraft("block.heavy_core.fall")); + + public static final DefaultedRegistryReference BLOCK_HEAVY_CORE_HIT = SoundTypes.key(ResourceKey.minecraft("block.heavy_core.hit")); + + public static final DefaultedRegistryReference BLOCK_HEAVY_CORE_PLACE = SoundTypes.key(ResourceKey.minecraft("block.heavy_core.place")); + + public static final DefaultedRegistryReference BLOCK_HEAVY_CORE_STEP = SoundTypes.key(ResourceKey.minecraft("block.heavy_core.step")); + public static final DefaultedRegistryReference BLOCK_HONEY_BLOCK_BREAK = SoundTypes.key(ResourceKey.minecraft("block.honey_block.break")); public static final DefaultedRegistryReference BLOCK_HONEY_BLOCK_FALL = SoundTypes.key(ResourceKey.minecraft("block.honey_block.fall")); @@ -1340,10 +1360,16 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_SWEET_BERRY_BUSH_PLACE = SoundTypes.key(ResourceKey.minecraft("block.sweet_berry_bush.place")); + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_ABOUT_TO_SPAWN_ITEM = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.about_to_spawn_item")); + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_AMBIENT = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.ambient")); + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_AMBIENT_CHARGED = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.ambient_charged")); + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_BREAK = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.break")); + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_CHARGE_ACTIVATE = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.charge_activate")); + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_CLOSE_SHUTTER = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.close_shutter")); public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_DETECT_PLAYER = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.detect_player")); @@ -1358,6 +1384,10 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_PLACE = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.place")); + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_SPAWN_ITEM = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.spawn_item")); + + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_SPAWN_ITEM_BEGIN = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.spawn_item_begin")); + public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_SPAWN_MOB = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.spawn_mob")); public static final DefaultedRegistryReference BLOCK_TRIAL_SPAWNER_STEP = SoundTypes.key(ResourceKey.minecraft("block.trial_spawner.step")); @@ -1390,6 +1420,32 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_TUFF_BRICKS_STEP = SoundTypes.key(ResourceKey.minecraft("block.tuff_bricks.step")); + public static final DefaultedRegistryReference BLOCK_VAULT_ACTIVATE = SoundTypes.key(ResourceKey.minecraft("block.vault.activate")); + + public static final DefaultedRegistryReference BLOCK_VAULT_AMBIENT = SoundTypes.key(ResourceKey.minecraft("block.vault.ambient")); + + public static final DefaultedRegistryReference BLOCK_VAULT_BREAK = SoundTypes.key(ResourceKey.minecraft("block.vault.break")); + + public static final DefaultedRegistryReference BLOCK_VAULT_CLOSE_SHUTTER = SoundTypes.key(ResourceKey.minecraft("block.vault.close_shutter")); + + public static final DefaultedRegistryReference BLOCK_VAULT_DEACTIVATE = SoundTypes.key(ResourceKey.minecraft("block.vault.deactivate")); + + public static final DefaultedRegistryReference BLOCK_VAULT_EJECT_ITEM = SoundTypes.key(ResourceKey.minecraft("block.vault.eject_item")); + + public static final DefaultedRegistryReference BLOCK_VAULT_FALL = SoundTypes.key(ResourceKey.minecraft("block.vault.fall")); + + public static final DefaultedRegistryReference BLOCK_VAULT_HIT = SoundTypes.key(ResourceKey.minecraft("block.vault.hit")); + + public static final DefaultedRegistryReference BLOCK_VAULT_INSERT_ITEM = SoundTypes.key(ResourceKey.minecraft("block.vault.insert_item")); + + public static final DefaultedRegistryReference BLOCK_VAULT_INSERT_ITEM_FAIL = SoundTypes.key(ResourceKey.minecraft("block.vault.insert_item_fail")); + + public static final DefaultedRegistryReference BLOCK_VAULT_OPEN_SHUTTER = SoundTypes.key(ResourceKey.minecraft("block.vault.open_shutter")); + + public static final DefaultedRegistryReference BLOCK_VAULT_PLACE = SoundTypes.key(ResourceKey.minecraft("block.vault.place")); + + public static final DefaultedRegistryReference BLOCK_VAULT_STEP = SoundTypes.key(ResourceKey.minecraft("block.vault.step")); + public static final DefaultedRegistryReference BLOCK_VINE_BREAK = SoundTypes.key(ResourceKey.minecraft("block.vine.break")); public static final DefaultedRegistryReference BLOCK_VINE_FALL = SoundTypes.key(ResourceKey.minecraft("block.vine.fall")); @@ -1434,6 +1490,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_WET_SPONGE_BREAK = SoundTypes.key(ResourceKey.minecraft("block.wet_sponge.break")); + public static final DefaultedRegistryReference BLOCK_WET_SPONGE_DRIES = SoundTypes.key(ResourceKey.minecraft("block.wet_sponge.dries")); + public static final DefaultedRegistryReference BLOCK_WET_SPONGE_FALL = SoundTypes.key(ResourceKey.minecraft("block.wet_sponge.fall")); public static final DefaultedRegistryReference BLOCK_WET_SPONGE_HIT = SoundTypes.key(ResourceKey.minecraft("block.wet_sponge.hit")); @@ -1494,6 +1552,32 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_ALLAY_ITEM_THROWN = SoundTypes.key(ResourceKey.minecraft("entity.allay.item_thrown")); + public static final DefaultedRegistryReference ENTITY_ARMADILLO_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.ambient")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_BRUSH = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.brush")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.death")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_EAT = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.eat")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_HURT = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.hurt")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_HURT_REDUCED = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.hurt_reduced")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_LAND = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.land")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_PEEK = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.peek")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_ROLL = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.roll")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_SCUTE_DROP = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.scute_drop")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_STEP = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.step")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_UNROLL_FINISH = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.unroll_finish")); + + public static final DefaultedRegistryReference ENTITY_ARMADILLO_UNROLL_START = SoundTypes.key(ResourceKey.minecraft("entity.armadillo.unroll_start")); + public static final DefaultedRegistryReference ENTITY_ARMOR_STAND_BREAK = SoundTypes.key(ResourceKey.minecraft("entity.armor_stand.break")); public static final DefaultedRegistryReference ENTITY_ARMOR_STAND_FALL = SoundTypes.key(ResourceKey.minecraft("entity.armor_stand.fall")); @@ -1558,8 +1642,22 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_BOAT_PADDLE_WATER = SoundTypes.key(ResourceKey.minecraft("entity.boat.paddle_water")); + public static final DefaultedRegistryReference ENTITY_BOGGED_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.bogged.ambient")); + + public static final DefaultedRegistryReference ENTITY_BOGGED_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.bogged.death")); + + public static final DefaultedRegistryReference ENTITY_BOGGED_HURT = SoundTypes.key(ResourceKey.minecraft("entity.bogged.hurt")); + + public static final DefaultedRegistryReference ENTITY_BOGGED_SHEAR = SoundTypes.key(ResourceKey.minecraft("entity.bogged.shear")); + + public static final DefaultedRegistryReference ENTITY_BOGGED_STEP = SoundTypes.key(ResourceKey.minecraft("entity.bogged.step")); + + public static final DefaultedRegistryReference ENTITY_BREEZE_CHARGE = SoundTypes.key(ResourceKey.minecraft("entity.breeze.charge")); + public static final DefaultedRegistryReference ENTITY_BREEZE_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.breeze.death")); + public static final DefaultedRegistryReference ENTITY_BREEZE_DEFLECT = SoundTypes.key(ResourceKey.minecraft("entity.breeze.deflect")); + public static final DefaultedRegistryReference ENTITY_BREEZE_HURT = SoundTypes.key(ResourceKey.minecraft("entity.breeze.hurt")); public static final DefaultedRegistryReference ENTITY_BREEZE_IDLE_AIR = SoundTypes.key(ResourceKey.minecraft("entity.breeze.idle_air")); @@ -1576,6 +1674,10 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_BREEZE_SLIDE = SoundTypes.key(ResourceKey.minecraft("entity.breeze.slide")); + public static final DefaultedRegistryReference ENTITY_BREEZE_WHIRL = SoundTypes.key(ResourceKey.minecraft("entity.breeze.whirl")); + + public static final DefaultedRegistryReference ENTITY_BREEZE_WIND_BURST = SoundTypes.key(ResourceKey.minecraft("entity.breeze.wind_burst")); + public static final DefaultedRegistryReference ENTITY_CAMEL_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.camel.ambient")); public static final DefaultedRegistryReference ENTITY_CAMEL_DASH = SoundTypes.key(ResourceKey.minecraft("entity.camel.dash")); @@ -1682,6 +1784,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_DONKEY_HURT = SoundTypes.key(ResourceKey.minecraft("entity.donkey.hurt")); + public static final DefaultedRegistryReference ENTITY_DONKEY_JUMP = SoundTypes.key(ResourceKey.minecraft("entity.donkey.jump")); + public static final DefaultedRegistryReference ENTITY_DRAGON_FIREBALL_EXPLODE = SoundTypes.key(ResourceKey.minecraft("entity.dragon_fireball.explode")); public static final DefaultedRegistryReference ENTITY_DROWNED_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.drowned.ambient")); @@ -1864,8 +1968,6 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_GENERIC_SWIM = SoundTypes.key(ResourceKey.minecraft("entity.generic.swim")); - public static final DefaultedRegistryReference ENTITY_GENERIC_WIND_BURST = SoundTypes.key(ResourceKey.minecraft("entity.generic.wind_burst")); - public static final DefaultedRegistryReference ENTITY_GHAST_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.ghast.ambient")); public static final DefaultedRegistryReference ENTITY_GHAST_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.ghast.death")); @@ -2124,6 +2226,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_MULE_HURT = SoundTypes.key(ResourceKey.minecraft("entity.mule.hurt")); + public static final DefaultedRegistryReference ENTITY_MULE_JUMP = SoundTypes.key(ResourceKey.minecraft("entity.mule.jump")); + public static final DefaultedRegistryReference ENTITY_OCELOT_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.ocelot.ambient")); public static final DefaultedRegistryReference ENTITY_OCELOT_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.ocelot.death")); @@ -2168,6 +2272,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_BLAZE = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.blaze")); + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_BOGGED = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.bogged")); + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_BREEZE = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.breeze")); public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_CREEPER = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.creeper")); @@ -2724,6 +2830,10 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_WARDEN_TENDRIL_CLICKS = SoundTypes.key(ResourceKey.minecraft("entity.warden.tendril_clicks")); + public static final DefaultedRegistryReference ENTITY_WIND_CHARGE_THROW = SoundTypes.key(ResourceKey.minecraft("entity.wind_charge.throw")); + + public static final DefaultedRegistryReference ENTITY_WIND_CHARGE_WIND_BURST = SoundTypes.key(ResourceKey.minecraft("entity.wind_charge.wind_burst")); + public static final DefaultedRegistryReference ENTITY_WITCH_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.witch.ambient")); public static final DefaultedRegistryReference ENTITY_WITCH_CELEBRATE = SoundTypes.key(ResourceKey.minecraft("entity.witch.celebrate")); @@ -2832,6 +2942,12 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_ZOMBIFIED_PIGLIN_HURT = SoundTypes.key(ResourceKey.minecraft("entity.zombified_piglin.hurt")); + public static final DefaultedRegistryReference EVENT_MOB_EFFECT_BAD_OMEN = SoundTypes.key(ResourceKey.minecraft("event.mob_effect.bad_omen")); + + public static final DefaultedRegistryReference EVENT_MOB_EFFECT_RAID_OMEN = SoundTypes.key(ResourceKey.minecraft("event.mob_effect.raid_omen")); + + public static final DefaultedRegistryReference EVENT_MOB_EFFECT_TRIAL_OMEN = SoundTypes.key(ResourceKey.minecraft("event.mob_effect.trial_omen")); + public static final DefaultedRegistryReference EVENT_RAID_HORN = SoundTypes.key(ResourceKey.minecraft("event.raid.horn")); public static final DefaultedRegistryReference INTENTIONALLY_EMPTY = SoundTypes.key(ResourceKey.minecraft("intentionally_empty")); @@ -2854,6 +2970,10 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_TURTLE = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_turtle")); + public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_WOLF = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_wolf")); + + public static final DefaultedRegistryReference ITEM_ARMOR_UNEQUIP_WOLF = SoundTypes.key(ResourceKey.minecraft("item.armor.unequip_wolf")); + public static final DefaultedRegistryReference ITEM_AXE_SCRAPE = SoundTypes.key(ResourceKey.minecraft("item.axe.scrape")); public static final DefaultedRegistryReference ITEM_AXE_STRIP = SoundTypes.key(ResourceKey.minecraft("item.axe.strip")); @@ -2970,8 +3090,16 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_LODESTONE_COMPASS_LOCK = SoundTypes.key(ResourceKey.minecraft("item.lodestone_compass.lock")); + public static final DefaultedRegistryReference ITEM_MACE_SMASH_AIR = SoundTypes.key(ResourceKey.minecraft("item.mace.smash_air")); + + public static final DefaultedRegistryReference ITEM_MACE_SMASH_GROUND = SoundTypes.key(ResourceKey.minecraft("item.mace.smash_ground")); + + public static final DefaultedRegistryReference ITEM_MACE_SMASH_GROUND_HEAVY = SoundTypes.key(ResourceKey.minecraft("item.mace.smash_ground_heavy")); + public static final DefaultedRegistryReference ITEM_NETHER_WART_PLANT = SoundTypes.key(ResourceKey.minecraft("item.nether_wart.plant")); + public static final DefaultedRegistryReference ITEM_OMINOUS_BOTTLE_DISPOSE = SoundTypes.key(ResourceKey.minecraft("item.ominous_bottle.dispose")); + public static final DefaultedRegistryReference ITEM_SHIELD_BLOCK = SoundTypes.key(ResourceKey.minecraft("item.shield.block")); public static final DefaultedRegistryReference ITEM_SHIELD_BREAK = SoundTypes.key(ResourceKey.minecraft("item.shield.break")); @@ -3000,6 +3128,14 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_TRIDENT_THUNDER = SoundTypes.key(ResourceKey.minecraft("item.trident.thunder")); + public static final DefaultedRegistryReference ITEM_WOLF_ARMOR_BREAK = SoundTypes.key(ResourceKey.minecraft("item.wolf_armor.break")); + + public static final DefaultedRegistryReference ITEM_WOLF_ARMOR_CRACK = SoundTypes.key(ResourceKey.minecraft("item.wolf_armor.crack")); + + public static final DefaultedRegistryReference ITEM_WOLF_ARMOR_DAMAGE = SoundTypes.key(ResourceKey.minecraft("item.wolf_armor.damage")); + + public static final DefaultedRegistryReference ITEM_WOLF_ARMOR_REPAIR = SoundTypes.key(ResourceKey.minecraft("item.wolf_armor.repair")); + public static final DefaultedRegistryReference MUSIC_CREATIVE = SoundTypes.key(ResourceKey.minecraft("music.creative")); public static final DefaultedRegistryReference MUSIC_CREDITS = SoundTypes.key(ResourceKey.minecraft("music.credits")); diff --git a/src/main/java/org/spongepowered/api/entity/EntityTypes.java b/src/main/java/org/spongepowered/api/entity/EntityTypes.java index 6d140731174..636720a328d 100644 --- a/src/main/java/org/spongepowered/api/entity/EntityTypes.java +++ b/src/main/java/org/spongepowered/api/entity/EntityTypes.java @@ -38,6 +38,7 @@ import org.spongepowered.api.entity.living.Bat; import org.spongepowered.api.entity.living.Human; import org.spongepowered.api.entity.living.animal.Allay; +import org.spongepowered.api.entity.living.animal.Armadillo; import org.spongepowered.api.entity.living.animal.Axolotl; import org.spongepowered.api.entity.living.animal.Bee; import org.spongepowered.api.entity.living.animal.Cat; @@ -102,6 +103,7 @@ import org.spongepowered.api.entity.living.monster.raider.illager.Vindicator; import org.spongepowered.api.entity.living.monster.raider.illager.spellcaster.Evoker; import org.spongepowered.api.entity.living.monster.raider.illager.spellcaster.Illusioner; +import org.spongepowered.api.entity.living.monster.skeleton.Bogged; import org.spongepowered.api.entity.living.monster.skeleton.Skeleton; import org.spongepowered.api.entity.living.monster.skeleton.Stray; import org.spongepowered.api.entity.living.monster.skeleton.WitherSkeleton; @@ -127,7 +129,6 @@ import org.spongepowered.api.entity.projectile.Potion; import org.spongepowered.api.entity.projectile.ShulkerBullet; import org.spongepowered.api.entity.projectile.Snowball; -import org.spongepowered.api.entity.projectile.WindCharge; import org.spongepowered.api.entity.projectile.arrow.Arrow; import org.spongepowered.api.entity.projectile.arrow.SpectralArrow; import org.spongepowered.api.entity.projectile.arrow.Trident; @@ -136,6 +137,8 @@ import org.spongepowered.api.entity.projectile.explosive.fireball.DragonFireball; import org.spongepowered.api.entity.projectile.explosive.fireball.ExplosiveFireball; import org.spongepowered.api.entity.projectile.explosive.fireball.SmallFireball; +import org.spongepowered.api.entity.projectile.windcharge.BreezeWindCharge; +import org.spongepowered.api.entity.projectile.windcharge.WindCharge; import org.spongepowered.api.entity.vehicle.Boat; import org.spongepowered.api.entity.vehicle.ChestBoat; import org.spongepowered.api.entity.vehicle.minecart.CommandBlockMinecart; @@ -164,6 +167,8 @@ public final class EntityTypes { public static final DefaultedRegistryReference> AREA_EFFECT_CLOUD = EntityTypes.key(ResourceKey.minecraft("area_effect_cloud")); + public static final DefaultedRegistryReference> ARMADILLO = EntityTypes.key(ResourceKey.minecraft("armadillo")); + public static final DefaultedRegistryReference> ARMOR_STAND = EntityTypes.key(ResourceKey.minecraft("armor_stand")); public static final DefaultedRegistryReference> ARROW = EntityTypes.key(ResourceKey.minecraft("arrow")); @@ -180,8 +185,12 @@ public final class EntityTypes { public static final DefaultedRegistryReference> BOAT = EntityTypes.key(ResourceKey.minecraft("boat")); + public static final DefaultedRegistryReference> BOGGED = EntityTypes.key(ResourceKey.minecraft("bogged")); + public static final DefaultedRegistryReference> BREEZE = EntityTypes.key(ResourceKey.minecraft("breeze")); + public static final DefaultedRegistryReference> BREEZE_WIND_CHARGE = EntityTypes.key(ResourceKey.minecraft("breeze_wind_charge")); + public static final DefaultedRegistryReference> CAMEL = EntityTypes.key(ResourceKey.minecraft("camel")); public static final DefaultedRegistryReference> CAT = EntityTypes.key(ResourceKey.minecraft("cat")); @@ -302,6 +311,8 @@ public final class EntityTypes { public static final DefaultedRegistryReference> OCELOT = EntityTypes.key(ResourceKey.minecraft("ocelot")); + public static final DefaultedRegistryReference> OMINOUS_ITEM_SPAWNER = EntityTypes.key(ResourceKey.minecraft("ominous_item_spawner")); + public static final DefaultedRegistryReference> PAINTING = EntityTypes.key(ResourceKey.minecraft("painting")); public static final DefaultedRegistryReference> PANDA = EntityTypes.key(ResourceKey.minecraft("panda")); diff --git a/src/main/java/org/spongepowered/api/resourcepack/package-info.java b/src/main/java/org/spongepowered/api/entity/OminousItemSpawner.java similarity index 88% rename from src/main/java/org/spongepowered/api/resourcepack/package-info.java rename to src/main/java/org/spongepowered/api/entity/OminousItemSpawner.java index 36196d31e96..77d161317f5 100644 --- a/src/main/java/org/spongepowered/api/resourcepack/package-info.java +++ b/src/main/java/org/spongepowered/api/entity/OminousItemSpawner.java @@ -22,5 +22,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) -package org.spongepowered.api.resourcepack; +package org.spongepowered.api.entity; + +public interface OminousItemSpawner extends Entity { +} diff --git a/src/main/java/org/spongepowered/api/entity/attribute/type/AttributeTypes.java b/src/main/java/org/spongepowered/api/entity/attribute/type/AttributeTypes.java index 098b0a7c0f8..e8454b59175 100644 --- a/src/main/java/org/spongepowered/api/entity/attribute/type/AttributeTypes.java +++ b/src/main/java/org/spongepowered/api/entity/attribute/type/AttributeTypes.java @@ -50,10 +50,16 @@ public final class AttributeTypes { public static final DefaultedRegistryReference GENERIC_ATTACK_SPEED = AttributeTypes.key(ResourceKey.minecraft("generic.attack_speed")); + public static final DefaultedRegistryReference GENERIC_FALL_DAMAGE_MULTIPLIER = AttributeTypes.key(ResourceKey.minecraft("generic.fall_damage_multiplier")); + public static final DefaultedRegistryReference GENERIC_FLYING_SPEED = AttributeTypes.key(ResourceKey.minecraft("generic.flying_speed")); public static final DefaultedRegistryReference GENERIC_FOLLOW_RANGE = AttributeTypes.key(ResourceKey.minecraft("generic.follow_range")); + public static final DefaultedRegistryReference GENERIC_GRAVITY = AttributeTypes.key(ResourceKey.minecraft("generic.gravity")); + + public static final DefaultedRegistryReference GENERIC_JUMP_STRENGTH = AttributeTypes.key(ResourceKey.minecraft("generic.jump_strength")); + public static final DefaultedRegistryReference GENERIC_KNOCKBACK_RESISTANCE = AttributeTypes.key(ResourceKey.minecraft("generic.knockback_resistance")); public static final DefaultedRegistryReference GENERIC_LUCK = AttributeTypes.key(ResourceKey.minecraft("generic.luck")); @@ -64,7 +70,17 @@ public final class AttributeTypes { public static final DefaultedRegistryReference GENERIC_MOVEMENT_SPEED = AttributeTypes.key(ResourceKey.minecraft("generic.movement_speed")); - public static final DefaultedRegistryReference HORSE_JUMP_STRENGTH = AttributeTypes.key(ResourceKey.minecraft("horse.jump_strength")); + public static final DefaultedRegistryReference GENERIC_SAFE_FALL_DISTANCE = AttributeTypes.key(ResourceKey.minecraft("generic.safe_fall_distance")); + + public static final DefaultedRegistryReference GENERIC_SCALE = AttributeTypes.key(ResourceKey.minecraft("generic.scale")); + + public static final DefaultedRegistryReference GENERIC_STEP_HEIGHT = AttributeTypes.key(ResourceKey.minecraft("generic.step_height")); + + public static final DefaultedRegistryReference PLAYER_BLOCK_BREAK_SPEED = AttributeTypes.key(ResourceKey.minecraft("player.block_break_speed")); + + public static final DefaultedRegistryReference PLAYER_BLOCK_INTERACTION_RANGE = AttributeTypes.key(ResourceKey.minecraft("player.block_interaction_range")); + + public static final DefaultedRegistryReference PLAYER_ENTITY_INTERACTION_RANGE = AttributeTypes.key(ResourceKey.minecraft("player.entity_interaction_range")); public static final DefaultedRegistryReference ZOMBIE_SPAWN_REINFORCEMENTS = AttributeTypes.key(ResourceKey.minecraft("zombie.spawn_reinforcements")); diff --git a/src/main/java/org/spongepowered/api/entity/display/DisplayEntity.java b/src/main/java/org/spongepowered/api/entity/display/DisplayEntity.java index ea6e470db0a..0173171c715 100644 --- a/src/main/java/org/spongepowered/api/entity/display/DisplayEntity.java +++ b/src/main/java/org/spongepowered/api/entity/display/DisplayEntity.java @@ -64,6 +64,15 @@ default Ticks interpolationDelay() { return this.require(Keys.INTERPOLATION_DELAY); } + /** + * Returns the duration of the teleportation + * + * @return the duration of the teleportation + */ + default Ticks teleportDuration() { + return this.require(Keys.TELEPORT_DURATION); + } + default BillboardType billboardType() { return this.require(Keys.BILLBOARD_TYPE); } diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/Armadillo.java b/src/main/java/org/spongepowered/api/entity/living/animal/Armadillo.java new file mode 100644 index 00000000000..bbd41be17f5 --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/animal/Armadillo.java @@ -0,0 +1,28 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.entity.living.animal; + +public interface Armadillo extends Animal { +} diff --git a/src/main/java/org/spongepowered/api/entity/living/monster/skeleton/Bogged.java b/src/main/java/org/spongepowered/api/entity/living/monster/skeleton/Bogged.java new file mode 100644 index 00000000000..a91d6ae005b --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/monster/skeleton/Bogged.java @@ -0,0 +1,28 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.entity.living.monster.skeleton; + +public interface Bogged extends SkeletonLike { +} diff --git a/src/main/java/org/spongepowered/api/entity/living/player/server/ServerPlayer.java b/src/main/java/org/spongepowered/api/entity/living/player/server/ServerPlayer.java index 51cc40b83e1..e96c96bafa2 100644 --- a/src/main/java/org/spongepowered/api/entity/living/player/server/ServerPlayer.java +++ b/src/main/java/org/spongepowered/api/entity/living/player/server/ServerPlayer.java @@ -48,8 +48,7 @@ import org.spongepowered.api.item.inventory.Container; import org.spongepowered.api.item.inventory.ContainerType; import org.spongepowered.api.item.inventory.Inventory; -import org.spongepowered.api.network.ServerPlayerConnection; -import org.spongepowered.api.resourcepack.ResourcePack; +import org.spongepowered.api.network.ServerSideConnection; import org.spongepowered.api.scoreboard.Scoreboard; import org.spongepowered.api.service.permission.Subject; import org.spongepowered.api.statistic.Statistic; @@ -206,19 +205,12 @@ default SetValue.Mutable displayedSkinParts() { } /** - * Gets the appropriate {@link ServerPlayerConnection} linking this player to a + * Gets the appropriate {@link ServerSideConnection} linking this player to a * client. * * @return The connection */ - ServerPlayerConnection connection(); - - /** - * Sends a given {@link ResourcePack} to this player. - * - * @param pack The ResourcePack to send - */ - void sendResourcePack(ResourcePack pack); + ServerSideConnection connection(); /** * Gets this player's {@link TabList}. diff --git a/src/main/java/org/spongepowered/api/entity/projectile/windcharge/BreezeWindCharge.java b/src/main/java/org/spongepowered/api/entity/projectile/windcharge/BreezeWindCharge.java new file mode 100644 index 00000000000..6c15f74095f --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/projectile/windcharge/BreezeWindCharge.java @@ -0,0 +1,28 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.entity.projectile.windcharge; + +public interface BreezeWindCharge extends WindChargeLike { +} diff --git a/src/main/java/org/spongepowered/api/entity/projectile/WindCharge.java b/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindCharge.java similarity index 91% rename from src/main/java/org/spongepowered/api/entity/projectile/WindCharge.java rename to src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindCharge.java index cf7fe6c8d40..5b0d76c2d3e 100644 --- a/src/main/java/org/spongepowered/api/entity/projectile/WindCharge.java +++ b/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindCharge.java @@ -22,10 +22,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.entity.projectile; +package org.spongepowered.api.entity.projectile.windcharge; /** * Represents a WindCharge. */ -public interface WindCharge extends DamagingProjectile { +public interface WindCharge extends WindChargeLike { } diff --git a/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindChargeLike.java b/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindChargeLike.java new file mode 100644 index 00000000000..3ab50a37961 --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/projectile/windcharge/WindChargeLike.java @@ -0,0 +1,30 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.entity.projectile.windcharge; + +import org.spongepowered.api.entity.projectile.DamagingProjectile; + +public interface WindChargeLike extends DamagingProjectile { +} diff --git a/src/main/java/org/spongepowered/api/event/block/entity/BrewingEvent.java b/src/main/java/org/spongepowered/api/event/block/entity/BrewingEvent.java index 585dde367f9..c2fc31bdd05 100644 --- a/src/main/java/org/spongepowered/api/event/block/entity/BrewingEvent.java +++ b/src/main/java/org/spongepowered/api/event/block/entity/BrewingEvent.java @@ -25,13 +25,12 @@ package org.spongepowered.api.event.block.entity; import org.spongepowered.api.block.entity.carrier.BrewingStand; -import org.spongepowered.api.data.Transaction; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; +import org.spongepowered.api.event.item.inventory.AffectSlotEvent; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import java.util.List; /** * Fires during the brewing process where {@link ItemStack}s are brewed into different {@link ItemStack}s @@ -61,15 +60,7 @@ interface Start extends BrewingEvent, Cancellable {} /** * Fired when a fuel item is consumed to refill the fuel bar. */ - interface ConsumeFuel extends BrewingEvent, Cancellable { - - /** - * The consumed fuel transaction. - * - * @return The consumed fuel transaction. - */ - Transaction fuel(); - + interface ConsumeFuel extends BrewingEvent, AffectSlotEvent, Cancellable { } /** @@ -85,14 +76,6 @@ interface Interrupt extends BrewingEvent {} /** * Fires when brewing finished. */ - interface Finish extends BrewingEvent { - - /** - * Gets an immutable {@link List} of {@link ItemStackSnapshot}s that are the result - * of the brew. - * - * @return The brewed items - */ - List brewedItemStacks(); + interface Finish extends BrewingEvent, AffectSlotEvent { } } diff --git a/src/main/java/org/spongepowered/api/event/block/entity/CookingEvent.java b/src/main/java/org/spongepowered/api/event/block/entity/CookingEvent.java index c71c95e4faa..577b837d1c0 100644 --- a/src/main/java/org/spongepowered/api/event/block/entity/CookingEvent.java +++ b/src/main/java/org/spongepowered/api/event/block/entity/CookingEvent.java @@ -28,11 +28,10 @@ import org.spongepowered.api.block.entity.BlockEntity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.event.item.inventory.AffectItemStackEvent; +import org.spongepowered.api.event.item.inventory.AffectSlotEvent; import org.spongepowered.api.item.inventory.ItemStackSnapshot; import org.spongepowered.api.item.recipe.cooking.CookingRecipe; -import java.util.List; import java.util.Optional; /** @@ -74,7 +73,7 @@ interface Start extends CookingEvent, Cancellable {} * Fires whenever fuel is consumed to refill the current burn time. * Canceling this event prevents fuel from being consumed in a furnace In the current burn time to 0. */ - interface ConsumeFuel extends CookingEvent, AffectItemStackEvent {} + interface ConsumeFuel extends CookingEvent, AffectSlotEvent {} /** * The cooking timer ticking up or down. @@ -95,13 +94,6 @@ interface Tick extends CookingEvent, Cancellable { interface Interrupt extends CookingEvent { } - interface Finish extends CookingEvent { - /** - * Gets an immutable {@link List} of {@link ItemStackSnapshot}s that are the result of the cooking. - * Always exactly one item. - * - * @return The cooked items - */ - List cookedItems(); + interface Finish extends CookingEvent, AffectSlotEvent { } } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageTypes.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageTypes.java index f7898effcbe..548bfc3f833 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageTypes.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageTypes.java @@ -108,6 +108,8 @@ public final class DamageTypes { public static final DefaultedRegistryReference SONIC_BOOM = DamageTypes.key(ResourceKey.minecraft("sonic_boom")); + public static final DefaultedRegistryReference SPIT = DamageTypes.key(ResourceKey.minecraft("spit")); + public static final DefaultedRegistryReference STALAGMITE = DamageTypes.key(ResourceKey.minecraft("stalagmite")); public static final DefaultedRegistryReference STARVE = DamageTypes.key(ResourceKey.minecraft("starve")); diff --git a/src/main/java/org/spongepowered/api/event/entity/living/player/ResourcePackStatusEvent.java b/src/main/java/org/spongepowered/api/event/entity/living/player/ResourcePackStatusEvent.java index 37c3723d93d..5502c27384d 100644 --- a/src/main/java/org/spongepowered/api/event/entity/living/player/ResourcePackStatusEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/living/player/ResourcePackStatusEvent.java @@ -24,35 +24,53 @@ */ package org.spongepowered.api.event.entity.living.player; -import org.checkerframework.checker.nullness.qual.Nullable; +import net.kyori.adventure.resource.ResourcePackInfo; +import net.kyori.adventure.resource.ResourcePackStatus; import org.spongepowered.api.Server; import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.event.Event; -import org.spongepowered.api.resourcepack.ResourcePack; +import org.spongepowered.api.network.ServerSideConnection; +import org.spongepowered.api.profile.GameProfile; import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; import java.util.Optional; /** - * Called when a {@link ServerPlayer player} notifies the {@link Server} of the + * Called when a {@link ServerSideConnection connection} notifies the {@link Server} of the * status of a resource pack change request. */ @GenerateFactoryMethod public interface ResourcePackStatusEvent extends Event { /** - * Get the {@link ServerPlayer player}. + * Gets the {@link ServerSideConnection connection}. * - * @return The player + * @return The connection */ - ServerPlayer player(); + ServerSideConnection connection(); + + /** + * Gets the {@link GameProfile profile} associated + * with this connection. + * + * @return The profile + */ + GameProfile profile(); + + /** + * Gets the {@link ServerPlayer player}. + * + * @return The player, or {@link Optional#empty()} if the + * player is in the configuration state. + */ + Optional player(); /** * Gets the pack that this status corresponds to. * * @return The pack that this status corresponds to. */ - ResourcePack pack(); + ResourcePackInfo pack(); /** * Gets the status of the sent pack. @@ -60,54 +78,4 @@ public interface ResourcePackStatusEvent extends Event { * @return The status of the sent pack. */ ResourcePackStatus status(); - - /** - * The different possible responses the client can have. - */ - enum ResourcePackStatus { - - /** - * The client is attempting to download the pack. - */ - ACCEPTED(null), - - /** - * The client declined to download the pack. - */ - DECLINED(false), - - /** - * The client failed to download the resource pack. - * - *

In some client versions, such as 1.8.0, this may only be sent when - * the resource pack URL does not end in {@code .zip}. Otherwise, - * {@link #SUCCESSFULLY_LOADED} will be sent.

- */ - FAILED(false), - - /** - * The pack URI was successfully loaded. This does not mean that pack - * was loaded, as the vanilla client sends this even when encountering a - * 404 or similar. - */ - SUCCESSFULLY_LOADED(true); - - @Nullable private final Boolean success; - - ResourcePackStatus(@Nullable Boolean success) { - this.success = success; - } - - /** - * Gets if this status indicates that the pack was successfully set. - * - * @return true if it was successful, false if it was not, and - * Optional.empty() if it cannot be determined at this time. - */ - public Optional wasSuccessful() { - return Optional.ofNullable(this.success); - } - - } - } diff --git a/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java b/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java index 7049af3b310..a23d58b2139 100644 --- a/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java +++ b/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java @@ -38,21 +38,30 @@ import org.spongepowered.api.profile.GameProfile; import org.spongepowered.api.service.ban.BanService; import org.spongepowered.api.service.whitelist.WhitelistService; +import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.api.world.server.ServerWorld; import org.spongepowered.math.vector.Vector3d; import java.net.InetAddress; +import java.util.Optional; /** - * Represents an event fired during the login process. + * Represents an event fired during the login and configuration phase. * *

These events represent the progression of a {@link ServerPlayer player} * from first authenticating, to being fully loaded in the world.

* *

The events are fired in the following order:

* - *

#Auth -> #Handshake -> #Login -> #Join

+ *

#Intent -> #Auth -> #Handshake -> #Configuration -> #Login -> #Join

+ * + *

Vanilla also allows the client to go back to the configuration phase + * where the {@link ServerPlayer player} is removed from the world before + * being put back after the configuration phase ends. The order of the events + * is the following:

+ * + *

#Leave -> #Configuration -> #Login -> #Join

* *

Traditionally one could consider a {@link SpawnEntityEvent} to be thrown, * but due to the nature of cancellations, a {@link ServerPlayer player} joining @@ -69,32 +78,72 @@ public interface ServerSideConnectionEvent extends Event { ServerSideConnection connection(); /** - * Gets the {@link GameProfile} of the client attempting to connect. + *

Called asynchronously when the client attempts to connect to + * the server.

* - * @return The client's profile + *

After observing this event for particular {@link ServerSideConnection connection} + * you are guaranteed to get #Disconnect for the same connection without + * ordering issues.

+ */ + interface Intent extends ServerSideConnectionEvent, MessageEvent, Cancellable { + + /** + * Gets if the user is intending to connect due to being transferred. + * + * @return {@code true} if the user is transferring. + */ + boolean isTransfer(); + } + + /** + * Represents an event that has knowledge about the {@link GameProfile} that + * is linked to the connection. */ - default GameProfile profile() { - return this.connection().profile(); + @NoFactoryMethod + interface ProfileScoped extends ServerSideConnectionEvent { + + /** + * Gets the {@link GameProfile} of the client. + * + * @return The client's profile + */ + GameProfile profile(); } /** * Called asynchronously when the client attempts to authenticate against * the server. * + *

After observing this event for particular {@link ServerSideConnection connection} + * you are guaranteed to get #Disconnect for the same connection without + * ordering issues.

+ * + *

If the registered {@link BanService} or {@link WhitelistService} + * indicates that a player should not be allowed to join ( + * {@link GameProfile} or {@link InetAddress} has an ban, or is not on the + * whitelist), then this event will automatically cancelled by the + * implementation, with the proper message set through + * {@link MessageEvent#setMessage(Component)}. No action on the part + * of the registered {@link BanService} or {@link WhitelistService} is + * required for this to occur. + * + *

Plugins may uncancel the event to allow a client to join, regardless of + * its ban/whitelist status.

+ * *

Note: This event is fired before #Login.

*/ - interface Auth extends ServerSideConnectionEvent, MessageEvent, Cancellable { + interface Auth extends ProfileScoped, MessageEvent, Cancellable { } /** - * Called after the client authenticates and attempts to login to the - * server. This is the phase where plugins can perform a handshake with - * the client by sending login related packets and requests. + * Called after the client authenticates and attempts to switch to the + * configuration phase. This is the phase where plugins can perform + * a handshake with the client by sending login related packets and requests. * *

During this event, it's possible to use the {@link Channel}s to send * requests to the client. As long as there's requests going to the client, * the connection will stay in the handshake phase and will not continue - * to the {@link Login} event.

+ * to the {@link Configuration} event.

* *

For example, a plugin sends a packet to the client to request its * client side plugin version. The client responds and the plugin handles @@ -105,13 +154,29 @@ interface Auth extends ServerSideConnectionEvent, MessageEvent, Cancellable { *

During the lifetime of the handshake phase, a {@link ServerSideConnection} * can be terminated by calling {@link ServerSideConnection#close(Component)}.

*/ - interface Handshake extends ServerSideConnectionEvent { + interface Handshake extends ProfileScoped { } /** - * Called after the server finished its handshake with the client. + * Called when the configuration phase starts. This can happen multiple + * times per session. + * + *

During this event, it's possible to use the {@link Channel}s to send + * requests to the client. As long as there's requests going to the client, + * the connection will stay in the configuration phase and will not continue + * to the {@link Login} event.

* - *

Note: This event is fired after #Auth and is NOT async. Any changes + *

During the lifetime of the handshake phase, a {@link ServerSideConnection} + * can be terminated by calling {@link ServerSideConnection#close(Component)}.

+ */ + interface Configuration extends ProfileScoped { + + } + + /** + * Called after the server finished its configuration with the client. + * + *

Note: This event is fired after #Configuration and is NOT async. Any changes * required for the {@link ServerPlayer players} {@link ServerLocation location} * or {@link Vector3d rotation} should be done during this event and NOT * during #Join.

@@ -128,7 +193,7 @@ interface Handshake extends ServerSideConnectionEvent { * Plugins may uncancel the event to allow a client to join, regardless of * its ban/whitelist status.

*/ - interface Login extends ServerSideConnectionEvent, MessageEvent, Event, Cancellable { + interface Login extends ProfileScoped, MessageEvent, Cancellable { /** * Gets the {@link User}. @@ -182,14 +247,14 @@ interface Login extends ServerSideConnectionEvent, MessageEvent, Event, Cancella /** * Called when a {@link ServerPlayer player} joins the game within a - * {@link ServerWorld world} for the first time after initial connection. + * {@link ServerWorld world} for the first time after the configuration phase. * Fired after {@link Login} once the {@link ServerPlayer player} has been * properly added to the {@link ServerWorld}. If data is wanted to be * modified that could affect a player's representation (such as vanishing), * it's recommended to modify such data in the logging in * {@link Login#user() User} instead. */ - interface Join extends ServerSideConnectionEvent, AudienceMessageEvent, MessageCancellable { + interface Join extends ProfileScoped, AudienceMessageEvent, MessageCancellable { /** * Gets the {@link ServerPlayer player}. @@ -200,9 +265,11 @@ interface Join extends ServerSideConnectionEvent, AudienceMessageEvent, MessageC } /** - * Called when a {@link ServerPlayer player} disconnects from the game. + * Called when a {@link ServerPlayer player} leaves from the world. The + * {@link ServerSideConnection connection} might not be closed yet as the + * client could have transitioned back to the configuration state. */ - interface Disconnect extends ServerSideConnectionEvent, AudienceMessageEvent { + interface Leave extends ProfileScoped, AudienceMessageEvent, MessageCancellable { /** * Gets the {@link ServerPlayer player}. @@ -212,4 +279,20 @@ interface Disconnect extends ServerSideConnectionEvent, AudienceMessageEvent { ServerPlayer player(); } + /** + * Called when a {@link ServerSideConnection connection} disconnects from the game. + * + *

Note: This event might be called asynchronously. Additionally, the connection + * might have not got past #Auth. + */ + interface Disconnect extends ServerSideConnectionEvent { + + /** + * Gets the {@link GameProfile} of the client if it got + * past authentication. + * + * @return The client's profile + */ + Optional profile(); + } } diff --git a/src/main/java/org/spongepowered/api/item/ItemTypes.java b/src/main/java/org/spongepowered/api/item/ItemTypes.java index 45fae9436d8..2b4ef0f8a24 100644 --- a/src/main/java/org/spongepowered/api/item/ItemTypes.java +++ b/src/main/java/org/spongepowered/api/item/ItemTypes.java @@ -106,6 +106,10 @@ public final class ItemTypes { public static final DefaultedRegistryReference ARCHER_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("archer_pottery_sherd")); + public static final DefaultedRegistryReference ARMADILLO_SCUTE = ItemTypes.key(ResourceKey.minecraft("armadillo_scute")); + + public static final DefaultedRegistryReference ARMADILLO_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("armadillo_spawn_egg")); + public static final DefaultedRegistryReference ARMOR_STAND = ItemTypes.key(ResourceKey.minecraft("armor_stand")); public static final DefaultedRegistryReference ARMS_UP_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("arms_up_pottery_sherd")); @@ -298,6 +302,10 @@ public final class ItemTypes { public static final DefaultedRegistryReference BLUE_WOOL = ItemTypes.key(ResourceKey.minecraft("blue_wool")); + public static final DefaultedRegistryReference BOGGED_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("bogged_spawn_egg")); + + public static final DefaultedRegistryReference BOLT_ARMOR_TRIM_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("bolt_armor_trim_smithing_template")); + public static final DefaultedRegistryReference BONE = ItemTypes.key(ResourceKey.minecraft("bone")); public static final DefaultedRegistryReference BONE_BLOCK = ItemTypes.key(ResourceKey.minecraft("bone_block")); @@ -320,6 +328,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference BREAD = ItemTypes.key(ResourceKey.minecraft("bread")); + public static final DefaultedRegistryReference BREEZE_ROD = ItemTypes.key(ResourceKey.minecraft("breeze_rod")); + public static final DefaultedRegistryReference BREEZE_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("breeze_spawn_egg")); public static final DefaultedRegistryReference BREWER_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("brewer_pottery_sherd")); @@ -968,6 +978,12 @@ public final class ItemTypes { public static final DefaultedRegistryReference FLINT_AND_STEEL = ItemTypes.key(ResourceKey.minecraft("flint_and_steel")); + public static final DefaultedRegistryReference FLOW_ARMOR_TRIM_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("flow_armor_trim_smithing_template")); + + public static final DefaultedRegistryReference FLOW_BANNER_PATTERN = ItemTypes.key(ResourceKey.minecraft("flow_banner_pattern")); + + public static final DefaultedRegistryReference FLOW_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("flow_pottery_sherd")); + public static final DefaultedRegistryReference FLOWER_BANNER_PATTERN = ItemTypes.key(ResourceKey.minecraft("flower_banner_pattern")); public static final DefaultedRegistryReference FLOWER_POT = ItemTypes.key(ResourceKey.minecraft("flower_pot")); @@ -1124,6 +1140,10 @@ public final class ItemTypes { public static final DefaultedRegistryReference GUNPOWDER = ItemTypes.key(ResourceKey.minecraft("gunpowder")); + public static final DefaultedRegistryReference GUSTER_BANNER_PATTERN = ItemTypes.key(ResourceKey.minecraft("guster_banner_pattern")); + + public static final DefaultedRegistryReference GUSTER_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("guster_pottery_sherd")); + public static final DefaultedRegistryReference HANGING_ROOTS = ItemTypes.key(ResourceKey.minecraft("hanging_roots")); public static final DefaultedRegistryReference HAY_BLOCK = ItemTypes.key(ResourceKey.minecraft("hay_block")); @@ -1134,6 +1154,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference HEARTBREAK_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("heartbreak_pottery_sherd")); + public static final DefaultedRegistryReference HEAVY_CORE = ItemTypes.key(ResourceKey.minecraft("heavy_core")); + public static final DefaultedRegistryReference HEAVY_WEIGHTED_PRESSURE_PLATE = ItemTypes.key(ResourceKey.minecraft("heavy_weighted_pressure_plate")); public static final DefaultedRegistryReference HOGLIN_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("hoglin_spawn_egg")); @@ -1396,6 +1418,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference LOOM = ItemTypes.key(ResourceKey.minecraft("loom")); + public static final DefaultedRegistryReference MACE = ItemTypes.key(ResourceKey.minecraft("mace")); + public static final DefaultedRegistryReference MAGENTA_BANNER = ItemTypes.key(ResourceKey.minecraft("magenta_banner")); public static final DefaultedRegistryReference MAGENTA_BED = ItemTypes.key(ResourceKey.minecraft("magenta_bed")); @@ -1660,6 +1684,10 @@ public final class ItemTypes { public static final DefaultedRegistryReference OCHRE_FROGLIGHT = ItemTypes.key(ResourceKey.minecraft("ochre_froglight")); + public static final DefaultedRegistryReference OMINOUS_BOTTLE = ItemTypes.key(ResourceKey.minecraft("ominous_bottle")); + + public static final DefaultedRegistryReference OMINOUS_TRIAL_KEY = ItemTypes.key(ResourceKey.minecraft("ominous_trial_key")); + public static final DefaultedRegistryReference ORANGE_BANNER = ItemTypes.key(ResourceKey.minecraft("orange_banner")); public static final DefaultedRegistryReference ORANGE_BED = ItemTypes.key(ResourceKey.minecraft("orange_bed")); @@ -2064,6 +2092,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference SCAFFOLDING = ItemTypes.key(ResourceKey.minecraft("scaffolding")); + public static final DefaultedRegistryReference SCRAPE_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("scrape_pottery_sherd")); + public static final DefaultedRegistryReference SCULK = ItemTypes.key(ResourceKey.minecraft("sculk")); public static final DefaultedRegistryReference SCULK_CATALYST = ItemTypes.key(ResourceKey.minecraft("sculk_catalyst")); @@ -2074,8 +2104,6 @@ public final class ItemTypes { public static final DefaultedRegistryReference SCULK_VEIN = ItemTypes.key(ResourceKey.minecraft("sculk_vein")); - public static final DefaultedRegistryReference SCUTE = ItemTypes.key(ResourceKey.minecraft("scute")); - public static final DefaultedRegistryReference SEA_LANTERN = ItemTypes.key(ResourceKey.minecraft("sea_lantern")); public static final DefaultedRegistryReference SEA_PICKLE = ItemTypes.key(ResourceKey.minecraft("sea_pickle")); @@ -2410,10 +2438,14 @@ public final class ItemTypes { public static final DefaultedRegistryReference TURTLE_HELMET = ItemTypes.key(ResourceKey.minecraft("turtle_helmet")); + public static final DefaultedRegistryReference TURTLE_SCUTE = ItemTypes.key(ResourceKey.minecraft("turtle_scute")); + public static final DefaultedRegistryReference TURTLE_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("turtle_spawn_egg")); public static final DefaultedRegistryReference TWISTING_VINES = ItemTypes.key(ResourceKey.minecraft("twisting_vines")); + public static final DefaultedRegistryReference VAULT = ItemTypes.key(ResourceKey.minecraft("vault")); + public static final DefaultedRegistryReference VERDANT_FROGLIGHT = ItemTypes.key(ResourceKey.minecraft("verdant_froglight")); public static final DefaultedRegistryReference VEX_ARMOR_TRIM_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("vex_armor_trim_smithing_template")); @@ -2600,6 +2632,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference WILD_ARMOR_TRIM_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("wild_armor_trim_smithing_template")); + public static final DefaultedRegistryReference WIND_CHARGE = ItemTypes.key(ResourceKey.minecraft("wind_charge")); + public static final DefaultedRegistryReference WITCH_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("witch_spawn_egg")); public static final DefaultedRegistryReference WITHER_ROSE = ItemTypes.key(ResourceKey.minecraft("wither_rose")); @@ -2610,6 +2644,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference WITHER_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("wither_spawn_egg")); + public static final DefaultedRegistryReference WOLF_ARMOR = ItemTypes.key(ResourceKey.minecraft("wolf_armor")); + public static final DefaultedRegistryReference WOLF_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("wolf_spawn_egg")); public static final DefaultedRegistryReference WOODEN_AXE = ItemTypes.key(ResourceKey.minecraft("wooden_axe")); diff --git a/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentTypes.java b/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentTypes.java index f9aa0c3a0d9..94a3745ba45 100644 --- a/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentTypes.java +++ b/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentTypes.java @@ -70,8 +70,12 @@ public final class EnchantmentTypes { */ public static final DefaultedRegistryReference BLAST_PROTECTION = EnchantmentTypes.key(ResourceKey.minecraft("blast_protection")); + public static final DefaultedRegistryReference BREACH = EnchantmentTypes.key(ResourceKey.minecraft("breach")); + public static final DefaultedRegistryReference CHANNELING = EnchantmentTypes.key(ResourceKey.minecraft("channeling")); + public static final DefaultedRegistryReference DENSITY = EnchantmentTypes.key(ResourceKey.minecraft("density")); + /** * Increases underwater movement speed. * @@ -245,12 +249,7 @@ public final class EnchantmentTypes { public static final DefaultedRegistryReference SOUL_SPEED = EnchantmentTypes.key(ResourceKey.minecraft("soul_speed")); - /** - * Increases the damage of the sweeping attack. - * - *

In vanilla the maximum level is 3.

- */ - public static final DefaultedRegistryReference SWEEPING = EnchantmentTypes.key(ResourceKey.minecraft("sweeping")); + public static final DefaultedRegistryReference SWEEPING_EDGE = EnchantmentTypes.key(ResourceKey.minecraft("sweeping_edge")); public static final DefaultedRegistryReference SWIFT_SNEAK = EnchantmentTypes.key(ResourceKey.minecraft("swift_sneak")); @@ -275,6 +274,8 @@ public final class EnchantmentTypes { */ public static final DefaultedRegistryReference VANISHING_CURSE = EnchantmentTypes.key(ResourceKey.minecraft("vanishing_curse")); + public static final DefaultedRegistryReference WIND_BURST = EnchantmentTypes.key(ResourceKey.minecraft("wind_burst")); + private EnchantmentTypes() { } diff --git a/src/main/java/org/spongepowered/api/item/inventory/menu/InventoryMenu.java b/src/main/java/org/spongepowered/api/item/inventory/menu/InventoryMenu.java index cfd8bff88f1..910c8ec0eec 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/menu/InventoryMenu.java +++ b/src/main/java/org/spongepowered/api/item/inventory/menu/InventoryMenu.java @@ -27,6 +27,7 @@ import net.kyori.adventure.text.Component; import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.item.inventory.Container; +import org.spongepowered.api.item.inventory.Slot; import org.spongepowered.api.item.inventory.menu.handler.ClickHandler; import org.spongepowered.api.item.inventory.menu.handler.CloseHandler; import org.spongepowered.api.item.inventory.menu.handler.InventoryCallbackHandler; @@ -149,6 +150,18 @@ static InventoryMenu of(ViewableInventory inventory) { */ InventoryMenu setReadOnly(boolean readOnly); + /** + * Sets the {@link Slot} readonly mode for this menu. + * By default, uses the menus current readonly mode. + * This can be used to override per slot. + * + * @param slot the slot which readonly mode is changed + * @param readOnly whether to make the slot readonly or not. + * @return this menu + * @throws IllegalArgumentException if the slot is not part of the menu + */ + InventoryMenu setReadOnly(Slot slot, boolean readOnly); + /** * Opens this menu for given {@link ServerPlayer player}. * diff --git a/src/main/java/org/spongepowered/api/network/LocalPlayerConnection.java b/src/main/java/org/spongepowered/api/item/inventory/slot/PotionSlot.java similarity index 71% rename from src/main/java/org/spongepowered/api/network/LocalPlayerConnection.java rename to src/main/java/org/spongepowered/api/item/inventory/slot/PotionSlot.java index bdfec46e21d..ef97aaf17b1 100644 --- a/src/main/java/org/spongepowered/api/network/LocalPlayerConnection.java +++ b/src/main/java/org/spongepowered/api/item/inventory/slot/PotionSlot.java @@ -22,21 +22,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.network; - -import org.spongepowered.api.entity.living.player.client.LocalPlayer; +package org.spongepowered.api.item.inventory.slot; /** - * Represents a connection of a client to the server where - * the client {@link LocalPlayer player} has successfully joined. + * An inventory slot which can only contain potions. + * e.g. BrewingStand */ -public interface LocalPlayerConnection extends PlayerConnection, ClientSideConnection { - - /** - * Gets the associated {@link LocalPlayer player} for this connection. - * - * @return The associated player - */ - @Override - LocalPlayer player(); +public interface PotionSlot extends FilteringSlot { } diff --git a/src/main/java/org/spongepowered/api/item/potion/PotionTypes.java b/src/main/java/org/spongepowered/api/item/potion/PotionTypes.java index 286fe0606e3..8278db6ab8b 100644 --- a/src/main/java/org/spongepowered/api/item/potion/PotionTypes.java +++ b/src/main/java/org/spongepowered/api/item/potion/PotionTypes.java @@ -42,14 +42,14 @@ public final class PotionTypes { public static final DefaultedRegistryReference AWKWARD = PotionTypes.key(ResourceKey.minecraft("awkward")); - public static final DefaultedRegistryReference EMPTY = PotionTypes.key(ResourceKey.minecraft("empty")); - public static final DefaultedRegistryReference FIRE_RESISTANCE = PotionTypes.key(ResourceKey.minecraft("fire_resistance")); public static final DefaultedRegistryReference HARMING = PotionTypes.key(ResourceKey.minecraft("harming")); public static final DefaultedRegistryReference HEALING = PotionTypes.key(ResourceKey.minecraft("healing")); + public static final DefaultedRegistryReference INFESTED = PotionTypes.key(ResourceKey.minecraft("infested")); + public static final DefaultedRegistryReference INVISIBILITY = PotionTypes.key(ResourceKey.minecraft("invisibility")); public static final DefaultedRegistryReference LEAPING = PotionTypes.key(ResourceKey.minecraft("leaping")); @@ -86,6 +86,8 @@ public final class PotionTypes { public static final DefaultedRegistryReference NIGHT_VISION = PotionTypes.key(ResourceKey.minecraft("night_vision")); + public static final DefaultedRegistryReference OOZING = PotionTypes.key(ResourceKey.minecraft("oozing")); + public static final DefaultedRegistryReference POISON = PotionTypes.key(ResourceKey.minecraft("poison")); public static final DefaultedRegistryReference REGENERATION = PotionTypes.key(ResourceKey.minecraft("regeneration")); @@ -126,6 +128,10 @@ public final class PotionTypes { public static final DefaultedRegistryReference WEAKNESS = PotionTypes.key(ResourceKey.minecraft("weakness")); + public static final DefaultedRegistryReference WEAVING = PotionTypes.key(ResourceKey.minecraft("weaving")); + + public static final DefaultedRegistryReference WIND_CHARGED = PotionTypes.key(ResourceKey.minecraft("wind_charged")); + private PotionTypes() { } diff --git a/src/main/java/org/spongepowered/api/map/decoration/MapDecorationType.java b/src/main/java/org/spongepowered/api/map/decoration/MapDecorationType.java index 9dd07eff608..72549a60d4c 100644 --- a/src/main/java/org/spongepowered/api/map/decoration/MapDecorationType.java +++ b/src/main/java/org/spongepowered/api/map/decoration/MapDecorationType.java @@ -24,15 +24,23 @@ */ package org.spongepowered.api.map.decoration; +import org.spongepowered.api.data.type.DyeColor; import org.spongepowered.api.map.MapCanvas; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; +import java.util.Optional; + /** - * Represents a symbol that may be used on a {@link MapCanvas} as part of a - * {@link MapDecoration}. + * Represents a symbol that may be used on a {@link MapCanvas} as part of a {@link MapDecoration}. */ @CatalogedBy(MapDecorationTypes.class) public interface MapDecorationType extends DefaultedRegistryValue { + /** + * Gets the corresponding {@link DyeColor} that this banner decoration type is. + * + * @return The {@link DyeColor} that this banner decoration type is. + */ + Optional bannerColor(); } diff --git a/src/main/java/org/spongepowered/api/network/ClientConnectionState.java b/src/main/java/org/spongepowered/api/network/ClientConnectionState.java new file mode 100644 index 00000000000..bb533b06a99 --- /dev/null +++ b/src/main/java/org/spongepowered/api/network/ClientConnectionState.java @@ -0,0 +1,77 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.network; + +import org.spongepowered.api.entity.living.player.client.LocalPlayer; + +/** + * Represents the state of the connection + * from the client to the server on the client side. + */ +public interface ClientConnectionState extends EngineConnectionState { + + /** + * Represents the intent state of the connection + * from the client to the server on the client side. + */ + interface Intent extends EngineConnectionState.Intent, ClientConnectionState { + } + + /** + * Represents the authenticated state of the connection + * from the client to the server on the client side. + */ + interface Authenticated extends EngineConnectionState.Authenticated, ClientConnectionState { + } + + /** + * Represents the login state of the connection + * from the client to the server on the client side. + */ + interface Login extends EngineConnectionState.Login, Authenticated { + } + + /** + * Represents the configuration state of the connection + * from the client to the server on the client side. + */ + interface Configuration extends EngineConnectionState.Configuration, Authenticated { + } + + /** + * Represents the game state of the connection + * from the client to the server on the client side. + */ + interface Game extends EngineConnectionState.Game, Authenticated { + + /** + * Gets the associated {@link LocalPlayer player} for this connection state. + * + * @return The associated player + */ + @Override + LocalPlayer player(); + } +} diff --git a/src/main/java/org/spongepowered/api/network/EngineConnection.java b/src/main/java/org/spongepowered/api/network/EngineConnection.java index 909ab840dc0..b87153e624f 100644 --- a/src/main/java/org/spongepowered/api/network/EngineConnection.java +++ b/src/main/java/org/spongepowered/api/network/EngineConnection.java @@ -26,6 +26,8 @@ import net.kyori.adventure.text.Component; +import java.util.Optional; + /** * Represents a connection on the server or client engine. */ @@ -38,6 +40,14 @@ public interface EngineConnection extends RemoteConnection { */ EngineConnectionSide side(); + /** + * Gets the state this connection is on. + * + * @return The state, or {@link Optional#empty()} if the connection + * has been closed. + */ + Optional state(); + /** * Closes the connection, showing the default disconnect reason. * (the translation key {@code disconnect.disconnected}) diff --git a/src/main/java/org/spongepowered/api/network/EngineConnectionState.java b/src/main/java/org/spongepowered/api/network/EngineConnectionState.java new file mode 100644 index 00000000000..d8453fcce4d --- /dev/null +++ b/src/main/java/org/spongepowered/api/network/EngineConnectionState.java @@ -0,0 +1,92 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.network; + +import org.spongepowered.api.entity.living.player.Player; +import org.spongepowered.api.profile.GameProfile; + +/** + * Represents the current state of the connection + * on the server or client engine. + */ +public interface EngineConnectionState { + + /** + * Gets whatever the connection was established because + * the client was transferred. + * + * @return {@code true} if the client was transferred. + */ + boolean transferred(); + + /** + * Represents the intent state of the connection + * on the server or client engine. + */ + interface Intent extends EngineConnectionState { + } + + /** + * Represents the authenticated state of the connection + * on the server or client engine. + */ + interface Authenticated extends EngineConnectionState { + + /** + * Gets the associated {@link GameProfile profile} for this connection state. + * + * @return The associated profile + */ + GameProfile profile(); + } + + /** + * Represents the login state of the connection + * on the server or client engine. + */ + interface Login extends Authenticated { + } + + /** + * Represents the connection state of the connection + * on the server or client engine. + */ + interface Configuration extends Authenticated { + } + + /** + * Represents the game state of the connection + * on the server or client engine. + */ + interface Game extends Authenticated { + + /** + * Gets the associated {@link Player player} for this connection state. + * + * @return The associated player + */ + Player player(); + } +} diff --git a/src/main/java/org/spongepowered/api/network/EngineConnectionStates.java b/src/main/java/org/spongepowered/api/network/EngineConnectionStates.java new file mode 100644 index 00000000000..f09e9bf10e0 --- /dev/null +++ b/src/main/java/org/spongepowered/api/network/EngineConnectionStates.java @@ -0,0 +1,85 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.network; + +/** + * An enumeration of all the possible engine connection states. + */ +public final class EngineConnectionStates { + + /** + * The supertype of all the known connection states. + */ + public static final Class ALL = EngineConnectionState.class; + + public static final Class INTENT = EngineConnectionState.Intent.class; + + /** + * The supertype of all the connection states where the connection is authenticated. + */ + public static final Class AUTHENTICATED = EngineConnectionState.Authenticated.class; + + public static final Class LOGIN = EngineConnectionState.Login.class; + + public static final Class CONFIGURATION = EngineConnectionState.Configuration.class; + + public static final Class GAME = EngineConnectionState.Game.class; + + /** + * The supertype of all the known client connection states. + */ + public static final Class CLIENT_SIDE = ClientConnectionState.class; + + public static final Class CLIENT_INTENT = ClientConnectionState.Intent.class; + + /** + * The supertype of all the connection states where the client is authenticated. + */ + public static final Class CLIENT_AUTHENTICATED = ClientConnectionState.Authenticated.class; + + public static final Class CLIENT_LOGIN = ClientConnectionState.Login.class; + + public static final Class CLIENT_CONFIGURATION = ClientConnectionState.Configuration.class; + + public static final Class CLIENT_GAME = ClientConnectionState.Game.class; + + /** + * The supertype of all the known server connection states. + */ + public static final Class SERVER_SIDE = ServerConnectionState.class; + + public static final Class SERVER_INTENT = ServerConnectionState.Intent.class; + + /** + * The supertype of all the connection states where the client is authenticated. + */ + public static final Class SERVER_AUTHENTICATED = ServerConnectionState.Authenticated.class; + + public static final Class SERVER_LOGIN = ServerConnectionState.Login.class; + + public static final Class SERVER_CONFIGURATION = ServerConnectionState.Configuration.class; + + public static final Class SERVER_GAME = ServerConnectionState.Game.class; +} diff --git a/src/main/java/org/spongepowered/api/network/EngineConnectionTypes.java b/src/main/java/org/spongepowered/api/network/EngineConnectionTypes.java deleted file mode 100644 index 1530854cd3a..00000000000 --- a/src/main/java/org/spongepowered/api/network/EngineConnectionTypes.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of SpongeAPI, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * 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.network; - -/** - * An enumeration of all the possible engine connection types. - */ -public final class EngineConnectionTypes { - - /** - * The supertype of all the known connection types. - */ - public static final Class ALL = EngineConnection.class; - - /** - * The client side connection type. - */ - public static final Class CLIENT_SIDE = ClientSideConnection.class; - - /** - * The client side connection type where the player - * has successfully joined a server. - */ - public static final Class LOCAL_PLAYER = LocalPlayerConnection.class; - - /** - * The server or client connection type where the player - * has successfully joined a server. - */ - public static final Class PLAYER = PlayerConnection.class; - - /** - * The server side connection type. - */ - public static final Class SERVER_SIDE = ServerSideConnection.class; - - /** - * The server side connection type where the player - * has successfully joined a server. - */ - public static final Class SERVER_PLAYER = ServerPlayerConnection.class; - - private EngineConnectionTypes() { - } -} diff --git a/src/main/java/org/spongepowered/api/network/RemoteConnection.java b/src/main/java/org/spongepowered/api/network/RemoteConnection.java index ba4aef19e95..05220251b4e 100644 --- a/src/main/java/org/spongepowered/api/network/RemoteConnection.java +++ b/src/main/java/org/spongepowered/api/network/RemoteConnection.java @@ -28,6 +28,13 @@ public interface RemoteConnection { + /*** + * Gets whatever the connection is open. + * + * @return {@code true} if the connection is open. + */ + boolean active(); + /** * Gets the {@link InetSocketAddress} of this connection. * diff --git a/src/main/java/org/spongepowered/api/network/ServerConnectionState.java b/src/main/java/org/spongepowered/api/network/ServerConnectionState.java new file mode 100644 index 00000000000..499c023cdea --- /dev/null +++ b/src/main/java/org/spongepowered/api/network/ServerConnectionState.java @@ -0,0 +1,78 @@ +/* + * This file is part of SpongeAPI, licensed under the MIT License (MIT). + * + * Copyright (c) SpongePowered + * 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.network; + +import org.spongepowered.api.entity.living.player.server.ServerPlayer; + +/** + * Represents a connection state between a minecraft client and server. + */ +public interface ServerConnectionState extends EngineConnectionState { + + /** + * Represents a intent state between a minecraft client and server. + */ + interface Intent extends EngineConnectionState.Intent, ServerConnectionState { + } + + /** + * Represents an authenicated state between a minecraft client and server. + */ + interface Authenticated extends EngineConnectionState.Authenticated, ServerConnectionState { + } + + /** + * Represents a login state between a minecraft client and server. + */ + interface Login extends EngineConnectionState.Login, Authenticated { + } + + /** + * Represents a configuration state between a minecraft client and server. + */ + interface Configuration extends EngineConnectionState.Configuration, Authenticated { + } + + /** + * Represents a game state between a minecraft client and server. + */ + interface Game extends EngineConnectionState.Game, Authenticated { + + /** + * Gets the associated {@link ServerPlayer player} for this connection state. + * + * @return The associated player + */ + @Override + ServerPlayer player(); + + /** + * Gets the connection latency. This is constantly calculated by the server. + * + * @return The latency + */ + int latency(); + } +} diff --git a/src/main/java/org/spongepowered/api/network/ServerSideConnection.java b/src/main/java/org/spongepowered/api/network/ServerSideConnection.java index 77a7d22e605..902c209f079 100644 --- a/src/main/java/org/spongepowered/api/network/ServerSideConnection.java +++ b/src/main/java/org/spongepowered/api/network/ServerSideConnection.java @@ -24,8 +24,6 @@ */ package org.spongepowered.api.network; -import org.spongepowered.api.profile.GameProfile; - /** * Represents a connection between a minecraft client and server. */ @@ -36,10 +34,4 @@ default EngineConnectionSide side() { return EngineConnectionSide.SERVER; } - /** - * Gets the profile of the client. - * - * @return The client's profile - */ - GameProfile profile(); } diff --git a/src/main/java/org/spongepowered/api/network/channel/Channel.java b/src/main/java/org/spongepowered/api/network/channel/Channel.java index c2fd17ae236..968cae837d6 100644 --- a/src/main/java/org/spongepowered/api/network/channel/Channel.java +++ b/src/main/java/org/spongepowered/api/network/channel/Channel.java @@ -25,7 +25,7 @@ package org.spongepowered.api.network.channel; import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.network.EngineConnection; +import org.spongepowered.api.network.EngineConnectionState; /** * Represents a network channel bound to a {@link ChannelManager}. The channel @@ -55,5 +55,5 @@ public interface Channel { * * @param handler The channel exception handler */ - void setExceptionHandler(ChannelExceptionHandler handler); + void setExceptionHandler(ChannelExceptionHandler handler); } diff --git a/src/main/java/org/spongepowered/api/network/channel/ChannelExceptionHandler.java b/src/main/java/org/spongepowered/api/network/channel/ChannelExceptionHandler.java index f952ade14ee..b557c7604f5 100644 --- a/src/main/java/org/spongepowered/api/network/channel/ChannelExceptionHandler.java +++ b/src/main/java/org/spongepowered/api/network/channel/ChannelExceptionHandler.java @@ -27,6 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.Sponge; import org.spongepowered.api.network.EngineConnection; +import org.spongepowered.api.network.EngineConnectionState; import java.util.Objects; import java.util.concurrent.CompletableFuture; @@ -35,10 +36,10 @@ * Represents a handler for exceptions of {@link Channel}s. This handler * can be implemented by plugin developers. * - * @param The connection type + * @param The connection state */ @FunctionalInterface -public interface ChannelExceptionHandler { +public interface ChannelExceptionHandler { /** * Gets the {@link ChannelExceptionHandler} that will always log when a @@ -51,7 +52,7 @@ public interface ChannelExceptionHandler { * * @return The channel exception handler */ - static ChannelExceptionHandler logEverything() { + static ChannelExceptionHandler logEverything() { return Sponge.game().factoryProvider().provide(Factory.class).logEverything(); } @@ -64,12 +65,12 @@ static ChannelExceptionHandler logEverything() { * this one must be completed when an exception occurs. The future is always * null when a request packet is being handled on the other side.

* - * @param connection The connection that the exception occurred for + * @param state The state that the exception occurred for * @param channel The channel the exception occurred on * @param exception The exception the occurred * @param future The future of the send operation or receive operation */ - void handle(C connection, Channel channel, ChannelException exception, @Nullable CompletableFuture future); + void handle(S state, Channel channel, ChannelException exception, @Nullable CompletableFuture future); /** * Returns a new {@link ChannelExceptionHandler} that suppresses every {@link ChannelException} @@ -80,8 +81,8 @@ static ChannelExceptionHandler logEverything() { * * @return The new channel exception handler */ - default ChannelExceptionHandler suppressAllIfFutureIsPresent() { - final ChannelExceptionHandler original = this; + default ChannelExceptionHandler suppressAllIfFutureIsPresent() { + final ChannelExceptionHandler original = this; return (connection, channel, exception, future) -> { if (future != null) { future.completeExceptionally(exception); @@ -102,9 +103,9 @@ default ChannelExceptionHandler suppressAllIfFutureIsPresent() { * @param exceptionType The exception type to suppress * @return The new channel exception handler */ - default ChannelExceptionHandler suppressIfFutureIsPresent(final Class exceptionType) { + default ChannelExceptionHandler suppressIfFutureIsPresent(final Class exceptionType) { Objects.requireNonNull(exceptionType, "exceptionType"); - final ChannelExceptionHandler original = this; + final ChannelExceptionHandler original = this; return (connection, channel, exception, future) -> { if (future != null && exceptionType.isInstance(exception)) { future.completeExceptionally(exception); @@ -127,9 +128,9 @@ default ChannelExceptionHandler suppressIfFutureIsPresent(final Class suppress(final Class exceptionType) { + default ChannelExceptionHandler suppress(final Class exceptionType) { Objects.requireNonNull(exceptionType, "exceptionType"); - final ChannelExceptionHandler original = this; + final ChannelExceptionHandler original = this; return (connection, channel, exception, future) -> { if (exceptionType.isInstance(exception)) { if (future != null) { @@ -143,6 +144,6 @@ default ChannelExceptionHandler suppress(final Class logEverything(); + ChannelExceptionHandler logEverything(); } } diff --git a/src/main/java/org/spongepowered/api/network/channel/packet/HandlerPacketBinding.java b/src/main/java/org/spongepowered/api/network/channel/packet/HandlerPacketBinding.java index a8fd014ed76..15c17b47464 100644 --- a/src/main/java/org/spongepowered/api/network/channel/packet/HandlerPacketBinding.java +++ b/src/main/java/org/spongepowered/api/network/channel/packet/HandlerPacketBinding.java @@ -24,8 +24,7 @@ */ package org.spongepowered.api.network.channel.packet; -import org.spongepowered.api.network.EngineConnection; -import org.spongepowered.api.network.EngineConnectionSide; +import org.spongepowered.api.network.EngineConnectionState; /** * A packet binding that allows the registration of {@link PacketHandler}s. @@ -34,29 +33,17 @@ */ public interface HandlerPacketBinding

extends PacketBinding

{ - /** - * Adds a {@link PacketHandler} to handle the packets of type - * {@link P}. The handler is invoked every time the packet is - * sent to the given side. - * - * @param side The side the handler should be used on - * @param handler The handler to add - * @param The connection type - * @return This binding, for chaining - */ - PacketBinding

addHandler(EngineConnectionSide side, PacketHandler handler); - /** * Adds a {@link PacketHandler} to handle the packets of type * {@link P}. The handler is invoked every time the packet is * received by the given connection type. * - * @param connectionType The connection type the handler should be used by + * @param connectionState The connection type the handler should be used by * @param handler The handler to add - * @param The connection type + * @param The connection state * @return This binding, for chaining */ - PacketBinding

addHandler(Class connectionType, PacketHandler handler); + PacketBinding

addHandler(Class connectionState, PacketHandler handler); /** * Adds a {@link PacketHandler} to handle the packets of type @@ -66,27 +53,17 @@ public interface HandlerPacketBinding

extends PacketBinding

* @param handler The handler to add * @return This binding, for chaining */ - PacketBinding

addHandler(PacketHandler handler); - - /** - * Removes the {@link PacketHandler} for the given side. - * - * @param side The side the handler should be removes from - * @param handler The handler to remove - * @param The connection type - * @return This binding, for chaining - */ - PacketBinding

removeHandler(EngineConnectionSide side, PacketHandler handler); + PacketBinding

addHandler(PacketHandler handler); /** * Removes the {@link PacketHandler} for the given connection type. * - * @param connectionType The connection type the handler should be removes from + * @param connectionState The connection state the handler should be removes from * @param handler The handler to remove - * @param The connection type + * @param The connection state * @return This binding, for chaining */ - PacketBinding

removeHandler(Class connectionType, PacketHandler handler); + PacketBinding

removeHandler(Class connectionState, PacketHandler handler); /** * Removes the {@link PacketHandler}. diff --git a/src/main/java/org/spongepowered/api/network/channel/packet/PacketChannel.java b/src/main/java/org/spongepowered/api/network/channel/packet/PacketChannel.java index c326269eafd..6ad9aa3d012 100644 --- a/src/main/java/org/spongepowered/api/network/channel/packet/PacketChannel.java +++ b/src/main/java/org/spongepowered/api/network/channel/packet/PacketChannel.java @@ -31,7 +31,7 @@ /** * Represents an advanced channel binding that sends and receives packets. An * advantage over using a {@link BasicPacketChannel} is that it also supports - * request/response packets. + * request/response packets and the configuration phase. * *

However this channel is NOT compatible with the forge opcode based packet * channels. If you want to remain compatible, use {@link BasicPacketChannel} diff --git a/src/main/java/org/spongepowered/api/network/channel/packet/PacketHandler.java b/src/main/java/org/spongepowered/api/network/channel/packet/PacketHandler.java index 153f5bb479d..78b0c15855c 100644 --- a/src/main/java/org/spongepowered/api/network/channel/packet/PacketHandler.java +++ b/src/main/java/org/spongepowered/api/network/channel/packet/PacketHandler.java @@ -24,21 +24,21 @@ */ package org.spongepowered.api.network.channel.packet; -import org.spongepowered.api.network.EngineConnection; +import org.spongepowered.api.network.EngineConnectionState; /** * Represents a handler for a packet that was received over the network. * - * @param The connection type + * @param The connection state */ @FunctionalInterface -public interface PacketHandler

{ +public interface PacketHandler

{ /** * Handles the {@link Packet} sent by a remote connection. * * @param packet The packet received - * @param connection The connection that sent the packet + * @param state The state that sent the packet */ - void handle(P packet, C connection); + void handle(P packet, S state); } diff --git a/src/main/java/org/spongepowered/api/network/channel/packet/RequestPacketHandler.java b/src/main/java/org/spongepowered/api/network/channel/packet/RequestPacketHandler.java index be72a6275e2..18addcbd6d2 100644 --- a/src/main/java/org/spongepowered/api/network/channel/packet/RequestPacketHandler.java +++ b/src/main/java/org/spongepowered/api/network/channel/packet/RequestPacketHandler.java @@ -24,7 +24,7 @@ */ package org.spongepowered.api.network.channel.packet; -import org.spongepowered.api.network.EngineConnection; +import org.spongepowered.api.network.EngineConnectionState; import org.spongepowered.api.network.RemoteConnection; import org.spongepowered.api.network.channel.ChannelException; @@ -33,10 +33,10 @@ * * @param

The request packet type * @param The response packet type - * @param The connection type + * @param The connection state */ @FunctionalInterface -public interface RequestPacketHandler

{ +public interface RequestPacketHandler

{ /** * Handles the {@link RequestPacket} which was send by a specific @@ -53,8 +53,8 @@ public interface RequestPacketHandler

* * @param requestPacket The received request packet - * @param connection The connection that sent the packet + * @param state The state that sent the packet * @param response The response which should be completed */ - void handleRequest(P requestPacket, C connection, RequestPacketResponse response); + void handleRequest(P requestPacket, S state, RequestPacketResponse response); } diff --git a/src/main/java/org/spongepowered/api/network/channel/packet/ResponsePacketHandler.java b/src/main/java/org/spongepowered/api/network/channel/packet/ResponsePacketHandler.java index 4365aa775a8..9afc7a64bc3 100644 --- a/src/main/java/org/spongepowered/api/network/channel/packet/ResponsePacketHandler.java +++ b/src/main/java/org/spongepowered/api/network/channel/packet/ResponsePacketHandler.java @@ -24,7 +24,7 @@ */ package org.spongepowered.api.network.channel.packet; -import org.spongepowered.api.network.EngineConnection; +import org.spongepowered.api.network.EngineConnectionState; import org.spongepowered.api.network.channel.ChannelException; import org.spongepowered.api.network.channel.NoResponseException; @@ -33,19 +33,19 @@ * * @param

The type of the request packet * @param The type of the response packet - * @param The connection type + * @param The connection state */ @FunctionalInterface -public interface ResponsePacketHandler

{ +public interface ResponsePacketHandler

{ /** * Handles the response {@link Packet} sent by a client connection. * * @param responsePacket The response packet that was received * @param requestPacket The packet that was send to request the response - * @param connection The connection that sent the packet + * @param state The state that sent the packet */ - void handleResponse(R responsePacket, P requestPacket, C connection); + void handleResponse(R responsePacket, P requestPacket, S state); /** * Handles the failure of a response {@link Packet}. The {@link ChannelException} which @@ -54,8 +54,8 @@ public interface ResponsePacketHandler

, R extend @Override Class

packetType(); - /** - * Sets the {@link RequestPacketHandler} to handle a {@link RequestPacket} - * on a specific connection side. The difference with a normal {@link PacketHandler} - * is that it requires a response {@link Packet} as return value. - * - * @param side The side the request packet should be handled on - * @param handler The handler of the request packet - * @param The connection type - * @return This packet binding, for chaining - */ - TransactionalPacketBinding setRequestHandler( - EngineConnectionSide side, RequestPacketHandler handler); - /** * Sets the {@link RequestPacketHandler} to handle a {@link RequestPacket} * for a specific connection type. The difference with a normal {@link PacketHandler} * is that it requires a response {@link Packet} as return value. * - * @param connectionType The connection type the request packet should be handled by + * @param connectionState The connection state the request packet should be handled by * @param handler The handler of the request packet - * @param The connection type + * @param The connection state * @return This packet binding, for chaining */ - TransactionalPacketBinding setRequestHandler( - Class connectionType, RequestPacketHandler handler); + TransactionalPacketBinding setRequestHandler( + Class connectionState, RequestPacketHandler handler); /** * Sets the {@link RequestPacketHandler} to handle a {@link RequestPacket} @@ -93,23 +80,7 @@ TransactionalPacketBinding setRequestHandler( * @param handler The handler of the request packet * @return This packet binding, for chaining */ - TransactionalPacketBinding setRequestHandler(RequestPacketHandler handler); - - /** - * Adds a {@link PacketHandler} to handle a response {@link Packet} - * on a specific connection side. - * - *

Binding a response {@link PacketHandler} is completely optional. It is also - * possible to append a handler to the {@link CompletableFuture} returned by - * {@link PacketChannel#sendTo(EngineConnection, RequestPacket)}.

- * - * @param side The side the response packet should be handled on - * @param handler The handler of the response packet - * @param The connection type - * @return This packet binding, for chaining - */ - TransactionalPacketBinding addResponseHandler( - EngineConnectionSide side, PacketHandler handler); + TransactionalPacketBinding setRequestHandler(RequestPacketHandler handler); /** * Adds a {@link PacketHandler} to handle a response {@link Packet} @@ -119,29 +90,13 @@ TransactionalPacketBinding addResponseHandler * possible to append a handler to the {@link CompletableFuture} returned by * {@link PacketChannel#sendTo(EngineConnection, RequestPacket)}.

* - * @param connectionType The connection type the response packet should be handled by + * @param connectionState The connection state the response packet should be handled by * @param responseHandler The handler of the response packet - * @param The connection type - * @return This packet binding, for chaining - */ - TransactionalPacketBinding addResponseHandler( - Class connectionType, PacketHandler responseHandler); - - /** - * Adds a {@link ResponsePacketHandler} to handle a response {@link Packet} - * on a specific connection side. - * - *

Binding a response {@link PacketHandler} is completely optional. It is also - * possible to append a handler to the {@link CompletableFuture} returned by - * {@link PacketChannel#sendTo(EngineConnection, RequestPacket)}.

- * - * @param side The side the response packet should be handled on - * @param handler The handler of the response packet - * @param The connection type + * @param The connection state * @return This packet binding, for chaining */ - TransactionalPacketBinding addResponseHandler( - EngineConnectionSide side, ResponsePacketHandler handler); + TransactionalPacketBinding addResponseHandler( + Class connectionState, PacketHandler responseHandler); /** * Adds a {@link ResponsePacketHandler} to handle a response {@link Packet} @@ -151,13 +106,13 @@ TransactionalPacketBinding addResponseHandler * possible to append a handler to the {@link CompletableFuture} returned by * {@link PacketChannel#sendTo(EngineConnection, RequestPacket)}.

* - * @param connectionType The connection type the response packet should be handled by + * @param connectionState The connection state the response packet should be handled by * @param handler The handler of the response packet - * @param The connection type + * @param The connection state * @return This packet binding, for chaining */ - TransactionalPacketBinding addResponseHandler( - Class connectionType, ResponsePacketHandler handler); + TransactionalPacketBinding addResponseHandler( + Class connectionState, ResponsePacketHandler handler); /** * Adds a {@link PacketHandler} to handle a response {@link Packet} on both platform sides. @@ -169,7 +124,7 @@ TransactionalPacketBinding addResponseHandler * @param handler The handler of the response packet * @return This packet binding, for chaining */ - TransactionalPacketBinding addResponseHandler(PacketHandler handler); + TransactionalPacketBinding addResponseHandler(PacketHandler handler); /** * Adds a {@link ResponsePacketHandler} to handle a response {@link Packet} @@ -182,5 +137,5 @@ TransactionalPacketBinding addResponseHandler * @param handler The handler of the response packet * @return This packet binding, for chaining */ - TransactionalPacketBinding addResponseHandler(ResponsePacketHandler handler); + TransactionalPacketBinding addResponseHandler(ResponsePacketHandler handler); } diff --git a/src/main/java/org/spongepowered/api/network/channel/packet/basic/BasicPacketChannel.java b/src/main/java/org/spongepowered/api/network/channel/packet/basic/BasicPacketChannel.java index c8d64d5fda1..d8546db1fa7 100644 --- a/src/main/java/org/spongepowered/api/network/channel/packet/basic/BasicPacketChannel.java +++ b/src/main/java/org/spongepowered/api/network/channel/packet/basic/BasicPacketChannel.java @@ -36,6 +36,7 @@ * *

There are a few limitations with using this channel. Request/response * packets may only be used during the handshake phase using {@link #handshake}. + * Packets can't be send during the configuration phase. * Normal packets may only be send during the play phase.

*/ public interface BasicPacketChannel extends Channel, TransactionalPacketRegistry { diff --git a/src/main/java/org/spongepowered/api/network/channel/raw/handshake/RawHandshakeDataChannel.java b/src/main/java/org/spongepowered/api/network/channel/raw/handshake/RawHandshakeDataChannel.java index f14d1ace87e..914d8138e39 100644 --- a/src/main/java/org/spongepowered/api/network/channel/raw/handshake/RawHandshakeDataChannel.java +++ b/src/main/java/org/spongepowered/api/network/channel/raw/handshake/RawHandshakeDataChannel.java @@ -25,7 +25,7 @@ package org.spongepowered.api.network.channel.raw.handshake; import org.spongepowered.api.network.EngineConnection; -import org.spongepowered.api.network.EngineConnectionSide; +import org.spongepowered.api.network.EngineConnectionState; import org.spongepowered.api.network.channel.ChannelBuf; import org.spongepowered.api.network.channel.NoResponseException; import org.spongepowered.api.network.channel.raw.RawDataChannel; @@ -46,23 +46,14 @@ public interface RawHandshakeDataChannel { */ RawDataChannel parent(); - /** - * Sets the {@link RawHandshakeDataRequestHandler} on the given connection side. - * - * @param side The connection side the handler should be set on - * @param handler The handler to set - * @param The connection type - */ - void setRequestHandler(EngineConnectionSide side, RawHandshakeDataRequestHandler handler); - /** * Sets the {@link RawHandshakeDataRequestHandler} for the given connection type. * - * @param connectionType The connection type the handler should be used by + * @param connectionState The connection state the handler should be used by * @param handler The handler to set - * @param The connection type + * @param The connection state */ - void setRequestHandler(Class connectionType, RawHandshakeDataRequestHandler handler); + void setRequestHandler(Class connectionState, RawHandshakeDataRequestHandler handler); /** * Sets the {@link RawHandshakeDataRequestHandler} on the @@ -70,7 +61,7 @@ public interface RawHandshakeDataChannel { * * @param handler The handler to set */ - void setRequestHandler(RawHandshakeDataRequestHandler handler); + void setRequestHandler(RawHandshakeDataRequestHandler handler); /** * Sends a request message {@link ChannelBuf} to diff --git a/src/main/java/org/spongepowered/api/network/channel/raw/handshake/RawHandshakeDataRequestHandler.java b/src/main/java/org/spongepowered/api/network/channel/raw/handshake/RawHandshakeDataRequestHandler.java index 898ecb7a6fc..d200dae08a0 100644 --- a/src/main/java/org/spongepowered/api/network/channel/raw/handshake/RawHandshakeDataRequestHandler.java +++ b/src/main/java/org/spongepowered/api/network/channel/raw/handshake/RawHandshakeDataRequestHandler.java @@ -25,16 +25,17 @@ package org.spongepowered.api.network.channel.raw.handshake; import org.spongepowered.api.network.EngineConnection; +import org.spongepowered.api.network.EngineConnectionState; import org.spongepowered.api.network.channel.ChannelBuf; import org.spongepowered.api.network.channel.NoResponseException; /** * Handles a raw handshake data request. * - * @param The connection type + * @param The connection state */ @FunctionalInterface -public interface RawHandshakeDataRequestHandler { +public interface RawHandshakeDataRequestHandler { /** * Handles the request data {@link ChannelBuf} for the given @@ -50,8 +51,8 @@ public interface RawHandshakeDataRequestHandler { * take minutes.

* * @param request The request channel buf - * @param connection The connection that received the request data + * @param state The state that received the request data * @param response The response which should be completed */ - void handleRequest(ChannelBuf request, C connection, RawHandshakeDataRequestResponse response); + void handleRequest(ChannelBuf request, S state, RawHandshakeDataRequestResponse response); } diff --git a/src/main/java/org/spongepowered/api/network/channel/raw/play/RawPlayDataChannel.java b/src/main/java/org/spongepowered/api/network/channel/raw/play/RawPlayDataChannel.java index b34fa2da434..4f0a52be09d 100644 --- a/src/main/java/org/spongepowered/api/network/channel/raw/play/RawPlayDataChannel.java +++ b/src/main/java/org/spongepowered/api/network/channel/raw/play/RawPlayDataChannel.java @@ -27,7 +27,7 @@ import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.network.EngineConnection; -import org.spongepowered.api.network.EngineConnectionSide; +import org.spongepowered.api.network.EngineConnectionState; import org.spongepowered.api.network.channel.ChannelBuf; import org.spongepowered.api.network.channel.packet.Packet; import org.spongepowered.api.network.channel.packet.PacketChannel; @@ -71,45 +71,26 @@ public interface RawPlayDataChannel { * * @param handler The handler */ - void addHandler(RawPlayDataHandler handler); + void addHandler(RawPlayDataHandler handler); /** * Adds a listener to this channel that is invoked every time data is * sent to it on the given connection side. * - * @param side The connection side the data will be handled for + * @param connectionState The connection state the data will be handled for * @param handler The handler - * @param The connection type + * @param The connection state */ - void addHandler(EngineConnectionSide side, RawPlayDataHandler handler); - - /** - * Adds a listener to this channel that is invoked every time data is - * sent to it on the given connection side. - * - * @param connectionType The connection type the data will be handled for - * @param handler The handler - * @param The connection type - */ - void addHandler(Class connectionType, RawPlayDataHandler handler); - - /** - * Removes the handler from handling data. - * - * @param side The side to remove the handler from - * @param handler The handler - * @param The connection type - */ - void removeHandler(EngineConnectionSide side, RawPlayDataHandler handler); + void addHandler(Class connectionState, RawPlayDataHandler handler); /** * Removes the handler from handling data. * - * @param connectionType The connection type to remove the handler from + * @param connectionState The connection state to remove the handler from * @param handler The handler - * @param The connection type + * @param The connection state */ - void removeHandler(Class connectionType, RawPlayDataHandler handler); + void removeHandler(Class connectionState, RawPlayDataHandler handler); /** * Removes the handler from handling data. diff --git a/src/main/java/org/spongepowered/api/network/channel/raw/play/RawPlayDataHandler.java b/src/main/java/org/spongepowered/api/network/channel/raw/play/RawPlayDataHandler.java index f2cc50f38f2..81bbe219f1a 100644 --- a/src/main/java/org/spongepowered/api/network/channel/raw/play/RawPlayDataHandler.java +++ b/src/main/java/org/spongepowered/api/network/channel/raw/play/RawPlayDataHandler.java @@ -24,22 +24,22 @@ */ package org.spongepowered.api.network.channel.raw.play; -import org.spongepowered.api.network.EngineConnection; +import org.spongepowered.api.network.EngineConnectionState; import org.spongepowered.api.network.channel.ChannelBuf; /** * Represents a listener for data being sent to a raw channel. * - * @param The connection type + * @param The connection state */ @FunctionalInterface -public interface RawPlayDataHandler { +public interface RawPlayDataHandler { /** * Handles the given {@link ChannelBuf} data sent by a remote connection. * * @param data The raw data - * @param connection The remote connection + * @param state The remote state */ - void handlePayload(ChannelBuf data, C connection); + void handlePayload(ChannelBuf data, S state); } diff --git a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java index 0988ad0d9f0..ad1d2d97243 100644 --- a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java +++ b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java @@ -77,6 +77,7 @@ import org.spongepowered.api.data.type.PistonType; import org.spongepowered.api.data.type.PortionType; import org.spongepowered.api.data.type.ProfessionType; +import org.spongepowered.api.data.type.PushReaction; import org.spongepowered.api.data.type.RabbitType; import org.spongepowered.api.data.type.RaidStatus; import org.spongepowered.api.data.type.RailDirection; @@ -87,7 +88,9 @@ import org.spongepowered.api.data.type.StairShape; import org.spongepowered.api.data.type.StructureMode; import org.spongepowered.api.data.type.Tilt; +import org.spongepowered.api.data.type.TrialSpawnerState; import org.spongepowered.api.data.type.TropicalFishShape; +import org.spongepowered.api.data.type.VaultState; import org.spongepowered.api.data.type.VillagerType; import org.spongepowered.api.data.type.WallConnectionState; import org.spongepowered.api.data.type.WireAttachmentType; @@ -196,6 +199,8 @@ public final class RegistryTypes { public static final DefaultedRegistryType ART_TYPE = RegistryTypes.minecraftKeyInGame("painting_variant"); + public static final DefaultedRegistryType ARMOR_MATERIAL = RegistryTypes.minecraftKeyInGame("armor_material"); + public static final DefaultedRegistryType ATTRIBUTE_TYPE = RegistryTypes.minecraftKeyInGame("attribute"); public static final DefaultedRegistryType BIOME = RegistryTypes.minecraftKeyInServer("worldgen/biome"); @@ -232,6 +237,8 @@ public final class RegistryTypes { public static final DefaultedRegistryType JIGSAW_POOL = RegistryTypes.minecraftKeyInServer("worldgen/template_pool"); + public static final DefaultedRegistryType MAP_DECORATION_TYPE = RegistryTypes.minecraftKeyInGame("map_decoration_type"); + public static final DefaultedRegistryType NOISE_GENERATOR_CONFIG = RegistryTypes.minecraftKeyInServer("worldgen/noise_settings"); public static final DefaultedRegistryType NOISE = RegistryTypes.minecraftKeyInServer("worldgen/noise"); @@ -250,6 +257,8 @@ public final class RegistryTypes { public static final DefaultedRegistryType PROFESSION_TYPE = RegistryTypes.minecraftKeyInGame("villager_profession"); + public static final DefaultedRegistryType PUSH_REACTION = RegistryTypes.spongeKeyInGame("push_reaction"); + public static final DefaultedRegistryType POTION_TYPE = RegistryTypes.minecraftKeyInGame("potion"); public static final DefaultedRegistryType> RECIPE_TYPE = RegistryTypes.minecraftKeyInGame("recipe_type"); @@ -278,7 +287,6 @@ public final class RegistryTypes { public static final DefaultedRegistryType ADVANCEMENT_TYPE = RegistryTypes.spongeKeyInGame("advancement_type"); - public static final DefaultedRegistryType ARMOR_MATERIAL = RegistryTypes.spongeKeyInGame("armor_material"); public static final DefaultedRegistryType ATTACHMENT_SURFACE = RegistryTypes.spongeKeyInGame("attachment_surface"); @@ -400,8 +408,6 @@ public final class RegistryTypes { public static final DefaultedRegistryType MAP_DECORATION_ORIENTATION = RegistryTypes.spongeKeyInGame("map_decoration_orientation"); - public static final DefaultedRegistryType MAP_DECORATION_TYPE = RegistryTypes.spongeKeyInGame("map_decoration_type"); - public static final DefaultedRegistryType MAP_SHADE = RegistryTypes.spongeKeyInGame("map_shade"); public static final DefaultedRegistryType MATTER_TYPE = RegistryTypes.spongeKeyInGame("matter_type"); @@ -492,10 +498,14 @@ public final class RegistryTypes { public static final DefaultedRegistryType TRANSACTION_TYPE = RegistryTypes.spongeKeyInGame("transaction_type"); + public static final DefaultedRegistryType TRIAL_SPAWNER_STATE = RegistryTypes.spongeKeyInGame("trial_spawner_state"); + public static final DefaultedRegistryType TROPICAL_FISH_SHAPE = RegistryTypes.spongeKeyInGame("tropical_fish_shape"); public static final DefaultedRegistryType TILT = RegistryTypes.spongeKeyInGame("tilt"); + public static final RegistryType VAULT_STATE = RegistryTypes.spongeKeyInGame("vault_state"); + public static final DefaultedRegistryType VISIBILITY = RegistryTypes.spongeKeyInGame("visibility"); public static final DefaultedRegistryType WALL_CONNECTION_STATE = RegistryTypes.spongeKeyInGame("wall_connection_state"); diff --git a/src/main/java/org/spongepowered/api/resourcepack/ResourcePack.java b/src/main/java/org/spongepowered/api/resourcepack/ResourcePack.java deleted file mode 100644 index 8dedd7d3131..00000000000 --- a/src/main/java/org/spongepowered/api/resourcepack/ResourcePack.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This file is part of SpongeAPI, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * 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.resourcepack; - -import net.kyori.adventure.text.Component; -import org.spongepowered.api.Sponge; - -import java.io.FileNotFoundException; -import java.net.URI; -import java.util.Optional; - -/** - * Represents a resource pack that can be sent to the client. - */ -public interface ResourcePack { - - /** - * Creates a {@link ResourcePack} from a URI and tries to download and hash - * it. - * - * @param uri The URI to look in - * @return A ResourcePack with the specified URI - * @throws FileNotFoundException If a valid resource pack could not be - * downloaded from the URI - */ - static ResourcePack fromUri(URI uri) throws FileNotFoundException { - return Sponge.game().factoryProvider().provide(Factory.class).fromUri(uri); - } - - /** - * Creates a {@link ResourcePack} from a URI, without checking ("unchecked") - * if there is a valid pack at the URI. - * - * @param uri The URI to look in - * @return A ResourcePack with the specified URI - */ - static ResourcePack fromUriUnchecked(URI uri) { - return Sponge.game().factoryProvider().provide(Factory.class).fromUriUnchecked(uri); - } - - /** - * Gets the URI associated with this resource pack. - * - * @return The URI associated with this resource pack. - */ - URI uri(); - - /** - * Gets the name of this resource pack. This is the filename of the pack - * zip file, with all non-word characters removed. Note to implementers: The - * name MUST be calculated like above, or this API will not - * work. - * - * @return The name of this resource pack. This is the filename of the pack - * .zip, with all non-word characters removed - */ - String name(); - - /** - * Gets the ID of this resource pack. - * - * @return the ID of this resource pack - */ - String id(); - - /** - * Gets the prompt of this resource pack. - * - * @return the prompt of this resource pack - */ - Component prompt(); - - /** - * Gets the hash of this resource pack. - * - * @return The hash of this pack, if present - */ - Optional hash(); - - interface Factory { - - ResourcePack fromUri(URI uri) throws FileNotFoundException; - - ResourcePack fromUriUnchecked(URI uri); - } -} diff --git a/src/main/java/org/spongepowered/api/state/BooleanStateProperties.java b/src/main/java/org/spongepowered/api/state/BooleanStateProperties.java index b4a2ac6d295..266edcd50fc 100644 --- a/src/main/java/org/spongepowered/api/state/BooleanStateProperties.java +++ b/src/main/java/org/spongepowered/api/state/BooleanStateProperties.java @@ -165,6 +165,10 @@ public static BooleanStateProperty property_OCCUPIED() { return BooleanStateProperty.of("OCCUPIED"); } + public static BooleanStateProperty property_OMINOUS() { + return BooleanStateProperty.of("OMINOUS"); + } + public static BooleanStateProperty property_OPEN() { return BooleanStateProperty.of("OPEN"); } diff --git a/src/main/java/org/spongepowered/api/state/EnumStateProperties.java b/src/main/java/org/spongepowered/api/state/EnumStateProperties.java index 7abe48745ba..8cdaa8c716e 100644 --- a/src/main/java/org/spongepowered/api/state/EnumStateProperties.java +++ b/src/main/java/org/spongepowered/api/state/EnumStateProperties.java @@ -41,6 +41,8 @@ import org.spongepowered.api.data.type.StairShape; import org.spongepowered.api.data.type.StructureMode; import org.spongepowered.api.data.type.Tilt; +import org.spongepowered.api.data.type.TrialSpawnerState; +import org.spongepowered.api.data.type.VaultState; import org.spongepowered.api.data.type.WallConnectionState; import org.spongepowered.api.data.type.WireAttachmentType; import org.spongepowered.api.util.Axis; @@ -179,10 +181,14 @@ public static EnumStateProperty property_TILT() { return EnumStateProperty.of("TILT"); } - public static EnumStateProperty property_TRIAL_SPAWNER_STATE() { + public static EnumStateProperty property_TRIAL_SPAWNER_STATE() { return EnumStateProperty.of("TRIAL_SPAWNER_STATE"); } + public static EnumStateProperty property_VAULT_STATE() { + return EnumStateProperty.of("VAULT_STATE"); + } + public static EnumStateProperty property_VERTICAL_DIRECTION() { return EnumStateProperty.of("VERTICAL_DIRECTION"); } diff --git a/src/main/java/org/spongepowered/api/state/EnumStateProperty.java b/src/main/java/org/spongepowered/api/state/EnumStateProperty.java index 3b3679f0cad..5d5fb69431b 100644 --- a/src/main/java/org/spongepowered/api/state/EnumStateProperty.java +++ b/src/main/java/org/spongepowered/api/state/EnumStateProperty.java @@ -25,6 +25,7 @@ package org.spongepowered.api.state; import org.spongepowered.api.Sponge; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.util.annotation.CatalogedBy; /** @@ -33,14 +34,14 @@ * may not be exposed in the API. */ @CatalogedBy(EnumStateProperties.class) -public interface EnumStateProperty> extends StateProperty { +public interface EnumStateProperty & StringRepresentable> extends StateProperty { - static > EnumStateProperty of(String name) { + static & StringRepresentable> EnumStateProperty of(String name) { return Sponge.game().factoryProvider().provide(Factory.class).of(name); } interface Factory { - > EnumStateProperty of(String name); + & StringRepresentable> EnumStateProperty of(String name); } } diff --git a/src/main/java/org/spongepowered/api/tag/BlockTypeTags.java b/src/main/java/org/spongepowered/api/tag/BlockTypeTags.java index 28fcab92998..7bf2a75ece6 100644 --- a/src/main/java/org/spongepowered/api/tag/BlockTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/BlockTypeTags.java @@ -49,12 +49,16 @@ public final class BlockTypeTags { public static final Tag ANVIL = BlockTypeTags.key(ResourceKey.minecraft("anvil")); + public static final Tag ARMADILLO_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("armadillo_spawnable_on")); + public static final Tag AXOLOTLS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("axolotls_spawnable_on")); public static final Tag AZALEA_GROWS_ON = BlockTypeTags.key(ResourceKey.minecraft("azalea_grows_on")); public static final Tag AZALEA_ROOT_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("azalea_root_replaceable")); + public static final Tag BADLANDS_TERRACOTTA = BlockTypeTags.key(ResourceKey.minecraft("badlands_terracotta")); + public static final Tag BAMBOO_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("bamboo_blocks")); public static final Tag BAMBOO_PLANTABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("bamboo_plantable_on")); @@ -133,6 +137,8 @@ public final class BlockTypeTags { public static final Tag DIRT = BlockTypeTags.key(ResourceKey.minecraft("dirt")); + public static final Tag DOES_NOT_BLOCK_HOPPERS = BlockTypeTags.key(ResourceKey.minecraft("does_not_block_hoppers")); + public static final Tag DOORS = BlockTypeTags.key(ResourceKey.minecraft("doors")); public static final Tag DRAGON_IMMUNE = BlockTypeTags.key(ResourceKey.minecraft("dragon_immune")); @@ -183,6 +189,18 @@ public final class BlockTypeTags { public static final Tag IMPERMEABLE = BlockTypeTags.key(ResourceKey.minecraft("impermeable")); + public static final Tag INCORRECT_FOR_DIAMOND_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_diamond_tool")); + + public static final Tag INCORRECT_FOR_GOLD_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_gold_tool")); + + public static final Tag INCORRECT_FOR_IRON_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_iron_tool")); + + public static final Tag INCORRECT_FOR_NETHERITE_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_netherite_tool")); + + public static final Tag INCORRECT_FOR_STONE_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_stone_tool")); + + public static final Tag INCORRECT_FOR_WOODEN_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_wooden_tool")); + public static final Tag INFINIBURN_END = BlockTypeTags.key(ResourceKey.minecraft("infiniburn_end")); public static final Tag INFINIBURN_NETHER = BlockTypeTags.key(ResourceKey.minecraft("infiniburn_nether")); diff --git a/src/main/java/org/spongepowered/api/tag/DamageTypeTags.java b/src/main/java/org/spongepowered/api/tag/DamageTypeTags.java index e402deac3fa..40c191a4c71 100644 --- a/src/main/java/org/spongepowered/api/tag/DamageTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/DamageTypeTags.java @@ -61,6 +61,8 @@ public final class DamageTypeTags { public static final Tag BYPASSES_SHIELD = DamageTypeTags.key(ResourceKey.minecraft("bypasses_shield")); + public static final Tag BYPASSES_WOLF_ARMOR = DamageTypeTags.key(ResourceKey.minecraft("bypasses_wolf_armor")); + public static final Tag CAN_BREAK_ARMOR_STAND = DamageTypeTags.key(ResourceKey.minecraft("can_break_armor_stand")); public static final Tag DAMAGES_HELMET = DamageTypeTags.key(ResourceKey.minecraft("damages_helmet")); @@ -79,6 +81,8 @@ public final class DamageTypeTags { public static final Tag IS_LIGHTNING = DamageTypeTags.key(ResourceKey.minecraft("is_lightning")); + public static final Tag IS_PLAYER_ATTACK = DamageTypeTags.key(ResourceKey.minecraft("is_player_attack")); + public static final Tag IS_PROJECTILE = DamageTypeTags.key(ResourceKey.minecraft("is_projectile")); public static final Tag NO_ANGER = DamageTypeTags.key(ResourceKey.minecraft("no_anger")); diff --git a/src/main/java/org/spongepowered/api/tag/EntityTypeTags.java b/src/main/java/org/spongepowered/api/tag/EntityTypeTags.java index 8d218f13c73..74b7fc48047 100644 --- a/src/main/java/org/spongepowered/api/tag/EntityTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/EntityTypeTags.java @@ -37,8 +37,12 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class EntityTypeTags { + public static final Tag> AQUATIC = EntityTypeTags.key(ResourceKey.minecraft("aquatic")); + public static final Tag> ARROWS = EntityTypeTags.key(ResourceKey.minecraft("arrows")); + public static final Tag> ARTHROPOD = EntityTypeTags.key(ResourceKey.minecraft("arthropod")); + public static final Tag> AXOLOTL_ALWAYS_HOSTILES = EntityTypeTags.key(ResourceKey.minecraft("axolotl_always_hostiles")); public static final Tag> AXOLOTL_HUNT_TARGETS = EntityTypeTags.key(ResourceKey.minecraft("axolotl_hunt_targets")); @@ -57,18 +61,38 @@ public final class EntityTypeTags { public static final Tag> FROG_FOOD = EntityTypeTags.key(ResourceKey.minecraft("frog_food")); + public static final Tag> IGNORES_POISON_AND_REGEN = EntityTypeTags.key(ResourceKey.minecraft("ignores_poison_and_regen")); + + public static final Tag> ILLAGER = EntityTypeTags.key(ResourceKey.minecraft("illager")); + + public static final Tag> ILLAGER_FRIENDS = EntityTypeTags.key(ResourceKey.minecraft("illager_friends")); + public static final Tag> IMPACT_PROJECTILES = EntityTypeTags.key(ResourceKey.minecraft("impact_projectiles")); + public static final Tag> INVERTED_HEALING_AND_HARM = EntityTypeTags.key(ResourceKey.minecraft("inverted_healing_and_harm")); + public static final Tag> NON_CONTROLLING_RIDER = EntityTypeTags.key(ResourceKey.minecraft("non_controlling_rider")); + public static final Tag> NOT_SCARY_FOR_PUFFERFISH = EntityTypeTags.key(ResourceKey.minecraft("not_scary_for_pufferfish")); + public static final Tag> POWDER_SNOW_WALKABLE_MOBS = EntityTypeTags.key(ResourceKey.minecraft("powder_snow_walkable_mobs")); public static final Tag> RAIDERS = EntityTypeTags.key(ResourceKey.minecraft("raiders")); + public static final Tag> REDIRECTABLE_PROJECTILE = EntityTypeTags.key(ResourceKey.minecraft("redirectable_projectile")); + + public static final Tag> SENSITIVE_TO_BANE_OF_ARTHROPODS = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_bane_of_arthropods")); + + public static final Tag> SENSITIVE_TO_IMPALING = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_impaling")); + + public static final Tag> SENSITIVE_TO_SMITE = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_smite")); + public static final Tag> SKELETONS = EntityTypeTags.key(ResourceKey.minecraft("skeletons")); public static final Tag> UNDEAD = EntityTypeTags.key(ResourceKey.minecraft("undead")); + public static final Tag> WITHER_FRIENDS = EntityTypeTags.key(ResourceKey.minecraft("wither_friends")); + public static final Tag> ZOMBIES = EntityTypeTags.key(ResourceKey.minecraft("zombies")); private EntityTypeTags() { diff --git a/src/main/java/org/spongepowered/api/tag/ItemTypeTags.java b/src/main/java/org/spongepowered/api/tag/ItemTypeTags.java index 45a52903471..8d9478114b1 100644 --- a/src/main/java/org/spongepowered/api/tag/ItemTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/ItemTypeTags.java @@ -41,11 +41,13 @@ public final class ItemTypeTags { public static final Tag ANVIL = ItemTypeTags.key(ResourceKey.minecraft("anvil")); + public static final Tag ARMADILLO_FOOD = ItemTypeTags.key(ResourceKey.minecraft("armadillo_food")); + public static final Tag ARROWS = ItemTypeTags.key(ResourceKey.minecraft("arrows")); public static final Tag AXES = ItemTypeTags.key(ResourceKey.minecraft("axes")); - public static final Tag AXOLOTL_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("axolotl_tempt_items")); + public static final Tag AXOLOTL_FOOD = ItemTypeTags.key(ResourceKey.minecraft("axolotl_food")); public static final Tag BAMBOO_BLOCKS = ItemTypeTags.key(ResourceKey.minecraft("bamboo_blocks")); @@ -55,6 +57,8 @@ public final class ItemTypeTags { public static final Tag BEDS = ItemTypeTags.key(ResourceKey.minecraft("beds")); + public static final Tag BEE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("bee_food")); + public static final Tag BIRCH_LOGS = ItemTypeTags.key(ResourceKey.minecraft("birch_logs")); public static final Tag BOATS = ItemTypeTags.key(ResourceKey.minecraft("boats")); @@ -65,12 +69,20 @@ public final class ItemTypeTags { public static final Tag BUTTONS = ItemTypeTags.key(ResourceKey.minecraft("buttons")); + public static final Tag CAMEL_FOOD = ItemTypeTags.key(ResourceKey.minecraft("camel_food")); + public static final Tag CANDLES = ItemTypeTags.key(ResourceKey.minecraft("candles")); + public static final Tag CAT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("cat_food")); + public static final Tag CHERRY_LOGS = ItemTypeTags.key(ResourceKey.minecraft("cherry_logs")); + public static final Tag CHEST_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("chest_armor")); + public static final Tag CHEST_BOATS = ItemTypeTags.key(ResourceKey.minecraft("chest_boats")); + public static final Tag CHICKEN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("chicken_food")); + public static final Tag CLUSTER_MAX_HARVESTABLES = ItemTypeTags.key(ResourceKey.minecraft("cluster_max_harvestables")); public static final Tag COAL_ORES = ItemTypeTags.key(ResourceKey.minecraft("coal_ores")); @@ -83,6 +95,8 @@ public final class ItemTypeTags { public static final Tag COPPER_ORES = ItemTypeTags.key(ResourceKey.minecraft("copper_ores")); + public static final Tag COW_FOOD = ItemTypeTags.key(ResourceKey.minecraft("cow_food")); + public static final Tag CREEPER_DROP_MUSIC_DISCS = ItemTypeTags.key(ResourceKey.minecraft("creeper_drop_music_discs")); public static final Tag CREEPER_IGNITERS = ItemTypeTags.key(ResourceKey.minecraft("creeper_igniters")); @@ -103,8 +117,46 @@ public final class ItemTypeTags { public static final Tag DOORS = ItemTypeTags.key(ResourceKey.minecraft("doors")); + public static final Tag DYEABLE = ItemTypeTags.key(ResourceKey.minecraft("dyeable")); + public static final Tag EMERALD_ORES = ItemTypeTags.key(ResourceKey.minecraft("emerald_ores")); + public static final Tag ENCHANTABLE_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/armor")); + + public static final Tag ENCHANTABLE_BOW = ItemTypeTags.key(ResourceKey.minecraft("enchantable/bow")); + + public static final Tag ENCHANTABLE_CHEST_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/chest_armor")); + + public static final Tag ENCHANTABLE_CROSSBOW = ItemTypeTags.key(ResourceKey.minecraft("enchantable/crossbow")); + + public static final Tag ENCHANTABLE_DURABILITY = ItemTypeTags.key(ResourceKey.minecraft("enchantable/durability")); + + public static final Tag ENCHANTABLE_EQUIPPABLE = ItemTypeTags.key(ResourceKey.minecraft("enchantable/equippable")); + + public static final Tag ENCHANTABLE_FIRE_ASPECT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/fire_aspect")); + + public static final Tag ENCHANTABLE_FISHING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/fishing")); + + public static final Tag ENCHANTABLE_FOOT_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/foot_armor")); + + public static final Tag ENCHANTABLE_HEAD_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/head_armor")); + + public static final Tag ENCHANTABLE_LEG_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/leg_armor")); + + public static final Tag ENCHANTABLE_MINING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/mining")); + + public static final Tag ENCHANTABLE_MINING_LOOT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/mining_loot")); + + public static final Tag ENCHANTABLE_SHARP_WEAPON = ItemTypeTags.key(ResourceKey.minecraft("enchantable/sharp_weapon")); + + public static final Tag ENCHANTABLE_SWORD = ItemTypeTags.key(ResourceKey.minecraft("enchantable/sword")); + + public static final Tag ENCHANTABLE_TRIDENT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/trident")); + + public static final Tag ENCHANTABLE_VANISHING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/vanishing")); + + public static final Tag ENCHANTABLE_WEAPON = ItemTypeTags.key(ResourceKey.minecraft("enchantable/weapon")); + public static final Tag FENCE_GATES = ItemTypeTags.key(ResourceKey.minecraft("fence_gates")); public static final Tag FENCES = ItemTypeTags.key(ResourceKey.minecraft("fences")); @@ -113,16 +165,30 @@ public final class ItemTypeTags { public static final Tag FLOWERS = ItemTypeTags.key(ResourceKey.minecraft("flowers")); + public static final Tag FOOT_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("foot_armor")); + public static final Tag FOX_FOOD = ItemTypeTags.key(ResourceKey.minecraft("fox_food")); public static final Tag FREEZE_IMMUNE_WEARABLES = ItemTypeTags.key(ResourceKey.minecraft("freeze_immune_wearables")); + public static final Tag FROG_FOOD = ItemTypeTags.key(ResourceKey.minecraft("frog_food")); + + public static final Tag GOAT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("goat_food")); + public static final Tag GOLD_ORES = ItemTypeTags.key(ResourceKey.minecraft("gold_ores")); public static final Tag HANGING_SIGNS = ItemTypeTags.key(ResourceKey.minecraft("hanging_signs")); + public static final Tag HEAD_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("head_armor")); + public static final Tag HOES = ItemTypeTags.key(ResourceKey.minecraft("hoes")); + public static final Tag HOGLIN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("hoglin_food")); + + public static final Tag HORSE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("horse_food")); + + public static final Tag HORSE_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("horse_tempt_items")); + public static final Tag IGNORED_BY_PIGLIN_BABIES = ItemTypeTags.key(ResourceKey.minecraft("ignored_by_piglin_babies")); public static final Tag IRON_ORES = ItemTypeTags.key(ResourceKey.minecraft("iron_ores")); @@ -135,12 +201,20 @@ public final class ItemTypeTags { public static final Tag LECTERN_BOOKS = ItemTypeTags.key(ResourceKey.minecraft("lectern_books")); + public static final Tag LEG_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("leg_armor")); + + public static final Tag LLAMA_FOOD = ItemTypeTags.key(ResourceKey.minecraft("llama_food")); + + public static final Tag LLAMA_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("llama_tempt_items")); + public static final Tag LOGS = ItemTypeTags.key(ResourceKey.minecraft("logs")); public static final Tag LOGS_THAT_BURN = ItemTypeTags.key(ResourceKey.minecraft("logs_that_burn")); public static final Tag MANGROVE_LOGS = ItemTypeTags.key(ResourceKey.minecraft("mangrove_logs")); + public static final Tag MEAT = ItemTypeTags.key(ResourceKey.minecraft("meat")); + public static final Tag MUSIC_DISCS = ItemTypeTags.key(ResourceKey.minecraft("music_discs")); public static final Tag NON_FLAMMABLE_WOOD = ItemTypeTags.key(ResourceKey.minecraft("non_flammable_wood")); @@ -149,8 +223,18 @@ public final class ItemTypeTags { public static final Tag OAK_LOGS = ItemTypeTags.key(ResourceKey.minecraft("oak_logs")); + public static final Tag OCELOT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("ocelot_food")); + + public static final Tag PANDA_FOOD = ItemTypeTags.key(ResourceKey.minecraft("panda_food")); + + public static final Tag PARROT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("parrot_food")); + + public static final Tag PARROT_POISONOUS_FOOD = ItemTypeTags.key(ResourceKey.minecraft("parrot_poisonous_food")); + public static final Tag PICKAXES = ItemTypeTags.key(ResourceKey.minecraft("pickaxes")); + public static final Tag PIG_FOOD = ItemTypeTags.key(ResourceKey.minecraft("pig_food")); + public static final Tag PIGLIN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("piglin_food")); public static final Tag PIGLIN_LOVED = ItemTypeTags.key(ResourceKey.minecraft("piglin_loved")); @@ -159,6 +243,8 @@ public final class ItemTypeTags { public static final Tag PLANKS = ItemTypeTags.key(ResourceKey.minecraft("planks")); + public static final Tag RABBIT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("rabbit_food")); + public static final Tag RAILS = ItemTypeTags.key(ResourceKey.minecraft("rails")); public static final Tag REDSTONE_ORES = ItemTypeTags.key(ResourceKey.minecraft("redstone_ores")); @@ -167,10 +253,14 @@ public final class ItemTypeTags { public static final Tag SAPLINGS = ItemTypeTags.key(ResourceKey.minecraft("saplings")); + public static final Tag SHEEP_FOOD = ItemTypeTags.key(ResourceKey.minecraft("sheep_food")); + public static final Tag SHOVELS = ItemTypeTags.key(ResourceKey.minecraft("shovels")); public static final Tag SIGNS = ItemTypeTags.key(ResourceKey.minecraft("signs")); + public static final Tag SKULLS = ItemTypeTags.key(ResourceKey.minecraft("skulls")); + public static final Tag SLABS = ItemTypeTags.key(ResourceKey.minecraft("slabs")); public static final Tag SMALL_FLOWERS = ItemTypeTags.key(ResourceKey.minecraft("small_flowers")); @@ -193,14 +283,16 @@ public final class ItemTypeTags { public static final Tag STONE_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("stone_tool_materials")); + public static final Tag STRIDER_FOOD = ItemTypeTags.key(ResourceKey.minecraft("strider_food")); + + public static final Tag STRIDER_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("strider_tempt_items")); + public static final Tag SWORDS = ItemTypeTags.key(ResourceKey.minecraft("swords")); public static final Tag TALL_FLOWERS = ItemTypeTags.key(ResourceKey.minecraft("tall_flowers")); public static final Tag TERRACOTTA = ItemTypeTags.key(ResourceKey.minecraft("terracotta")); - public static final Tag TOOLS = ItemTypeTags.key(ResourceKey.minecraft("tools")); - public static final Tag TRAPDOORS = ItemTypeTags.key(ResourceKey.minecraft("trapdoors")); public static final Tag TRIM_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("trim_materials")); @@ -209,6 +301,8 @@ public final class ItemTypeTags { public static final Tag TRIMMABLE_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("trimmable_armor")); + public static final Tag TURTLE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("turtle_food")); + public static final Tag VILLAGER_PLANTABLE_SEEDS = ItemTypeTags.key(ResourceKey.minecraft("villager_plantable_seeds")); public static final Tag WALLS = ItemTypeTags.key(ResourceKey.minecraft("walls")); @@ -217,6 +311,8 @@ public final class ItemTypeTags { public static final Tag WART_BLOCKS = ItemTypeTags.key(ResourceKey.minecraft("wart_blocks")); + public static final Tag WOLF_FOOD = ItemTypeTags.key(ResourceKey.minecraft("wolf_food")); + public static final Tag WOODEN_BUTTONS = ItemTypeTags.key(ResourceKey.minecraft("wooden_buttons")); public static final Tag WOODEN_DOORS = ItemTypeTags.key(ResourceKey.minecraft("wooden_doors")); diff --git a/src/main/java/org/spongepowered/api/util/Axis.java b/src/main/java/org/spongepowered/api/util/Axis.java index 1c569851b79..4537059c7ae 100644 --- a/src/main/java/org/spongepowered/api/util/Axis.java +++ b/src/main/java/org/spongepowered/api/util/Axis.java @@ -24,12 +24,13 @@ */ package org.spongepowered.api.util; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.math.vector.Vector3d; /** * Represents a three dimensional cartesian axis. */ -public enum Axis implements Cycleable { +public enum Axis implements Cycleable, StringRepresentable { X(new Vector3d(1, 0, 0)), Y(new Vector3d(0, 1, 0)), @@ -142,4 +143,10 @@ public Axis cycleNext() { } return Axis.X; } + + @Override + public String serializationString() { + return this.name(); + } + } diff --git a/src/main/java/org/spongepowered/api/util/Direction.java b/src/main/java/org/spongepowered/api/util/Direction.java index f88bfa412a1..7ffc7dc87b4 100644 --- a/src/main/java/org/spongepowered/api/util/Direction.java +++ b/src/main/java/org/spongepowered/api/util/Direction.java @@ -25,6 +25,7 @@ package org.spongepowered.api.util; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.math.GenericMath; import org.spongepowered.math.TrigMath; import org.spongepowered.math.vector.Vector3d; @@ -42,7 +43,7 @@ *
  • {@link #DOWN} targeting towards -Y
  • * */ -public enum Direction { +public enum Direction implements StringRepresentable { NORTH(new Vector3d(0, 0, -1), Division.CARDINAL), NORTH_NORTHEAST(new Vector3d(C.S8, 0, -C.C8), Division.SECONDARY_ORDINAL), NORTHEAST(new Vector3d(1, 0, -1), Division.ORDINAL), @@ -341,6 +342,11 @@ public Vector3i asBlockOffset() { return this.blockOffset; } + @Override + public String serializationString() { + return this.name(); + } + private interface C { double C8 = Math.cos(Math.PI / 8); diff --git a/src/main/java/org/spongepowered/api/util/locale/Locales.java b/src/main/java/org/spongepowered/api/util/locale/Locales.java index 67e49cb4c86..d6ac4b3a341 100644 --- a/src/main/java/org/spongepowered/api/util/locale/Locales.java +++ b/src/main/java/org/spongepowered/api/util/locale/Locales.java @@ -43,79 +43,79 @@ public static Locale of(String locale) { return Sponge.game().locale(locale); } - public static final Locale AF_ZA = new Locale("af", "ZA"); - public static final Locale AR_SA = new Locale("ar", "SA"); - public static final Locale AST_ES = new Locale("ast", "ES"); - public static final Locale AZ_AZ = new Locale("az", "AZ"); - public static final Locale BG_BG = new Locale("bg", "BG"); - public static final Locale CA_ES = new Locale("ca", "ES"); - public static final Locale CS_CZ = new Locale("cs", "CZ"); - public static final Locale CY_GB = new Locale("cy", "GB"); - public static final Locale DA_DK = new Locale("da", "DK"); + public static final Locale AF_ZA = Locale.of("af", "ZA"); + public static final Locale AR_SA = Locale.of("ar", "SA"); + public static final Locale AST_ES = Locale.of("ast", "ES"); + public static final Locale AZ_AZ = Locale.of("az", "AZ"); + public static final Locale BG_BG = Locale.of("bg", "BG"); + public static final Locale CA_ES = Locale.of("ca", "ES"); + public static final Locale CS_CZ = Locale.of("cs", "CZ"); + public static final Locale CY_GB = Locale.of("cy", "GB"); + public static final Locale DA_DK = Locale.of("da", "DK"); public static final Locale DE_DE = Locale.GERMANY; - public static final Locale EL_GR = new Locale("el", "GR"); - public static final Locale EN_AU = new Locale("en", "AU"); - public static final Locale EN_CA = new Locale("en", "CA"); + public static final Locale EL_GR = Locale.of("el", "GR"); + public static final Locale EN_AU = Locale.of("en", "AU"); + public static final Locale EN_CA = Locale.of("en", "CA"); public static final Locale EN_GB = Locale.UK; - public static final Locale EN_PT = new Locale("en", "PT"); + public static final Locale EN_PT = Locale.of("en", "PT"); public static final Locale EN_US = Locale.US; - public static final Locale EO_UY = new Locale("eo", "UY"); - public static final Locale ES_AR = new Locale("es", "AR"); - public static final Locale ES_ES = new Locale("es", "ES"); - public static final Locale ES_MX = new Locale("es", "MX"); - public static final Locale ES_UY = new Locale("es", "UY"); - public static final Locale ES_VE = new Locale("es", "VE"); - public static final Locale ET_EE = new Locale("et", "EE"); - public static final Locale EU_ES = new Locale("eu", "ES"); - public static final Locale FA_IR = new Locale("fa", "IR"); - public static final Locale FI_FI = new Locale("fi", "FI"); - public static final Locale FIL_PH = new Locale("fil", "PH"); + public static final Locale EO_UY = Locale.of("eo", "UY"); + public static final Locale ES_AR = Locale.of("es", "AR"); + public static final Locale ES_ES = Locale.of("es", "ES"); + public static final Locale ES_MX = Locale.of("es", "MX"); + public static final Locale ES_UY = Locale.of("es", "UY"); + public static final Locale ES_VE = Locale.of("es", "VE"); + public static final Locale ET_EE = Locale.of("et", "EE"); + public static final Locale EU_ES = Locale.of("eu", "ES"); + public static final Locale FA_IR = Locale.of("fa", "IR"); + public static final Locale FI_FI = Locale.of("fi", "FI"); + public static final Locale FIL_PH = Locale.of("fil", "PH"); public static final Locale FR_CA = Locale.CANADA_FRENCH; public static final Locale FR_FR = Locale.FRANCE; - public static final Locale GA_IE = new Locale("ga", "IE"); - public static final Locale GL_ES = new Locale("gl", "ES"); - public static final Locale GV_IM = new Locale("gv", "IM"); - public static final Locale HE_IL = new Locale("he", "IL"); - public static final Locale HI_IN = new Locale("hi", "IN"); - public static final Locale HR_HR = new Locale("hr", "HR"); - public static final Locale HU_HU = new Locale("hu", "HU"); - public static final Locale HY_AM = new Locale("hy", "AM"); - public static final Locale ID_ID = new Locale("id", "ID"); - public static final Locale IS_IS = new Locale("is", "IS"); + public static final Locale GA_IE = Locale.of("ga", "IE"); + public static final Locale GL_ES = Locale.of("gl", "ES"); + public static final Locale GV_IM = Locale.of("gv", "IM"); + public static final Locale HE_IL = Locale.of("he", "IL"); + public static final Locale HI_IN = Locale.of("hi", "IN"); + public static final Locale HR_HR = Locale.of("hr", "HR"); + public static final Locale HU_HU = Locale.of("hu", "HU"); + public static final Locale HY_AM = Locale.of("hy", "AM"); + public static final Locale ID_ID = Locale.of("id", "ID"); + public static final Locale IS_IS = Locale.of("is", "IS"); public static final Locale IT_IT = Locale.ITALY; public static final Locale JA_JP = Locale.JAPAN; - public static final Locale KA_GE = new Locale("ka", "GE"); + public static final Locale KA_GE = Locale.of("ka", "GE"); public static final Locale KO_KR = Locale.KOREA; - public static final Locale KW_GB = new Locale("kw", "GB"); - public static final Locale LA_LA = new Locale("la", "LA"); - public static final Locale LB_LU = new Locale("lb", "LU"); - public static final Locale LT_LT = new Locale("lt", "LT"); - public static final Locale LV_LV = new Locale("lv", "LV"); - public static final Locale MI_NZ = new Locale("mi", "NZ"); - public static final Locale MS_MY = new Locale("ms", "MY"); - public static final Locale MT_MT = new Locale("mt", "MT"); - public static final Locale NDS_DE = new Locale("nds", "DE"); - public static final Locale NL_NL = new Locale("nl", "NL"); - public static final Locale NN_NO = new Locale("nn", "NO"); - public static final Locale NO_NO = new Locale("no", "NO"); - public static final Locale OC_FR = new Locale("oc", "FR"); - public static final Locale PL_PL = new Locale("pl", "PL"); - public static final Locale PT_BR = new Locale("pt", "BR"); - public static final Locale PT_PT = new Locale("pt", "PT"); - public static final Locale QYA_AA = new Locale("qya", "AA"); - public static final Locale RO_RO = new Locale("ro", "RO"); - public static final Locale RU_RU = new Locale("ru", "RU"); - public static final Locale SE_NO = new Locale("se", "NO"); - public static final Locale SK_SK = new Locale("sk", "SK"); - public static final Locale SL_SI = new Locale("sl", "SI"); - public static final Locale SR_SP = new Locale("sr", "SP"); - public static final Locale SV_SE = new Locale("sv", "SE"); - public static final Locale TH_TH = new Locale("th", "TH"); - public static final Locale TLH_AA = new Locale("tlh", "AA"); - public static final Locale TR_TR = new Locale("tr", "TR"); - public static final Locale UK_UA = new Locale("uk", "UA"); - public static final Locale VAL_ES = new Locale("val", "ES"); - public static final Locale VI_VN = new Locale("vi", "VN"); + public static final Locale KW_GB = Locale.of("kw", "GB"); + public static final Locale LA_LA = Locale.of("la", "LA"); + public static final Locale LB_LU = Locale.of("lb", "LU"); + public static final Locale LT_LT = Locale.of("lt", "LT"); + public static final Locale LV_LV = Locale.of("lv", "LV"); + public static final Locale MI_NZ = Locale.of("mi", "NZ"); + public static final Locale MS_MY = Locale.of("ms", "MY"); + public static final Locale MT_MT = Locale.of("mt", "MT"); + public static final Locale NDS_DE = Locale.of("nds", "DE"); + public static final Locale NL_NL = Locale.of("nl", "NL"); + public static final Locale NN_NO = Locale.of("nn", "NO"); + public static final Locale NO_NO = Locale.of("no", "NO"); + public static final Locale OC_FR = Locale.of("oc", "FR"); + public static final Locale PL_PL = Locale.of("pl", "PL"); + public static final Locale PT_BR = Locale.of("pt", "BR"); + public static final Locale PT_PT = Locale.of("pt", "PT"); + public static final Locale QYA_AA = Locale.of("qya", "AA"); + public static final Locale RO_RO = Locale.of("ro", "RO"); + public static final Locale RU_RU = Locale.of("ru", "RU"); + public static final Locale SE_NO = Locale.of("se", "NO"); + public static final Locale SK_SK = Locale.of("sk", "SK"); + public static final Locale SL_SI = Locale.of("sl", "SI"); + public static final Locale SR_SP = Locale.of("sr", "SP"); + public static final Locale SV_SE = Locale.of("sv", "SE"); + public static final Locale TH_TH = Locale.of("th", "TH"); + public static final Locale TLH_AA = Locale.of("tlh", "AA"); + public static final Locale TR_TR = Locale.of("tr", "TR"); + public static final Locale UK_UA = Locale.of("uk", "UA"); + public static final Locale VAL_ES = Locale.of("val", "ES"); + public static final Locale VI_VN = Locale.of("vi", "VN"); public static final Locale ZH_CN = Locale.SIMPLIFIED_CHINESE; public static final Locale ZH_TW = Locale.TRADITIONAL_CHINESE; diff --git a/src/main/java/org/spongepowered/api/util/weighted/NestedTableEntry.java b/src/main/java/org/spongepowered/api/util/weighted/NestedTableEntry.java index 2fc92a58b24..cf67981845c 100644 --- a/src/main/java/org/spongepowered/api/util/weighted/NestedTableEntry.java +++ b/src/main/java/org/spongepowered/api/util/weighted/NestedTableEntry.java @@ -61,6 +61,15 @@ public List get(final RandomGenerator rand) { return this.table.get(rand); } + /** + * Returns the nested table + * + * @return The nested table + */ + public RandomObjectTable getNestedTable() { + return this.table; + } + @Override public boolean equals(final Object o) { if (o == this) { diff --git a/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java b/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java index 1772e238d65..d3cfe5cb420 100644 --- a/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java +++ b/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java @@ -130,6 +130,8 @@ public final class GameRules { public static final DefaultedRegistryReference> SNOW_ACCUMULATION_HEIGHT = GameRules.key(ResourceKey.sponge("snow_accumulation_height")); + public static final DefaultedRegistryReference> SPAWN_CHUNK_RADIUS = GameRules.key(ResourceKey.sponge("spawn_chunk_radius")); + public static final DefaultedRegistryReference> SPAWN_RADIUS = GameRules.key(ResourceKey.sponge("spawn_radius")); public static final DefaultedRegistryReference> SPECTATORS_GENERATE_CHUNKS = GameRules.key(ResourceKey.sponge("spectators_generate_chunks")); diff --git a/src/main/java/org/spongepowered/api/world/server/ChunkManager.java b/src/main/java/org/spongepowered/api/world/server/ChunkManager.java index 1c8c20d48bc..9e3ebbfda52 100644 --- a/src/main/java/org/spongepowered/api/world/server/ChunkManager.java +++ b/src/main/java/org/spongepowered/api/world/server/ChunkManager.java @@ -24,7 +24,6 @@ */ package org.spongepowered.api.world.server; -import org.spongepowered.api.registry.DefaultedRegistryReference; import org.spongepowered.api.util.Ticks; import org.spongepowered.api.util.annotation.DoNotStore; import org.spongepowered.api.world.ChunkRegenerateFlag; @@ -66,38 +65,6 @@ public interface ChunkManager { */ Ticks timeLeft(Ticket ticket); - /** - * Request a {@link Ticket} for a given {@link TicketType} that supports a - * chunk position. - * - * @param type The type of ticket to request. - * @param chunkOrigin The chunk co-ordinates of the central {@link WorldChunk} - * affected by this {@link Ticket} - * @param radius The radius of the area, in chunks, that this {@link Ticket} - * affects. - * @return The ticket, if granted. - */ - default Optional> requestTicket(final DefaultedRegistryReference> type, - final Vector3i chunkOrigin, final int radius) { - return this.requestTicket(type.get(), chunkOrigin, radius); - } - - /** - * Request a {@link Ticket} for a given {@link TicketType} that supports a - * chunk position. - * - * @param type The type of ticket to request. - * @param chunkOrigin The chunk co-ordinates of the central {@link WorldChunk} - * affected by this {@link Ticket} - * @param radius The radius of the area, in chunks, that this {@link Ticket} - * affects. - * @return The ticket, if granted. - */ - default Optional> requestTicket(final TicketType type, final Vector3i chunkOrigin, - final int radius) { - return this.requestTicket(type, chunkOrigin, chunkOrigin, radius); - } - /** * Request a {@link Ticket} for the given {@link TicketType}. * @@ -112,24 +79,6 @@ default Optional> requestTicket(final TicketType type */ Optional> requestTicket(TicketType type, Vector3i chunkOrigin, T value, int radius); - /** - * Request a {@link Ticket} for the given {@link TicketType}. - * - * @param type The type of ticket to request. - * @param chunkOrigin The chunk co-ordinates of the central {@link WorldChunk} - * affected by this {@link Ticket} - * @param value The value to register the ticket with. - * @param radius The radius of the area, in chunks, that this {@link Ticket} - * affects. This may be capped - for the Vanilla impl, this is - * limited to a radius of 33 chunks. - * @param The type of the supplied {@code value}. - * @return The ticket, if granted. - */ - default Optional> requestTicket(final DefaultedRegistryReference> type, - final Vector3i chunkOrigin, final T value, final int radius) { - return this.requestTicket(type.get(), chunkOrigin, value, radius); - } - /** * Attempts to renew this ticket, resetting the lifetime to the default. * @@ -160,18 +109,6 @@ default Optional> requestTicket(final DefaultedRegistryReference Collection> findTickets(TicketType type); - /** - * Gets all currently active {@link Ticket tickets} that are of the - * provided {@link TicketType}. - * - * @param type The {@link TicketType} to retrieve tickets for - * @param The type of value the {@link Ticket} holds - * @return A {@link Collection} of {@link Ticket tickets} - */ - default Collection> findTickets(final DefaultedRegistryReference> type) { - return this.findTickets(type.get()); - } - /** * Regenerates a chunk at the given chunk coordinate position. * diff --git a/src/main/java/org/spongepowered/api/world/server/TicketType.java b/src/main/java/org/spongepowered/api/world/server/TicketType.java index 7740ddce441..f16f082d405 100644 --- a/src/main/java/org/spongepowered/api/world/server/TicketType.java +++ b/src/main/java/org/spongepowered/api/world/server/TicketType.java @@ -24,8 +24,13 @@ */ package org.spongepowered.api.world.server; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.util.ResettableBuilder; import org.spongepowered.api.util.Ticks; -import org.spongepowered.api.util.annotation.CatalogedBy; + +import java.util.Comparator; /** * Represents a type of {@link Ticket chunk loading ticket} that can be obtained @@ -34,8 +39,19 @@ * @param The type of value that is associated with a {@link Ticket} of this * type. */ -@CatalogedBy(TicketTypes.class) -public interface TicketType { +@SuppressWarnings("unchecked") +public interface TicketType { + + static Builder builder() { + return Sponge.game().builderProvider().provide(Builder.class); + } + + /** + * The name of this type. + * + * @return The name + */ + String name(); /** * Gets the lifetime of any {@link Ticket tickets} of this type. @@ -45,4 +61,41 @@ public interface TicketType { */ Ticks lifetime(); + interface Builder extends ResettableBuilder> { + + /** + * Sets the name of the {@link TicketType type}. + * + * @param name The name + * @return The builder, for chaining + */ + Builder name(@NonNull String name); + + /** + * Sets the {@link Comparator comparator} used by requested {@link Ticket tickets} + * of this type used to determine the appropriate ticket to be used during collisions. + *

    + * If this call is omitted, it is up to the implementation on how the comparison is handled. + * In the official implementation, the resulting comparison value is '0'. + * + * @param comparator The comparator + * @return The builder, for chaining + */ + Builder comparator(@Nullable Comparator comparator); + + /** + * Sets the lifetime of the {@link TicketType type}. + * + * @param lifetime The lifetime + * @return The builder, for chaining + */ + Builder lifetime(Ticks lifetime); + + /** + * Builds a new {@link TicketType type}. + * + * @return The type + */ + TicketType build(); + } } diff --git a/src/main/java/org/spongepowered/api/world/server/TicketTypes.java b/src/main/java/org/spongepowered/api/world/server/TicketTypes.java deleted file mode 100644 index 277e4328765..00000000000 --- a/src/main/java/org/spongepowered/api/world/server/TicketTypes.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This file is part of SpongeAPI, licensed under the MIT License (MIT). - * - * Copyright (c) SpongePowered - * 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.world.server; - -import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.registry.DefaultedRegistryReference; -import org.spongepowered.api.registry.Registry; -import org.spongepowered.api.registry.RegistryKey; -import org.spongepowered.api.registry.RegistryTypes; -import org.spongepowered.api.util.Ticks; -import org.spongepowered.api.world.chunk.WorldChunk; -import org.spongepowered.api.world.portal.Portal; -import org.spongepowered.math.vector.Vector3i; - -/** - * Types of {@link Ticket tickets} that can be requested via the - * {@link ChunkManager}. - */ -public final class TicketTypes { - - // @formatter:off - - // SORTFIELDS:ON - - /** - * Represents {@link Ticket tickets} that ensures the target - * {@link WorldChunk chunks} are loaded, but are not guaranteed to be loaded at - * any time in the future, that is, the lifetime of such a ticket is - * effectively one {@link Ticks tick}. - * - *

    The position represented by the {@link Vector3i} is a chunk - * position, not a block position, so when requesting a ticket - * using {@link ChunkManager#requestTicket( TicketType, Vector3i, Object, int)}, - * the second and third parameter should be the same.

    - */ - public static final DefaultedRegistryReference> STANDARD = TicketTypes.key(ResourceKey.sponge("standard")); - - /** - * Represents {@link Ticket tickets} that are intended to ensure that the - * target {@link WorldChunk chunks} around a {@link Portal} are loaded, ready to - * accept {@link Entity entities} that travel through it. - * - *

    The position represented by the {@link Vector3i} is a block - * position, specifically, it is intended it is that of the exit - * point of a portal. When requesting a ticket using - * {@link ChunkManager#requestTicket( TicketType, Vector3i, Object, int)}, - * the second parameter represents a chunk position, the third parameter - * represents a block position.

    - */ - public static final DefaultedRegistryReference> PORTAL = TicketTypes.key(ResourceKey.sponge("portal")); - - /** - * Represents {@link Ticket tickets} that are intended to ensure that the - * target {@link WorldChunk chunks} around an {@link Entity} are loaded after - * teleportation. - */ - public static final DefaultedRegistryReference> POST_TELEPORT = TicketTypes.key(ResourceKey.sponge("post_teleport")); - - // SORTFIELDS:OFF - - // @formatter:on - - private TicketTypes() { - } - - public static Registry> registry() { - return Sponge.game().registry(RegistryTypes.TICKET_TYPE); - } - - private static DefaultedRegistryReference> key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.TICKET_TYPE, location).asDefaultedReference(Sponge::game); - } - -} diff --git a/src/main/java/org/spongepowered/api/world/volume/block/BlockVolume.java b/src/main/java/org/spongepowered/api/world/volume/block/BlockVolume.java index 97a63d28d47..eb02e1dd9fc 100644 --- a/src/main/java/org/spongepowered/api/world/volume/block/BlockVolume.java +++ b/src/main/java/org/spongepowered/api/world/volume/block/BlockVolume.java @@ -46,6 +46,17 @@ public interface BlockVolume extends Volume { + /** + * Gets the {@link Palette} in use for this particular {@link Volume}. + * It is not guaranteed that the palette is the same across smaller + * {@link Volume Volumes} that may be contained within this volume. + * An example can be the difference between a {@link org.spongepowered.api.world.chunk.Chunk} + * and {@link org.spongepowered.api.world.World}'s palette. + * + * @return The block palette in use for this volume + */ + Palette blockPalette(); + BlockState block(int x, int y, int z); default BlockState block(final Vector3i vector3i) {