diff --git a/.checkstyle/checkstyle-suppressions.xml b/.checkstyle/checkstyle-suppressions.xml index 5c677e151a1..2bf5687b5dd 100644 --- a/.checkstyle/checkstyle-suppressions.xml +++ b/.checkstyle/checkstyle-suppressions.xml @@ -17,4 +17,5 @@ + diff --git a/.gitignore b/.gitignore index 1e698d63c71..95d321c54ae 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ MANIFEST.MF dependency-reduced-pom.xml .checkstyle !.checkstyle/ +# We exclude the generated events from git to avoid +# temptation to edit said generated files. +src/generated/ +src/main/generated/ # Compiled # ############ diff --git a/build.gradle.kts b/build.gradle.kts index b4c685ea8cb..33e47fcc60e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,7 @@ import net.ltgt.gradle.errorprone.errorprone import org.jetbrains.gradle.ext.delegateActions import org.jetbrains.gradle.ext.settings -import org.jetbrains.gradle.ext.taskTriggers -buildscript { - dependencies { - classpath(libs.spoon) // bump for EIG - } -} plugins { eclipse @@ -16,12 +10,14 @@ plugins { alias(libs.plugins.indra.crossdoc) alias(libs.plugins.indra.publishing) alias(libs.plugins.indra.publishing.sonatype) - alias(libs.plugins.eventImplGen) alias(libs.plugins.ideaExt) alias(libs.plugins.errorprone) alias(libs.plugins.nexusPublish) } +// Enable event generation to be considered part of +// the main source set +val generatedEventSourcesDir = project.file("src/main/generated") val javaTarget: String by project val ap by sourceSets.registering { compileClasspath += sourceSets.main.get().compileClasspath + sourceSets.main.get().output @@ -44,11 +40,32 @@ nexusPublishing { } } +tasks { + register("printSourceDirs") { + doLast { + sourceSets.forEach { set -> + println("SourceSet: ${set.name}") + println("Java Source Dirs: ${set.java.srcDirs}" ) + } + } + } +} + +sourceSets { + main { + java { + srcDirs(generatedEventSourcesDir) + } + } +} + // Project dependencies dependencies { // Directly tied to what's available from Minecraft api(libs.log4j.api) api(libs.gson) + api(libs.eventImplGen.annotations) + annotationProcessor(libs.eventImplGen.processor) // Adventure api(platform(libs.adventure.bom)) @@ -139,28 +156,23 @@ dependencies { testImplementation(libs.mockito) } +spotless { + java { + target("src/main/java/**/*.java") + targetExclude("src/main/generated/**/*.java") + } +} + tasks { - genEventImpl { - sourceCompatibility = "17" // TODO use javaTarget here - destinationDirectory = project.layout.buildDirectory.dir("generated/event-factory") - - outputFactory = "org.spongepowered.api.event.SpongeEventFactory" - include("org/spongepowered/api/event/*/**/*") - exclude("org/spongepowered/api/event/action/InteractEvent.java") - exclude("org/spongepowered/api/event/cause/") - exclude("org/spongepowered/api/event/entity/AffectEntityEvent.java") - exclude("org/spongepowered/api/event/filter/") - exclude("org/spongepowered/api/event/impl/") - exclude("org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java") - exclude("org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java") - exclude("org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java") - exclude("org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java") - exclude("org/spongepowered/api/event/lifecycle/RegisterTagEvent.java") - exclude("org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java") - exclude("org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java") - exclude("org/spongepowered/api/event/lifecycle/RegisterWorldEvent.java") - inclusiveAnnotations = setOf("org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod") - exclusiveAnnotations = setOf("org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod") + + compileJava { + options.generatedSourceOutputDirectory = generatedEventSourcesDir + options.compilerArgs.addAll(listOf( + "-AeventGenInclusiveFolders=org/spongepowered/api/event", + "-AeventGenExclusiveFolders=org/spongepowered/api/event/cause,org/spongepowered/api/event/filter,org/spongepowered/api/event/impl,org/spongepowered/api/event/lifecycle", + "-AeventGenFactory=org.spongepowered.api.event.SpongeEventFactory", + "-AeventGenDebug=true", + )) } jar { @@ -176,6 +188,15 @@ tasks { indraGit.applyVcsInformationToManifest(this) } } + checkstyleMain { + dependsOn(compileJava) + } + spotlessJava { + dependsOn(compileJava) + } + sourcesJar { + dependsOn(compileJava) + } withType(JavaCompile::class).configureEach { options.apply { @@ -225,15 +246,12 @@ idea { delegateBuildRunToGradle = false testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM } - taskTriggers { - beforeBuild(tasks.genEventImpl) - } } } } eclipse { - synchronizationTasks(tasks.genEventImpl) +// synchronizationTasks(tasks.genEventImpl) } val organization: String by project diff --git a/gradle.properties b/gradle.properties index b12f90482ac..3a648afca71 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=org.spongepowered -version=12.1.0-SNAPSHOT +version=18.0.0-SNAPSHOT organization=SpongePowered projectUrl=https://www.spongepowered.org projectDescription=A plugin API for Minecraft: Java Edition diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 395388daf8f..66443a1115d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ format = { version = "1.1" } [versions] -adventure = "4.17.0" +adventure = "4.26.1" caffeine = "3.1.8" checker = "3.42.0" checkstyle = "10.12.7" @@ -13,10 +13,10 @@ guice = "5.0.1" ideaExt = "1.1.8" indra = "3.1.3" junit = "5.10.2" -log4j = "2.22.1" +log4j = "2.25.2" math = "2.0.1" mockito = "5.11.0" -pluginSpi = "0.4.0" +pluginSpi = "0.5.2" [libraries] adventure-bom = { module = "net.kyori:adventure-bom", version.ref = "adventure" } @@ -37,13 +37,14 @@ guice = { module = "com.google.inject:guice", version.ref = "guice" } log4j-api = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4j" } math = { module = "org.spongepowered:math", version.ref = "math" } pluginSpi = { module = "org.spongepowered:plugin-spi", version.ref = "pluginSpi" } +eventImplGen-processor = {module = "org.spongepowered:event-impl-gen", version = "8.0.0"} +eventImplGen-annotations = { module = "org.spongepowered:event-impl-gen-annotations", version = "8.0.0"} # build-time/annotations checkerQual = { module = "org.checkerframework:checker-qual", version.ref = "checker" } errorprone = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" } errorprone-annotations = { module = "com.google.errorprone:error_prone_annotations", version.ref = "errorprone" } -spoon = { module = "fr.inria.gforge.spoon:spoon-core", version = "10.4.2" } # bump for EIG # testing @@ -55,7 +56,7 @@ junit-launcher = { module = "org.junit.platform:junit-platform-launcher" } mockito = { module = "org.mockito:mockito-core", version.ref = "mockito" } [plugins] -errorprone = { id = "net.ltgt.errorprone", version = "3.1.0" } +errorprone = { id = "net.ltgt.errorprone", version = "4.3.0" } eventImplGen = { id = "org.spongepowered.gradle.event-impl-gen", version = "7.1.0" } ideaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "ideaExt" } indra-checkstyle = { id = "net.kyori.indra.checkstyle", version.ref = "indra" } diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index fc344bca710..ed9aac2fe37 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -6,6 +6,8 @@ + + @@ -17,6 +19,14 @@ + + + + + + + + @@ -159,6 +169,14 @@ + + + + + + + + @@ -256,6 +274,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -296,6 +338,14 @@ + + + + + + + + @@ -351,6 +401,11 @@ + + + + + @@ -553,6 +608,14 @@ + + + + + + + + @@ -561,6 +624,14 @@ + + + + + + + + @@ -756,6 +827,22 @@ + + + + + + + + + + + + + + + + @@ -838,6 +925,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -854,6 +976,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -876,6 +1030,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -898,6 +1087,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -920,6 +1168,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -942,6 +1225,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -964,6 +1282,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -986,6 +1339,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1103,6 +1491,11 @@ + + + + + @@ -1111,6 +1504,14 @@ + + + + + + + + @@ -1376,6 +1777,14 @@ + + + + + + + + @@ -1420,6 +1829,11 @@ + + + + + @@ -1531,6 +1945,9 @@ + + + @@ -1544,6 +1961,9 @@ + + + @@ -1640,6 +2060,16 @@ + + + + + + + + + + @@ -1750,6 +2180,14 @@ + + + + + + + + @@ -1758,6 +2196,14 @@ + + + + + + + + @@ -2015,6 +2461,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2213,6 +2691,25 @@ + + + + + + + + + + + + + + + + + + + @@ -2254,6 +2751,16 @@ + + + + + + + + + + @@ -2276,6 +2783,21 @@ + + + + + + + + + + + + + + + diff --git a/src/main/java/org/spongepowered/api/advancement/Advancement.java b/src/main/java/org/spongepowered/api/advancement/Advancement.java index 98daddb4395..6a45e29c0ec 100644 --- a/src/main/java/org/spongepowered/api/advancement/Advancement.java +++ b/src/main/java/org/spongepowered/api/advancement/Advancement.java @@ -26,9 +26,13 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ComponentLike; +import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.Sponge; import org.spongepowered.api.advancement.criteria.AdvancementCriterion; -import org.spongepowered.api.data.persistence.DataSerializable; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.CopyableBuilder; import java.util.List; import java.util.Optional; @@ -36,7 +40,16 @@ /** * An advancement. */ -public interface Advancement extends ComponentLike, DataSerializable { +public interface Advancement extends DefaultedRegistryValue, ComponentLike, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create an {@link Advancement}. + * + * @return The new builder + */ + static Advancement.Builder builder() { + return Sponge.game().builderProvider().provide(Advancement.Builder.class); + } /** * Gets all the {@link AdvancementCriterion} that should be achieved @@ -72,4 +85,57 @@ public interface Advancement extends ComponentLike, DataSerializable { */ List toToastText(); + /** + * A builder to create {@link Advancement}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the parent {@link Advancement} key. + *

For the root advancement use {@link #root}

+ * + * @param parent The parent advancement + * @return This builder, for chaining + */ + Builder parent(ResourceKey parent); + + /** + * Sets this advancement as root. + * + * @return This builder, for chaining + */ + Builder.RootStep root(); + + /** + * Define root advancement only parameters. + */ + interface RootStep extends Builder { + + /** + * Sets the background path.. + * + * @param backgroundPath The {@link AdvancementTree}s background. + * + * @return This builder, for chaining + */ + Builder background(ResourceKey backgroundPath); + } + + /** + * Sets the {@link AdvancementCriterion} that should be used + * for the advancement. Defaults to {@link AdvancementCriterion#empty()}. + * + * @param criterion The criterion + * @return This builder, for chaining + */ + Builder criterion(AdvancementCriterion criterion); + + /** + * Sets the {@link DisplayInfo}. Defaults to {code null}. + * + * @param displayInfo The display info + * @return This builder, for chaining + */ + Builder displayInfo(@Nullable DisplayInfo displayInfo); + } } diff --git a/src/main/java/org/spongepowered/api/advancement/AdvancementTemplate.java b/src/main/java/org/spongepowered/api/advancement/AdvancementTemplate.java deleted file mode 100644 index 7388e885696..00000000000 --- a/src/main/java/org/spongepowered/api/advancement/AdvancementTemplate.java +++ /dev/null @@ -1,128 +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.advancement; - -import org.checkerframework.checker.nullness.qual.Nullable; -import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.advancement.criteria.AdvancementCriterion; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.ResourceKeyedBuilder; - -import java.util.Optional; - -/** - * A template for an {@link Advancement}. - */ -public interface AdvancementTemplate extends DataPackEntry { - - /** - * Creates a new {@link Builder} to create {@link Advancement}s. - * - * @return The new builder - */ - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class); - } - - /** - * Return the advancement - * - * @return The advancement - */ - Advancement advancement(); - - /** - * Gets the {@link AdvancementTree} of this advancement - * will only be present if it is a root advancement. - * - * @return The advancement tree - */ - Optional tree(); - - /** - * A builder to create {@link Advancement}s. - */ - interface Builder extends ResourceKeyedBuilder { - - /** - * Sets the parent {@link Advancement} template. - *

For the root advancement use {@link #root}

- * - * @param parent The parent advancement - * @return This builder, for chaining - */ - Builder parent(AdvancementTemplate parent); - - /** - * Sets the parent {@link Advancement} key. - *

For the root advancement use {@link #root}

- * - * @param parent The parent advancement - * @return This builder, for chaining - */ - Builder parent(ResourceKey parent); - - /** - * Sets this advancement as root. - * - * @return This builder, for chaining - */ - Builder.RootStep root(); - - /** - * Define root advancement only parameters. - */ - interface RootStep extends Builder { - - /** - * Sets the background path.. - * - * @param backgroundPath The {@link AdvancementTree}s background. - * - * @return This builder, for chaining - */ - Builder background(ResourceKey backgroundPath); - } - - /** - * Sets the {@link AdvancementCriterion} that should be used - * for the advancement. Defaults to {@link AdvancementCriterion#empty()}. - * - * @param criterion The criterion - * @return This builder, for chaining - */ - Builder criterion(AdvancementCriterion criterion); - - /** - * Sets the {@link DisplayInfo}. Defaults to {code null}. - * - * @param displayInfo The display info - * @return This builder, for chaining - */ - Builder displayInfo(@Nullable DisplayInfo displayInfo); - - } -} diff --git a/src/main/java/org/spongepowered/api/advancement/AdvancementTree.java b/src/main/java/org/spongepowered/api/advancement/AdvancementTree.java index a477132c2dd..36121511680 100644 --- a/src/main/java/org/spongepowered/api/advancement/AdvancementTree.java +++ b/src/main/java/org/spongepowered/api/advancement/AdvancementTree.java @@ -59,7 +59,7 @@ public interface AdvancementTree extends AdvancementNode { * @param advancement The advancement * @return The tree layout element */ - Optional layoutElement(AdvancementTemplate advancement); + Optional layoutElement(Advancement advancement); /** diff --git a/src/main/java/org/spongepowered/api/advancement/AdvancementType.java b/src/main/java/org/spongepowered/api/advancement/AdvancementType.java index b1d387fcbbf..2b641bf904e 100644 --- a/src/main/java/org/spongepowered/api/advancement/AdvancementType.java +++ b/src/main/java/org/spongepowered/api/advancement/AdvancementType.java @@ -25,6 +25,7 @@ package org.spongepowered.api.advancement; import net.kyori.adventure.text.format.TextColor; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -33,7 +34,7 @@ * also the appearance in the notifications. */ @CatalogedBy(AdvancementTypes.class) -public interface AdvancementType extends DefaultedRegistryValue { +public interface AdvancementType extends DefaultedRegistryValue, StringRepresentable { /** * Gets the {@link TextColor} of the advancement type. diff --git a/src/main/java/org/spongepowered/api/advancement/criteria/trigger/Trigger.java b/src/main/java/org/spongepowered/api/advancement/criteria/trigger/Trigger.java index 10db3ce166f..bcd7a9b15c5 100644 --- a/src/main/java/org/spongepowered/api/advancement/criteria/trigger/Trigger.java +++ b/src/main/java/org/spongepowered/api/advancement/criteria/trigger/Trigger.java @@ -53,7 +53,7 @@ */ @SuppressWarnings("unchecked") @CatalogedBy(Triggers.class) -public interface Trigger extends DefaultedRegistryValue { +public interface Trigger extends DefaultedRegistryValue> { /** * Creates a new {@link Builder} which can be used to create 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 17f5bd3989e..d2fba1e749b 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 @@ -94,7 +94,7 @@ public final class Triggers { public static final DefaultedRegistryReference> ITEM_USED_ON_BLOCK = Triggers.key(ResourceKey.minecraft("item_used_on_block")); - public static final DefaultedRegistryReference> KILLED_BY_CROSSBOW = Triggers.key(ResourceKey.minecraft("killed_by_crossbow")); + public static final DefaultedRegistryReference> KILLED_BY_ARROW = Triggers.key(ResourceKey.minecraft("killed_by_arrow")); public static final DefaultedRegistryReference> KILL_MOB_NEAR_SCULK_CATALYST = Triggers.key(ResourceKey.minecraft("kill_mob_near_sculk_catalyst")); @@ -116,6 +116,8 @@ public final class Triggers { public static final DefaultedRegistryReference> PLAYER_KILLED_ENTITY = Triggers.key(ResourceKey.minecraft("player_killed_entity")); + public static final DefaultedRegistryReference> PLAYER_SHEARED_EQUIPMENT = Triggers.key(ResourceKey.minecraft("player_sheared_equipment")); + public static final DefaultedRegistryReference> RECIPE_CRAFTED = Triggers.key(ResourceKey.minecraft("recipe_crafted")); public static final DefaultedRegistryReference> RECIPE_UNLOCKED = Triggers.key(ResourceKey.minecraft("recipe_unlocked")); @@ -128,6 +130,8 @@ public final class Triggers { public static final DefaultedRegistryReference> SLIDE_DOWN_BLOCK = Triggers.key(ResourceKey.minecraft("slide_down_block")); + public static final DefaultedRegistryReference> SPEAR_MOBS = Triggers.key(ResourceKey.minecraft("spear_mobs")); + public static final DefaultedRegistryReference> STARTED_RIDING = Triggers.key(ResourceKey.minecraft("started_riding")); public static final DefaultedRegistryReference> SUMMONED_ENTITY = Triggers.key(ResourceKey.minecraft("summoned_entity")); diff --git a/src/main/java/org/spongepowered/api/adventure/ChatType.java b/src/main/java/org/spongepowered/api/adventure/ChatType.java index c36b038d422..614cf92e516 100644 --- a/src/main/java/org/spongepowered/api/adventure/ChatType.java +++ b/src/main/java/org/spongepowered/api/adventure/ChatType.java @@ -25,16 +25,83 @@ package org.spongepowered.api.adventure; import net.kyori.adventure.text.format.Style; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; /** * A type of chat */ @CatalogedBy(ChatTypes.class) -public interface ChatType extends net.kyori.adventure.chat.ChatType { +public interface ChatType extends DefaultedRegistryValue, net.kyori.adventure.chat.ChatType, DataPackSerializable { + /** + * Creates a new {@link Builder} to create a {@link ChatType}. + * + * @return The new builder + */ + static Builder builder() { + return Sponge.game().builderProvider().provide(Builder.class); + } + + /** + * Gets the translation key that would be used + * to display the chat message. + * + * @return The translation key + */ String translationKey(); + /** + * Gets the style that would be used to + * display the chat message. + * + * @return The style + */ Style style(); + /** + * A builder to create {@link ChatType}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the translation key or custom format mask. + * + * @param translationKey The translation key or format mask + * @return this builder, for chaining + */ + Builder translationKey(String translationKey); + + /** + * Sets the style. + * + * @param style The style + * @return this builder, for chaining + */ + Builder style(Style style); + + /** + * Adds a sender parameter. + * + * @return this builder, for chaining + */ + Builder addSender(); + + /** + * Adds a content parameter. + * + * @return this builder, for chaining + */ + Builder addContent(); + + /** + * Adds a target parameter. + * + * @return this builder, for chaining + */ + Builder addTarget(); + } } diff --git a/src/main/java/org/spongepowered/api/adventure/ChatTypeTemplate.java b/src/main/java/org/spongepowered/api/adventure/ChatTypeTemplate.java deleted file mode 100644 index 8f78b954f3f..00000000000 --- a/src/main/java/org/spongepowered/api/adventure/ChatTypeTemplate.java +++ /dev/null @@ -1,88 +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.adventure; - -import net.kyori.adventure.text.format.Style; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; - -/** - * A template for {@link ChatType chat types}. - */ -public interface ChatTypeTemplate extends DataPackEntry { - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the chat type - * - * @return The chat type - */ - ChatType type(); - - interface Builder extends DataPackEntryBuilder { - - /** - * Sets the translation key or custom format mask. - * - * @param translationKey The translation key or format mask - * @return this builder, for chaining - */ - Builder translationKey(String translationKey); - - /** - * Sets the style. - * - * @param style The style - * @return this builder, for chaining - */ - Builder style(Style style); - - /** - * Adds a sender parameter. - * - * @return this builder, for chaining - */ - Builder addSender(); - - /** - * Adds a content parameter. - * - * @return this builder, for chaining - */ - Builder addContent(); - - /** - * Adds a target parameter. - * - * @return this builder, for chaining - */ - Builder addTarget(); - - } -} diff --git a/src/main/java/org/spongepowered/api/adventure/ChatTypes.java b/src/main/java/org/spongepowered/api/adventure/ChatTypes.java index 5afc963df5c..7784a020b3d 100644 --- a/src/main/java/org/spongepowered/api/adventure/ChatTypes.java +++ b/src/main/java/org/spongepowered/api/adventure/ChatTypes.java @@ -98,6 +98,6 @@ public static Registry registry() { } public static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.CHAT_TYPE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.CHAT_TYPE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/adventure/ResolveOperation.java b/src/main/java/org/spongepowered/api/adventure/ResolveOperation.java index 6564a2f613a..d90a4e35c4d 100644 --- a/src/main/java/org/spongepowered/api/adventure/ResolveOperation.java +++ b/src/main/java/org/spongepowered/api/adventure/ResolveOperation.java @@ -24,12 +24,13 @@ */ package org.spongepowered.api.adventure; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; /** * A type of rendering operation that can be performed on a component. */ @CatalogedBy(ResolveOperations.class) -public interface ResolveOperation { +public interface ResolveOperation extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/adventure/ResolveOperations.java b/src/main/java/org/spongepowered/api/adventure/ResolveOperations.java index 3c093968ad1..7a04337e09a 100644 --- a/src/main/java/org/spongepowered/api/adventure/ResolveOperations.java +++ b/src/main/java/org/spongepowered/api/adventure/ResolveOperations.java @@ -68,6 +68,11 @@ public final class ResolveOperations { */ public static final DefaultedRegistryReference CUSTOM_TRANSLATIONS = ResolveOperations.key(ResourceKey.sponge("custom_translations")); + /** + * Resolves Sponge provided virtual components. + */ + public static final DefaultedRegistryReference VIRTUAL_COMPONENTS = ResolveOperations.key(ResourceKey.sponge("virtual_components")); + // SORTFIELDS:OFF // @formatter:ON diff --git a/src/main/java/org/spongepowered/api/adventure/SpongeComponents.java b/src/main/java/org/spongepowered/api/adventure/SpongeComponents.java index 835ed06b0f1..9a9f7ce10d0 100644 --- a/src/main/java/org/spongepowered/api/adventure/SpongeComponents.java +++ b/src/main/java/org/spongepowered/api/adventure/SpongeComponents.java @@ -26,6 +26,8 @@ import net.kyori.adventure.audience.Audience; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.ComponentLike; +import net.kyori.adventure.text.VirtualComponent; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.flattener.ComponentFlattener; import org.spongepowered.api.Sponge; @@ -33,6 +35,7 @@ import org.spongepowered.api.registry.DefaultedRegistryReference; import java.util.function.Consumer; +import java.util.function.Function; /** * Additional SpongeAPI-specific methods for working with {@link Component}s and related. @@ -111,6 +114,35 @@ public static ComponentFlattener flattener() { return SpongeComponents.factory().flattener(); } + /** + * Creates a new {@link VirtualComponent} that will be used to + * render each {@link Audience} their own version of + * the received message. + * + * @param apply The function invoked to render + * {@link Audience} specific component. + * @return The virtual component + */ + public static VirtualComponent receiverVirtualComponent(final Function apply) { + return SpongeComponents.receiverVirtualComponent(apply, ""); + } + + /** + * Creates a new {@link VirtualComponent} that will be used to + * render each {@link Audience} their own version of + * the received message. + * + * @param apply The function invoked to render + * {@link Audience} specific component. + * @param fallbackValue The fallback value used when this + * component has been serialized without + * being rendered. + * @return The virtual component + */ + public static VirtualComponent receiverVirtualComponent(final Function apply, final String fallbackValue) { + return SpongeComponents.factory().receiverVirtualComponent(apply, fallbackValue); + } + private static Factory factory() { return Sponge.game().factoryProvider().provide(Factory.class); } @@ -137,5 +169,6 @@ Component render( ComponentFlattener flattener(); + VirtualComponent receiverVirtualComponent(Function apply, String fallbackValue); } } diff --git a/src/main/java/org/spongepowered/api/block/BlockType.java b/src/main/java/org/spongepowered/api/block/BlockType.java index 261cd4229ad..0109500aa80 100644 --- a/src/main/java/org/spongepowered/api/block/BlockType.java +++ b/src/main/java/org/spongepowered/api/block/BlockType.java @@ -44,7 +44,7 @@ * via {@link BlockEntity}.

*/ @CatalogedBy(BlockTypes.class) -public interface BlockType extends DefaultedRegistryValue, ComponentLike, StateContainer, DataHolder.Immutable, Taggable { +public interface BlockType extends DefaultedRegistryValue, ComponentLike, StateContainer, DataHolder.Immutable, Taggable { /** * Return the {@link ItemType} that represents this block. diff --git a/src/main/java/org/spongepowered/api/block/BlockTypes.java b/src/main/java/org/spongepowered/api/block/BlockTypes.java index e41e0b38be7..fd90f9528a7 100644 --- a/src/main/java/org/spongepowered/api/block/BlockTypes.java +++ b/src/main/java/org/spongepowered/api/block/BlockTypes.java @@ -60,6 +60,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference ACACIA_SAPLING = BlockTypes.key(ResourceKey.minecraft("acacia_sapling")); + public static final DefaultedRegistryReference ACACIA_SHELF = BlockTypes.key(ResourceKey.minecraft("acacia_shelf")); + public static final DefaultedRegistryReference ACACIA_SIGN = BlockTypes.key(ResourceKey.minecraft("acacia_sign")); public static final DefaultedRegistryReference ACACIA_SLAB = BlockTypes.key(ResourceKey.minecraft("acacia_slab")); @@ -132,6 +134,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference BAMBOO_SAPLING = BlockTypes.key(ResourceKey.minecraft("bamboo_sapling")); + public static final DefaultedRegistryReference BAMBOO_SHELF = BlockTypes.key(ResourceKey.minecraft("bamboo_shelf")); + public static final DefaultedRegistryReference BAMBOO_SIGN = BlockTypes.key(ResourceKey.minecraft("bamboo_sign")); public static final DefaultedRegistryReference BAMBOO_SLAB = BlockTypes.key(ResourceKey.minecraft("bamboo_slab")); @@ -186,6 +190,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference BIRCH_SAPLING = BlockTypes.key(ResourceKey.minecraft("birch_sapling")); + public static final DefaultedRegistryReference BIRCH_SHELF = BlockTypes.key(ResourceKey.minecraft("birch_shelf")); + public static final DefaultedRegistryReference BIRCH_SIGN = BlockTypes.key(ResourceKey.minecraft("birch_sign")); public static final DefaultedRegistryReference BIRCH_SLAB = BlockTypes.key(ResourceKey.minecraft("birch_slab")); @@ -336,8 +342,12 @@ public final class BlockTypes { public static final DefaultedRegistryReference BUDDING_AMETHYST = BlockTypes.key(ResourceKey.minecraft("budding_amethyst")); + public static final DefaultedRegistryReference BUSH = BlockTypes.key(ResourceKey.minecraft("bush")); + public static final DefaultedRegistryReference CACTUS = BlockTypes.key(ResourceKey.minecraft("cactus")); + public static final DefaultedRegistryReference CACTUS_FLOWER = BlockTypes.key(ResourceKey.minecraft("cactus_flower")); + public static final DefaultedRegistryReference CAKE = BlockTypes.key(ResourceKey.minecraft("cake")); public static final DefaultedRegistryReference CALCITE = BlockTypes.key(ResourceKey.minecraft("calcite")); @@ -364,8 +374,6 @@ public final class BlockTypes { public static final DefaultedRegistryReference CAVE_VINES_PLANT = BlockTypes.key(ResourceKey.minecraft("cave_vines_plant")); - public static final DefaultedRegistryReference CHAIN = BlockTypes.key(ResourceKey.minecraft("chain")); - public static final DefaultedRegistryReference CHAIN_COMMAND_BLOCK = BlockTypes.key(ResourceKey.minecraft("chain_command_block")); public static final DefaultedRegistryReference CHERRY_BUTTON = BlockTypes.key(ResourceKey.minecraft("cherry_button")); @@ -388,6 +396,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference CHERRY_SAPLING = BlockTypes.key(ResourceKey.minecraft("cherry_sapling")); + public static final DefaultedRegistryReference CHERRY_SHELF = BlockTypes.key(ResourceKey.minecraft("cherry_shelf")); + public static final DefaultedRegistryReference CHERRY_SIGN = BlockTypes.key(ResourceKey.minecraft("cherry_sign")); public static final DefaultedRegistryReference CHERRY_SLAB = BlockTypes.key(ResourceKey.minecraft("cherry_slab")); @@ -420,6 +430,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference CHISELED_RED_SANDSTONE = BlockTypes.key(ResourceKey.minecraft("chiseled_red_sandstone")); + public static final DefaultedRegistryReference CHISELED_RESIN_BRICKS = BlockTypes.key(ResourceKey.minecraft("chiseled_resin_bricks")); + public static final DefaultedRegistryReference CHISELED_SANDSTONE = BlockTypes.key(ResourceKey.minecraft("chiseled_sandstone")); public static final DefaultedRegistryReference CHISELED_STONE_BRICKS = BlockTypes.key(ResourceKey.minecraft("chiseled_stone_bricks")); @@ -434,6 +446,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference CLAY = BlockTypes.key(ResourceKey.minecraft("clay")); + public static final DefaultedRegistryReference CLOSED_EYEBLOSSOM = BlockTypes.key(ResourceKey.minecraft("closed_eyeblossom")); + public static final DefaultedRegistryReference COAL_BLOCK = BlockTypes.key(ResourceKey.minecraft("coal_block")); public static final DefaultedRegistryReference COAL_ORE = BlockTypes.key(ResourceKey.minecraft("coal_ore")); @@ -468,18 +482,32 @@ public final class BlockTypes { public static final DefaultedRegistryReference CONDUIT = BlockTypes.key(ResourceKey.minecraft("conduit")); + public static final DefaultedRegistryReference COPPER_BARS = BlockTypes.key(ResourceKey.minecraft("copper_bars")); + public static final DefaultedRegistryReference COPPER_BLOCK = BlockTypes.key(ResourceKey.minecraft("copper_block")); public static final DefaultedRegistryReference COPPER_BULB = BlockTypes.key(ResourceKey.minecraft("copper_bulb")); + public static final DefaultedRegistryReference COPPER_CHAIN = BlockTypes.key(ResourceKey.minecraft("copper_chain")); + + public static final DefaultedRegistryReference COPPER_CHEST = BlockTypes.key(ResourceKey.minecraft("copper_chest")); + public static final DefaultedRegistryReference COPPER_DOOR = BlockTypes.key(ResourceKey.minecraft("copper_door")); + public static final DefaultedRegistryReference COPPER_GOLEM_STATUE = BlockTypes.key(ResourceKey.minecraft("copper_golem_statue")); + public static final DefaultedRegistryReference COPPER_GRATE = BlockTypes.key(ResourceKey.minecraft("copper_grate")); + public static final DefaultedRegistryReference COPPER_LANTERN = BlockTypes.key(ResourceKey.minecraft("copper_lantern")); + public static final DefaultedRegistryReference COPPER_ORE = BlockTypes.key(ResourceKey.minecraft("copper_ore")); + public static final DefaultedRegistryReference COPPER_TORCH = BlockTypes.key(ResourceKey.minecraft("copper_torch")); + public static final DefaultedRegistryReference COPPER_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("copper_trapdoor")); + public static final DefaultedRegistryReference COPPER_WALL_TORCH = BlockTypes.key(ResourceKey.minecraft("copper_wall_torch")); + public static final DefaultedRegistryReference CORNFLOWER = BlockTypes.key(ResourceKey.minecraft("cornflower")); public static final DefaultedRegistryReference CRACKED_DEEPSLATE_BRICKS = BlockTypes.key(ResourceKey.minecraft("cracked_deepslate_bricks")); @@ -496,6 +524,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference CRAFTING_TABLE = BlockTypes.key(ResourceKey.minecraft("crafting_table")); + public static final DefaultedRegistryReference CREAKING_HEART = BlockTypes.key(ResourceKey.minecraft("creaking_heart")); + public static final DefaultedRegistryReference CREEPER_HEAD = BlockTypes.key(ResourceKey.minecraft("creeper_head")); public static final DefaultedRegistryReference CREEPER_WALL_HEAD = BlockTypes.key(ResourceKey.minecraft("creeper_wall_head")); @@ -522,6 +552,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference CRIMSON_ROOTS = BlockTypes.key(ResourceKey.minecraft("crimson_roots")); + public static final DefaultedRegistryReference CRIMSON_SHELF = BlockTypes.key(ResourceKey.minecraft("crimson_shelf")); + public static final DefaultedRegistryReference CRIMSON_SIGN = BlockTypes.key(ResourceKey.minecraft("crimson_sign")); public static final DefaultedRegistryReference CRIMSON_SLAB = BlockTypes.key(ResourceKey.minecraft("crimson_slab")); @@ -604,6 +636,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference DARK_OAK_SAPLING = BlockTypes.key(ResourceKey.minecraft("dark_oak_sapling")); + public static final DefaultedRegistryReference DARK_OAK_SHELF = BlockTypes.key(ResourceKey.minecraft("dark_oak_shelf")); + public static final DefaultedRegistryReference DARK_OAK_SIGN = BlockTypes.key(ResourceKey.minecraft("dark_oak_sign")); public static final DefaultedRegistryReference DARK_OAK_SLAB = BlockTypes.key(ResourceKey.minecraft("dark_oak_slab")); @@ -730,6 +764,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference DRAGON_WALL_HEAD = BlockTypes.key(ResourceKey.minecraft("dragon_wall_head")); + public static final DefaultedRegistryReference DRIED_GHAST = BlockTypes.key(ResourceKey.minecraft("dried_ghast")); + public static final DefaultedRegistryReference DRIED_KELP_BLOCK = BlockTypes.key(ResourceKey.minecraft("dried_kelp_block")); public static final DefaultedRegistryReference DRIPSTONE_BLOCK = BlockTypes.key(ResourceKey.minecraft("dripstone_block")); @@ -766,12 +802,22 @@ public final class BlockTypes { public static final DefaultedRegistryReference EXPOSED_COPPER = BlockTypes.key(ResourceKey.minecraft("exposed_copper")); + public static final DefaultedRegistryReference EXPOSED_COPPER_BARS = BlockTypes.key(ResourceKey.minecraft("exposed_copper_bars")); + public static final DefaultedRegistryReference EXPOSED_COPPER_BULB = BlockTypes.key(ResourceKey.minecraft("exposed_copper_bulb")); + public static final DefaultedRegistryReference EXPOSED_COPPER_CHAIN = BlockTypes.key(ResourceKey.minecraft("exposed_copper_chain")); + + public static final DefaultedRegistryReference EXPOSED_COPPER_CHEST = BlockTypes.key(ResourceKey.minecraft("exposed_copper_chest")); + public static final DefaultedRegistryReference EXPOSED_COPPER_DOOR = BlockTypes.key(ResourceKey.minecraft("exposed_copper_door")); + public static final DefaultedRegistryReference EXPOSED_COPPER_GOLEM_STATUE = BlockTypes.key(ResourceKey.minecraft("exposed_copper_golem_statue")); + public static final DefaultedRegistryReference EXPOSED_COPPER_GRATE = BlockTypes.key(ResourceKey.minecraft("exposed_copper_grate")); + public static final DefaultedRegistryReference EXPOSED_COPPER_LANTERN = BlockTypes.key(ResourceKey.minecraft("exposed_copper_lantern")); + public static final DefaultedRegistryReference EXPOSED_COPPER_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("exposed_copper_trapdoor")); public static final DefaultedRegistryReference EXPOSED_CUT_COPPER = BlockTypes.key(ResourceKey.minecraft("exposed_cut_copper")); @@ -780,12 +826,16 @@ public final class BlockTypes { public static final DefaultedRegistryReference EXPOSED_CUT_COPPER_STAIRS = BlockTypes.key(ResourceKey.minecraft("exposed_cut_copper_stairs")); + public static final DefaultedRegistryReference EXPOSED_LIGHTNING_ROD = BlockTypes.key(ResourceKey.minecraft("exposed_lightning_rod")); + public static final DefaultedRegistryReference FARMLAND = BlockTypes.key(ResourceKey.minecraft("farmland")); public static final DefaultedRegistryReference FERN = BlockTypes.key(ResourceKey.minecraft("fern")); public static final DefaultedRegistryReference FIRE = BlockTypes.key(ResourceKey.minecraft("fire")); + public static final DefaultedRegistryReference FIREFLY_BUSH = BlockTypes.key(ResourceKey.minecraft("firefly_bush")); + public static final DefaultedRegistryReference FIRE_CORAL = BlockTypes.key(ResourceKey.minecraft("fire_coral")); public static final DefaultedRegistryReference FIRE_CORAL_BLOCK = BlockTypes.key(ResourceKey.minecraft("fire_coral_block")); @@ -934,6 +984,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference IRON_BLOCK = BlockTypes.key(ResourceKey.minecraft("iron_block")); + public static final DefaultedRegistryReference IRON_CHAIN = BlockTypes.key(ResourceKey.minecraft("iron_chain")); + public static final DefaultedRegistryReference IRON_DOOR = BlockTypes.key(ResourceKey.minecraft("iron_door")); public static final DefaultedRegistryReference IRON_ORE = BlockTypes.key(ResourceKey.minecraft("iron_ore")); @@ -966,6 +1018,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference JUNGLE_SAPLING = BlockTypes.key(ResourceKey.minecraft("jungle_sapling")); + public static final DefaultedRegistryReference JUNGLE_SHELF = BlockTypes.key(ResourceKey.minecraft("jungle_shelf")); + public static final DefaultedRegistryReference JUNGLE_SIGN = BlockTypes.key(ResourceKey.minecraft("jungle_sign")); public static final DefaultedRegistryReference JUNGLE_SLAB = BlockTypes.key(ResourceKey.minecraft("jungle_slab")); @@ -1000,6 +1054,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference LAVA_CAULDRON = BlockTypes.key(ResourceKey.minecraft("lava_cauldron")); + public static final DefaultedRegistryReference LEAF_LITTER = BlockTypes.key(ResourceKey.minecraft("leaf_litter")); + public static final DefaultedRegistryReference LECTERN = BlockTypes.key(ResourceKey.minecraft("lectern")); public static final DefaultedRegistryReference LEVER = BlockTypes.key(ResourceKey.minecraft("lever")); @@ -1156,6 +1212,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference MANGROVE_ROOTS = BlockTypes.key(ResourceKey.minecraft("mangrove_roots")); + public static final DefaultedRegistryReference MANGROVE_SHELF = BlockTypes.key(ResourceKey.minecraft("mangrove_shelf")); + public static final DefaultedRegistryReference MANGROVE_SIGN = BlockTypes.key(ResourceKey.minecraft("mangrove_sign")); public static final DefaultedRegistryReference MANGROVE_SLAB = BlockTypes.key(ResourceKey.minecraft("mangrove_slab")); @@ -1262,6 +1320,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference OAK_SAPLING = BlockTypes.key(ResourceKey.minecraft("oak_sapling")); + public static final DefaultedRegistryReference OAK_SHELF = BlockTypes.key(ResourceKey.minecraft("oak_shelf")); + public static final DefaultedRegistryReference OAK_SIGN = BlockTypes.key(ResourceKey.minecraft("oak_sign")); public static final DefaultedRegistryReference OAK_SLAB = BlockTypes.key(ResourceKey.minecraft("oak_slab")); @@ -1282,6 +1342,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference OCHRE_FROGLIGHT = BlockTypes.key(ResourceKey.minecraft("ochre_froglight")); + public static final DefaultedRegistryReference OPEN_EYEBLOSSOM = BlockTypes.key(ResourceKey.minecraft("open_eyeblossom")); + public static final DefaultedRegistryReference ORANGE_BANNER = BlockTypes.key(ResourceKey.minecraft("orange_banner")); public static final DefaultedRegistryReference ORANGE_BED = BlockTypes.key(ResourceKey.minecraft("orange_bed")); @@ -1318,12 +1380,22 @@ public final class BlockTypes { public static final DefaultedRegistryReference OXIDIZED_COPPER = BlockTypes.key(ResourceKey.minecraft("oxidized_copper")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_BARS = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_bars")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_BULB = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_bulb")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_CHAIN = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_chain")); + + public static final DefaultedRegistryReference OXIDIZED_COPPER_CHEST = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_chest")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_DOOR = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_door")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_GOLEM_STATUE = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_golem_statue")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_GRATE = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_grate")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_LANTERN = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_lantern")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("oxidized_copper_trapdoor")); public static final DefaultedRegistryReference OXIDIZED_CUT_COPPER = BlockTypes.key(ResourceKey.minecraft("oxidized_cut_copper")); @@ -1332,10 +1404,54 @@ public final class BlockTypes { public static final DefaultedRegistryReference OXIDIZED_CUT_COPPER_STAIRS = BlockTypes.key(ResourceKey.minecraft("oxidized_cut_copper_stairs")); + public static final DefaultedRegistryReference OXIDIZED_LIGHTNING_ROD = BlockTypes.key(ResourceKey.minecraft("oxidized_lightning_rod")); + public static final DefaultedRegistryReference PACKED_ICE = BlockTypes.key(ResourceKey.minecraft("packed_ice")); public static final DefaultedRegistryReference PACKED_MUD = BlockTypes.key(ResourceKey.minecraft("packed_mud")); + public static final DefaultedRegistryReference PALE_HANGING_MOSS = BlockTypes.key(ResourceKey.minecraft("pale_hanging_moss")); + + public static final DefaultedRegistryReference PALE_MOSS_BLOCK = BlockTypes.key(ResourceKey.minecraft("pale_moss_block")); + + public static final DefaultedRegistryReference PALE_MOSS_CARPET = BlockTypes.key(ResourceKey.minecraft("pale_moss_carpet")); + + public static final DefaultedRegistryReference PALE_OAK_BUTTON = BlockTypes.key(ResourceKey.minecraft("pale_oak_button")); + + public static final DefaultedRegistryReference PALE_OAK_DOOR = BlockTypes.key(ResourceKey.minecraft("pale_oak_door")); + + public static final DefaultedRegistryReference PALE_OAK_FENCE = BlockTypes.key(ResourceKey.minecraft("pale_oak_fence")); + + public static final DefaultedRegistryReference PALE_OAK_FENCE_GATE = BlockTypes.key(ResourceKey.minecraft("pale_oak_fence_gate")); + + public static final DefaultedRegistryReference PALE_OAK_HANGING_SIGN = BlockTypes.key(ResourceKey.minecraft("pale_oak_hanging_sign")); + + public static final DefaultedRegistryReference PALE_OAK_LEAVES = BlockTypes.key(ResourceKey.minecraft("pale_oak_leaves")); + + public static final DefaultedRegistryReference PALE_OAK_LOG = BlockTypes.key(ResourceKey.minecraft("pale_oak_log")); + + public static final DefaultedRegistryReference PALE_OAK_PLANKS = BlockTypes.key(ResourceKey.minecraft("pale_oak_planks")); + + public static final DefaultedRegistryReference PALE_OAK_PRESSURE_PLATE = BlockTypes.key(ResourceKey.minecraft("pale_oak_pressure_plate")); + + public static final DefaultedRegistryReference PALE_OAK_SAPLING = BlockTypes.key(ResourceKey.minecraft("pale_oak_sapling")); + + public static final DefaultedRegistryReference PALE_OAK_SHELF = BlockTypes.key(ResourceKey.minecraft("pale_oak_shelf")); + + public static final DefaultedRegistryReference PALE_OAK_SIGN = BlockTypes.key(ResourceKey.minecraft("pale_oak_sign")); + + public static final DefaultedRegistryReference PALE_OAK_SLAB = BlockTypes.key(ResourceKey.minecraft("pale_oak_slab")); + + public static final DefaultedRegistryReference PALE_OAK_STAIRS = BlockTypes.key(ResourceKey.minecraft("pale_oak_stairs")); + + public static final DefaultedRegistryReference PALE_OAK_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("pale_oak_trapdoor")); + + public static final DefaultedRegistryReference PALE_OAK_WALL_HANGING_SIGN = BlockTypes.key(ResourceKey.minecraft("pale_oak_wall_hanging_sign")); + + public static final DefaultedRegistryReference PALE_OAK_WALL_SIGN = BlockTypes.key(ResourceKey.minecraft("pale_oak_wall_sign")); + + public static final DefaultedRegistryReference PALE_OAK_WOOD = BlockTypes.key(ResourceKey.minecraft("pale_oak_wood")); + public static final DefaultedRegistryReference PEARLESCENT_FROGLIGHT = BlockTypes.key(ResourceKey.minecraft("pearlescent_froglight")); public static final DefaultedRegistryReference PEONY = BlockTypes.key(ResourceKey.minecraft("peony")); @@ -1474,6 +1590,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference POTTED_CHERRY_SAPLING = BlockTypes.key(ResourceKey.minecraft("potted_cherry_sapling")); + public static final DefaultedRegistryReference POTTED_CLOSED_EYEBLOSSOM = BlockTypes.key(ResourceKey.minecraft("potted_closed_eyeblossom")); + public static final DefaultedRegistryReference POTTED_CORNFLOWER = BlockTypes.key(ResourceKey.minecraft("potted_cornflower")); public static final DefaultedRegistryReference POTTED_CRIMSON_FUNGUS = BlockTypes.key(ResourceKey.minecraft("potted_crimson_fungus")); @@ -1498,10 +1616,14 @@ public final class BlockTypes { public static final DefaultedRegistryReference POTTED_OAK_SAPLING = BlockTypes.key(ResourceKey.minecraft("potted_oak_sapling")); + public static final DefaultedRegistryReference POTTED_OPEN_EYEBLOSSOM = BlockTypes.key(ResourceKey.minecraft("potted_open_eyeblossom")); + public static final DefaultedRegistryReference POTTED_ORANGE_TULIP = BlockTypes.key(ResourceKey.minecraft("potted_orange_tulip")); public static final DefaultedRegistryReference POTTED_OXEYE_DAISY = BlockTypes.key(ResourceKey.minecraft("potted_oxeye_daisy")); + public static final DefaultedRegistryReference POTTED_PALE_OAK_SAPLING = BlockTypes.key(ResourceKey.minecraft("potted_pale_oak_sapling")); + public static final DefaultedRegistryReference POTTED_PINK_TULIP = BlockTypes.key(ResourceKey.minecraft("potted_pink_tulip")); public static final DefaultedRegistryReference POTTED_POPPY = BlockTypes.key(ResourceKey.minecraft("potted_poppy")); @@ -1670,6 +1792,18 @@ public final class BlockTypes { public static final DefaultedRegistryReference REPEATING_COMMAND_BLOCK = BlockTypes.key(ResourceKey.minecraft("repeating_command_block")); + public static final DefaultedRegistryReference RESIN_BLOCK = BlockTypes.key(ResourceKey.minecraft("resin_block")); + + public static final DefaultedRegistryReference RESIN_BRICKS = BlockTypes.key(ResourceKey.minecraft("resin_bricks")); + + public static final DefaultedRegistryReference RESIN_BRICK_SLAB = BlockTypes.key(ResourceKey.minecraft("resin_brick_slab")); + + public static final DefaultedRegistryReference RESIN_BRICK_STAIRS = BlockTypes.key(ResourceKey.minecraft("resin_brick_stairs")); + + public static final DefaultedRegistryReference RESIN_BRICK_WALL = BlockTypes.key(ResourceKey.minecraft("resin_brick_wall")); + + public static final DefaultedRegistryReference RESIN_CLUMP = BlockTypes.key(ResourceKey.minecraft("resin_clump")); + public static final DefaultedRegistryReference RESPAWN_ANCHOR = BlockTypes.key(ResourceKey.minecraft("respawn_anchor")); public static final DefaultedRegistryReference ROOTED_DIRT = BlockTypes.key(ResourceKey.minecraft("rooted_dirt")); @@ -1704,6 +1838,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference SEA_PICKLE = BlockTypes.key(ResourceKey.minecraft("sea_pickle")); + public static final DefaultedRegistryReference SHORT_DRY_GRASS = BlockTypes.key(ResourceKey.minecraft("short_dry_grass")); + public static final DefaultedRegistryReference SHORT_GRASS = BlockTypes.key(ResourceKey.minecraft("short_grass")); public static final DefaultedRegistryReference SHROOMLIGHT = BlockTypes.key(ResourceKey.minecraft("shroomlight")); @@ -1794,6 +1930,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference SPRUCE_SAPLING = BlockTypes.key(ResourceKey.minecraft("spruce_sapling")); + public static final DefaultedRegistryReference SPRUCE_SHELF = BlockTypes.key(ResourceKey.minecraft("spruce_shelf")); + public static final DefaultedRegistryReference SPRUCE_SIGN = BlockTypes.key(ResourceKey.minecraft("spruce_sign")); public static final DefaultedRegistryReference SPRUCE_SLAB = BlockTypes.key(ResourceKey.minecraft("spruce_slab")); @@ -1864,6 +2002,10 @@ public final class BlockTypes { public static final DefaultedRegistryReference STRIPPED_OAK_WOOD = BlockTypes.key(ResourceKey.minecraft("stripped_oak_wood")); + public static final DefaultedRegistryReference STRIPPED_PALE_OAK_LOG = BlockTypes.key(ResourceKey.minecraft("stripped_pale_oak_log")); + + public static final DefaultedRegistryReference STRIPPED_PALE_OAK_WOOD = BlockTypes.key(ResourceKey.minecraft("stripped_pale_oak_wood")); + public static final DefaultedRegistryReference STRIPPED_SPRUCE_LOG = BlockTypes.key(ResourceKey.minecraft("stripped_spruce_log")); public static final DefaultedRegistryReference STRIPPED_SPRUCE_WOOD = BlockTypes.key(ResourceKey.minecraft("stripped_spruce_wood")); @@ -1886,6 +2028,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference SWEET_BERRY_BUSH = BlockTypes.key(ResourceKey.minecraft("sweet_berry_bush")); + public static final DefaultedRegistryReference TALL_DRY_GRASS = BlockTypes.key(ResourceKey.minecraft("tall_dry_grass")); + public static final DefaultedRegistryReference TALL_GRASS = BlockTypes.key(ResourceKey.minecraft("tall_grass")); public static final DefaultedRegistryReference TALL_SEAGRASS = BlockTypes.key(ResourceKey.minecraft("tall_seagrass")); @@ -1894,6 +2038,10 @@ public final class BlockTypes { public static final DefaultedRegistryReference TERRACOTTA = BlockTypes.key(ResourceKey.minecraft("terracotta")); + public static final DefaultedRegistryReference TEST_BLOCK = BlockTypes.key(ResourceKey.minecraft("test_block")); + + public static final DefaultedRegistryReference TEST_INSTANCE_BLOCK = BlockTypes.key(ResourceKey.minecraft("test_instance_block")); + public static final DefaultedRegistryReference TINTED_GLASS = BlockTypes.key(ResourceKey.minecraft("tinted_glass")); public static final DefaultedRegistryReference TNT = BlockTypes.key(ResourceKey.minecraft("tnt")); @@ -1974,6 +2122,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference WARPED_ROOTS = BlockTypes.key(ResourceKey.minecraft("warped_roots")); + public static final DefaultedRegistryReference WARPED_SHELF = BlockTypes.key(ResourceKey.minecraft("warped_shelf")); + public static final DefaultedRegistryReference WARPED_SIGN = BlockTypes.key(ResourceKey.minecraft("warped_sign")); public static final DefaultedRegistryReference WARPED_SLAB = BlockTypes.key(ResourceKey.minecraft("warped_slab")); @@ -1996,14 +2146,24 @@ public final class BlockTypes { public static final DefaultedRegistryReference WAXED_CHISELED_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_chiseled_copper")); + public static final DefaultedRegistryReference WAXED_COPPER_BARS = BlockTypes.key(ResourceKey.minecraft("waxed_copper_bars")); + public static final DefaultedRegistryReference WAXED_COPPER_BLOCK = BlockTypes.key(ResourceKey.minecraft("waxed_copper_block")); public static final DefaultedRegistryReference WAXED_COPPER_BULB = BlockTypes.key(ResourceKey.minecraft("waxed_copper_bulb")); + public static final DefaultedRegistryReference WAXED_COPPER_CHAIN = BlockTypes.key(ResourceKey.minecraft("waxed_copper_chain")); + + public static final DefaultedRegistryReference WAXED_COPPER_CHEST = BlockTypes.key(ResourceKey.minecraft("waxed_copper_chest")); + public static final DefaultedRegistryReference WAXED_COPPER_DOOR = BlockTypes.key(ResourceKey.minecraft("waxed_copper_door")); + public static final DefaultedRegistryReference WAXED_COPPER_GOLEM_STATUE = BlockTypes.key(ResourceKey.minecraft("waxed_copper_golem_statue")); + public static final DefaultedRegistryReference WAXED_COPPER_GRATE = BlockTypes.key(ResourceKey.minecraft("waxed_copper_grate")); + public static final DefaultedRegistryReference WAXED_COPPER_LANTERN = BlockTypes.key(ResourceKey.minecraft("waxed_copper_lantern")); + public static final DefaultedRegistryReference WAXED_COPPER_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("waxed_copper_trapdoor")); public static final DefaultedRegistryReference WAXED_CUT_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_cut_copper")); @@ -2016,12 +2176,22 @@ public final class BlockTypes { public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_BARS = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_bars")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_BULB = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_bulb")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_CHAIN = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_chain")); + + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_CHEST = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_chest")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_DOOR = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_door")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_GOLEM_STATUE = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_golem_statue")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_GRATE = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_grate")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_LANTERN = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_lantern")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_copper_trapdoor")); public static final DefaultedRegistryReference WAXED_EXPOSED_CUT_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_cut_copper")); @@ -2030,16 +2200,30 @@ public final class BlockTypes { public static final DefaultedRegistryReference WAXED_EXPOSED_CUT_COPPER_STAIRS = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_cut_copper_stairs")); + public static final DefaultedRegistryReference WAXED_EXPOSED_LIGHTNING_ROD = BlockTypes.key(ResourceKey.minecraft("waxed_exposed_lightning_rod")); + + public static final DefaultedRegistryReference WAXED_LIGHTNING_ROD = BlockTypes.key(ResourceKey.minecraft("waxed_lightning_rod")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_CHISELED_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_chiseled_copper")); public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_BARS = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_bars")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_BULB = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_bulb")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_CHAIN = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_chain")); + + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_CHEST = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_chest")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_DOOR = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_door")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_GOLEM_STATUE = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_golem_statue")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_GRATE = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_grate")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_LANTERN = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_lantern")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_trapdoor")); public static final DefaultedRegistryReference WAXED_OXIDIZED_CUT_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_cut_copper")); @@ -2048,16 +2232,28 @@ public final class BlockTypes { public static final DefaultedRegistryReference WAXED_OXIDIZED_CUT_COPPER_STAIRS = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_cut_copper_stairs")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_LIGHTNING_ROD = BlockTypes.key(ResourceKey.minecraft("waxed_oxidized_lightning_rod")); + public static final DefaultedRegistryReference WAXED_WEATHERED_CHISELED_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_chiseled_copper")); public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_BARS = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_bars")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_BULB = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_bulb")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_CHAIN = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_chain")); + + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_CHEST = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_chest")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_DOOR = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_door")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_GOLEM_STATUE = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_golem_statue")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_GRATE = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_grate")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_LANTERN = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_lantern")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_copper_trapdoor")); public static final DefaultedRegistryReference WAXED_WEATHERED_CUT_COPPER = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_cut_copper")); @@ -2066,16 +2262,28 @@ public final class BlockTypes { public static final DefaultedRegistryReference WAXED_WEATHERED_CUT_COPPER_STAIRS = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_cut_copper_stairs")); + public static final DefaultedRegistryReference WAXED_WEATHERED_LIGHTNING_ROD = BlockTypes.key(ResourceKey.minecraft("waxed_weathered_lightning_rod")); + public static final DefaultedRegistryReference WEATHERED_CHISELED_COPPER = BlockTypes.key(ResourceKey.minecraft("weathered_chiseled_copper")); public static final DefaultedRegistryReference WEATHERED_COPPER = BlockTypes.key(ResourceKey.minecraft("weathered_copper")); + public static final DefaultedRegistryReference WEATHERED_COPPER_BARS = BlockTypes.key(ResourceKey.minecraft("weathered_copper_bars")); + public static final DefaultedRegistryReference WEATHERED_COPPER_BULB = BlockTypes.key(ResourceKey.minecraft("weathered_copper_bulb")); + public static final DefaultedRegistryReference WEATHERED_COPPER_CHAIN = BlockTypes.key(ResourceKey.minecraft("weathered_copper_chain")); + + public static final DefaultedRegistryReference WEATHERED_COPPER_CHEST = BlockTypes.key(ResourceKey.minecraft("weathered_copper_chest")); + public static final DefaultedRegistryReference WEATHERED_COPPER_DOOR = BlockTypes.key(ResourceKey.minecraft("weathered_copper_door")); + public static final DefaultedRegistryReference WEATHERED_COPPER_GOLEM_STATUE = BlockTypes.key(ResourceKey.minecraft("weathered_copper_golem_statue")); + public static final DefaultedRegistryReference WEATHERED_COPPER_GRATE = BlockTypes.key(ResourceKey.minecraft("weathered_copper_grate")); + public static final DefaultedRegistryReference WEATHERED_COPPER_LANTERN = BlockTypes.key(ResourceKey.minecraft("weathered_copper_lantern")); + public static final DefaultedRegistryReference WEATHERED_COPPER_TRAPDOOR = BlockTypes.key(ResourceKey.minecraft("weathered_copper_trapdoor")); public static final DefaultedRegistryReference WEATHERED_CUT_COPPER = BlockTypes.key(ResourceKey.minecraft("weathered_cut_copper")); @@ -2084,6 +2292,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference WEATHERED_CUT_COPPER_STAIRS = BlockTypes.key(ResourceKey.minecraft("weathered_cut_copper_stairs")); + public static final DefaultedRegistryReference WEATHERED_LIGHTNING_ROD = BlockTypes.key(ResourceKey.minecraft("weathered_lightning_rod")); + public static final DefaultedRegistryReference WEEPING_VINES = BlockTypes.key(ResourceKey.minecraft("weeping_vines")); public static final DefaultedRegistryReference WEEPING_VINES_PLANT = BlockTypes.key(ResourceKey.minecraft("weeping_vines_plant")); @@ -2122,6 +2332,8 @@ public final class BlockTypes { public static final DefaultedRegistryReference WHITE_WOOL = BlockTypes.key(ResourceKey.minecraft("white_wool")); + public static final DefaultedRegistryReference WILDFLOWERS = BlockTypes.key(ResourceKey.minecraft("wildflowers")); + public static final DefaultedRegistryReference WITHER_ROSE = BlockTypes.key(ResourceKey.minecraft("wither_rose")); public static final DefaultedRegistryReference WITHER_SKELETON_SKULL = BlockTypes.key(ResourceKey.minecraft("wither_skeleton_skull")); diff --git a/src/main/java/org/spongepowered/api/block/entity/BlockEntityType.java b/src/main/java/org/spongepowered/api/block/entity/BlockEntityType.java index 52558596808..8c139afc594 100644 --- a/src/main/java/org/spongepowered/api/block/entity/BlockEntityType.java +++ b/src/main/java/org/spongepowered/api/block/entity/BlockEntityType.java @@ -32,7 +32,7 @@ * Describes a type of block entity. */ @CatalogedBy(BlockEntityTypes.class) -public interface BlockEntityType extends DefaultedRegistryValue { +public interface BlockEntityType extends DefaultedRegistryValue { /** * Determines if the provided block is considered valid by the {@link BlockEntity}. 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 610f4eef818..6bfe5a6b71f 100644 --- a/src/main/java/org/spongepowered/api/block/entity/BlockEntityTypes.java +++ b/src/main/java/org/spongepowered/api/block/entity/BlockEntityTypes.java @@ -72,8 +72,12 @@ public final class BlockEntityTypes { public static final DefaultedRegistryReference CONDUIT = BlockEntityTypes.key(ResourceKey.minecraft("conduit")); + public static final DefaultedRegistryReference COPPER_GOLEM_STATUE = BlockEntityTypes.key(ResourceKey.minecraft("copper_golem_statue")); + public static final DefaultedRegistryReference CRAFTER = BlockEntityTypes.key(ResourceKey.minecraft("crafter")); + public static final DefaultedRegistryReference CREAKING_HEART = BlockEntityTypes.key(ResourceKey.minecraft("creaking_heart")); + public static final DefaultedRegistryReference DAYLIGHT_DETECTOR = BlockEntityTypes.key(ResourceKey.minecraft("daylight_detector")); public static final DefaultedRegistryReference DECORATED_POT = BlockEntityTypes.key(ResourceKey.minecraft("decorated_pot")); @@ -112,6 +116,8 @@ public final class BlockEntityTypes { public static final DefaultedRegistryReference SCULK_SHRIEKER = BlockEntityTypes.key(ResourceKey.minecraft("sculk_shrieker")); + public static final DefaultedRegistryReference SHELF = BlockEntityTypes.key(ResourceKey.minecraft("shelf")); + public static final DefaultedRegistryReference SHULKER_BOX = BlockEntityTypes.key(ResourceKey.minecraft("shulker_box")); public static final DefaultedRegistryReference SIGN = BlockEntityTypes.key(ResourceKey.minecraft("sign")); @@ -122,6 +128,10 @@ public final class BlockEntityTypes { public static final DefaultedRegistryReference STRUCTURE_BLOCK = BlockEntityTypes.key(ResourceKey.minecraft("structure_block")); + public static final DefaultedRegistryReference TEST_BLOCK = BlockEntityTypes.key(ResourceKey.minecraft("test_block")); + + public static final DefaultedRegistryReference TEST_INSTANCE_BLOCK = BlockEntityTypes.key(ResourceKey.minecraft("test_instance_block")); + public static final DefaultedRegistryReference TRAPPED_CHEST = BlockEntityTypes.key(ResourceKey.minecraft("trapped_chest")); public static final DefaultedRegistryReference TRIAL_SPAWNER = BlockEntityTypes.key(ResourceKey.minecraft("trial_spawner")); diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/NoFactoryMethod.java b/src/main/java/org/spongepowered/api/block/entity/CreakingHeart.java similarity index 81% rename from src/main/java/org/spongepowered/api/util/annotation/eventgen/NoFactoryMethod.java rename to src/main/java/org/spongepowered/api/block/entity/CreakingHeart.java index 31872277cab..bf4516c7a45 100644 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/NoFactoryMethod.java +++ b/src/main/java/org/spongepowered/api/block/entity/CreakingHeart.java @@ -22,13 +22,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.util.annotation.eventgen; +package org.spongepowered.api.block.entity; /** - * Explicitly disables generation of an event factory method for an event class. + * Represents a CreakingHeart block entity. * - *

By default, an event which contains subinterfaces will not have - * an event factory method generated.

+ * @see Creaking Heart */ -public @interface NoFactoryMethod { +public interface CreakingHeart extends BlockEntity { + } diff --git a/src/main/java/org/spongepowered/api/block/transaction/NotificationTicket.java b/src/main/java/org/spongepowered/api/block/transaction/NotificationTicket.java index 4b1a6fe51f2..b6951b104f0 100644 --- a/src/main/java/org/spongepowered/api/block/transaction/NotificationTicket.java +++ b/src/main/java/org/spongepowered/api/block/transaction/NotificationTicket.java @@ -28,24 +28,60 @@ import org.spongepowered.api.world.LocatableBlock; import org.spongepowered.math.vector.Vector3i; +/** + * Represents a notification that is being proposed to the engine. + */ public interface NotificationTicket { + /** + * Gets the notifier block that scheduled this notification. + * + * @return The notifier block + */ LocatableBlock notifier(); + /** + * Gets the notifier position that scheduled this notification. + * + * @return The notifier position + */ default Vector3i notifierPosition() { return this.notifier().blockPosition(); } + /** + * Gets the target block of this notification. + * + * @return The target block + */ BlockSnapshot target(); + /** + * Gets the target position of this notification. + * + * @return The target position + */ default Vector3i targetPosition() { return this.target().position(); } + /** + * Gets whether this ticket is marked as valid. + * + * @return The valid state of this ticket + */ boolean valid(); + /** + * Sets whether this ticket is valid or not. + * + * @param valid The valid state of this ticket + */ void setValid(boolean valid); + /** + * Invalidates this ticket. + */ default void invalidate() { this.setValid(false); } diff --git a/src/main/java/org/spongepowered/api/block/transaction/Operation.java b/src/main/java/org/spongepowered/api/block/transaction/Operation.java index eb091fe949f..0fc8fe18a42 100644 --- a/src/main/java/org/spongepowered/api/block/transaction/Operation.java +++ b/src/main/java/org/spongepowered/api/block/transaction/Operation.java @@ -34,5 +34,5 @@ * but holds no bearing on the order of a transaction taking place. */ @CatalogedBy(Operations.class) -public interface Operation extends DefaultedRegistryValue { +public interface Operation extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/command/Command.java b/src/main/java/org/spongepowered/api/command/Command.java index 92db1fadbcd..f106ab73c2d 100644 --- a/src/main/java/org/spongepowered/api/command/Command.java +++ b/src/main/java/org/spongepowered/api/command/Command.java @@ -41,6 +41,7 @@ import org.spongepowered.api.event.Cause; import org.spongepowered.api.event.EventContext; import org.spongepowered.api.event.lifecycle.RegisterCommandEvent; +import org.spongepowered.api.registry.RegistryHolder; import org.spongepowered.api.service.permission.PermissionDescription; import org.spongepowered.api.service.permission.Subject; @@ -207,14 +208,15 @@ interface Raw extends Command { *

Defaults to a command with an optional string argument string that * is greedy.

* + * @param registryHolder The owning {@link RegistryHolder registry holder}. * @return The tree. */ - default CommandTreeNode.Root commandTree() { + default CommandTreeNode.Root commandTree(RegistryHolder registryHolder) { return CommandTreeNode.root() .executable() .requires(this::canExecute) .child("arguments", - CommandTreeNodeTypes.STRING.get().createNode().greedy().executable().customCompletions()); + CommandTreeNodeTypes.STRING.get(registryHolder).createNode().greedy().executable().customCompletions()); } } diff --git a/src/main/java/org/spongepowered/api/command/parameter/managed/ValueCompleter.java b/src/main/java/org/spongepowered/api/command/parameter/managed/ValueCompleter.java index 1762d44a9c0..9c674a9f343 100644 --- a/src/main/java/org/spongepowered/api/command/parameter/managed/ValueCompleter.java +++ b/src/main/java/org/spongepowered/api/command/parameter/managed/ValueCompleter.java @@ -26,6 +26,7 @@ import org.spongepowered.api.command.CommandCompletion; import org.spongepowered.api.command.parameter.CommandContext; +import org.spongepowered.api.registry.RegistryHolder; import java.util.List; @@ -46,4 +47,14 @@ public interface ValueCompleter { */ List complete(CommandContext context, String currentInput); + /** + * Creates a new {@link ValueCompleter} that is bound to + * a specific {@link RegistryHolder registry holder}. + * + * @param registryHolder The owning {@link RegistryHolder registry holder}. + * @return The bound {@link ValueCompleter}. + */ + default ValueCompleter bind(RegistryHolder registryHolder) { + return this; + } } diff --git a/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParameter.java b/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParameter.java index b687d1a2ec1..2ccb3c8c149 100644 --- a/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParameter.java +++ b/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParameter.java @@ -32,6 +32,7 @@ import org.spongepowered.api.command.parameter.CommandContext; import org.spongepowered.api.command.parameter.Parameter; import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.registry.RegistryHolder; import java.util.List; import java.util.Optional; @@ -47,13 +48,18 @@ * @see org.spongepowered.api.command.parameter.managed.ValueParser * @see org.spongepowered.api.command.parameter.managed.ValueUsage */ -public interface ValueParameter extends DefaultedRegistryValue, ValueCompleter, ValueParser, ValueUsage { +public interface ValueParameter extends DefaultedRegistryValue>, ValueCompleter, ValueParser, ValueUsage { @Override default String usage(@NonNull final String key) { return key; } + @Override + default ValueParameter bind(RegistryHolder registryHolder) { + return this; + } + /** * A {@link ValueParameter} that does not rely on the {@link CommandContext} * or {@link Parameter.Key} to parse its results. @@ -118,5 +124,4 @@ default List complete(final CommandContext context, final Str } } - } diff --git a/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParameterModifier.java b/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParameterModifier.java index e236fba6d2e..c924e877988 100644 --- a/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParameterModifier.java +++ b/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParameterModifier.java @@ -32,6 +32,7 @@ import org.spongepowered.api.command.parameter.ArgumentReader; import org.spongepowered.api.command.parameter.CommandContext; import org.spongepowered.api.command.parameter.Parameter; +import org.spongepowered.api.registry.RegistryHolder; import java.util.List; import java.util.Optional; @@ -146,4 +147,14 @@ default List modifyCompletion( return exceptionMessage; } + /** + * Creates a new {@link ValueParameterModifier} that is bound to + * a specific {@link RegistryHolder registry holder}. + * + * @param registryHolder The owning {@link RegistryHolder registry holder}. + * @return The bound {@link ValueParameterModifier}. + */ + default ValueParameterModifier bind(RegistryHolder registryHolder) { + return this; + } } diff --git a/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParser.java b/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParser.java index 39be340b7f4..e74032cf4d3 100644 --- a/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParser.java +++ b/src/main/java/org/spongepowered/api/command/parameter/managed/ValueParser.java @@ -32,6 +32,7 @@ import org.spongepowered.api.command.parameter.managed.clientcompletion.ClientCompletionType; import org.spongepowered.api.command.parameter.managed.clientcompletion.ClientCompletionTypes; import org.spongepowered.api.event.Cause; +import org.spongepowered.api.registry.RegistryHolder; import java.util.Collections; import java.util.List; @@ -113,4 +114,14 @@ default List clientCompletionType() { return Collections.emptyList(); } + /** + * Creates a new {@link ValueParser} that is bound to + * a specific {@link RegistryHolder registry holder}. + * + * @param registryHolder The owning {@link RegistryHolder registry holder}. + * @return The bound {@link ValueParser}. + */ + default ValueParser bind(RegistryHolder registryHolder) { + return this; + } } diff --git a/src/main/java/org/spongepowered/api/command/parameter/managed/clientcompletion/ClientCompletionType.java b/src/main/java/org/spongepowered/api/command/parameter/managed/clientcompletion/ClientCompletionType.java index fc088fbf823..816e048b98a 100644 --- a/src/main/java/org/spongepowered/api/command/parameter/managed/clientcompletion/ClientCompletionType.java +++ b/src/main/java/org/spongepowered/api/command/parameter/managed/clientcompletion/ClientCompletionType.java @@ -37,5 +37,5 @@ * types

*/ @CatalogedBy(ClientCompletionTypes.class) -public interface ClientCompletionType extends DefaultedRegistryValue { +public interface ClientCompletionType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/command/parameter/managed/operator/Operator.java b/src/main/java/org/spongepowered/api/command/parameter/managed/operator/Operator.java index 725c39e6779..a36ffb3121b 100644 --- a/src/main/java/org/spongepowered/api/command/parameter/managed/operator/Operator.java +++ b/src/main/java/org/spongepowered/api/command/parameter/managed/operator/Operator.java @@ -25,6 +25,7 @@ package org.spongepowered.api.command.parameter.managed.operator; import org.spongepowered.api.command.parameter.managed.standard.ResourceKeyedValueParameters; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; /** @@ -33,7 +34,7 @@ * @see ResourceKeyedValueParameters#OPERATOR */ @CatalogedBy(Operators.class) -public interface Operator { +public interface Operator extends DefaultedRegistryValue { /** * The string representation of this operator diff --git a/src/main/java/org/spongepowered/api/command/parameter/managed/standard/ResourceKeyedValueParameter.java b/src/main/java/org/spongepowered/api/command/parameter/managed/standard/ResourceKeyedValueParameter.java index 529f05aa9f5..ba6b0845f02 100644 --- a/src/main/java/org/spongepowered/api/command/parameter/managed/standard/ResourceKeyedValueParameter.java +++ b/src/main/java/org/spongepowered/api/command/parameter/managed/standard/ResourceKeyedValueParameter.java @@ -34,6 +34,6 @@ * @param The type of value that the parameter will return. */ @CatalogedBy(ResourceKeyedValueParameters.class) -public interface ResourceKeyedValueParameter extends ValueParameter.Simple, ResourceKeyed { +public interface ResourceKeyedValueParameter extends ValueParameter, ResourceKeyed { } diff --git a/src/main/java/org/spongepowered/api/command/registrar/CommandRegistrarType.java b/src/main/java/org/spongepowered/api/command/registrar/CommandRegistrarType.java index ff2393a7642..b57f5974aed 100644 --- a/src/main/java/org/spongepowered/api/command/registrar/CommandRegistrarType.java +++ b/src/main/java/org/spongepowered/api/command/registrar/CommandRegistrarType.java @@ -27,6 +27,7 @@ import io.leangen.geantyref.TypeToken; import org.spongepowered.api.command.manager.CommandManager; import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.registry.RegistryHolder; /** * A type of {@link CommandRegistrar}. @@ -36,7 +37,7 @@ * * @param the handled command type */ -public interface CommandRegistrarType extends DefaultedRegistryValue { +public interface CommandRegistrarType extends DefaultedRegistryValue> { /** * Gets the type of command that this registrar handles. @@ -50,7 +51,8 @@ public interface CommandRegistrarType extends DefaultedRegistryValue { * * @param manager The {@link CommandManager} that has requested the creation * of the {@link CommandRegistrar} associated with this type + * @param registryHolder The owning {@link RegistryHolder registry holder}. * @return the newly created registrar */ - CommandRegistrar create(final CommandManager.Mutable manager); + CommandRegistrar create(final CommandManager.Mutable manager, RegistryHolder registryHolder); } diff --git a/src/main/java/org/spongepowered/api/command/registrar/tree/CommandCompletionProviders.java b/src/main/java/org/spongepowered/api/command/registrar/tree/CommandCompletionProviders.java index 32c575d89c0..8e9bc53d993 100644 --- a/src/main/java/org/spongepowered/api/command/registrar/tree/CommandCompletionProviders.java +++ b/src/main/java/org/spongepowered/api/command/registrar/tree/CommandCompletionProviders.java @@ -28,7 +28,6 @@ import org.spongepowered.api.Sponge; import org.spongepowered.api.effect.sound.SoundType; import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.item.recipe.Recipe; import org.spongepowered.api.registry.DefaultedRegistryReference; import org.spongepowered.api.registry.Registry; import org.spongepowered.api.registry.RegistryKey; @@ -44,15 +43,6 @@ public final class CommandCompletionProviders { // SORTFIELDS:ON - /** - * Instructs the node represented by a {@link CommandTreeNode} to display - * all known {@link Recipe recipes}. - * - *

This provider is intended for use with a {@link ResourceKey} parser. - *

- */ - public static final DefaultedRegistryReference ALL_RECIPES = CommandCompletionProviders.key(ResourceKey.minecraft("all_recipes")); - /** * Instructs the node represented by a {@link CommandTreeNode} to display * all known {@link SoundType sounds}. diff --git a/src/main/java/org/spongepowered/api/command/registrar/tree/CommandTreeNodeType.java b/src/main/java/org/spongepowered/api/command/registrar/tree/CommandTreeNodeType.java index 56903fc2222..b8ec861745d 100644 --- a/src/main/java/org/spongepowered/api/command/registrar/tree/CommandTreeNodeType.java +++ b/src/main/java/org/spongepowered/api/command/registrar/tree/CommandTreeNodeType.java @@ -55,7 +55,7 @@ * displaying and completing command strings.

*/ @CatalogedBy(CommandTreeNodeTypes.class) -public interface CommandTreeNodeType> extends DefaultedRegistryValue, ResourceKeyed { +public interface CommandTreeNodeType> extends DefaultedRegistryValue>, ResourceKeyed { /** * Creates a {@link CommandTreeNode} that represents this diff --git a/src/main/java/org/spongepowered/api/command/registrar/tree/CommandTreeNodeTypes.java b/src/main/java/org/spongepowered/api/command/registrar/tree/CommandTreeNodeTypes.java index 00bf0c0e289..a5ff2c1c85e 100644 --- a/src/main/java/org/spongepowered/api/command/registrar/tree/CommandTreeNodeTypes.java +++ b/src/main/java/org/spongepowered/api/command/registrar/tree/CommandTreeNodeTypes.java @@ -37,7 +37,7 @@ * The known {@link CommandTreeNodeType types} available on the vanilla client. */ @SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.GAME) +@RegistryScopes(scopes = RegistryScope.ENGINE) public final class CommandTreeNodeTypes { // @formatter:off @@ -134,10 +134,10 @@ private CommandTreeNodeTypes() { } public static Registry> registry() { - return Sponge.game().registry(RegistryTypes.COMMAND_TREE_NODE_TYPE); + return Sponge.server().registry(RegistryTypes.COMMAND_TREE_NODE_TYPE); } private static > DefaultedRegistryReference> key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.COMMAND_TREE_NODE_TYPE, location).asDefaultedReference(Sponge::game); + return RegistryKey.of(RegistryTypes.COMMAND_TREE_NODE_TYPE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/command/selector/SelectorSortAlgorithm.java b/src/main/java/org/spongepowered/api/command/selector/SelectorSortAlgorithm.java index f0b5530fbd6..ad4aa651e81 100644 --- a/src/main/java/org/spongepowered/api/command/selector/SelectorSortAlgorithm.java +++ b/src/main/java/org/spongepowered/api/command/selector/SelectorSortAlgorithm.java @@ -32,6 +32,6 @@ * will have a significant effect when limits are imposed on the selector. */ @CatalogedBy(SelectorSortAlgorithms.class) -public interface SelectorSortAlgorithm extends DefaultedRegistryValue { +public interface SelectorSortAlgorithm extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/command/selector/SelectorType.java b/src/main/java/org/spongepowered/api/command/selector/SelectorType.java index a086ea58121..238799b19fc 100644 --- a/src/main/java/org/spongepowered/api/command/selector/SelectorType.java +++ b/src/main/java/org/spongepowered/api/command/selector/SelectorType.java @@ -31,7 +31,7 @@ * Represents a type of selector that Minecraft supplies. */ @CatalogedBy(SelectorTypes.class) -public interface SelectorType extends DefaultedRegistryValue { +public interface SelectorType extends DefaultedRegistryValue { /** * Gets the token that represents this selector type when used in commands. diff --git a/src/main/java/org/spongepowered/api/data/BlockStateKeys.java b/src/main/java/org/spongepowered/api/data/BlockStateKeys.java index 32c50669fac..576f616b83a 100644 --- a/src/main/java/org/spongepowered/api/data/BlockStateKeys.java +++ b/src/main/java/org/spongepowered/api/data/BlockStateKeys.java @@ -30,6 +30,8 @@ import org.spongepowered.api.data.type.BellAttachmentType; import org.spongepowered.api.data.type.ChestAttachmentType; import org.spongepowered.api.data.type.ComparatorMode; +import org.spongepowered.api.data.type.CopperGolemPose; +import org.spongepowered.api.data.type.CreakingHeartState; import org.spongepowered.api.data.type.DoorHinge; import org.spongepowered.api.data.type.DripstoneSegment; import org.spongepowered.api.data.type.InstrumentType; @@ -38,9 +40,11 @@ import org.spongepowered.api.data.type.PortionType; import org.spongepowered.api.data.type.RailDirection; import org.spongepowered.api.data.type.SculkSensorState; +import org.spongepowered.api.data.type.SideChain; import org.spongepowered.api.data.type.SlabPortion; import org.spongepowered.api.data.type.StairShape; import org.spongepowered.api.data.type.StructureMode; +import org.spongepowered.api.data.type.TestBlockMode; import org.spongepowered.api.data.type.Tilt; import org.spongepowered.api.data.type.TrialSpawnerState; import org.spongepowered.api.data.type.VaultState; @@ -98,24 +102,16 @@ public final class BlockStateKeys { public static final Key> CHEST_TYPE = BlockStateKeys.key(ResourceKey.minecraft("property/type"), ChestAttachmentType.class); - public static final Key> CHISELED_BOOKSHELF_SLOT_0_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_0_occupied"), Boolean.class); - - public static final Key> CHISELED_BOOKSHELF_SLOT_1_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_1_occupied"), Boolean.class); - - public static final Key> CHISELED_BOOKSHELF_SLOT_2_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_2_occupied"), Boolean.class); - - public static final Key> CHISELED_BOOKSHELF_SLOT_3_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_3_occupied"), Boolean.class); - - public static final Key> CHISELED_BOOKSHELF_SLOT_4_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_4_occupied"), Boolean.class); - - public static final Key> CHISELED_BOOKSHELF_SLOT_5_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_5_occupied"), Boolean.class); - public static final Key> CONDITIONAL = BlockStateKeys.key(ResourceKey.minecraft("property/conditional"), Boolean.class); + public static final Key> COPPER_GOLEM_POSE = BlockStateKeys.key(ResourceKey.minecraft("property/copper_golem_pose"), CopperGolemPose.class); + public static final Key> CRACKED = BlockStateKeys.key(ResourceKey.minecraft("property/cracked"), Boolean.class); public static final Key> CRAFTING = BlockStateKeys.key(ResourceKey.minecraft("property/crafting"), Boolean.class); + public static final Key> CREAKING_HEART_STATE = BlockStateKeys.key(ResourceKey.minecraft("property/creaking_heart_state"), CreakingHeartState.class); + public static final Key> DELAY = BlockStateKeys.key(ResourceKey.minecraft("property/delay"), Integer.class); public static final Key> DISARMED = BlockStateKeys.key(ResourceKey.minecraft("property/disarmed"), Boolean.class); @@ -130,6 +126,8 @@ public final class BlockStateKeys { public static final Key> DRAG = BlockStateKeys.key(ResourceKey.minecraft("property/drag"), Boolean.class); + public static final Key> DRIED_GHAST_HYDRATION_LEVELS = BlockStateKeys.key(ResourceKey.minecraft("property/hydration"), Integer.class); + public static final Key> DRIPSTONE_THICKNESS = BlockStateKeys.key(ResourceKey.minecraft("property/thickness"), DripstoneSegment.class); public static final Key> DUSTED = BlockStateKeys.key(ResourceKey.minecraft("property/dusted"), Integer.class); @@ -196,10 +194,14 @@ public final class BlockStateKeys { public static final Key> LOCKED = BlockStateKeys.key(ResourceKey.minecraft("property/locked"), Boolean.class); + public static final Key> MAP = BlockStateKeys.key(ResourceKey.minecraft("property/map"), Boolean.class); + public static final Key> MODE_COMPARATOR = BlockStateKeys.key(ResourceKey.minecraft("property/mode"), ComparatorMode.class); public static final Key> MOISTURE = BlockStateKeys.key(ResourceKey.minecraft("property/moisture"), Integer.class); + public static final Key> NATURAL = BlockStateKeys.key(ResourceKey.minecraft("property/natural"), Boolean.class); + public static final Key> NORTH = BlockStateKeys.key(ResourceKey.minecraft("property/north"), Boolean.class); public static final Key> NORTH_REDSTONE = BlockStateKeys.key(ResourceKey.minecraft("property/north"), WireAttachmentType.class); @@ -238,14 +240,30 @@ public final class BlockStateKeys { public static final Key> SCULK_SENSOR_PHASE = BlockStateKeys.key(ResourceKey.minecraft("property/sculk_sensor_phase"), SculkSensorState.class); + public static final Key> SEGMENT_AMOUNT = BlockStateKeys.key(ResourceKey.minecraft("property/segment_amount"), Integer.class); + public static final Key> SHORT = BlockStateKeys.key(ResourceKey.minecraft("property/short"), Boolean.class); public static final Key> SHRIEKING = BlockStateKeys.key(ResourceKey.minecraft("property/shrieking"), Boolean.class); + public static final Key> SIDE_CHAIN_PART = BlockStateKeys.key(ResourceKey.minecraft("property/side_chain"), SideChain.class); + public static final Key> SIGNAL_FIRE = BlockStateKeys.key(ResourceKey.minecraft("property/signal_fire"), Boolean.class); public static final Key> SLAB_TYPE = BlockStateKeys.key(ResourceKey.minecraft("property/type"), SlabPortion.class); + public static final Key> SLOT_0_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_0_occupied"), Boolean.class); + + public static final Key> SLOT_1_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_1_occupied"), Boolean.class); + + public static final Key> SLOT_2_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_2_occupied"), Boolean.class); + + public static final Key> SLOT_3_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_3_occupied"), Boolean.class); + + public static final Key> SLOT_4_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_4_occupied"), Boolean.class); + + public static final Key> SLOT_5_OCCUPIED = BlockStateKeys.key(ResourceKey.minecraft("property/slot_5_occupied"), Boolean.class); + public static final Key> SNOWY = BlockStateKeys.key(ResourceKey.minecraft("property/snowy"), Boolean.class); public static final Key> SOUTH = BlockStateKeys.key(ResourceKey.minecraft("property/south"), Boolean.class); @@ -262,8 +280,12 @@ public final class BlockStateKeys { public static final Key> STRUCTUREBLOCK_MODE = BlockStateKeys.key(ResourceKey.minecraft("property/mode"), StructureMode.class); + public static final Key> TEST_BLOCK_MODE = BlockStateKeys.key(ResourceKey.minecraft("property/mode"), TestBlockMode.class); + public static final Key> TILT = BlockStateKeys.key(ResourceKey.minecraft("property/tilt"), Tilt.class); + public static final Key> TIP = BlockStateKeys.key(ResourceKey.minecraft("property/tip"), Boolean.class); + public static final Key> TRIAL_SPAWNER_STATE = BlockStateKeys.key(ResourceKey.minecraft("property/trial_spawner_state"), TrialSpawnerState.class); public static final Key> TRIGGERED = BlockStateKeys.key(ResourceKey.minecraft("property/triggered"), Boolean.class); diff --git a/src/main/java/org/spongepowered/api/data/DataManager.java b/src/main/java/org/spongepowered/api/data/DataManager.java index 2156bcc584d..face41e8a9b 100644 --- a/src/main/java/org/spongepowered/api/data/DataManager.java +++ b/src/main/java/org/spongepowered/api/data/DataManager.java @@ -131,7 +131,7 @@ public interface DataManager { * be read by a plugin-data datastore. * * @param legacyId The legacy id - * @param dataStoreKey The dataStore key set in {@link org.spongepowered.api.data.persistence.DataStore.Builder.HolderStep#pluginData(ResourceKey)} + * @param dataStoreKey The dataStore key set in {@link org.spongepowered.api.data.persistence.DataStore.Builder#pluginData(ResourceKey)} */ void registerLegacyManipulatorIds(String legacyId, ResourceKey dataStoreKey); diff --git a/src/main/java/org/spongepowered/api/data/DataManipulator.java b/src/main/java/org/spongepowered/api/data/DataManipulator.java index 05254bc457e..e70aba2b527 100644 --- a/src/main/java/org/spongepowered/api/data/DataManipulator.java +++ b/src/main/java/org/spongepowered/api/data/DataManipulator.java @@ -30,8 +30,8 @@ import org.spongepowered.api.data.value.Value; import org.spongepowered.api.data.value.ValueContainer; import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.util.annotation.eventgen.TransformWith; import org.spongepowered.api.world.World; +import org.spongepowered.eventgen.annotations.TransformWith; import java.util.Arrays; import java.util.Objects; diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java index ef79faed768..b5c847d3fb9 100644 --- a/src/main/java/org/spongepowered/api/data/Keys.java +++ b/src/main/java/org/spongepowered/api/data/Keys.java @@ -34,6 +34,7 @@ import org.spongepowered.api.block.entity.Banner; import org.spongepowered.api.block.entity.BlockEntity; import org.spongepowered.api.block.entity.CommandBlock; +import org.spongepowered.api.block.entity.CreakingHeart; import org.spongepowered.api.block.entity.DecoratedPot; import org.spongepowered.api.block.entity.EndGateway; import org.spongepowered.api.block.entity.Jukebox; @@ -53,12 +54,15 @@ import org.spongepowered.api.data.type.ArmorMaterial; import org.spongepowered.api.data.type.ArtType; import org.spongepowered.api.data.type.AttachmentSurface; -import org.spongepowered.api.data.type.BoatType; +import org.spongepowered.api.data.type.AxolotlVariant; import org.spongepowered.api.data.type.BodyPart; import org.spongepowered.api.data.type.BodyParts; import org.spongepowered.api.data.type.CatType; import org.spongepowered.api.data.type.ChestAttachmentType; +import org.spongepowered.api.data.type.ChickenVariant; import org.spongepowered.api.data.type.ComparatorMode; +import org.spongepowered.api.data.type.CopperOxidation; +import org.spongepowered.api.data.type.CowVariant; import org.spongepowered.api.data.type.DoorHinge; import org.spongepowered.api.data.type.DripstoneSegment; import org.spongepowered.api.data.type.DyeColor; @@ -68,6 +72,7 @@ import org.spongepowered.api.data.type.HorseColor; import org.spongepowered.api.data.type.HorseStyle; import org.spongepowered.api.data.type.InstrumentType; +import org.spongepowered.api.data.type.ItemAction; import org.spongepowered.api.data.type.ItemTier; import org.spongepowered.api.data.type.LlamaType; import org.spongepowered.api.data.type.MatterType; @@ -78,13 +83,17 @@ import org.spongepowered.api.data.type.ParrotType; import org.spongepowered.api.data.type.PhantomPhase; import org.spongepowered.api.data.type.PickupRule; +import org.spongepowered.api.data.type.PigType; 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.SalmonSize; import org.spongepowered.api.data.type.SculkSensorState; +import org.spongepowered.api.data.type.ShieldDamageReduction; +import org.spongepowered.api.data.type.ShieldItemDamageFunction; import org.spongepowered.api.data.type.SkinPart; import org.spongepowered.api.data.type.SlabPortion; import org.spongepowered.api.data.type.SpellType; @@ -97,11 +106,13 @@ import org.spongepowered.api.data.type.VillagerType; import org.spongepowered.api.data.type.WallConnectionState; import org.spongepowered.api.data.type.WireAttachmentType; +import org.spongepowered.api.data.type.WolfSoundVariant; import org.spongepowered.api.data.type.WolfVariant; import org.spongepowered.api.data.value.ListValue; import org.spongepowered.api.data.value.MapValue; import org.spongepowered.api.data.value.SetValue; import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.data.value.ValueContainer; import org.spongepowered.api.data.value.WeightedCollectionValue; import org.spongepowered.api.effect.VanishState; import org.spongepowered.api.effect.particle.ParticleEffect; @@ -124,6 +135,7 @@ import org.spongepowered.api.entity.Item; import org.spongepowered.api.entity.Ownable; import org.spongepowered.api.entity.ai.goal.GoalExecutorTypes; +import org.spongepowered.api.entity.attribute.ItemAttribute; import org.spongepowered.api.entity.display.BillboardType; import org.spongepowered.api.entity.display.DisplayEntity; import org.spongepowered.api.entity.display.ItemDisplayType; @@ -143,6 +155,7 @@ import org.spongepowered.api.entity.living.Humanoid; import org.spongepowered.api.entity.living.Living; import org.spongepowered.api.entity.living.animal.Animal; +import org.spongepowered.api.entity.living.animal.Axolotl; import org.spongepowered.api.entity.living.animal.Cat; import org.spongepowered.api.entity.living.animal.Chicken; import org.spongepowered.api.entity.living.animal.Fox; @@ -156,6 +169,7 @@ import org.spongepowered.api.entity.living.animal.TameableAnimal; import org.spongepowered.api.entity.living.animal.Turtle; import org.spongepowered.api.entity.living.animal.Wolf; +import org.spongepowered.api.entity.living.animal.cow.Cow; import org.spongepowered.api.entity.living.animal.cow.Mooshroom; import org.spongepowered.api.entity.living.animal.frog.Frog; import org.spongepowered.api.entity.living.animal.horse.Horse; @@ -163,10 +177,14 @@ import org.spongepowered.api.entity.living.animal.horse.llama.Llama; import org.spongepowered.api.entity.living.animal.horse.llama.TraderLlama; import org.spongepowered.api.entity.living.aquatic.Dolphin; +import org.spongepowered.api.entity.living.aquatic.fish.Pufferfish; +import org.spongepowered.api.entity.living.aquatic.fish.school.Salmon; import org.spongepowered.api.entity.living.aquatic.fish.school.TropicalFish; +import org.spongepowered.api.entity.living.golem.CopperGolem; import org.spongepowered.api.entity.living.golem.IronGolem; import org.spongepowered.api.entity.living.golem.Shulker; import org.spongepowered.api.entity.living.monster.Blaze; +import org.spongepowered.api.entity.living.monster.Creaking; import org.spongepowered.api.entity.living.monster.Creeper; import org.spongepowered.api.entity.living.monster.Enderman; import org.spongepowered.api.entity.living.monster.Endermite; @@ -187,6 +205,7 @@ import org.spongepowered.api.entity.living.monster.spider.Spider; import org.spongepowered.api.entity.living.monster.zombie.ZombieVillager; import org.spongepowered.api.entity.living.monster.zombie.ZombifiedPiglin; +import org.spongepowered.api.entity.living.player.CooldownTracker; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.User; import org.spongepowered.api.entity.living.player.chat.ChatVisibility; @@ -212,6 +231,8 @@ import org.spongepowered.api.entity.vehicle.minecart.Minecart; import org.spongepowered.api.entity.vehicle.minecart.MinecartLike; import org.spongepowered.api.entity.weather.LightningBolt; +import org.spongepowered.api.event.cause.entity.damage.DamageType; +import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; import org.spongepowered.api.event.cause.entity.damage.source.DamageSources; import org.spongepowered.api.fluid.FluidStackSnapshot; import org.spongepowered.api.fluid.FluidTypes; @@ -242,7 +263,9 @@ import org.spongepowered.api.projectile.source.ProjectileSource; import org.spongepowered.api.raid.Raid; import org.spongepowered.api.raid.RaidWave; +import org.spongepowered.api.registry.DefaultedRegistryType; import org.spongepowered.api.statistic.Statistic; +import org.spongepowered.api.tag.BlockTypeTags; import org.spongepowered.api.tag.Tag; import org.spongepowered.api.util.Axis; import org.spongepowered.api.util.Color; @@ -255,6 +278,7 @@ import org.spongepowered.api.util.orientation.Orientation; import org.spongepowered.api.world.DefaultWorldKeys; import org.spongepowered.api.world.SerializationBehavior; +import org.spongepowered.api.world.World; import org.spongepowered.api.world.WorldType; import org.spongepowered.api.world.WorldTypeEffect; import org.spongepowered.api.world.WorldTypes; @@ -271,7 +295,6 @@ import org.spongepowered.api.world.explosion.Explosion; import org.spongepowered.api.world.generation.ChunkGenerator; import org.spongepowered.api.world.generation.carver.Carver; -import org.spongepowered.api.world.generation.carver.CarvingStep; import org.spongepowered.api.world.generation.config.WorldGenerationConfig; import org.spongepowered.api.world.generation.feature.DecorationStep; import org.spongepowered.api.world.generation.feature.PlacedFeature; @@ -279,7 +302,8 @@ import org.spongepowered.api.world.portal.PortalLogic; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.api.world.server.ServerWorld; -import org.spongepowered.api.world.server.WorldTemplate; +import org.spongepowered.api.world.server.WorldArchetype; +import org.spongepowered.api.world.server.WorldArchetypeType; import org.spongepowered.api.world.server.storage.ServerWorldProperties; import org.spongepowered.api.world.storage.WorldProperties; import org.spongepowered.api.world.weather.Weather; @@ -373,6 +397,11 @@ public final class Keys { */ public static final Key> AMBIENT_PARTICLE = Keys.key(ResourceKey.sponge("ambient_particle"), ParticleConfig.class); + /** + * The set of {@link EntityType} allowed to equip an {@link ItemStack}. + */ + public static final Key>> ALLOWED_ENTITIES = Keys.setKey(ResourceKey.sponge("allowed_entities"), new TypeToken<>() {}); + /** * The ambient sound in a {@link Biome} * Readonly @@ -386,7 +415,7 @@ public final class Keys { * fade over time and the entity will become peaceful again once its anger * reaches its minimum.

*/ - public static final Key> ANGER_LEVEL = Keys.key(ResourceKey.sponge("anger_level"), Integer.class); + public static final Key> ANGER_LEVEL = Keys.key(ResourceKey.sponge("anger_level"), Long.class); /** * The set of {@link PotionEffect}s applied on use of an {@link ItemStack}. @@ -463,6 +492,11 @@ public final class Keys { */ public static final Key> AXIS = Keys.key(ResourceKey.sponge("axis"), Axis.class); + /** + * The {@link AxolotlVariant} of an {@link Axolotl}. + */ + public static final Key> AXOLOTL_VARIANT = Keys.key(ResourceKey.sponge("axolotl_variant"), AxolotlVariant.class); + /** * The ticks until a {@link Ageable} turns into an adult. */ @@ -541,7 +575,7 @@ public final class Keys { public static final Key> BLOCK_LIGHT = Keys.key(ResourceKey.sponge("block_light"), Integer.class); /** - * The {@link BlockState} of a {@link BlockOccupiedMinecart} or {@link FallingBlock}. + * The {@link BlockState} of a {@link BlockOccupiedMinecart}, {@link FallingBlock} or {@link Piston moving Piston}. */ public static final Key> BLOCK_STATE = Keys.key(ResourceKey.sponge("block_state"), BlockState.class); @@ -552,11 +586,6 @@ public final class Keys { */ public static final Key> BLOCK_TEMPERATURE = Keys.key(ResourceKey.sponge("block_temperature"), Double.class); - /** - * The type of the boat. - */ - public static final Key> BOAT_TYPE = Keys.key(ResourceKey.sponge("boat_type"), BoatType.class); - /** * The rotation of specific body parts of a {@link ArmorStand} or {@link Living}. * @@ -619,6 +648,21 @@ public final class Keys { */ public static final Key> BURN_TIME = Keys.key(ResourceKey.sponge("burn_time"), Integer.class); + /** + * The {@link DamageType} tag that bypasses a shield-like {@link ItemStack}. + */ + public static final Key>> BYPASS_DAMAGE_TAG = Keys.key(ResourceKey.sponge("bypass_damage_tag"), new TypeToken<>() {}); + + /** + * The {@link ResourceKey} overlay rendered when {@link ItemStack} equipped on head. + */ + public static final Key> CAMERA_OVERLAY = Keys.key(ResourceKey.sponge("camera_overlay"), ResourceKey.class); + + /** + * Whether an equipped {@link ItemStack} can be removed using shears. + */ + public static final Key> CAN_BE_SHEARED = Keys.key(ResourceKey.sponge("can_be_sheared"), Boolean.class); + /** * Whether an {@link ItemStack} can always be eaten. */ @@ -691,7 +735,7 @@ public final class Keys { * The carvers of a {@link Biome} used during world generation. * Readonly */ - public static final Key>> CARVERS = Keys.mapKey(ResourceKey.sponge("carvers"), TypeToken.get(CarvingStep.class), new TypeToken>() {}); + public static final Key> CARVERS = Keys.listKey(ResourceKey.sponge("carvers"), Carver.class); /** * The current casting time of a {@link Spellcaster}. @@ -729,7 +773,12 @@ public final class Keys { public static final Key> CHEST_ROTATION = Keys.key(ResourceKey.sponge("chest_rotation"), Vector3d.class); /** - * The chunk generator of a {@link WorldTemplate} + * The {@link ChickenVariant} of a {@link Chicken}. + */ + public static final Key> CHICKEN_VARIANT = Keys.key(ResourceKey.sponge("chicken_variant"), ChickenVariant.class); + + /** + * The chunk generator of a {@link World} * Readonly */ public static final Key> CHUNK_GENERATOR = Keys.key(ResourceKey.sponge("chunk_generator"), ChunkGenerator.class); @@ -749,7 +798,7 @@ public final class Keys { public static final Key> COMMAND = Keys.key(ResourceKey.sponge("command"), String.class); /** - * Whether commands can be run in a world of a {@link WorldTemplate} or {@link ServerWorldProperties} + * Whether commands can be run in a world of a {@link World} or {@link ServerWorldProperties} * Readonly */ public static final Key> COMMANDS = Keys.key(ResourceKey.sponge("commands"), Boolean.class); @@ -767,6 +816,11 @@ public final class Keys { */ public static final Key> CONNECTED_DIRECTIONS = Keys.setKey(ResourceKey.sponge("connected_directions"), Direction.class); + /** + * The {@link ItemAction}s an {@link ItemStack} will apply when consumed. + */ + public static final Key> CONSUME_ACTIONS = Keys.listKey(ResourceKey.sponge("consume_effects"), ItemAction.class); + /** * The container {@link ItemType} of an {@link ItemStack}. * e.g. {@link ItemTypes#BUCKET} for a {@link ItemTypes#WATER_BUCKET} stack. @@ -774,6 +828,18 @@ public final class Keys { */ public static final Key> CONTAINER_ITEM = Keys.key(ResourceKey.sponge("container_item"), ItemType.class); + /** + * The {@link CopperOxidation} state of a {@link BlockState block} + * (given that it applies to the {@link BlockTypeTags#COPPER} tag) or + * a {@link CopperGolem} + */ + public static final Key> COPPER_OXIDATION = Keys.key(ResourceKey.sponge("copper_oxidation"), CopperOxidation.class); + + /** + * The {@link CowVariant} of a {@link Cow}. + */ + public static final Key> COW_VARIANT = Keys.key(ResourceKey.sponge("cow_variant"), CowVariant.class); + /** * The {@link ItemStack} a food {@link ItemStack} converts to when eaten. */ @@ -785,9 +851,24 @@ public final class Keys { * The amount of ticks a {@link EndGateway} has to wait for the next teleportation. * or * The amount of ticks a {@link Crafter} has to wait for the next craft. + * or + * The amount of ticks an {@link ItemStack} has to wait before being used again, primarily in conjunction + * with {@link #COOLDOWN_GROUP} in a joined {@link ValueContainer} to be offered as a custom cooldown. Using + * a {@link DataManipulator#mutableOf( Iterable)} to set this value using {@link Value#mutableOf( Key, Object)} + * to join together a group is ideal. */ public static final Key> COOLDOWN = Keys.key(ResourceKey.sponge("cooldown"), Ticks.class); + /** + * The {@link ResourceKey group} of an {@link ItemStackLike ItemStack} that would apply a + * cooldown to the item when used. Note that this affects the {@link CooldownTracker} when + * a {@link Player} uses the item. Can be used in tandem with the {@link #COOLDOWN} key + * to apply a cooldown to said group. A group will differentiate a cooldown from the default + * {@link ItemStackLike ItemStack} cooldown based on the + * {@link ItemType#key(DefaultedRegistryType) ResourceKey}. + */ + public static final Key> COOLDOWN_GROUP = Keys.key(ResourceKey.sponge("cooldown_group"), ResourceKey.class); + /** * The coordinate scale of a {@link WorldType} applied to the coordinates of a {@link ServerPlayer player} * when traveling in between {@link ServerWorld worlds}. @@ -799,6 +880,22 @@ public final class Keys { */ public static final Key> COORDINATE_MULTIPLIER = Keys.key(ResourceKey.sponge("coordinate_multiplier"), Double.class); + /** + * The coordinates of where a {@link Creaking} has + * it's bonded {@link CreakingHeart home} set to. Can be + * overridden. + * + * When a {@link Creaking} is spawned, it can + * be considered linked to a heart or not. + */ + public static final Key> CREAKING_HOME_POSITION = Keys.key(ResourceKey.sponge("creaking_home_position"), Vector3i.class); + + /** + * Marks whether a {@link Creaking} is considered transient. When transient, it may be + * invulnerable to most all {@link DamageSource}s. Note that this is not mutable. + */ + public static final Key> CREAKING_IS_LINKED = Keys.key(ResourceKey.sponge("creaking_transient"), Boolean.class); + /** * Overrides whether a {@link WorldType} allows the {@link EnderDragon dragon} fight mechanic to spawn. *

By default, the dragon only spawns in the {@link DefaultWorldKeys#THE_END} world with {@link WorldTypes#THE_END} world type.

@@ -829,12 +926,32 @@ public final class Keys { public static final Key, Double>> CUSTOM_ATTACK_DAMAGE = Keys.mapKey(ResourceKey.sponge("custom_attack_damage"), new TypeToken>() {}, TypeToken.get(Double.class)); /** - * The resource pack model index of an {@link ItemStack}. + * List of floats used by items model definitions. + * + * @see Items model definition + */ + public static final Key> CUSTOM_MODEL_DATA_FLOATS = Keys.listKey(ResourceKey.sponge("custom_model_data_floats"), Float.class); + + /** + * List of booleans used by items model definitions. + * + * @see Items model definition + */ + public static final Key> CUSTOM_MODEL_DATA_FLAGS = Keys.listKey(ResourceKey.sponge("custom_model_data_flags"), Boolean.class); + + /** + * List of strings used by items model definitions. * - *

Resource packs can use the same index in their files to replace the - * item model of an ItemStack.

+ * @see Items model definition */ - public static final Key> CUSTOM_MODEL_DATA = Keys.key(ResourceKey.sponge("custom_model_data"), Integer.class); + public static final Key> CUSTOM_MODEL_DATA_STRINGS = Keys.listKey(ResourceKey.sponge("custom_model_data_strings"), String.class); + + /** + * List of colors used by items model definitions. + * + * @see Items model definition + */ + public static final Key> CUSTOM_MODEL_DATA_COLORS = Keys.listKey(ResourceKey.sponge("custom_model_data_colors"), Color.class); /** * The custom name of an {@link Entity}, {@link ItemStack} or {@link BlockEntity}. @@ -858,6 +975,11 @@ public final class Keys { */ public static final Key> DAMAGE_ABSORPTION = Keys.key(ResourceKey.sponge("damage_absorption"), Double.class); + /** + * Whether an equipped {@link ItemStack} is damaged when the wearer is hurt. + */ + public static final Key> DAMAGE_ON_HURT = Keys.key(ResourceKey.sponge("damage_on_hurt"), Boolean.class); + /** * How much damage a {@link FallingBlock} deals to {@link Living} entities * it hits per block fallen. @@ -866,6 +988,11 @@ public final class Keys { */ public static final Key> DAMAGE_PER_BLOCK = Keys.key(ResourceKey.sponge("damage_per_block"), Double.class); + /** + * The {@link ItemAction}s an {@link ItemStack} will apply on death. + */ + public static final Key> DEATH_PROTECTION_ACTIONS = Keys.listKey(ResourceKey.sponge("death_protection_effects"), ItemAction.class); + /** * The distance at which a {@link BlockState} will decay. * This usually applies to leaves, for example {@link BlockTypes#OAK_LEAVES}. @@ -900,6 +1027,17 @@ public final class Keys { */ public static final Key> DIRECTION = Keys.key(ResourceKey.sponge("direction"), Direction.class); + /** + * The amount of {@link Ticks} this {@link ItemStack} disables blocking with a shield-like {@link ItemStack} on a successful attack. + */ + public static final Key> DISABLE_SHIELD_TICKS = Keys.key(ResourceKey.sponge("disable_shield_ticks"), Ticks.class); + + /** + * The multiplier applied to the cooldown time during which blocking using this shield-like {@link ItemStack} is disabled. + * If set to 0, this item can never be disabled by attacks. + */ + public static final Key> DISABLE_SHIELD_TICKS_SCALE = Keys.key(ResourceKey.sponge("disable_shield_ticks_scale"), Double.class); + /** * The display name of an {@link Entity}, {@link ItemStack} or {@link BlockEntity}. * @@ -907,7 +1045,7 @@ public final class Keys { *

On an {@link Entity}, this represents a combination of {@link Keys#CUSTOM_NAME} (if set), scoreboard info, and any click data.

*

On an {@link ItemStack}, this represents the {@link Keys#CUSTOM_NAME} or if not set the {@link ItemType}s translation. *

On a {@link BlockEntity}, this usually represents the name displayed in its {@link org.spongepowered.api.item.inventory.Container} - *

On a {@link WorldTemplate} or {@link ServerWorldProperties}, this represents the display name of the corresponding {@link ServerWorld}

+ *

On a {@link World} or {@link ServerWorldProperties}, this represents the display name of the corresponding {@link ServerWorld}

*

On a {@link TextDisplay} this is modifiable.

*/ public static final Key> DISPLAY_NAME = Keys.key(ResourceKey.sponge("display_name"), Component.class); @@ -1010,11 +1148,20 @@ public final class Keys { */ public static final Key> ENTITY_TO_SPAWN = Keys.key(ResourceKey.sponge("entity_to_spawn"), EntityArchetype.class); + /** + * Whether an item is equipped when interacting with it. + */ + public static final Key> EQUIP_ON_INTERACT = Keys.key(ResourceKey.sponge("equip_on_interact"), Boolean.class); + + /** + * The {@link SoundType} played when equipping an item. + */ + public static final Key> EQUIP_SOUND = Keys.key(ResourceKey.sponge("equip_sound"), SoundType.class); + /** * The {@link EquipmentType} that the target inventory supports. This usually applies to {@link EquipmentSlot}s. * or * The {@link EquipmentType} of an {@link ItemStack} - * Readonly */ public static final Key> EQUIPMENT_TYPE = Keys.key(ResourceKey.sponge("equipment_type"), EquipmentType.class); @@ -1056,7 +1203,7 @@ public final class Keys { * determined randomly at the time of the explosion or computed from the * context in which the {@link Explosive} explodes.

*/ - public static final Key> EXPLOSION_RADIUS = Keys.key(ResourceKey.sponge("explosion_radius"), Integer.class); + public static final Key> EXPLOSION_RADIUS = Keys.key(ResourceKey.sponge("explosion_radius"), Float.class); /** * The eye height of an {@link Entity}. @@ -1220,7 +1367,7 @@ public final class Keys { public static final Key> FUSE_DURATION = Keys.key(ResourceKey.sponge("fuse_duration"), Ticks.class); /** - * The {@link GameMode} a {@link Humanoid} or {@link ServerWorldProperties} or {@link WorldTemplate} has. + * The {@link GameMode} a {@link Humanoid} or {@link ServerWorldProperties} or {@link World} has. */ public static final Key> GAME_MODE = Keys.key(ResourceKey.sponge("game_mode"), GameMode.class); @@ -1267,7 +1414,7 @@ public final class Keys { public static final Key> GROWTH_STAGE = Keys.key(ResourceKey.sponge("growth_stage"), Integer.class); /** - * Whether world of a {@link WorldTemplate} or {@link WorldProperties} is in hardcore mode. + * Whether world of a {@link World} or {@link WorldProperties} is in hardcore mode. * Readonly */ public static final Key> HARDCORE = Keys.key(ResourceKey.sponge("hardcore"), Boolean.class); @@ -1450,11 +1597,26 @@ public final class Keys { */ public static final Key> HIDDEN_GENE = Keys.key(ResourceKey.sponge("hidden_gene"), PandaGene.class); + /** + * Whether the {@link #ARMOR_TRIM} of an {@link ItemStack} is hidden. + */ + public static final Key> HIDE_ARMOR_TRIM = Keys.key(ResourceKey.sponge("hide_armor_trim"), Boolean.class); + /** * Whether the attributes of an {@link ItemStack} are hidden. */ public static final Key> HIDE_ATTRIBUTES = Keys.key(ResourceKey.sponge("hide_attributes"), Boolean.class); + /** + * Whether the {@link #BANNER_PATTERN_LAYERS} of an {@link ItemStack} are hidden in the item description. + */ + public static final Key> HIDE_BANNER_PATTERNS = Keys.key(ResourceKey.sponge("hide_banner_patterns"), Boolean.class); + + /** + * Whether the bundle contents of an {@link ItemStack} are hidden. + */ + public static final Key> HIDE_BUNDLE_CONTENTS = Keys.key(ResourceKey.sponge("hide_bundle_contents"), Boolean.class); + /** * Whether the {@link #BREAKABLE_BLOCK_TYPES} of an {@link ItemStack} are hidden. */ @@ -1465,17 +1627,36 @@ public final class Keys { */ public static final Key> HIDE_CAN_PLACE = Keys.key(ResourceKey.sponge("hide_can_place"), Boolean.class); + /** + * Whether the {@link #COLOR} of an {@link ItemStack} is hidden in the item description. + */ + public static final Key> HIDE_COLOR = Keys.key(ResourceKey.sponge("hide_color"), Boolean.class); + /** * Whether the {@link #APPLIED_ENCHANTMENTS} of an {@link ItemStack} are hidden. */ public static final Key> HIDE_ENCHANTMENTS = Keys.key(ResourceKey.sponge("hide_enchantments"), Boolean.class); + /** + * Whether the instrument of an {@link ItemStack} (e.g. {@link ItemTypes#GOAT_HORN}) is hidden. + */ + public static final Key> HIDE_INSTRUMENT = Keys.key(ResourceKey.sponge("hide_instrument"), Boolean.class); + /** * Whether miscellaneous values of an {@link ItemStack} are hidden. - * e.g. potion effects or shield pattern info */ public static final Key> HIDE_MISCELLANEOUS = Keys.key(ResourceKey.sponge("hide_miscellaneous"), Boolean.class); + /** + * Whether the {@link #MUSIC_DISC} of and {@link ItemStack} is hidden in the item description. + */ + public static final Key> HIDE_MUSIC_DISC = Keys.key(ResourceKey.sponge("hide_music_disc"), Boolean.class); + + /** + * Whether the potion effects (e.g. {@link #CUSTOM_POTION_EFFECTS}) of an {@link ItemStack} are hidden. + */ + public static final Key> HIDE_POTION_EFFECTS = Keys.key(ResourceKey.sponge("hide_potion_effects"), Boolean.class); + /** * Whether the {@link #STORED_ENCHANTMENTS} of an {@link ItemStack} are hidden. */ @@ -1696,6 +1877,11 @@ public final class Keys { */ public static final Key> IS_DISARMED = Keys.key(ResourceKey.sponge("is_disarmed"), Boolean.class); + /** + * Whether an item can be equipped using a dispenser. + */ + public static final Key> IS_DISPENSABLE = Keys.key(ResourceKey.sponge("is_dispensable"), Boolean.class); + /** * Whether an entity is eating. * e.g. {@link Panda} @@ -1714,8 +1900,8 @@ public final class Keys { public static final Key> IS_ELYTRA_FLYING = Keys.key(ResourceKey.sponge("is_elytra_flying"), Boolean.class); /** - * Whether a piston {@link BlockState} is currently extended. - * TODO {@link Piston}? + * Whether a piston {@link BlockState} is currently extended or + * {@link Piston moving Piston} is extending. */ public static final Key> IS_EXTENDED = Keys.key(ResourceKey.sponge("is_extended"), Boolean.class); @@ -1844,7 +2030,7 @@ public final class Keys { public static final Key> IS_LIT = Keys.key(ResourceKey.sponge("is_lit"), Boolean.class); /** - * Whether a world of a {@link WorldTemplate} or {@link ServerWorldProperties} is supposed to be loaded at startup. + * Whether a world of a {@link World} or {@link ServerWorldProperties} is supposed to be loaded at startup. * Readonly */ public static final Key> IS_LOAD_ON_STARTUP = Keys.key(ResourceKey.sponge("is_load_on_startup"), Boolean.class); @@ -2061,6 +2247,11 @@ public final class Keys { */ public static final Key> IS_SURROGATE_BLOCK = Keys.key(ResourceKey.sponge("is_surrogate_block"), Boolean.class); + /** + * Whether an equipped item can be swapped by interacting with it. + */ + public static final Key> IS_SWAPPABLE = Keys.key(ResourceKey.sponge("is_swappable"), Boolean.class); + /** * Whether players are prevented from taking * items from an equipment slot on an {@link ArmorStand} @@ -2107,6 +2298,11 @@ public final class Keys { */ public static final Key> IS_WET = Keys.key(ResourceKey.sponge("is_wet"), Boolean.class); + /** + * The {@link ItemAttribute}s an {@link ItemStackLike} can apply. + */ + public static final Key> ITEM_ATTRIBUTES = Keys.listKey(ResourceKey.sponge("item_attributes"), ItemAttribute.class); + /** * The {@link ItemDisplayType display type} of a {@link org.spongepowered.api.entity.display.ItemDisplay}. */ @@ -2438,6 +2634,13 @@ public final class Keys { */ public static final Key> MIN_SPAWN_DELAY = Keys.key(ResourceKey.sponge("min_spawn_delay"), Ticks.class); + /** + * Location of the resource pack model for an {@link ItemStack}. + * + * @see Model + */ + public static final Key> MODEL = Keys.key(ResourceKey.sponge("model"), ResourceKey.class); + /** * The moisture value of a {@link BlockTypes#FARMLAND} {@link BlockState}. */ @@ -2573,7 +2776,7 @@ public final class Keys { public static final Key> PATTERN_COLOR = Keys.key(ResourceKey.sponge("pattern_color"), DyeColor.class); /** - * Whether spawn logic is performed on a world of a {@link WorldTemplate} or {@link ServerWorldProperties} + * Whether spawn logic is performed on a world of a {@link World} or {@link ServerWorldProperties} * See {@link ServerWorldProperties#performsSpawnLogic()}. * Readonly */ @@ -2594,6 +2797,14 @@ public final class Keys { */ public static final Key> PICKUP_RULE = Keys.key(ResourceKey.sponge("pickup_rule"), PickupRule.class); + /** + * The {@link PigType} for a {@link Pig}, which can vary based on + * {@link Biome}. + * + * @see Pig Variant Changes + */ + public static final Key> PIG_TYPE = Keys.key(ResourceKey.sponge("pig_variant"), PigType.class); + /** * Whether a {@link WorldType} is safe for {@link Piglin} to not transform * into {@link ZombifiedPiglin} over time in a {@link ServerWorld world} of that type @@ -2735,6 +2946,12 @@ public final class Keys { */ public static final Key> PROFESSION_LEVEL = Keys.key(ResourceKey.sponge("profession_level"), Integer.class); + /** + * The "puffiness" state of a {@link Pufferfish}, ranges from 0 to 2 per + * the Minecraft Wiki. + */ + public static final Key> PUFFER_FISH_PUFFINESS_STATE = Keys.key(ResourceKey.sponge("puffer_fish_size"), Integer.class); + /** * The {@link Entity} or {@link BlockState} push reaction when a {@link Piston} pushes it. * Readonly @@ -2742,7 +2959,7 @@ public final class Keys { 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} + * Whether pvp combat is enabled in a world of a {@link World} or {@link ServerWorldProperties} * Readonly */ public static final Key> PVP = Keys.key(ResourceKey.sponge("pvp"), Boolean.class); @@ -2870,6 +3087,11 @@ public final class Keys { */ public static final Key> ROARING_TIME = Keys.key(ResourceKey.sponge("roaring_time"), Ticks.class); + /** + * The {@link SalmonSize} of a {@link Salmon} entity. + */ + public static final Key> SALMON_SIZE = Keys.key(ResourceKey.sponge("salmon_size"), SalmonSize.class); + /** * The current saturation of a {@link Player}. * @@ -2919,7 +3141,7 @@ public final class Keys { public static final Key> SECOND_TRUSTED = Keys.key(ResourceKey.sponge("second_trusted"), UUID.class); /** - * The seed of a {@link WorldTemplate} + * The seed of a {@link World} */ public static final Key> SEED = Keys.key(ResourceKey.sponge("structure_seed"), Long.class); @@ -2929,7 +3151,7 @@ public final class Keys { public static final Key> SEE_THROUGH_BLOCKS = Keys.key(ResourceKey.sponge("see_through_blocks"), Boolean.class); /** - * The {@link SerializationBehavior} of a {@link WorldTemplate} or {@link ServerWorldProperties} + * The {@link SerializationBehavior} of a {@link World} or {@link ServerWorldProperties} * Readonly */ public static final Key> SERIALIZATION_BEHAVIOR = Keys.key(ResourceKey.sponge("serialization_behavior"), SerializationBehavior.class); @@ -2944,6 +3166,36 @@ public final class Keys { */ public static final Key> SHADOW_STRENGTH = Keys.key(ResourceKey.sponge("shadow_strength"), Double.class); + /** + * The {@link SoundType} played when removing an equipped {@link ItemStack} using shears. + */ + public static final Key> SHEARING_SOUND = Keys.key(ResourceKey.sponge("shearing_sound"), SoundType.class); + + /** + * The sound played when blocking an attack with a shield-like {@link ItemStack}. + */ + public static final Key> SHIELD_BLOCK_SOUND = Keys.key(ResourceKey.sponge("shield_block_sound"), SoundType.class); + + /** + * The amount of attack damage a shield-like {@link ItemStack} reduces for certain {@link DamageType}s + */ + public static final Key>> SHIELD_DAMAGE_REDUCTIONS = Keys.listKey(ResourceKey.sponge("shield_damage_reductions"), new TypeToken<>() {}); + + /** + * The amount of {@link Ticks} player must use this shield-like {@link ItemStack} for to block attacks successfully. + */ + public static final Key> SHIELD_DEPLOY_TICKS = Keys.key(ResourceKey.sponge("shield_deploy_ticks"), Ticks.class); + + /** + * The sound played when a shield-like {@link ItemStack} is disabled. + */ + public static final Key> SHIELD_DISABLE_SOUND = Keys.key(ResourceKey.sponge("shield_disable_sound"), SoundType.class); + + /** + * Function for the amount of {@link Keys#ITEM_DURABILITY} damage a shield-like {@link ItemStack} takes when blocking an attack. + */ + public static final Key>> SHIELD_ITEM_DAMAGE_FUNCTION = Keys.key(ResourceKey.sponge("shield_item_damage_function"), new TypeToken<>() {}); + /** * The shooter of a {@link Projectile}. */ @@ -3082,7 +3334,7 @@ public final class Keys { public static final Key>> SPAWN_LIGHT_RANGE = Keys.key(ResourceKey.sponge("spawn_light_range"), new TypeToken>() {}); /** - * The spawn position in a world of a {@link WorldTemplate} or {@link WorldProperties} + * The spawn position in a world of a {@link World} or {@link WorldProperties} * Readonly */ public static final Key> SPAWN_POSITION = Keys.key(ResourceKey.sponge("spawn_position"), Vector3i.class); @@ -3281,6 +3533,15 @@ public final class Keys { */ public static final Key> TOOL_TYPE = Keys.key(ResourceKey.sponge("tool_type"), ItemTier.class); + /** + * For a given {@link ResourceKey}, the textures for the tooltip of an {@link ItemStack} will be looked up from the following locations in the + * active resource packs: + * + *

Background: {@literal /assets//textures/gui/sprites/tooltip/_background} + *

Frame: {@literal /assets//textures/gui/sprites/tooltip/_frame} + */ + public static final Key> TOOLTIP_STYLE = Keys.key(ResourceKey.sponge("tooltip_style"), ResourceKey.class); + /** * Whether a {@link CommandBlock} does track its output. * @@ -3374,7 +3635,7 @@ public final class Keys { /** * The client view distance of a {@link ServerPlayer} - *

or the view distance in a world of a {@link WorldTemplate} or {@link ServerWorldProperties}

+ *

or the view distance in a world of a {@link World} or {@link ServerWorldProperties}

* *

This value represents the radius (around the player) in * unit chunks.

@@ -3423,6 +3684,17 @@ public final class Keys { */ public static final Key> WATER_FOG_COLOR = Keys.key(ResourceKey.sponge("water_fog_color"), Color.class); + /** + * The state of whether a {@link BlockState} that is a copper block is waxed, or if a {@link CopperGolem} + * is waxed. + */ + public static final Key> WAXED = Keys.key(ResourceKey.sponge("waxed"), Boolean.class); + + /** + * The {@link #ITEM_DURABILITY} damage an {@link ItemStack} takes per attack. + */ + public static final Key> WEAPON_DAMAGE_PER_ATTACK = Keys.key(ResourceKey.sponge("weapon_damage_per_attack"), Integer.class); + /** * The weather of a {@link ServerWorldProperties}. */ @@ -3472,12 +3744,31 @@ public final class Keys { */ public static final Key> WOLF_VARIANT = Keys.key(ResourceKey.sponge("wolf_variant"), WolfVariant.class); + /** + * The {@link WolfSoundVariant} of a {@link Wolf}. + * + * @see Wolves wiki + */ + public static final Key> WOLF_SOUND_VARIANT = Keys.key(ResourceKey.sponge("wolf_sound_variant"), WolfSoundVariant.class); + /** * The {@link Sheep} who is being targeted by the {@link SpellTypes#WOLOLO} * spell being casted by an {@link Evoker} */ public static final Key> WOLOLO_TARGET = Keys.key(ResourceKey.sponge("wololo_target"), Sheep.class); + /** + * The {@link WorldArchetype} of a {@link World} or {@link ServerWorldProperties} + * Readonly + */ + public static final Key> WORLD_ARCHETYPE = Keys.key(ResourceKey.sponge("world_archetype"), WorldArchetype.class); + + /** + * The {@link WorldArchetypeType} of a {@link World} or {@link ServerWorldProperties} + * Readonly + */ + public static final Key> WORLD_ARCHETYPE_TYPE = Keys.key(ResourceKey.sponge("world_archetype_type"), WorldArchetypeType.class); + /** * The world border of {@link WorldProperties} * Readonly @@ -3485,7 +3776,7 @@ public final class Keys { public static final Key> WORLD_BORDER = Keys.key(ResourceKey.sponge("world_border"), WorldBorder.class); /** - * The difficulty of a {@link WorldTemplate} or {@link WorldProperties} + * The difficulty of a {@link World} or {@link WorldProperties} * Readonly */ public static final Key> WORLD_DIFFICULTY = Keys.key(ResourceKey.sponge("world_difficulty"), Difficulty.class); @@ -3523,7 +3814,7 @@ public final class Keys { public static final Key> WORLD_LOGICAL_HEIGHT = Keys.key(ResourceKey.sponge("world_logical_height"), Integer.class); /** - * The {@link WorldType} of a {@link WorldTemplate} or {@link ServerWorldProperties} + * The {@link WorldType} of a {@link World} or {@link ServerWorldProperties} * Readonly */ public static final Key> WORLD_TYPE = Keys.key(ResourceKey.sponge("world_type"), WorldType.class); diff --git a/src/main/java/org/spongepowered/api/data/persistence/DataFormat.java b/src/main/java/org/spongepowered/api/data/persistence/DataFormat.java index 702a6eb1c1a..81301e96f25 100644 --- a/src/main/java/org/spongepowered/api/data/persistence/DataFormat.java +++ b/src/main/java/org/spongepowered/api/data/persistence/DataFormat.java @@ -36,7 +36,7 @@ * a DataContainer to/from a stream of the specific format. */ @CatalogedBy(DataFormats.class) -public interface DataFormat extends DefaultedRegistryValue { +public interface DataFormat extends DefaultedRegistryValue { /** * Creates a new {@link DataContainer} from the contents of the given diff --git a/src/main/java/org/spongepowered/api/data/type/ArmorMaterial.java b/src/main/java/org/spongepowered/api/data/type/ArmorMaterial.java index cdcc6cfa1a5..e42833fc8dc 100644 --- a/src/main/java/org/spongepowered/api/data/type/ArmorMaterial.java +++ b/src/main/java/org/spongepowered/api/data/type/ArmorMaterial.java @@ -26,25 +26,24 @@ import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.ItemTypes; -import org.spongepowered.api.item.recipe.crafting.Ingredient; +import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; -import java.util.Optional; +import java.util.function.Predicate; /** * Represents a type of "armor", usually applicable to any * {@link ItemTypes#DIAMOND_CHESTPLATE}. */ @CatalogedBy(ArmorMaterials.class) -public interface ArmorMaterial extends DefaultedRegistryValue { +public interface ArmorMaterial extends DefaultedRegistryValue { /** - * Gets the {@link ItemType} that can be used to - * "repair" the armor type. + * Gets the {@link ItemType} that can be used to "repair" the armor type. * * @return The item type considered to be used for repairing */ - Optional repairIngredient(); + Predicate repairIngredient(); } 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 64170a17a4f..9de3827c049 100644 --- a/src/main/java/org/spongepowered/api/data/type/ArmorMaterials.java +++ b/src/main/java/org/spongepowered/api/data/type/ArmorMaterials.java @@ -40,10 +40,12 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class ArmorMaterials { - public static final DefaultedRegistryReference ARMADILLO = ArmorMaterials.key(ResourceKey.minecraft("armadillo")); + public static final DefaultedRegistryReference ARMADILLO_SCUTE = ArmorMaterials.key(ResourceKey.minecraft("armadillo_scute")); public static final DefaultedRegistryReference CHAINMAIL = ArmorMaterials.key(ResourceKey.minecraft("chainmail")); + public static final DefaultedRegistryReference COPPER = ArmorMaterials.key(ResourceKey.minecraft("copper")); + public static final DefaultedRegistryReference DIAMOND = ArmorMaterials.key(ResourceKey.minecraft("diamond")); public static final DefaultedRegistryReference GOLD = ArmorMaterials.key(ResourceKey.minecraft("gold")); @@ -54,7 +56,7 @@ public final class ArmorMaterials { public static final DefaultedRegistryReference NETHERITE = ArmorMaterials.key(ResourceKey.minecraft("netherite")); - public static final DefaultedRegistryReference TURTLE = ArmorMaterials.key(ResourceKey.minecraft("turtle")); + public static final DefaultedRegistryReference TURTLE_SCUTE = ArmorMaterials.key(ResourceKey.minecraft("turtle_scute")); private ArmorMaterials() { } diff --git a/src/main/java/org/spongepowered/api/data/type/ArtType.java b/src/main/java/org/spongepowered/api/data/type/ArtType.java index 2d8ef2af8a0..6ec04c3e36f 100644 --- a/src/main/java/org/spongepowered/api/data/type/ArtType.java +++ b/src/main/java/org/spongepowered/api/data/type/ArtType.java @@ -24,15 +24,24 @@ */ package org.spongepowered.api.data.type; +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.entity.hanging.Painting; import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; /** * Represents a piece of art to be displayed by {@link Painting}s. */ @CatalogedBy(ArtTypes.class) -public interface ArtType extends DefaultedRegistryValue { +public interface ArtType extends DefaultedRegistryValue, DataPackSerializable { + + static Builder builder() { + return Sponge.game().builderProvider().provide(Builder.class); + } /** * Gets the height in blocks this art piece spans. @@ -48,4 +57,10 @@ public interface ArtType extends DefaultedRegistryValue { */ int width(); + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + Builder dimensions(int width, int height); + + Builder asset(ResourceKey assetId); + } } diff --git a/src/main/java/org/spongepowered/api/data/type/ArtTypes.java b/src/main/java/org/spongepowered/api/data/type/ArtTypes.java index 5ec86d75b42..3f743c8d68f 100644 --- a/src/main/java/org/spongepowered/api/data/type/ArtTypes.java +++ b/src/main/java/org/spongepowered/api/data/type/ArtTypes.java @@ -68,6 +68,8 @@ public final class ArtTypes { public static final DefaultedRegistryReference CREEBET = ArtTypes.key(ResourceKey.minecraft("creebet")); + public static final DefaultedRegistryReference DENNIS = ArtTypes.key(ResourceKey.minecraft("dennis")); + public static final DefaultedRegistryReference DONKEY_KONG = ArtTypes.key(ResourceKey.minecraft("donkey_kong")); public static final DefaultedRegistryReference EARTH = ArtTypes.key(ResourceKey.minecraft("earth")); @@ -148,6 +150,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.ART_TYPE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.ART_TYPE, location).asScopedReference(); } } 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 6c40aadf68c..10f7632cacf 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, StringRepresentable { +public interface AttachmentSurface extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/GenerateFactoryMethod.java b/src/main/java/org/spongepowered/api/data/type/AxolotlVariant.java similarity index 80% rename from src/main/java/org/spongepowered/api/util/annotation/eventgen/GenerateFactoryMethod.java rename to src/main/java/org/spongepowered/api/data/type/AxolotlVariant.java index 84d05b2eefc..9312db093a1 100644 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/GenerateFactoryMethod.java +++ b/src/main/java/org/spongepowered/api/data/type/AxolotlVariant.java @@ -22,14 +22,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.util.annotation.eventgen; +package org.spongepowered.api.data.type; -/** - * Explicitly enables generation of an event factory method for an event class. - * - *

By default, an event which contains subinterfaces will not have - * an event factory method generated.

- */ -public @interface GenerateFactoryMethod { +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; +@CatalogedBy(AxolotlVariants.class) +public interface AxolotlVariant extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/AxolotlVariants.java b/src/main/java/org/spongepowered/api/data/type/AxolotlVariants.java new file mode 100644 index 00000000000..bc3feddd4b9 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/AxolotlVariants.java @@ -0,0 +1,51 @@ +/* + * 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.RegistryKey; +import org.spongepowered.api.registry.RegistryTypes; + +/** + * + */ +public class AxolotlVariants { + + public static final DefaultedRegistryReference BLUE = AxolotlVariants.key(ResourceKey.sponge("blue")); + + public static final DefaultedRegistryReference CYAN = AxolotlVariants.key(ResourceKey.sponge("cyan")); + + public static final DefaultedRegistryReference GOLD = AxolotlVariants.key(ResourceKey.sponge("gold")); + + public static final DefaultedRegistryReference LUCY = AxolotlVariants.key(ResourceKey.sponge("lucy")); + + public static final DefaultedRegistryReference WILD = AxolotlVariants.key(ResourceKey.sponge("wild")); + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.AXOLOTL_VARIANT, location).asDefaultedReference(Sponge::game); + } +} 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 f94c386171c..94c9df2f54b 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, StringRepresentable { +public interface BambooLeavesType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/BannerPatternShape.java b/src/main/java/org/spongepowered/api/data/type/BannerPatternShape.java index dc0ceddfecb..0df50225f1e 100644 --- a/src/main/java/org/spongepowered/api/data/type/BannerPatternShape.java +++ b/src/main/java/org/spongepowered/api/data/type/BannerPatternShape.java @@ -31,6 +31,6 @@ * A pattern shape which may be applied to a banner. */ @CatalogedBy(BannerPatternShapes.class) -public interface BannerPatternShape extends DefaultedRegistryValue { +public interface BannerPatternShape extends DefaultedRegistryValue { } 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 e9f715523fa..437b71a7455 100644 --- a/src/main/java/org/spongepowered/api/data/type/BannerPatternShapes.java +++ b/src/main/java/org/spongepowered/api/data/type/BannerPatternShapes.java @@ -134,6 +134,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.BANNER_PATTERN_SHAPE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.BANNER_PATTERN_SHAPE, location).asScopedReference(); } } 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 106643793b5..403de266552 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, StringRepresentable { +public interface BellAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/BodyPart.java b/src/main/java/org/spongepowered/api/data/type/BodyPart.java index cca394819f8..d197f42a2ff 100644 --- a/src/main/java/org/spongepowered/api/data/type/BodyPart.java +++ b/src/main/java/org/spongepowered/api/data/type/BodyPart.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(BodyParts.class) -public interface BodyPart extends DefaultedRegistryValue { +public interface BodyPart extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/CatType.java b/src/main/java/org/spongepowered/api/data/type/CatType.java index e45c2cc7ab8..7a5462320db 100644 --- a/src/main/java/org/spongepowered/api/data/type/CatType.java +++ b/src/main/java/org/spongepowered/api/data/type/CatType.java @@ -31,6 +31,6 @@ * Represents the type of cat a cat is. */ @CatalogedBy(CatTypes.class) -public interface CatType extends DefaultedRegistryValue { +public interface CatType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/CatTypes.java b/src/main/java/org/spongepowered/api/data/type/CatTypes.java index 8b00eab91bd..65a9e8ffdd0 100644 --- a/src/main/java/org/spongepowered/api/data/type/CatTypes.java +++ b/src/main/java/org/spongepowered/api/data/type/CatTypes.java @@ -37,7 +37,7 @@ * */ @SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.GAME) +@RegistryScopes(scopes = RegistryScope.ENGINE) public final class CatTypes { public static final DefaultedRegistryReference ALL_BLACK = CatTypes.key(ResourceKey.minecraft("all_black")); @@ -66,10 +66,10 @@ private CatTypes() { } public static Registry registry() { - return Sponge.game().registry(RegistryTypes.CAT_TYPE); + return Sponge.server().registry(RegistryTypes.CAT_TYPE); } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.CAT_TYPE, location).asDefaultedReference(Sponge::game); + return RegistryKey.of(RegistryTypes.CAT_TYPE, location).asScopedReference(); } } 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 d533040edab..8ee2c98af0a 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, StringRepresentable { +public interface ChestAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/ChickenVariant.java b/src/main/java/org/spongepowered/api/data/type/ChickenVariant.java new file mode 100644 index 00000000000..9fdce4b68c6 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ChickenVariant.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.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(ChickenVariants.class) +public interface ChickenVariant extends DefaultedRegistryValue { +} diff --git a/src/main/java/org/spongepowered/api/data/type/ChickenVariants.java b/src/main/java/org/spongepowered/api/data/type/ChickenVariants.java new file mode 100644 index 00000000000..0470609fed8 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ChickenVariants.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** + * + */ +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.ENGINE) +public final class ChickenVariants { + + public static final DefaultedRegistryReference COLD = ChickenVariants.key(ResourceKey.minecraft("cold")); + + public static final DefaultedRegistryReference TEMPERATE = ChickenVariants.key(ResourceKey.minecraft("temperate")); + + public static final DefaultedRegistryReference WARM = ChickenVariants.key(ResourceKey.minecraft("warm")); + + private ChickenVariants() { + } + + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.CHICKEN_VARIANT); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.CHICKEN_VARIANT, location).asScopedReference(); + } +} 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 02a2ab223d3..60ca167f640 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, StringRepresentable { +public interface ComparatorMode extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/CopperGolemPose.java b/src/main/java/org/spongepowered/api/data/type/CopperGolemPose.java new file mode 100644 index 00000000000..fb41d778fff --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/CopperGolemPose.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.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(CopperGolemPoses.class) +public interface CopperGolemPose extends DefaultedRegistryValue, StringRepresentable, Comparable { +} diff --git a/src/main/java/org/spongepowered/api/data/type/CopperGolemPoses.java b/src/main/java/org/spongepowered/api/data/type/CopperGolemPoses.java new file mode 100644 index 00000000000..581f5388331 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/CopperGolemPoses.java @@ -0,0 +1,60 @@ +/* + * 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 CopperGolemPoses { + + public static final DefaultedRegistryReference RUNNING = CopperGolemPoses.key(ResourceKey.sponge("running")); + + public static final DefaultedRegistryReference SITTING = CopperGolemPoses.key(ResourceKey.sponge("sitting")); + + public static final DefaultedRegistryReference STANDING = CopperGolemPoses.key(ResourceKey.sponge("standing")); + + public static final DefaultedRegistryReference STAR = CopperGolemPoses.key(ResourceKey.sponge("star")); + + private CopperGolemPoses() { + } + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.COPPER_GOLEM_POSE); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.COPPER_GOLEM_POSE, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/item/recipe/RecipeRegistration.java b/src/main/java/org/spongepowered/api/data/type/CopperOxidation.java similarity index 75% rename from src/main/java/org/spongepowered/api/item/recipe/RecipeRegistration.java rename to src/main/java/org/spongepowered/api/data/type/CopperOxidation.java index 18c30b0585a..d45ee52cba7 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/RecipeRegistration.java +++ b/src/main/java/org/spongepowered/api/data/type/CopperOxidation.java @@ -22,15 +22,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.item.recipe; +package org.spongepowered.api.data.type; -import org.spongepowered.api.datapack.DataPackEntry; +import org.spongepowered.api.registry.DefaultedRegistryType; +import org.spongepowered.api.util.Cycleable; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(CopperOxidations.class) +public interface CopperOxidation extends DefaultedRegistryType, Comparable, StringRepresentable, Cycleable { -/** - * A registration of a {@link Recipe} by an API consumer. - * - *

All registrations through the API will generate into the Vanilla data pack system

- */ -public interface RecipeRegistration extends DataPackEntry { - Recipe recipe(); } diff --git a/src/main/java/org/spongepowered/api/data/type/CopperOxidations.java b/src/main/java/org/spongepowered/api/data/type/CopperOxidations.java new file mode 100644 index 00000000000..ad2814280fe --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/CopperOxidations.java @@ -0,0 +1,60 @@ +/* + * 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 CopperOxidations { + + public static final DefaultedRegistryReference EXPOSED = CopperOxidations.key(ResourceKey.sponge("exposed")); + + public static final DefaultedRegistryReference OXIDIZED = CopperOxidations.key(ResourceKey.sponge("oxidized")); + + public static final DefaultedRegistryReference UNAFFECTED = CopperOxidations.key(ResourceKey.sponge("unaffected")); + + public static final DefaultedRegistryReference WEATHERED = CopperOxidations.key(ResourceKey.sponge("weathered")); + + private CopperOxidations() { + } + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.COPPER_OXIDATION); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.COPPER_OXIDATION, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/CowVariant.java b/src/main/java/org/spongepowered/api/data/type/CowVariant.java new file mode 100644 index 00000000000..8d207b4037d --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/CowVariant.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.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(CowVariants.class) +public interface CowVariant extends DefaultedRegistryValue { +} diff --git a/src/main/java/org/spongepowered/api/data/type/CowVariants.java b/src/main/java/org/spongepowered/api/data/type/CowVariants.java new file mode 100644 index 00000000000..e48c3ec5de5 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/CowVariants.java @@ -0,0 +1,59 @@ +/* + * 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; + +/** + * + */ +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.ENGINE) +public final class CowVariants { + + public static final DefaultedRegistryReference COLD = CowVariants.key(ResourceKey.minecraft("cold")); + + public static final DefaultedRegistryReference TEMPERATE = CowVariants.key(ResourceKey.minecraft("temperate")); + + public static final DefaultedRegistryReference WARM = CowVariants.key(ResourceKey.minecraft("warm")); + + private CowVariants() { + } + + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.COW_VARIANT); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.COW_VARIANT, location).asScopedReference(); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/CreakingHeartState.java b/src/main/java/org/spongepowered/api/data/type/CreakingHeartState.java new file mode 100644 index 00000000000..a2e7053d361 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/CreakingHeartState.java @@ -0,0 +1,33 @@ +/* + * 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.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + + +@CatalogedBy(CreakingHeartStates.class) +public interface CreakingHeartState extends DefaultedRegistryValue, Comparable, StringRepresentable { +} diff --git a/src/main/java/org/spongepowered/api/data/type/CreakingHeartStates.java b/src/main/java/org/spongepowered/api/data/type/CreakingHeartStates.java new file mode 100644 index 00000000000..ef323706075 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/CreakingHeartStates.java @@ -0,0 +1,58 @@ +/* + * 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 class CreakingHeartStates { + + public static final DefaultedRegistryReference AWAKE = CreakingHeartStates.key(ResourceKey.sponge("awake")); + + public static final DefaultedRegistryReference DORMANT = CreakingHeartStates.key(ResourceKey.sponge("dormant")); + + public static final DefaultedRegistryReference UPROOTED = CreakingHeartStates.key(ResourceKey.sponge("uprooted")); + + private CreakingHeartStates() { + } + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.CREAKING_HEART_STATES); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.CREAKING_HEART_STATES, location).asDefaultedReference(Sponge::game); + } +} 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 e24042f9870..c1df5c6d0e1 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, StringRepresentable { +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 156051a015a..d00f003624d 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, StringRepresentable { +public interface DripstoneSegment extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/DyeColor.java b/src/main/java/org/spongepowered/api/data/type/DyeColor.java index 627b7dc2bd1..6bb05b8e11e 100644 --- a/src/main/java/org/spongepowered/api/data/type/DyeColor.java +++ b/src/main/java/org/spongepowered/api/data/type/DyeColor.java @@ -32,7 +32,7 @@ * Represents a color of dye that can be used by various items and blocks. */ @CatalogedBy(DyeColors.class) -public interface DyeColor extends DefaultedRegistryValue { +public interface DyeColor extends DefaultedRegistryValue, StringRepresentable { /** * Gets this dye color as a {@link Color} for easy translation. diff --git a/src/main/java/org/spongepowered/api/data/type/FoxType.java b/src/main/java/org/spongepowered/api/data/type/FoxType.java index 0cfc3d8877d..9da55448e5d 100644 --- a/src/main/java/org/spongepowered/api/data/type/FoxType.java +++ b/src/main/java/org/spongepowered/api/data/type/FoxType.java @@ -31,6 +31,6 @@ * Represents a type of fox a fox is. */ @CatalogedBy(FoxTypes.class) -public interface FoxType extends DefaultedRegistryValue { +public interface FoxType extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/FrogType.java b/src/main/java/org/spongepowered/api/data/type/FrogType.java index 22c9a584b25..0e9d6ae27f9 100644 --- a/src/main/java/org/spongepowered/api/data/type/FrogType.java +++ b/src/main/java/org/spongepowered/api/data/type/FrogType.java @@ -24,8 +24,9 @@ */ package org.spongepowered.api.data.type; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(FrogTypes.class) -public interface FrogType { +public interface FrogType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/FrogTypes.java b/src/main/java/org/spongepowered/api/data/type/FrogTypes.java index 8d1ba3af239..9819d8c4d0e 100644 --- a/src/main/java/org/spongepowered/api/data/type/FrogTypes.java +++ b/src/main/java/org/spongepowered/api/data/type/FrogTypes.java @@ -37,7 +37,7 @@ * */ @SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.GAME) +@RegistryScopes(scopes = RegistryScope.ENGINE) public final class FrogTypes { public static final DefaultedRegistryReference COLD = FrogTypes.key(ResourceKey.minecraft("cold")); @@ -50,10 +50,10 @@ private FrogTypes() { } public static Registry registry() { - return Sponge.game().registry(RegistryTypes.FROG_TYPE); + return Sponge.server().registry(RegistryTypes.FROG_TYPE); } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.FROG_TYPE, location).asDefaultedReference(Sponge::game); + return RegistryKey.of(RegistryTypes.FROG_TYPE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/data/type/HandPreference.java b/src/main/java/org/spongepowered/api/data/type/HandPreference.java index 41e77f7ac50..d98d1ec6f1f 100644 --- a/src/main/java/org/spongepowered/api/data/type/HandPreference.java +++ b/src/main/java/org/spongepowered/api/data/type/HandPreference.java @@ -36,6 +36,6 @@ *

For players, this is controlled by the left hand/right hand setting

*/ @CatalogedBy(HandPreferences.class) -public interface HandPreference extends DefaultedRegistryValue, ComponentLike, StringRepresentable { +public interface HandPreference extends DefaultedRegistryValue, ComponentLike, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/HandType.java b/src/main/java/org/spongepowered/api/data/type/HandType.java index 3d28c5610d8..3bbee5a626e 100644 --- a/src/main/java/org/spongepowered/api/data/type/HandType.java +++ b/src/main/java/org/spongepowered/api/data/type/HandType.java @@ -35,6 +35,6 @@ * preference. */ @CatalogedBy(HandTypes.class) -public interface HandType extends DefaultedRegistryValue { +public interface HandType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/HorseColor.java b/src/main/java/org/spongepowered/api/data/type/HorseColor.java index 54a2da61c6f..71feeaad01c 100644 --- a/src/main/java/org/spongepowered/api/data/type/HorseColor.java +++ b/src/main/java/org/spongepowered/api/data/type/HorseColor.java @@ -33,6 +33,6 @@ *

The color of a horse is a genetic trait that can be inherited to a new born horse.

*/ @CatalogedBy(HorseColors.class) -public interface HorseColor extends DefaultedRegistryValue { +public interface HorseColor extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/HorseStyle.java b/src/main/java/org/spongepowered/api/data/type/HorseStyle.java index a884fff1d01..07a328d5f1d 100644 --- a/src/main/java/org/spongepowered/api/data/type/HorseStyle.java +++ b/src/main/java/org/spongepowered/api/data/type/HorseStyle.java @@ -34,6 +34,6 @@ * horse. The style can be inherited to new born child horses.

*/ @CatalogedBy(HorseStyles.class) -public interface HorseStyle extends DefaultedRegistryValue { +public interface HorseStyle extends DefaultedRegistryValue { } 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 9d3d1649c12..192348c1f48 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, StringRepresentable { +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/ItemAction.java b/src/main/java/org/spongepowered/api/data/type/ItemAction.java new file mode 100644 index 00000000000..b2692ea4bbf --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ItemAction.java @@ -0,0 +1,202 @@ +/* + * 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.Sponge; +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.effect.potion.PotionEffect; +import org.spongepowered.api.effect.potion.PotionEffectType; +import org.spongepowered.api.effect.sound.SoundType; +import org.spongepowered.api.entity.living.Living; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackLike; +import org.spongepowered.api.tag.Tag; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +/** + * Represents an action an {@link ItemStack} can apply to {@link Living} in different circumstances. + * + * @see Keys#CONSUME_ACTIONS + * @see Keys#DEATH_PROTECTION_ACTIONS + */ +public interface ItemAction { + + static ApplyEffects applyEffects(final Collection effects) { + return ItemAction.applyEffects(1.0D, effects); + } + + static ApplyEffects applyEffects(final PotionEffect... effects) { + return ItemAction.applyEffects(1.0D, effects); + } + + static ApplyEffects applyEffects(final double chance, final Collection effects) { + return ItemAction.factory().applyEffects(chance, List.copyOf(effects)); + } + + static ApplyEffects applyEffects(final double chance, final PotionEffect... effects) { + return ItemAction.factory().applyEffects(chance, List.of(effects)); + } + + static RemoveEffects removeEffects(final Collection effectTypes) { + return ItemAction.factory().removeEffects(Set.copyOf(effectTypes)); + } + + static RemoveEffects removeEffects(final PotionEffectType... effectTypes) { + return ItemAction.factory().removeEffects(Set.of(effectTypes)); + } + + @SafeVarargs + static RemoveEffects removeEffects(final Supplier... effectTypes) { + return ItemAction.factory().removeEffects(Arrays.stream(effectTypes).map(Supplier::get).collect(Collectors.toSet())); + } + + static RemoveEffects removeEffects(final Tag effectTypeTag) { + return ItemAction.factory().removeEffects(effectTypeTag); + } + + static ClearEffects clearEffects() { + return ItemAction.factory().clearEffects(); + } + + static PlaySound playSound(final SoundType soundType) { + return ItemAction.factory().playSound(soundType); + } + + static PlaySound playSound(final Supplier soundType) { + return ItemAction.factory().playSound(soundType.get()); + } + + static TeleportRandomly teleportRandomly(final double distance) { + return ItemAction.factory().teleportRandomly(distance); + } + + private static Factory factory() { + return Sponge.game().factoryProvider().provide(Factory.class); + } + + /** + * Returns the type of this effect. + * @return The type of this effect + */ + ItemActionType type(); + + /** + * Tries to apply this effect and returns whether it was successfully applied. + * The definition of success is purely left up to the implementation. + * + * @param entity The entity to apply effect to + * @param stack The item to apply effect with + * @return true if effect was successfully applied + */ + boolean apply(Living entity, ItemStackLike stack); + + /** + * Applies this effect with {@link ItemStack#empty()}. + * + * @param entity The entity to apply effect to + * @return true if effect was successfully applied + * @see #apply(Living, ItemStackLike) + */ + default boolean apply(final Living entity) { + return this.apply(entity, ItemStack.empty()); + } + + /** + * Applies {@link PotionEffect}s with chance. + */ + interface ApplyEffects extends ItemAction { + /** + * Returns the probability for effects to be applied. + * @return The probability for effects to be applied + */ + double chance(); + + /** + * Returns {@link PotionEffect}s that will be applied. + * @return {@link PotionEffect}s that will be applied + */ + List effects(); + } + + /** + * Removes {@link PotionEffect}s with matching {@link PotionEffectType}s. + */ + interface RemoveEffects extends ItemAction { + /** + * Returns {@link PotionEffectType}s that will be removed. + * @return {@link PotionEffectType}s that will be removed + */ + Set effectTypes(); + } + + /** + * Clears all {@link PotionEffect}s. + */ + interface ClearEffects extends ItemAction { + } + + /** + * Plays {@link SoundType}. + */ + interface PlaySound extends ItemAction { + /** + * Returns the {@link SoundType} to be played. + * @return The {@link SoundType} + */ + SoundType soundType(); + } + + /** + * Teleports randomly within maximum distance. + */ + interface TeleportRandomly extends ItemAction { + /** + * Returns the maximum distance entity can be teleported. + * @return The maximum distance entity can be teleported + */ + double distance(); + } + + interface Factory { + + ApplyEffects applyEffects(double chance, List effects); + + RemoveEffects removeEffects(Set effectTypes); + + RemoveEffects removeEffects(Tag effectTypeTag); + + ClearEffects clearEffects(); + + PlaySound playSound(SoundType soundType); + + TeleportRandomly teleportRandomly(double distance); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/ItemActionType.java b/src/main/java/org/spongepowered/api/data/type/ItemActionType.java new file mode 100644 index 00000000000..a0c5d4c8dcf --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ItemActionType.java @@ -0,0 +1,35 @@ +/* + * 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.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +/** + * Represents a possible type of {@link ItemAction}. + */ +@CatalogedBy(ItemActionTypes.class) +public interface ItemActionType extends DefaultedRegistryValue { +} diff --git a/src/main/java/org/spongepowered/api/data/type/BoatTypes.java b/src/main/java/org/spongepowered/api/data/type/ItemActionTypes.java similarity index 57% rename from src/main/java/org/spongepowered/api/data/type/BoatTypes.java rename to src/main/java/org/spongepowered/api/data/type/ItemActionTypes.java index 48d7b7c9147..e01c637e809 100644 --- a/src/main/java/org/spongepowered/api/data/type/BoatTypes.java +++ b/src/main/java/org/spongepowered/api/data/type/ItemActionTypes.java @@ -38,34 +38,26 @@ */ @SuppressWarnings("unused") @RegistryScopes(scopes = RegistryScope.GAME) -public final class BoatTypes { +public final class ItemActionTypes { - public static final DefaultedRegistryReference ACACIA = BoatTypes.key(ResourceKey.sponge("acacia")); + public static final DefaultedRegistryReference APPLY_EFFECTS = ItemActionTypes.key(ResourceKey.minecraft("apply_effects")); - public static final DefaultedRegistryReference BAMBOO = BoatTypes.key(ResourceKey.sponge("bamboo")); + public static final DefaultedRegistryReference CLEAR_ALL_EFFECTS = ItemActionTypes.key(ResourceKey.minecraft("clear_all_effects")); - public static final DefaultedRegistryReference BIRCH = BoatTypes.key(ResourceKey.sponge("birch")); + public static final DefaultedRegistryReference PLAY_SOUND = ItemActionTypes.key(ResourceKey.minecraft("play_sound")); - public static final DefaultedRegistryReference CHERRY = BoatTypes.key(ResourceKey.sponge("cherry")); + public static final DefaultedRegistryReference REMOVE_EFFECTS = ItemActionTypes.key(ResourceKey.minecraft("remove_effects")); - public static final DefaultedRegistryReference DARK_OAK = BoatTypes.key(ResourceKey.sponge("dark_oak")); + public static final DefaultedRegistryReference TELEPORT_RANDOMLY = ItemActionTypes.key(ResourceKey.minecraft("teleport_randomly")); - public static final DefaultedRegistryReference JUNGLE = BoatTypes.key(ResourceKey.sponge("jungle")); - - public static final DefaultedRegistryReference MANGROVE = BoatTypes.key(ResourceKey.sponge("mangrove")); - - public static final DefaultedRegistryReference OAK = BoatTypes.key(ResourceKey.sponge("oak")); - - public static final DefaultedRegistryReference SPRUCE = BoatTypes.key(ResourceKey.sponge("spruce")); - - private BoatTypes() { + private ItemActionTypes() { } - public static Registry registry() { - return Sponge.game().registry(RegistryTypes.BOAT_TYPE); + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.ITEM_ACTION_TYPE); } - private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.BOAT_TYPE, location).asDefaultedReference(Sponge::game); + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.ITEM_ACTION_TYPE, location).asDefaultedReference(Sponge::game); } } diff --git a/src/main/java/org/spongepowered/api/data/type/ItemTier.java b/src/main/java/org/spongepowered/api/data/type/ItemTier.java index ccc82dd75b7..ca4893872e2 100644 --- a/src/main/java/org/spongepowered/api/data/type/ItemTier.java +++ b/src/main/java/org/spongepowered/api/data/type/ItemTier.java @@ -29,7 +29,7 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(ItemTiers.class) -public interface ItemTier extends DefaultedRegistryValue { +public interface ItemTier extends DefaultedRegistryValue { /** * Gets the {@link Ingredient} needed to repair this tool. diff --git a/src/main/java/org/spongepowered/api/data/type/ItemTiers.java b/src/main/java/org/spongepowered/api/data/type/ItemTiers.java index 089e50f44de..633fdf2da0f 100644 --- a/src/main/java/org/spongepowered/api/data/type/ItemTiers.java +++ b/src/main/java/org/spongepowered/api/data/type/ItemTiers.java @@ -40,6 +40,8 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class ItemTiers { + public static final DefaultedRegistryReference COPPER = ItemTiers.key(ResourceKey.sponge("copper")); + public static final DefaultedRegistryReference DIAMOND = ItemTiers.key(ResourceKey.sponge("diamond")); public static final DefaultedRegistryReference GOLD = ItemTiers.key(ResourceKey.sponge("gold")); 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 84cabb9c2c1..4d417502e5c 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, StringRepresentable { +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/LlamaType.java b/src/main/java/org/spongepowered/api/data/type/LlamaType.java index 648b74cd434..e8bf2625dc6 100644 --- a/src/main/java/org/spongepowered/api/data/type/LlamaType.java +++ b/src/main/java/org/spongepowered/api/data/type/LlamaType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(LlamaTypes.class) -public interface LlamaType extends DefaultedRegistryValue { +public interface LlamaType extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/MatterType.java b/src/main/java/org/spongepowered/api/data/type/MatterType.java index 3e704778c07..e8fbe54048b 100644 --- a/src/main/java/org/spongepowered/api/data/type/MatterType.java +++ b/src/main/java/org/spongepowered/api/data/type/MatterType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(MatterTypes.class) -public interface MatterType extends DefaultedRegistryValue { +public interface MatterType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/MooshroomType.java b/src/main/java/org/spongepowered/api/data/type/MooshroomType.java index f4798b42dc7..c9dc0da6aac 100644 --- a/src/main/java/org/spongepowered/api/data/type/MooshroomType.java +++ b/src/main/java/org/spongepowered/api/data/type/MooshroomType.java @@ -31,6 +31,6 @@ * Represents a type of mooshroom a mooshroom is. */ @CatalogedBy(MooshroomTypes.class) -public interface MooshroomType extends DefaultedRegistryValue { +public interface MooshroomType extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/NotePitch.java b/src/main/java/org/spongepowered/api/data/type/NotePitch.java index 40af670682b..ae3c974ff06 100644 --- a/src/main/java/org/spongepowered/api/data/type/NotePitch.java +++ b/src/main/java/org/spongepowered/api/data/type/NotePitch.java @@ -33,6 +33,6 @@ * Represents a NotePitch which may be played by a {@link BlockTypes#NOTE_BLOCK}. */ @CatalogedBy(NotePitches.class) -public interface NotePitch extends DefaultedRegistryValue, Cycleable { +public interface NotePitch extends DefaultedRegistryValue, Cycleable { } diff --git a/src/main/java/org/spongepowered/api/data/type/PandaGene.java b/src/main/java/org/spongepowered/api/data/type/PandaGene.java index a665c46a49b..eaf7d57a518 100644 --- a/src/main/java/org/spongepowered/api/data/type/PandaGene.java +++ b/src/main/java/org/spongepowered/api/data/type/PandaGene.java @@ -31,7 +31,7 @@ * Represents the type of panda a panda is. */ @CatalogedBy(PandaGenes.class) -public interface PandaGene extends DefaultedRegistryValue { +public interface PandaGene extends DefaultedRegistryValue, StringRepresentable { boolean isRecessive(); } diff --git a/src/main/java/org/spongepowered/api/data/type/ParrotType.java b/src/main/java/org/spongepowered/api/data/type/ParrotType.java index 83c9593ce0d..60a00bf8ffc 100644 --- a/src/main/java/org/spongepowered/api/data/type/ParrotType.java +++ b/src/main/java/org/spongepowered/api/data/type/ParrotType.java @@ -32,6 +32,6 @@ * Represents the type of a {@link Parrot}. */ @CatalogedBy(ParrotTypes.class) -public interface ParrotType extends DefaultedRegistryValue { +public interface ParrotType extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/PhantomPhase.java b/src/main/java/org/spongepowered/api/data/type/PhantomPhase.java index e764f2d3380..f3c664f0dc1 100644 --- a/src/main/java/org/spongepowered/api/data/type/PhantomPhase.java +++ b/src/main/java/org/spongepowered/api/data/type/PhantomPhase.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(PhantomPhases.class) -public interface PhantomPhase extends DefaultedRegistryValue { +public interface PhantomPhase extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/PickupRule.java b/src/main/java/org/spongepowered/api/data/type/PickupRule.java index c9c78eaddf2..021a6dcd79c 100644 --- a/src/main/java/org/spongepowered/api/data/type/PickupRule.java +++ b/src/main/java/org/spongepowered/api/data/type/PickupRule.java @@ -32,6 +32,6 @@ * Represents a pickup rule used by {@link ArrowLike}s. */ @CatalogedBy(PickupRules.class) -public interface PickupRule extends DefaultedRegistryValue { +public interface PickupRule extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/world/generation/carver/CarvingStep.java b/src/main/java/org/spongepowered/api/data/type/PigType.java similarity index 86% rename from src/main/java/org/spongepowered/api/world/generation/carver/CarvingStep.java rename to src/main/java/org/spongepowered/api/data/type/PigType.java index f83e599d459..85863f492a8 100644 --- a/src/main/java/org/spongepowered/api/world/generation/carver/CarvingStep.java +++ b/src/main/java/org/spongepowered/api/data/type/PigType.java @@ -22,14 +22,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.world.generation.carver; +package org.spongepowered.api.data.type; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; -/** - * A carving step for {@link Carver carvers} - */ -@CatalogedBy(CarvingSteps.class) -public interface CarvingStep { - +@CatalogedBy(PigTypes.class) +public interface PigType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataPackValueEvent.java b/src/main/java/org/spongepowered/api/data/type/PigTypes.java similarity index 51% rename from src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataPackValueEvent.java rename to src/main/java/org/spongepowered/api/data/type/PigTypes.java index eb92a194c1a..4d3b41c9ea8 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataPackValueEvent.java +++ b/src/main/java/org/spongepowered/api/data/type/PigTypes.java @@ -22,18 +22,38 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.event.lifecycle; +package org.spongepowered.api.data.type; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.datapack.DataPackType; -import org.spongepowered.api.event.GenericEvent; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +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; -@SuppressWarnings("rawtypes") -@NoFactoryMethod -public interface RegisterDataPackValueEvent extends LifecycleEvent, GenericEvent { +/** + * + */ +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.ENGINE) +public final class PigTypes { + + public static final DefaultedRegistryReference COLD = PigTypes.key(ResourceKey.minecraft("cold")); + + public static final DefaultedRegistryReference TEMPERATE = PigTypes.key(ResourceKey.minecraft("temperate")); + + public static final DefaultedRegistryReference WARM = PigTypes.key(ResourceKey.minecraft("warm")); + + private PigTypes() { + } - DataPackType type(); + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.PIG_TYPE); + } - RegisterDataPackValueEvent register(T serializable); + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.PIG_TYPE, location).asScopedReference(); + } } 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 a52e8c2f201..c1d51f0c7c8 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, StringRepresentable { +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 efac7f30217..fc43466f16d 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, StringRepresentable { +public interface PortionType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/ProfessionType.java b/src/main/java/org/spongepowered/api/data/type/ProfessionType.java index 61d3c70b06e..2579b698bc4 100644 --- a/src/main/java/org/spongepowered/api/data/type/ProfessionType.java +++ b/src/main/java/org/spongepowered/api/data/type/ProfessionType.java @@ -33,6 +33,6 @@ * trade offers a trader may offer to a player. */ @CatalogedBy(ProfessionTypes.class) -public interface ProfessionType extends DefaultedRegistryValue { +public interface ProfessionType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/PushReaction.java b/src/main/java/org/spongepowered/api/data/type/PushReaction.java index 374eb454a12..940fd072394 100644 --- a/src/main/java/org/spongepowered/api/data/type/PushReaction.java +++ b/src/main/java/org/spongepowered/api/data/type/PushReaction.java @@ -24,9 +24,10 @@ */ package org.spongepowered.api.data.type; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(PushReactions.class) -public interface PushReaction { +public interface PushReaction extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/RabbitType.java b/src/main/java/org/spongepowered/api/data/type/RabbitType.java index b7809653488..5411b015d26 100644 --- a/src/main/java/org/spongepowered/api/data/type/RabbitType.java +++ b/src/main/java/org/spongepowered/api/data/type/RabbitType.java @@ -32,6 +32,6 @@ * Represents a type of {@link Rabbit}. */ @CatalogedBy(RabbitTypes.class) -public interface RabbitType extends DefaultedRegistryValue { +public interface RabbitType extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/RaidStatus.java b/src/main/java/org/spongepowered/api/data/type/RaidStatus.java index cd4ddfacfa3..0564237edc8 100644 --- a/src/main/java/org/spongepowered/api/data/type/RaidStatus.java +++ b/src/main/java/org/spongepowered/api/data/type/RaidStatus.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(RaidStatuses.class) -public interface RaidStatus extends DefaultedRegistryValue { +public interface RaidStatus extends DefaultedRegistryValue { } 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 4d21ad9d24a..9f681737a9e 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, StringRepresentable { +public interface RailDirection extends DefaultedRegistryValue, Cycleable, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/SalmonSize.java b/src/main/java/org/spongepowered/api/data/type/SalmonSize.java new file mode 100644 index 00000000000..d20284e52ad --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/SalmonSize.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.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(SalmonSizes.class) +public interface SalmonSize extends DefaultedRegistryValue, StringRepresentable { +} diff --git a/src/main/java/org/spongepowered/api/world/generation/carver/CarverTemplate.java b/src/main/java/org/spongepowered/api/data/type/SalmonSizes.java similarity index 59% rename from src/main/java/org/spongepowered/api/world/generation/carver/CarverTemplate.java rename to src/main/java/org/spongepowered/api/data/type/SalmonSizes.java index 8861ef82b8f..bec7d918adb 100644 --- a/src/main/java/org/spongepowered/api/world/generation/carver/CarverTemplate.java +++ b/src/main/java/org/spongepowered/api/data/type/SalmonSizes.java @@ -22,38 +22,26 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.world.generation.carver; +package org.spongepowered.api.data.type; +import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; +import org.spongepowered.api.registry.DefaultedRegistryReference; +import org.spongepowered.api.registry.RegistryKey; +import org.spongepowered.api.registry.RegistryTypes; /** - * A template for {@link CarverType carvers}. + * */ -public interface CarverTemplate extends DataPackEntry { +public final class SalmonSizes { - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the {@link Carver} - * - * @return The carver - */ - Carver carver(); + public static final DefaultedRegistryReference LARGE = SalmonSizes.key(ResourceKey.sponge("large")); - interface Builder extends DataPackEntryBuilder { + public static final DefaultedRegistryReference MEDIUM = SalmonSizes.key(ResourceKey.sponge("medium")); - /** - * Sets the {@link CarverType} - * - * @param type The carver type - * @return This builder, for chaining - */ - Builder type(CarverType type); + public static final DefaultedRegistryReference SMALL = SalmonSizes.key(ResourceKey.sponge("small")); + private static DefaultedRegistryReference key(ResourceKey key) { + return RegistryKey.of(RegistryTypes.SALMON_SIZE, key).asDefaultedReference(Sponge::game); } - } 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 2870604f94f..02972f16353 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, StringRepresentable { +public interface SculkSensorState extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/ShieldDamageReduction.java b/src/main/java/org/spongepowered/api/data/type/ShieldDamageReduction.java new file mode 100644 index 00000000000..a1bda626088 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ShieldDamageReduction.java @@ -0,0 +1,144 @@ +/* + * 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.Sponge; +import org.spongepowered.api.event.cause.entity.damage.DamageType; +import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; +import org.spongepowered.api.tag.Tag; +import org.spongepowered.api.util.ResettableBuilder; + +import java.util.Optional; +import java.util.Set; + + +/** + * Defines the amount of damage reduced when blocking with a shield-like {@link org.spongepowered.api.item.inventory.ItemStack}. + */ +public interface ShieldDamageReduction { + + static ShieldDamageReduction of(MultiplyAdd config) { + return Sponge.game().factoryProvider().provide(Factory.class).create(config); + } + + T configuration(); + + double resolve(DamageSource source, double damage, double angle); + + interface Factory { + + ShieldDamageReduction create(MultiplyAdd config); + + } + + /** + * The final amount of blocked damage will be {@code constantReduction + fractionalReduction * damage} + */ + interface MultiplyAdd { + + static Builder builder() { + return Sponge.game().builderProvider().provide(Builder.class); + } + + /** + * Returns the {@link DamageType damage types} this reduction applies to. + * {@link Optional#empty()} means this reduction is not restricted to any given damage type. + * + * @return the affected damage types + */ + Optional> damageTypes(); + + /** + * Returns the maximum angle between the users facing direction and the direction of the incoming attack. + * + * @return the maximum angle + */ + double horizontalBlockingAngle(); + + /** + * Returns the constant amount of damage to be blocked. + * + * @return a constant amount of damage to block + */ + double constantReduction(); + + /** + * Returns fractional amount of damage to block, where a factor of 1 means that all damage is blocked, + * and a factor of 0 that no damage is blocked. + * + * @return fractional amount of damage to block + */ + double fractionalReduction(); + + interface Builder extends ResettableBuilder { + + /** + * Limits the {@link DamageType damage types} this reduction applies to. + * + * @param damageTypes the affected damage types + * @return This builder, for chaining + */ + Builder damageTypes(Set damageTypes); + + /** + * Limits the {@link DamageType damage types} this reduction applies to. + * + * @param tag the tag defining affected damage types + * @return This builder, for chaining + */ + Builder damageTypes(Tag tag); + + /** + * Sets the maximum angle between the users facing direction and the direction of the incoming attack. + * + * @param angle the maximum angle + * @return This builder, for chaining + */ + Builder horizontalBlockingAngle(double angle); + + /** + * Sets the constant amount of damage to be blocked. + * + * @param constant a constant amount of damage to block + * @return This builder, for chaining + */ + Builder constantReduction(double constant); + + /** + * Sets fractional amount of damage to block, where a factor of 1 means that all damage is blocked, + * and a factor of 0 that no damage is blocked. + * + * @param fraction fractional amount of damage to block + * @return This builder, for chaining + */ + Builder fractionalReduction(double fraction); + + MultiplyAdd build(); + + } + + } + +} diff --git a/src/main/java/org/spongepowered/api/data/type/ShieldItemDamageFunction.java b/src/main/java/org/spongepowered/api/data/type/ShieldItemDamageFunction.java new file mode 100644 index 00000000000..5ee106b8594 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/ShieldItemDamageFunction.java @@ -0,0 +1,114 @@ +/* + * 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.Sponge; +import org.spongepowered.api.util.ResettableBuilder; + +/** + * Defines the amount of {@link org.spongepowered.api.data.Keys#ITEM_DURABILITY} damage a shield-like + * {@link org.spongepowered.api.item.inventory.ItemStack} takes, when blocking an attack. + */ +public interface ShieldItemDamageFunction { + + static ShieldItemDamageFunction of(MultiplyAdd config) { + return Sponge.game().factoryProvider().provide(Factory.class).create(config); + } + + T configuration(); + + double resolve(double damage); + + interface Factory { + + ShieldItemDamageFunction create(MultiplyAdd config); + + } + + /** + * The final amount of damage will be {@code constantDamage + fractionalDamage * attackDamage} + */ + interface MultiplyAdd { + + static Builder builder() { + return Sponge.game().builderProvider().provide(Builder.class); + } + + /** + * Returns the minimum amount of damage blocked attack must have had, for the item to take damage at all. + * + * @return minimum attack damage required for any durability loss + */ + double minAttackDamage(); + + /** + * Returns the constant amount of damage taken. + * + * @return a constant amount of damage to take + */ + double constantDamage(); + + /** + * Returns fractional amount of damage to take, where a factor of 1 means that the amount of durability lost is equal to attack damage, + * and a factor of 0 that no durability is lost. + * + * @return fractional amount of damage to take + */ + double fractionalDamage(); + + interface Builder extends ResettableBuilder { + + /** + * Sets the minimum amount of damage blocked attack must have had, for the item to take damage at all. + * + * @param minDamage minimum attack damage required for any durability loss + * @return This builder, for chaining + */ + Builder minAttackDamage(double minDamage); + + /** + * Sets the constant amount of damage taken. + * + * @param constantDamage a constant amount of damage to take + * @return This builder, for chaining + */ + Builder constantDamage(double constantDamage); + + /** + * Sets fractional amount of damage to take, where a factor of 1 means that the amount of durability lost is equal to attack damage, + * and a factor of 0 that no durability is lost. + * + * @param fractionalDamage fractional amount of damage to take + * @return This builder, for chaining + */ + Builder fractionalDamage(double fractionalDamage); + + MultiplyAdd build(); + + } + + } + +} diff --git a/src/main/java/org/spongepowered/api/data/type/SideChain.java b/src/main/java/org/spongepowered/api/data/type/SideChain.java new file mode 100644 index 00000000000..7f84925611f --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/SideChain.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.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(SideChains.class) +public interface SideChain extends DefaultedRegistryValue, StringRepresentable, Comparable { +} diff --git a/src/main/java/org/spongepowered/api/data/type/SideChains.java b/src/main/java/org/spongepowered/api/data/type/SideChains.java new file mode 100644 index 00000000000..f9b823a5f99 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/SideChains.java @@ -0,0 +1,60 @@ +/* + * 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 SideChains { + + public static final DefaultedRegistryReference CENTER = SideChains.key(ResourceKey.sponge("center")); + + public static final DefaultedRegistryReference LEFT = SideChains.key(ResourceKey.sponge("left")); + + public static final DefaultedRegistryReference RIGHT = SideChains.key(ResourceKey.sponge("right")); + + public static final DefaultedRegistryReference UNCONNECTED = SideChains.key(ResourceKey.sponge("unconnected")); + + private SideChains() { + } + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.SIDE_CHAIN); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.SIDE_CHAIN, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/SkinPart.java b/src/main/java/org/spongepowered/api/data/type/SkinPart.java index 79887f44080..0441696319a 100644 --- a/src/main/java/org/spongepowered/api/data/type/SkinPart.java +++ b/src/main/java/org/spongepowered/api/data/type/SkinPart.java @@ -32,6 +32,6 @@ * Represents a part of a player's skin. */ @CatalogedBy(SkinParts.class) -public interface SkinPart extends DefaultedRegistryValue, ComponentLike { +public interface SkinPart extends DefaultedRegistryValue, ComponentLike { } 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 af3853a2be8..213caa72e32 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, StringRepresentable { +public interface SlabPortion extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/SpellType.java b/src/main/java/org/spongepowered/api/data/type/SpellType.java index 9fd3f79b3cc..1b820904bdf 100644 --- a/src/main/java/org/spongepowered/api/data/type/SpellType.java +++ b/src/main/java/org/spongepowered/api/data/type/SpellType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(SpellTypes.class) -public interface SpellType extends DefaultedRegistryValue { +public interface SpellType extends DefaultedRegistryValue { } 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 a445a429130..eab57dae00d 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, StringRepresentable { +public interface StairShape extends DefaultedRegistryValue, Comparable, StringRepresentable { } 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 7562aa8d9f2..9da96db59dc 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, StringRepresentable { +public interface StructureMode extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/BoatType.java b/src/main/java/org/spongepowered/api/data/type/TestBlockMode.java similarity index 89% rename from src/main/java/org/spongepowered/api/data/type/BoatType.java rename to src/main/java/org/spongepowered/api/data/type/TestBlockMode.java index bece42a412c..611ab98a414 100644 --- a/src/main/java/org/spongepowered/api/data/type/BoatType.java +++ b/src/main/java/org/spongepowered/api/data/type/TestBlockMode.java @@ -24,12 +24,10 @@ */ package org.spongepowered.api.data.type; -import org.spongepowered.api.block.BlockType; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; -@CatalogedBy(BoatTypes.class) -public interface BoatType extends DefaultedRegistryValue { +@CatalogedBy(TestBlockModes.class) +public interface TestBlockMode extends Comparable, DefaultedRegistryValue, StringRepresentable { - BlockType representedBlock(); } diff --git a/src/main/java/org/spongepowered/api/data/type/TestBlockModes.java b/src/main/java/org/spongepowered/api/data/type/TestBlockModes.java new file mode 100644 index 00000000000..d40bd14caa4 --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/TestBlockModes.java @@ -0,0 +1,54 @@ +/* + * 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 class TestBlockModes { + + public static final DefaultedRegistryReference ACCEPT = TestBlockModes.key(ResourceKey.sponge("accept")); + + public static final DefaultedRegistryReference FAIL = TestBlockModes.key(ResourceKey.sponge("fail")); + + public static final DefaultedRegistryReference LOG = TestBlockModes.key(ResourceKey.sponge("log")); + + public static final DefaultedRegistryReference START = TestBlockModes.key(ResourceKey.sponge("start")); + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.TEST_BLOCK_MODE); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.TEST_BLOCK_MODE, location).asDefaultedReference(Sponge::game); + } +} 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 eeca1951d71..ddb3614aac5 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, StringRepresentable { +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/TrialSpawnerState.java b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java index 504d2ecacc0..cb4e9c7d36f 100644 --- a/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java +++ b/src/main/java/org/spongepowered/api/data/type/TrialSpawnerState.java @@ -24,9 +24,10 @@ */ package org.spongepowered.api.data.type; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(TrialSpawnerStates.class) -public interface TrialSpawnerState extends Comparable, StringRepresentable { +public interface TrialSpawnerState extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/TropicalFishShape.java b/src/main/java/org/spongepowered/api/data/type/TropicalFishShape.java index 010860e2aa9..32c6c19da56 100644 --- a/src/main/java/org/spongepowered/api/data/type/TropicalFishShape.java +++ b/src/main/java/org/spongepowered/api/data/type/TropicalFishShape.java @@ -34,7 +34,7 @@ *

A TropicalFishShape represents both a fish's appearance and size.

*/ @CatalogedBy(TropicalFishShapes.class) -public interface TropicalFishShape extends DefaultedRegistryValue { +public interface TropicalFishShape extends DefaultedRegistryValue, StringRepresentable { /** * Whether this shape represents a large {@link TropicalFish}. diff --git a/src/main/java/org/spongepowered/api/data/type/VaultState.java b/src/main/java/org/spongepowered/api/data/type/VaultState.java index b80f20a53df..57d754d1cfa 100644 --- a/src/main/java/org/spongepowered/api/data/type/VaultState.java +++ b/src/main/java/org/spongepowered/api/data/type/VaultState.java @@ -24,9 +24,10 @@ */ package org.spongepowered.api.data.type; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(VaultStates.class) -public interface VaultState extends Comparable, StringRepresentable { +public interface VaultState extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/VillagerType.java b/src/main/java/org/spongepowered/api/data/type/VillagerType.java index 4ca7f988a88..f85eddcf6d6 100644 --- a/src/main/java/org/spongepowered/api/data/type/VillagerType.java +++ b/src/main/java/org/spongepowered/api/data/type/VillagerType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(VillagerTypes.class) -public interface VillagerType extends DefaultedRegistryValue { +public interface VillagerType extends DefaultedRegistryValue { } 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 2ea5feec8e5..908150c356a 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, StringRepresentable { +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 dc35ec8fb77..a418ed6e2d4 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, StringRepresentable { +public interface WireAttachmentType extends DefaultedRegistryValue, Comparable, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/data/type/WolfSoundVariant.java b/src/main/java/org/spongepowered/api/data/type/WolfSoundVariant.java new file mode 100644 index 00000000000..7e5ea9c793b --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/WolfSoundVariant.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.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(WolfSoundVariants.class) +public interface WolfSoundVariant extends DefaultedRegistryValue { +} diff --git a/src/main/java/org/spongepowered/api/data/type/WolfSoundVariants.java b/src/main/java/org/spongepowered/api/data/type/WolfSoundVariants.java new file mode 100644 index 00000000000..3ff9e811d8b --- /dev/null +++ b/src/main/java/org/spongepowered/api/data/type/WolfSoundVariants.java @@ -0,0 +1,67 @@ +/* + * 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; + +/** + * + */ +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.ENGINE) +public final class WolfSoundVariants { + + public static final DefaultedRegistryReference ANGRY = WolfSoundVariants.key(ResourceKey.minecraft("angry")); + + public static final DefaultedRegistryReference BIG = WolfSoundVariants.key(ResourceKey.minecraft("big")); + + public static final DefaultedRegistryReference CLASSIC = WolfSoundVariants.key(ResourceKey.minecraft("classic")); + + public static final DefaultedRegistryReference CUTE = WolfSoundVariants.key(ResourceKey.minecraft("cute")); + + public static final DefaultedRegistryReference GRUMPY = WolfSoundVariants.key(ResourceKey.minecraft("grumpy")); + + public static final DefaultedRegistryReference PUGLIN = WolfSoundVariants.key(ResourceKey.minecraft("puglin")); + + public static final DefaultedRegistryReference SAD = WolfSoundVariants.key(ResourceKey.minecraft("sad")); + + private WolfSoundVariants() { + } + + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.WOLF_SOUND_VARIANT); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.WOLF_SOUND_VARIANT, location).asScopedReference(); + } +} diff --git a/src/main/java/org/spongepowered/api/data/type/WolfVariant.java b/src/main/java/org/spongepowered/api/data/type/WolfVariant.java index 50f041bfaf1..f8209ff2985 100644 --- a/src/main/java/org/spongepowered/api/data/type/WolfVariant.java +++ b/src/main/java/org/spongepowered/api/data/type/WolfVariant.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(WolfVariants.class) -public interface WolfVariant extends DefaultedRegistryValue { +public interface WolfVariant extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/data/type/WolfVariants.java b/src/main/java/org/spongepowered/api/data/type/WolfVariants.java index f362a6b1890..1c85e6fa37e 100644 --- a/src/main/java/org/spongepowered/api/data/type/WolfVariants.java +++ b/src/main/java/org/spongepowered/api/data/type/WolfVariants.java @@ -25,47 +25,47 @@ 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.RegistryReference; import org.spongepowered.api.registry.RegistryScope; import org.spongepowered.api.registry.RegistryScopes; import org.spongepowered.api.registry.RegistryTypes; -import org.spongepowered.api.world.server.ServerWorld; /** * */ @SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.WORLD) +@RegistryScopes(scopes = RegistryScope.ENGINE) public final class WolfVariants { - public static final RegistryReference ASHEN = WolfVariants.key(ResourceKey.minecraft("ashen")); + public static final DefaultedRegistryReference ASHEN = WolfVariants.key(ResourceKey.minecraft("ashen")); - public static final RegistryReference BLACK = WolfVariants.key(ResourceKey.minecraft("black")); + public static final DefaultedRegistryReference BLACK = WolfVariants.key(ResourceKey.minecraft("black")); - public static final RegistryReference CHESTNUT = WolfVariants.key(ResourceKey.minecraft("chestnut")); + public static final DefaultedRegistryReference CHESTNUT = WolfVariants.key(ResourceKey.minecraft("chestnut")); - public static final RegistryReference PALE = WolfVariants.key(ResourceKey.minecraft("pale")); + public static final DefaultedRegistryReference PALE = WolfVariants.key(ResourceKey.minecraft("pale")); - public static final RegistryReference RUSTY = WolfVariants.key(ResourceKey.minecraft("rusty")); + public static final DefaultedRegistryReference RUSTY = WolfVariants.key(ResourceKey.minecraft("rusty")); - public static final RegistryReference SNOWY = WolfVariants.key(ResourceKey.minecraft("snowy")); + public static final DefaultedRegistryReference SNOWY = WolfVariants.key(ResourceKey.minecraft("snowy")); - public static final RegistryReference SPOTTED = WolfVariants.key(ResourceKey.minecraft("spotted")); + public static final DefaultedRegistryReference SPOTTED = WolfVariants.key(ResourceKey.minecraft("spotted")); - public static final RegistryReference STRIPED = WolfVariants.key(ResourceKey.minecraft("striped")); + public static final DefaultedRegistryReference STRIPED = WolfVariants.key(ResourceKey.minecraft("striped")); - public static final RegistryReference WOODS = WolfVariants.key(ResourceKey.minecraft("woods")); + public static final DefaultedRegistryReference WOODS = WolfVariants.key(ResourceKey.minecraft("woods")); private WolfVariants() { } - public static Registry registry(final ServerWorld world) { - return world.registry(RegistryTypes.WOLF_VAIRANT); + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.WOLF_VARIANT); } - private static RegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.WOLF_VAIRANT, location).asReference(); + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.WOLF_VARIANT, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/datapack/DataPackEntry.java b/src/main/java/org/spongepowered/api/datapack/DataPackSerializable.java similarity index 69% rename from src/main/java/org/spongepowered/api/datapack/DataPackEntry.java rename to src/main/java/org/spongepowered/api/datapack/DataPackSerializable.java index 913023ff443..129b182da3b 100644 --- a/src/main/java/org/spongepowered/api/datapack/DataPackEntry.java +++ b/src/main/java/org/spongepowered/api/datapack/DataPackSerializable.java @@ -24,19 +24,23 @@ */ package org.spongepowered.api.datapack; -import org.spongepowered.api.ResourceKeyed; -import org.spongepowered.api.data.persistence.DataSerializable; +import org.spongepowered.api.data.persistence.DataContainer; +import org.spongepowered.api.registry.RegistryHolder; + +import java.util.Optional; /** - * A data pack entry. Can be saved using the {@link org.spongepowered.api.world.server.DataPackManager} or when registering it on a {@link org.spongepowered.api.event.lifecycle.RegisterDataPackValueEvent} + * Represents a type that can be serialized into a {@link DataContainer} + * and is a valid data pack entry. */ -public interface DataPackEntry> extends ResourceKeyed, DataSerializable { +public interface DataPackSerializable { /** - * The data pack this entry belongs to. + * Creates a serialized representation of this type + * if possible. Not all types have serializable representation. * - * @return The data pack + * @param registryHolder The registry holder. + * @return The serialized data container. */ - DataPack pack(); - + Optional toDataPack(RegistryHolder registryHolder); } diff --git a/src/main/java/org/spongepowered/api/datapack/DataPackType.java b/src/main/java/org/spongepowered/api/datapack/DataPackType.java deleted file mode 100644 index 8edcd91e9ac..00000000000 --- a/src/main/java/org/spongepowered/api/datapack/DataPackType.java +++ /dev/null @@ -1,106 +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.datapack; - -import org.spongepowered.api.advancement.AdvancementTemplate; -import org.spongepowered.api.adventure.ChatTypeTemplate; -import org.spongepowered.api.data.type.ArtTypeTemplate; -import org.spongepowered.api.event.cause.entity.damage.DamageTypeTemplate; -import org.spongepowered.api.item.recipe.RecipeRegistration; -import org.spongepowered.api.registry.RegistryType; -import org.spongepowered.api.tag.TagTemplate; -import org.spongepowered.api.tag.Taggable; -import org.spongepowered.api.util.annotation.CatalogedBy; -import org.spongepowered.api.world.WorldTypeTemplate; -import org.spongepowered.api.world.biome.BiomeTemplate; -import org.spongepowered.api.world.generation.carver.CarverTemplate; -import org.spongepowered.api.world.generation.config.noise.DensityFunctionTemplate; -import org.spongepowered.api.world.generation.config.noise.NoiseGeneratorConfigTemplate; -import org.spongepowered.api.world.generation.config.noise.NoiseTemplate; -import org.spongepowered.api.world.generation.feature.FeatureTemplate; -import org.spongepowered.api.world.generation.feature.PlacedFeatureTemplate; -import org.spongepowered.api.world.generation.structure.SchematicTemplate; -import org.spongepowered.api.world.generation.structure.StructureSetTemplate; -import org.spongepowered.api.world.generation.structure.StructureTemplate; -import org.spongepowered.api.world.generation.structure.jigsaw.JigsawPoolTemplate; -import org.spongepowered.api.world.generation.structure.jigsaw.ProcessorListTemplate; -import org.spongepowered.api.world.server.WorldTemplate; - -@CatalogedBy(DataPackTypes.class) -public interface DataPackType { - - /** - * Returns a data pack for this data pack type. - * - * @param name The pack name - * @param description The pack description - * - * @return The new pack. - */ - DataPack pack(String name, String description); - - interface Factory { - - DataPackType advancement(); - - DataPackType recipe(); - - DataPackType worldType(); - - DataPackType world(); - - > DataPackType> tag(RegistryType registryType); - - DataPackType biome(); - - DataPackType carver(); - - DataPackType feature(); - - DataPackType placedFeature(); - - DataPackType noiseGeneratorConfig(); - - DataPackType noise(); - - DataPackType densityFunction(); - - DataPackType structure(); - - DataPackType schematic(); - - DataPackType processorList(); - - DataPackType structureSet(); - - DataPackType jigsawPool(); - - DataPackType chatType(); - - DataPackType damageType(); - - DataPackType artType(); - } -} diff --git a/src/main/java/org/spongepowered/api/datapack/DataPackTypes.java b/src/main/java/org/spongepowered/api/datapack/DataPackTypes.java deleted file mode 100644 index d6deacc4404..00000000000 --- a/src/main/java/org/spongepowered/api/datapack/DataPackTypes.java +++ /dev/null @@ -1,119 +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.datapack; - -import org.spongepowered.api.Sponge; -import org.spongepowered.api.advancement.AdvancementTemplate; -import org.spongepowered.api.adventure.ChatTypeTemplate; -import org.spongepowered.api.block.BlockType; -import org.spongepowered.api.data.type.ArtTypeTemplate; -import org.spongepowered.api.entity.EntityType; -import org.spongepowered.api.event.cause.entity.damage.DamageType; -import org.spongepowered.api.event.cause.entity.damage.DamageTypeTemplate; -import org.spongepowered.api.fluid.FluidType; -import org.spongepowered.api.item.ItemType; -import org.spongepowered.api.item.recipe.RecipeRegistration; -import org.spongepowered.api.registry.RegistryType; -import org.spongepowered.api.registry.RegistryTypes; -import org.spongepowered.api.tag.TagTemplate; -import org.spongepowered.api.world.WorldTypeTemplate; -import org.spongepowered.api.world.biome.Biome; -import org.spongepowered.api.world.biome.BiomeTemplate; -import org.spongepowered.api.world.generation.carver.CarverTemplate; -import org.spongepowered.api.world.generation.config.noise.DensityFunctionTemplate; -import org.spongepowered.api.world.generation.config.noise.NoiseGeneratorConfigTemplate; -import org.spongepowered.api.world.generation.config.noise.NoiseTemplate; -import org.spongepowered.api.world.generation.feature.FeatureTemplate; -import org.spongepowered.api.world.generation.feature.PlacedFeatureTemplate; -import org.spongepowered.api.world.generation.structure.SchematicTemplate; -import org.spongepowered.api.world.generation.structure.StructureSetTemplate; -import org.spongepowered.api.world.generation.structure.StructureTemplate; -import org.spongepowered.api.world.generation.structure.jigsaw.JigsawPoolTemplate; -import org.spongepowered.api.world.generation.structure.jigsaw.ProcessorListTemplate; -import org.spongepowered.api.world.server.WorldTemplate; - -public final class DataPackTypes { - - // SORTFIELDS:ON - - public static final DataPackType ADVANCEMENT = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).advancement(); - - public static final DataPackType RECIPE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).recipe(); - - public static final DataPackType> BLOCK_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag(RegistryTypes.BLOCK_TYPE); - - public static final DataPackType> FLUID_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag(RegistryTypes.FLUID_TYPE); - - public static final DataPackType> ITEM_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag(RegistryTypes.ITEM_TYPE); - - public static final DataPackType>> ENTITY_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag((RegistryType>) RegistryTypes.ENTITY_TYPE); - - public static final DataPackType> BIOME_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag(RegistryTypes.BIOME); - - public static final DataPackType BIOME = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).biome(); - - public static final DataPackType CARVER = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).carver(); - - public static final DataPackType FEATURE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).feature(); - - public static final DataPackType PLACED_FEATURE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).placedFeature(); - - public static final DataPackType WORLD_TYPE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).worldType(); - - public static final DataPackType WORLD = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).world(); - - public static final DataPackType NOISE_GENERATOR_CONFIG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).noiseGeneratorConfig(); - - public static final DataPackType NOISE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).noise(); - - public static final DataPackType DENSITY_FUNCTION = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).densityFunction(); - - public static final DataPackType STRUCTURE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).structure(); - - public static final DataPackType STRUCTURE_SET = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).structureSet(); - - public static final DataPackType SCHEMATIC = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).schematic(); - - public static final DataPackType PROCESSOR_LIST = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).processorList(); - - public static final DataPackType JIGSAW_POOL = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).jigsawPool(); - - public static final DataPackType CHAT_TYPE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).chatType(); - - public static final DataPackType DAMAGE_TYPE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).damageType(); - public static final DataPackType> DAMAGE_TYPE_TAG = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).tag(RegistryTypes.DAMAGE_TYPE); - - public static final DataPackType ART_TYPE = Sponge.game().factoryProvider().provide(DataPackType.Factory.class).artType(); - - // SORTFIELDS:OFF - - // TODO `worldgen/world_preset`? WorldGenerationConfig? with mapping of LevelStems - // TODO `worldgen/flat_level_generator_preset`? `FlatGeneratorConfigs` - // TODO tag for `game_event` + registry - // TODO `loot_tables` - - private DataPackTypes() { - } -} diff --git a/src/main/java/org/spongepowered/api/datapack/DataPacks.java b/src/main/java/org/spongepowered/api/datapack/DataPacks.java deleted file mode 100644 index ad0c4728317..00000000000 --- a/src/main/java/org/spongepowered/api/datapack/DataPacks.java +++ /dev/null @@ -1,107 +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.datapack; - -import org.spongepowered.api.advancement.AdvancementTemplate; -import org.spongepowered.api.adventure.ChatTypeTemplate; -import org.spongepowered.api.block.BlockType; -import org.spongepowered.api.entity.EntityType; -import org.spongepowered.api.event.cause.entity.damage.DamageType; -import org.spongepowered.api.event.cause.entity.damage.DamageTypeTemplate; -import org.spongepowered.api.fluid.FluidType; -import org.spongepowered.api.item.ItemType; -import org.spongepowered.api.item.recipe.RecipeRegistration; -import org.spongepowered.api.tag.TagTemplate; -import org.spongepowered.api.world.WorldTypeTemplate; -import org.spongepowered.api.world.biome.BiomeTemplate; -import org.spongepowered.api.world.generation.carver.CarverTemplate; -import org.spongepowered.api.world.generation.config.noise.DensityFunctionTemplate; -import org.spongepowered.api.world.generation.config.noise.NoiseGeneratorConfigTemplate; -import org.spongepowered.api.world.generation.config.noise.NoiseTemplate; -import org.spongepowered.api.world.generation.feature.FeatureTemplate; -import org.spongepowered.api.world.generation.feature.PlacedFeatureTemplate; -import org.spongepowered.api.world.generation.structure.SchematicTemplate; -import org.spongepowered.api.world.generation.structure.StructureSetTemplate; -import org.spongepowered.api.world.generation.structure.StructureTemplate; -import org.spongepowered.api.world.generation.structure.jigsaw.JigsawPoolTemplate; -import org.spongepowered.api.world.generation.structure.jigsaw.ProcessorListTemplate; -import org.spongepowered.api.world.server.WorldTemplate; - -/** - * Sponge provided default data packs for plugins. When building a {@link DataPackEntry} these packs are set by default. - */ -public final class DataPacks { - - // SORTFIELDS:ON - - public static final DataPack ADVANCEMENT = DataPackTypes.ADVANCEMENT.pack("plugin_advancements", "Sponge plugin provided advancements"); - - public static final DataPack RECIPE = DataPackTypes.RECIPE.pack("plugin_recipes", "Sponge plugin provided recipes"); - - public static final DataPack> BLOCK_TAG = DataPackTypes.BLOCK_TAG.pack("plugin_tags", "Sponge plugin provided tags"); - - public static final DataPack> FLUID_TAG = DataPackTypes.FLUID_TAG.pack("plugin_tags", "Sponge plugin provided tags"); - - public static final DataPack> ITEM_TAG = DataPackTypes.ITEM_TAG.pack("plugin_tags", "Sponge plugin provided tags"); - - public static final DataPack>> ENTITY_TAG = DataPackTypes.ENTITY_TAG.pack("plugin_tags", "Sponge plugin provided tags"); - - public static final DataPack BIOME = DataPackTypes.BIOME.pack("plugin_worlds", "Sponge plugin provided biomes"); - - public static final DataPack CARVER = DataPackTypes.CARVER.pack("plugin_worlds", "Sponge plugin provided carvers"); - - public static final DataPack FEATURE = DataPackTypes.FEATURE.pack("plugin_worlds", "Sponge plugin provided features"); - - public static final DataPack PLACED_FEATURE = DataPackTypes.PLACED_FEATURE.pack("plugin_worlds", "Sponge plugin provided placed features"); - - public static final DataPack WORLD_TYPE = DataPackTypes.WORLD_TYPE.pack("plugin_worlds", "Sponge plugin provided world types"); - - public static final DataPack WORLD = DataPackTypes.WORLD.pack("plugin_worlds", "Sponge plugin provided worlds"); - - public static final DataPack NOISE_GENERATOR_CONFIG = DataPackTypes.NOISE_GENERATOR_CONFIG.pack("plugin_worldgen", "Sponge plugin provided noise generator configs"); - - public static final DataPack NOISE = DataPackTypes.NOISE.pack("plugin_worldgen", "Sponge plugin provided noises"); - - public static final DataPack DENSITY_FUNCTION = DataPackTypes.DENSITY_FUNCTION.pack("plugin_worldgen", "Sponge plugin provided density functions"); - - public static final DataPack STRUCTURE = DataPackTypes.STRUCTURE.pack("plugin_worldgen", "Sponge plugin provided structures"); - - public static final DataPack STRUCTURE_SET = DataPackTypes.STRUCTURE_SET.pack("plugin_worldgen", "Sponge plugin provided structure sets"); - - public static final DataPack SCHEMATIC = DataPackTypes.SCHEMATIC.pack("plugin_worldgen", "Sponge plugin provided structure schematics"); - - public static final DataPack PROCESSOR_LIST = DataPackTypes.PROCESSOR_LIST.pack("plugin_worldgen", "Sponge plugin provided processor lists"); - - public static final DataPack JIGSAW_POOL = DataPackTypes.JIGSAW_POOL.pack("plugin_worldgen", "Sponge plugin provided jigsaw pools"); - public static final DataPack CHAT_TYPE = DataPackTypes.CHAT_TYPE.pack("plugin_chat_types", "Sponge plugin provided chat types"); - - public static final DataPack DAMAGE_TYPE = DataPackTypes.DAMAGE_TYPE.pack("plugin_damage_types", "Sponge plugin provided damage types"); - public static final DataPack> DAMAGE_TYPE_TAG = DataPackTypes.DAMAGE_TYPE_TAG.pack("plugin_damage_types", "Sponge plugin provided damage type tags"); - - // SORTFIELDS:ON - - private DataPacks() { - } -} diff --git a/src/main/java/org/spongepowered/api/effect/VanishState.java b/src/main/java/org/spongepowered/api/effect/VanishState.java index f803d9ac1bc..72fa2ecf0b1 100644 --- a/src/main/java/org/spongepowered/api/effect/VanishState.java +++ b/src/main/java/org/spongepowered/api/effect/VanishState.java @@ -35,7 +35,7 @@ public interface VanishState { /** - * Gets a vanished state via {@link Factory#vanish()} with the following + * Gets a vanished state via {@link Factory#vanished()} with the following * defaults: *
    *
  • {@link VanishState#invisible()} = {@code true}
  • diff --git a/src/main/java/org/spongepowered/api/effect/Viewer.java b/src/main/java/org/spongepowered/api/effect/Viewer.java index 9fe9d4d80c4..7ece3a855aa 100644 --- a/src/main/java/org/spongepowered/api/effect/Viewer.java +++ b/src/main/java/org/spongepowered/api/effect/Viewer.java @@ -31,6 +31,7 @@ import org.spongepowered.api.effect.particle.ParticleEffect; import org.spongepowered.api.effect.sound.SoundType; import org.spongepowered.api.effect.sound.music.MusicDisc; +import org.spongepowered.api.item.inventory.ItemStackLike; import org.spongepowered.api.world.World; import org.spongepowered.api.world.WorldType; import org.spongepowered.api.world.WorldTypes; @@ -57,6 +58,13 @@ public interface Viewer extends Audience { */ void sendWorldType(WorldType worldType); + /** + * Plays the totem of undying effect with the texture of the given item. + * + * @param stack The item to display + */ + void playTotemOfUndyingEffect(ItemStackLike stack); + /** * Spawn the given {@link ParticleEffect} at the given position. * diff --git a/src/main/java/org/spongepowered/api/effect/particle/ParticleOption.java b/src/main/java/org/spongepowered/api/effect/particle/ParticleOption.java index 91cc1172c26..fb199688fb1 100644 --- a/src/main/java/org/spongepowered/api/effect/particle/ParticleOption.java +++ b/src/main/java/org/spongepowered/api/effect/particle/ParticleOption.java @@ -34,7 +34,7 @@ * @param The type of the option value */ @CatalogedBy(ParticleOptions.class) -public interface ParticleOption extends DefaultedRegistryValue { +public interface ParticleOption extends DefaultedRegistryValue> { /** * Gets the type of the value. 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 c9e3a59c951..c6d8cb70721 100644 --- a/src/main/java/org/spongepowered/api/effect/particle/ParticleOptions.java +++ b/src/main/java/org/spongepowered/api/effect/particle/ParticleOptions.java @@ -59,6 +59,7 @@ public final class ParticleOptions { *
  • {@link ParticleTypes#BLOCK_MARKER}
  • *
  • {@link ParticleTypes#DUST_PILLAR}
  • *
  • {@link ParticleTypes#FALLING_DUST}
  • + *
  • {@link ParticleTypes#BLOCK_CRUMBLE}
  • *
*/ public static final DefaultedRegistryReference> BLOCK_STATE = ParticleOptions.key(ResourceKey.sponge("block_state")); @@ -71,6 +72,7 @@ public final class ParticleOptions { *
  • {@link ParticleTypes#ENTITY_EFFECT}
  • *
  • {@link ParticleTypes#DUST}
  • *
  • {@link ParticleTypes#DUST_COLOR_TRANSITION}
  • + *
  • {@link ParticleTypes#TRAIL}
  • * */ public static final DefaultedRegistryReference> COLOR = ParticleOptions.key(ResourceKey.sponge("color")); @@ -158,6 +160,16 @@ public final class ParticleOptions { */ public static final DefaultedRegistryReference> SCALE = ParticleOptions.key(ResourceKey.sponge("scale")); + /** + * This option will affect the target of a particle + * The only vanilla {@link ParticleType} this option is applicable to is: + * + *
      + *
    • {@link ParticleTypes#TRAIL}
    • + *
    + */ + public static final DefaultedRegistryReference> TARGET = ParticleOptions.key(ResourceKey.sponge("target")); + /** * This option will change the color the transition particle will change to. * The only vanilla {@link ParticleType} this option is applicable to is: @@ -174,6 +186,7 @@ public final class ParticleOptions { * *
      *
    • {@link ParticleTypes#VIBRATION}
    • + *
    • {@link ParticleTypes#TRAIL}
    • *
    */ public static final DefaultedRegistryReference> TRAVEL_TIME = ParticleOptions.key(ResourceKey.sponge("travel_time")); diff --git a/src/main/java/org/spongepowered/api/effect/particle/ParticleType.java b/src/main/java/org/spongepowered/api/effect/particle/ParticleType.java index bf12edbcfe6..1fab60ace4a 100644 --- a/src/main/java/org/spongepowered/api/effect/particle/ParticleType.java +++ b/src/main/java/org/spongepowered/api/effect/particle/ParticleType.java @@ -35,7 +35,7 @@ * Represents a particle that can be sent on a Minecraft client. */ @CatalogedBy(ParticleTypes.class) -public interface ParticleType extends DefaultedRegistryValue { +public interface ParticleType extends DefaultedRegistryValue { /** * Gets the default value for the specified {@link ParticleOption}, it may 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 06fa3d1930c..1e20d477593 100644 --- a/src/main/java/org/spongepowered/api/effect/particle/ParticleTypes.java +++ b/src/main/java/org/spongepowered/api/effect/particle/ParticleTypes.java @@ -46,6 +46,8 @@ public final class ParticleTypes { public static final DefaultedRegistryReference BLOCK = ParticleTypes.key(ResourceKey.minecraft("block")); + public static final DefaultedRegistryReference BLOCK_CRUMBLE = ParticleTypes.key(ResourceKey.minecraft("block_crumble")); + public static final DefaultedRegistryReference BLOCK_MARKER = ParticleTypes.key(ResourceKey.minecraft("block_marker")); public static final DefaultedRegistryReference BUBBLE = ParticleTypes.key(ResourceKey.minecraft("bubble")); @@ -64,6 +66,8 @@ public final class ParticleTypes { public static final DefaultedRegistryReference COMPOSTER = ParticleTypes.key(ResourceKey.minecraft("composter")); + public static final DefaultedRegistryReference COPPER_FIRE_FLAME = ParticleTypes.key(ResourceKey.minecraft("copper_fire_flame")); + public static final DefaultedRegistryReference CRIMSON_SPORE = ParticleTypes.key(ResourceKey.minecraft("crimson_spore")); public static final DefaultedRegistryReference CRIT = ParticleTypes.key(ResourceKey.minecraft("crit")); @@ -134,6 +138,8 @@ public final class ParticleTypes { public static final DefaultedRegistryReference FALLING_WATER = ParticleTypes.key(ResourceKey.minecraft("falling_water")); + public static final DefaultedRegistryReference FIREFLY = ParticleTypes.key(ResourceKey.minecraft("firefly")); + public static final DefaultedRegistryReference FIREWORK = ParticleTypes.key(ResourceKey.minecraft("firework")); public static final DefaultedRegistryReference FISHING = ParticleTypes.key(ResourceKey.minecraft("fishing")); @@ -186,6 +192,8 @@ public final class ParticleTypes { public static final DefaultedRegistryReference OMINOUS_SPAWNING = ParticleTypes.key(ResourceKey.minecraft("ominous_spawning")); + public static final DefaultedRegistryReference PALE_OAK_LEAVES = ParticleTypes.key(ResourceKey.minecraft("pale_oak_leaves")); + public static final DefaultedRegistryReference POOF = ParticleTypes.key(ResourceKey.minecraft("poof")); public static final DefaultedRegistryReference PORTAL = ParticleTypes.key(ResourceKey.minecraft("portal")); @@ -232,8 +240,12 @@ public final class ParticleTypes { public static final DefaultedRegistryReference SWEEP_ATTACK = ParticleTypes.key(ResourceKey.minecraft("sweep_attack")); + public static final DefaultedRegistryReference TINTED_LEAVES = ParticleTypes.key(ResourceKey.minecraft("tinted_leaves")); + public static final DefaultedRegistryReference TOTEM_OF_UNDYING = ParticleTypes.key(ResourceKey.minecraft("totem_of_undying")); + public static final DefaultedRegistryReference TRAIL = ParticleTypes.key(ResourceKey.minecraft("trail")); + 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")); diff --git a/src/main/java/org/spongepowered/api/effect/potion/PotionEffectType.java b/src/main/java/org/spongepowered/api/effect/potion/PotionEffectType.java index 7179f435d2a..300f888df17 100644 --- a/src/main/java/org/spongepowered/api/effect/potion/PotionEffectType.java +++ b/src/main/java/org/spongepowered/api/effect/potion/PotionEffectType.java @@ -25,14 +25,14 @@ package org.spongepowered.api.effect.potion; import net.kyori.adventure.text.ComponentLike; -import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.tag.Taggable; import org.spongepowered.api.util.annotation.CatalogedBy; /** * Represents a possible type of {@link PotionEffect}. */ @CatalogedBy(PotionEffectTypes.class) -public interface PotionEffectType extends DefaultedRegistryValue, ComponentLike { +public interface PotionEffectType extends Taggable, ComponentLike { /** * Gets whether this potion effect is applied instantly or over time. 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 23c84a4daa0..765c2fcee11 100644 --- a/src/main/java/org/spongepowered/api/effect/potion/PotionEffectTypes.java +++ b/src/main/java/org/spongepowered/api/effect/potion/PotionEffectTypes.java @@ -46,6 +46,8 @@ public final class PotionEffectTypes { public static final DefaultedRegistryReference BLINDNESS = PotionEffectTypes.key(ResourceKey.minecraft("blindness")); + public static final DefaultedRegistryReference BREATH_OF_THE_NAUTILUS = PotionEffectTypes.key(ResourceKey.minecraft("breath_of_the_nautilus")); + public static final DefaultedRegistryReference CONDUIT_POWER = PotionEffectTypes.key(ResourceKey.minecraft("conduit_power")); public static final DefaultedRegistryReference DARKNESS = PotionEffectTypes.key(ResourceKey.minecraft("darkness")); diff --git a/src/main/java/org/spongepowered/api/effect/sound/SoundType.java b/src/main/java/org/spongepowered/api/effect/sound/SoundType.java index 188f0e6af6f..1c3f0af8dce 100644 --- a/src/main/java/org/spongepowered/api/effect/sound/SoundType.java +++ b/src/main/java/org/spongepowered/api/effect/sound/SoundType.java @@ -27,6 +27,7 @@ import net.kyori.adventure.sound.Sound; import org.spongepowered.api.ResourceKeyed; import org.spongepowered.api.Sponge; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.ResourceKeyedBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -34,7 +35,7 @@ * Represents a sound that can be heard on clients. */ @CatalogedBy(SoundTypes.class) -public interface SoundType extends ResourceKeyed, Sound.Type { +public interface SoundType extends DefaultedRegistryValue, ResourceKeyed, Sound.Type { /** * Creates a new {@link Builder} for building SoundTypes. 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 b9576c00540..36513454227 100644 --- a/src/main/java/org/spongepowered/api/effect/sound/SoundTypes.java +++ b/src/main/java/org/spongepowered/api/effect/sound/SoundTypes.java @@ -284,6 +284,10 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_BUBBLE_COLUMN_WHIRLPOOL_INSIDE = SoundTypes.key(ResourceKey.minecraft("block.bubble_column.whirlpool_inside")); + public static final DefaultedRegistryReference BLOCK_CACTUS_FLOWER_BREAK = SoundTypes.key(ResourceKey.minecraft("block.cactus_flower.break")); + + public static final DefaultedRegistryReference BLOCK_CACTUS_FLOWER_PLACE = SoundTypes.key(ResourceKey.minecraft("block.cactus_flower.place")); + public static final DefaultedRegistryReference BLOCK_CAKE_ADD_CANDLE = SoundTypes.key(ResourceKey.minecraft("block.cake.add_candle")); public static final DefaultedRegistryReference BLOCK_CALCITE_BREAK = SoundTypes.key(ResourceKey.minecraft("block.calcite.break")); @@ -468,12 +472,34 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_COPPER_BULB_TURN_ON = SoundTypes.key(ResourceKey.minecraft("block.copper_bulb.turn_on")); + public static final DefaultedRegistryReference BLOCK_COPPER_CHEST_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.copper_chest.close")); + + public static final DefaultedRegistryReference BLOCK_COPPER_CHEST_OPEN = SoundTypes.key(ResourceKey.minecraft("block.copper_chest.open")); + + public static final DefaultedRegistryReference BLOCK_COPPER_CHEST_OXIDIZED_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.copper_chest_oxidized.close")); + + public static final DefaultedRegistryReference BLOCK_COPPER_CHEST_OXIDIZED_OPEN = SoundTypes.key(ResourceKey.minecraft("block.copper_chest_oxidized.open")); + + public static final DefaultedRegistryReference BLOCK_COPPER_CHEST_WEATHERED_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.copper_chest_weathered.close")); + + public static final DefaultedRegistryReference BLOCK_COPPER_CHEST_WEATHERED_OPEN = SoundTypes.key(ResourceKey.minecraft("block.copper_chest_weathered.open")); + public static final DefaultedRegistryReference BLOCK_COPPER_DOOR_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.copper_door.close")); public static final DefaultedRegistryReference BLOCK_COPPER_DOOR_OPEN = SoundTypes.key(ResourceKey.minecraft("block.copper_door.open")); public static final DefaultedRegistryReference BLOCK_COPPER_FALL = SoundTypes.key(ResourceKey.minecraft("block.copper.fall")); + public static final DefaultedRegistryReference BLOCK_COPPER_GOLEM_STATUE_BREAK = SoundTypes.key(ResourceKey.minecraft("block.copper_golem_statue.break")); + + public static final DefaultedRegistryReference BLOCK_COPPER_GOLEM_STATUE_FALL = SoundTypes.key(ResourceKey.minecraft("block.copper_golem_statue.fall")); + + public static final DefaultedRegistryReference BLOCK_COPPER_GOLEM_STATUE_HIT = SoundTypes.key(ResourceKey.minecraft("block.copper_golem_statue.hit")); + + public static final DefaultedRegistryReference BLOCK_COPPER_GOLEM_STATUE_PLACE = SoundTypes.key(ResourceKey.minecraft("block.copper_golem_statue.place")); + + public static final DefaultedRegistryReference BLOCK_COPPER_GOLEM_STATUE_STEP = SoundTypes.key(ResourceKey.minecraft("block.copper_golem_statue.step")); + public static final DefaultedRegistryReference BLOCK_COPPER_GRATE_BREAK = SoundTypes.key(ResourceKey.minecraft("block.copper_grate.break")); public static final DefaultedRegistryReference BLOCK_COPPER_GRATE_FALL = SoundTypes.key(ResourceKey.minecraft("block.copper_grate.fall")); @@ -508,8 +534,26 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_CRAFTER_FAIL = SoundTypes.key(ResourceKey.minecraft("block.crafter.fail")); + public static final DefaultedRegistryReference BLOCK_CREAKING_HEART_BREAK = SoundTypes.key(ResourceKey.minecraft("block.creaking_heart.break")); + + public static final DefaultedRegistryReference BLOCK_CREAKING_HEART_FALL = SoundTypes.key(ResourceKey.minecraft("block.creaking_heart.fall")); + + public static final DefaultedRegistryReference BLOCK_CREAKING_HEART_HIT = SoundTypes.key(ResourceKey.minecraft("block.creaking_heart.hit")); + + public static final DefaultedRegistryReference BLOCK_CREAKING_HEART_HURT = SoundTypes.key(ResourceKey.minecraft("block.creaking_heart.hurt")); + + public static final DefaultedRegistryReference BLOCK_CREAKING_HEART_IDLE = SoundTypes.key(ResourceKey.minecraft("block.creaking_heart.idle")); + + public static final DefaultedRegistryReference BLOCK_CREAKING_HEART_PLACE = SoundTypes.key(ResourceKey.minecraft("block.creaking_heart.place")); + + public static final DefaultedRegistryReference BLOCK_CREAKING_HEART_SPAWN = SoundTypes.key(ResourceKey.minecraft("block.creaking_heart.spawn")); + + public static final DefaultedRegistryReference BLOCK_CREAKING_HEART_STEP = SoundTypes.key(ResourceKey.minecraft("block.creaking_heart.step")); + public static final DefaultedRegistryReference BLOCK_CROP_BREAK = SoundTypes.key(ResourceKey.minecraft("block.crop.break")); + public static final DefaultedRegistryReference BLOCK_DEADBUSH_IDLE = SoundTypes.key(ResourceKey.minecraft("block.deadbush.idle")); + public static final DefaultedRegistryReference BLOCK_DECORATED_POT_BREAK = SoundTypes.key(ResourceKey.minecraft("block.decorated_pot.break")); public static final DefaultedRegistryReference BLOCK_DECORATED_POT_FALL = SoundTypes.key(ResourceKey.minecraft("block.decorated_pot.fall")); @@ -562,6 +606,22 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_DISPENSER_LAUNCH = SoundTypes.key(ResourceKey.minecraft("block.dispenser.launch")); + public static final DefaultedRegistryReference BLOCK_DRIED_GHAST_AMBIENT = SoundTypes.key(ResourceKey.minecraft("block.dried_ghast.ambient")); + + public static final DefaultedRegistryReference BLOCK_DRIED_GHAST_AMBIENT_WATER = SoundTypes.key(ResourceKey.minecraft("block.dried_ghast.ambient_water")); + + public static final DefaultedRegistryReference BLOCK_DRIED_GHAST_BREAK = SoundTypes.key(ResourceKey.minecraft("block.dried_ghast.break")); + + public static final DefaultedRegistryReference BLOCK_DRIED_GHAST_FALL = SoundTypes.key(ResourceKey.minecraft("block.dried_ghast.fall")); + + public static final DefaultedRegistryReference BLOCK_DRIED_GHAST_PLACE = SoundTypes.key(ResourceKey.minecraft("block.dried_ghast.place")); + + public static final DefaultedRegistryReference BLOCK_DRIED_GHAST_PLACE_IN_WATER = SoundTypes.key(ResourceKey.minecraft("block.dried_ghast.place_in_water")); + + public static final DefaultedRegistryReference BLOCK_DRIED_GHAST_STEP = SoundTypes.key(ResourceKey.minecraft("block.dried_ghast.step")); + + public static final DefaultedRegistryReference BLOCK_DRIED_GHAST_TRANSITION = SoundTypes.key(ResourceKey.minecraft("block.dried_ghast.transition")); + public static final DefaultedRegistryReference BLOCK_DRIPSTONE_BLOCK_BREAK = SoundTypes.key(ResourceKey.minecraft("block.dripstone_block.break")); public static final DefaultedRegistryReference BLOCK_DRIPSTONE_BLOCK_FALL = SoundTypes.key(ResourceKey.minecraft("block.dripstone_block.fall")); @@ -572,6 +632,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_DRIPSTONE_BLOCK_STEP = SoundTypes.key(ResourceKey.minecraft("block.dripstone_block.step")); + public static final DefaultedRegistryReference BLOCK_DRY_GRASS_AMBIENT = SoundTypes.key(ResourceKey.minecraft("block.dry_grass.ambient")); + public static final DefaultedRegistryReference BLOCK_ENCHANTMENT_TABLE_USE = SoundTypes.key(ResourceKey.minecraft("block.enchantment_table.use")); public static final DefaultedRegistryReference BLOCK_ENDER_CHEST_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.ender_chest.close")); @@ -584,10 +646,22 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_END_PORTAL_SPAWN = SoundTypes.key(ResourceKey.minecraft("block.end_portal.spawn")); + public static final DefaultedRegistryReference BLOCK_EYEBLOSSOM_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.eyeblossom.close")); + + public static final DefaultedRegistryReference BLOCK_EYEBLOSSOM_CLOSE_LONG = SoundTypes.key(ResourceKey.minecraft("block.eyeblossom.close_long")); + + public static final DefaultedRegistryReference BLOCK_EYEBLOSSOM_IDLE = SoundTypes.key(ResourceKey.minecraft("block.eyeblossom.idle")); + + public static final DefaultedRegistryReference BLOCK_EYEBLOSSOM_OPEN = SoundTypes.key(ResourceKey.minecraft("block.eyeblossom.open")); + + public static final DefaultedRegistryReference BLOCK_EYEBLOSSOM_OPEN_LONG = SoundTypes.key(ResourceKey.minecraft("block.eyeblossom.open_long")); + public static final DefaultedRegistryReference BLOCK_FENCE_GATE_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.fence_gate.close")); public static final DefaultedRegistryReference BLOCK_FENCE_GATE_OPEN = SoundTypes.key(ResourceKey.minecraft("block.fence_gate.open")); + public static final DefaultedRegistryReference BLOCK_FIREFLY_BUSH_IDLE = SoundTypes.key(ResourceKey.minecraft("block.firefly_bush.idle")); + public static final DefaultedRegistryReference BLOCK_FIRE_AMBIENT = SoundTypes.key(ResourceKey.minecraft("block.fire.ambient")); public static final DefaultedRegistryReference BLOCK_FIRE_EXTINGUISH = SoundTypes.key(ResourceKey.minecraft("block.fire.extinguish")); @@ -724,10 +798,20 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_HONEY_BLOCK_STEP = SoundTypes.key(ResourceKey.minecraft("block.honey_block.step")); + public static final DefaultedRegistryReference BLOCK_IRON_BREAK = SoundTypes.key(ResourceKey.minecraft("block.iron.break")); + public static final DefaultedRegistryReference BLOCK_IRON_DOOR_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.iron_door.close")); public static final DefaultedRegistryReference BLOCK_IRON_DOOR_OPEN = SoundTypes.key(ResourceKey.minecraft("block.iron_door.open")); + public static final DefaultedRegistryReference BLOCK_IRON_FALL = SoundTypes.key(ResourceKey.minecraft("block.iron.fall")); + + public static final DefaultedRegistryReference BLOCK_IRON_HIT = SoundTypes.key(ResourceKey.minecraft("block.iron.hit")); + + public static final DefaultedRegistryReference BLOCK_IRON_PLACE = SoundTypes.key(ResourceKey.minecraft("block.iron.place")); + + public static final DefaultedRegistryReference BLOCK_IRON_STEP = SoundTypes.key(ResourceKey.minecraft("block.iron.step")); + public static final DefaultedRegistryReference BLOCK_IRON_TRAPDOOR_CLOSE = SoundTypes.key(ResourceKey.minecraft("block.iron_trapdoor.close")); public static final DefaultedRegistryReference BLOCK_IRON_TRAPDOOR_OPEN = SoundTypes.key(ResourceKey.minecraft("block.iron_trapdoor.open")); @@ -762,6 +846,16 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_LAVA_POP = SoundTypes.key(ResourceKey.minecraft("block.lava.pop")); + public static final DefaultedRegistryReference BLOCK_LEAF_LITTER_BREAK = SoundTypes.key(ResourceKey.minecraft("block.leaf_litter.break")); + + public static final DefaultedRegistryReference BLOCK_LEAF_LITTER_FALL = SoundTypes.key(ResourceKey.minecraft("block.leaf_litter.fall")); + + public static final DefaultedRegistryReference BLOCK_LEAF_LITTER_HIT = SoundTypes.key(ResourceKey.minecraft("block.leaf_litter.hit")); + + public static final DefaultedRegistryReference BLOCK_LEAF_LITTER_PLACE = SoundTypes.key(ResourceKey.minecraft("block.leaf_litter.place")); + + public static final DefaultedRegistryReference BLOCK_LEAF_LITTER_STEP = SoundTypes.key(ResourceKey.minecraft("block.leaf_litter.step")); + public static final DefaultedRegistryReference BLOCK_LEVER_CLICK = SoundTypes.key(ResourceKey.minecraft("block.lever.click")); public static final DefaultedRegistryReference BLOCK_LILY_PAD_PLACE = SoundTypes.key(ResourceKey.minecraft("block.lily_pad.place")); @@ -1020,6 +1114,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_PACKED_MUD_STEP = SoundTypes.key(ResourceKey.minecraft("block.packed_mud.step")); + public static final DefaultedRegistryReference BLOCK_PALE_HANGING_MOSS_IDLE = SoundTypes.key(ResourceKey.minecraft("block.pale_hanging_moss.idle")); + public static final DefaultedRegistryReference BLOCK_PINK_PETALS_BREAK = SoundTypes.key(ResourceKey.minecraft("block.pink_petals.break")); public static final DefaultedRegistryReference BLOCK_PINK_PETALS_FALL = SoundTypes.key(ResourceKey.minecraft("block.pink_petals.fall")); @@ -1094,6 +1190,24 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_REDSTONE_TORCH_BURNOUT = SoundTypes.key(ResourceKey.minecraft("block.redstone_torch.burnout")); + public static final DefaultedRegistryReference BLOCK_RESIN_BREAK = SoundTypes.key(ResourceKey.minecraft("block.resin.break")); + + public static final DefaultedRegistryReference BLOCK_RESIN_BRICKS_BREAK = SoundTypes.key(ResourceKey.minecraft("block.resin_bricks.break")); + + public static final DefaultedRegistryReference BLOCK_RESIN_BRICKS_FALL = SoundTypes.key(ResourceKey.minecraft("block.resin_bricks.fall")); + + public static final DefaultedRegistryReference BLOCK_RESIN_BRICKS_HIT = SoundTypes.key(ResourceKey.minecraft("block.resin_bricks.hit")); + + public static final DefaultedRegistryReference BLOCK_RESIN_BRICKS_PLACE = SoundTypes.key(ResourceKey.minecraft("block.resin_bricks.place")); + + public static final DefaultedRegistryReference BLOCK_RESIN_BRICKS_STEP = SoundTypes.key(ResourceKey.minecraft("block.resin_bricks.step")); + + public static final DefaultedRegistryReference BLOCK_RESIN_FALL = SoundTypes.key(ResourceKey.minecraft("block.resin.fall")); + + public static final DefaultedRegistryReference BLOCK_RESIN_PLACE = SoundTypes.key(ResourceKey.minecraft("block.resin.place")); + + public static final DefaultedRegistryReference BLOCK_RESIN_STEP = SoundTypes.key(ResourceKey.minecraft("block.resin.step")); + public static final DefaultedRegistryReference BLOCK_RESPAWN_ANCHOR_AMBIENT = SoundTypes.key(ResourceKey.minecraft("block.respawn_anchor.ambient")); public static final DefaultedRegistryReference BLOCK_RESPAWN_ANCHOR_CHARGE = SoundTypes.key(ResourceKey.minecraft("block.respawn_anchor.charge")); @@ -1128,6 +1242,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_SAND_HIT = SoundTypes.key(ResourceKey.minecraft("block.sand.hit")); + public static final DefaultedRegistryReference BLOCK_SAND_IDLE = SoundTypes.key(ResourceKey.minecraft("block.sand.idle")); + public static final DefaultedRegistryReference BLOCK_SAND_PLACE = SoundTypes.key(ResourceKey.minecraft("block.sand.place")); public static final DefaultedRegistryReference BLOCK_SAND_STEP = SoundTypes.key(ResourceKey.minecraft("block.sand.step")); @@ -1204,6 +1320,28 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_SCULK_VEIN_STEP = SoundTypes.key(ResourceKey.minecraft("block.sculk_vein.step")); + public static final DefaultedRegistryReference BLOCK_SHELF_ACTIVATE = SoundTypes.key(ResourceKey.minecraft("block.shelf.activate")); + + public static final DefaultedRegistryReference BLOCK_SHELF_BREAK = SoundTypes.key(ResourceKey.minecraft("block.shelf.break")); + + public static final DefaultedRegistryReference BLOCK_SHELF_DEACTIVATE = SoundTypes.key(ResourceKey.minecraft("block.shelf.deactivate")); + + public static final DefaultedRegistryReference BLOCK_SHELF_FALL = SoundTypes.key(ResourceKey.minecraft("block.shelf.fall")); + + public static final DefaultedRegistryReference BLOCK_SHELF_HIT = SoundTypes.key(ResourceKey.minecraft("block.shelf.hit")); + + public static final DefaultedRegistryReference BLOCK_SHELF_MULTI_SWAP = SoundTypes.key(ResourceKey.minecraft("block.shelf.multi_swap")); + + public static final DefaultedRegistryReference BLOCK_SHELF_PLACE = SoundTypes.key(ResourceKey.minecraft("block.shelf.place")); + + public static final DefaultedRegistryReference BLOCK_SHELF_PLACE_ITEM = SoundTypes.key(ResourceKey.minecraft("block.shelf.place_item")); + + public static final DefaultedRegistryReference BLOCK_SHELF_SINGLE_SWAP = SoundTypes.key(ResourceKey.minecraft("block.shelf.single_swap")); + + public static final DefaultedRegistryReference BLOCK_SHELF_STEP = SoundTypes.key(ResourceKey.minecraft("block.shelf.step")); + + public static final DefaultedRegistryReference BLOCK_SHELF_TAKE_ITEM = SoundTypes.key(ResourceKey.minecraft("block.shelf.take_item")); + public static final DefaultedRegistryReference BLOCK_SHROOMLIGHT_BREAK = SoundTypes.key(ResourceKey.minecraft("block.shroomlight.break")); public static final DefaultedRegistryReference BLOCK_SHROOMLIGHT_FALL = SoundTypes.key(ResourceKey.minecraft("block.shroomlight.fall")); @@ -1284,6 +1422,16 @@ public final class SoundTypes { public static final DefaultedRegistryReference BLOCK_SOUL_SOIL_STEP = SoundTypes.key(ResourceKey.minecraft("block.soul_soil.step")); + public static final DefaultedRegistryReference BLOCK_SPAWNER_BREAK = SoundTypes.key(ResourceKey.minecraft("block.spawner.break")); + + public static final DefaultedRegistryReference BLOCK_SPAWNER_FALL = SoundTypes.key(ResourceKey.minecraft("block.spawner.fall")); + + public static final DefaultedRegistryReference BLOCK_SPAWNER_HIT = SoundTypes.key(ResourceKey.minecraft("block.spawner.hit")); + + public static final DefaultedRegistryReference BLOCK_SPAWNER_PLACE = SoundTypes.key(ResourceKey.minecraft("block.spawner.place")); + + public static final DefaultedRegistryReference BLOCK_SPAWNER_STEP = SoundTypes.key(ResourceKey.minecraft("block.spawner.step")); + public static final DefaultedRegistryReference BLOCK_SPONGE_ABSORB = SoundTypes.key(ResourceKey.minecraft("block.sponge.absorb")); public static final DefaultedRegistryReference BLOCK_SPONGE_BREAK = SoundTypes.key(ResourceKey.minecraft("block.sponge.break")); @@ -1608,6 +1756,22 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_AXOLOTL_SWIM = SoundTypes.key(ResourceKey.minecraft("entity.axolotl.swim")); + public static final DefaultedRegistryReference ENTITY_BABY_NAUTILUS_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.baby_nautilus.ambient")); + + public static final DefaultedRegistryReference ENTITY_BABY_NAUTILUS_AMBIENT_LAND = SoundTypes.key(ResourceKey.minecraft("entity.baby_nautilus.ambient_land")); + + public static final DefaultedRegistryReference ENTITY_BABY_NAUTILUS_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.baby_nautilus.death")); + + public static final DefaultedRegistryReference ENTITY_BABY_NAUTILUS_DEATH_LAND = SoundTypes.key(ResourceKey.minecraft("entity.baby_nautilus.death_land")); + + public static final DefaultedRegistryReference ENTITY_BABY_NAUTILUS_EAT = SoundTypes.key(ResourceKey.minecraft("entity.baby_nautilus.eat")); + + public static final DefaultedRegistryReference ENTITY_BABY_NAUTILUS_HURT = SoundTypes.key(ResourceKey.minecraft("entity.baby_nautilus.hurt")); + + public static final DefaultedRegistryReference ENTITY_BABY_NAUTILUS_HURT_LAND = SoundTypes.key(ResourceKey.minecraft("entity.baby_nautilus.hurt_land")); + + public static final DefaultedRegistryReference ENTITY_BABY_NAUTILUS_SWIM = SoundTypes.key(ResourceKey.minecraft("entity.baby_nautilus.swim")); + public static final DefaultedRegistryReference ENTITY_BAT_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.bat.ambient")); public static final DefaultedRegistryReference ENTITY_BAT_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.bat.death")); @@ -1692,6 +1856,28 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_CAMEL_HURT = SoundTypes.key(ResourceKey.minecraft("entity.camel.hurt")); + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.ambient")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_DASH = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.dash")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_DASH_READY = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.dash_ready")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.death")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_EAT = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.eat")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_HURT = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.hurt")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_SADDLE = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.saddle")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_SIT = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.sit")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_STAND = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.stand")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_STEP = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.step")); + + public static final DefaultedRegistryReference ENTITY_CAMEL_HUSK_STEP_SAND = SoundTypes.key(ResourceKey.minecraft("entity.camel_husk.step_sand")); + public static final DefaultedRegistryReference ENTITY_CAMEL_SADDLE = SoundTypes.key(ResourceKey.minecraft("entity.camel.saddle")); public static final DefaultedRegistryReference ENTITY_CAMEL_SIT = SoundTypes.key(ResourceKey.minecraft("entity.camel.sit")); @@ -1738,6 +1924,44 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_COD_HURT = SoundTypes.key(ResourceKey.minecraft("entity.cod.hurt")); + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_BECOME_STATUE = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_become_statue")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.death")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_HURT = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.hurt")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_ITEM_DROP = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.item_drop")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_ITEM_NO_DROP = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.item_no_drop")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_NO_ITEM_GET = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.no_item_get")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_NO_ITEM_NO_GET = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.no_item_no_get")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_OXIDIZED_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_oxidized.death")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_OXIDIZED_HURT = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_oxidized.hurt")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_OXIDIZED_SPIN = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_oxidized.spin")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_OXIDIZED_STEP = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_oxidized.step")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_SHEAR = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.shear")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_SPAWN = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.spawn")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_SPIN = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.spin")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_STEP = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem.step")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_WEATHERED_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_weathered.death")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_WEATHERED_HURT = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_weathered.hurt")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_WEATHERED_SPIN = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_weathered.spin")); + + public static final DefaultedRegistryReference ENTITY_COPPER_GOLEM_WEATHERED_STEP = SoundTypes.key(ResourceKey.minecraft("entity.copper_golem_weathered.step")); + public static final DefaultedRegistryReference ENTITY_COW_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.cow.ambient")); public static final DefaultedRegistryReference ENTITY_COW_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.cow.death")); @@ -1748,6 +1972,28 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_COW_STEP = SoundTypes.key(ResourceKey.minecraft("entity.cow.step")); + public static final DefaultedRegistryReference ENTITY_CREAKING_ACTIVATE = SoundTypes.key(ResourceKey.minecraft("entity.creaking.activate")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.creaking.ambient")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_ATTACK = SoundTypes.key(ResourceKey.minecraft("entity.creaking.attack")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_DEACTIVATE = SoundTypes.key(ResourceKey.minecraft("entity.creaking.deactivate")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.creaking.death")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_FREEZE = SoundTypes.key(ResourceKey.minecraft("entity.creaking.freeze")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_SPAWN = SoundTypes.key(ResourceKey.minecraft("entity.creaking.spawn")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_STEP = SoundTypes.key(ResourceKey.minecraft("entity.creaking.step")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_SWAY = SoundTypes.key(ResourceKey.minecraft("entity.creaking.sway")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_TWITCH = SoundTypes.key(ResourceKey.minecraft("entity.creaking.twitch")); + + public static final DefaultedRegistryReference ENTITY_CREAKING_UNFREEZE = SoundTypes.key(ResourceKey.minecraft("entity.creaking.unfreeze")); + public static final DefaultedRegistryReference ENTITY_CREEPER_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.creeper.death")); public static final DefaultedRegistryReference ENTITY_CREEPER_HURT = SoundTypes.key(ResourceKey.minecraft("entity.creeper.hurt")); @@ -1970,6 +2216,14 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_GENERIC_SWIM = SoundTypes.key(ResourceKey.minecraft("entity.generic.swim")); + public static final DefaultedRegistryReference ENTITY_GHASTLING_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.ghastling.ambient")); + + public static final DefaultedRegistryReference ENTITY_GHASTLING_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.ghastling.death")); + + public static final DefaultedRegistryReference ENTITY_GHASTLING_HURT = SoundTypes.key(ResourceKey.minecraft("entity.ghastling.hurt")); + + public static final DefaultedRegistryReference ENTITY_GHASTLING_SPAWN = SoundTypes.key(ResourceKey.minecraft("entity.ghastling.spawn")); + 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")); @@ -2024,8 +2278,6 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_GOAT_SCREAMING_EAT = SoundTypes.key(ResourceKey.minecraft("entity.goat.screaming.eat")); - public static final DefaultedRegistryReference ENTITY_GOAT_SCREAMING_HORN_BREAK = SoundTypes.key(ResourceKey.minecraft("entity.goat.screaming.horn_break")); - public static final DefaultedRegistryReference ENTITY_GOAT_SCREAMING_HURT = SoundTypes.key(ResourceKey.minecraft("entity.goat.screaming.hurt")); public static final DefaultedRegistryReference ENTITY_GOAT_SCREAMING_LONG_JUMP = SoundTypes.key(ResourceKey.minecraft("entity.goat.screaming.long_jump")); @@ -2054,6 +2306,22 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_GUARDIAN_HURT_LAND = SoundTypes.key(ResourceKey.minecraft("entity.guardian.hurt_land")); + public static final DefaultedRegistryReference ENTITY_HAPPY_GHAST_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.happy_ghast.ambient")); + + public static final DefaultedRegistryReference ENTITY_HAPPY_GHAST_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.happy_ghast.death")); + + public static final DefaultedRegistryReference ENTITY_HAPPY_GHAST_EQUIP = SoundTypes.key(ResourceKey.minecraft("entity.happy_ghast.equip")); + + public static final DefaultedRegistryReference ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_DOWN = SoundTypes.key(ResourceKey.minecraft("entity.happy_ghast.harness_goggles_down")); + + public static final DefaultedRegistryReference ENTITY_HAPPY_GHAST_HARNESS_GOGGLES_UP = SoundTypes.key(ResourceKey.minecraft("entity.happy_ghast.harness_goggles_up")); + + public static final DefaultedRegistryReference ENTITY_HAPPY_GHAST_HURT = SoundTypes.key(ResourceKey.minecraft("entity.happy_ghast.hurt")); + + public static final DefaultedRegistryReference ENTITY_HAPPY_GHAST_RIDING = SoundTypes.key(ResourceKey.minecraft("entity.happy_ghast.riding")); + + public static final DefaultedRegistryReference ENTITY_HAPPY_GHAST_UNEQUIP = SoundTypes.key(ResourceKey.minecraft("entity.happy_ghast.unequip")); + public static final DefaultedRegistryReference ENTITY_HOGLIN_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.hoglin.ambient")); public static final DefaultedRegistryReference ENTITY_HOGLIN_ANGRY = SoundTypes.key(ResourceKey.minecraft("entity.hoglin.angry")); @@ -2158,10 +2426,6 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_ITEM_PICKUP = SoundTypes.key(ResourceKey.minecraft("entity.item.pickup")); - public static final DefaultedRegistryReference ENTITY_LEASH_KNOT_BREAK = SoundTypes.key(ResourceKey.minecraft("entity.leash_knot.break")); - - public static final DefaultedRegistryReference ENTITY_LEASH_KNOT_PLACE = SoundTypes.key(ResourceKey.minecraft("entity.leash_knot.place")); - public static final DefaultedRegistryReference ENTITY_LIGHTNING_BOLT_IMPACT = SoundTypes.key(ResourceKey.minecraft("entity.lightning_bolt.impact")); public static final DefaultedRegistryReference ENTITY_LIGHTNING_BOLT_THUNDER = SoundTypes.key(ResourceKey.minecraft("entity.lightning_bolt.thunder")); @@ -2230,6 +2494,32 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_MULE_JUMP = SoundTypes.key(ResourceKey.minecraft("entity.mule.jump")); + public static final DefaultedRegistryReference ENTITY_NAUTILUS_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.ambient")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_AMBIENT_LAND = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.ambient_land")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_DASH = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.dash")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_DASH_LAND = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.dash_land")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_DASH_READY = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.dash_ready")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_DASH_READY_LAND = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.dash_ready_land")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.death")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_DEATH_LAND = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.death_land")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_EAT = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.eat")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_HURT = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.hurt")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_HURT_LAND = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.hurt_land")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_RIDING = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.riding")); + + public static final DefaultedRegistryReference ENTITY_NAUTILUS_SWIM = SoundTypes.key(ResourceKey.minecraft("entity.nautilus.swim")); + 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")); @@ -2262,6 +2552,14 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_PANDA_WORRIED_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.panda.worried_ambient")); + public static final DefaultedRegistryReference ENTITY_PARCHED_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.parched.ambient")); + + public static final DefaultedRegistryReference ENTITY_PARCHED_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.parched.death")); + + public static final DefaultedRegistryReference ENTITY_PARCHED_HURT = SoundTypes.key(ResourceKey.minecraft("entity.parched.hurt")); + + public static final DefaultedRegistryReference ENTITY_PARCHED_STEP = SoundTypes.key(ResourceKey.minecraft("entity.parched.step")); + public static final DefaultedRegistryReference ENTITY_PARROT_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.parrot.ambient")); public static final DefaultedRegistryReference ENTITY_PARROT_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.parrot.death")); @@ -2278,6 +2576,10 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_BREEZE = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.breeze")); + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_CAMEL_HUSK = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.camel_husk")); + + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_CREAKING = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.creaking")); + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_CREEPER = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.creeper")); public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_DROWNED = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.drowned")); @@ -2302,6 +2604,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_MAGMA_CUBE = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.magma_cube")); + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_PARCHED = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.parched")); + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_PHANTOM = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.phantom")); public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_PIGLIN = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.piglin")); @@ -2340,6 +2644,10 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_ZOMBIE = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.zombie")); + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_ZOMBIE_HORSE = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.zombie_horse")); + + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_ZOMBIE_NAUTILUS = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.zombie_nautilus")); + public static final DefaultedRegistryReference ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER = SoundTypes.key(ResourceKey.minecraft("entity.parrot.imitate.zombie_villager")); public static final DefaultedRegistryReference ENTITY_PARROT_STEP = SoundTypes.key(ResourceKey.minecraft("entity.parrot.step")); @@ -2460,8 +2768,6 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_POLAR_BEAR_WARNING = SoundTypes.key(ResourceKey.minecraft("entity.polar_bear.warning")); - public static final DefaultedRegistryReference ENTITY_PUFFER_FISH_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.puffer_fish.ambient")); - public static final DefaultedRegistryReference ENTITY_PUFFER_FISH_BLOW_OUT = SoundTypes.key(ResourceKey.minecraft("entity.puffer_fish.blow_out")); public static final DefaultedRegistryReference ENTITY_PUFFER_FISH_BLOW_UP = SoundTypes.key(ResourceKey.minecraft("entity.puffer_fish.blow_up")); @@ -2870,16 +3176,86 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_WOLF_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.wolf.ambient")); + public static final DefaultedRegistryReference ENTITY_WOLF_ANGRY_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_angry.ambient")); + + public static final DefaultedRegistryReference ENTITY_WOLF_ANGRY_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.wolf_angry.death")); + + public static final DefaultedRegistryReference ENTITY_WOLF_ANGRY_GROWL = SoundTypes.key(ResourceKey.minecraft("entity.wolf_angry.growl")); + + public static final DefaultedRegistryReference ENTITY_WOLF_ANGRY_HURT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_angry.hurt")); + + public static final DefaultedRegistryReference ENTITY_WOLF_ANGRY_PANT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_angry.pant")); + + public static final DefaultedRegistryReference ENTITY_WOLF_ANGRY_WHINE = SoundTypes.key(ResourceKey.minecraft("entity.wolf_angry.whine")); + + public static final DefaultedRegistryReference ENTITY_WOLF_BIG_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_big.ambient")); + + public static final DefaultedRegistryReference ENTITY_WOLF_BIG_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.wolf_big.death")); + + public static final DefaultedRegistryReference ENTITY_WOLF_BIG_GROWL = SoundTypes.key(ResourceKey.minecraft("entity.wolf_big.growl")); + + public static final DefaultedRegistryReference ENTITY_WOLF_BIG_HURT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_big.hurt")); + + public static final DefaultedRegistryReference ENTITY_WOLF_BIG_PANT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_big.pant")); + + public static final DefaultedRegistryReference ENTITY_WOLF_BIG_WHINE = SoundTypes.key(ResourceKey.minecraft("entity.wolf_big.whine")); + + public static final DefaultedRegistryReference ENTITY_WOLF_CUTE_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_cute.ambient")); + + public static final DefaultedRegistryReference ENTITY_WOLF_CUTE_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.wolf_cute.death")); + + public static final DefaultedRegistryReference ENTITY_WOLF_CUTE_GROWL = SoundTypes.key(ResourceKey.minecraft("entity.wolf_cute.growl")); + + public static final DefaultedRegistryReference ENTITY_WOLF_CUTE_HURT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_cute.hurt")); + + public static final DefaultedRegistryReference ENTITY_WOLF_CUTE_PANT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_cute.pant")); + + public static final DefaultedRegistryReference ENTITY_WOLF_CUTE_WHINE = SoundTypes.key(ResourceKey.minecraft("entity.wolf_cute.whine")); + public static final DefaultedRegistryReference ENTITY_WOLF_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.wolf.death")); public static final DefaultedRegistryReference ENTITY_WOLF_GROWL = SoundTypes.key(ResourceKey.minecraft("entity.wolf.growl")); - public static final DefaultedRegistryReference ENTITY_WOLF_HOWL = SoundTypes.key(ResourceKey.minecraft("entity.wolf.howl")); + public static final DefaultedRegistryReference ENTITY_WOLF_GRUMPY_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_grumpy.ambient")); + + public static final DefaultedRegistryReference ENTITY_WOLF_GRUMPY_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.wolf_grumpy.death")); + + public static final DefaultedRegistryReference ENTITY_WOLF_GRUMPY_GROWL = SoundTypes.key(ResourceKey.minecraft("entity.wolf_grumpy.growl")); + + public static final DefaultedRegistryReference ENTITY_WOLF_GRUMPY_HURT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_grumpy.hurt")); + + public static final DefaultedRegistryReference ENTITY_WOLF_GRUMPY_PANT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_grumpy.pant")); + + public static final DefaultedRegistryReference ENTITY_WOLF_GRUMPY_WHINE = SoundTypes.key(ResourceKey.minecraft("entity.wolf_grumpy.whine")); public static final DefaultedRegistryReference ENTITY_WOLF_HURT = SoundTypes.key(ResourceKey.minecraft("entity.wolf.hurt")); public static final DefaultedRegistryReference ENTITY_WOLF_PANT = SoundTypes.key(ResourceKey.minecraft("entity.wolf.pant")); + public static final DefaultedRegistryReference ENTITY_WOLF_PUGLIN_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_puglin.ambient")); + + public static final DefaultedRegistryReference ENTITY_WOLF_PUGLIN_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.wolf_puglin.death")); + + public static final DefaultedRegistryReference ENTITY_WOLF_PUGLIN_GROWL = SoundTypes.key(ResourceKey.minecraft("entity.wolf_puglin.growl")); + + public static final DefaultedRegistryReference ENTITY_WOLF_PUGLIN_HURT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_puglin.hurt")); + + public static final DefaultedRegistryReference ENTITY_WOLF_PUGLIN_PANT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_puglin.pant")); + + public static final DefaultedRegistryReference ENTITY_WOLF_PUGLIN_WHINE = SoundTypes.key(ResourceKey.minecraft("entity.wolf_puglin.whine")); + + public static final DefaultedRegistryReference ENTITY_WOLF_SAD_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_sad.ambient")); + + public static final DefaultedRegistryReference ENTITY_WOLF_SAD_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.wolf_sad.death")); + + public static final DefaultedRegistryReference ENTITY_WOLF_SAD_GROWL = SoundTypes.key(ResourceKey.minecraft("entity.wolf_sad.growl")); + + public static final DefaultedRegistryReference ENTITY_WOLF_SAD_HURT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_sad.hurt")); + + public static final DefaultedRegistryReference ENTITY_WOLF_SAD_PANT = SoundTypes.key(ResourceKey.minecraft("entity.wolf_sad.pant")); + + public static final DefaultedRegistryReference ENTITY_WOLF_SAD_WHINE = SoundTypes.key(ResourceKey.minecraft("entity.wolf_sad.whine")); + public static final DefaultedRegistryReference ENTITY_WOLF_SHAKE = SoundTypes.key(ResourceKey.minecraft("entity.wolf.shake")); public static final DefaultedRegistryReference ENTITY_WOLF_STEP = SoundTypes.key(ResourceKey.minecraft("entity.wolf.step")); @@ -2914,14 +3290,42 @@ public final class SoundTypes { public static final DefaultedRegistryReference ENTITY_ZOMBIE_HORSE_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.zombie_horse.ambient")); + public static final DefaultedRegistryReference ENTITY_ZOMBIE_HORSE_ANGRY = SoundTypes.key(ResourceKey.minecraft("entity.zombie_horse.angry")); + public static final DefaultedRegistryReference ENTITY_ZOMBIE_HORSE_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.zombie_horse.death")); + public static final DefaultedRegistryReference ENTITY_ZOMBIE_HORSE_EAT = SoundTypes.key(ResourceKey.minecraft("entity.zombie_horse.eat")); + public static final DefaultedRegistryReference ENTITY_ZOMBIE_HORSE_HURT = SoundTypes.key(ResourceKey.minecraft("entity.zombie_horse.hurt")); public static final DefaultedRegistryReference ENTITY_ZOMBIE_HURT = SoundTypes.key(ResourceKey.minecraft("entity.zombie.hurt")); public static final DefaultedRegistryReference ENTITY_ZOMBIE_INFECT = SoundTypes.key(ResourceKey.minecraft("entity.zombie.infect")); + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.ambient")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_AMBIENT_LAND = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.ambient_land")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_DASH = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.dash")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_DASH_LAND = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.dash_land")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_DASH_READY = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.dash_ready")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_DASH_READY_LAND = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.dash_ready_land")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_DEATH = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.death")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_DEATH_LAND = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.death_land")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_EAT = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.eat")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_HURT = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.hurt")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_HURT_LAND = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.hurt_land")); + + public static final DefaultedRegistryReference ENTITY_ZOMBIE_NAUTILUS_SWIM = SoundTypes.key(ResourceKey.minecraft("entity.zombie_nautilus.swim")); + public static final DefaultedRegistryReference ENTITY_ZOMBIE_STEP = SoundTypes.key(ResourceKey.minecraft("entity.zombie.step")); public static final DefaultedRegistryReference ENTITY_ZOMBIE_VILLAGER_AMBIENT = SoundTypes.key(ResourceKey.minecraft("entity.zombie_villager.ambient")); @@ -2956,6 +3360,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_CHAIN = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_chain")); + public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_COPPER = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_copper")); + public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_DIAMOND = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_diamond")); public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_ELYTRA = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_elytra")); @@ -2968,12 +3374,16 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_LEATHER = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_leather")); + public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_NAUTILUS = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_nautilus")); + public static final DefaultedRegistryReference ITEM_ARMOR_EQUIP_NETHERITE = SoundTypes.key(ResourceKey.minecraft("item.armor.equip_netherite")); 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_NAUTILUS = SoundTypes.key(ResourceKey.minecraft("item.armor.unequip_nautilus")); + 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")); @@ -3032,6 +3442,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_BUNDLE_INSERT = SoundTypes.key(ResourceKey.minecraft("item.bundle.insert")); + public static final DefaultedRegistryReference ITEM_BUNDLE_INSERT_FAIL = SoundTypes.key(ResourceKey.minecraft("item.bundle.insert_fail")); + public static final DefaultedRegistryReference ITEM_BUNDLE_REMOVE_ONE = SoundTypes.key(ResourceKey.minecraft("item.bundle.remove_one")); public static final DefaultedRegistryReference ITEM_CHORUS_FRUIT_TELEPORT = SoundTypes.key(ResourceKey.minecraft("item.chorus_fruit.teleport")); @@ -3064,8 +3476,6 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_GLOW_INK_SAC_USE = SoundTypes.key(ResourceKey.minecraft("item.glow_ink_sac.use")); - public static final DefaultedRegistryReference ITEM_GOAT_HORN_PLAY = SoundTypes.key(ResourceKey.minecraft("item.goat_horn.play")); - public static final DefaultedRegistryReference ITEM_GOAT_HORN_SOUND_0 = SoundTypes.key(ResourceKey.minecraft("item.goat_horn.sound.0")); public static final DefaultedRegistryReference ITEM_GOAT_HORN_SOUND_1 = SoundTypes.key(ResourceKey.minecraft("item.goat_horn.sound.1")); @@ -3088,8 +3498,18 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_HONEY_BOTTLE_DRINK = SoundTypes.key(ResourceKey.minecraft("item.honey_bottle.drink")); + public static final DefaultedRegistryReference ITEM_HORSE_ARMOR_UNEQUIP = SoundTypes.key(ResourceKey.minecraft("item.horse_armor.unequip")); + public static final DefaultedRegistryReference ITEM_INK_SAC_USE = SoundTypes.key(ResourceKey.minecraft("item.ink_sac.use")); + public static final DefaultedRegistryReference ITEM_LEAD_BREAK = SoundTypes.key(ResourceKey.minecraft("item.lead.break")); + + public static final DefaultedRegistryReference ITEM_LEAD_TIED = SoundTypes.key(ResourceKey.minecraft("item.lead.tied")); + + public static final DefaultedRegistryReference ITEM_LEAD_UNTIED = SoundTypes.key(ResourceKey.minecraft("item.lead.untied")); + + public static final DefaultedRegistryReference ITEM_LLAMA_CARPET_UNEQUIP = SoundTypes.key(ResourceKey.minecraft("item.llama_carpet.unequip")); + 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")); @@ -3098,16 +3518,42 @@ public final class SoundTypes { public static final DefaultedRegistryReference ITEM_MACE_SMASH_GROUND_HEAVY = SoundTypes.key(ResourceKey.minecraft("item.mace.smash_ground_heavy")); + public static final DefaultedRegistryReference ITEM_NAUTILUS_SADDLE_EQUIP = SoundTypes.key(ResourceKey.minecraft("item.nautilus_saddle_equip")); + + public static final DefaultedRegistryReference ITEM_NAUTILUS_SADDLE_UNDERWATER_EQUIP = SoundTypes.key(ResourceKey.minecraft("item.nautilus_saddle_underwater_equip")); + 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_SADDLE_UNEQUIP = SoundTypes.key(ResourceKey.minecraft("item.saddle.unequip")); + + public static final DefaultedRegistryReference ITEM_SHEARS_SNIP = SoundTypes.key(ResourceKey.minecraft("item.shears.snip")); + 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")); public static final DefaultedRegistryReference ITEM_SHOVEL_FLATTEN = SoundTypes.key(ResourceKey.minecraft("item.shovel.flatten")); + public static final DefaultedRegistryReference ITEM_SPEAR_ATTACK = SoundTypes.key(ResourceKey.minecraft("item.spear.attack")); + + public static final DefaultedRegistryReference ITEM_SPEAR_HIT = SoundTypes.key(ResourceKey.minecraft("item.spear.hit")); + + public static final DefaultedRegistryReference ITEM_SPEAR_LUNGE_1 = SoundTypes.key(ResourceKey.minecraft("item.spear.lunge_1")); + + public static final DefaultedRegistryReference ITEM_SPEAR_LUNGE_2 = SoundTypes.key(ResourceKey.minecraft("item.spear.lunge_2")); + + public static final DefaultedRegistryReference ITEM_SPEAR_LUNGE_3 = SoundTypes.key(ResourceKey.minecraft("item.spear.lunge_3")); + + public static final DefaultedRegistryReference ITEM_SPEAR_USE = SoundTypes.key(ResourceKey.minecraft("item.spear.use")); + + public static final DefaultedRegistryReference ITEM_SPEAR_WOOD_ATTACK = SoundTypes.key(ResourceKey.minecraft("item.spear_wood.attack")); + + public static final DefaultedRegistryReference ITEM_SPEAR_WOOD_HIT = SoundTypes.key(ResourceKey.minecraft("item.spear_wood.hit")); + + public static final DefaultedRegistryReference ITEM_SPEAR_WOOD_USE = SoundTypes.key(ResourceKey.minecraft("item.spear_wood.use")); + public static final DefaultedRegistryReference ITEM_SPYGLASS_STOP_USING = SoundTypes.key(ResourceKey.minecraft("item.spyglass.stop_using")); public static final DefaultedRegistryReference ITEM_SPYGLASS_USE = SoundTypes.key(ResourceKey.minecraft("item.spyglass.use")); @@ -3160,6 +3606,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference MUSIC_DISC_FAR = SoundTypes.key(ResourceKey.minecraft("music_disc.far")); + public static final DefaultedRegistryReference MUSIC_DISC_LAVA_CHICKEN = SoundTypes.key(ResourceKey.minecraft("music_disc.lava_chicken")); + public static final DefaultedRegistryReference MUSIC_DISC_MALL = SoundTypes.key(ResourceKey.minecraft("music_disc.mall")); public static final DefaultedRegistryReference MUSIC_DISC_MELLOHI = SoundTypes.key(ResourceKey.minecraft("music_disc.mellohi")); @@ -3176,6 +3624,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference MUSIC_DISC_STRAD = SoundTypes.key(ResourceKey.minecraft("music_disc.strad")); + public static final DefaultedRegistryReference MUSIC_DISC_TEARS = SoundTypes.key(ResourceKey.minecraft("music_disc.tears")); + public static final DefaultedRegistryReference MUSIC_DISC_WAIT = SoundTypes.key(ResourceKey.minecraft("music_disc.wait")); public static final DefaultedRegistryReference MUSIC_DISC_WARD = SoundTypes.key(ResourceKey.minecraft("music_disc.ward")); @@ -3244,6 +3694,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference UI_CARTOGRAPHY_TABLE_TAKE_RESULT = SoundTypes.key(ResourceKey.minecraft("ui.cartography_table.take_result")); + public static final DefaultedRegistryReference UI_HUD_BUBBLE_POP = SoundTypes.key(ResourceKey.minecraft("ui.hud.bubble_pop")); + public static final DefaultedRegistryReference UI_LOOM_SELECT_PATTERN = SoundTypes.key(ResourceKey.minecraft("ui.loom.select_pattern")); public static final DefaultedRegistryReference UI_LOOM_TAKE_RESULT = SoundTypes.key(ResourceKey.minecraft("ui.loom.take_result")); @@ -3258,6 +3710,8 @@ public final class SoundTypes { public static final DefaultedRegistryReference UI_TOAST_OUT = SoundTypes.key(ResourceKey.minecraft("ui.toast.out")); + public static final DefaultedRegistryReference WEATHER_END_FLASH = SoundTypes.key(ResourceKey.minecraft("weather.end_flash")); + public static final DefaultedRegistryReference WEATHER_RAIN = SoundTypes.key(ResourceKey.minecraft("weather.rain")); public static final DefaultedRegistryReference WEATHER_RAIN_ABOVE = SoundTypes.key(ResourceKey.minecraft("weather.rain.above")); diff --git a/src/main/java/org/spongepowered/api/effect/sound/music/MusicDisc.java b/src/main/java/org/spongepowered/api/effect/sound/music/MusicDisc.java index d5b01818f9b..6a5de30e4f4 100644 --- a/src/main/java/org/spongepowered/api/effect/sound/music/MusicDisc.java +++ b/src/main/java/org/spongepowered/api/effect/sound/music/MusicDisc.java @@ -34,7 +34,7 @@ * played by a {@link Jukebox}. */ @CatalogedBy(MusicDiscs.class) -public interface MusicDisc extends DefaultedRegistryValue { +public interface MusicDisc extends DefaultedRegistryValue { /** * Gets the {@link SoundType} that is used diff --git a/src/main/java/org/spongepowered/api/effect/sound/music/MusicDiscs.java b/src/main/java/org/spongepowered/api/effect/sound/music/MusicDiscs.java index 742eed0d173..c80cdf90dd6 100644 --- a/src/main/java/org/spongepowered/api/effect/sound/music/MusicDiscs.java +++ b/src/main/java/org/spongepowered/api/effect/sound/music/MusicDiscs.java @@ -56,6 +56,8 @@ public final class MusicDiscs { public static final DefaultedRegistryReference FIVE = MusicDiscs.key(ResourceKey.minecraft("5")); + public static final DefaultedRegistryReference LAVA_CHICKEN = MusicDiscs.key(ResourceKey.minecraft("lava_chicken")); + public static final DefaultedRegistryReference MALL = MusicDiscs.key(ResourceKey.minecraft("mall")); public static final DefaultedRegistryReference MELLOHI = MusicDiscs.key(ResourceKey.minecraft("mellohi")); @@ -72,6 +74,8 @@ public final class MusicDiscs { public static final DefaultedRegistryReference STRAD = MusicDiscs.key(ResourceKey.minecraft("strad")); + public static final DefaultedRegistryReference TEARS = MusicDiscs.key(ResourceKey.minecraft("tears")); + public static final DefaultedRegistryReference THIRTEEN = MusicDiscs.key(ResourceKey.minecraft("13")); public static final DefaultedRegistryReference WAIT = MusicDiscs.key(ResourceKey.minecraft("wait")); @@ -86,6 +90,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.MUSIC_DISC, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.MUSIC_DISC, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/entity/Angerable.java b/src/main/java/org/spongepowered/api/entity/Angerable.java index a6f9d975282..e8f40153431 100644 --- a/src/main/java/org/spongepowered/api/entity/Angerable.java +++ b/src/main/java/org/spongepowered/api/entity/Angerable.java @@ -43,7 +43,7 @@ default Value.Mutable angry() { * * @return The anger level, decays over time */ - default Value.Mutable angerLevel() { + default Value.Mutable angerLevel() { return this.requireValue(Keys.ANGER_LEVEL).asMutable(); } } diff --git a/src/main/java/org/spongepowered/api/entity/Entity.java b/src/main/java/org/spongepowered/api/entity/Entity.java index 668f17c4013..c7d629d77ff 100644 --- a/src/main/java/org/spongepowered/api/entity/Entity.java +++ b/src/main/java/org/spongepowered/api/entity/Entity.java @@ -292,6 +292,10 @@ default boolean damage(final double damage, final Supplier, StringRepresentable { /** * Whether this category of entities is considered "friendly". diff --git a/src/main/java/org/spongepowered/api/entity/EntityType.java b/src/main/java/org/spongepowered/api/entity/EntityType.java index abb97ed8259..99552ec64b4 100644 --- a/src/main/java/org/spongepowered/api/entity/EntityType.java +++ b/src/main/java/org/spongepowered/api/entity/EntityType.java @@ -34,7 +34,7 @@ * Describes a type of entity. */ @CatalogedBy(EntityTypes.class) -public interface EntityType extends DefaultedRegistryValue, ComponentLike, Taggable> { +public interface EntityType extends DefaultedRegistryValue>, ComponentLike, Taggable> { /** * If true {@link Entity entities} of this type will not be saved to disk. diff --git a/src/main/java/org/spongepowered/api/entity/EntityTypes.java b/src/main/java/org/spongepowered/api/entity/EntityTypes.java index 64863cb3dea..e1ee0e952f2 100644 --- a/src/main/java/org/spongepowered/api/entity/EntityTypes.java +++ b/src/main/java/org/spongepowered/api/entity/EntityTypes.java @@ -46,7 +46,9 @@ import org.spongepowered.api.entity.living.animal.Chicken; import org.spongepowered.api.entity.living.animal.Fox; import org.spongepowered.api.entity.living.animal.Goat; +import org.spongepowered.api.entity.living.animal.HappyGhast; import org.spongepowered.api.entity.living.animal.Hoglin; +import org.spongepowered.api.entity.living.animal.Nautilus; import org.spongepowered.api.entity.living.animal.Ocelot; import org.spongepowered.api.entity.living.animal.Panda; import org.spongepowered.api.entity.living.animal.Parrot; @@ -58,11 +60,13 @@ import org.spongepowered.api.entity.living.animal.Strider; import org.spongepowered.api.entity.living.animal.Turtle; import org.spongepowered.api.entity.living.animal.Wolf; +import org.spongepowered.api.entity.living.animal.ZombieNautilus; +import org.spongepowered.api.entity.living.animal.camel.Camel; +import org.spongepowered.api.entity.living.animal.camel.CamelHusk; import org.spongepowered.api.entity.living.animal.cow.Cow; import org.spongepowered.api.entity.living.animal.cow.Mooshroom; import org.spongepowered.api.entity.living.animal.frog.Frog; import org.spongepowered.api.entity.living.animal.frog.Tadpole; -import org.spongepowered.api.entity.living.animal.horse.Camel; import org.spongepowered.api.entity.living.animal.horse.Donkey; import org.spongepowered.api.entity.living.animal.horse.Horse; import org.spongepowered.api.entity.living.animal.horse.Mule; @@ -77,10 +81,12 @@ import org.spongepowered.api.entity.living.aquatic.fish.school.Cod; import org.spongepowered.api.entity.living.aquatic.fish.school.Salmon; import org.spongepowered.api.entity.living.aquatic.fish.school.TropicalFish; +import org.spongepowered.api.entity.living.golem.CopperGolem; import org.spongepowered.api.entity.living.golem.IronGolem; import org.spongepowered.api.entity.living.golem.Shulker; import org.spongepowered.api.entity.living.golem.SnowGolem; import org.spongepowered.api.entity.living.monster.Blaze; +import org.spongepowered.api.entity.living.monster.Creaking; import org.spongepowered.api.entity.living.monster.Creeper; import org.spongepowered.api.entity.living.monster.Enderman; import org.spongepowered.api.entity.living.monster.Endermite; @@ -105,6 +111,7 @@ 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.Parched; 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; @@ -142,6 +149,7 @@ 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.Raft; import org.spongepowered.api.entity.vehicle.minecart.CommandBlockMinecart; import org.spongepowered.api.entity.vehicle.minecart.FurnaceMinecart; import org.spongepowered.api.entity.vehicle.minecart.Minecart; @@ -164,6 +172,10 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class EntityTypes { + public static final DefaultedRegistryReference> ACACIA_BOAT = EntityTypes.key(ResourceKey.minecraft("acacia_boat")); + + public static final DefaultedRegistryReference> ACACIA_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("acacia_chest_boat")); + public static final DefaultedRegistryReference> ALLAY = EntityTypes.key(ResourceKey.minecraft("allay")); public static final DefaultedRegistryReference> AREA_EFFECT_CLOUD = EntityTypes.key(ResourceKey.minecraft("area_effect_cloud")); @@ -176,16 +188,22 @@ public final class EntityTypes { public static final DefaultedRegistryReference> AXOLOTL = EntityTypes.key(ResourceKey.minecraft("axolotl")); + public static final DefaultedRegistryReference> BAMBOO_CHEST_RAFT = EntityTypes.key(ResourceKey.minecraft("bamboo_chest_raft")); + + public static final DefaultedRegistryReference> BAMBOO_RAFT = EntityTypes.key(ResourceKey.minecraft("bamboo_raft")); + public static final DefaultedRegistryReference> BAT = EntityTypes.key(ResourceKey.minecraft("bat")); public static final DefaultedRegistryReference> BEE = EntityTypes.key(ResourceKey.minecraft("bee")); + public static final DefaultedRegistryReference> BIRCH_BOAT = EntityTypes.key(ResourceKey.minecraft("birch_boat")); + + public static final DefaultedRegistryReference> BIRCH_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("birch_chest_boat")); + public static final DefaultedRegistryReference> BLAZE = EntityTypes.key(ResourceKey.minecraft("blaze")); public static final DefaultedRegistryReference> BLOCK_DISPLAY = EntityTypes.key(ResourceKey.minecraft("block_display")); - 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")); @@ -194,11 +212,15 @@ public final class EntityTypes { public static final DefaultedRegistryReference> CAMEL = EntityTypes.key(ResourceKey.minecraft("camel")); + public static final DefaultedRegistryReference> CAMEL_HUSK = EntityTypes.key(ResourceKey.minecraft("camel_husk")); + public static final DefaultedRegistryReference> CAT = EntityTypes.key(ResourceKey.minecraft("cat")); public static final DefaultedRegistryReference> CAVE_SPIDER = EntityTypes.key(ResourceKey.minecraft("cave_spider")); - public static final DefaultedRegistryReference> CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("chest_boat")); + public static final DefaultedRegistryReference> CHERRY_BOAT = EntityTypes.key(ResourceKey.minecraft("cherry_boat")); + + public static final DefaultedRegistryReference> CHERRY_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("cherry_chest_boat")); public static final DefaultedRegistryReference> CHEST_MINECART = EntityTypes.key(ResourceKey.minecraft("chest_minecart")); @@ -208,10 +230,18 @@ public final class EntityTypes { public static final DefaultedRegistryReference> COMMAND_BLOCK_MINECART = EntityTypes.key(ResourceKey.minecraft("command_block_minecart")); + public static final DefaultedRegistryReference> COPPER_GOLEM = EntityTypes.key(ResourceKey.minecraft("copper_golem")); + public static final DefaultedRegistryReference> COW = EntityTypes.key(ResourceKey.minecraft("cow")); + public static final DefaultedRegistryReference> CREAKING = EntityTypes.key(ResourceKey.minecraft("creaking")); + public static final DefaultedRegistryReference> CREEPER = EntityTypes.key(ResourceKey.minecraft("creeper")); + public static final DefaultedRegistryReference> DARK_OAK_BOAT = EntityTypes.key(ResourceKey.minecraft("dark_oak_boat")); + + public static final DefaultedRegistryReference> DARK_OAK_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("dark_oak_chest_boat")); + public static final DefaultedRegistryReference> DOLPHIN = EntityTypes.key(ResourceKey.minecraft("dolphin")); public static final DefaultedRegistryReference> DONKEY = EntityTypes.key(ResourceKey.minecraft("donkey")); @@ -270,6 +300,8 @@ public final class EntityTypes { public static final DefaultedRegistryReference> GUARDIAN = EntityTypes.key(ResourceKey.minecraft("guardian")); + public static final DefaultedRegistryReference> HAPPY_GHAST = EntityTypes.key(ResourceKey.minecraft("happy_ghast")); + public static final DefaultedRegistryReference> HOGLIN = EntityTypes.key(ResourceKey.minecraft("hoglin")); public static final DefaultedRegistryReference> HOPPER_MINECART = EntityTypes.key(ResourceKey.minecraft("hopper_minecart")); @@ -292,16 +324,28 @@ public final class EntityTypes { public static final DefaultedRegistryReference> ITEM_FRAME = EntityTypes.key(ResourceKey.minecraft("item_frame")); + public static final DefaultedRegistryReference> JUNGLE_BOAT = EntityTypes.key(ResourceKey.minecraft("jungle_boat")); + + public static final DefaultedRegistryReference> JUNGLE_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("jungle_chest_boat")); + public static final DefaultedRegistryReference> LEASH_KNOT = EntityTypes.key(ResourceKey.minecraft("leash_knot")); public static final DefaultedRegistryReference> LIGHTNING_BOLT = EntityTypes.key(ResourceKey.minecraft("lightning_bolt")); + public static final DefaultedRegistryReference> LINGERING_POTION = EntityTypes.key(ResourceKey.minecraft("lingering_potion")); + public static final DefaultedRegistryReference> LLAMA = EntityTypes.key(ResourceKey.minecraft("llama")); public static final DefaultedRegistryReference> LLAMA_SPIT = EntityTypes.key(ResourceKey.minecraft("llama_spit")); public static final DefaultedRegistryReference> MAGMA_CUBE = EntityTypes.key(ResourceKey.minecraft("magma_cube")); + public static final DefaultedRegistryReference> MANGROVE_BOAT = EntityTypes.key(ResourceKey.minecraft("mangrove_boat")); + + public static final DefaultedRegistryReference> MANGROVE_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("mangrove_chest_boat")); + + public static final DefaultedRegistryReference> MANNEQUIN = EntityTypes.key(ResourceKey.minecraft("mannequin")); + public static final DefaultedRegistryReference> MARKER = EntityTypes.key(ResourceKey.minecraft("marker")); public static final DefaultedRegistryReference> MINECART = EntityTypes.key(ResourceKey.minecraft("minecart")); @@ -310,14 +354,26 @@ public final class EntityTypes { public static final DefaultedRegistryReference> MULE = EntityTypes.key(ResourceKey.minecraft("mule")); + public static final DefaultedRegistryReference> NAUTILUS = EntityTypes.key(ResourceKey.minecraft("nautilus")); + + public static final DefaultedRegistryReference> OAK_BOAT = EntityTypes.key(ResourceKey.minecraft("oak_boat")); + + public static final DefaultedRegistryReference> OAK_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("oak_chest_boat")); + 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> PALE_OAK_BOAT = EntityTypes.key(ResourceKey.minecraft("pale_oak_boat")); + + public static final DefaultedRegistryReference> PALE_OAK_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("pale_oak_chest_boat")); + public static final DefaultedRegistryReference> PANDA = EntityTypes.key(ResourceKey.minecraft("panda")); + public static final DefaultedRegistryReference> PARCHED = EntityTypes.key(ResourceKey.minecraft("parched")); + public static final DefaultedRegistryReference> PARROT = EntityTypes.key(ResourceKey.minecraft("parrot")); public static final DefaultedRegistryReference> PHANTOM = EntityTypes.key(ResourceKey.minecraft("phantom")); @@ -334,8 +390,6 @@ public final class EntityTypes { public static final DefaultedRegistryReference> POLAR_BEAR = EntityTypes.key(ResourceKey.minecraft("polar_bear")); - public static final DefaultedRegistryReference> POTION = EntityTypes.key(ResourceKey.minecraft("potion")); - public static final DefaultedRegistryReference> PUFFERFISH = EntityTypes.key(ResourceKey.minecraft("pufferfish")); public static final DefaultedRegistryReference> RABBIT = EntityTypes.key(ResourceKey.minecraft("rabbit")); @@ -372,6 +426,12 @@ public final class EntityTypes { public static final DefaultedRegistryReference> SPIDER = EntityTypes.key(ResourceKey.minecraft("spider")); + public static final DefaultedRegistryReference> SPLASH_POTION = EntityTypes.key(ResourceKey.minecraft("splash_potion")); + + public static final DefaultedRegistryReference> SPRUCE_BOAT = EntityTypes.key(ResourceKey.minecraft("spruce_boat")); + + public static final DefaultedRegistryReference> SPRUCE_CHEST_BOAT = EntityTypes.key(ResourceKey.minecraft("spruce_chest_boat")); + public static final DefaultedRegistryReference> SQUID = EntityTypes.key(ResourceKey.minecraft("squid")); public static final DefaultedRegistryReference> STRAY = EntityTypes.key(ResourceKey.minecraft("stray")); @@ -422,6 +482,8 @@ public final class EntityTypes { public static final DefaultedRegistryReference> ZOMBIE_HORSE = EntityTypes.key(ResourceKey.minecraft("zombie_horse")); + public static final DefaultedRegistryReference> ZOMBIE_NAUTILUS = EntityTypes.key(ResourceKey.minecraft("zombie_nautilus")); + public static final DefaultedRegistryReference> ZOMBIE_VILLAGER = EntityTypes.key(ResourceKey.minecraft("zombie_villager")); public static final DefaultedRegistryReference> ZOMBIFIED_PIGLIN = EntityTypes.key(ResourceKey.minecraft("zombified_piglin")); @@ -429,7 +491,7 @@ public final class EntityTypes { private EntityTypes() { } - public static Registry> registry() { + public static Registry> registry() { return Sponge.game().registry(RegistryTypes.ENTITY_TYPE); } diff --git a/src/main/java/org/spongepowered/api/datapack/DataPack.java b/src/main/java/org/spongepowered/api/entity/Mannequin.java similarity index 72% rename from src/main/java/org/spongepowered/api/datapack/DataPack.java rename to src/main/java/org/spongepowered/api/entity/Mannequin.java index 1c71778046d..ca02b9dc56f 100644 --- a/src/main/java/org/spongepowered/api/datapack/DataPack.java +++ b/src/main/java/org/spongepowered/api/entity/Mannequin.java @@ -22,32 +22,21 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.datapack; +package org.spongepowered.api.entity; -import org.spongepowered.api.util.annotation.CatalogedBy; +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.type.HandPreference; +import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.entity.living.Living; -@CatalogedBy(DataPacks.class) -public interface DataPack { +public interface Mannequin extends Living { /** - * Returns the name of the data pack + * {@link Keys#DOMINANT_HAND} * - * @return The name + * @return The dominant HandPreference of the player */ - String name(); - - /** - * Returns the data pack description - * - * @return The description - */ - String description(); - - /** - * Returns the data pack type - * - * @return The data pack type - */ - DataPackType type(); - + default Value.Mutable dominantHand() { + return this.requireValue(Keys.DOMINANT_HAND).asMutable(); + } } diff --git a/src/main/java/org/spongepowered/api/entity/Saddleable.java b/src/main/java/org/spongepowered/api/entity/Saddleable.java index 4a3dfe1dee7..ba03f4156c9 100644 --- a/src/main/java/org/spongepowered/api/entity/Saddleable.java +++ b/src/main/java/org/spongepowered/api/entity/Saddleable.java @@ -26,10 +26,16 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.tag.DefaultedTag; +import org.spongepowered.api.tag.EntityTypeTags; /** * Represents an {@link Entity} which can be saddled. + * + * @deprecated Use {@link EntityType#is(DefaultedTag) EntityType.is} {@link EntityTypeTags#CAN_EQUIP_SADDLE} as + * other {@link Entity entities} may be now saddled based on the tag definition */ +@Deprecated(forRemoval = true, since = "15") public interface Saddleable extends Entity { /** diff --git a/src/main/java/org/spongepowered/api/entity/ai/goal/GoalExecutorType.java b/src/main/java/org/spongepowered/api/entity/ai/goal/GoalExecutorType.java index 9eed90f679f..69302971025 100644 --- a/src/main/java/org/spongepowered/api/entity/ai/goal/GoalExecutorType.java +++ b/src/main/java/org/spongepowered/api/entity/ai/goal/GoalExecutorType.java @@ -28,5 +28,5 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(GoalExecutorTypes.class) -public interface GoalExecutorType extends DefaultedRegistryValue { +public interface GoalExecutorType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/entity/ai/goal/GoalType.java b/src/main/java/org/spongepowered/api/entity/ai/goal/GoalType.java index 530060fc2ac..a115fff1afd 100644 --- a/src/main/java/org/spongepowered/api/entity/ai/goal/GoalType.java +++ b/src/main/java/org/spongepowered/api/entity/ai/goal/GoalType.java @@ -28,7 +28,7 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(GoalTypes.class) -public interface GoalType extends DefaultedRegistryValue { +public interface GoalType extends DefaultedRegistryValue { /** * Gets the {@link Goal} class that this type represents. diff --git a/src/main/java/org/spongepowered/api/entity/ai/goal/builtin/creature/AvoidLivingGoal.java b/src/main/java/org/spongepowered/api/entity/ai/goal/builtin/creature/AvoidLivingGoal.java index fee7413384c..d3ed6ace738 100644 --- a/src/main/java/org/spongepowered/api/entity/ai/goal/builtin/creature/AvoidLivingGoal.java +++ b/src/main/java/org/spongepowered/api/entity/ai/goal/builtin/creature/AvoidLivingGoal.java @@ -30,7 +30,9 @@ import org.spongepowered.api.entity.living.Agent; import org.spongepowered.api.entity.living.Living; import org.spongepowered.api.entity.living.PathfinderAgent; +import org.spongepowered.api.world.server.ServerWorld; +import java.util.function.BiPredicate; import java.util.function.Predicate; public interface AvoidLivingGoal extends Goal { @@ -52,7 +54,7 @@ static Builder builder() { * * @return The predicate used to filter which entities to avoid */ - Predicate targetSelector(); + BiPredicate targetSelector(); /** * Sets the {@link Predicate} for filtering which {@link Living} instances @@ -61,7 +63,11 @@ static Builder builder() { * @param predicate The predicate * @return This task, for chaining */ - AvoidLivingGoal setTargetSelector(Predicate predicate); + default AvoidLivingGoal setTargetSelector(Predicate predicate) { + return this.setTargetSelector((entity, world) -> predicate.test(entity)); + } + + AvoidLivingGoal setTargetSelector(BiPredicate predicate); /** * Gets the search distance at which any {@link Living} instances in a diff --git a/src/main/java/org/spongepowered/api/entity/attribute/AttributeModifier.java b/src/main/java/org/spongepowered/api/entity/attribute/AttributeModifier.java index b34c7458472..ec587da064a 100644 --- a/src/main/java/org/spongepowered/api/entity/attribute/AttributeModifier.java +++ b/src/main/java/org/spongepowered/api/entity/attribute/AttributeModifier.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.entity.attribute; +import org.spongepowered.api.ResourceKey; import org.spongepowered.api.ResourceKeyed; import org.spongepowered.api.Sponge; import org.spongepowered.api.item.inventory.ItemStack; @@ -38,6 +39,30 @@ */ public interface AttributeModifier extends ResourceKeyed { + /** + * Creates an attribute modifier with the given values. + * + * @param key The resource key + * @param operation The attribute operation + * @param amount The amount + * @return The attribute modifier + */ + static AttributeModifier of(final ResourceKey key, final Supplier operation, final double amount) { + return AttributeModifier.builder().key(key).operation(operation).amount(amount).build(); + } + + /** + * Creates an attribute modifier with the given values. + * + * @param key The resource key + * @param operation The attribute operation + * @param amount The amount + * @return The attribute modifier + */ + static AttributeModifier of(final ResourceKey key, final AttributeOperation operation, final double amount) { + return AttributeModifier.builder().key(key).operation(operation).amount(amount).build(); + } + /** * Creates a new {@link Builder} to create an {@link AttributeModifier}. * diff --git a/src/main/java/org/spongepowered/api/entity/attribute/AttributeOperation.java b/src/main/java/org/spongepowered/api/entity/attribute/AttributeOperation.java index 3e59ce8b442..3a0ca2bdd9f 100644 --- a/src/main/java/org/spongepowered/api/entity/attribute/AttributeOperation.java +++ b/src/main/java/org/spongepowered/api/entity/attribute/AttributeOperation.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.entity.attribute; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -32,6 +33,6 @@ * {@link Attribute}. */ @CatalogedBy(AttributeOperations.class) -public interface AttributeOperation extends DefaultedRegistryValue { +public interface AttributeOperation extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/entity/attribute/ItemAttribute.java b/src/main/java/org/spongepowered/api/entity/attribute/ItemAttribute.java new file mode 100644 index 00000000000..77e304d71d0 --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/attribute/ItemAttribute.java @@ -0,0 +1,114 @@ +/* + * 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.attribute; + +import org.spongepowered.api.Sponge; +import org.spongepowered.api.entity.attribute.type.AttributeType; +import org.spongepowered.api.item.inventory.ItemStackLike; +import org.spongepowered.api.item.inventory.equipment.EquipmentCondition; + +import java.util.Objects; +import java.util.function.Supplier; + +/** + * Represents an {@link AttributeModifier} for the specific {@link AttributeType} + * an {@link ItemStackLike} can apply when the {@link EquipmentCondition} is met. + */ +public interface ItemAttribute { + + /** + * Creates an item attribute with the given values. + * + * @param type The attribute type + * @param modifier The attribute modifier + * @param condition The equipment condition + * @return The item attribute + */ + static ItemAttribute of(final Supplier type, final AttributeModifier modifier, final Supplier condition) { + return ItemAttribute.of(Objects.requireNonNull(type, "type").get(), modifier, Objects.requireNonNull(condition, "condition").get()); + } + + /** + * Creates an item attribute with the given values. + * + * @param type The attribute type + * @param modifier The attribute modifier + * @param condition The equipment condition + * @return The item attribute + */ + static ItemAttribute of(final Supplier type, final AttributeModifier modifier, final EquipmentCondition condition) { + return ItemAttribute.of(Objects.requireNonNull(type, "type").get(), modifier, condition); + } + + /** + * Creates an item attribute with the given values. + * + * @param type The attribute type + * @param modifier The attribute modifier + * @param condition The equipment condition + * @return The item attribute + */ + static ItemAttribute of(final AttributeType type, final AttributeModifier modifier, final Supplier condition) { + return ItemAttribute.of(type, modifier, Objects.requireNonNull(condition, "condition").get()); + } + + /** + * Creates an item attribute with the given values. + * + * @param type The attribute type + * @param modifier The attribute modifier + * @param condition The equipment condition + * @return The item attribute + */ + static ItemAttribute of(final AttributeType type, final AttributeModifier modifier, final EquipmentCondition condition) { + return Sponge.game().factoryProvider().provide(Factory.class).of(type, modifier, condition); + } + + /** + * Returns the attribute type. + * + * @return The attribute type + */ + AttributeType type(); + + /** + * Returns the attribute modifier. + * + * @return The attribute modifier + */ + AttributeModifier modifier(); + + /** + * Returns the equipment condition. + * + * @return The equipment condition + */ + EquipmentCondition condition(); + + interface Factory { + + ItemAttribute of(AttributeType type, AttributeModifier modifier, EquipmentCondition condition); + } +} diff --git a/src/main/java/org/spongepowered/api/entity/attribute/type/AttributeType.java b/src/main/java/org/spongepowered/api/entity/attribute/type/AttributeType.java index 1ce5fbe78d8..23568a640cd 100644 --- a/src/main/java/org/spongepowered/api/entity/attribute/type/AttributeType.java +++ b/src/main/java/org/spongepowered/api/entity/attribute/type/AttributeType.java @@ -32,7 +32,7 @@ * Represents an attribute type that can apply effects or modify traits related to an entity. */ @CatalogedBy(AttributeTypes.class) -public interface AttributeType extends DefaultedRegistryValue { +public interface AttributeType extends DefaultedRegistryValue { /** * Gets the default value of this attribute type before any {@link AttributeModifier}s are applied. 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 328602a4642..ec1034f9902 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 @@ -40,67 +40,75 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class AttributeTypes { - public static final DefaultedRegistryReference GENERIC_ARMOR = AttributeTypes.key(ResourceKey.minecraft("generic.armor")); + public static final DefaultedRegistryReference ARMOR = AttributeTypes.key(ResourceKey.minecraft("armor")); - public static final DefaultedRegistryReference GENERIC_ARMOR_TOUGHNESS = AttributeTypes.key(ResourceKey.minecraft("generic.armor_toughness")); + public static final DefaultedRegistryReference ARMOR_TOUGHNESS = AttributeTypes.key(ResourceKey.minecraft("armor_toughness")); - public static final DefaultedRegistryReference GENERIC_ATTACK_DAMAGE = AttributeTypes.key(ResourceKey.minecraft("generic.attack_damage")); + public static final DefaultedRegistryReference ATTACK_DAMAGE = AttributeTypes.key(ResourceKey.minecraft("attack_damage")); - public static final DefaultedRegistryReference GENERIC_ATTACK_KNOCKBACK = AttributeTypes.key(ResourceKey.minecraft("generic.attack_knockback")); + public static final DefaultedRegistryReference ATTACK_KNOCKBACK = AttributeTypes.key(ResourceKey.minecraft("attack_knockback")); - public static final DefaultedRegistryReference GENERIC_ATTACK_SPEED = AttributeTypes.key(ResourceKey.minecraft("generic.attack_speed")); + public static final DefaultedRegistryReference ATTACK_SPEED = AttributeTypes.key(ResourceKey.minecraft("attack_speed")); - public static final DefaultedRegistryReference GENERIC_BURNING_TIME = AttributeTypes.key(ResourceKey.minecraft("generic.burning_time")); + public static final DefaultedRegistryReference BLOCK_BREAK_SPEED = AttributeTypes.key(ResourceKey.minecraft("block_break_speed")); - public static final DefaultedRegistryReference GENERIC_EXPLOSION_KNOCKBACK_RESISTANCE = AttributeTypes.key(ResourceKey.minecraft("generic.explosion_knockback_resistance")); + public static final DefaultedRegistryReference BLOCK_INTERACTION_RANGE = AttributeTypes.key(ResourceKey.minecraft("block_interaction_range")); - public static final DefaultedRegistryReference GENERIC_FALL_DAMAGE_MULTIPLIER = AttributeTypes.key(ResourceKey.minecraft("generic.fall_damage_multiplier")); + public static final DefaultedRegistryReference BURNING_TIME = AttributeTypes.key(ResourceKey.minecraft("burning_time")); - public static final DefaultedRegistryReference GENERIC_FLYING_SPEED = AttributeTypes.key(ResourceKey.minecraft("generic.flying_speed")); + public static final DefaultedRegistryReference CAMERA_DISTANCE = AttributeTypes.key(ResourceKey.minecraft("camera_distance")); - public static final DefaultedRegistryReference GENERIC_FOLLOW_RANGE = AttributeTypes.key(ResourceKey.minecraft("generic.follow_range")); + public static final DefaultedRegistryReference ENTITY_INTERACTION_RANGE = AttributeTypes.key(ResourceKey.minecraft("entity_interaction_range")); - public static final DefaultedRegistryReference GENERIC_GRAVITY = AttributeTypes.key(ResourceKey.minecraft("generic.gravity")); + public static final DefaultedRegistryReference EXPLOSION_KNOCKBACK_RESISTANCE = AttributeTypes.key(ResourceKey.minecraft("explosion_knockback_resistance")); - public static final DefaultedRegistryReference GENERIC_JUMP_STRENGTH = AttributeTypes.key(ResourceKey.minecraft("generic.jump_strength")); + public static final DefaultedRegistryReference FALL_DAMAGE_MULTIPLIER = AttributeTypes.key(ResourceKey.minecraft("fall_damage_multiplier")); - public static final DefaultedRegistryReference GENERIC_KNOCKBACK_RESISTANCE = AttributeTypes.key(ResourceKey.minecraft("generic.knockback_resistance")); + public static final DefaultedRegistryReference FLYING_SPEED = AttributeTypes.key(ResourceKey.minecraft("flying_speed")); - public static final DefaultedRegistryReference GENERIC_LUCK = AttributeTypes.key(ResourceKey.minecraft("generic.luck")); + public static final DefaultedRegistryReference FOLLOW_RANGE = AttributeTypes.key(ResourceKey.minecraft("follow_range")); - public static final DefaultedRegistryReference GENERIC_MAX_ABSORPTION = AttributeTypes.key(ResourceKey.minecraft("generic.max_absorption")); + public static final DefaultedRegistryReference GRAVITY = AttributeTypes.key(ResourceKey.minecraft("gravity")); - public static final DefaultedRegistryReference GENERIC_MAX_HEALTH = AttributeTypes.key(ResourceKey.minecraft("generic.max_health")); + public static final DefaultedRegistryReference JUMP_STRENGTH = AttributeTypes.key(ResourceKey.minecraft("jump_strength")); - public static final DefaultedRegistryReference GENERIC_MOVEMENT_EFFICIENCY = AttributeTypes.key(ResourceKey.minecraft("generic.movement_efficiency")); + public static final DefaultedRegistryReference KNOCKBACK_RESISTANCE = AttributeTypes.key(ResourceKey.minecraft("knockback_resistance")); - public static final DefaultedRegistryReference GENERIC_MOVEMENT_SPEED = AttributeTypes.key(ResourceKey.minecraft("generic.movement_speed")); + public static final DefaultedRegistryReference LUCK = AttributeTypes.key(ResourceKey.minecraft("luck")); - public static final DefaultedRegistryReference GENERIC_OXYGEN_BONUS = AttributeTypes.key(ResourceKey.minecraft("generic.oxygen_bonus")); + public static final DefaultedRegistryReference MAX_ABSORPTION = AttributeTypes.key(ResourceKey.minecraft("max_absorption")); - public static final DefaultedRegistryReference GENERIC_SAFE_FALL_DISTANCE = AttributeTypes.key(ResourceKey.minecraft("generic.safe_fall_distance")); + public static final DefaultedRegistryReference MAX_HEALTH = AttributeTypes.key(ResourceKey.minecraft("max_health")); - public static final DefaultedRegistryReference GENERIC_SCALE = AttributeTypes.key(ResourceKey.minecraft("generic.scale")); + public static final DefaultedRegistryReference MINING_EFFICIENCY = AttributeTypes.key(ResourceKey.minecraft("mining_efficiency")); - public static final DefaultedRegistryReference GENERIC_STEP_HEIGHT = AttributeTypes.key(ResourceKey.minecraft("generic.step_height")); + public static final DefaultedRegistryReference MOVEMENT_EFFICIENCY = AttributeTypes.key(ResourceKey.minecraft("movement_efficiency")); - public static final DefaultedRegistryReference GENERIC_WATER_MOVEMENT_EFFICIENCY = AttributeTypes.key(ResourceKey.minecraft("generic.water_movement_efficiency")); + public static final DefaultedRegistryReference MOVEMENT_SPEED = AttributeTypes.key(ResourceKey.minecraft("movement_speed")); - public static final DefaultedRegistryReference PLAYER_BLOCK_BREAK_SPEED = AttributeTypes.key(ResourceKey.minecraft("player.block_break_speed")); + public static final DefaultedRegistryReference OXYGEN_BONUS = AttributeTypes.key(ResourceKey.minecraft("oxygen_bonus")); - public static final DefaultedRegistryReference PLAYER_BLOCK_INTERACTION_RANGE = AttributeTypes.key(ResourceKey.minecraft("player.block_interaction_range")); + public static final DefaultedRegistryReference SAFE_FALL_DISTANCE = AttributeTypes.key(ResourceKey.minecraft("safe_fall_distance")); - public static final DefaultedRegistryReference PLAYER_ENTITY_INTERACTION_RANGE = AttributeTypes.key(ResourceKey.minecraft("player.entity_interaction_range")); + public static final DefaultedRegistryReference SCALE = AttributeTypes.key(ResourceKey.minecraft("scale")); - public static final DefaultedRegistryReference PLAYER_MINING_EFFICIENCY = AttributeTypes.key(ResourceKey.minecraft("player.mining_efficiency")); + public static final DefaultedRegistryReference SNEAKING_SPEED = AttributeTypes.key(ResourceKey.minecraft("sneaking_speed")); - public static final DefaultedRegistryReference PLAYER_SNEAKING_SPEED = AttributeTypes.key(ResourceKey.minecraft("player.sneaking_speed")); + public static final DefaultedRegistryReference SPAWN_REINFORCEMENTS = AttributeTypes.key(ResourceKey.minecraft("spawn_reinforcements")); - public static final DefaultedRegistryReference PLAYER_SUBMERGED_MINING_SPEED = AttributeTypes.key(ResourceKey.minecraft("player.submerged_mining_speed")); + public static final DefaultedRegistryReference STEP_HEIGHT = AttributeTypes.key(ResourceKey.minecraft("step_height")); - public static final DefaultedRegistryReference PLAYER_SWEEPING_DAMAGE_RATIO = AttributeTypes.key(ResourceKey.minecraft("player.sweeping_damage_ratio")); + public static final DefaultedRegistryReference SUBMERGED_MINING_SPEED = AttributeTypes.key(ResourceKey.minecraft("submerged_mining_speed")); - public static final DefaultedRegistryReference ZOMBIE_SPAWN_REINFORCEMENTS = AttributeTypes.key(ResourceKey.minecraft("zombie.spawn_reinforcements")); + public static final DefaultedRegistryReference SWEEPING_DAMAGE_RATIO = AttributeTypes.key(ResourceKey.minecraft("sweeping_damage_ratio")); + + public static final DefaultedRegistryReference TEMPT_RANGE = AttributeTypes.key(ResourceKey.minecraft("tempt_range")); + + public static final DefaultedRegistryReference WATER_MOVEMENT_EFFICIENCY = AttributeTypes.key(ResourceKey.minecraft("water_movement_efficiency")); + + public static final DefaultedRegistryReference WAYPOINT_RECEIVE_RANGE = AttributeTypes.key(ResourceKey.minecraft("waypoint_receive_range")); + + public static final DefaultedRegistryReference WAYPOINT_TRANSMIT_RANGE = AttributeTypes.key(ResourceKey.minecraft("waypoint_transmit_range")); private AttributeTypes() { } diff --git a/src/main/java/org/spongepowered/api/entity/display/BillboardType.java b/src/main/java/org/spongepowered/api/entity/display/BillboardType.java index 88b2664d818..a6acea8d8ee 100644 --- a/src/main/java/org/spongepowered/api/entity/display/BillboardType.java +++ b/src/main/java/org/spongepowered/api/entity/display/BillboardType.java @@ -24,10 +24,11 @@ */ package org.spongepowered.api.entity.display; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(BillboardTypes.class) -public interface BillboardType extends DefaultedRegistryValue { +public interface BillboardType extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/entity/display/ItemDisplayType.java b/src/main/java/org/spongepowered/api/entity/display/ItemDisplayType.java index 10de94fb1cf..8b6c5466212 100644 --- a/src/main/java/org/spongepowered/api/entity/display/ItemDisplayType.java +++ b/src/main/java/org/spongepowered/api/entity/display/ItemDisplayType.java @@ -24,10 +24,11 @@ */ package org.spongepowered.api.entity.display; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(ItemDisplayTypes.class) -public interface ItemDisplayType extends DefaultedRegistryValue { +public interface ItemDisplayType extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/entity/display/ItemDisplayTypes.java b/src/main/java/org/spongepowered/api/entity/display/ItemDisplayTypes.java index ba0f680a0ae..be8222a7610 100644 --- a/src/main/java/org/spongepowered/api/entity/display/ItemDisplayTypes.java +++ b/src/main/java/org/spongepowered/api/entity/display/ItemDisplayTypes.java @@ -54,6 +54,8 @@ public final class ItemDisplayTypes { public static final DefaultedRegistryReference NONE = ItemDisplayTypes.key(ResourceKey.sponge("none")); + public static final DefaultedRegistryReference ON_SHELF = ItemDisplayTypes.key(ResourceKey.sponge("on_shelf")); + public static final DefaultedRegistryReference THIRDPERSON_LEFTHAND = ItemDisplayTypes.key(ResourceKey.sponge("thirdperson_lefthand")); public static final DefaultedRegistryReference THIRDPERSON_RIGHTHAND = ItemDisplayTypes.key(ResourceKey.sponge("thirdperson_righthand")); diff --git a/src/main/java/org/spongepowered/api/entity/display/TextAlignment.java b/src/main/java/org/spongepowered/api/entity/display/TextAlignment.java index 3b9d3f984f8..43d74eb4f4b 100644 --- a/src/main/java/org/spongepowered/api/entity/display/TextAlignment.java +++ b/src/main/java/org/spongepowered/api/entity/display/TextAlignment.java @@ -24,10 +24,11 @@ */ package org.spongepowered.api.entity.display; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(TextAlignments.class) -public interface TextAlignment extends DefaultedRegistryValue { +public interface TextAlignment extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/entity/explosive/Explosive.java b/src/main/java/org/spongepowered/api/entity/explosive/Explosive.java index ab0cff20aca..23e3a18a65c 100644 --- a/src/main/java/org/spongepowered/api/entity/explosive/Explosive.java +++ b/src/main/java/org/spongepowered/api/entity/explosive/Explosive.java @@ -40,7 +40,7 @@ public interface Explosive extends Entity { * * @return The explosion radius */ - default Optional> explosionRadius() { + default Optional> explosionRadius() { return this.getValue(Keys.EXPLOSION_RADIUS).map(Value::asMutable); } diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/Axolotl.java b/src/main/java/org/spongepowered/api/entity/living/animal/Axolotl.java index 7f4253f9749..79e4da6bf7a 100644 --- a/src/main/java/org/spongepowered/api/entity/living/animal/Axolotl.java +++ b/src/main/java/org/spongepowered/api/entity/living/animal/Axolotl.java @@ -24,8 +24,23 @@ */ package org.spongepowered.api.entity.living.animal; +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.type.AxolotlVariant; +import org.spongepowered.api.data.value.Value; + /** * Represents an Axolotl. */ public interface Axolotl extends Animal { + + /** + * Gets the {@link AxolotlVariant} of this Axolotl. Can be + * set back. + * + * @see org.spongepowered.api.data.type.AxolotlVariants + * @return The AxolotlVariant of this Axolotl. + */ + default Value variant() { + return this.requireValue(Keys.AXOLOTL_VARIANT); + } } diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/HappyGhast.java b/src/main/java/org/spongepowered/api/entity/living/animal/HappyGhast.java new file mode 100644 index 00000000000..a425258ab82 --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/animal/HappyGhast.java @@ -0,0 +1,36 @@ +/* + * 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; + +import org.spongepowered.api.util.annotation.Experimental; + +/** + * A Happy Ghast that is passive and normally does not attack players. + * + * @see Minecraft Wiki + */ +@Experimental("summer_drop") +public interface HappyGhast extends Animal { +} diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/Nautilus.java b/src/main/java/org/spongepowered/api/entity/living/animal/Nautilus.java new file mode 100644 index 00000000000..1a7274c7bdc --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/animal/Nautilus.java @@ -0,0 +1,33 @@ +/* + * 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; + +/** + * A friendly {@link NautilusLike} entity. + *

    + * See Minecraft Wiki + */ +public interface Nautilus extends NautilusLike { +} diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/NautilusLike.java b/src/main/java/org/spongepowered/api/entity/living/animal/NautilusLike.java new file mode 100644 index 00000000000..bb098c61607 --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/animal/NautilusLike.java @@ -0,0 +1,35 @@ +/* + * 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; + +import org.spongepowered.api.item.inventory.Carrier; + +/** + * Represents a Nautilus-like entity, all of which can be mounted. + *

    + * See Minecraft Wiki + */ +public interface NautilusLike extends TameableAnimal, Carrier { +} diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/Pig.java b/src/main/java/org/spongepowered/api/entity/living/animal/Pig.java index 2bb9204d625..6af33b2d0ba 100644 --- a/src/main/java/org/spongepowered/api/entity/living/animal/Pig.java +++ b/src/main/java/org/spongepowered/api/entity/living/animal/Pig.java @@ -24,11 +24,24 @@ */ package org.spongepowered.api.entity.living.animal; -import org.spongepowered.api.entity.Saddleable; +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.type.PigType; +import org.spongepowered.api.data.value.Value; /** * Represents a Pig. */ -public interface Pig extends Animal, Saddleable { +@SuppressWarnings("removal") +public interface Pig extends Animal, org.spongepowered.api.entity.Saddleable { + + /** + * Gets the variant {@link PigType} of this Pig. + * + * @see Pig Variant Changes + * @return The {@link PigType} of this Pig. + */ + default Value variant() { + return this.requireValue(Keys.PIG_TYPE).asMutable(); + } } diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/Strider.java b/src/main/java/org/spongepowered/api/entity/living/animal/Strider.java index 0c2a703bdc5..1f6c21eb348 100644 --- a/src/main/java/org/spongepowered/api/entity/living/animal/Strider.java +++ b/src/main/java/org/spongepowered/api/entity/living/animal/Strider.java @@ -24,10 +24,10 @@ */ package org.spongepowered.api.entity.living.animal; -import org.spongepowered.api.entity.Saddleable; - /** * Represents a Strider. */ -public interface Strider extends Animal, Saddleable { +@SuppressWarnings("removal") +public interface Strider extends Animal, org.spongepowered.api.entity.Saddleable { + } diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/Wolf.java b/src/main/java/org/spongepowered/api/entity/living/animal/Wolf.java index c35a73fee6a..5628dd4eb47 100644 --- a/src/main/java/org/spongepowered/api/entity/living/animal/Wolf.java +++ b/src/main/java/org/spongepowered/api/entity/living/animal/Wolf.java @@ -26,6 +26,7 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.type.DyeColor; +import org.spongepowered.api.data.type.WolfSoundVariant; import org.spongepowered.api.data.type.WolfVariant; import org.spongepowered.api.data.value.Value; import org.spongepowered.api.entity.Angerable; @@ -43,6 +44,14 @@ default Value.Mutable variant() { return this.requireValue(Keys.WOLF_VARIANT).asMutable(); } + /** + * {@link Keys#WOLF_SOUND_VARIANT} + * @return The wolf's sound variant + */ + default Value.Mutable soundVariant() { + return this.requireValue(Keys.WOLF_SOUND_VARIANT).asMutable(); + } + /** * {@link Keys#DYE_COLOR} * @return The collar color diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/ZombieNautilus.java b/src/main/java/org/spongepowered/api/entity/living/animal/ZombieNautilus.java new file mode 100644 index 00000000000..a37d6f2413e --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/animal/ZombieNautilus.java @@ -0,0 +1,34 @@ +/* + * 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; + +/** + * Represents a Zombie Nautilus. + *

    + * See Minecraft Wiki + */ +public interface ZombieNautilus extends NautilusLike { + +} diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/horse/Camel.java b/src/main/java/org/spongepowered/api/entity/living/animal/camel/Camel.java similarity index 91% rename from src/main/java/org/spongepowered/api/entity/living/animal/horse/Camel.java rename to src/main/java/org/spongepowered/api/entity/living/animal/camel/Camel.java index 790614b12fb..14fc4dc2edf 100644 --- a/src/main/java/org/spongepowered/api/entity/living/animal/horse/Camel.java +++ b/src/main/java/org/spongepowered/api/entity/living/animal/camel/Camel.java @@ -22,9 +22,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.entity.living.animal.horse; +package org.spongepowered.api.entity.living.animal.camel; import org.spongepowered.api.entity.living.animal.Sittable; +import org.spongepowered.api.entity.living.animal.horse.HorseLike; /** * Represents a Camel. diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/package-info.java b/src/main/java/org/spongepowered/api/entity/living/animal/camel/CamelHusk.java similarity index 85% rename from src/main/java/org/spongepowered/api/util/annotation/eventgen/package-info.java rename to src/main/java/org/spongepowered/api/entity/living/animal/camel/CamelHusk.java index 6e343110159..7db46282719 100644 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/package-info.java +++ b/src/main/java/org/spongepowered/api/entity/living/animal/camel/CamelHusk.java @@ -22,5 +22,11 @@ * 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.util.annotation.eventgen; +package org.spongepowered.api.entity.living.animal.camel; + +/** + * Represents a Camel Husk. + * @see Minecraft Wiki + */ +public interface CamelHusk extends Camel { +} diff --git a/src/main/java/org/spongepowered/api/entity/living/animal/horse/HorseLike.java b/src/main/java/org/spongepowered/api/entity/living/animal/horse/HorseLike.java index fc9e61b41a4..46ce2174fbc 100644 --- a/src/main/java/org/spongepowered/api/entity/living/animal/horse/HorseLike.java +++ b/src/main/java/org/spongepowered/api/entity/living/animal/horse/HorseLike.java @@ -27,7 +27,6 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.value.Value; import org.spongepowered.api.entity.Ownable; -import org.spongepowered.api.entity.Saddleable; import org.spongepowered.api.entity.living.animal.Animal; import org.spongepowered.api.item.inventory.Carrier; @@ -35,7 +34,8 @@ /** * An abstract representation of a Horse. */ -public interface HorseLike extends Animal, Ownable, Saddleable, Carrier { +@SuppressWarnings("removal") +public interface HorseLike extends Animal, Ownable, org.spongepowered.api.entity.Saddleable, Carrier { /** * {@link Keys#IS_TAMED} diff --git a/src/main/java/org/spongepowered/api/entity/living/aquatic/Dolphin.java b/src/main/java/org/spongepowered/api/entity/living/aquatic/Dolphin.java index c0f7399565b..4f63568e25b 100644 --- a/src/main/java/org/spongepowered/api/entity/living/aquatic/Dolphin.java +++ b/src/main/java/org/spongepowered/api/entity/living/aquatic/Dolphin.java @@ -26,11 +26,12 @@ import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.entity.Ageable; /** * Represents a Dolphin */ -public interface Dolphin extends Aquatic { +public interface Dolphin extends Aquatic, Ageable { /** * {@link Keys#SKIN_MOISTURE} diff --git a/src/main/java/org/spongepowered/api/entity/living/aquatic/Squid.java b/src/main/java/org/spongepowered/api/entity/living/aquatic/Squid.java index 3d85e1e914e..39cc635e77d 100644 --- a/src/main/java/org/spongepowered/api/entity/living/aquatic/Squid.java +++ b/src/main/java/org/spongepowered/api/entity/living/aquatic/Squid.java @@ -24,9 +24,11 @@ */ package org.spongepowered.api.entity.living.aquatic; +import org.spongepowered.api.entity.Ageable; + /** * Represents a Squid. */ -public interface Squid extends Aquatic { +public interface Squid extends Aquatic, Ageable { } diff --git a/src/main/java/org/spongepowered/api/entity/living/aquatic/fish/school/Salmon.java b/src/main/java/org/spongepowered/api/entity/living/aquatic/fish/school/Salmon.java index 8503cd4cd8f..25e470dedfb 100644 --- a/src/main/java/org/spongepowered/api/entity/living/aquatic/fish/school/Salmon.java +++ b/src/main/java/org/spongepowered/api/entity/living/aquatic/fish/school/Salmon.java @@ -24,5 +24,14 @@ */ package org.spongepowered.api.entity.living.aquatic.fish.school; +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.type.SalmonSize; +import org.spongepowered.api.data.value.Value; + public interface Salmon extends SchoolingFish { + + default Value.Mutable size() { + return this.requireValue(Keys.SALMON_SIZE).asMutable(); + } + } diff --git a/src/main/java/org/spongepowered/api/world/biome/BiomeTemplate.java b/src/main/java/org/spongepowered/api/entity/living/golem/CopperGolem.java similarity index 57% rename from src/main/java/org/spongepowered/api/world/biome/BiomeTemplate.java rename to src/main/java/org/spongepowered/api/entity/living/golem/CopperGolem.java index bd6bae9e47e..77624fa8937 100644 --- a/src/main/java/org/spongepowered/api/world/biome/BiomeTemplate.java +++ b/src/main/java/org/spongepowered/api/entity/living/golem/CopperGolem.java @@ -22,42 +22,32 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.world.biome; +package org.spongepowered.api.entity.living.golem; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.data.Key; +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.type.CopperOxidation; import org.spongepowered.api.data.value.Value; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; -/** - * A template for {@link Biome biomes}. - */ -public interface BiomeTemplate extends DataPackEntry { +public interface CopperGolem extends Golem { - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); + /** + * Gets the {@link Value.Mutable} value of the current {@link CopperOxidation} state + * for this golem. + * + * @return The mutable value, to set it back, use {@link #offer(Value)} + * @see Oxidation + */ + default Value.Mutable oxidation() { + return this.requireValue(Keys.COPPER_OXIDATION).asMutable(); } /** - * Returns the {@link Biome} + * Gets the {@link Value.Mutable} value of the current waxed state. * - * @return The biome + * @return The mutable value, to set it back, use {@link #offer(Value)} + * @see Waxing */ - Biome biome(); - - interface Builder extends DataPackEntryBuilder { - - /** - * Adds the given {@link Key} with the given value. - * - * @param key The key to assign the value with - * @param value The value to assign with the key - * @param The type of the value - * @return This builder, for chaining - */ - Builder add(Key> key, V value); - + default Value.Mutable waxed() { + return this.requireValue(Keys.WAXED).asMutable(); } - } diff --git a/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java b/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java new file mode 100644 index 00000000000..523cbf8c718 --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java @@ -0,0 +1,46 @@ +/* + * 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; + +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.entity.living.Monster; +import org.spongepowered.math.vector.Vector3i; + +import java.util.Optional; + +/** + * A Creaking is a type of monster that originates from the {@link org.spongepowered.api.world.biome.Biomes#PALE_GARDEN} + */ +public interface Creaking extends Monster { + + default Optional> homePosition() { + return this.getValue(Keys.CREAKING_HOME_POSITION).map(Value::asMutable); + } + + default Value.Immutable isLinked() { + return this.requireValue(Keys.CREAKING_IS_LINKED).asImmutable(); + } +} diff --git a/src/main/java/org/spongepowered/api/entity/living/monster/boss/dragon/phase/DragonPhaseType.java b/src/main/java/org/spongepowered/api/entity/living/monster/boss/dragon/phase/DragonPhaseType.java index 31d3e703c2e..d8c6b813653 100644 --- a/src/main/java/org/spongepowered/api/entity/living/monster/boss/dragon/phase/DragonPhaseType.java +++ b/src/main/java/org/spongepowered/api/entity/living/monster/boss/dragon/phase/DragonPhaseType.java @@ -31,6 +31,6 @@ * An {@link DragonPhase} type. */ @CatalogedBy(DragonPhaseTypes.class) -public interface DragonPhaseType extends DefaultedRegistryValue { +public interface DragonPhaseType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/entity/living/monster/skeleton/Parched.java b/src/main/java/org/spongepowered/api/entity/living/monster/skeleton/Parched.java new file mode 100644 index 00000000000..5765f7e7734 --- /dev/null +++ b/src/main/java/org/spongepowered/api/entity/living/monster/skeleton/Parched.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.entity.living.monster.skeleton; + +/** + * Represents a Parched Skeleton. + * See Minecraft Wiki + */ +public interface Parched extends SkeletonLike { +} diff --git a/src/main/java/org/spongepowered/api/entity/living/monster/zombie/Zombie.java b/src/main/java/org/spongepowered/api/entity/living/monster/zombie/Zombie.java index 12a8bf17bdf..17aaa513354 100644 --- a/src/main/java/org/spongepowered/api/entity/living/monster/zombie/Zombie.java +++ b/src/main/java/org/spongepowered/api/entity/living/monster/zombie/Zombie.java @@ -38,6 +38,7 @@ public interface Zombie extends Monster { * * @return Whether this zombie is an adult or not */ + @Override default Value.Mutable adult() { return this.requireValue(Keys.IS_ADULT).asMutable(); } diff --git a/src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java b/src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java index 9a0c1815069..d6e24486881 100644 --- a/src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java +++ b/src/main/java/org/spongepowered/api/entity/living/player/CooldownTracker.java @@ -24,7 +24,9 @@ */ package org.spongepowered.api.entity.living.player; +import org.spongepowered.api.ResourceKey; import org.spongepowered.api.item.ItemType; +import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.util.Ticks; import java.util.Optional; @@ -39,41 +41,56 @@ public interface CooldownTracker { * Checks if the specified {@link ItemType} is currently on cooldown * for the player. * - * @param type The item type to check is on cooldown + * @param stack The item type to check is on cooldown * @return Whether or not the specified item type is cooldown */ - boolean hasCooldown(ItemType type); + boolean hasCooldown(ItemStack stack); + + boolean hasCooldown(ResourceKey group); /** * Gets the cooldown of the specified {@link ItemType} in ticks for the * player, or empty if the the item type is currently not on cooldown. * - * @param type The item type to get the cooldown for + * @param stack The item type to get the cooldown for * @return The cooldown remaining for this item type in ticks, if not * on cooldown */ - Optional cooldown(ItemType type); + Optional cooldown(ItemStack stack); + + /** + * Gets the cooldown for the specified {@link ResourceKey group} in ticks + * for the player, or empty if the group is not on cooldown. + * + * @param group The group to get the cooldown for + * @return The cooldown remaining for this group in ticks, if not on cooldown + */ + Optional cooldown(ResourceKey group); /** * Sets the cooldown for the specified {@link ItemType} for the * specified amount of ticks. * - * @param type The item type to set the cooldown for + * @param stack The item type to set the cooldown for * @param ticks The amount of ticks to set the item type on cooldown for * @return False if setting the cooldown failed, possibly due to the event * being cancelled */ - boolean setCooldown(ItemType type, Ticks ticks); + boolean setCooldown(ItemStack stack, Ticks ticks); + + boolean setCooldown(ResourceKey group, Ticks ticks); /** * Resets the cooldown of the specified {@link ItemType} for the * player. * - * @param type The item type to reset the cooldown for + * @param stack The item type to reset the cooldown for * @return False if setting the cooldown failed, possibly due to the event * being cancelled */ - boolean resetCooldown(ItemType type); + boolean resetCooldown(ItemStack stack); + + boolean resetCooldown(ResourceKey group); /** * Gets the fraction of the specified {@link ItemType}'s cooldown that @@ -82,9 +99,11 @@ public interface CooldownTracker { * *

    If present, this value will be between 0.0 and 1.0.

    * - * @param type The item type to get the cooldown fraction remaining + * @param stack The item type to get the cooldown fraction remaining * @return The fraction of cooldown remaining for the specified item type */ - OptionalDouble fractionRemaining(ItemType type); + OptionalDouble fractionRemaining(ItemStack stack); + + OptionalDouble fractionRemaining(ResourceKey group); } diff --git a/src/main/java/org/spongepowered/api/entity/living/player/chat/ChatVisibility.java b/src/main/java/org/spongepowered/api/entity/living/player/chat/ChatVisibility.java index 9da212b7848..fd185537678 100644 --- a/src/main/java/org/spongepowered/api/entity/living/player/chat/ChatVisibility.java +++ b/src/main/java/org/spongepowered/api/entity/living/player/chat/ChatVisibility.java @@ -32,7 +32,7 @@ * Represents a visibility mode for a client's chat. */ @CatalogedBy(ChatVisibilities.class) -public interface ChatVisibility extends DefaultedRegistryValue, ComponentLike { +public interface ChatVisibility extends DefaultedRegistryValue, ComponentLike { /** * Tests whether system messages will be visible with this visibility diff --git a/src/main/java/org/spongepowered/api/entity/living/player/gamemode/GameMode.java b/src/main/java/org/spongepowered/api/entity/living/player/gamemode/GameMode.java index a8436fa2856..24f252eb04d 100644 --- a/src/main/java/org/spongepowered/api/entity/living/player/gamemode/GameMode.java +++ b/src/main/java/org/spongepowered/api/entity/living/player/gamemode/GameMode.java @@ -25,6 +25,7 @@ package org.spongepowered.api.entity.living.player.gamemode; import net.kyori.adventure.text.ComponentLike; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -33,6 +34,6 @@ * Represents a game mode that a {@link Player} may have. */ @CatalogedBy(GameModes.class) -public interface GameMode extends DefaultedRegistryValue, ComponentLike { +public interface GameMode extends DefaultedRegistryValue, ComponentLike, StringRepresentable { } 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 8829301e1f8..c6f7ca21c9f 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 @@ -30,7 +30,6 @@ import org.spongepowered.api.Server; import org.spongepowered.api.advancement.Advancement; import org.spongepowered.api.advancement.AdvancementProgress; -import org.spongepowered.api.advancement.AdvancementTemplate; import org.spongepowered.api.advancement.AdvancementTree; import org.spongepowered.api.data.Keys; import org.spongepowered.api.data.type.SkinPart; @@ -282,7 +281,7 @@ default SetValue.Mutable displayedSkinParts() { * @param advancement The advancement * @return The advancement progress */ - AdvancementProgress progress(AdvancementTemplate advancement); + AdvancementProgress progress(Advancement advancement); /** * Gets all the {@link AdvancementTree}s that this diff --git a/src/main/java/org/spongepowered/api/entity/living/player/tab/TabListEntry.java b/src/main/java/org/spongepowered/api/entity/living/player/tab/TabListEntry.java index 699bc4cec6d..571666f1b22 100644 --- a/src/main/java/org/spongepowered/api/entity/living/player/tab/TabListEntry.java +++ b/src/main/java/org/spongepowered/api/entity/living/player/tab/TabListEntry.java @@ -167,6 +167,25 @@ static Builder builder() { */ TabListEntry setListed(boolean listed); + /** + * Gets the weight of this entry. + * Entries are first sorted by their weight in + * descending order. + * + * @return The weight of this entry + */ + int weight(); + + /** + * Sets the weight of this entry. + * Entries are first sorted by their weight in + * descending order. + * + * @param weight The new weight + * @return This entry, for chaining + */ + TabListEntry setWeight(int weight); + /** * Represents a builder class to create mutable {@link TabListEntry}s. * @@ -230,6 +249,15 @@ interface Builder extends org.spongepowered.api.util.Builder boatType() { - return this.requireValue(Keys.BOAT_TYPE).asMutable(); - } - /** * {@link Keys#IS_IN_WATER} * diff --git a/src/main/java/org/spongepowered/api/datapack/package-info.java b/src/main/java/org/spongepowered/api/entity/vehicle/Raft.java similarity index 89% rename from src/main/java/org/spongepowered/api/datapack/package-info.java rename to src/main/java/org/spongepowered/api/entity/vehicle/Raft.java index f63075f5e01..b5c77f49d83 100644 --- a/src/main/java/org/spongepowered/api/datapack/package-info.java +++ b/src/main/java/org/spongepowered/api/entity/vehicle/Raft.java @@ -22,5 +22,11 @@ * 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.datapack; +package org.spongepowered.api.entity.vehicle; + +/** + * Represents a Raft kind of boat. + */ +public interface Raft extends Boat { + +} diff --git a/src/main/java/org/spongepowered/api/event/BiGenericEvent.java b/src/main/java/org/spongepowered/api/event/BiGenericEvent.java new file mode 100644 index 00000000000..d72b02a7345 --- /dev/null +++ b/src/main/java/org/spongepowered/api/event/BiGenericEvent.java @@ -0,0 +1,49 @@ +/* + * 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.event; + +import io.leangen.geantyref.TypeToken; + +import java.util.List; + +/** + * {@link GenericEvent} that requires two type parameters. + * + * @param The primary generic type + * @param The secondary generic type + */ +public interface BiGenericEvent extends GenericEvent { + + /** + * Gets the secondary {@link TypeToken generic type}. + * + * @return The type token + */ + TypeToken secondaryParamType(); + + default List> paramTypes() { + return List.of(this.paramType(), this.secondaryParamType()); + } +} diff --git a/src/main/java/org/spongepowered/api/event/Cancellable.java b/src/main/java/org/spongepowered/api/event/Cancellable.java index 7a5b5bd7bd7..2ad6bc82887 100644 --- a/src/main/java/org/spongepowered/api/event/Cancellable.java +++ b/src/main/java/org/spongepowered/api/event/Cancellable.java @@ -24,7 +24,7 @@ */ package org.spongepowered.api.event; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.PropertySettings; /** * Represents an event that can be cancelled. diff --git a/src/main/java/org/spongepowered/api/event/Cause.java b/src/main/java/org/spongepowered/api/event/Cause.java index ede6a617623..a1b42f7f59c 100644 --- a/src/main/java/org/spongepowered/api/event/Cause.java +++ b/src/main/java/org/spongepowered/api/event/Cause.java @@ -27,6 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.DoNotStore; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.ArrayList; import java.util.Arrays; @@ -54,6 +55,7 @@ */ @DoNotStore @SuppressWarnings("unchecked") +@NoFactoryMethod public final class Cause implements Iterable { /** diff --git a/src/main/java/org/spongepowered/api/event/CompositeEvent.java b/src/main/java/org/spongepowered/api/event/CompositeEvent.java new file mode 100644 index 00000000000..5fa4a10819a --- /dev/null +++ b/src/main/java/org/spongepowered/api/event/CompositeEvent.java @@ -0,0 +1,81 @@ +/* + * 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.event; + +import org.spongepowered.api.event.impl.AbstractCompositeEvent; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.PropertySettings; + +import java.util.List; +import java.util.function.Consumer; + +/** + * A {@link CompositeEvent} is an {@link Event} that contains multiple + * side effectual {@link Event Events}, which may have their own side effects + * and may be {@link Cancellable}. In some cases, the interactions of this event + * may be cancellable as a whole, but are not guaranteed to revert all side + * effects on the {@link org.spongepowered.api.Game}. The {@link #children()} of + * this event are ordered in a "best-effort" basis, and may not be guaranteed + * to be in any particular order. + *

    Using {@link #setCancelled(boolean)} will perform a best effort cancellation + * on each of the children events. + */ +@GenerateFactoryMethod +@ImplementedBy(AbstractCompositeEvent.class) +public interface CompositeEvent extends Event, Cancellable { + + @PropertySettings(useInToString = false) + E baseEvent(); + + List children(); + + default List event(Class type) { + return this.children().stream() + .filter(type::isInstance) + .map(type::cast) + .toList(); + } + + default void applyTo(Class type, Consumer consumer) { + this.children().stream() + .filter(type::isInstance) + .map(type::cast) + .forEach(consumer); + } + + /** + * {@inheritDoc} + * + * Cancels this event and all related events captured {@link #children()}. + * Selectively, if individual events are wished to be cancelled, + * the individual events should be cancelled instead. + * + * @param cancel The new cancelled state + */ + @PropertySettings(generateMethods = false) + @Override + void setCancelled(boolean cancel); +} diff --git a/src/main/java/org/spongepowered/api/event/Event.java b/src/main/java/org/spongepowered/api/event/Event.java index 9496098700f..bcf481f4987 100644 --- a/src/main/java/org/spongepowered/api/event/Event.java +++ b/src/main/java/org/spongepowered/api/event/Event.java @@ -26,8 +26,8 @@ import org.spongepowered.api.event.impl.AbstractEvent; import org.spongepowered.api.util.annotation.DoNotStore; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; +import org.spongepowered.eventgen.annotations.ImplementedBy; /** * An event called within Sponge. diff --git a/src/main/java/org/spongepowered/api/event/EventContext.java b/src/main/java/org/spongepowered/api/event/EventContext.java index 645f1f66912..96aa907de4d 100644 --- a/src/main/java/org/spongepowered/api/event/EventContext.java +++ b/src/main/java/org/spongepowered/api/event/EventContext.java @@ -27,6 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.DoNotStore; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.HashMap; import java.util.Map; @@ -42,6 +43,7 @@ * in the event's {@link Cause}. */ @DoNotStore +@NoFactoryMethod public final class EventContext { private static final EventContext EMPTY_CONTEXT = new EventContext(Map.of()); diff --git a/src/main/java/org/spongepowered/api/event/EventContextKeys.java b/src/main/java/org/spongepowered/api/event/EventContextKeys.java index a8019aafd34..17df7c6cb0f 100644 --- a/src/main/java/org/spongepowered/api/event/EventContextKeys.java +++ b/src/main/java/org/spongepowered/api/event/EventContextKeys.java @@ -53,6 +53,7 @@ import org.spongepowered.api.world.portal.PortalLogic; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.api.world.server.ServerWorld; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.math.vector.Vector3d; import org.spongepowered.plugin.PluginContainer; @@ -62,6 +63,7 @@ * Standard keys for use within {@link EventContext}s. */ @SuppressWarnings("unused") +@NoFactoryMethod public final class EventContextKeys { // @formatter:off diff --git a/src/main/java/org/spongepowered/api/event/EventManager.java b/src/main/java/org/spongepowered/api/event/EventManager.java index db0842a4398..5a7ea2bb711 100644 --- a/src/main/java/org/spongepowered/api/event/EventManager.java +++ b/src/main/java/org/spongepowered/api/event/EventManager.java @@ -51,7 +51,11 @@ public interface EventManager { * @param plugin The plugin container * @param obj The object * @return This manager, for fluency + * @deprecated In order to be compatible with the JPMS, it is highly + * recommended that plugins instead use the + * {@link #registerListeners(PluginContainer, Object, MethodHandles.Lookup)} overload. */ + @Deprecated(since = "13") EventManager registerListeners(PluginContainer plugin, Object obj); /** diff --git a/src/main/java/org/spongepowered/api/event/GenericEvent.java b/src/main/java/org/spongepowered/api/event/GenericEvent.java index 1d7c4988679..7e44df38bf8 100644 --- a/src/main/java/org/spongepowered/api/event/GenericEvent.java +++ b/src/main/java/org/spongepowered/api/event/GenericEvent.java @@ -26,6 +26,8 @@ import io.leangen.geantyref.TypeToken; +import java.util.List; + /** * All {@link Event}s that require a generic type should implement this * interface. @@ -40,4 +42,13 @@ public interface GenericEvent extends Event { * @return The type token */ TypeToken paramType(); + + /** + * Gets all the {@link TypeToken generic type}'s. + * + * @return The list of type tokens + */ + default List> paramTypes() { + return List.of(this.paramType()); + } } diff --git a/src/main/java/org/spongepowered/api/event/Listener.java b/src/main/java/org/spongepowered/api/event/Listener.java index 776dcb0d1c3..2873fd2e5aa 100644 --- a/src/main/java/org/spongepowered/api/event/Listener.java +++ b/src/main/java/org/spongepowered/api/event/Listener.java @@ -24,6 +24,8 @@ */ package org.spongepowered.api.event; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -34,6 +36,7 @@ */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) +@NoFactoryMethod public @interface Listener { /** diff --git a/src/main/java/org/spongepowered/api/event/action/CollideEvent.java b/src/main/java/org/spongepowered/api/event/action/CollideEvent.java index 30404ad787f..31dae13241d 100644 --- a/src/main/java/org/spongepowered/api/event/action/CollideEvent.java +++ b/src/main/java/org/spongepowered/api/event/action/CollideEvent.java @@ -28,8 +28,8 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; import org.spongepowered.api.world.server.ServerLocation; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Fired when an {@link Entity} or {@link BlockSnapshot} collide with each other. diff --git a/src/main/java/org/spongepowered/api/event/action/InteractEvent.java b/src/main/java/org/spongepowered/api/event/action/InteractEvent.java index e3f3f889130..4f4ea4a3528 100644 --- a/src/main/java/org/spongepowered/api/event/action/InteractEvent.java +++ b/src/main/java/org/spongepowered/api/event/action/InteractEvent.java @@ -25,10 +25,12 @@ package org.spongepowered.api.event.action; import org.spongepowered.api.event.Event; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Base event for all interactions. */ +@NoFactoryMethod public interface InteractEvent extends Event { } diff --git a/src/main/java/org/spongepowered/api/event/advancement/AdvancementTreeEvent.java b/src/main/java/org/spongepowered/api/event/advancement/AdvancementTreeEvent.java index 880b5237187..14498e4e194 100644 --- a/src/main/java/org/spongepowered/api/event/advancement/AdvancementTreeEvent.java +++ b/src/main/java/org/spongepowered/api/event/advancement/AdvancementTreeEvent.java @@ -26,6 +26,7 @@ import org.spongepowered.api.advancement.AdvancementTree; import org.spongepowered.api.event.Event; +import org.spongepowered.api.registry.RegistryHolder; /** * A base interface for all the {@link AdvancementTree} events. @@ -47,5 +48,11 @@ public interface AdvancementTreeEvent extends Event { */ interface GenerateLayout extends AdvancementTreeEvent { + /** + * Gets the owning {@link RegistryHolder registry holder}. + * + * @return The registry holder. + */ + RegistryHolder registryHolder(); } } diff --git a/src/main/java/org/spongepowered/api/event/block/InteractBlockEvent.java b/src/main/java/org/spongepowered/api/event/block/InteractBlockEvent.java index 161452c8bdf..0f4e6e44f66 100644 --- a/src/main/java/org/spongepowered/api/event/block/InteractBlockEvent.java +++ b/src/main/java/org/spongepowered/api/event/block/InteractBlockEvent.java @@ -29,11 +29,15 @@ import org.spongepowered.api.block.BlockTypes; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.Cancellable; +import org.spongepowered.api.event.CompositeEvent; import org.spongepowered.api.event.action.InteractEvent; +import org.spongepowered.api.event.impl.AbstractCompositeEvent; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.util.Direction; import org.spongepowered.api.util.Tristate; import org.spongepowered.api.world.server.ServerLocation; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.ImplementedBy; import org.spongepowered.math.vector.Vector3d; /** @@ -101,7 +105,8 @@ interface Finish extends Primary, Cancellable { * *

    This is usually right-click.

    */ - interface Secondary extends InteractBlockEvent, Cancellable { + @GenerateFactoryMethod + interface Secondary extends InteractBlockEvent { Tristate originalUseItemResult(); @@ -143,43 +148,86 @@ interface Secondary extends InteractBlockEvent, Cancellable { */ Tristate useBlockResult(); - /** - * Sets whether the {@link Player#itemInHand} should be used. - * - *
      - *
    • FALSE: The {@link ItemStack} will never be used.
    • - *
    • UNDEFINED: The {@link ItemStack} will be used if the block fails. - *
    • - *
    • TRUE: The {@link ItemStack} will always be used.
    • - *
    - * - *

    Note: These results may differ depending on implementation.

    - * - * @param result Whether the {@link Player#itemInHand} should be used - */ - void setUseItemResult(Tristate result); - - /** - * Sets whether the interacted {@link BlockSnapshot} should be used. - * - *
      - *
    • FALSE: {@link BlockSnapshot} will never be used.
    • - *
    • UNDEFINED: {@link BlockSnapshot} will be used as normal.
    • - *
    • TRUE: {@link BlockSnapshot} will always be used.
    • - *
    - * - *

    Note: These results may differ depending on implementation.

    - * - * @param result Whether the interacted {@link BlockSnapshot} should be - * used - */ - void setUseBlockResult(Tristate result); - /** * Gets the point of interaction where the interaction occurred as a {@link Vector3d}. * * @return The interaction point */ Vector3d interactionPoint(); + + interface Pre extends Secondary, Cancellable { + + /** + * Sets whether the {@link Player#itemInHand} should be used. + * + *
      + *
    • FALSE: The {@link ItemStack} will never be used.
    • + *
    • UNDEFINED: The {@link ItemStack} will be used if the block fails. + *
    • + *
    • TRUE: The {@link ItemStack} will always be used.
    • + *
    + * + *

    Note: These results may differ depending on implementation.

    + * + * @param result Whether the {@link Player#itemInHand} should be used + */ + void setUseItemResult(Tristate result); + + /** + * Sets whether the interacted {@link BlockSnapshot} should be used. + * + *
      + *
    • FALSE: {@link BlockSnapshot} will never be used.
    • + *
    • UNDEFINED: {@link BlockSnapshot} will be used as normal.
    • + *
    • TRUE: {@link BlockSnapshot} will always be used.
    • + *
    + * + *

    Note: These results may differ depending on implementation.

    + * + * @param result Whether the interacted {@link BlockSnapshot} should be + * used + */ + void setUseBlockResult(Tristate result); + } + + @ImplementedBy(AbstractCompositeEvent.class) + interface Post extends Secondary, CompositeEvent { + + @Override + default Tristate originalUseItemResult() { + return this.baseEvent().originalUseItemResult(); + } + + @Override + default Tristate originalUseBlockResult() { + return this.baseEvent().originalUseBlockResult(); + } + + @Override + default Tristate useItemResult() { + return this.baseEvent().useItemResult(); + } + + @Override + default Tristate useBlockResult() { + return this.baseEvent().useBlockResult(); + } + + @Override + default Vector3d interactionPoint() { + return this.baseEvent().interactionPoint(); + } + + @Override + default BlockSnapshot block() { + return this.baseEvent().block(); + } + + @Override + default Direction targetSide() { + return this.baseEvent().targetSide(); + } + } + } } diff --git a/src/main/java/org/spongepowered/api/event/block/NotifyNeighborBlockEvent.java b/src/main/java/org/spongepowered/api/event/block/NotifyNeighborBlockEvent.java index e19dd50b550..a195afb6d62 100644 --- a/src/main/java/org/spongepowered/api/event/block/NotifyNeighborBlockEvent.java +++ b/src/main/java/org/spongepowered/api/event/block/NotifyNeighborBlockEvent.java @@ -33,23 +33,50 @@ import java.util.function.Predicate; /** - * + * Fired when a neighbour notification is being proposed to the engine. */ public interface NotifyNeighborBlockEvent extends Event, Cancellable { + /** + * Gets a list of the {@link NotificationTicket}s for this event. + * If a ticket is requested to be marked as "invalid", + * {@link NotificationTicket#setValid(boolean)} can be used. + * + * @return The unmodifiable list of tickets + */ List tickets(); + /** + * Applies the provided {@link Predicate} to the {@link List} of + * {@link NotificationTicket}s from {@link #tickets()} such that + * any time that {@link Predicate#test(Object)} returns {@code false} + * on the location of the {@link NotificationTicket}, the + * {@link NotificationTicket} is marked as "invalid". + * + *

    {@link NotificationTicket#targetPosition()} is used to get the {@link Vector3i}

    + * + * @param predicate The predicate to use for filtering + */ default void filterTargetPositions(final Predicate predicate) { this.tickets().forEach(ticket -> { - if (predicate.test(ticket.targetPosition())) { + if (!predicate.test(ticket.targetPosition())) { ticket.setValid(false); } }); } + /** + * Applies the provided {@link Predicate} to the {@link List} of + * {@link NotificationTicket}s from {@link #tickets()} such that + * any time that {@link Predicate#test(Object)} returns {@code false} + * on the location of the {@link NotificationTicket}, the + * {@link NotificationTicket} is marked as "invalid". + * + * @param predicate The predicate to use for filtering + */ default void filterTickets(final Predicate predicate) { this.tickets().forEach(ticket -> { - if (predicate.test(ticket)) { + if (!predicate.test(ticket)) { ticket.setValid(false); } }); diff --git a/src/main/java/org/spongepowered/api/event/block/ScheduleBlockUpdateEvent.java b/src/main/java/org/spongepowered/api/event/block/ScheduleBlockUpdateEvent.java index ac3fb5f7823..0b4a5f748bd 100644 --- a/src/main/java/org/spongepowered/api/event/block/ScheduleBlockUpdateEvent.java +++ b/src/main/java/org/spongepowered/api/event/block/ScheduleBlockUpdateEvent.java @@ -37,7 +37,7 @@ * Fired when a {@link ScheduledUpdate scheduled block update} * is being proposed to the engine. */ -public interface ScheduleBlockUpdateEvent extends GenericEvent, Cancellable { +public interface ScheduleBlockUpdateEvent extends GenericEvent, Cancellable { /** * Gets a list of the {@link ScheduleUpdateTicket}s for this event. diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/DismountType.java b/src/main/java/org/spongepowered/api/event/cause/entity/DismountType.java index c81867891dd..bb41b2a7a8c 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/DismountType.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/DismountType.java @@ -31,6 +31,6 @@ * Used to set the {@link org.spongepowered.api.event.EventContextKeys#DISMOUNT_TYPE} in {@link org.spongepowered.api.event.entity.RideEntityEvent.Dismount dismount events}. */ @CatalogedBy(DismountTypes.class) -public interface DismountType extends DefaultedRegistryValue { +public interface DismountType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/MovementType.java b/src/main/java/org/spongepowered/api/event/cause/entity/MovementType.java index 426777de434..168cef60e9f 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/MovementType.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/MovementType.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(MovementTypes.class) -public interface MovementType extends DefaultedRegistryValue { +public interface MovementType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/MovementTypes.java b/src/main/java/org/spongepowered/api/event/cause/entity/MovementTypes.java index e8dd1f11567..9980cbd6e22 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/MovementTypes.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/MovementTypes.java @@ -57,6 +57,8 @@ public final class MovementTypes { public static final DefaultedRegistryReference PORTAL = MovementTypes.key(ResourceKey.sponge("portal")); + public static final DefaultedRegistryReference SPECTATOR = MovementTypes.key(ResourceKey.sponge("spectator")); + // SORTFIELDS:OFF // @formatter:on diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/SpawnType.java b/src/main/java/org/spongepowered/api/event/cause/entity/SpawnType.java index 8d94d3cdc6b..97c07608858 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/SpawnType.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/SpawnType.java @@ -32,6 +32,6 @@ * Represents a type of "spawning" for a {@link SpawnEntityEvent}. */ @CatalogedBy(SpawnTypes.class) -public interface SpawnType extends DefaultedRegistryValue { +public interface SpawnType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageEffect.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageEffect.java index 09b24d48657..8a181b7488f 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageEffect.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageEffect.java @@ -24,11 +24,12 @@ */ package org.spongepowered.api.event.cause.entity.damage; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(DamageEffects.class) -public interface DamageEffect extends DefaultedRegistryValue { +public interface DamageEffect extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageFunction.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageFunction.java deleted file mode 100644 index 6efb3adc728..00000000000 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageFunction.java +++ /dev/null @@ -1,120 +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.event.cause.entity.damage; - -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.Objects; -import java.util.StringJoiner; -import java.util.function.DoubleUnaryOperator; - -public class DamageFunction implements ModifierFunction { - - public static final DoubleUnaryOperator ZERO_DAMAGE = value -> 0.0D; - - /** - * Constructs a new damage function. - * - * @param first The damage modifier to use - * @param second The unary operator to use - * @return The resulting damage function - */ - public static DamageFunction of(final DamageModifier first, final DoubleUnaryOperator second) { - return new DamageFunction(first, second); - } - - private final DamageModifier modifier; - private final DoubleUnaryOperator function; - - /** - * Creates a new {@link DamageFunction} with the provided - * {@link DamageModifier}. The caveat is that the provided - * {@link DamageFunction} is by default going to provide {@code 0} - * damage modifications. - * - * @param modifier The damage modifier - */ - public DamageFunction(final DamageModifier modifier) { - this(modifier, DamageFunction.ZERO_DAMAGE); - } - - /** - * Creates a new {@link DamageFunction} with the provided - * {@link DamageModifier} and {@link DoubleUnaryOperator}. - * - * @param modifier The modifier - * @param function The function - */ - public DamageFunction(final DamageModifier modifier, final DoubleUnaryOperator function) { - this.modifier = java.util.Objects.requireNonNull(modifier, "modifier"); - this.function = java.util.Objects.requireNonNull(function, "function"); - } - - /** - * Gets the {@link DamageModifier} for this function. - * - * @return The damage modifier - */ - @Override - public DamageModifier modifier() { - return this.modifier; - } - - /** - * Gets the {@link DoubleUnaryOperator} for this function. - * - * @return The damage function - */ - @Override - public DoubleUnaryOperator function() { - return this.function; - } - - @Override - public String toString() { - return new StringJoiner(",", DamageFunction.class.getSimpleName() + "[", "]") - .add("modifier=" + this.modifier()) - .add("function=" + this.function()) - .toString(); - } - - @Override - public boolean equals(final @Nullable Object o) { - if (this == o) { - return true; - } - if (o == null || this.getClass() != o.getClass()) { - return false; - } - final DamageFunction that = (DamageFunction) o; - return Objects.equals(this.modifier, that.modifier) - && Objects.equals(this.function, that.function); - } - - @Override - public int hashCode() { - return Objects.hash(this.modifier, this.function); - } -} diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifier.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifier.java index 65e99fa592a..d4359d29dc3 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifier.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifier.java @@ -24,255 +24,87 @@ */ package org.spongepowered.api.event.cause.entity.damage; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.event.Cause; -import org.spongepowered.api.item.ItemTypes; -import org.spongepowered.api.item.enchantment.Enchantment; -import org.spongepowered.api.item.inventory.ItemStack; -import org.spongepowered.api.item.inventory.ItemStackLike; -import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.CopyableBuilder; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.event.CauseStackManager; -import java.util.Objects; import java.util.Optional; -import java.util.StringJoiner; -import java.util.function.DoubleUnaryOperator; -import java.util.function.Supplier; +import java.util.function.Consumer; /** - * Represents a modifier that will apply a function on a damage value to deal - * towards an entity such that the raw damage is the input of a - * {@link DoubleUnaryOperator} such that the output will be the final damage - * applied to the {@link Entity}. + * A damage modifier that will create a {@link DamageStep}. */ public interface DamageModifier { /** - * Creates a new {@link Builder} for constructing a {@link DamageModifier}. + * Gets the {@link DamageStepType} of this modifier. * - * @return A new builder + * @return the step type */ - static Builder builder() { - return new Builder(); - } + DamageStepType type(); /** - * Gets the {@link DamageModifierType} for this {@link DamageModifier}. + * Gets the consumer that will modify the cause frame. * - * @return The damage modifier type + * @return The cause frame modifier */ - DamageModifierType type(); + Optional> frameModifier(); /** - * Returns the damage modifier group. - *

    Grouped modifiers calculate their damage independently from each other

    + * Gets the function that will modify the damage. + * The function may be absent if the sole purpose of this modifier is to apply children steps. * - * @return The damage modifier group + * @return the damage modifier */ - String group(); + Optional damageFunction(); - /** - * Gets the cause of this {@link DamageModifier}. - * - * @return The cause of this damage modifier - */ - Cause cause(); + @FunctionalInterface + interface Function { + /** + * Modifies the damage. + * + * @param step The damage step this modifier is associated with. + * @param damage The current damage value. + * @return The next damage value + */ + double modify(DamageStep step, double damage); + } /** - * Gets the contributing {@link ItemStackSnapshot} that provided the - * "reason" for this {@link DamageModifier} to exist. An example of a - * contributing {@link ItemStack} is if an {@link ItemTypes#DIAMOND_SWORD} - * provided an {@link Enchantment} that provided a - * {@link DamageModifierTypes#WEAPON_ENCHANTMENT}, this modifier would have - * the {@link ItemStackSnapshot} for the weapon used. Some modifiers however, - * do not require an {@link ItemStack} to be the contributing factor for - * this modifier to exist. + * Creates a new {@link Builder} to create {@link DamageModifier}s. * - * @return The contributing item, if available + * @return The new builder */ - Optional contributingItem(); + static Builder builder() { + return Sponge.game().builderProvider().provide(Builder.class); + } /** - * A builder that creates {@link DamageModifier}s, for use in both plugin and - * implementation requirements. + * A builder to create {@link DamageModifier}s. */ - final class Builder implements org.spongepowered.api.util.Builder, CopyableBuilder { - - @Nullable DamageModifierType type; - @Nullable Cause cause; - @Nullable String group; - @Nullable ItemStackSnapshot snapshot; - - Builder() { - } - - - /** - * Sets the {@link DamageModifierType} for the {@link DamageModifier} to - * build. - * - * @param damageModifierType The damage modifier type - * @return This builder, for chaining - */ - public Builder type(final Supplier damageModifierType) { - return this.type(damageModifierType.get()); - } + interface Builder extends org.spongepowered.api.util.Builder { /** - * Sets the {@link DamageModifierType} for the {@link DamageModifier} to - * build. + * Sets the {@link DamageStepType} for this modifier. * - * @param damageModifierType The damage modifier type - * @return This builder, for chaining + * @param type The damage step type + * @return this builder for chaining */ - public Builder type(final DamageModifierType damageModifierType) { - this.type = java.util.Objects.requireNonNull(damageModifierType); - return this; - } + Builder type(DamageStepType type); /** - * The main attack damage calculated for an {@link org.spongepowered.api.event.entity.AttackEntityEvent} + * Sets the cause frame modifier. * - * @return This builder, for chaining + * @param frameModifier The frame modifier + * @return this builder for chaining */ - public Builder attackDamageGroup() { - return this.group("minecraft:attack_damage"); - } + Builder frameModifier(Consumer frameModifier); /** - * The enchantment attack damage calculated for an {@link org.spongepowered.api.event.entity.AttackEntityEvent} + * Sets the {@link Function} for this modifier. * - * @return This builder, for chaining + * @param function The damage function + * @return this builder for chaining */ - public Builder attackEnchantmentGroup() { - return this.group("minecraft:attack_enchantment"); - } - - /** - * The damage calculated for an {@link org.spongepowered.api.event.entity.DamageEntityEvent} - * - * @return This builder, for chaining - */ - public Builder damageReductionGroup() { - return this.group("minecraft:damage_reduction"); - } - - public Builder group(final String group) { - this.group = group; - return this; - } - - public Builder item(final ItemStackLike item) { - this.snapshot = java.util.Objects.requireNonNull(item, "item").asImmutable(); - return this; - } - - /** - * Sets the {@link Cause} for the {@link DamageModifier} to build. - * - * @param cause The cause for the damage modifier - * @return This builder, for chaining - */ - public Builder cause(final Cause cause) { - this.cause = java.util.Objects.requireNonNull(cause); - return this; - } - - /** - * Creates a new {@link DamageModifier} with this builder's provided - * {@link Cause} and {@link DamageModifierType}. - * - * @return The newly created damage modifier - */ - @Override - public DamageModifier build() { - if (this.type == null) { - throw new IllegalStateException("The DamageModifierType must not be null!"); - } - if (this.cause == null) { - throw new IllegalStateException("The cause for the DamageModifier must not be null!"); - } - return new ImplementedDamageModifier(this); - } - - @Override - public Builder from(final DamageModifier value) { - this.type = value.type(); - this.cause = value.cause(); - this.snapshot = value.contributingItem().orElse(null); - return this; - } - - @Override - public Builder reset() { - this.type = null; - this.cause = null; - return this; - } - - - private static class ImplementedDamageModifier implements DamageModifier { - private final DamageModifierType type; - private final Cause cause; - @Nullable private final ItemStackSnapshot snapshot; - private final String group; - - ImplementedDamageModifier(final Builder builder) { - this.type = java.util.Objects.requireNonNull(builder.type, "DamageType is null!"); - this.cause = java.util.Objects.requireNonNull(builder.cause, "Cause is null!"); - this.group = java.util.Objects.requireNonNull(builder.group, "Group is null!"); - this.snapshot = builder.snapshot; - } - - @Override - public DamageModifierType type() { - return this.type; - } - - @Override - public Cause cause() { - return this.cause; - } - - @Override - public Optional contributingItem() { - return Optional.ofNullable(this.snapshot); - } - - @Override - public String group() { - return group; - } - - @Override - public int hashCode() { - return Objects.hash(this.type, this.cause); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null || this.getClass() != obj.getClass()) { - return false; - } - final ImplementedDamageModifier other = (ImplementedDamageModifier) obj; - return Objects.equals(this.type, other.type) - && Objects.equals(this.cause, other.cause) - && Objects.equals(this.snapshot, other.snapshot); - } - - @Override - public String toString() { - return new StringJoiner(", ", "DamageModifier[", "]") - .add("type=" + this.type) - .add("cause=" + this.cause) - .add("snapshot=" + this.snapshot) - .toString(); - } - } - + Builder damageFunction(Function function); } } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifierTypes.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifierTypes.java deleted file mode 100644 index 69fe4d3804f..00000000000 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifierTypes.java +++ /dev/null @@ -1,199 +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.event.cause.entity.damage; - -import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.effect.potion.PotionEffect; -import org.spongepowered.api.effect.potion.PotionEffectType; -import org.spongepowered.api.effect.potion.PotionEffectTypes; -import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.entity.living.player.Player; -import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; -import org.spongepowered.api.item.enchantment.Enchantment; -import org.spongepowered.api.item.enchantment.EnchantmentType; -import org.spongepowered.api.item.inventory.ItemStack; -import org.spongepowered.api.item.inventory.ItemStackSnapshot; -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; -import org.spongepowered.api.world.World; -import org.spongepowered.api.world.difficulty.Difficulty; - -@SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.GAME) -public final class DamageModifierTypes { - - // @formatter:off - - // SORTFIELDS:ON - - /** - * Represents a {@link DamageModifier} that "absorbs" damage based on - * the {@link PotionEffectTypes#ABSORPTION} level on the - * {@link Entity}. - */ - public static final DefaultedRegistryReference ABSORPTION = DamageModifierTypes.key(ResourceKey.sponge("absorption")); - - /** - * Represents a {@link DamageModifier} that will reduce damage based on - * the armor {@link ItemStack}s. - */ - public static final DefaultedRegistryReference ARMOR = DamageModifierTypes.key(ResourceKey.sponge("armor")); - - /** - * Represents a {@link DamageModifier} that will reduce damage based on - * the {@link EnchantmentType}s applicable to an {@link ItemStack} that is - * considered to be "armor" currently equipped on the owner. - * - *

    Usually, within the {@link DamageModifier#cause ()} will reside - * an {@link ItemStackSnapshot} and an {@link Enchantment} signifying - * that the {@link EnchantmentType} of the {@link ItemStack} is modifying the - * incoming/outgoing damage. There can be multiple {@link DamageModifier}s - * of this type in a single event due to the variety of possibilities in - * customization of armor handling.

    - */ - public static final DefaultedRegistryReference ARMOR_ENCHANTMENT = DamageModifierTypes.key(ResourceKey.sponge("armor_enchantment")); - - /** - * Represents the {@link DamageModifier} that will reduce damage from a - * {@link Player} if their attack cooldown has not been completed yet. - */ - public static final DefaultedRegistryReference ATTACK_COOLDOWN = DamageModifierTypes.key(ResourceKey.sponge("attack_cooldown")); - - /** - * Represents a {@link DamageModifier} that will modify damage from the attacks strength. - *

    For vanilla this only reduces damage when repeating attacks too quickly

    - */ - public static final DefaultedRegistryReference ATTACK_STRENGTH = DamageModifierTypes.key(ResourceKey.sponge("attack_strength")); - - /** - * Represents the {@link DamageModifier} that will modify damage output - * based on the fact that the attacking source is critically hitting the - * target. - */ - public static final DefaultedRegistryReference CRITICAL_HIT = DamageModifierTypes.key(ResourceKey.sponge("critical_hit")); - - /** - * Represents a {@link DamageModifier} that will reduce damage based on - * the {@link PotionEffectTypes#RESISTANCE} or any other - * {@link PotionEffectType} that can be deemed as reducing incoming damage. - * - *

    Usually, within the {@link DamageModifier#cause ()} will reside - * a {@link PotionEffect} including the amplifier and duration, signifying - * that the {@link PotionEffectType} is modifying the incoming damage.

    - */ - public static final DefaultedRegistryReference DEFENSIVE_POTION_EFFECT = DamageModifierTypes.key(ResourceKey.sponge("defensive_potion_effect")); - - /** - * Represents a {@link DamageModifier} that enhances damage based on the - * current {@link Difficulty} of the {@link World}. - */ - public static final DefaultedRegistryReference DIFFICULTY = DamageModifierTypes.key(ResourceKey.sponge("difficulty")); - - /** - * Represents a {@link DamageModifier} that will modify freezing damage. - * E.g. {@link org.spongepowered.api.entity.living.monster.Blaze} take more damage from freezing sources. - */ - public static final DefaultedRegistryReference FREEZING_BONUS = DamageModifierTypes.key(ResourceKey.sponge("freezing_bonus")); - - - /** - * Represents the {@link DamageModifier} that will modify damage from - * a {@link DamageSource#source()} that is a {@link org.spongepowered.api.entity.FallingBlock}. - * - *

    Usually, within the {@link DamageModifier#cause ()} will reside - * an {@link ItemStackSnapshot} and an {@link Enchantment} signifying - * that the {@link EnchantmentType} of the {@link ItemStack} is modifying the - * incoming/outgoing damage.

    - */ - public static final DefaultedRegistryReference HARD_HAT = DamageModifierTypes.key(ResourceKey.sponge("hard_hat")); - - /** - * Represents a {@link DamageModifier} that will modify damage based on - * magic. - */ - public static final DefaultedRegistryReference MAGIC = DamageModifierTypes.key(ResourceKey.sponge("magic")); - - /** - * Represents a {@link DamageModifier} that will reduce outgoing damage - * based on a {@link PotionEffect}. - * - *

    Usually, within the {@link DamageModifier#cause ()} will reside - * a {@link PotionEffect} including the amplifier and duration, signifying - * that the {@link PotionEffectType} is reducing the outgoing damage.

    - */ - public static final DefaultedRegistryReference NEGATIVE_POTION_EFFECT = DamageModifierTypes.key(ResourceKey.sponge("negative_potion_effect")); - - /** - * Represents the {@link DamageModifier} that will increase damage from - * a {@link PotionEffect} affecting the attacker. - */ - public static final DefaultedRegistryReference OFFENSIVE_POTION_EFFECT = DamageModifierTypes.key(ResourceKey.sponge("offensive_potion_effect")); - - /** - * Represents a {@link DamageModifier} that will reduce damage due to using a shield. - */ - public static final DefaultedRegistryReference SHIELD = DamageModifierTypes.key(ResourceKey.sponge("shield")); - - /** - * Represents a {@link DamageModifier} that is applied for a sweeping attack. - */ - public static final DefaultedRegistryReference SWEEPING = DamageModifierTypes.key(ResourceKey.sponge("sweeping")); - - /** - * Represents a {@link DamageModifier} that will add bonus damage based on the weapon used. - */ - public static final DefaultedRegistryReference WEAPON_BONUS = DamageModifierTypes.key(ResourceKey.sponge("weapon_bonus")); - - /** - * Represents the {@link DamageModifier} that will modify damage from - * an {@link EnchantmentType} on an equipped {@link ItemStack}. - * - *

    Usually, within the {@link DamageModifier#cause ()} will reside - * an {@link ItemStackSnapshot} and an {@link Enchantment} signifying - * that the {@link EnchantmentType} of the {@link ItemStack} is modifying the - * incoming/outgoing damage.

    - */ - public static final DefaultedRegistryReference WEAPON_ENCHANTMENT = DamageModifierTypes.key(ResourceKey.sponge("weapon_enchantment")); - - // SORTFIELDS:OFF - - // @formatter:on - - private DamageModifierTypes() { - } - - public static Registry registry() { - return Sponge.game().registry(RegistryTypes.DAMAGE_MODIFIER_TYPE); - } - - private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.DAMAGE_MODIFIER_TYPE, location).asDefaultedReference(Sponge::game); - } -} diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageScaling.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageScaling.java index cc22b9a9220..a70f216cc26 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageScaling.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageScaling.java @@ -24,11 +24,11 @@ */ package org.spongepowered.api.event.cause.entity.damage; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; - @CatalogedBy(DamageScalings.class) -public interface DamageScaling extends DefaultedRegistryValue { +public interface DamageScaling extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStep.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStep.java new file mode 100644 index 00000000000..3cbd226e1a8 --- /dev/null +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStep.java @@ -0,0 +1,199 @@ +/* + * 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.event.cause.entity.damage; + +import org.spongepowered.api.event.Cause; + +import java.util.EnumSet; +import java.util.List; +import java.util.Optional; +import java.util.OptionalDouble; +import java.util.Set; + +/** + * A step represent an operation made by the platform (vanilla and mods) or modifiers added by plugins. + * Steps are structured as trees where children modify the input or output of the parent step. + * A damage calculation is made of multiple trees of steps. + */ +public interface DamageStep { + + /** + * Gets the {@link DamageStepType} of this step. + * + * @return the step type + */ + DamageStepType type(); + + /** + * Gets the {@link Cause} of this step. + * + * @return The cause of this step + */ + Cause cause(); + + /** + * Gets whether this step is skipped. + * When skipped, only the step itself and its side effects are ignored, children are still applied. + * A modifier willing to ignore every previous children should revert the damage to {@link #damageBeforeChildren()}, + * or call {@link #skip} on each child. + * + * @return Whether this step is skipped + */ + boolean isSkipped(); + + /** + * Sets whether this step is skipped. + * + * @see #isSkipped() + * @throws IllegalStateException if called after the step has finished. + */ + void setSkipped(boolean skipped); + + /** + * Skips this step. + * + * @see #isSkipped() + * @throws IllegalStateException if called after the step has finished. + */ + default void skip() { + this.setSkipped(true); + } + + /** + * Sets whether parts of this step are skipped. + * This has no effect on steps already finished. + * + * @see #isSkipped() + */ + default void trySetSkipped(Set parts, boolean skipped) { + if (parts.contains(Part.CHILDREN_BEFORE) && this.damageBeforeSelf().isEmpty()) { + for (DamageStep child : this.childrenBefore()) { + child.trySetSkipped(Part.ALL, skipped); + } + } + if (parts.contains(Part.SELF) && this.damageAfterSelf().isEmpty()) { + this.setSkipped(skipped); + } + if (parts.contains(Part.CHILDREN_AFTER) && this.damageAfterChildren().isEmpty()) { + for (DamageStep child : this.childrenAfter()) { + child.trySetSkipped(Part.ALL, skipped); + } + } + } + + /** + * Skips parts of this step. + * This has no effect on steps already finished. + * + * @see #isSkipped() + */ + default void trySkip(Set parts) { + this.trySetSkipped(parts, true); + } + + /** + * The damage just before the children of this step. + * Returns empty if the value is not known yet. + * + * @return The damage before the children of this step + */ + OptionalDouble damageBeforeChildren(); + + /** + * The damage just before this step. + * Returns empty if the value is not known yet. + * + * @return The damage before this step + */ + OptionalDouble damageBeforeSelf(); + + /** + * The damage just after this step. + * Returns empty if the value is not known yet. + * + * @return The damage after this step + */ + OptionalDouble damageAfterSelf(); + + /** + * The damage just after the children of this step. + * Returns empty if the value is not known yet. + * + * @return The damage after this step + */ + OptionalDouble damageAfterChildren(); + + /** + * Gets the {@link DamageStepHistory} this step belongs to. + * + * @return The history containing this step. + */ + DamageStepHistory history(); + + /** + * Gets the parent of this step. + * Returns empty if this step is the root of its tree. + * + * @return The parent of this step + */ + Optional parent(); + + /** + * Gets the root of this step. + * + * @return The root of this step + */ + default DamageStep root() { + DamageStep step = this; + Optional parent; + while ((parent = step.parent()).isPresent()) { + step = parent.get(); + } + return step; + } + + /** + * Gets an immutable list of all children steps that applies just before this step. + * + * @return The list of children steps + */ + List childrenBefore(); + + /** + * Gets an immutable list of all children steps that applies just after this step. + * + * @return The list of children steps + */ + List childrenAfter(); + + /** + * The parts composing a step. + */ + enum Part { + SELF, CHILDREN_BEFORE, CHILDREN_AFTER; + + public static final EnumSet ALL = EnumSet.allOf(Part.class); + } +} diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/ModifierFunction.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepHistory.java similarity index 71% rename from src/main/java/org/spongepowered/api/event/cause/entity/damage/ModifierFunction.java rename to src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepHistory.java index a13e4dfaecf..cd2d3958fa3 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/ModifierFunction.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepHistory.java @@ -24,29 +24,20 @@ */ package org.spongepowered.api.event.cause.entity.damage; -import java.util.function.DoubleUnaryOperator; +import java.util.List; /** - * A function associating a - * {@link DamageModifier} with a {@link DoubleUnaryOperator} of the resultant - * effect. - * - * @param The modifier type + * Captures the root steps occurring during a damage calculation. */ -public interface ModifierFunction { - - /** - * Gets the modifier used by this modifier function. - * - * @return The modifier - */ - M modifier(); +public interface DamageStepHistory { /** - * Gets the double unary operator used by this function. + * Gets the list of the captured root steps during the damage calculation in the order they have been applied. + * Note that this list is not an exhaustive representation of all the operations applied, + * especially in a modded environment. + * The list is unmodifiable and will gradually grow during the damage calculation. * - * @return The unary operator + * @return The root steps. */ - DoubleUnaryOperator function(); - + List rootSteps(); } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifierType.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepType.java similarity index 68% rename from src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifierType.java rename to src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepType.java index e27d91de2bc..b94a70b1754 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifierType.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepType.java @@ -24,18 +24,35 @@ */ package org.spongepowered.api.event.cause.entity.damage; -import org.spongepowered.api.event.Cause; +import org.spongepowered.api.Sponge; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; /** - * A type of {@link DamageModifier} that can apply a "grouping" so to speak - * for the damage modifier. The use case is being able to differentiate between - * various {@link DamageModifier}s based on the {@link DamageModifierType} - * without digging through the {@link Cause} provided by - * {@link DamageModifier#cause()}. + * Represents a type of {@link DamageStep}. */ -@CatalogedBy(DamageModifierTypes.class) -public interface DamageModifierType extends DefaultedRegistryValue { +@CatalogedBy(DamageStepTypes.class) +public interface DamageStepType extends DefaultedRegistryValue { + /** + * Creates a new {@link DamageStepType}. + * + * @return the new step type + */ + static DamageStepType create() { + return Sponge.game().factoryProvider().provide(Factory.class).create(); + } + + /** + * A factory to create {@link DamageStepType}s. + */ + interface Factory { + + /** + * Creates a new {@link DamageStepType}. + * + * @return the new step type + */ + DamageStepType create(); + } } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepTypes.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepTypes.java new file mode 100644 index 00000000000..4b8893f7872 --- /dev/null +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageStepTypes.java @@ -0,0 +1,204 @@ +/* + * 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.event.cause.entity.damage; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.effect.potion.PotionEffect; +import org.spongepowered.api.effect.potion.PotionEffectType; +import org.spongepowered.api.effect.potion.PotionEffectTypes; +import org.spongepowered.api.entity.Entity; +import org.spongepowered.api.entity.living.player.Player; +import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; +import org.spongepowered.api.item.enchantment.Enchantment; +import org.spongepowered.api.item.enchantment.EnchantmentType; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +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; + +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.GAME) +public final class DamageStepTypes { + + // @formatter:off + + // SORTFIELDS:ON + + /** + * Represents a {@link DamageStep} that "absorbs" damage based on + * the {@link PotionEffectTypes#ABSORPTION} level on the + * {@link Entity}. + */ + public static final DefaultedRegistryReference ABSORPTION = DamageStepTypes.key(ResourceKey.sponge("absorption")); + + /** + * Represents a {@link DamageStep} that will reduce damage based on + * the armor {@link ItemStack}s. + */ + public static final DefaultedRegistryReference ARMOR = DamageStepTypes.key(ResourceKey.sponge("armor")); + + /** + * Represents a {@link DamageStep} that will reduce damage based on + * the {@link EnchantmentType}s applicable to an {@link ItemStack} that is + * considered to be "armor" currently equipped on the owner. + * + *

    Usually, within the {@link DamageStep#cause()} will reside + * an {@link ItemStackSnapshot} and an {@link Enchantment} signifying + * that the {@link EnchantmentType} of the {@link ItemStack} is modifying the + * incoming/outgoing damage. There can be multiple {@link DamageStep}s + * of this type in a single event due to the variety of possibilities in + * customization of armor handling.

    + */ + public static final DefaultedRegistryReference ARMOR_ENCHANTMENT = DamageStepTypes.key(ResourceKey.sponge("armor_enchantment")); + + /** + * Represents the {@link DamageStep} that will reduce the base damage from a + * {@link Player} if their attack cooldown has not been completed yet. + */ + public static final DefaultedRegistryReference BASE_COOLDOWN = DamageStepTypes.key(ResourceKey.sponge("base_cooldown")); + + /** + * Represents the {@link DamageStep} that will modify damage output + * based on the fact that the attacking source is critically hitting the + * target. + */ + public static final DefaultedRegistryReference CRITICAL_HIT = DamageStepTypes.key(ResourceKey.sponge("critical_hit")); + + /** + * Represents a {@link DamageStep} that will reduce damage based on + * the {@link PotionEffectTypes#RESISTANCE} or any other + * {@link PotionEffectType} that can be deemed as reducing incoming damage. + * + *

    Usually, within the {@link DamageStep#cause()} will reside + * a {@link PotionEffect} including the amplifier and duration, signifying + * that the {@link PotionEffectType} is modifying the incoming damage.

    + */ + public static final DefaultedRegistryReference DEFENSIVE_POTION_EFFECT = DamageStepTypes.key(ResourceKey.sponge("defensive_potion_effect")); + + /** + * Represents the {@link DamageStep} that will reduce the enchantment damage from a + * {@link Player} if their attack cooldown has not been completed yet. + */ + public static final DefaultedRegistryReference ENCHANTMENT_COOLDOWN = DamageStepTypes.key(ResourceKey.sponge("enchantment_cooldown")); + + /** + * Represents the last {@link DamageStep} applied during a damage calculation. + * This step happens just before the {@link org.spongepowered.api.event.entity.DamageCalculationEvent.Post}. + * This step does nothing but can be used to add modifiers to the final damage. + */ + public static final DefaultedRegistryReference END = DamageStepTypes.key(ResourceKey.sponge("end")); + + /** + * Represents a {@link DamageStep} that will modify freezing damage. + * E.g. {@link org.spongepowered.api.entity.living.monster.Blaze} take more damage from freezing sources. + */ + public static final DefaultedRegistryReference FREEZING_BONUS = DamageStepTypes.key(ResourceKey.sponge("freezing_bonus")); + + /** + * Represents the {@link DamageStep} that will modify damage from + * a {@link DamageSource#source()} that is a {@link org.spongepowered.api.entity.FallingBlock}. + * + *

    Usually, within the {@link DamageStep#cause()} will reside + * an {@link ItemStackSnapshot} and an {@link Enchantment} signifying + * that the {@link EnchantmentType} of the {@link ItemStack} is modifying the + * incoming/outgoing damage.

    + */ + public static final DefaultedRegistryReference HARD_HAT = DamageStepTypes.key(ResourceKey.sponge("hard_hat")); + + /** + * Represents a {@link DamageStep} that will modify damage based on + * magic. + */ + public static final DefaultedRegistryReference MAGIC = DamageStepTypes.key(ResourceKey.sponge("magic")); + + /** + * Represents a {@link DamageStep} that will reduce outgoing damage + * based on a {@link PotionEffect}. + * + *

    Usually, within the {@link DamageStep#cause()} will reside + * a {@link PotionEffect} including the amplifier and duration, signifying + * that the {@link PotionEffectType} is reducing the outgoing damage.

    + */ + public static final DefaultedRegistryReference NEGATIVE_POTION_EFFECT = DamageStepTypes.key(ResourceKey.sponge("negative_potion_effect")); + + /** + * Represents the {@link DamageStep} that will increase damage from + * a {@link PotionEffect} affecting the attacker. + */ + public static final DefaultedRegistryReference OFFENSIVE_POTION_EFFECT = DamageStepTypes.key(ResourceKey.sponge("offensive_potion_effect")); + + /** + * Represents a {@link DamageStep} that will reduce damage due to using a shield. + */ + public static final DefaultedRegistryReference SHIELD = DamageStepTypes.key(ResourceKey.sponge("shield")); + + /** + * Represents the first {@link DamageStep} applied during a damage calculation. + * This step happens just after the {@link org.spongepowered.api.event.entity.DamageCalculationEvent.Pre}. + * This step does nothing but can be used to add modifiers to the base damage. + */ + public static final DefaultedRegistryReference START = DamageStepTypes.key(ResourceKey.sponge("start")); + + /** + * Represents a {@link DamageStep} that is applied for a sweeping attack. + */ + public static final DefaultedRegistryReference SWEEPING = DamageStepTypes.key(ResourceKey.sponge("sweeping")); + + /** + * Represents a {@link DamageStep} that will add bonus damage based on the weapon used. + */ + public static final DefaultedRegistryReference WEAPON_BONUS = DamageStepTypes.key(ResourceKey.sponge("weapon_bonus")); + + /** + * Represents the {@link DamageStep} that will modify damage from + * an {@link EnchantmentType} on an equipped {@link ItemStack}. + * + *

    Usually, within the {@link DamageStep#cause()} will reside + * an {@link ItemStackSnapshot} and an {@link Enchantment} signifying + * that the {@link EnchantmentType} of the {@link ItemStack} is modifying the + * incoming/outgoing damage.

    + */ + public static final DefaultedRegistryReference WEAPON_ENCHANTMENT = DamageStepTypes.key(ResourceKey.sponge("weapon_enchantment")); + + // SORTFIELDS:OFF + + // @formatter:on + + private DamageStepTypes() { + } + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.DAMAGE_STEP_TYPE); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.DAMAGE_STEP_TYPE, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageType.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageType.java index 9a17b8a44a7..6131f6dc1ea 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageType.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageType.java @@ -24,11 +24,13 @@ */ package org.spongepowered.api.event.cause.entity.damage; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; import org.spongepowered.api.registry.DefaultedRegistryValue; -import org.spongepowered.api.tag.Tag; import org.spongepowered.api.tag.Taggable; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.Nameable; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -39,8 +41,16 @@ * can damage an {@link Entity} with varying {@link DamageType}s depending on the circumstances. */ @CatalogedBy(DamageTypes.class) -public interface DamageType extends DefaultedRegistryValue, Nameable, Taggable { +public interface DamageType extends DefaultedRegistryValue, Nameable, Taggable, DataPackSerializable { + /** + * Creates a new {@link Builder} to create a {@link DamageType}. + * + * @return The new builder + */ + static Builder builder() { + return Sponge.game().builderProvider().provide(Builder.class); + } /** * Gets the amount of exhaustion this {@link DamageType} will add to the entity, generally only to players. @@ -54,15 +64,6 @@ public interface DamageType extends DefaultedRegistryValue, Nameable, Taggable tag); - /** * Returns the damage scaling. * @@ -77,4 +78,52 @@ public interface DamageType extends DefaultedRegistryValue, Nameable, Taggable, CopyableBuilder { + + /** + * Sets the name of the {@link DamageType}. + * Used as part of the death message translation key. + * TODO falling/intentional game design? + * + * @param name The name + * + * @return This builder, for chaining + */ + Builder name(String name); + + /** + * Sets damage scaling + * + * @param scaling the daamge scaling + * + * @return This builder + */ + Builder scaling(DamageScaling scaling); + + /** + * Sets damage effects + * + * @param effect the damage effect + * + * @return This builder + */ + Builder effect(DamageEffect effect); + + /** + * Sets the amount of exhaustion a {@link DamageSource} of this type will + * add to the entity, generally only to players. + * + * TODO check if this is still correct + *

    In vanilla gameplay, the default is 0.1, unless if the damage + * is absolute or bypasses armor, where the exhaustion gets set to 0. + *

    + * + * @param exhaustion The amount of exhaustion to add to the entity + * @return This builder + */ + Builder exhaustion(double exhaustion); + } } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageTypeTemplate.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageTypeTemplate.java deleted file mode 100644 index 4612308f4a1..00000000000 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageTypeTemplate.java +++ /dev/null @@ -1,97 +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.event.cause.entity.damage; - -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; -import org.spongepowered.api.util.DataPackEntryBuilder; - -/** - * A template for {@link DamageType damage types}. - */ - -public interface DamageTypeTemplate extends DataPackEntry { - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the damage type - * - * @return the damage type - */ - DamageType type(); - - - interface Builder extends DataPackEntryBuilder { - - /** - * Sets the name of the {@link DamageType}. - * Used as part of the death message translation key. - * TODO falling/intentional game design? - * - * @param name The name - * - * @return This builder, for chaining - */ - Builder name(String name); - - /** - * Sets damage scaling - * - * @param scaling the daamge scaling - * - * @return This builder - */ - Builder scaling(DamageScaling scaling); - - /** - * Sets damage effects - * - * @param effect the damage effect - * - * @return This builder - */ - Builder effect(DamageEffect effect); - - /** - * Sets the amount of exhaustion a {@link DamageSource} of this type will - * add to the entity, generally only to players. - * - * TODO check if this is still correct - *

    In vanilla gameplay, the default is 0.1, unless if the damage - * is absolute or bypasses armor, where the exhaustion gets set to 0. - *

    - * - * @param exhaustion The amount of exhaustion to add to the entity - * @return This builder - */ - Builder exhaustion(double exhaustion); - - } - -} 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 1c47212b672..b2bf79e7591 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 @@ -56,6 +56,8 @@ public final class DamageTypes { public static final DefaultedRegistryReference DRY_OUT = DamageTypes.key(ResourceKey.minecraft("dry_out")); + public static final DefaultedRegistryReference ENDER_PEARL = DamageTypes.key(ResourceKey.minecraft("ender_pearl")); + public static final DefaultedRegistryReference EXPLOSION = DamageTypes.key(ResourceKey.minecraft("explosion")); public static final DefaultedRegistryReference FALL = DamageTypes.key(ResourceKey.minecraft("fall")); @@ -90,6 +92,8 @@ public final class DamageTypes { public static final DefaultedRegistryReference LIGHTNING_BOLT = DamageTypes.key(ResourceKey.minecraft("lightning_bolt")); + public static final DefaultedRegistryReference MACE_SMASH = DamageTypes.key(ResourceKey.minecraft("mace_smash")); + public static final DefaultedRegistryReference MAGIC = DamageTypes.key(ResourceKey.minecraft("magic")); public static final DefaultedRegistryReference MOB_ATTACK = DamageTypes.key(ResourceKey.minecraft("mob_attack")); @@ -110,6 +114,8 @@ public final class DamageTypes { public static final DefaultedRegistryReference SONIC_BOOM = DamageTypes.key(ResourceKey.minecraft("sonic_boom")); + public static final DefaultedRegistryReference SPEAR = DamageTypes.key(ResourceKey.minecraft("spear")); + public static final DefaultedRegistryReference SPIT = DamageTypes.key(ResourceKey.minecraft("spit")); public static final DefaultedRegistryReference STALAGMITE = DamageTypes.key(ResourceKey.minecraft("stalagmite")); @@ -142,6 +148,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.DAMAGE_TYPE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.DAMAGE_TYPE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/package-info.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/package-info.java index 854a642a92d..b8d89392421 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/package-info.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/package-info.java @@ -22,5 +22,8 @@ * 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) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event.cause.entity.damage; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/source/package-info.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/source/package-info.java index 2259174ac8f..2385f8466a9 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/source/package-info.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/source/package-info.java @@ -22,5 +22,8 @@ * 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) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event.cause.entity.damage.source; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/package-info.java b/src/main/java/org/spongepowered/api/event/cause/entity/package-info.java index 88639e98bbc..cb3fa67ca4c 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/package-info.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/package-info.java @@ -22,5 +22,8 @@ * 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) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event.cause.entity; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/org/spongepowered/api/event/cause/package-info.java b/src/main/java/org/spongepowered/api/event/cause/package-info.java index d4759eac38c..15dada1c460 100644 --- a/src/main/java/org/spongepowered/api/event/cause/package-info.java +++ b/src/main/java/org/spongepowered/api/event/cause/package-info.java @@ -22,5 +22,8 @@ * 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) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event.cause; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/org/spongepowered/api/event/data/ChangeDataHolderEvent.java b/src/main/java/org/spongepowered/api/event/data/ChangeDataHolderEvent.java index fe6c156a31f..31de1e88d1e 100644 --- a/src/main/java/org/spongepowered/api/event/data/ChangeDataHolderEvent.java +++ b/src/main/java/org/spongepowered/api/event/data/ChangeDataHolderEvent.java @@ -30,8 +30,8 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; import org.spongepowered.api.event.impl.data.AbstractValueChangeEvent; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.PropertySettings; /** * An event that is associated with a {@link org.spongepowered.api.data.DataHolder.Mutable} that may have some diff --git a/src/main/java/org/spongepowered/api/event/entity/AffectEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/AffectEntityEvent.java index a099ee8114e..b18526af11a 100644 --- a/src/main/java/org/spongepowered/api/event/entity/AffectEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/AffectEntityEvent.java @@ -30,10 +30,11 @@ import org.spongepowered.api.event.Event; import org.spongepowered.api.event.Order; import org.spongepowered.api.event.impl.entity.AbstractAffectEntityEvent; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; import org.spongepowered.api.world.explosion.Explosion; import org.spongepowered.api.world.server.ServerLocation; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.PropertySettings; import java.util.List; import java.util.function.Predicate; @@ -48,6 +49,7 @@ * Other cases will be included as necessary. */ @ImplementedBy(AbstractAffectEntityEvent.class) +@NoFactoryMethod public interface AffectEntityEvent extends Event, Cancellable { /** diff --git a/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java index 208f68a4108..38948d73ca1 100644 --- a/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java @@ -25,38 +25,19 @@ package org.spongepowered.api.event.entity; import org.spongepowered.api.block.entity.carrier.Dispenser; -import org.spongepowered.api.effect.potion.PotionEffect; import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.entity.living.Living; import org.spongepowered.api.entity.living.monster.skeleton.Skeleton; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.projectile.arrow.ArrowLike; -import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cause; -import org.spongepowered.api.event.Event; -import org.spongepowered.api.event.cause.entity.damage.DamageFunction; -import org.spongepowered.api.event.cause.entity.damage.DamageModifier; -import org.spongepowered.api.event.cause.entity.damage.DamageModifierType; -import org.spongepowered.api.event.cause.entity.damage.DamageModifierTypes; import org.spongepowered.api.event.cause.entity.damage.DamageType; import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; -import org.spongepowered.api.event.impl.entity.AbstractAttackEntityEvent; import org.spongepowered.api.item.ItemTypes; import org.spongepowered.api.item.inventory.ItemStack; -import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.Tuple; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; import org.spongepowered.api.world.World; import org.spongepowered.api.world.difficulty.Difficulties; import org.spongepowered.api.world.difficulty.Difficulty; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.DoubleUnaryOperator; -import java.util.function.Function; - /** * Represents the base event for when an {@link Entity} is being "attacked". * The uniqueness of this event is that all {@link DamageSource}s can deal @@ -77,7 +58,7 @@ * to a particular {@link DamageType}, has no static finalized amount of damage * to deal to a particular {@link Entity}. To properly represent this, * a {@link DamageSource} has various "states" such as: - * {@link DamageSource#isAbsolute()}, or {@link DamageSource#isBypassingArmor()}. + * {@link DamageSource#isMagic()}, or {@link DamageSource#isBypassingArmor()}. * Quite simply, the {@link DamageSource} will always be the "first" element * within a {@link Cause} that can be retrieved from {@link #cause()}.

    * @@ -88,316 +69,43 @@ * the {@link Cause}. The same can be said if an {@link ArrowLike} was shot from * a {@link Dispenser} that was triggered by a {@link Player} flipping a * switch.

    - * - *

    Continuing with the notion of "modifiers" to damage, the "base" damage - * is modified or added onto after various unknown methods are called or - * processed on the damage. Optimally, these modifiers can be traced to a - * particular object, be it an {@link ItemStack}, {@link Difficulty}, or - * simply an an attribute. The interesting part is that these "modifiers" - * do not just define a static value to add to the "base" damage, they - * are usually a loose form of a {@link Function} that are applied to - * the "base" damage. Given that {@link Cause} has a unique capability of - * storing any and every {@link Object} willing to be passed into it, we - * can easily represent these "sources" of "modifiers" in a {@link Cause}. - * Now, knowing the "source" will not provide enough information, so a - * {@link DamageModifierType} is provided with a {@link DamageModifier} to - * paint the fullest picture of "explaining" the {@link DamageModifier} as to - * why it is present, and why it is "modifying" the "base" damage. Finally, - * we can associate a {@link DamageModifier} with a {@link Function} that is - * passed the current "damage" into {@link Function#apply(Object)}, being added - * to the current "damage". After all {@link DamageModifier} {@link Function}s - * are "applied", the overall "damage" is now the final damage to actually - * throw a {@link AttackEntityEvent}.

    - * - *

    Note that due to the mechanics of the game, {@link DamageModifier}s - * are always ordered in the order of which they apply their modifier onto - * the "base" damage. The implementation for {@link #finalOutputDamage()} can - * be exemplified like so:

    - * - *
    {@code
    - * double damage = this.baseDamage;
    - * for (Map.Entry> entry : this.modifierFunctions.entrySet()) { - * damage += checkNotNull(entry.getValue().apply(damage)); - * } - * return damage; - * }
    - * - * TODO explain groups - *

    After which, the "final" damage is simply the summation of the - * "base" damage and all "modified damage" for each {@link DamageModifier} - * provided in this event.

    - * - *

    Coming forward, it is possible to further customize not only the "base" - * damage, but override pre-existing {@link DamageModifier} {@link Function}s - * by calling {@link #setOutputDamage(DamageModifier, DoubleUnaryOperator)} at which point the - * end result may be undefined. However, if a custom {@link DamageModifier} - * that aims to alter the "final" damage based on some custom circumstances, - * calling {@link #setOutputDamage(DamageModifier, DoubleUnaryOperator)} on a new - * {@link DamageModifier} instance, easily created from the - * {@link org.spongepowered.api.event.cause.entity.damage.DamageModifier.Builder}, - * the provided pairing will be added at the - * "end" of the list for "modifying" the "base" damage.

    - * - *

    Note that this event is intended for processing incoming damage to - * an {@link Entity} prior to any {@link DamageModifier}s associated with - * the {@link #entity()}. The {@link AttackEntityEvent} is used - * to process the various {@link DamageModifier}s of which originate or are - * associated with the targeted {@link Entity}.

    */ -@ImplementedBy(AbstractAttackEntityEvent.class) -public interface AttackEntityEvent extends Event, Cancellable { - - /** - * For use with the {@link DamageSource} that is known as the "source" - * of the damage. - */ - String SOURCE = "Source"; - /** - * For use with a {@link DamageModifier} where it's type is a - * {@link DamageModifierTypes#HARD_HAT} and the {@link Cause} contains - * an {@link ItemStackSnapshot}, usually a helmet. - */ - String HARD_HAT_ARMOR = "HardHat"; - - /** - * or use with a {@link DamageModifier} where its type is a - * {@link DamageModifierTypes#SHIELD} and the {@link Cause} contains - * an {@link ItemStackSnapshot} (in Vanilla, a shield). - */ - String SHIELD = "Shield"; - - /** - * For use with a {@link DamageModifier} where it's type is a - * {@link DamageModifierTypes#ARMOR} and the {@link Cause} contains - * an {@link ItemStackSnapshot}. Separate from hard hat but still - * considered as "armor" where it will absorb a certain amount of damage - * before dealing damage to the wearer. - */ - String GENERAL_ARMOR = "GeneralArmor"; - /** - * For use with a {@link DamageModifier} where it's type is a - * {@link DamageModifierTypes#ARMOR} and the {@link Cause} contains - * an {@link ItemStackSnapshot} for a "helmet". - */ - String HELMET = AttackEntityEvent.GENERAL_ARMOR + ":head"; - /** - * For use with a {@link DamageModifier} where it's type is a - * {@link DamageModifierTypes#ARMOR} and the {@link Cause} contains - * an {@link ItemStackSnapshot} for a "chestplate". - */ - String CHESTPLATE = AttackEntityEvent.GENERAL_ARMOR + ":chestplate"; - /** - * For use with a {@link DamageModifier} where it's type is a - * {@link DamageModifierTypes#ARMOR} and the {@link Cause} contains - * an {@link ItemStackSnapshot} for "leggings". - */ - String LEGGINGS = AttackEntityEvent.GENERAL_ARMOR + ":leggings"; - /** - * For use with a {@link DamageModifier} where it's type is a - * {@link DamageModifierTypes#ARMOR} and the {@link Cause} contains - * an {@link ItemStackSnapshot} for "boots". - */ - String BOOTS = AttackEntityEvent.GENERAL_ARMOR + ":boots"; - /** - * For use with a {@link DamageModifier} where it's type is a - * {@link DamageModifierTypes#HARD_HAT} and the {@link Cause} contains - * a {@link PotionEffect}. - */ - String RESISTANCE = "Resistance"; - /** - * For use with a {@link DamageModifier} where it's type is a - * {@link DamageModifierTypes#ABSORPTION} and the {@link Cause} contains - * a {@link PotionEffect}. - */ - String ABSORPTION = "AbsorptionPotion"; - /** - * For use with a {@link DamageModifier} where the root cause is "created" - * by an object, usually the {@link Entity} or {@link Living} entity. - */ - String CREATOR = "Creator"; - /** - * For use with a {@link DamageSource} with a {@link DamageSource#source() entity} or - * {@link DamageSource#blockSnapshot()} such that it was last "notified" by the object - * represented in the cause. - * - *

    Usually this is used where a {@link Player} interacted with the - * now {@link DamageSource} such that they

    - */ - String NOTIFIER = "Notifier"; - - /** - * Gets the {@link Entity}. - * - * @return The entity - */ - Entity entity(); - - /** - * Gets the original "raw" amount of damage to deal to the targeted - * {@link Entity}. - * - * @return The original "raw" damage - */ - double originalDamage(); - - /** - * Gets the original "final" amount of damage after all original - * {@link DamageModifier}s are applied to {@link #originalDamage()}. - * The "final" damage is considered the amount of health being lost by - * the {@link Entity}, if health is tracked. - * - * @return The final amount of damage to originally deal - */ - @PropertySettings(requiredParameter = false, generateMethods = false) - double originalFinalDamage(); - - /** - * Gets an immutable {@link Map} of all original {@link DamageModifier}s - * and their associated "modified" damage. Note that ordering is not - * retained. - * - * @return An immutable map of the original modified damages - */ - @PropertySettings(requiredParameter = false, generateMethods = false) - Map> originalDamages(); - - /** - * Gets the original damage for the provided {@link DamageModifier}. If - * the provided {@link DamageModifier} was not included in - * {@link #originalDamages()}, an {@link IllegalArgumentException} is - * thrown. - * - * @param damageModifier The original damage modifier - * @return The original damage change - */ - Tuple originalModifierDamage(DamageModifier damageModifier); - - /** - * Gets the original {@link List} of {@link DamageModifier} to - * {@link Function} that was originally passed into the event. - * - * @return The list of damage modifier functions - */ - List originalFunctions(); - - /** - * Gets the "base" damage to deal to the targeted {@link Entity}. The - * "base" damage is the original value before passing along the chain of - * {@link Function}s for all known {@link DamageModifier}s. - * - * @return The base damage - */ - @PropertySettings(requiredParameter = false, generateMethods = false) - double baseOutputDamage(); - - /** - * Sets the "base" damage to deal to the targeted {@link Entity}. The - * "base" damage is the original value before passing along the chain of - * {@link Function}s for all known {@link DamageModifier}s. - * - * @param baseDamage The base damage - */ - void setBaseOutputDamage(double baseDamage); +public interface AttackEntityEvent extends DamageCalculationEvent { /** - * Gets the final damage that will be passed into the proceeding - * {@link AttackEntityEvent}. The final damage is the end result of the - * {@link #baseOutputDamage()} being applied in {@link Function#apply(Object)} - * available from all the {@link Tuple}s of {@link DamageModifier} to - * {@link Function} in {@link #originalFunctions()}. - * - * @return The final damage to deal + * Fires before the damage steps and their side effects are applied. + * The final damage is still unknown. */ - @PropertySettings(requiredParameter = false, generateMethods = false) - double finalOutputDamage(); + interface Pre extends AttackEntityEvent, DamageCalculationEvent.Pre { + } /** - * Checks whether the provided {@link DamageModifier} is applicable to the - * current available {@link DamageModifier}s. - * - * @param damageModifier The damage modifier to check - * @return True if the damage modifier is relevant to this event + * Fires after the damage steps and their side effects have been applied. */ - boolean isModifierApplicable(DamageModifier damageModifier); + interface Post extends AttackEntityEvent, DamageCalculationEvent.Post { - /** - * Gets the damage for the provided {@link DamageModifier}. Providing that - * {@link #isModifierApplicable(DamageModifier)} returns true, - * the cached "damage" for the {@link DamageModifier} is returned. - * - * @param damageModifier The damage modifier to get the damage for - * @return The modifier - */ - Tuple outputDamage(DamageModifier damageModifier); - - /** - * Sets the provided {@link Function} to be used for the given - * {@link DamageModifier}. If the {@link DamageModifier} is already - * included in {@link #modifiers()}, the {@link Function} replaces - * the existing function. If there is no {@link Tuple} for the - * {@link DamageModifier}, a new one is created and added to the end - * of the list of {@link Function}s to be applied to the - * {@link #baseOutputDamage()}. - * - *

    If needing to create a custom {@link DamageModifier} is required, - * usage of the - * {@link org.spongepowered.api.event.cause.entity.damage.DamageModifier.Builder} - * is recommended.

    - * - * @param damageModifier The damage modifier - * @param function The function to map to the modifier - */ - void setOutputDamage(DamageModifier damageModifier, DoubleUnaryOperator function); + /** + * Gets the original knockback modifier. + * + * @see #knockbackModifier() + * @return The original knockback modifier + */ + double originalKnockbackModifier(); - /** - * Adds the provided {@link DamageModifier} and {@link Function} to the - * list of modifiers, such that the {@link Set} containing - * {@link DamageModifierType}s provided in {@code before} will appear - * after the provided damage modifier. - * - * @param damageModifier The damage modifier to add - * @param function The associated function - * @param before The set containing the modifier types to come after - * the provided modifier - */ - void addDamageModifierBefore(DamageModifier damageModifier, DoubleUnaryOperator function, Set before); + /** + * Gets the knockback modifier. The modifier itself will apply to the + * momentum of the attacked entity. + * + * @return The knockback modifier + */ + double knockbackModifier(); - /** - * Adds the provided {@link DamageModifier} and {@link Function} to the list - * of modifiers, such that the modifier will appear in order after any - * current modifiers whose type are included in the provided {@link Set} - * of {@link DamageModifierType}s. - * - * @param damageModifier The damage modifier to add - * @param function The associated function - * @param after The set of modifier types to come before the new modifier - */ - void addDamageModifierAfter(DamageModifier damageModifier, DoubleUnaryOperator function, Set after); - - /** - * Gets a list of simple {@link Tuple}s of {@link DamageModifier} keyed to - * their representative {@link Function}s. All {@link DamageModifier}s are - * applicable to the entity based on the {@link DamageSource} and any - * possible invulnerabilities due to the {@link DamageSource}. - * - * @return A list of damage modifiers to functions - */ - @PropertySettings(requiredParameter = false, generateMethods = false) - List modifiers(); - - /** - * Gets the knock back modifier. The modifier itself will apply to the - * momentum of the attacked entity. - * - * @return The knock back modifier - */ - float knockbackModifier(); - - /** - * Sets the knock back modifier. The modifier itself will apply to the - * momentum of the attacked entity. - * - * @param modifier The knock back modifier to set - */ - void setKnockbackModifier(float modifier); + /** + * Sets the knockback modifier. + * + * @see #knockbackModifier() + * @param modifier The knockback modifier to set + */ + void setKnockbackModifier(double modifier); + } } diff --git a/src/main/java/org/spongepowered/api/event/entity/ChangeEntityEquipmentEvent.java b/src/main/java/org/spongepowered/api/event/entity/ChangeEntityEquipmentEvent.java index 6ee0f580e9f..0a5885e7f09 100644 --- a/src/main/java/org/spongepowered/api/event/entity/ChangeEntityEquipmentEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/ChangeEntityEquipmentEvent.java @@ -32,7 +32,7 @@ import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.ItemStackSnapshot; import org.spongepowered.api.item.inventory.Slot; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Called when an entity changes an equipped item. This can occur whenever diff --git a/src/main/java/org/spongepowered/api/event/entity/ChangeEntityWorldEvent.java b/src/main/java/org/spongepowered/api/event/entity/ChangeEntityWorldEvent.java index 2cb09c213fe..55ced7a4acf 100644 --- a/src/main/java/org/spongepowered/api/event/entity/ChangeEntityWorldEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/ChangeEntityWorldEvent.java @@ -27,8 +27,8 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; import org.spongepowered.api.world.server.ServerWorld; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; /** * Called when an {@link Entity} is changing {@link ServerWorld worlds}. diff --git a/src/main/java/org/spongepowered/api/event/entity/CollideEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/CollideEntityEvent.java index 5668e895be3..6b36c2c40af 100644 --- a/src/main/java/org/spongepowered/api/event/entity/CollideEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/CollideEntityEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.action.CollideEvent; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Fired when an {@link Entity} collides with one or more {@link Entity}'s. diff --git a/src/main/java/org/spongepowered/api/event/entity/DamageCalculationEvent.java b/src/main/java/org/spongepowered/api/event/entity/DamageCalculationEvent.java new file mode 100644 index 00000000000..07f898b2253 --- /dev/null +++ b/src/main/java/org/spongepowered/api/event/entity/DamageCalculationEvent.java @@ -0,0 +1,182 @@ +/* + * 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.event.entity; + +import org.spongepowered.api.entity.Entity; +import org.spongepowered.api.event.Cancellable; +import org.spongepowered.api.event.Cause; +import org.spongepowered.api.event.Event; +import org.spongepowered.api.event.cause.entity.damage.DamageModifier; +import org.spongepowered.api.event.cause.entity.damage.DamageStep; +import org.spongepowered.api.event.cause.entity.damage.DamageStepHistory; +import org.spongepowered.api.event.cause.entity.damage.DamageStepType; +import org.spongepowered.api.event.cause.entity.damage.DamageStepTypes; +import org.spongepowered.api.event.impl.entity.AbstractDamageCalculationEventPre; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.world.difficulty.Difficulty; +import org.spongepowered.eventgen.annotations.ImplementedBy; + +import java.util.List; +import java.util.function.Supplier; + +/** + * The base event for when some damage is calculated, + * whether it is the damage output of an attack, or the damage inflicted to an entity. + * + *

    The damage calculation starts with a base damage which is modified + * by a series of operations to obtain a final value. + * Some of these operations are captured as {@link DamageStep}s and are modifiable.

    + * + *

    Optimally, these steps can be traced to a + * particular object, be it an {@link ItemStack}, {@link Difficulty}, or + * simply an attribute. Given that {@link Cause} has a unique capability of + * storing any and every {@link Object} willing to be passed into it, we + * can easily represent these "sources" of "steps" in a {@link Cause}. + * Now, knowing the "source" will not provide enough information, so a + * {@link DamageStepType} is provided with a {@link DamageStep} to + * paint the fullest picture of "explaining" the {@link DamageStep} as to + * why it is present, and why it is modifying the base damage.

    + */ +public interface DamageCalculationEvent extends Event, Cancellable { + + /** + * Gets the targeted {@link Entity}. + * + * @return The targeted entity + */ + Entity entity(); + + /** + * Gets the base damage to deal to the targeted {@link Entity}. + * The base damage is the value before the calculation and its {@link DamageStep}s. + * To modify the base damage, add a modifier to the step associated to {@link DamageStepTypes#START}. + * + * @return The base damage + */ + double baseDamage(); + + /** + * Fires before the damage steps and their side effects are applied. + */ + @ImplementedBy(AbstractDamageCalculationEventPre.class) + interface Pre extends DamageCalculationEvent { + + /** + * Gets an unmodifiable list of all modifiers that applies just before the step. + * + * @param type The step type + * @return The list of modifiers + */ + default List modifiersBefore(Supplier type) { + return this.modifiersBefore(type.get()); + } + + /** + * Gets an unmodifiable list of all modifiers that applies just before the step. + * + * @param type The step type + * @return The list of modifiers + */ + List modifiersBefore(DamageStepType type); + + /** + * Adds a modifier that applies just before the step. + * + * @param type The step type + * @param modifier The modifier + */ + default void addModifierBefore(Supplier type, DamageModifier modifier) { + this.addModifierBefore(type.get(), modifier); + } + + /** + * Adds a modifier that applies just before the step. + * + * @param type The step type + * @param modifier The modifier + */ + void addModifierBefore(DamageStepType type, DamageModifier modifier); + + /** + * Gets an unmodifiable list of all modifiers that applies just after the step. + * + * @param type The step type + * @return The list of modifiers + */ + default List modifiersAfter(Supplier type) { + return this.modifiersAfter(type.get()); + } + + /** + * Gets an unmodifiable list of all modifiers that applies just after the step. + * + * @param type The step type + * @return The list of modifiers + */ + List modifiersAfter(DamageStepType type); + + /** + * Adds a modifier that applies just after the step. + * + * @param type The step type + * @param modifier The modifier + */ + default void addModifierAfter(Supplier type, DamageModifier modifier) { + this.addModifierAfter(type.get(), modifier); + } + + /** + * Adds a modifier that applies just after the step. + * + * @param type The step type + * @param modifier The modifier + */ + void addModifierAfter(DamageStepType type, DamageModifier modifier); + } + + /** + * Fires after the damage steps and their side effects have been applied. + * The steps have been captured and can't be changed. + */ + interface Post extends DamageCalculationEvent { + + /** + * Gets the final damage to deal to the targeted {@link Entity}. + * The final damage is the value after the calculation and its {@link DamageStep}s. + * The final damage is the amount of health being lost by the {@link Entity}, if health is tracked. + * To modify the final damage, add a modifier to the step associated to {@link DamageStepTypes#END}. + * + * @return The final damage + */ + double finalDamage(); + + /** + * Gets the {@link DamageStepHistory} of this damage calculation. + * + * @return The history. + */ + DamageStepHistory history(); + } +} diff --git a/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java index 990a05a1deb..a4cab3e9138 100644 --- a/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java @@ -29,32 +29,20 @@ import org.spongepowered.api.entity.living.monster.skeleton.Skeleton; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.projectile.arrow.ArrowLike; -import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cause; -import org.spongepowered.api.event.Event; -import org.spongepowered.api.event.cause.entity.damage.DamageFunction; -import org.spongepowered.api.event.cause.entity.damage.DamageModifier; -import org.spongepowered.api.event.cause.entity.damage.DamageModifier.Builder; -import org.spongepowered.api.event.cause.entity.damage.DamageModifierType; import org.spongepowered.api.event.cause.entity.damage.DamageType; import org.spongepowered.api.event.cause.entity.damage.source.DamageSource; -import org.spongepowered.api.event.impl.entity.AbstractDamageEntityEvent; +import org.spongepowered.api.event.impl.entity.AbstractDamageEntityEventPost; import org.spongepowered.api.item.ItemTypes; import org.spongepowered.api.item.inventory.ItemStack; -import org.spongepowered.api.util.Tuple; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; import org.spongepowered.api.world.World; import org.spongepowered.api.world.difficulty.Difficulties; import org.spongepowered.api.world.difficulty.Difficulty; - -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.DoubleUnaryOperator; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.PropertySettings; /** - * Represents the base event for when an {@link Entity} is being "attacked". + * Represents the base event for when an {@link Entity} is being "damaged". * The uniqueness of this event is that all {@link DamageSource}s can deal * varying amounts of damage with varying modifiers based on various reasons. * Due to this ambiguous variety of information that is possible to provide, @@ -73,7 +61,7 @@ * to a particular {@link DamageType}, has no static finalized amount of damage * to deal to a particular {@link Entity}. To properly represent this, * a {@link DamageSource} has various "states" such as: - * {@link DamageSource#isAbsolute()}, or {@link DamageSource#isBypassingArmor()}. + * {@link DamageSource#isMagic()}, or {@link DamageSource#isBypassingArmor()}. * Quite simply, the {@link DamageSource} will always be the "first" element * within a {@link Cause} that can be retrieved from {@link #cause()}.

    * @@ -84,233 +72,29 @@ * the {@link Cause}. The same can be said if an {@link ArrowLike} was shot from * a {@link Dispenser} that was triggered by a {@link Player} flipping a * switch.

    - * - *

    Continuing with the notion of "modifiers" to damage, the "base" damage - * is modified or added onto after various unknown methods are called or - * processed on the damage. Optimally, these modifiers can be traced to a - * particular object, be it an {@link ItemStack}, {@link Difficulty}, or - * simply an an attribute. The interesting part is that these "modifiers" - * do not just define a static value to add to the "base" damage, they - * are usually a loose form of a {@link DamageFunction} that are applied to - * the "base" damage. Given that {@link Cause} has a unique capability of - * storing any and every {@link Object} willing to be passed into it, we - * can easily represent these "sources" of "modifiers" in a {@link Cause}. - * Now, knowning the "source" will not provide enough information, so a - * {@link DamageModifierType} is provided with a {@link DamageModifier} to - * paint the fullest picture of "explaining" the {@link DamageModifier} as to - * why it is present, and why it is "modifying" the "base" damage. Finally, - * we can associate a {@link DamageModifier} with a {@link DamageFunction} that is - * passed the current "damage" into {@link DoubleUnaryOperator#applyAsDouble(double)} - * , being added - * to the current "damage". After all {@link DamageModifier} {@link DamageFunction}s - * are "applied", the overall "damage" is now the final damage to actually - * throw a {@link DamageEntityEvent}.

    - * - *

    Note that due to the mechanics of the game, {@link DamageModifier}s - * are always ordered in the order of which they apply their modifier onto - * the "base" damage. The implementation for {@link #finalDamage()} can be - * exemplified like so:

    - * - *
    {@code
    - * double damage = this.baseDamage;
    - * for (Map.Entry> entry : this.modifierFunctions.entrySet()) { - * damage += checkNotNull(entry.getValue().apply(damage)); - * } - * return damage; - * }
    - * - * TODO explain groups - *

    After which, the "final" damage is simply the summation of the - * "base" damage and all "modified damage" for each {@link DamageModifier} - * provided in this event.

    - * - *

    Coming forward, it is possible to further customize not only the "base" - * damage, but override pre-existing {@link DamageModifier} {@link DamageFunction}s - * by calling {@link #setDamage(DamageModifier, DoubleUnaryOperator)} at which point the - * end result may be undefined. However, if a custom {@link DamageModifier} - * that aims to alter the "final" damage based on some custom circumstances, - * calling {@link #setDamage(DamageModifier, DoubleUnaryOperator)} on a new - * {@link DamageModifier} instance, easily created from the - * {@link org.spongepowered.api.event.cause.entity.damage.DamageModifier.Builder}, - * the provided pairing will be added at the - * "end" of the list for "modifying" the "base" damage.

    - * - * TODO this is wrong? - *

    Note that this event is intended for processing incoming damage to - * an {@link Entity} prior to any {@link DamageModifier}s associated with - * the {@link #entity()}. The {@link DamageEntityEvent} is used - * to process the various {@link DamageModifier}s of which originate or are - * associated with the targeted {@link Entity}.

    */ -@ImplementedBy(AbstractDamageEntityEvent.class) -public interface DamageEntityEvent extends Event, Cancellable { - - /** - * Gets the {@link Entity}. - * - * @return The entity - */ - Entity entity(); - - /** - * Gets the original "raw" amount of damage to deal to the targeted - * {@link Entity}. - * - * @return The original "raw" damage - */ - double originalDamage(); - - /** - * Gets the original "final" amount of damage after all original - * {@link DamageModifier}s are applied to {@link #originalDamage()}. - * The "final" damage is considered the amount of health being lost by - * the {@link Entity}, if health is tracked. - * - * @return The final amount of damage to originally deal - */ - @PropertySettings(requiredParameter = false, generateMethods = false) - double originalFinalDamage(); - - /** - * Gets an immutable {@link Map} of all original {@link DamageModifier}s - * and their associated "modified" damage. Note that ordering is not - * retained. - * - * @return An immutable map of the original modified damages - */ - @PropertySettings(requiredParameter = false, generateMethods = false) - Map> originalDamages(); - - /** - * Gets the original damage for the provided {@link DamageModifier}. If - * the provided {@link DamageModifier} was not included in - * {@link #originalDamages()}, an {@link IllegalArgumentException} is - * thrown. - * - * @param damageModifier The original damage modifier - * @return The original damage change - */ - Tuple originalModifierDamage(DamageModifier damageModifier); - - /** - * Gets the original {@link List} of {@link DamageModifier} to - * {@link DamageFunction} that was originally passed into the event. - * - * @return The list of damage modifier functions - */ - List originalFunctions(); - - /** - * Gets the "base" damage to deal to the targeted {@link Entity}. The - * "base" damage is the original value before passing along the chain of - * {@link DamageFunction}s for all known {@link DamageModifier}s. - * - * @return The base damage - */ - @PropertySettings(requiredParameter = false, generateMethods = false) - double baseDamage(); - - /** - * Sets the "base" damage to deal to the targeted {@link Entity}. The - * "base" damage is the original value before passing along the chain of - * {@link DamageFunction}s for all known {@link DamageModifier}s. - * - * @param baseDamage The base damage - */ - void setBaseDamage(double baseDamage); - - /** - * Gets the final damage that will be passed into the proceeding - * {@link DamageEntityEvent}. The final damage is the end result of the - * {@link #baseDamage()} being applied in {@link DoubleUnaryOperator#applyAsDouble(double)} - * available from all the {@link Tuple}s of {@link DamageModifier} to - * {@link DamageFunction} in {@link #originalFunctions()}. - * - * @return The final damage to deal - */ - @PropertySettings(requiredParameter = false, generateMethods = false) - double finalDamage(); - - /** - * Checks whether the provided {@link DamageModifier} is applicable to the - * current available {@link DamageModifier}s. - * - * @param damageModifier The damage modifier to check - * @return True if the damage modifier is relevant to this event - */ - boolean isModifierApplicable(DamageModifier damageModifier); - - /** - * Gets the damage for the provided {@link DamageModifier}. Providing that - * {@link #isModifierApplicable(DamageModifier)} returns true, - * the cached "damage" for the {@link DamageModifier} is returned. - * - * @param damageModifier The damage modifier to get the damage for - * @return The modifier - */ - Tuple damage(DamageModifier damageModifier); - - /** - * Sets the provided {@link DamageFunction} to be used for the given - * {@link DamageModifier}. If the {@link DamageModifier} is already - * included in {@link #modifiers()}, the {@link DoubleUnaryOperator} replaces - * the existing function. If there is no {@link Tuple} for the - * {@link DamageModifier}, a new one is created and added to the end - * of the list of {@link DoubleUnaryOperator}s to be applied to the - * {@link #baseDamage()}. - * - *

    If needing to create a custom {@link DamageModifier} is required, - * usage of the {@link Builder} is recommended.

    - * - * @param damageModifier The damage modifier - * @param function The function to map to the modifier - */ - void setDamage(DamageModifier damageModifier, DoubleUnaryOperator function); - - /** - * Adds the provided {@link DamageModifier} and {@link DoubleUnaryOperator} to the - * list of modifiers, such that the {@link Set} containing - * {@link DamageModifierType}s provided in {@code before} will appear - * after the provided damage modifier. - * - * @param damageModifier The damage modifier to add - * @param function The associated function - * @param before The set containing the modifier types to come after - * the provided modifier - */ - void addDamageModifierBefore(DamageModifier damageModifier, DoubleUnaryOperator function, Set before); - - /** - * Adds the provided {@link DamageModifier} and {@link DoubleUnaryOperator} to the list - * of modifiers, such that the modifier will appear in order after any - * current modifiers whose type are included in the provided {@link Set} of - * {@link DamageModifierType}s. - * - * @param damageModifier The damage modifier to add - * @param function The associated function - * @param after The set of modifier types to come before the new modifier - */ - void addModifierAfter(DamageModifier damageModifier, DoubleUnaryOperator function, Set after); +public interface DamageEntityEvent extends DamageCalculationEvent { /** - * Gets a list of simple {@link Tuple}s of {@link DamageModifier} keyed to - * their representative {@link DamageFunction}s. All {@link DamageModifier}s are - * applicable to the entity based on the {@link DamageSource} and any - * possible invulnerabilities due to the {@link DamageSource}. - * - * @return A list of damage modifiers to functions + * Fires before the damage steps and their side effects are applied. + * The final damage is still unknown. */ - @PropertySettings(requiredParameter = false, generateMethods = false) - List modifiers(); + interface Pre extends DamageEntityEvent, DamageCalculationEvent.Pre { + } /** - * Returns whether or not this event will cause the entity to die if the - * event is not cancelled. Only supported for living entities, returns false - * if {@link #entity()} is not a living entity. - * - * @return Whether the entity will die + * Fires after the damage steps and their side effects have been applied. */ - @PropertySettings(requiredParameter = false, generateMethods = false) - boolean willCauseDeath(); + @ImplementedBy(AbstractDamageEntityEventPost.class) + interface Post extends DamageEntityEvent, DamageCalculationEvent.Post { + /** + * Returns whether this event will cause the entity to die if the event is not cancelled. + * Only supported for living entities, returns false if {@link #entity()} is not a living entity. + * + * @return Whether the entity will die + */ + @PropertySettings(requiredParameter = false, generateMethods = false) + boolean willCauseDeath(); + } } diff --git a/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java index 192cbdb8c44..853ba04ef86 100644 --- a/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java @@ -29,8 +29,8 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.message.AudienceMessageEvent; import org.spongepowered.api.event.message.MessageCancellable; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; import org.spongepowered.api.world.gamerule.GameRules; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * An event where the {@link Entity} is being either removed usually due to diff --git a/src/main/java/org/spongepowered/api/event/entity/ExpireEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/ExpireEntityEvent.java index 9cb96bc2a7d..a9f265eb765 100644 --- a/src/main/java/org/spongepowered/api/event/entity/ExpireEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/ExpireEntityEvent.java @@ -28,7 +28,7 @@ import org.spongepowered.api.entity.living.monster.Endermite; import org.spongepowered.api.entity.weather.LightningBolt; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Called when an {@link Entity} is expiring from the world. Examples may diff --git a/src/main/java/org/spongepowered/api/event/entity/HarvestEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/HarvestEntityEvent.java index e2feb2fe8d8..3bbb689d414 100644 --- a/src/main/java/org/spongepowered/api/event/entity/HarvestEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/HarvestEntityEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Called when an {@link Entity} has been killed and is being "harvested" (drops/etc). Happens diff --git a/src/main/java/org/spongepowered/api/event/entity/InvokePortalEvent.java b/src/main/java/org/spongepowered/api/event/entity/InvokePortalEvent.java index e71bea00bec..e2e27b0a743 100644 --- a/src/main/java/org/spongepowered/api/event/entity/InvokePortalEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/InvokePortalEvent.java @@ -27,9 +27,10 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; import org.spongepowered.api.world.portal.PortalLogic; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.math.vector.Vector3d; import java.util.Optional; @@ -59,6 +60,7 @@ public interface InvokePortalEvent extends Event { * Called when entering a portal. * Cancel to prevent portal effects. */ + @GenerateFactoryMethod interface Enter extends InvokePortalEvent, Cancellable { /** @@ -88,6 +90,7 @@ interface Enter extends InvokePortalEvent, Cancellable { * Canceling resets the portal transition time * Setting custom portal logic can change the teleport behaviour. */ + @GenerateFactoryMethod interface Prepare extends InvokePortalEvent, Cancellable { /** @@ -102,6 +105,7 @@ interface Prepare extends InvokePortalEvent, Cancellable { * Called after a {@link PortalLogic} calculated and found or generated the portal exit. * Note that {@link ChangeEntityWorldEvent} still fire after this. */ + @GenerateFactoryMethod interface Execute extends InvokePortalEvent, ChangeEntityWorldEvent.Reposition, RotateEntityEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/entity/MoveEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/MoveEntityEvent.java index bed41167130..5a550c5cabd 100644 --- a/src/main/java/org/spongepowered/api/event/entity/MoveEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/MoveEntityEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; import org.spongepowered.math.vector.Vector3d; /** diff --git a/src/main/java/org/spongepowered/api/event/entity/RotateEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/RotateEntityEvent.java index 007007ef281..f245eef5c8c 100644 --- a/src/main/java/org/spongepowered/api/event/entity/RotateEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/RotateEntityEvent.java @@ -27,8 +27,8 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; import org.spongepowered.math.vector.Vector3d; /** diff --git a/src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java index f459b856f79..8ead9621984 100644 --- a/src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java @@ -26,9 +26,10 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cause; +import org.spongepowered.api.event.impl.entity.AbstractAffectEntityEvent; import org.spongepowered.api.event.impl.entity.AbstractSpawnEntityEvent; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.ImplementedBy; /** * Raised when an {@link Entity} is spawned. This usually follows the chain of @@ -51,7 +52,8 @@ public interface SpawnEntityEvent extends AffectEntityEvent { * will result in no awareness to the client that the entity was being * spawned and later cancelled. */ - interface Pre extends SpawnEntityEvent {} + @ImplementedBy(value = AbstractAffectEntityEvent.class, priority = 2) + interface Pre extends AffectEntityEvent {} interface Custom extends SpawnEntityEvent {} } diff --git a/src/main/java/org/spongepowered/api/event/entity/ai/goal/GoalEvent.java b/src/main/java/org/spongepowered/api/event/entity/ai/goal/GoalEvent.java index 0d14efda4ac..0e9758a6f34 100644 --- a/src/main/java/org/spongepowered/api/event/entity/ai/goal/GoalEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/ai/goal/GoalEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; import org.spongepowered.api.event.impl.entity.ai.goal.AbstractGoalEvent; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; +import org.spongepowered.eventgen.annotations.ImplementedBy; @ImplementedBy(AbstractGoalEvent.class) public interface GoalEvent extends Event, Cancellable { diff --git a/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java b/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java index 65555c1227d..2fdb6f8f99c 100644 --- a/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.event.entity.living.player; +import org.spongepowered.api.ResourceKey; import org.spongepowered.api.entity.living.player.CooldownTracker; import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.event.Cancellable; @@ -47,11 +48,11 @@ public interface CooldownEvent extends Event { ServerPlayer player(); /** - * Gets the associated item type whose cooldown is being set or removed. + * Gets the associated item group whose cooldown is being set or removed. * * @return The associated item type */ - ItemType itemType(); + ResourceKey group(); /** * Handles an {@link ItemType} being given a cooldown for a {@link ServerPlayer player}. 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 5502c27384d..7dc4e4f27ba 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 @@ -31,7 +31,7 @@ import org.spongepowered.api.event.Event; import org.spongepowered.api.network.ServerSideConnection; import org.spongepowered.api.profile.GameProfile; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; import java.util.Optional; diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/FeatureTemplate.java b/src/main/java/org/spongepowered/api/event/impl/AbstractCompositeEvent.java similarity index 57% rename from src/main/java/org/spongepowered/api/world/generation/feature/FeatureTemplate.java rename to src/main/java/org/spongepowered/api/event/impl/AbstractCompositeEvent.java index f294d865997..cc4389429f8 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/FeatureTemplate.java +++ b/src/main/java/org/spongepowered/api/event/impl/AbstractCompositeEvent.java @@ -22,38 +22,38 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.world.generation.feature; +package org.spongepowered.api.event.impl; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; +import org.spongepowered.api.event.Cancellable; +import org.spongepowered.api.event.CompositeEvent; +import org.spongepowered.api.event.Event; +import org.spongepowered.eventgen.annotations.UseField; -/** - * A template for {@link Feature features} - */ -public interface FeatureTemplate extends DataPackEntry { +import java.util.Collections; +import java.util.List; - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } +public abstract class AbstractCompositeEvent extends AbstractEvent implements CompositeEvent { - /** - * Returns the feature. - * - * @return The feature - */ - Feature feature(); + @UseField + protected E baseEvent; - interface Builder extends DataPackEntryBuilder { + @UseField(overrideToString = true) + protected List children; - /** - * Sets the given {@link FeatureType}. - * - * @param type The feature type - * @return The builder, for chaining - */ - Builder type(FeatureType type); + @UseField + protected boolean cancelled; + public final void postInit() { + this.children = Collections.unmodifiableList(this.children); } + @Override + public void setCancelled(boolean cancel) { + this.cancelled = cancel; + this.children().forEach(event -> { + if (event instanceof Cancellable cancellable) { + cancellable.setCancelled(cancel); + } + }); + } } diff --git a/src/main/java/org/spongepowered/api/event/impl/data/AbstractValueChangeEvent.java b/src/main/java/org/spongepowered/api/event/impl/data/AbstractValueChangeEvent.java index 34292304fcf..a19d1081fb2 100644 --- a/src/main/java/org/spongepowered/api/event/impl/data/AbstractValueChangeEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/data/AbstractValueChangeEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.data.DataTransactionResult; import org.spongepowered.api.event.data.ChangeDataHolderEvent; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; public abstract class AbstractValueChangeEvent implements ChangeDataHolderEvent.ValueChange { diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAffectEntityEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAffectEntityEvent.java index 7504abafd55..a6b4d36638c 100644 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAffectEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAffectEntityEvent.java @@ -29,7 +29,7 @@ import org.spongepowered.api.event.Order; import org.spongepowered.api.event.entity.AffectEntityEvent; import org.spongepowered.api.event.impl.AbstractEvent; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; import java.util.Collections; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAttackEntityEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAttackEntityEvent.java deleted file mode 100644 index 6d8531e060a..00000000000 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAttackEntityEvent.java +++ /dev/null @@ -1,194 +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.event.impl.entity; - -import org.spongepowered.api.event.cause.entity.damage.DamageFunction; -import org.spongepowered.api.event.cause.entity.damage.DamageModifier; -import org.spongepowered.api.event.cause.entity.damage.DamageModifierType; -import org.spongepowered.api.event.cause.entity.damage.ModifierFunction; -import org.spongepowered.api.event.entity.AttackEntityEvent; -import org.spongepowered.api.util.Tuple; -import org.spongepowered.api.util.annotation.eventgen.UseField; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.function.DoubleUnaryOperator; -import java.util.function.Function; -import java.util.stream.Collectors; - -public abstract class AbstractAttackEntityEvent extends AbstractModifierEvent implements AttackEntityEvent { - - @UseField protected double originalDamage; - @UseField protected List originalFunctions; - - @UseField protected double baseDamage; - - @Override - protected final void init() { - this.originalFunctions = this.init(this.originalDamage, this.originalFunctions); - this.baseDamage = this.originalDamage; - } - - @Override - public final Tuple originalModifierDamage(final DamageModifier damageModifier) { - Objects.requireNonNull(damageModifier, "Damage modifier cannot be null!"); - for (final var tuple : this.originalModifiers) { - if (tuple.first().equals(damageModifier)) { - return tuple.second(); - } - } - throw new IllegalArgumentException("The provided damage modifier is not applicable: " + damageModifier.toString()); - } - - @Override - public final double originalFinalDamage() { - return this.originalFinalAmount; - } - - @Override - public final Map> originalDamages() { - - return this.originalModifierMap; - } - - @Override - public final double finalOutputDamage() { - return this.finalAmount(this.baseDamage); - } - - @Override - public final boolean isModifierApplicable(final DamageModifier damageModifier) { - return this.modifiers.containsKey(Objects.requireNonNull(damageModifier)); - } - - @Override - public final Tuple outputDamage(final DamageModifier damageModifier) { - if (!this.modifiers.containsKey(Objects.requireNonNull(damageModifier, "Damage Modifier cannot be null!"))) { - throw new IllegalArgumentException("The provided damage modifier is not applicable: " + damageModifier.toString()); - } - return this.modifiers.get(Objects.requireNonNull(damageModifier)); - } - - @Override - public final void setOutputDamage(final DamageModifier damageModifier, final DoubleUnaryOperator function) { - Objects.requireNonNull(damageModifier, "Damage modifier was null!"); - Objects.requireNonNull(function, "Function was null!"); - int indexToAddTo = 0; - boolean addAtEnd = true; - for (final Iterator iterator = this.modifierFunctions.iterator(); iterator.hasNext(); ) { - final ModifierFunction tuple = iterator.next(); - if (tuple.modifier().equals(damageModifier)) { - iterator.remove(); - addAtEnd = false; - break; - } - indexToAddTo++; - } - if (addAtEnd) { - this.modifierFunctions.add(new DamageFunction(damageModifier, function)); - } else { - this.modifierFunctions.add(indexToAddTo, new DamageFunction(damageModifier, function)); - } - this.recalculate(this.baseDamage); - } - - @Override - public void addDamageModifierBefore(final DamageModifier damageModifier, final DoubleUnaryOperator function, final Set before) { - Objects.requireNonNull(damageModifier, "Damage modifier was null!"); - Objects.requireNonNull(function, "Function was null!"); - int indexToAddBefore = -1; - int index = 0; - for (final ModifierFunction tuple : this.modifierFunctions) { - if (tuple.modifier().equals(damageModifier)) { - throw new IllegalArgumentException("Cannot add a duplicate modifier"); - } - if (before.contains(tuple.modifier().type())) { - indexToAddBefore = index; - } - index++; - - } - if (indexToAddBefore == -1) { - this.modifierFunctions.add(new DamageFunction(damageModifier, function)); - } else { - this.modifierFunctions.add(indexToAddBefore, new DamageFunction(damageModifier, function)); - } - this.recalculate(this.baseDamage); - } - - @Override - public void addDamageModifierAfter(final DamageModifier damageModifier, final DoubleUnaryOperator function, final Set after) { - Objects.requireNonNull(damageModifier, "Damage modifier was null!"); - Objects.requireNonNull(function, "Function was null!"); - int indexToAddAfter = -1; - int index = 0; - for (final ModifierFunction tuple : this.modifierFunctions) { - if (tuple.modifier().equals(damageModifier)) { - throw new IllegalArgumentException("Cannot add a duplicate modifier"); - } - if (after.contains(tuple.modifier().type())) { - indexToAddAfter = index; - } - index++; - - } - if (indexToAddAfter == -1) { - this.modifierFunctions.add(new DamageFunction(damageModifier, function)); - } else { - this.modifierFunctions.add(indexToAddAfter + 1, new DamageFunction(damageModifier, function)); - } - this.recalculate(this.baseDamage); - } - - @Override - public double baseOutputDamage() { - return this.baseDamage; - } - - @Override - public final void setBaseOutputDamage(final double baseDamage) { - this.baseDamage = baseDamage; - this.recalculate(this.baseDamage); - } - - @Override - protected DamageFunction convertTuple(final DamageModifier obj, final DoubleUnaryOperator function) { - return new DamageFunction(obj, function); - } - - @Override - public List modifiers() { - return this.modifierFunctions.stream().map((Function, DamageFunction>) entry -> { - if (entry instanceof DamageFunction) { - return (DamageFunction) entry; - } else { - return new DamageFunction(entry.modifier(), entry.function()); - } - }).collect(Collectors.toUnmodifiableList()); - } -} diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractChangeEntityEquipmentEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractChangeEntityEquipmentEvent.java index 20e52426b5d..b1bfdea3ddc 100644 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractChangeEntityEquipmentEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractChangeEntityEquipmentEvent.java @@ -28,7 +28,7 @@ import org.spongepowered.api.event.entity.ChangeEntityEquipmentEvent; import org.spongepowered.api.event.impl.AbstractEvent; import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; public abstract class AbstractChangeEntityEquipmentEvent extends AbstractEvent implements ChangeEntityEquipmentEvent { diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageCalculationEventPre.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageCalculationEventPre.java new file mode 100644 index 00000000000..45509339073 --- /dev/null +++ b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageCalculationEventPre.java @@ -0,0 +1,69 @@ +/* + * 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.event.impl.entity; + +import org.spongepowered.api.event.cause.entity.damage.DamageModifier; +import org.spongepowered.api.event.cause.entity.damage.DamageStepType; +import org.spongepowered.api.event.entity.DamageCalculationEvent; +import org.spongepowered.api.event.impl.AbstractEvent; + +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +public abstract class AbstractDamageCalculationEventPre extends AbstractEvent implements DamageCalculationEvent.Pre { + private final Map> modifiersBeforeMap = new HashMap<>(); + private final Map> modifiersAfterMap = new HashMap<>(); + + private List getModifiersBefore(DamageStepType type) { + return this.modifiersBeforeMap.computeIfAbsent(type, k -> new LinkedList<>()); + } + + private List getModifiersAfter(DamageStepType type) { + return this.modifiersAfterMap.computeIfAbsent(type, k -> new LinkedList<>()); + } + + @Override + public List modifiersBefore(DamageStepType type) { + return Collections.unmodifiableList(this.getModifiersBefore(type)); + } + + @Override + public List modifiersAfter(DamageStepType type) { + return Collections.unmodifiableList(this.getModifiersAfter(type)); + } + + @Override + public void addModifierBefore(DamageStepType type, DamageModifier modifier) { + this.getModifiersBefore(type).addFirst(modifier); + } + + @Override + public void addModifierAfter(DamageStepType type, DamageModifier modifier) { + this.getModifiersAfter(type).addLast(modifier); + } +} diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEvent.java deleted file mode 100644 index 598d34e222e..00000000000 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEvent.java +++ /dev/null @@ -1,202 +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.event.impl.entity; - -import org.spongepowered.api.data.Keys; -import org.spongepowered.api.event.cause.entity.damage.DamageFunction; -import org.spongepowered.api.event.cause.entity.damage.DamageModifier; -import org.spongepowered.api.event.cause.entity.damage.DamageModifierType; -import org.spongepowered.api.event.cause.entity.damage.ModifierFunction; -import org.spongepowered.api.event.entity.DamageEntityEvent; -import org.spongepowered.api.util.Tuple; -import org.spongepowered.api.util.annotation.eventgen.UseField; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.DoubleUnaryOperator; -import java.util.function.Function; -import java.util.stream.Collectors; - -public abstract class AbstractDamageEntityEvent extends AbstractModifierEvent implements DamageEntityEvent { - - @UseField protected double originalDamage; - @UseField protected List originalFunctions; - @UseField protected double baseDamage; - - @Override - protected final void init() { - this.originalFunctions = this.init(this.originalDamage, this.originalFunctions); - this.baseDamage = this.originalDamage; - } - - @Override - public final Tuple originalModifierDamage(DamageModifier damageModifier) { - Objects.requireNonNull(damageModifier, "The damage modifier cannot be null!"); - for (var tuple : this.originalModifiers) { - if (tuple.first().equals(damageModifier)) { - return tuple.second(); - } - } - throw new IllegalArgumentException("The provided damage modifier is not applicable: " + damageModifier.toString()); - } - - @Override - public final double originalFinalDamage() { - return this.originalFinalAmount; - } - - @Override - public final Map> originalDamages() { - - return this.originalModifierMap; - } - - @Override - public final double finalDamage() { - return this.finalAmount(this.baseDamage); - } - - @Override - public final boolean isModifierApplicable(DamageModifier damageModifier) { - return this.modifiers.containsKey(Objects.requireNonNull(damageModifier)); - } - - @Override - public final Tuple damage(DamageModifier damageModifier) { - if (!this.modifiers.containsKey(Objects.requireNonNull(damageModifier, "Damage Modifier cannot be null!"))) { - throw new IllegalArgumentException("The provided damage modifier is not applicable: " + damageModifier); - } - return this.modifiers.get(Objects.requireNonNull(damageModifier)); - } - - @Override - public final void setDamage(DamageModifier damageModifier, DoubleUnaryOperator function) { - Objects.requireNonNull(damageModifier, "Damage modifier was null!"); - Objects.requireNonNull(function, "Function was null!"); - int indexToAddTo = 0; - boolean addAtEnd = true; - for (Iterator iterator = this.modifierFunctions.iterator(); iterator.hasNext(); ) { - final ModifierFunction tuple = iterator.next(); - if (tuple.modifier().equals(damageModifier)) { - iterator.remove(); - addAtEnd = false; - break; - } - indexToAddTo++; - } - if (addAtEnd) { - this.modifierFunctions.add(new DamageFunction(damageModifier, function)); - } else { - this.modifierFunctions.add(indexToAddTo, new DamageFunction(damageModifier, function)); - } - this.recalculate(this.baseDamage); - } - - @Override - public void addDamageModifierBefore(DamageModifier damageModifier, DoubleUnaryOperator function, Set before) { - Objects.requireNonNull(damageModifier, "Damage modifier was null!"); - Objects.requireNonNull(function, "Function was null!"); - int indexToAddBefore = -1; - int index = 0; - for (ModifierFunction tuple : this.modifierFunctions) { - if (tuple.modifier().equals(damageModifier)) { - throw new IllegalArgumentException("Cannot add a duplicate modifier"); - } - if (before.contains(tuple.modifier().type())) { - indexToAddBefore = index; - } - index++; - - } - if (indexToAddBefore == -1) { - this.modifierFunctions.add(new DamageFunction(damageModifier, function)); - } else { - this.modifierFunctions.add(indexToAddBefore, new DamageFunction(damageModifier, function)); - } - this.recalculate(this.baseDamage); - } - - @Override - public void addModifierAfter(DamageModifier damageModifier, DoubleUnaryOperator function, Set after) { - Objects.requireNonNull(damageModifier, "Damage modifier was null!"); - Objects.requireNonNull(function, "Function was null!"); - int indexToAddAfter = -1; - int index = 0; - for (ModifierFunction tuple : this.modifierFunctions) { - if (tuple.modifier().equals(damageModifier)) { - throw new IllegalArgumentException("Cannot add a duplicate modifier"); - } - if (after.contains(tuple.modifier().type())) { - indexToAddAfter = index; - } - index++; - - } - if (indexToAddAfter == -1) { - this.modifierFunctions.add(new DamageFunction(damageModifier, function)); - } else { - this.modifierFunctions.add(indexToAddAfter + 1, new DamageFunction(damageModifier, function)); - } - this.recalculate(this.baseDamage); - } - - @Override - protected DamageFunction convertTuple(DamageModifier obj, DoubleUnaryOperator function) { - return new DamageFunction(obj, function); - } - - @Override - public List modifiers() { - return this.modifierFunctions.stream().map((Function, DamageFunction>) entry -> { - if (entry instanceof DamageFunction) { - return (DamageFunction) entry; - } else { - return new DamageFunction(entry.modifier(), entry.function()); - } - }).collect(Collectors.toUnmodifiableList()); - } - - @Override - public double baseDamage() { - return this.baseDamage; - } - - @Override - public final void setBaseDamage(double baseDamage) { - this.baseDamage = baseDamage; - this.recalculate(this.baseDamage); - } - - @Override - public boolean willCauseDeath() { - final Optional health = this.entity().get(Keys.HEALTH); - return health.isPresent() && health.get() - this.finalDamage() <= 0; - } - -} diff --git a/src/main/java/org/spongepowered/api/data/type/ArtTypeTemplate.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEventPost.java similarity index 69% rename from src/main/java/org/spongepowered/api/data/type/ArtTypeTemplate.java rename to src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEventPost.java index ce73fc6ffdc..8dfbaffb345 100644 --- a/src/main/java/org/spongepowered/api/data/type/ArtTypeTemplate.java +++ b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEventPost.java @@ -22,23 +22,19 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.data.type; +package org.spongepowered.api.event.impl.entity; -import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; +import org.spongepowered.api.data.Keys; +import org.spongepowered.api.event.entity.DamageEntityEvent; +import org.spongepowered.api.event.impl.AbstractEvent; -public interface ArtTypeTemplate extends DataPackEntry { +import java.util.Optional; - ArtType type(); - - interface Builder extends DataPackEntryBuilder { - - Builder dimensions(int width, int height); - - Builder asset(ResourceKey assetId); +public abstract class AbstractDamageEntityEventPost extends AbstractEvent implements DamageEntityEvent.Post { + @Override + public boolean willCauseDeath() { + final Optional health = this.entity().get(Keys.HEALTH); + return health.isPresent() && health.get() - this.finalDamage() <= 0; } - - } diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractModifierEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractModifierEvent.java deleted file mode 100644 index f9b99168c97..00000000000 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractModifierEvent.java +++ /dev/null @@ -1,105 +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.event.impl.entity; - -import org.spongepowered.api.event.cause.entity.damage.DamageModifier; -import org.spongepowered.api.event.cause.entity.damage.ModifierFunction; -import org.spongepowered.api.event.entity.DamageEntityEvent; -import org.spongepowered.api.event.impl.AbstractEvent; -import org.spongepowered.api.util.Tuple; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.function.DoubleUnaryOperator; - -/** - * An abstract base class for implementations of {@link DamageEntityEvent}. - * - * @param The modifier type to use - */ -public abstract class AbstractModifierEvent, M> extends AbstractEvent { - - protected double originalFinalAmount; - protected List>> originalModifiers; - protected Map> originalModifierMap; - protected final LinkedHashMap> modifiers = new LinkedHashMap<>(); - protected final List modifierFunctions = new ArrayList<>(); - - protected List init(double baseAmount, List functions) { - functions.stream().map(entry -> this.convertTuple(entry.modifier(), entry.function())).forEach(this.modifierFunctions::add); - this.originalFinalAmount = this.recalculate(baseAmount); - this.originalModifiers = this.modifiers.entrySet().stream().map(e -> new Tuple<>(e.getKey(), e.getValue())).toList(); - this.originalModifierMap = Map.copyOf(this.modifiers); - return functions.stream().map(entry -> this.convertTuple(entry.modifier(), entry.function())).toList(); - } - - protected abstract T convertTuple(M obj, DoubleUnaryOperator function); - - protected double recalculate(final double baseAmount) { - final var amounts = AbstractModifierEvent.recalculate(this.modifierFunctions, baseAmount, this.modifiers); - return amounts.values().stream().mapToDouble(Double::doubleValue).sum(); - } - - private static , M> Map recalculate(final List functions, final double baseAmount, final Map> into) { - into.clear(); - final var defaultGroup = "default"; - final Map amounts = new HashMap<>(); - for (T func : functions) { - var group = defaultGroup; - if (func.modifier() instanceof DamageModifier damageModifier) { - group = damageModifier.group(); - } - final var oldAmount = amounts.getOrDefault(group, baseAmount); - final var newAmount = func.function().applyAsDouble(oldAmount); - amounts.put(group, newAmount); - into.put(func.modifier(), new Tuple<>(oldAmount, newAmount)); - } - if (amounts.isEmpty()) { - amounts.put(defaultGroup, baseAmount); - } - return amounts; - } - - protected double finalAmount(final double baseAmount) { - final var amounts = AbstractModifierEvent.finalAmounts(baseAmount, this.modifierFunctions); - return amounts.values().stream().mapToDouble(Double::doubleValue).sum(); - } - - public static , M> Map finalAmounts(final double baseAmount, final List modifiers) { - return AbstractModifierEvent.recalculate(modifiers, baseAmount, new LinkedHashMap<>()); - } - - /** - * Gets the modifiers affecting this event. - * - * @return The list of modifiers - */ - public List modifiers() { - return List.copyOf(this.modifierFunctions); - } -} diff --git a/src/main/java/org/spongepowered/api/event/impl/world/AbstractDetonateEvent.java b/src/main/java/org/spongepowered/api/event/impl/world/AbstractDetonateEvent.java index 2227b7b165e..e88affc0d6f 100644 --- a/src/main/java/org/spongepowered/api/event/impl/world/AbstractDetonateEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/world/AbstractDetonateEvent.java @@ -26,8 +26,8 @@ import org.spongepowered.api.event.impl.entity.AbstractAffectEntityEvent; import org.spongepowered.api.event.world.ExplosionEvent; -import org.spongepowered.api.util.annotation.eventgen.UseField; import org.spongepowered.api.world.server.ServerLocation; +import org.spongepowered.eventgen.annotations.UseField; import java.util.Collections; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/AffectItemStackEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/AffectItemStackEvent.java index 6e46aafe463..a24e83a0b30 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/AffectItemStackEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/AffectItemStackEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.item.inventory.Inventory; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/AffectSlotEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/AffectSlotEvent.java index ab7d667fd58..197893a448b 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/AffectSlotEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/AffectSlotEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.transaction.SlotTransaction; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/ChangeInventoryEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/ChangeInventoryEvent.java index 0ba10845c86..2936292ea15 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/ChangeInventoryEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/ChangeInventoryEvent.java @@ -32,8 +32,8 @@ import org.spongepowered.api.item.inventory.Inventory; import org.spongepowered.api.item.inventory.ItemStackSnapshot; import org.spongepowered.api.item.inventory.Slot; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.PropertySettings; import java.util.List; import java.util.Optional; diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/InteractItemEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/InteractItemEvent.java index 74ede46988f..7a7c8c266ee 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/InteractItemEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/InteractItemEvent.java @@ -25,12 +25,14 @@ package org.spongepowered.api.event.item.inventory; import org.spongepowered.api.event.Cancellable; +import org.spongepowered.api.event.CompositeEvent; import org.spongepowered.api.event.action.InteractEvent; import org.spongepowered.api.event.block.InteractBlockEvent; import org.spongepowered.api.event.entity.InteractEntityEvent; import org.spongepowered.api.event.entity.living.AnimateHandEvent; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Base event for all interactions with an {@link ItemStack} in hand. @@ -64,5 +66,21 @@ interface Primary extends InteractItemEvent { * *

    Vanilla minecraft does not call an event when interacting with an empty hand in air.

    */ - interface Secondary extends InteractItemEvent, Cancellable {} + @GenerateFactoryMethod + interface Secondary extends InteractItemEvent, Cancellable { + + interface Pre extends Secondary { + + } + + interface Post extends CompositeEvent, Secondary { + + @Override + default ItemStackSnapshot itemStack() { + return this.baseEvent().itemStack(); + } + + } + + } } diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java index 3f4f0986feb..98f865043b9 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.item.inventory.AnvilCost; import org.spongepowered.api.item.inventory.Inventory; import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Fires whenever the left and right slots of an anvil are filled and a new result is computed. diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/container/InteractContainerEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/container/InteractContainerEvent.java index b8456aeacb8..8a9b8f0c277 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/container/InteractContainerEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/container/InteractContainerEvent.java @@ -56,7 +56,27 @@ public interface InteractContainerEvent extends Event, Cancellable { interface Open extends InteractContainerEvent {} /** - * The target container was closed. + * Base event when a {@link Container} is closed. */ - interface Close extends ChangeInventoryEvent, InteractContainerEvent {} + interface Close extends InteractContainerEvent { + + /** + * Fired before the {@link Container} is closed. + * + *

    Cancelling this event will prevent the {@link Container} + * from being closed.

    + */ + interface Pre extends Close { + } + + /** + * Fired after the {@link Container} was closed. + * + *

    Cancelling this event will rollback the content + * of the {@link Container} that was mutated during + * the close.

    + */ + interface Post extends Close, ChangeInventoryEvent { + } + } } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/ConstructPluginEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/ConstructPluginEvent.java index dcdf4d33485..5befd25781b 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/ConstructPluginEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/ConstructPluginEvent.java @@ -24,8 +24,10 @@ */ package org.spongepowered.api.event.lifecycle; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; import org.spongepowered.plugin.PluginContainer; +@GenerateFactoryMethod public interface ConstructPluginEvent extends LifecycleEvent { PluginContainer plugin(); diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/EngineLifecycleEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/EngineLifecycleEvent.java index 58cf05f64dd..a420393f18e 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/EngineLifecycleEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/EngineLifecycleEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.Engine; import org.spongepowered.api.event.GenericEvent; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; @NoFactoryMethod public interface EngineLifecycleEvent extends GenericEvent, LifecycleEvent { diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/FreezeRegistryEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/FreezeRegistryEvent.java new file mode 100644 index 00000000000..6ac903b1cc6 --- /dev/null +++ b/src/main/java/org/spongepowered/api/event/lifecycle/FreezeRegistryEvent.java @@ -0,0 +1,79 @@ +/* + * 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.event.lifecycle; + +import org.spongepowered.api.Engine; +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.event.GenericEvent; +import org.spongepowered.api.registry.Registry; +import org.spongepowered.api.registry.RegistryHolder; +import org.spongepowered.api.registry.RegistryType; + +import java.util.function.Consumer; + +public interface FreezeRegistryEvent extends LifecycleEvent { + + /** + * Fired after a layer has established its registries + * and is no longer accepting any type of modifications. + * + *

    Note: Layers might be reloadable! + * When a registry is being reloaded, this event is fired + * again for the relevant registries.

    + */ + interface Post extends FreezeRegistryEvent { + + /** + * Gets the built {@link RegistryHolder registry holder}. + * + * @return The registry holder. + */ + RegistryHolder holder(); + + /** + *

    Fetch a registry by its type.

    + * + *

    The consumer will be called if it matches the current set of + * registries being created.

    + * + * @param registryType The registry type to fetch. + * @param consumer The consumer to be called if found. + */ + default void registry(RegistryType registryType, Consumer> consumer) { + this.holder().findRegistry(registryType).ifPresent(consumer); + } + + interface GameScoped extends Post { + } + + interface EngineScoped extends Post, GenericEvent { + } + + interface WorldScoped extends Post { + + ResourceKey worldKey(); + } + } +} diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/LifecycleEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/LifecycleEvent.java index e76643aac7f..21df07bf922 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/LifecycleEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/LifecycleEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.Game; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * An event called during the lifetime (start to stop) of a diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/LoadedGameEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/LoadedGameEvent.java index f68a02615ca..f7b31ccd64d 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/LoadedGameEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/LoadedGameEvent.java @@ -25,11 +25,13 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.Game; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Called when the implementation signals that all the aspects of the * {@link Game} have completed loading. */ +@GenerateFactoryMethod public interface LoadedGameEvent extends LifecycleEvent { } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java index bf449d52316..ed6d93d9041 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java @@ -25,7 +25,9 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.Engine; +import org.spongepowered.api.event.BiGenericEvent; import org.spongepowered.api.event.GenericEvent; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.function.Supplier; @@ -47,6 +49,7 @@ * * @param The service to provide. */ +@NoFactoryMethod public interface ProvideServiceEvent extends GenericEvent, LifecycleEvent { /** @@ -70,18 +73,12 @@ interface GameScoped extends ProvideServiceEvent { *

    It is up to the provider to determine which engine a service is to be * supplied for. Services that are engine scoped may not support all * engines. Plugins can check to see what {@link Engine} the service will - * be provided for via the {@link #engine()} method, and can choose to + * be provided for via the {@link E} type parameter, and can choose to * forgo providing a service based on this information.

    * * @param The service to provide. + * @param The target engine. */ - interface EngineScoped extends ProvideServiceEvent { - - /** - * Gets the {@link Engine} that is associated with this event. - * - * @return The engine. - */ - Engine engine(); + interface EngineScoped extends ProvideServiceEvent, BiGenericEvent { } } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RefreshGameEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RefreshGameEvent.java index 148585a47d8..6f06938d92b 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RefreshGameEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RefreshGameEvent.java @@ -25,6 +25,7 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.Game; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Fired when something within a {@link Game} triggers a refresh of @@ -37,6 +38,7 @@ * plugin use. *

    */ +@GenerateFactoryMethod public interface RefreshGameEvent extends LifecycleEvent { } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java index 5c027aa7ccb..e295e7e7b16 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java @@ -26,9 +26,11 @@ import org.spongepowered.api.registry.DuplicateRegistrationException; import org.spongepowered.api.util.Builder; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.function.Supplier; +@NoFactoryMethod public interface RegisterBuilderEvent extends LifecycleEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterChannelEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterChannelEvent.java index bb9e3d248be..8c8818ebd7d 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterChannelEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterChannelEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.ResourceKey; import org.spongepowered.api.network.channel.Channel; import org.spongepowered.api.registry.DuplicateRegistrationException; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Lifecycle event to indicate when network channels should be created and registered. diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java index 1fbecd17c14..ea9d12b3356 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java @@ -29,6 +29,8 @@ import org.spongepowered.api.command.manager.CommandMapping; import org.spongepowered.api.command.registrar.CommandRegistrar; import org.spongepowered.api.event.GenericEvent; +import org.spongepowered.api.registry.RegistryHolder; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.plugin.PluginContainer; /** @@ -60,8 +62,16 @@ * * @param The type of command that is being registered. */ +@NoFactoryMethod public interface RegisterCommandEvent extends GenericEvent, LifecycleEvent { + /** + * Gets the owning {@link RegistryHolder registry holder}. + * + * @return The registry holder. + */ + RegistryHolder registryHolder(); + /** * Registers a command with the appropriate {@link CommandRegistrar}. * diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataEvent.java index 294f0620ffe..a34d4d9147b 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.data.DataManager; import org.spongepowered.api.data.DataRegistration; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Lifecycle event for registering custom {@link DataRegistration data} within the {@link DataManager}. diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java index dab7e6222a9..c54152ea77d 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java @@ -25,7 +25,9 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.registry.DuplicateRegistrationException; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; +@NoFactoryMethod public interface RegisterFactoryEvent extends LifecycleEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java index 562da7f2adc..5e0e0b4f1d2 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java @@ -29,11 +29,15 @@ import org.spongepowered.api.event.GenericEvent; import org.spongepowered.api.registry.DuplicateRegistrationException; import org.spongepowered.api.registry.Registry; +import org.spongepowered.api.registry.RegistryHolder; import org.spongepowered.api.registry.RegistryType; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.Map; +import java.util.function.Function; import java.util.function.Supplier; +@NoFactoryMethod public interface RegisterRegistryEvent extends LifecycleEvent { /** @@ -55,6 +59,16 @@ public interface RegisterRegistryEvent extends LifecycleEvent { */ RegistryType register(ResourceKey key, boolean isDynamic, Supplier> defaultValues) throws DuplicateRegistrationException; + /** + * Registers a new {@link Registry}. + * + * @param key The key for the registry + * @param isDynamic If this registry will support additional registrations after the lifecycle + * @param defaultValues The values to populate the registry with + * @throws DuplicateRegistrationException If the type is already registered + */ + RegistryType register(ResourceKey key, boolean isDynamic, Function> defaultValues, RegistryType... dependencies) throws DuplicateRegistrationException; + interface GameScoped extends RegisterRegistryEvent { } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java index d8129480980..8d5e093d5a3 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java @@ -27,21 +27,107 @@ import org.spongepowered.api.Engine; import org.spongepowered.api.ResourceKey; import org.spongepowered.api.event.GenericEvent; -import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.registry.Registry; +import org.spongepowered.api.registry.RegistryHolder; +import org.spongepowered.api.registry.RegistryRegistrationSet; import org.spongepowered.api.registry.RegistryType; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +/** + * Lifecycle event for registering entries to a {@link Registry}. + * + *

    This event may be called multiple times for the same layer + * as the registry is being appended and as dependencies become + * available. Plugins should only execute code inside the consumers.

    + * + *

    Note: Layers might be reloadable! When a registry + * is being reloaded, this event is fired again for the relevant registries. + * The implementation does not keep a reference to the Consumer observed + * in the last stage and expects plugins to fill a new set of entries.

    + * + *

    Additionally, plugins may request to take a dependency on another + * registry in order to access registered entries early to enrich its + * own content. This can prove to be useful when both registries are in + * the same layer and would have no access to each other otherwise.

    + * + *

    The available registries and their content are not guaranteed to + * be accessible unless they have been added as a dependency. Plugins + * might observe registries they have not marked as a dependency due + * to the platform having natural dependency on them or due to the + * registries dependency graph.

    + */ +@NoFactoryMethod public interface RegisterRegistryValueEvent extends LifecycleEvent { - RegistryStep registry(RegistryType registryType); + /** + *

    Register new entries against a specific {@link Registry}.

    + * + *

    The consumer will be called if it matches the current set of + * registries being created.

    + * + * @param registryType The registry type to append. + * @param consumer The consumer to be called if found. + */ + default void registry(RegistryType registryType, Consumer> consumer) { + this.registry(registryType, (h, r) -> consumer.accept(r)); + } + + /** + *

    Register new entries against a specific {@link Registry}.

    + * + *

    The consumer will be called if it matches the current set of + * registries being created.

    + * + * @param registryType The registry type to append. + * @param consumer The consumer to be called if found. + */ + void registry(RegistryType registryType, BiConsumer> consumer); - interface RegistryStep { + /** + *

    Register new entries against a specific {@link Registry}.

    + * + *

    The consumer will be called if it matches the current set of + * registries being created.

    + * + * @param registryType The registry type to append. + * @param consumer The consumer to be called if found. + * @param dependencies The list of registries to create before + * invoking the consumer. + */ + void registry(RegistryType registryType, BiConsumer> consumer, final RegistryType... dependencies); - RegistryStep register(ResourceKey key, T value); + /** + *

    Register new entries against a specific {@link Registry}.

    + * + *

    The {@link RegistryRegistrationSet registration set} will be + * appended if it matches the current set of registries being created.

    + * + * @param registrationSet The registration set. + */ + default void register(RegistryRegistrationSet registrationSet) { + this.registry(registrationSet.registryType(), (h, r) -> registrationSet.values().forEach((k, v) -> r.register(k, v.apply(h)))); } - interface BuiltIn extends LifecycleEvent { + /** + *

    Register new entries against a specific {@link Registry}.

    + * + *

    The {@link RegistryRegistrationSet registration set} will be + * appended if it matches the current set of registries being created.

    + * + * @param registrationSet The registration set. + * @param dependencies The list of registries to create before + * appending the registration set. + */ + default void register(RegistryRegistrationSet registrationSet, final RegistryType... dependencies) { + this.registry(registrationSet.registryType(), (h, r) -> registrationSet.values().forEach((k, v) -> r.register(k, v.apply(h))), dependencies); + } - RegistryStep registry(RegistryType registryType); + interface RegistryStep { + + RegistryStep register(ResourceKey key, T value); } interface GameScoped extends RegisterRegistryValueEvent { diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/StartedEngineEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/StartedEngineEvent.java index d413aa6442b..35992a63577 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/StartedEngineEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/StartedEngineEvent.java @@ -25,6 +25,8 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.Engine; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +@GenerateFactoryMethod public interface StartedEngineEvent extends EngineLifecycleEvent { } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/StartingEngineEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/StartingEngineEvent.java index 4da26e16426..02556c6cd54 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/StartingEngineEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/StartingEngineEvent.java @@ -25,6 +25,8 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.Engine; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +@GenerateFactoryMethod public interface StartingEngineEvent extends EngineLifecycleEvent { } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/StoppedGameEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/StoppedGameEvent.java index 024fe1945b3..e1bf3f544a3 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/StoppedGameEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/StoppedGameEvent.java @@ -25,6 +25,7 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.Game; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * This event is called at the end of a {@link Game} instance, after the game's @@ -38,6 +39,7 @@ *

    Most users will want to listen to {@link StoppingEngineEvent} instead, to * do operations tied to the lifecycle of one single engine.

    */ +@GenerateFactoryMethod public interface StoppedGameEvent extends LifecycleEvent { } diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/StoppingEngineEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/StoppingEngineEvent.java index 414579881a0..a57dbbe9ae4 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/StoppingEngineEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/StoppingEngineEvent.java @@ -25,6 +25,8 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.Engine; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +@GenerateFactoryMethod public interface StoppingEngineEvent extends EngineLifecycleEvent { } diff --git a/src/main/java/org/spongepowered/api/event/message/AudienceMessageEvent.java b/src/main/java/org/spongepowered/api/event/message/AudienceMessageEvent.java index 654f183e9e4..80ee098351c 100644 --- a/src/main/java/org/spongepowered/api/event/message/AudienceMessageEvent.java +++ b/src/main/java/org/spongepowered/api/event/message/AudienceMessageEvent.java @@ -28,7 +28,7 @@ import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.adventure.Audiences; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.Optional; import java.util.function.Predicate; diff --git a/src/main/java/org/spongepowered/api/event/message/MessageCancellable.java b/src/main/java/org/spongepowered/api/event/message/MessageCancellable.java index 2ff2850ee4e..3f16ffeced2 100644 --- a/src/main/java/org/spongepowered/api/event/message/MessageCancellable.java +++ b/src/main/java/org/spongepowered/api/event/message/MessageCancellable.java @@ -25,7 +25,7 @@ package org.spongepowered.api.event.message; import net.kyori.adventure.text.Component; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Represents an event whose message can be cancelled. diff --git a/src/main/java/org/spongepowered/api/event/message/MessageEvent.java b/src/main/java/org/spongepowered/api/event/message/MessageEvent.java index 814f3ecc458..389e160f54a 100644 --- a/src/main/java/org/spongepowered/api/event/message/MessageEvent.java +++ b/src/main/java/org/spongepowered/api/event/message/MessageEvent.java @@ -26,7 +26,7 @@ import net.kyori.adventure.text.Component; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Describes events when a involving a {@link Component} message. diff --git a/src/main/java/org/spongepowered/api/event/message/PlayerChatEvent.java b/src/main/java/org/spongepowered/api/event/message/PlayerChatEvent.java index ff4ab709be0..2aa914a35e7 100644 --- a/src/main/java/org/spongepowered/api/event/message/PlayerChatEvent.java +++ b/src/main/java/org/spongepowered/api/event/message/PlayerChatEvent.java @@ -30,7 +30,6 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cause; import org.spongepowered.api.registry.RegistryReference; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; import java.util.Optional; import java.util.function.Predicate; @@ -39,7 +38,6 @@ * Fired when sending a chat message. * To modify the message use {@link Decorate}. */ -@NoFactoryMethod public interface PlayerChatEvent extends MessageEvent { /** 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 bbcc2e9bbee..e9fc2bb233c 100644 --- a/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java +++ b/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java @@ -39,9 +39,9 @@ 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.eventgen.annotations.NoFactoryMethod; import org.spongepowered.math.vector.Vector3d; import java.net.InetAddress; diff --git a/src/main/java/org/spongepowered/api/event/package-info.java b/src/main/java/org/spongepowered/api/event/package-info.java index 9d12180f851..e5d13b53794 100644 --- a/src/main/java/org/spongepowered/api/event/package-info.java +++ b/src/main/java/org/spongepowered/api/event/package-info.java @@ -22,5 +22,10 @@ * 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) +@NoFactoryMethod(ignoreNested = true) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; diff --git a/src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java b/src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java index 1181ae82d32..61cbbd29d73 100644 --- a/src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java +++ b/src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java @@ -33,8 +33,8 @@ import org.spongepowered.api.network.status.StatusClient; import org.spongepowered.api.network.status.StatusResponse; import org.spongepowered.api.profile.GameProfile; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.List; import java.util.Optional; diff --git a/src/main/java/org/spongepowered/api/event/user/BanUserEvent.java b/src/main/java/org/spongepowered/api/event/user/BanUserEvent.java index 6fadd6153b7..39ec4bb4bf6 100644 --- a/src/main/java/org/spongepowered/api/event/user/BanUserEvent.java +++ b/src/main/java/org/spongepowered/api/event/user/BanUserEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.living.player.User; import org.spongepowered.api.event.Event; import org.spongepowered.api.service.ban.Ban; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Occurs when a user is banned. diff --git a/src/main/java/org/spongepowered/api/event/user/PardonUserEvent.java b/src/main/java/org/spongepowered/api/event/user/PardonUserEvent.java index 39473f80212..72278efaa50 100644 --- a/src/main/java/org/spongepowered/api/event/user/PardonUserEvent.java +++ b/src/main/java/org/spongepowered/api/event/user/PardonUserEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.living.player.User; import org.spongepowered.api.event.Event; import org.spongepowered.api.service.ban.Ban; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Occurs when a user is pardoned. diff --git a/src/main/java/org/spongepowered/api/event/world/ChangeWorldBorderEvent.java b/src/main/java/org/spongepowered/api/event/world/ChangeWorldBorderEvent.java index 66c3affcc74..92077ea3d1b 100644 --- a/src/main/java/org/spongepowered/api/event/world/ChangeWorldBorderEvent.java +++ b/src/main/java/org/spongepowered/api/event/world/ChangeWorldBorderEvent.java @@ -27,9 +27,10 @@ import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; import org.spongepowered.api.world.border.WorldBorder; import org.spongepowered.api.world.server.ServerWorld; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.Optional; @@ -78,6 +79,7 @@ public interface ChangeWorldBorderEvent extends Event, Cancellable { /** * Fired when a value on a world's {@link WorldBorder} is changed. */ + @GenerateFactoryMethod interface World extends ChangeWorldBorderEvent { /** @@ -93,6 +95,7 @@ interface World extends ChangeWorldBorderEvent { * An event that is fired when a player's world border is changed. This may * also be fired when a player's border is set or unset. */ + @GenerateFactoryMethod interface Player extends ChangeWorldBorderEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/world/ExplosionEvent.java b/src/main/java/org/spongepowered/api/event/world/ExplosionEvent.java index 86322fdf353..af247cb0172 100644 --- a/src/main/java/org/spongepowered/api/event/world/ExplosionEvent.java +++ b/src/main/java/org/spongepowered/api/event/world/ExplosionEvent.java @@ -28,12 +28,12 @@ import org.spongepowered.api.event.Event; import org.spongepowered.api.event.entity.AffectEntityEvent; import org.spongepowered.api.event.impl.world.AbstractDetonateEvent; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; import org.spongepowered.api.world.World; import org.spongepowered.api.world.explosion.Explosion; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.api.world.server.ServerWorld; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.PropertySettings; import java.util.List; import java.util.function.Predicate; diff --git a/src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java b/src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java index 09358b7d35a..2251db3a119 100644 --- a/src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java +++ b/src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java @@ -27,13 +27,13 @@ import org.spongepowered.api.ResourceKey; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; import org.spongepowered.api.world.World; import org.spongepowered.api.world.chunk.BlockChunk; import org.spongepowered.api.world.chunk.Chunk; import org.spongepowered.api.world.chunk.EntityChunk; import org.spongepowered.api.world.chunk.WorldChunk; import org.spongepowered.api.world.server.ServerWorld; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.math.vector.Vector3i; public interface ChunkEvent extends Event { diff --git a/src/main/java/org/spongepowered/api/fluid/FluidType.java b/src/main/java/org/spongepowered/api/fluid/FluidType.java index c258fe98bef..5f09ae6c072 100644 --- a/src/main/java/org/spongepowered/api/fluid/FluidType.java +++ b/src/main/java/org/spongepowered/api/fluid/FluidType.java @@ -48,6 +48,6 @@ * than how vanilla implementations handle them.

    */ @CatalogedBy(FluidTypes.class) -public interface FluidType extends DefaultedRegistryValue, StateContainer, DataHolder.Immutable, Taggable { +public interface FluidType extends DefaultedRegistryValue, StateContainer, DataHolder.Immutable, Taggable { } diff --git a/src/main/java/org/spongepowered/api/item/FireworkShape.java b/src/main/java/org/spongepowered/api/item/FireworkShape.java index 0e9d5828c01..5432129f1cb 100644 --- a/src/main/java/org/spongepowered/api/item/FireworkShape.java +++ b/src/main/java/org/spongepowered/api/item/FireworkShape.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.item; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -31,6 +32,6 @@ * Represents a possible shape for a firework explosion. */ @CatalogedBy(FireworkShapes.class) -public interface FireworkShape extends DefaultedRegistryValue { +public interface FireworkShape extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/item/ItemRarity.java b/src/main/java/org/spongepowered/api/item/ItemRarity.java index e55177bd4a0..366dd2cd278 100644 --- a/src/main/java/org/spongepowered/api/item/ItemRarity.java +++ b/src/main/java/org/spongepowered/api/item/ItemRarity.java @@ -25,13 +25,15 @@ package org.spongepowered.api.item; import net.kyori.adventure.text.format.TextColor; +import org.spongepowered.api.data.type.StringRepresentable; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; /** * The rarity of an item. */ @CatalogedBy(ItemRarities.class) -public interface ItemRarity { +public interface ItemRarity extends DefaultedRegistryValue, StringRepresentable { /** * Gets the {@link TextColor} used to decorate tooltips of items with this {@link ItemRarity}. diff --git a/src/main/java/org/spongepowered/api/item/ItemType.java b/src/main/java/org/spongepowered/api/item/ItemType.java index 398dd7b4ff1..6b5cd98eaa0 100644 --- a/src/main/java/org/spongepowered/api/item/ItemType.java +++ b/src/main/java/org/spongepowered/api/item/ItemType.java @@ -39,7 +39,7 @@ * A type of item. */ @CatalogedBy(ItemTypes.class) -public interface ItemType extends DefaultedRegistryValue, ComponentLike, DataHolder.Immutable, Taggable { +public interface ItemType extends DefaultedRegistryValue, ComponentLike, DataHolder.Immutable, Taggable { /** * Gets the corresponding {@link BlockType} of this item if one exists. diff --git a/src/main/java/org/spongepowered/api/item/ItemTypes.java b/src/main/java/org/spongepowered/api/item/ItemTypes.java index f3512467ea3..2905a2702a5 100644 --- a/src/main/java/org/spongepowered/api/item/ItemTypes.java +++ b/src/main/java/org/spongepowered/api/item/ItemTypes.java @@ -64,6 +64,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference ACACIA_SAPLING = ItemTypes.key(ResourceKey.minecraft("acacia_sapling")); + public static final DefaultedRegistryReference ACACIA_SHELF = ItemTypes.key(ResourceKey.minecraft("acacia_shelf")); + public static final DefaultedRegistryReference ACACIA_SIGN = ItemTypes.key(ResourceKey.minecraft("acacia_sign")); public static final DefaultedRegistryReference ACACIA_SLAB = ItemTypes.key(ResourceKey.minecraft("acacia_slab")); @@ -156,6 +158,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference BAMBOO_RAFT = ItemTypes.key(ResourceKey.minecraft("bamboo_raft")); + public static final DefaultedRegistryReference BAMBOO_SHELF = ItemTypes.key(ResourceKey.minecraft("bamboo_shelf")); + public static final DefaultedRegistryReference BAMBOO_SIGN = ItemTypes.key(ResourceKey.minecraft("bamboo_sign")); public static final DefaultedRegistryReference BAMBOO_SLAB = ItemTypes.key(ResourceKey.minecraft("bamboo_slab")); @@ -218,6 +222,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference BIRCH_SAPLING = ItemTypes.key(ResourceKey.minecraft("birch_sapling")); + public static final DefaultedRegistryReference BIRCH_SHELF = ItemTypes.key(ResourceKey.minecraft("birch_shelf")); + public static final DefaultedRegistryReference BIRCH_SIGN = ItemTypes.key(ResourceKey.minecraft("birch_sign")); public static final DefaultedRegistryReference BIRCH_SLAB = ItemTypes.key(ResourceKey.minecraft("birch_slab")); @@ -240,6 +246,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference BLACK_BED = ItemTypes.key(ResourceKey.minecraft("black_bed")); + public static final DefaultedRegistryReference BLACK_BUNDLE = ItemTypes.key(ResourceKey.minecraft("black_bundle")); + public static final DefaultedRegistryReference BLACK_CANDLE = ItemTypes.key(ResourceKey.minecraft("black_candle")); public static final DefaultedRegistryReference BLACK_CARPET = ItemTypes.key(ResourceKey.minecraft("black_carpet")); @@ -252,6 +260,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference BLACK_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("black_glazed_terracotta")); + public static final DefaultedRegistryReference BLACK_HARNESS = ItemTypes.key(ResourceKey.minecraft("black_harness")); + public static final DefaultedRegistryReference BLACK_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("black_shulker_box")); public static final DefaultedRegistryReference BLACK_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("black_stained_glass")); @@ -276,6 +286,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference BLUE_BED = ItemTypes.key(ResourceKey.minecraft("blue_bed")); + public static final DefaultedRegistryReference BLUE_BUNDLE = ItemTypes.key(ResourceKey.minecraft("blue_bundle")); + public static final DefaultedRegistryReference BLUE_CANDLE = ItemTypes.key(ResourceKey.minecraft("blue_candle")); public static final DefaultedRegistryReference BLUE_CARPET = ItemTypes.key(ResourceKey.minecraft("blue_carpet")); @@ -286,8 +298,12 @@ public final class ItemTypes { public static final DefaultedRegistryReference BLUE_DYE = ItemTypes.key(ResourceKey.minecraft("blue_dye")); + public static final DefaultedRegistryReference BLUE_EGG = ItemTypes.key(ResourceKey.minecraft("blue_egg")); + public static final DefaultedRegistryReference BLUE_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("blue_glazed_terracotta")); + public static final DefaultedRegistryReference BLUE_HARNESS = ItemTypes.key(ResourceKey.minecraft("blue_harness")); + public static final DefaultedRegistryReference BLUE_ICE = ItemTypes.key(ResourceKey.minecraft("blue_ice")); public static final DefaultedRegistryReference BLUE_ORCHID = ItemTypes.key(ResourceKey.minecraft("blue_orchid")); @@ -316,6 +332,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference BOOKSHELF = ItemTypes.key(ResourceKey.minecraft("bookshelf")); + public static final DefaultedRegistryReference BORDURE_INDENTED_BANNER_PATTERN = ItemTypes.key(ResourceKey.minecraft("bordure_indented_banner_pattern")); + public static final DefaultedRegistryReference BOW = ItemTypes.key(ResourceKey.minecraft("bow")); public static final DefaultedRegistryReference BOWL = ItemTypes.key(ResourceKey.minecraft("bowl")); @@ -350,6 +368,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference BROWN_BED = ItemTypes.key(ResourceKey.minecraft("brown_bed")); + public static final DefaultedRegistryReference BROWN_BUNDLE = ItemTypes.key(ResourceKey.minecraft("brown_bundle")); + public static final DefaultedRegistryReference BROWN_CANDLE = ItemTypes.key(ResourceKey.minecraft("brown_candle")); public static final DefaultedRegistryReference BROWN_CARPET = ItemTypes.key(ResourceKey.minecraft("brown_carpet")); @@ -360,8 +380,12 @@ public final class ItemTypes { public static final DefaultedRegistryReference BROWN_DYE = ItemTypes.key(ResourceKey.minecraft("brown_dye")); + public static final DefaultedRegistryReference BROWN_EGG = ItemTypes.key(ResourceKey.minecraft("brown_egg")); + public static final DefaultedRegistryReference BROWN_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("brown_glazed_terracotta")); + public static final DefaultedRegistryReference BROWN_HARNESS = ItemTypes.key(ResourceKey.minecraft("brown_harness")); + public static final DefaultedRegistryReference BROWN_MUSHROOM = ItemTypes.key(ResourceKey.minecraft("brown_mushroom")); public static final DefaultedRegistryReference BROWN_MUSHROOM_BLOCK = ItemTypes.key(ResourceKey.minecraft("brown_mushroom_block")); @@ -392,14 +416,20 @@ public final class ItemTypes { public static final DefaultedRegistryReference BURN_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("burn_pottery_sherd")); + public static final DefaultedRegistryReference BUSH = ItemTypes.key(ResourceKey.minecraft("bush")); + public static final DefaultedRegistryReference CACTUS = ItemTypes.key(ResourceKey.minecraft("cactus")); + public static final DefaultedRegistryReference CACTUS_FLOWER = ItemTypes.key(ResourceKey.minecraft("cactus_flower")); + public static final DefaultedRegistryReference CAKE = ItemTypes.key(ResourceKey.minecraft("cake")); public static final DefaultedRegistryReference CALCITE = ItemTypes.key(ResourceKey.minecraft("calcite")); public static final DefaultedRegistryReference CALIBRATED_SCULK_SENSOR = ItemTypes.key(ResourceKey.minecraft("calibrated_sculk_sensor")); + public static final DefaultedRegistryReference CAMEL_HUSK_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("camel_husk_spawn_egg")); + public static final DefaultedRegistryReference CAMEL_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("camel_spawn_egg")); public static final DefaultedRegistryReference CAMPFIRE = ItemTypes.key(ResourceKey.minecraft("campfire")); @@ -420,8 +450,6 @@ public final class ItemTypes { public static final DefaultedRegistryReference CAVE_SPIDER_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("cave_spider_spawn_egg")); - public static final DefaultedRegistryReference CHAIN = ItemTypes.key(ResourceKey.minecraft("chain")); - public static final DefaultedRegistryReference CHAINMAIL_BOOTS = ItemTypes.key(ResourceKey.minecraft("chainmail_boots")); public static final DefaultedRegistryReference CHAINMAIL_CHESTPLATE = ItemTypes.key(ResourceKey.minecraft("chainmail_chestplate")); @@ -458,6 +486,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference CHERRY_SAPLING = ItemTypes.key(ResourceKey.minecraft("cherry_sapling")); + public static final DefaultedRegistryReference CHERRY_SHELF = ItemTypes.key(ResourceKey.minecraft("cherry_shelf")); + public static final DefaultedRegistryReference CHERRY_SIGN = ItemTypes.key(ResourceKey.minecraft("cherry_sign")); public static final DefaultedRegistryReference CHERRY_SLAB = ItemTypes.key(ResourceKey.minecraft("cherry_slab")); @@ -492,6 +522,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference CHISELED_RED_SANDSTONE = ItemTypes.key(ResourceKey.minecraft("chiseled_red_sandstone")); + public static final DefaultedRegistryReference CHISELED_RESIN_BRICKS = ItemTypes.key(ResourceKey.minecraft("chiseled_resin_bricks")); + public static final DefaultedRegistryReference CHISELED_SANDSTONE = ItemTypes.key(ResourceKey.minecraft("chiseled_sandstone")); public static final DefaultedRegistryReference CHISELED_STONE_BRICKS = ItemTypes.key(ResourceKey.minecraft("chiseled_stone_bricks")); @@ -512,6 +544,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference CLOCK = ItemTypes.key(ResourceKey.minecraft("clock")); + public static final DefaultedRegistryReference CLOSED_EYEBLOSSOM = ItemTypes.key(ResourceKey.minecraft("closed_eyeblossom")); + public static final DefaultedRegistryReference COAL = ItemTypes.key(ResourceKey.minecraft("coal")); public static final DefaultedRegistryReference COAL_BLOCK = ItemTypes.key(ResourceKey.minecraft("coal_block")); @@ -576,18 +610,58 @@ public final class ItemTypes { public static final DefaultedRegistryReference COOKIE = ItemTypes.key(ResourceKey.minecraft("cookie")); + public static final DefaultedRegistryReference COPPER_AXE = ItemTypes.key(ResourceKey.minecraft("copper_axe")); + + public static final DefaultedRegistryReference COPPER_BARS = ItemTypes.key(ResourceKey.minecraft("copper_bars")); + public static final DefaultedRegistryReference COPPER_BLOCK = ItemTypes.key(ResourceKey.minecraft("copper_block")); + public static final DefaultedRegistryReference COPPER_BOOTS = ItemTypes.key(ResourceKey.minecraft("copper_boots")); + public static final DefaultedRegistryReference COPPER_BULB = ItemTypes.key(ResourceKey.minecraft("copper_bulb")); + public static final DefaultedRegistryReference COPPER_CHAIN = ItemTypes.key(ResourceKey.minecraft("copper_chain")); + + public static final DefaultedRegistryReference COPPER_CHEST = ItemTypes.key(ResourceKey.minecraft("copper_chest")); + + public static final DefaultedRegistryReference COPPER_CHESTPLATE = ItemTypes.key(ResourceKey.minecraft("copper_chestplate")); + public static final DefaultedRegistryReference COPPER_DOOR = ItemTypes.key(ResourceKey.minecraft("copper_door")); + public static final DefaultedRegistryReference COPPER_GOLEM_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("copper_golem_spawn_egg")); + + public static final DefaultedRegistryReference COPPER_GOLEM_STATUE = ItemTypes.key(ResourceKey.minecraft("copper_golem_statue")); + public static final DefaultedRegistryReference COPPER_GRATE = ItemTypes.key(ResourceKey.minecraft("copper_grate")); + public static final DefaultedRegistryReference COPPER_HELMET = ItemTypes.key(ResourceKey.minecraft("copper_helmet")); + + public static final DefaultedRegistryReference COPPER_HOE = ItemTypes.key(ResourceKey.minecraft("copper_hoe")); + + public static final DefaultedRegistryReference COPPER_HORSE_ARMOR = ItemTypes.key(ResourceKey.minecraft("copper_horse_armor")); + public static final DefaultedRegistryReference COPPER_INGOT = ItemTypes.key(ResourceKey.minecraft("copper_ingot")); + public static final DefaultedRegistryReference COPPER_LANTERN = ItemTypes.key(ResourceKey.minecraft("copper_lantern")); + + public static final DefaultedRegistryReference COPPER_LEGGINGS = ItemTypes.key(ResourceKey.minecraft("copper_leggings")); + + public static final DefaultedRegistryReference COPPER_NAUTILUS_ARMOR = ItemTypes.key(ResourceKey.minecraft("copper_nautilus_armor")); + + public static final DefaultedRegistryReference COPPER_NUGGET = ItemTypes.key(ResourceKey.minecraft("copper_nugget")); + public static final DefaultedRegistryReference COPPER_ORE = ItemTypes.key(ResourceKey.minecraft("copper_ore")); + public static final DefaultedRegistryReference COPPER_PICKAXE = ItemTypes.key(ResourceKey.minecraft("copper_pickaxe")); + + public static final DefaultedRegistryReference COPPER_SHOVEL = ItemTypes.key(ResourceKey.minecraft("copper_shovel")); + + public static final DefaultedRegistryReference COPPER_SPEAR = ItemTypes.key(ResourceKey.minecraft("copper_spear")); + + public static final DefaultedRegistryReference COPPER_SWORD = ItemTypes.key(ResourceKey.minecraft("copper_sword")); + + public static final DefaultedRegistryReference COPPER_TORCH = ItemTypes.key(ResourceKey.minecraft("copper_torch")); + public static final DefaultedRegistryReference COPPER_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("copper_trapdoor")); public static final DefaultedRegistryReference CORNFLOWER = ItemTypes.key(ResourceKey.minecraft("cornflower")); @@ -608,6 +682,10 @@ public final class ItemTypes { public static final DefaultedRegistryReference CRAFTING_TABLE = ItemTypes.key(ResourceKey.minecraft("crafting_table")); + public static final DefaultedRegistryReference CREAKING_HEART = ItemTypes.key(ResourceKey.minecraft("creaking_heart")); + + public static final DefaultedRegistryReference CREAKING_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("creaking_spawn_egg")); + public static final DefaultedRegistryReference CREEPER_BANNER_PATTERN = ItemTypes.key(ResourceKey.minecraft("creeper_banner_pattern")); public static final DefaultedRegistryReference CREEPER_HEAD = ItemTypes.key(ResourceKey.minecraft("creeper_head")); @@ -636,6 +714,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference CRIMSON_ROOTS = ItemTypes.key(ResourceKey.minecraft("crimson_roots")); + public static final DefaultedRegistryReference CRIMSON_SHELF = ItemTypes.key(ResourceKey.minecraft("crimson_shelf")); + public static final DefaultedRegistryReference CRIMSON_SIGN = ItemTypes.key(ResourceKey.minecraft("crimson_sign")); public static final DefaultedRegistryReference CRIMSON_SLAB = ItemTypes.key(ResourceKey.minecraft("crimson_slab")); @@ -668,6 +748,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference CYAN_BED = ItemTypes.key(ResourceKey.minecraft("cyan_bed")); + public static final DefaultedRegistryReference CYAN_BUNDLE = ItemTypes.key(ResourceKey.minecraft("cyan_bundle")); + public static final DefaultedRegistryReference CYAN_CANDLE = ItemTypes.key(ResourceKey.minecraft("cyan_candle")); public static final DefaultedRegistryReference CYAN_CARPET = ItemTypes.key(ResourceKey.minecraft("cyan_carpet")); @@ -680,6 +762,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference CYAN_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("cyan_glazed_terracotta")); + public static final DefaultedRegistryReference CYAN_HARNESS = ItemTypes.key(ResourceKey.minecraft("cyan_harness")); + public static final DefaultedRegistryReference CYAN_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("cyan_shulker_box")); public static final DefaultedRegistryReference CYAN_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("cyan_stained_glass")); @@ -720,6 +804,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference DARK_OAK_SAPLING = ItemTypes.key(ResourceKey.minecraft("dark_oak_sapling")); + public static final DefaultedRegistryReference DARK_OAK_SHELF = ItemTypes.key(ResourceKey.minecraft("dark_oak_shelf")); + public static final DefaultedRegistryReference DARK_OAK_SIGN = ItemTypes.key(ResourceKey.minecraft("dark_oak_sign")); public static final DefaultedRegistryReference DARK_OAK_SLAB = ItemTypes.key(ResourceKey.minecraft("dark_oak_slab")); @@ -828,12 +914,16 @@ public final class ItemTypes { public static final DefaultedRegistryReference DIAMOND_LEGGINGS = ItemTypes.key(ResourceKey.minecraft("diamond_leggings")); + public static final DefaultedRegistryReference DIAMOND_NAUTILUS_ARMOR = ItemTypes.key(ResourceKey.minecraft("diamond_nautilus_armor")); + public static final DefaultedRegistryReference DIAMOND_ORE = ItemTypes.key(ResourceKey.minecraft("diamond_ore")); public static final DefaultedRegistryReference DIAMOND_PICKAXE = ItemTypes.key(ResourceKey.minecraft("diamond_pickaxe")); public static final DefaultedRegistryReference DIAMOND_SHOVEL = ItemTypes.key(ResourceKey.minecraft("diamond_shovel")); + public static final DefaultedRegistryReference DIAMOND_SPEAR = ItemTypes.key(ResourceKey.minecraft("diamond_spear")); + public static final DefaultedRegistryReference DIAMOND_SWORD = ItemTypes.key(ResourceKey.minecraft("diamond_sword")); public static final DefaultedRegistryReference DIORITE = ItemTypes.key(ResourceKey.minecraft("diorite")); @@ -862,6 +952,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference DRAGON_HEAD = ItemTypes.key(ResourceKey.minecraft("dragon_head")); + public static final DefaultedRegistryReference DRIED_GHAST = ItemTypes.key(ResourceKey.minecraft("dried_ghast")); + public static final DefaultedRegistryReference DRIED_KELP = ItemTypes.key(ResourceKey.minecraft("dried_kelp")); public static final DefaultedRegistryReference DRIED_KELP_BLOCK = ItemTypes.key(ResourceKey.minecraft("dried_kelp_block")); @@ -932,12 +1024,22 @@ public final class ItemTypes { public static final DefaultedRegistryReference EXPOSED_COPPER = ItemTypes.key(ResourceKey.minecraft("exposed_copper")); + public static final DefaultedRegistryReference EXPOSED_COPPER_BARS = ItemTypes.key(ResourceKey.minecraft("exposed_copper_bars")); + public static final DefaultedRegistryReference EXPOSED_COPPER_BULB = ItemTypes.key(ResourceKey.minecraft("exposed_copper_bulb")); + public static final DefaultedRegistryReference EXPOSED_COPPER_CHAIN = ItemTypes.key(ResourceKey.minecraft("exposed_copper_chain")); + + public static final DefaultedRegistryReference EXPOSED_COPPER_CHEST = ItemTypes.key(ResourceKey.minecraft("exposed_copper_chest")); + public static final DefaultedRegistryReference EXPOSED_COPPER_DOOR = ItemTypes.key(ResourceKey.minecraft("exposed_copper_door")); + public static final DefaultedRegistryReference EXPOSED_COPPER_GOLEM_STATUE = ItemTypes.key(ResourceKey.minecraft("exposed_copper_golem_statue")); + public static final DefaultedRegistryReference EXPOSED_COPPER_GRATE = ItemTypes.key(ResourceKey.minecraft("exposed_copper_grate")); + public static final DefaultedRegistryReference EXPOSED_COPPER_LANTERN = ItemTypes.key(ResourceKey.minecraft("exposed_copper_lantern")); + public static final DefaultedRegistryReference EXPOSED_COPPER_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("exposed_copper_trapdoor")); public static final DefaultedRegistryReference EXPOSED_CUT_COPPER = ItemTypes.key(ResourceKey.minecraft("exposed_cut_copper")); @@ -946,6 +1048,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference EXPOSED_CUT_COPPER_STAIRS = ItemTypes.key(ResourceKey.minecraft("exposed_cut_copper_stairs")); + public static final DefaultedRegistryReference EXPOSED_LIGHTNING_ROD = ItemTypes.key(ResourceKey.minecraft("exposed_lightning_rod")); + public static final DefaultedRegistryReference EYE_ARMOR_TRIM_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("eye_armor_trim_smithing_template")); public static final DefaultedRegistryReference FARMLAND = ItemTypes.key(ResourceKey.minecraft("farmland")); @@ -956,8 +1060,12 @@ public final class ItemTypes { public static final DefaultedRegistryReference FERN = ItemTypes.key(ResourceKey.minecraft("fern")); + public static final DefaultedRegistryReference FIELD_MASONED_BANNER_PATTERN = ItemTypes.key(ResourceKey.minecraft("field_masoned_banner_pattern")); + public static final DefaultedRegistryReference FILLED_MAP = ItemTypes.key(ResourceKey.minecraft("filled_map")); + public static final DefaultedRegistryReference FIREFLY_BUSH = ItemTypes.key(ResourceKey.minecraft("firefly_bush")); + public static final DefaultedRegistryReference FIREWORK_ROCKET = ItemTypes.key(ResourceKey.minecraft("firework_rocket")); public static final DefaultedRegistryReference FIREWORK_STAR = ItemTypes.key(ResourceKey.minecraft("firework_star")); @@ -1056,10 +1164,14 @@ public final class ItemTypes { public static final DefaultedRegistryReference GOLDEN_LEGGINGS = ItemTypes.key(ResourceKey.minecraft("golden_leggings")); + public static final DefaultedRegistryReference GOLDEN_NAUTILUS_ARMOR = ItemTypes.key(ResourceKey.minecraft("golden_nautilus_armor")); + public static final DefaultedRegistryReference GOLDEN_PICKAXE = ItemTypes.key(ResourceKey.minecraft("golden_pickaxe")); public static final DefaultedRegistryReference GOLDEN_SHOVEL = ItemTypes.key(ResourceKey.minecraft("golden_shovel")); + public static final DefaultedRegistryReference GOLDEN_SPEAR = ItemTypes.key(ResourceKey.minecraft("golden_spear")); + public static final DefaultedRegistryReference GOLDEN_SWORD = ItemTypes.key(ResourceKey.minecraft("golden_sword")); public static final DefaultedRegistryReference GOLD_BLOCK = ItemTypes.key(ResourceKey.minecraft("gold_block")); @@ -1086,6 +1198,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference GRAY_BED = ItemTypes.key(ResourceKey.minecraft("gray_bed")); + public static final DefaultedRegistryReference GRAY_BUNDLE = ItemTypes.key(ResourceKey.minecraft("gray_bundle")); + public static final DefaultedRegistryReference GRAY_CANDLE = ItemTypes.key(ResourceKey.minecraft("gray_candle")); public static final DefaultedRegistryReference GRAY_CARPET = ItemTypes.key(ResourceKey.minecraft("gray_carpet")); @@ -1098,6 +1212,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference GRAY_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("gray_glazed_terracotta")); + public static final DefaultedRegistryReference GRAY_HARNESS = ItemTypes.key(ResourceKey.minecraft("gray_harness")); + public static final DefaultedRegistryReference GRAY_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("gray_shulker_box")); public static final DefaultedRegistryReference GRAY_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("gray_stained_glass")); @@ -1112,6 +1228,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference GREEN_BED = ItemTypes.key(ResourceKey.minecraft("green_bed")); + public static final DefaultedRegistryReference GREEN_BUNDLE = ItemTypes.key(ResourceKey.minecraft("green_bundle")); + public static final DefaultedRegistryReference GREEN_CANDLE = ItemTypes.key(ResourceKey.minecraft("green_candle")); public static final DefaultedRegistryReference GREEN_CARPET = ItemTypes.key(ResourceKey.minecraft("green_carpet")); @@ -1124,6 +1242,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference GREEN_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("green_glazed_terracotta")); + public static final DefaultedRegistryReference GREEN_HARNESS = ItemTypes.key(ResourceKey.minecraft("green_harness")); + public static final DefaultedRegistryReference GREEN_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("green_shulker_box")); public static final DefaultedRegistryReference GREEN_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("green_stained_glass")); @@ -1146,6 +1266,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference HANGING_ROOTS = ItemTypes.key(ResourceKey.minecraft("hanging_roots")); + public static final DefaultedRegistryReference HAPPY_GHAST_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("happy_ghast_spawn_egg")); + public static final DefaultedRegistryReference HAY_BLOCK = ItemTypes.key(ResourceKey.minecraft("hay_block")); public static final DefaultedRegistryReference HEARTBREAK_POTTERY_SHERD = ItemTypes.key(ResourceKey.minecraft("heartbreak_pottery_sherd")); @@ -1212,6 +1334,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference IRON_BOOTS = ItemTypes.key(ResourceKey.minecraft("iron_boots")); + public static final DefaultedRegistryReference IRON_CHAIN = ItemTypes.key(ResourceKey.minecraft("iron_chain")); + public static final DefaultedRegistryReference IRON_CHESTPLATE = ItemTypes.key(ResourceKey.minecraft("iron_chestplate")); public static final DefaultedRegistryReference IRON_DOOR = ItemTypes.key(ResourceKey.minecraft("iron_door")); @@ -1228,6 +1352,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference IRON_LEGGINGS = ItemTypes.key(ResourceKey.minecraft("iron_leggings")); + public static final DefaultedRegistryReference IRON_NAUTILUS_ARMOR = ItemTypes.key(ResourceKey.minecraft("iron_nautilus_armor")); + public static final DefaultedRegistryReference IRON_NUGGET = ItemTypes.key(ResourceKey.minecraft("iron_nugget")); public static final DefaultedRegistryReference IRON_ORE = ItemTypes.key(ResourceKey.minecraft("iron_ore")); @@ -1236,6 +1362,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference IRON_SHOVEL = ItemTypes.key(ResourceKey.minecraft("iron_shovel")); + public static final DefaultedRegistryReference IRON_SPEAR = ItemTypes.key(ResourceKey.minecraft("iron_spear")); + public static final DefaultedRegistryReference IRON_SWORD = ItemTypes.key(ResourceKey.minecraft("iron_sword")); public static final DefaultedRegistryReference IRON_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("iron_trapdoor")); @@ -1272,6 +1400,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference JUNGLE_SAPLING = ItemTypes.key(ResourceKey.minecraft("jungle_sapling")); + public static final DefaultedRegistryReference JUNGLE_SHELF = ItemTypes.key(ResourceKey.minecraft("jungle_shelf")); + public static final DefaultedRegistryReference JUNGLE_SIGN = ItemTypes.key(ResourceKey.minecraft("jungle_sign")); public static final DefaultedRegistryReference JUNGLE_SLAB = ItemTypes.key(ResourceKey.minecraft("jungle_slab")); @@ -1304,6 +1434,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference LEAD = ItemTypes.key(ResourceKey.minecraft("lead")); + public static final DefaultedRegistryReference LEAF_LITTER = ItemTypes.key(ResourceKey.minecraft("leaf_litter")); + public static final DefaultedRegistryReference LEATHER = ItemTypes.key(ResourceKey.minecraft("leather")); public static final DefaultedRegistryReference LEATHER_BOOTS = ItemTypes.key(ResourceKey.minecraft("leather_boots")); @@ -1328,6 +1460,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference LIGHT_BLUE_BED = ItemTypes.key(ResourceKey.minecraft("light_blue_bed")); + public static final DefaultedRegistryReference LIGHT_BLUE_BUNDLE = ItemTypes.key(ResourceKey.minecraft("light_blue_bundle")); + public static final DefaultedRegistryReference LIGHT_BLUE_CANDLE = ItemTypes.key(ResourceKey.minecraft("light_blue_candle")); public static final DefaultedRegistryReference LIGHT_BLUE_CARPET = ItemTypes.key(ResourceKey.minecraft("light_blue_carpet")); @@ -1340,6 +1474,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference LIGHT_BLUE_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("light_blue_glazed_terracotta")); + public static final DefaultedRegistryReference LIGHT_BLUE_HARNESS = ItemTypes.key(ResourceKey.minecraft("light_blue_harness")); + public static final DefaultedRegistryReference LIGHT_BLUE_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("light_blue_shulker_box")); public static final DefaultedRegistryReference LIGHT_BLUE_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("light_blue_stained_glass")); @@ -1354,6 +1490,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference LIGHT_GRAY_BED = ItemTypes.key(ResourceKey.minecraft("light_gray_bed")); + public static final DefaultedRegistryReference LIGHT_GRAY_BUNDLE = ItemTypes.key(ResourceKey.minecraft("light_gray_bundle")); + public static final DefaultedRegistryReference LIGHT_GRAY_CANDLE = ItemTypes.key(ResourceKey.minecraft("light_gray_candle")); public static final DefaultedRegistryReference LIGHT_GRAY_CARPET = ItemTypes.key(ResourceKey.minecraft("light_gray_carpet")); @@ -1366,6 +1504,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference LIGHT_GRAY_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("light_gray_glazed_terracotta")); + public static final DefaultedRegistryReference LIGHT_GRAY_HARNESS = ItemTypes.key(ResourceKey.minecraft("light_gray_harness")); + public static final DefaultedRegistryReference LIGHT_GRAY_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("light_gray_shulker_box")); public static final DefaultedRegistryReference LIGHT_GRAY_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("light_gray_stained_glass")); @@ -1388,6 +1528,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference LIME_BED = ItemTypes.key(ResourceKey.minecraft("lime_bed")); + public static final DefaultedRegistryReference LIME_BUNDLE = ItemTypes.key(ResourceKey.minecraft("lime_bundle")); + public static final DefaultedRegistryReference LIME_CANDLE = ItemTypes.key(ResourceKey.minecraft("lime_candle")); public static final DefaultedRegistryReference LIME_CARPET = ItemTypes.key(ResourceKey.minecraft("lime_carpet")); @@ -1400,6 +1542,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference LIME_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("lime_glazed_terracotta")); + public static final DefaultedRegistryReference LIME_HARNESS = ItemTypes.key(ResourceKey.minecraft("lime_harness")); + public static final DefaultedRegistryReference LIME_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("lime_shulker_box")); public static final DefaultedRegistryReference LIME_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("lime_stained_glass")); @@ -1424,6 +1568,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference MAGENTA_BED = ItemTypes.key(ResourceKey.minecraft("magenta_bed")); + public static final DefaultedRegistryReference MAGENTA_BUNDLE = ItemTypes.key(ResourceKey.minecraft("magenta_bundle")); + public static final DefaultedRegistryReference MAGENTA_CANDLE = ItemTypes.key(ResourceKey.minecraft("magenta_candle")); public static final DefaultedRegistryReference MAGENTA_CARPET = ItemTypes.key(ResourceKey.minecraft("magenta_carpet")); @@ -1436,6 +1582,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference MAGENTA_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("magenta_glazed_terracotta")); + public static final DefaultedRegistryReference MAGENTA_HARNESS = ItemTypes.key(ResourceKey.minecraft("magenta_harness")); + public static final DefaultedRegistryReference MAGENTA_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("magenta_shulker_box")); public static final DefaultedRegistryReference MAGENTA_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("magenta_stained_glass")); @@ -1478,6 +1626,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference MANGROVE_ROOTS = ItemTypes.key(ResourceKey.minecraft("mangrove_roots")); + public static final DefaultedRegistryReference MANGROVE_SHELF = ItemTypes.key(ResourceKey.minecraft("mangrove_shelf")); + public static final DefaultedRegistryReference MANGROVE_SIGN = ItemTypes.key(ResourceKey.minecraft("mangrove_sign")); public static final DefaultedRegistryReference MANGROVE_SLAB = ItemTypes.key(ResourceKey.minecraft("mangrove_slab")); @@ -1566,6 +1716,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference MUSIC_DISC_FAR = ItemTypes.key(ResourceKey.minecraft("music_disc_far")); + public static final DefaultedRegistryReference MUSIC_DISC_LAVA_CHICKEN = ItemTypes.key(ResourceKey.minecraft("music_disc_lava_chicken")); + public static final DefaultedRegistryReference MUSIC_DISC_MALL = ItemTypes.key(ResourceKey.minecraft("music_disc_mall")); public static final DefaultedRegistryReference MUSIC_DISC_MELLOHI = ItemTypes.key(ResourceKey.minecraft("music_disc_mellohi")); @@ -1582,6 +1734,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference MUSIC_DISC_STRAD = ItemTypes.key(ResourceKey.minecraft("music_disc_strad")); + public static final DefaultedRegistryReference MUSIC_DISC_TEARS = ItemTypes.key(ResourceKey.minecraft("music_disc_tears")); + public static final DefaultedRegistryReference MUSIC_DISC_WAIT = ItemTypes.key(ResourceKey.minecraft("music_disc_wait")); public static final DefaultedRegistryReference MUSIC_DISC_WARD = ItemTypes.key(ResourceKey.minecraft("music_disc_ward")); @@ -1594,6 +1748,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference NAUTILUS_SHELL = ItemTypes.key(ResourceKey.minecraft("nautilus_shell")); + public static final DefaultedRegistryReference NAUTILUS_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("nautilus_spawn_egg")); + public static final DefaultedRegistryReference NETHERITE_AXE = ItemTypes.key(ResourceKey.minecraft("netherite_axe")); public static final DefaultedRegistryReference NETHERITE_BLOCK = ItemTypes.key(ResourceKey.minecraft("netherite_block")); @@ -1606,16 +1762,22 @@ public final class ItemTypes { public static final DefaultedRegistryReference NETHERITE_HOE = ItemTypes.key(ResourceKey.minecraft("netherite_hoe")); + public static final DefaultedRegistryReference NETHERITE_HORSE_ARMOR = ItemTypes.key(ResourceKey.minecraft("netherite_horse_armor")); + public static final DefaultedRegistryReference NETHERITE_INGOT = ItemTypes.key(ResourceKey.minecraft("netherite_ingot")); public static final DefaultedRegistryReference NETHERITE_LEGGINGS = ItemTypes.key(ResourceKey.minecraft("netherite_leggings")); + public static final DefaultedRegistryReference NETHERITE_NAUTILUS_ARMOR = ItemTypes.key(ResourceKey.minecraft("netherite_nautilus_armor")); + public static final DefaultedRegistryReference NETHERITE_PICKAXE = ItemTypes.key(ResourceKey.minecraft("netherite_pickaxe")); public static final DefaultedRegistryReference NETHERITE_SCRAP = ItemTypes.key(ResourceKey.minecraft("netherite_scrap")); public static final DefaultedRegistryReference NETHERITE_SHOVEL = ItemTypes.key(ResourceKey.minecraft("netherite_shovel")); + public static final DefaultedRegistryReference NETHERITE_SPEAR = ItemTypes.key(ResourceKey.minecraft("netherite_spear")); + public static final DefaultedRegistryReference NETHERITE_SWORD = ItemTypes.key(ResourceKey.minecraft("netherite_sword")); public static final DefaultedRegistryReference NETHERITE_UPGRADE_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("netherite_upgrade_smithing_template")); @@ -1672,6 +1834,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference OAK_SAPLING = ItemTypes.key(ResourceKey.minecraft("oak_sapling")); + public static final DefaultedRegistryReference OAK_SHELF = ItemTypes.key(ResourceKey.minecraft("oak_shelf")); + public static final DefaultedRegistryReference OAK_SIGN = ItemTypes.key(ResourceKey.minecraft("oak_sign")); public static final DefaultedRegistryReference OAK_SLAB = ItemTypes.key(ResourceKey.minecraft("oak_slab")); @@ -1694,10 +1858,14 @@ public final class ItemTypes { public static final DefaultedRegistryReference OMINOUS_TRIAL_KEY = ItemTypes.key(ResourceKey.minecraft("ominous_trial_key")); + public static final DefaultedRegistryReference OPEN_EYEBLOSSOM = ItemTypes.key(ResourceKey.minecraft("open_eyeblossom")); + public static final DefaultedRegistryReference ORANGE_BANNER = ItemTypes.key(ResourceKey.minecraft("orange_banner")); public static final DefaultedRegistryReference ORANGE_BED = ItemTypes.key(ResourceKey.minecraft("orange_bed")); + public static final DefaultedRegistryReference ORANGE_BUNDLE = ItemTypes.key(ResourceKey.minecraft("orange_bundle")); + public static final DefaultedRegistryReference ORANGE_CANDLE = ItemTypes.key(ResourceKey.minecraft("orange_candle")); public static final DefaultedRegistryReference ORANGE_CARPET = ItemTypes.key(ResourceKey.minecraft("orange_carpet")); @@ -1710,6 +1878,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference ORANGE_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("orange_glazed_terracotta")); + public static final DefaultedRegistryReference ORANGE_HARNESS = ItemTypes.key(ResourceKey.minecraft("orange_harness")); + public static final DefaultedRegistryReference ORANGE_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("orange_shulker_box")); public static final DefaultedRegistryReference ORANGE_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("orange_stained_glass")); @@ -1728,12 +1898,22 @@ public final class ItemTypes { public static final DefaultedRegistryReference OXIDIZED_COPPER = ItemTypes.key(ResourceKey.minecraft("oxidized_copper")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_BARS = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_bars")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_BULB = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_bulb")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_CHAIN = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_chain")); + + public static final DefaultedRegistryReference OXIDIZED_COPPER_CHEST = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_chest")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_DOOR = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_door")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_GOLEM_STATUE = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_golem_statue")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_GRATE = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_grate")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_LANTERN = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_lantern")); + public static final DefaultedRegistryReference OXIDIZED_COPPER_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("oxidized_copper_trapdoor")); public static final DefaultedRegistryReference OXIDIZED_CUT_COPPER = ItemTypes.key(ResourceKey.minecraft("oxidized_cut_copper")); @@ -1742,16 +1922,62 @@ public final class ItemTypes { public static final DefaultedRegistryReference OXIDIZED_CUT_COPPER_STAIRS = ItemTypes.key(ResourceKey.minecraft("oxidized_cut_copper_stairs")); + public static final DefaultedRegistryReference OXIDIZED_LIGHTNING_ROD = ItemTypes.key(ResourceKey.minecraft("oxidized_lightning_rod")); + public static final DefaultedRegistryReference PACKED_ICE = ItemTypes.key(ResourceKey.minecraft("packed_ice")); public static final DefaultedRegistryReference PACKED_MUD = ItemTypes.key(ResourceKey.minecraft("packed_mud")); public static final DefaultedRegistryReference PAINTING = ItemTypes.key(ResourceKey.minecraft("painting")); + public static final DefaultedRegistryReference PALE_HANGING_MOSS = ItemTypes.key(ResourceKey.minecraft("pale_hanging_moss")); + + public static final DefaultedRegistryReference PALE_MOSS_BLOCK = ItemTypes.key(ResourceKey.minecraft("pale_moss_block")); + + public static final DefaultedRegistryReference PALE_MOSS_CARPET = ItemTypes.key(ResourceKey.minecraft("pale_moss_carpet")); + + public static final DefaultedRegistryReference PALE_OAK_BOAT = ItemTypes.key(ResourceKey.minecraft("pale_oak_boat")); + + public static final DefaultedRegistryReference PALE_OAK_BUTTON = ItemTypes.key(ResourceKey.minecraft("pale_oak_button")); + + public static final DefaultedRegistryReference PALE_OAK_CHEST_BOAT = ItemTypes.key(ResourceKey.minecraft("pale_oak_chest_boat")); + + public static final DefaultedRegistryReference PALE_OAK_DOOR = ItemTypes.key(ResourceKey.minecraft("pale_oak_door")); + + public static final DefaultedRegistryReference PALE_OAK_FENCE = ItemTypes.key(ResourceKey.minecraft("pale_oak_fence")); + + public static final DefaultedRegistryReference PALE_OAK_FENCE_GATE = ItemTypes.key(ResourceKey.minecraft("pale_oak_fence_gate")); + + public static final DefaultedRegistryReference PALE_OAK_HANGING_SIGN = ItemTypes.key(ResourceKey.minecraft("pale_oak_hanging_sign")); + + public static final DefaultedRegistryReference PALE_OAK_LEAVES = ItemTypes.key(ResourceKey.minecraft("pale_oak_leaves")); + + public static final DefaultedRegistryReference PALE_OAK_LOG = ItemTypes.key(ResourceKey.minecraft("pale_oak_log")); + + public static final DefaultedRegistryReference PALE_OAK_PLANKS = ItemTypes.key(ResourceKey.minecraft("pale_oak_planks")); + + public static final DefaultedRegistryReference PALE_OAK_PRESSURE_PLATE = ItemTypes.key(ResourceKey.minecraft("pale_oak_pressure_plate")); + + public static final DefaultedRegistryReference PALE_OAK_SAPLING = ItemTypes.key(ResourceKey.minecraft("pale_oak_sapling")); + + public static final DefaultedRegistryReference PALE_OAK_SHELF = ItemTypes.key(ResourceKey.minecraft("pale_oak_shelf")); + + public static final DefaultedRegistryReference PALE_OAK_SIGN = ItemTypes.key(ResourceKey.minecraft("pale_oak_sign")); + + public static final DefaultedRegistryReference PALE_OAK_SLAB = ItemTypes.key(ResourceKey.minecraft("pale_oak_slab")); + + public static final DefaultedRegistryReference PALE_OAK_STAIRS = ItemTypes.key(ResourceKey.minecraft("pale_oak_stairs")); + + public static final DefaultedRegistryReference PALE_OAK_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("pale_oak_trapdoor")); + + public static final DefaultedRegistryReference PALE_OAK_WOOD = ItemTypes.key(ResourceKey.minecraft("pale_oak_wood")); + public static final DefaultedRegistryReference PANDA_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("panda_spawn_egg")); public static final DefaultedRegistryReference PAPER = ItemTypes.key(ResourceKey.minecraft("paper")); + public static final DefaultedRegistryReference PARCHED_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("parched_spawn_egg")); + public static final DefaultedRegistryReference PARROT_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("parrot_spawn_egg")); public static final DefaultedRegistryReference PEARLESCENT_FROGLIGHT = ItemTypes.key(ResourceKey.minecraft("pearlescent_froglight")); @@ -1780,6 +2006,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference PINK_BED = ItemTypes.key(ResourceKey.minecraft("pink_bed")); + public static final DefaultedRegistryReference PINK_BUNDLE = ItemTypes.key(ResourceKey.minecraft("pink_bundle")); + public static final DefaultedRegistryReference PINK_CANDLE = ItemTypes.key(ResourceKey.minecraft("pink_candle")); public static final DefaultedRegistryReference PINK_CARPET = ItemTypes.key(ResourceKey.minecraft("pink_carpet")); @@ -1792,6 +2020,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference PINK_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("pink_glazed_terracotta")); + public static final DefaultedRegistryReference PINK_HARNESS = ItemTypes.key(ResourceKey.minecraft("pink_harness")); + public static final DefaultedRegistryReference PINK_PETALS = ItemTypes.key(ResourceKey.minecraft("pink_petals")); public static final DefaultedRegistryReference PINK_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("pink_shulker_box")); @@ -1930,6 +2160,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference PURPLE_BED = ItemTypes.key(ResourceKey.minecraft("purple_bed")); + public static final DefaultedRegistryReference PURPLE_BUNDLE = ItemTypes.key(ResourceKey.minecraft("purple_bundle")); + public static final DefaultedRegistryReference PURPLE_CANDLE = ItemTypes.key(ResourceKey.minecraft("purple_candle")); public static final DefaultedRegistryReference PURPLE_CARPET = ItemTypes.key(ResourceKey.minecraft("purple_carpet")); @@ -1942,6 +2174,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference PURPLE_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("purple_glazed_terracotta")); + public static final DefaultedRegistryReference PURPLE_HARNESS = ItemTypes.key(ResourceKey.minecraft("purple_harness")); + public static final DefaultedRegistryReference PURPLE_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("purple_shulker_box")); public static final DefaultedRegistryReference PURPLE_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("purple_stained_glass")); @@ -2016,6 +2250,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference RED_BED = ItemTypes.key(ResourceKey.minecraft("red_bed")); + public static final DefaultedRegistryReference RED_BUNDLE = ItemTypes.key(ResourceKey.minecraft("red_bundle")); + public static final DefaultedRegistryReference RED_CANDLE = ItemTypes.key(ResourceKey.minecraft("red_candle")); public static final DefaultedRegistryReference RED_CARPET = ItemTypes.key(ResourceKey.minecraft("red_carpet")); @@ -2028,6 +2264,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference RED_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("red_glazed_terracotta")); + public static final DefaultedRegistryReference RED_HARNESS = ItemTypes.key(ResourceKey.minecraft("red_harness")); + public static final DefaultedRegistryReference RED_MUSHROOM = ItemTypes.key(ResourceKey.minecraft("red_mushroom")); public static final DefaultedRegistryReference RED_MUSHROOM_BLOCK = ItemTypes.key(ResourceKey.minecraft("red_mushroom_block")); @@ -2068,6 +2306,20 @@ public final class ItemTypes { public static final DefaultedRegistryReference REPEATING_COMMAND_BLOCK = ItemTypes.key(ResourceKey.minecraft("repeating_command_block")); + public static final DefaultedRegistryReference RESIN_BLOCK = ItemTypes.key(ResourceKey.minecraft("resin_block")); + + public static final DefaultedRegistryReference RESIN_BRICK = ItemTypes.key(ResourceKey.minecraft("resin_brick")); + + public static final DefaultedRegistryReference RESIN_BRICKS = ItemTypes.key(ResourceKey.minecraft("resin_bricks")); + + public static final DefaultedRegistryReference RESIN_BRICK_SLAB = ItemTypes.key(ResourceKey.minecraft("resin_brick_slab")); + + public static final DefaultedRegistryReference RESIN_BRICK_STAIRS = ItemTypes.key(ResourceKey.minecraft("resin_brick_stairs")); + + public static final DefaultedRegistryReference RESIN_BRICK_WALL = ItemTypes.key(ResourceKey.minecraft("resin_brick_wall")); + + public static final DefaultedRegistryReference RESIN_CLUMP = ItemTypes.key(ResourceKey.minecraft("resin_clump")); + public static final DefaultedRegistryReference RESPAWN_ANCHOR = ItemTypes.key(ResourceKey.minecraft("respawn_anchor")); public static final DefaultedRegistryReference RIB_ARMOR_TRIM_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("rib_armor_trim_smithing_template")); @@ -2130,6 +2382,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference SHIELD = ItemTypes.key(ResourceKey.minecraft("shield")); + public static final DefaultedRegistryReference SHORT_DRY_GRASS = ItemTypes.key(ResourceKey.minecraft("short_dry_grass")); + public static final DefaultedRegistryReference SHORT_GRASS = ItemTypes.key(ResourceKey.minecraft("short_grass")); public static final DefaultedRegistryReference SHROOMLIGHT = ItemTypes.key(ResourceKey.minecraft("shroomlight")); @@ -2258,6 +2512,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference SPRUCE_SAPLING = ItemTypes.key(ResourceKey.minecraft("spruce_sapling")); + public static final DefaultedRegistryReference SPRUCE_SHELF = ItemTypes.key(ResourceKey.minecraft("spruce_shelf")); + public static final DefaultedRegistryReference SPRUCE_SIGN = ItemTypes.key(ResourceKey.minecraft("spruce_sign")); public static final DefaultedRegistryReference SPRUCE_SLAB = ItemTypes.key(ResourceKey.minecraft("spruce_slab")); @@ -2302,6 +2558,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference STONE_SLAB = ItemTypes.key(ResourceKey.minecraft("stone_slab")); + public static final DefaultedRegistryReference STONE_SPEAR = ItemTypes.key(ResourceKey.minecraft("stone_spear")); + public static final DefaultedRegistryReference STONE_STAIRS = ItemTypes.key(ResourceKey.minecraft("stone_stairs")); public static final DefaultedRegistryReference STONE_SWORD = ItemTypes.key(ResourceKey.minecraft("stone_sword")); @@ -2346,6 +2604,10 @@ public final class ItemTypes { public static final DefaultedRegistryReference STRIPPED_OAK_WOOD = ItemTypes.key(ResourceKey.minecraft("stripped_oak_wood")); + public static final DefaultedRegistryReference STRIPPED_PALE_OAK_LOG = ItemTypes.key(ResourceKey.minecraft("stripped_pale_oak_log")); + + public static final DefaultedRegistryReference STRIPPED_PALE_OAK_WOOD = ItemTypes.key(ResourceKey.minecraft("stripped_pale_oak_wood")); + public static final DefaultedRegistryReference STRIPPED_SPRUCE_LOG = ItemTypes.key(ResourceKey.minecraft("stripped_spruce_log")); public static final DefaultedRegistryReference STRIPPED_SPRUCE_WOOD = ItemTypes.key(ResourceKey.minecraft("stripped_spruce_wood")); @@ -2376,12 +2638,18 @@ public final class ItemTypes { public static final DefaultedRegistryReference TADPOLE_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("tadpole_spawn_egg")); + public static final DefaultedRegistryReference TALL_DRY_GRASS = ItemTypes.key(ResourceKey.minecraft("tall_dry_grass")); + public static final DefaultedRegistryReference TALL_GRASS = ItemTypes.key(ResourceKey.minecraft("tall_grass")); public static final DefaultedRegistryReference TARGET = ItemTypes.key(ResourceKey.minecraft("target")); public static final DefaultedRegistryReference TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("terracotta")); + public static final DefaultedRegistryReference TEST_BLOCK = ItemTypes.key(ResourceKey.minecraft("test_block")); + + public static final DefaultedRegistryReference TEST_INSTANCE_BLOCK = ItemTypes.key(ResourceKey.minecraft("test_instance_block")); + public static final DefaultedRegistryReference TIDE_ARMOR_TRIM_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("tide_armor_trim_smithing_template")); public static final DefaultedRegistryReference TINTED_GLASS = ItemTypes.key(ResourceKey.minecraft("tinted_glass")); @@ -2494,6 +2762,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference WARPED_ROOTS = ItemTypes.key(ResourceKey.minecraft("warped_roots")); + public static final DefaultedRegistryReference WARPED_SHELF = ItemTypes.key(ResourceKey.minecraft("warped_shelf")); + public static final DefaultedRegistryReference WARPED_SIGN = ItemTypes.key(ResourceKey.minecraft("warped_sign")); public static final DefaultedRegistryReference WARPED_SLAB = ItemTypes.key(ResourceKey.minecraft("warped_slab")); @@ -2510,14 +2780,24 @@ public final class ItemTypes { public static final DefaultedRegistryReference WAXED_CHISELED_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_chiseled_copper")); + public static final DefaultedRegistryReference WAXED_COPPER_BARS = ItemTypes.key(ResourceKey.minecraft("waxed_copper_bars")); + public static final DefaultedRegistryReference WAXED_COPPER_BLOCK = ItemTypes.key(ResourceKey.minecraft("waxed_copper_block")); public static final DefaultedRegistryReference WAXED_COPPER_BULB = ItemTypes.key(ResourceKey.minecraft("waxed_copper_bulb")); + public static final DefaultedRegistryReference WAXED_COPPER_CHAIN = ItemTypes.key(ResourceKey.minecraft("waxed_copper_chain")); + + public static final DefaultedRegistryReference WAXED_COPPER_CHEST = ItemTypes.key(ResourceKey.minecraft("waxed_copper_chest")); + public static final DefaultedRegistryReference WAXED_COPPER_DOOR = ItemTypes.key(ResourceKey.minecraft("waxed_copper_door")); + public static final DefaultedRegistryReference WAXED_COPPER_GOLEM_STATUE = ItemTypes.key(ResourceKey.minecraft("waxed_copper_golem_statue")); + public static final DefaultedRegistryReference WAXED_COPPER_GRATE = ItemTypes.key(ResourceKey.minecraft("waxed_copper_grate")); + public static final DefaultedRegistryReference WAXED_COPPER_LANTERN = ItemTypes.key(ResourceKey.minecraft("waxed_copper_lantern")); + public static final DefaultedRegistryReference WAXED_COPPER_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("waxed_copper_trapdoor")); public static final DefaultedRegistryReference WAXED_CUT_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_cut_copper")); @@ -2530,12 +2810,22 @@ public final class ItemTypes { public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_BARS = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_bars")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_BULB = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_bulb")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_CHAIN = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_chain")); + + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_CHEST = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_chest")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_DOOR = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_door")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_GOLEM_STATUE = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_golem_statue")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_GRATE = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_grate")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_LANTERN = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_lantern")); + public static final DefaultedRegistryReference WAXED_EXPOSED_COPPER_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_copper_trapdoor")); public static final DefaultedRegistryReference WAXED_EXPOSED_CUT_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_cut_copper")); @@ -2544,16 +2834,30 @@ public final class ItemTypes { public static final DefaultedRegistryReference WAXED_EXPOSED_CUT_COPPER_STAIRS = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_cut_copper_stairs")); + public static final DefaultedRegistryReference WAXED_EXPOSED_LIGHTNING_ROD = ItemTypes.key(ResourceKey.minecraft("waxed_exposed_lightning_rod")); + + public static final DefaultedRegistryReference WAXED_LIGHTNING_ROD = ItemTypes.key(ResourceKey.minecraft("waxed_lightning_rod")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_CHISELED_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_chiseled_copper")); public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_BARS = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_bars")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_BULB = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_bulb")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_CHAIN = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_chain")); + + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_CHEST = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_chest")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_DOOR = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_door")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_GOLEM_STATUE = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_golem_statue")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_GRATE = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_grate")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_LANTERN = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_lantern")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_COPPER_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_copper_trapdoor")); public static final DefaultedRegistryReference WAXED_OXIDIZED_CUT_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_cut_copper")); @@ -2562,16 +2866,28 @@ public final class ItemTypes { public static final DefaultedRegistryReference WAXED_OXIDIZED_CUT_COPPER_STAIRS = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_cut_copper_stairs")); + public static final DefaultedRegistryReference WAXED_OXIDIZED_LIGHTNING_ROD = ItemTypes.key(ResourceKey.minecraft("waxed_oxidized_lightning_rod")); + public static final DefaultedRegistryReference WAXED_WEATHERED_CHISELED_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_chiseled_copper")); public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_BARS = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_bars")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_BULB = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_bulb")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_CHAIN = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_chain")); + + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_CHEST = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_chest")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_DOOR = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_door")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_GOLEM_STATUE = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_golem_statue")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_GRATE = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_grate")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_LANTERN = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_lantern")); + public static final DefaultedRegistryReference WAXED_WEATHERED_COPPER_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_copper_trapdoor")); public static final DefaultedRegistryReference WAXED_WEATHERED_CUT_COPPER = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_cut_copper")); @@ -2580,18 +2896,30 @@ public final class ItemTypes { public static final DefaultedRegistryReference WAXED_WEATHERED_CUT_COPPER_STAIRS = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_cut_copper_stairs")); + public static final DefaultedRegistryReference WAXED_WEATHERED_LIGHTNING_ROD = ItemTypes.key(ResourceKey.minecraft("waxed_weathered_lightning_rod")); + public static final DefaultedRegistryReference WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE = ItemTypes.key(ResourceKey.minecraft("wayfinder_armor_trim_smithing_template")); public static final DefaultedRegistryReference WEATHERED_CHISELED_COPPER = ItemTypes.key(ResourceKey.minecraft("weathered_chiseled_copper")); public static final DefaultedRegistryReference WEATHERED_COPPER = ItemTypes.key(ResourceKey.minecraft("weathered_copper")); + public static final DefaultedRegistryReference WEATHERED_COPPER_BARS = ItemTypes.key(ResourceKey.minecraft("weathered_copper_bars")); + public static final DefaultedRegistryReference WEATHERED_COPPER_BULB = ItemTypes.key(ResourceKey.minecraft("weathered_copper_bulb")); + public static final DefaultedRegistryReference WEATHERED_COPPER_CHAIN = ItemTypes.key(ResourceKey.minecraft("weathered_copper_chain")); + + public static final DefaultedRegistryReference WEATHERED_COPPER_CHEST = ItemTypes.key(ResourceKey.minecraft("weathered_copper_chest")); + public static final DefaultedRegistryReference WEATHERED_COPPER_DOOR = ItemTypes.key(ResourceKey.minecraft("weathered_copper_door")); + public static final DefaultedRegistryReference WEATHERED_COPPER_GOLEM_STATUE = ItemTypes.key(ResourceKey.minecraft("weathered_copper_golem_statue")); + public static final DefaultedRegistryReference WEATHERED_COPPER_GRATE = ItemTypes.key(ResourceKey.minecraft("weathered_copper_grate")); + public static final DefaultedRegistryReference WEATHERED_COPPER_LANTERN = ItemTypes.key(ResourceKey.minecraft("weathered_copper_lantern")); + public static final DefaultedRegistryReference WEATHERED_COPPER_TRAPDOOR = ItemTypes.key(ResourceKey.minecraft("weathered_copper_trapdoor")); public static final DefaultedRegistryReference WEATHERED_CUT_COPPER = ItemTypes.key(ResourceKey.minecraft("weathered_cut_copper")); @@ -2600,6 +2928,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference WEATHERED_CUT_COPPER_STAIRS = ItemTypes.key(ResourceKey.minecraft("weathered_cut_copper_stairs")); + public static final DefaultedRegistryReference WEATHERED_LIGHTNING_ROD = ItemTypes.key(ResourceKey.minecraft("weathered_lightning_rod")); + public static final DefaultedRegistryReference WEEPING_VINES = ItemTypes.key(ResourceKey.minecraft("weeping_vines")); public static final DefaultedRegistryReference WET_SPONGE = ItemTypes.key(ResourceKey.minecraft("wet_sponge")); @@ -2612,6 +2942,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference WHITE_BED = ItemTypes.key(ResourceKey.minecraft("white_bed")); + public static final DefaultedRegistryReference WHITE_BUNDLE = ItemTypes.key(ResourceKey.minecraft("white_bundle")); + public static final DefaultedRegistryReference WHITE_CANDLE = ItemTypes.key(ResourceKey.minecraft("white_candle")); public static final DefaultedRegistryReference WHITE_CARPET = ItemTypes.key(ResourceKey.minecraft("white_carpet")); @@ -2624,6 +2956,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference WHITE_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("white_glazed_terracotta")); + public static final DefaultedRegistryReference WHITE_HARNESS = ItemTypes.key(ResourceKey.minecraft("white_harness")); + public static final DefaultedRegistryReference WHITE_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("white_shulker_box")); public static final DefaultedRegistryReference WHITE_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("white_stained_glass")); @@ -2636,6 +2970,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference WHITE_WOOL = ItemTypes.key(ResourceKey.minecraft("white_wool")); + public static final DefaultedRegistryReference WILDFLOWERS = ItemTypes.key(ResourceKey.minecraft("wildflowers")); + 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")); @@ -2662,6 +2998,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference WOODEN_SHOVEL = ItemTypes.key(ResourceKey.minecraft("wooden_shovel")); + public static final DefaultedRegistryReference WOODEN_SPEAR = ItemTypes.key(ResourceKey.minecraft("wooden_spear")); + public static final DefaultedRegistryReference WOODEN_SWORD = ItemTypes.key(ResourceKey.minecraft("wooden_sword")); public static final DefaultedRegistryReference WRITABLE_BOOK = ItemTypes.key(ResourceKey.minecraft("writable_book")); @@ -2672,6 +3010,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference YELLOW_BED = ItemTypes.key(ResourceKey.minecraft("yellow_bed")); + public static final DefaultedRegistryReference YELLOW_BUNDLE = ItemTypes.key(ResourceKey.minecraft("yellow_bundle")); + public static final DefaultedRegistryReference YELLOW_CANDLE = ItemTypes.key(ResourceKey.minecraft("yellow_candle")); public static final DefaultedRegistryReference YELLOW_CARPET = ItemTypes.key(ResourceKey.minecraft("yellow_carpet")); @@ -2684,6 +3024,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference YELLOW_GLAZED_TERRACOTTA = ItemTypes.key(ResourceKey.minecraft("yellow_glazed_terracotta")); + public static final DefaultedRegistryReference YELLOW_HARNESS = ItemTypes.key(ResourceKey.minecraft("yellow_harness")); + public static final DefaultedRegistryReference YELLOW_SHULKER_BOX = ItemTypes.key(ResourceKey.minecraft("yellow_shulker_box")); public static final DefaultedRegistryReference YELLOW_STAINED_GLASS = ItemTypes.key(ResourceKey.minecraft("yellow_stained_glass")); @@ -2700,6 +3042,8 @@ public final class ItemTypes { public static final DefaultedRegistryReference ZOMBIE_HORSE_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("zombie_horse_spawn_egg")); + public static final DefaultedRegistryReference ZOMBIE_NAUTILUS_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("zombie_nautilus_spawn_egg")); + public static final DefaultedRegistryReference ZOMBIE_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("zombie_spawn_egg")); public static final DefaultedRegistryReference ZOMBIE_VILLAGER_SPAWN_EGG = ItemTypes.key(ResourceKey.minecraft("zombie_villager_spawn_egg")); diff --git a/src/main/java/org/spongepowered/api/item/enchantment/Enchantment.java b/src/main/java/org/spongepowered/api/item/enchantment/Enchantment.java index c4fffd8f620..f8b5e4ba06a 100644 --- a/src/main/java/org/spongepowered/api/item/enchantment/Enchantment.java +++ b/src/main/java/org/spongepowered/api/item/enchantment/Enchantment.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.item.enchantment; +import net.kyori.adventure.text.ComponentLike; import org.spongepowered.api.Sponge; import org.spongepowered.api.data.persistence.DataBuilder; import org.spongepowered.api.data.persistence.DataSerializable; @@ -42,7 +43,7 @@ * they will work properly outside of {@link EnchantmentType#minimumLevel()} * and {@link EnchantmentType#maximumLevel()}.

    */ -public interface Enchantment extends DataSerializable { +public interface Enchantment extends DataSerializable, ComponentLike { /** * Creates a new {@link Builder} to create an {@link Enchantment}. diff --git a/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentType.java b/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentType.java index 804eaa1bc8e..279ced28f9f 100644 --- a/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentType.java +++ b/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentType.java @@ -28,7 +28,7 @@ import org.spongepowered.api.block.entity.EnchantmentTable; import org.spongepowered.api.item.inventory.ItemStackLike; import org.spongepowered.api.registry.DefaultedRegistryValue; -import org.spongepowered.api.tag.EnchantmenTypeTags; +import org.spongepowered.api.tag.EnchantmentTypeTags; import org.spongepowered.api.tag.Taggable; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -36,7 +36,7 @@ * Represents a modifier on an item that has various effects. */ @CatalogedBy(EnchantmentTypes.class) -public interface EnchantmentType extends DefaultedRegistryValue, ComponentLike, Taggable { +public interface EnchantmentType extends DefaultedRegistryValue, ComponentLike, Taggable { /** * Gets the weight of this enchantment type. @@ -117,7 +117,7 @@ public interface EnchantmentType extends DefaultedRegistryValue, ComponentLike, * @return Whether this enchantment type is a treasure enchantment type */ default boolean isTreasure() { - return this.is(EnchantmenTypeTags.TREASURE); + return this.is(EnchantmentTypeTags.TREASURE); } /** @@ -127,7 +127,7 @@ default boolean isTreasure() { * @return Whether this enchantment type is a curse enchantment type */ default boolean isCurse() { - return this.is(EnchantmenTypeTags.CURSE); + return this.is(EnchantmentTypeTags.CURSE); } } 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 a22a95b7ee5..9243434f481 100644 --- a/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentTypes.java +++ b/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentTypes.java @@ -164,6 +164,14 @@ public final class EnchantmentTypes { */ public static final DefaultedRegistryReference LUCK_OF_THE_SEA = EnchantmentTypes.key(ResourceKey.minecraft("luck_of_the_sea")); + /** + * Lunge is an enchantment applied to spears that causes jab attacks to propel the wielder forward horizontally at the cost of draining durability. + * + *

    In vanilla, the maximum level is 3.

    + * See
    Lunge on the Minecraft Wiki. + */ + public static final DefaultedRegistryReference LUNGE = EnchantmentTypes.key(ResourceKey.minecraft("lunge")); + /** * Increases rate of fish biting your hook while fishing. * @@ -284,6 +292,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.ENCHANTMENT_TYPE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.ENCHANTMENT_TYPE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/item/inventory/ContainerType.java b/src/main/java/org/spongepowered/api/item/inventory/ContainerType.java index 4022689ad5c..86f702f864e 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/ContainerType.java +++ b/src/main/java/org/spongepowered/api/item/inventory/ContainerType.java @@ -33,6 +33,6 @@ * It defines what {@link Container} is displayed on the client side when the inventory is opened. */ @CatalogedBy(ContainerTypes.class) -public interface ContainerType extends DefaultedRegistryValue { +public interface ContainerType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/item/inventory/ItemStack.java b/src/main/java/org/spongepowered/api/item/inventory/ItemStack.java index 5732149556f..991261f1647 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/ItemStack.java +++ b/src/main/java/org/spongepowered/api/item/inventory/ItemStack.java @@ -121,14 +121,6 @@ static ItemStack of(ItemType itemType) { */ void setQuantity(int quantity) throws IllegalArgumentException; - /** - * @deprecated Use {@link #asImmutable()} instead. - */ - @Deprecated(forRemoval = true) - default ItemStackSnapshot createSnapshot() { - return this.asImmutable(); - } - /** * Returns true if the specified {@link ItemStack} has the same stack * size, {@link ItemType}, and data. Note that this method is not an diff --git a/src/main/java/org/spongepowered/api/item/inventory/ItemStackSnapshot.java b/src/main/java/org/spongepowered/api/item/inventory/ItemStackSnapshot.java index e6fa6e98f9f..35314f96e94 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/ItemStackSnapshot.java +++ b/src/main/java/org/spongepowered/api/item/inventory/ItemStackSnapshot.java @@ -45,14 +45,6 @@ static ItemStackSnapshot empty() { return Sponge.game().factoryProvider().provide(Factory.class).empty(); } - /** - * @deprecated Use {@link #asMutable()} or {@link #asMutableCopy()} instead. - */ - @Deprecated(forRemoval = true) - default ItemStack createStack() { - return this.asMutable(); - } - interface Factory { ItemStackSnapshot empty(); diff --git a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentCondition.java b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentCondition.java new file mode 100644 index 00000000000..9bfe345588c --- /dev/null +++ b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentCondition.java @@ -0,0 +1,58 @@ +/* + * 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.item.inventory.equipment; + +import net.kyori.adventure.text.ComponentLike; +import org.spongepowered.api.data.type.StringRepresentable; +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +import java.util.Objects; +import java.util.function.Supplier; + +/** + * Represents some condition for {@link EquipmentType}. + */ +@CatalogedBy(EquipmentConditions.class) +public interface EquipmentCondition extends DefaultedRegistryValue, StringRepresentable, ComponentLike { + + /** + * Tests whether the equipment type is suitable for this condition. + * + * @param type The equipment type to test + * @return True if the equipment type is suitable for this condition + */ + default boolean test(final Supplier type) { + return this.test(Objects.requireNonNull(type, "type").get()); + } + + /** + * Tests whether the equipment type is suitable for this condition. + * + * @param type The equipment type to test + * @return True if the equipment type is suitable for this condition + */ + boolean test(EquipmentType type); +} diff --git a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentConditions.java b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentConditions.java new file mode 100644 index 00000000000..5c4737fec9f --- /dev/null +++ b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentConditions.java @@ -0,0 +1,71 @@ +/* + * 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.item.inventory.equipment; + +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 EquipmentConditions { + + public static final DefaultedRegistryReference ANY = EquipmentConditions.key(ResourceKey.sponge("any")); + + public static final DefaultedRegistryReference ARMOR = EquipmentConditions.key(ResourceKey.sponge("armor")); + + public static final DefaultedRegistryReference BODY = EquipmentConditions.key(ResourceKey.sponge("body")); + + public static final DefaultedRegistryReference CHEST = EquipmentConditions.key(ResourceKey.sponge("chest")); + + public static final DefaultedRegistryReference FEET = EquipmentConditions.key(ResourceKey.sponge("feet")); + + public static final DefaultedRegistryReference HAND = EquipmentConditions.key(ResourceKey.sponge("hand")); + + public static final DefaultedRegistryReference HEAD = EquipmentConditions.key(ResourceKey.sponge("head")); + + public static final DefaultedRegistryReference LEGS = EquipmentConditions.key(ResourceKey.sponge("legs")); + + public static final DefaultedRegistryReference MAINHAND = EquipmentConditions.key(ResourceKey.sponge("mainhand")); + + public static final DefaultedRegistryReference OFFHAND = EquipmentConditions.key(ResourceKey.sponge("offhand")); + + public static final DefaultedRegistryReference SADDLE = EquipmentConditions.key(ResourceKey.sponge("saddle")); + + private EquipmentConditions() { + } + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.EQUIPMENT_CONDITION); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.EQUIPMENT_CONDITION, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentGroup.java b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentGroup.java index e036225f15d..7dd88c31abc 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentGroup.java +++ b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentGroup.java @@ -31,6 +31,6 @@ * Represents a grouping of {@link EquipmentType equipment}. */ @CatalogedBy(EquipmentGroups.class) -public interface EquipmentGroup extends DefaultedRegistryValue { +public interface EquipmentGroup extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentGroups.java b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentGroups.java index 9a369859919..2cc988bdae1 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentGroups.java +++ b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentGroups.java @@ -46,6 +46,8 @@ public final class EquipmentGroups { public static final DefaultedRegistryReference HUMANOID_ARMOR = EquipmentGroups.key(ResourceKey.sponge("humanoid_armor")); + public static final DefaultedRegistryReference SADDLE = EquipmentGroups.key(ResourceKey.sponge("saddle")); + private EquipmentGroups() { } diff --git a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentType.java b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentType.java index da2e28ca180..f24f78ed051 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentType.java +++ b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentType.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.item.inventory.equipment; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -31,7 +32,7 @@ * Represents a equipment type. */ @CatalogedBy(EquipmentTypes.class) -public interface EquipmentType extends DefaultedRegistryValue { +public interface EquipmentType extends DefaultedRegistryValue, StringRepresentable { /** * Gets the {@link EquipmentGroup group} this equipment falls under. @@ -39,4 +40,11 @@ public interface EquipmentType extends DefaultedRegistryValue { * @return The group */ EquipmentGroup group(); + + /** + * Gets the most specific {@link EquipmentCondition} for this equipment type. + * + * @return The condition + */ + EquipmentCondition condition(); } diff --git a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentTypes.java b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentTypes.java index c15efac03ba..ad0d3f5a465 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentTypes.java +++ b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentTypes.java @@ -54,6 +54,8 @@ public final class EquipmentTypes { public static final DefaultedRegistryReference OFFHAND = EquipmentTypes.key(ResourceKey.sponge("offhand")); + public static final DefaultedRegistryReference SADDLE = EquipmentTypes.key(ResourceKey.sponge("saddle")); + private EquipmentTypes() { } diff --git a/src/main/java/org/spongepowered/api/item/inventory/menu/ClickType.java b/src/main/java/org/spongepowered/api/item/inventory/menu/ClickType.java index ef46a8f375a..de0adb7a5b5 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/menu/ClickType.java +++ b/src/main/java/org/spongepowered/api/item/inventory/menu/ClickType.java @@ -34,6 +34,6 @@ * @param The handler for the click type */ @CatalogedBy(ClickTypes.class) -public interface ClickType extends DefaultedRegistryValue { +public interface ClickType extends DefaultedRegistryValue> { } diff --git a/src/main/java/org/spongepowered/api/item/inventory/query/QueryType.java b/src/main/java/org/spongepowered/api/item/inventory/query/QueryType.java index dd745418fe9..da1fb7e5e8e 100644 --- a/src/main/java/org/spongepowered/api/item/inventory/query/QueryType.java +++ b/src/main/java/org/spongepowered/api/item/inventory/query/QueryType.java @@ -32,7 +32,7 @@ * Represents a possible type of operation for an {@link Inventory#query inventory query}. */ @CatalogedBy(QueryTypes.class) -public interface QueryType extends DefaultedRegistryValue { +public interface QueryType extends DefaultedRegistryValue { /** * A type of query that requires no parameters. It can directly be used as a query. diff --git a/src/main/java/org/spongepowered/api/item/potion/PotionType.java b/src/main/java/org/spongepowered/api/item/potion/PotionType.java index 842185786c3..b2cf7d5a4f7 100644 --- a/src/main/java/org/spongepowered/api/item/potion/PotionType.java +++ b/src/main/java/org/spongepowered/api/item/potion/PotionType.java @@ -34,7 +34,7 @@ * Represents a type of potion with specific {@link PotionEffect}s. */ @CatalogedBy(PotionTypes.class) -public interface PotionType extends DefaultedRegistryValue { +public interface PotionType extends DefaultedRegistryValue { List effects(); } diff --git a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java index cb06bb9f0dd..6ef2f7a04a9 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java +++ b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java @@ -29,12 +29,12 @@ import org.spongepowered.api.block.entity.carrier.furnace.BlastFurnace; import org.spongepowered.api.block.entity.carrier.furnace.Furnace; import org.spongepowered.api.block.entity.carrier.furnace.Smoker; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.item.ItemTypes; import org.spongepowered.api.item.inventory.ItemStackSnapshot; import org.spongepowered.api.item.inventory.crafting.CraftingInventory; import org.spongepowered.api.item.recipe.cooking.CookingRecipe; import org.spongepowered.api.item.recipe.crafting.CraftingRecipe; -import org.spongepowered.api.item.recipe.crafting.Ingredient; import org.spongepowered.api.item.recipe.crafting.RecipeInput; import org.spongepowered.api.item.recipe.crafting.RecipeResult; import org.spongepowered.api.item.recipe.crafting.ShapedCraftingRecipe; @@ -42,6 +42,7 @@ import org.spongepowered.api.item.recipe.crafting.SpecialCraftingRecipe; import org.spongepowered.api.item.recipe.single.StoneCutterRecipe; import org.spongepowered.api.item.recipe.smithing.SmithingRecipe; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.world.server.ServerWorld; import java.util.List; @@ -57,7 +58,7 @@ *

    {@link StoneCutterRecipe} for recipes in a {@link BlockTypes#STONECUTTER} block

    *

    {@link SmithingRecipe} for recipes in a {@link BlockTypes#SMITHING_TABLE} block

    */ -public interface Recipe { +public interface Recipe extends DefaultedRegistryValue>, DataPackSerializable { /** * Checks if the given inventory fits the required constraints to make a valid recipe @@ -124,13 +125,6 @@ default Optional result(T inventory, ServerWorld world) { return Optional.empty(); } - /** - * Gets the ingredients for this recipe. - * - * @return An unmodifiable list of the ingredients. - */ - List ingredients(); - /** * Returns true if the recipe is dynamic. *

    Dynamic recipes are not displayed in the recipe book.

    diff --git a/src/main/java/org/spongepowered/api/item/recipe/RecipeManager.java b/src/main/java/org/spongepowered/api/item/recipe/RecipeManager.java index 84ea899a8ae..5e487d8125c 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/RecipeManager.java +++ b/src/main/java/org/spongepowered/api/item/recipe/RecipeManager.java @@ -36,8 +36,7 @@ /** * Manages registered recipes. - * Register new Recipes during {@link org.spongepowered.api.event.lifecycle.RegisterDataPackValueEvent} - * using {@link RecipeRegistration}s. + * Register new Recipes during {@link org.spongepowered.api.event.lifecycle.RegisterRegistryValueEvent}. * To disable a recipe override it with an empty result. */ public interface RecipeManager { diff --git a/src/main/java/org/spongepowered/api/item/recipe/RecipeType.java b/src/main/java/org/spongepowered/api/item/recipe/RecipeType.java index 11f1b55ac77..5ee0bd09d4f 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/RecipeType.java +++ b/src/main/java/org/spongepowered/api/item/recipe/RecipeType.java @@ -29,7 +29,7 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(RecipeTypes.class) -public interface RecipeType> extends DefaultedRegistryValue { +public interface RecipeType> extends DefaultedRegistryValue> { } diff --git a/src/main/java/org/spongepowered/api/item/recipe/RecipeTypes.java b/src/main/java/org/spongepowered/api/item/recipe/RecipeTypes.java index 4a26ee214db..ff9049c36f9 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/RecipeTypes.java +++ b/src/main/java/org/spongepowered/api/item/recipe/RecipeTypes.java @@ -61,7 +61,7 @@ public final class RecipeTypes { private RecipeTypes() { } - public static Registry>> registry() { + public static Registry> registry() { return Sponge.game().registry(RegistryTypes.RECIPE_TYPE); } diff --git a/src/main/java/org/spongepowered/api/item/recipe/cooking/CookingRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/cooking/CookingRecipe.java index 49617451922..e8fa771f5aa 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/cooking/CookingRecipe.java +++ b/src/main/java/org/spongepowered/api/item/recipe/cooking/CookingRecipe.java @@ -26,15 +26,13 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPack; import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.inventory.ItemStackLike; import org.spongepowered.api.item.recipe.Recipe; -import org.spongepowered.api.item.recipe.RecipeRegistration; import org.spongepowered.api.item.recipe.RecipeType; import org.spongepowered.api.item.recipe.crafting.Ingredient; import org.spongepowered.api.item.recipe.crafting.RecipeInput; -import org.spongepowered.api.util.ResourceKeyedBuilder; +import org.spongepowered.api.util.Builder; import org.spongepowered.api.util.Ticks; import java.util.Optional; @@ -100,7 +98,7 @@ static Builder builder() { /** * Builds a simple furnace recipe. */ - interface Builder extends ResourceKeyedBuilder { + interface Builder extends org.spongepowered.api.util.Builder { /** * Sets the type of recipe @@ -203,7 +201,7 @@ default EndStep result(Supplier result) { } interface EndStep extends Builder, - org.spongepowered.api.util.Builder { + org.spongepowered.api.util.Builder { /** * Sets the group of the recipe. @@ -231,16 +229,6 @@ interface EndStep extends Builder, */ EndStep cookingTime(Ticks ticks); - - /** - * Sets the data pack for the recipe. - * - * @param pack The data pack - * - * @return This builder, for chaining - */ - EndStep pack(DataPack pack); - } } } diff --git a/src/main/java/org/spongepowered/api/item/recipe/cooking/CookingResult.java b/src/main/java/org/spongepowered/api/item/recipe/cooking/CookingResult.java index 8cb100ba488..447a67cd895 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/cooking/CookingResult.java +++ b/src/main/java/org/spongepowered/api/item/recipe/cooking/CookingResult.java @@ -28,22 +28,22 @@ import org.spongepowered.api.item.inventory.ItemStackSnapshot; import java.util.Objects; -import java.util.StringJoiner; /** * The result of fulfilling a {@link CookingRecipe}. */ -public final class CookingResult { - - private final ItemStackSnapshot result; - private final double experience; +public record CookingResult(ItemStackSnapshot result, double experience) { /** - * @deprecated Use {@link #CookingResult(ItemStackLike, double)} instead. + * Creates a new {@link CookingResult}. + * + *

    Note that this may be replaced with a static of method in the future.

    + * + * @param result The result of the cooking recipe + * @param experience The experience that should be created from this result */ - @Deprecated(forRemoval = true) - public CookingResult(final ItemStackSnapshot result, final double experience) { - this((ItemStackLike) result, experience); + public CookingResult(final ItemStackLike result, final double experience) { + this(Objects.requireNonNull(result, "result").asImmutable(), experience); } /** @@ -54,7 +54,7 @@ public CookingResult(final ItemStackSnapshot result, final double experience) { * @param result The result of the cooking recipe * @param experience The experience that should be created from this result */ - public CookingResult(final ItemStackLike result, final double experience) { + public CookingResult { Objects.requireNonNull(result, "result"); if (result.isEmpty()) { throw new IllegalArgumentException("The result must not be empty"); @@ -62,9 +62,6 @@ public CookingResult(final ItemStackLike result, final double experience) { if (experience < 0) { throw new IllegalArgumentException("The experience must be non-negative."); } - - this.result = result.asImmutable(); - this.experience = experience; } /** @@ -92,28 +89,4 @@ public double experience() { return this.experience; } - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - if (!(o instanceof CookingResult)) { - return false; - } - final CookingResult that = (CookingResult) o; - return Double.compare(that.experience, this.experience) == 0 && Objects.equals(this.result, that.result); - } - - @Override - public int hashCode() { - return Objects.hash(this.result, this.experience); - } - - @Override - public String toString() { - return new StringJoiner(", ", CookingResult.class.getSimpleName() + "[", "]") - .add("result=" + this.result) - .add("experience=" + this.experience) - .toString(); - } } diff --git a/src/main/java/org/spongepowered/api/item/recipe/crafting/Ingredient.java b/src/main/java/org/spongepowered/api/item/recipe/crafting/Ingredient.java index 0c862cfb505..ac32a099032 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/crafting/Ingredient.java +++ b/src/main/java/org/spongepowered/api/item/recipe/crafting/Ingredient.java @@ -86,35 +86,6 @@ static Ingredient of(ItemType @Nullable ... itemTypes) { return Ingredient.builder().with(itemTypes).build(); } - /** - * @deprecated Use {@link #of(ItemStackLike...)} instead. - */ - @Deprecated(forRemoval = true) - static Ingredient of(ItemStack @Nullable ... items) { - return Ingredient.of((ItemStackLike[]) items); - } - - /** - * @deprecated Use {@link #of(ItemStackLike...)} instead. - */ - @Deprecated(forRemoval = true) - static Ingredient of(ItemStackSnapshot @Nullable ... items) { - return Ingredient.of((ItemStackLike[]) items); - } - - /** - * Creates a new {@link Ingredient} for the provided {@link ItemStackLike}s. - * - * @param items The item - * @return The new ingredient - */ - static Ingredient of(ItemStackLike @Nullable ... items) { - if (items == null) { - return Ingredient.empty(); - } - return Ingredient.builder().with(items).build(); - } - /** * Creates a new {@link Ingredient} for the provided {@link ItemType}s. * @@ -130,11 +101,16 @@ static Ingredient of(DefaultedRegistryReference @Nullable .. } /** - * @deprecated Use {@link #of(ResourceKey, Predicate, ItemStackLike...)} instead. + * Creates a new {@link Ingredient} for the provided {@link ItemStackLike}s. + * + * @param items The item + * @return The new ingredient */ - @Deprecated(forRemoval = true) - static Ingredient of(ResourceKey key, Predicate predicate, ItemStack... exemplaryStacks) { - return Ingredient.of(key, itemStack -> predicate.test(itemStack.asMutable()), (ItemStackLike[]) exemplaryStacks); + static Ingredient of(ItemStackLike @Nullable ... items) { + if (items == null) { + return Ingredient.empty(); + } + return Ingredient.builder().with(items).build(); } /** diff --git a/src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeResult.java b/src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeResult.java index 489eadcbf07..99690df799c 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeResult.java +++ b/src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeResult.java @@ -40,14 +40,6 @@ public final class RecipeResult { private final ItemStackSnapshot result; private final List remainingItems; - /** - * @deprecated Use {@link #RecipeResult(ItemStackLike, List)} instead. - */ - @Deprecated(forRemoval = true) - public RecipeResult(ItemStackSnapshot result, List remainingItems) { - this((ItemStackLike) result, (List) remainingItems); - } - /** * Creates a new {@link RecipeResult}. * diff --git a/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapedCraftingRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapedCraftingRecipe.java index 51c66981a75..8c65a4f2b3e 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapedCraftingRecipe.java +++ b/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapedCraftingRecipe.java @@ -25,13 +25,10 @@ package org.spongepowered.api.item.recipe.crafting; import org.checkerframework.checker.nullness.qual.Nullable; -import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPack; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.ItemStackLike; -import org.spongepowered.api.item.recipe.RecipeRegistration; -import org.spongepowered.api.util.ResourceKeyedBuilder; +import org.spongepowered.api.util.Builder; import java.util.List; import java.util.Map; @@ -42,6 +39,13 @@ */ public interface ShapedCraftingRecipe extends CraftingRecipe { + /** + * Gets the ingredients for this recipe. + * + * @return An unmodifiable list of the ingredients. + */ + List ingredients(); + /** * Creates a new {@link ShapedCraftingRecipe.Builder} to build a {@link ShapedCraftingRecipe}. * @@ -102,7 +106,7 @@ static Builder builder() { * } * */ - interface Builder extends ResourceKeyedBuilder { + interface Builder extends org.spongepowered.api.util.Builder { /** * Start building a new recipe based on the aisle pattern. @@ -243,7 +247,7 @@ interface ResultStep extends Builder { * In this Step set the group of the Recipe and/or build it. */ interface EndStep extends Builder, - org.spongepowered.api.util.Builder { + org.spongepowered.api.util.Builder { /** * Sets the group of the recipe. @@ -254,24 +258,14 @@ interface EndStep extends Builder, */ EndStep group(@Nullable String name); - /** - * Sets the data pack for the recipe. - * - * @param pack The data pack - * - * @return This builder, for chaining - */ - EndStep pack(DataPack pack); - /** * Builds the {@link ShapedCraftingRecipe}. * * @return The built shaped crafting recipe - * @throws IllegalStateException If not all the recipe builder steps are completed - * or the {@link #key(ResourceKey)} isn't set. + * @throws IllegalStateException If not all the recipe builder steps are completed. */ @Override - RecipeRegistration build() throws IllegalStateException; + ShapedCraftingRecipe build() throws IllegalStateException; } } diff --git a/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapelessCraftingRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapelessCraftingRecipe.java index a14e4f93823..c09afe50e43 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapelessCraftingRecipe.java +++ b/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapelessCraftingRecipe.java @@ -25,13 +25,10 @@ package org.spongepowered.api.item.recipe.crafting; import org.checkerframework.checker.nullness.qual.Nullable; -import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPack; import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.inventory.ItemStackLike; -import org.spongepowered.api.item.recipe.RecipeRegistration; -import org.spongepowered.api.util.ResourceKeyedBuilder; +import org.spongepowered.api.util.Builder; import java.util.List; import java.util.function.Function; @@ -43,6 +40,13 @@ */ public interface ShapelessCraftingRecipe extends CraftingRecipe { + /** + * Gets the ingredients for this recipe. + * + * @return An unmodifiable list of the ingredients. + */ + List ingredients(); + /** * Creates a new {@link Builder} to build a {@link ShapelessCraftingRecipe}. * @@ -55,7 +59,7 @@ static Builder builder() { /** * The Builder for {@link ShapelessCraftingRecipe}s. */ - interface Builder extends ResourceKeyedBuilder { + interface Builder extends org.spongepowered.api.util.Builder { /** * Adds ingredients for this recipe. @@ -126,7 +130,7 @@ interface ResultStep extends Builder { * In this Step set the group of the Recipe and/or build it. */ interface EndStep extends Builder, - org.spongepowered.api.util.Builder { + org.spongepowered.api.util.Builder { /** * Sets the group of the recipe. @@ -137,24 +141,14 @@ interface EndStep extends Builder, */ EndStep group(@Nullable String name); - /** - * Sets the data pack for the recipe. - * - * @param pack The data pack - * - * @return This builder, for chaining - */ - EndStep pack(DataPack pack); - /** * Builds the {@link ShapelessCraftingRecipe}. * * @return The built shapeless crafting recipe - * @throws IllegalStateException If not all the recipe builder steps are completed - * or the {@link #key(ResourceKey)} isn't set. + * @throws IllegalStateException If not all the recipe builder steps are completed. */ @Override - RecipeRegistration build() throws IllegalStateException; + ShapelessCraftingRecipe build() throws IllegalStateException; } } diff --git a/src/main/java/org/spongepowered/api/item/recipe/crafting/SpecialCraftingRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/crafting/SpecialCraftingRecipe.java index c8be1acd85a..33128a333c5 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/crafting/SpecialCraftingRecipe.java +++ b/src/main/java/org/spongepowered/api/item/recipe/crafting/SpecialCraftingRecipe.java @@ -25,10 +25,8 @@ package org.spongepowered.api.item.recipe.crafting; import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPack; import org.spongepowered.api.item.inventory.ItemStackLike; -import org.spongepowered.api.item.recipe.RecipeRegistration; -import org.spongepowered.api.util.ResourceKeyedBuilder; +import org.spongepowered.api.util.Builder; import org.spongepowered.api.world.server.ServerWorld; import java.util.List; @@ -50,7 +48,7 @@ static Builder builder() { return Sponge.game().builderProvider().provide(Builder.class); } - interface Builder extends ResourceKeyedBuilder { + interface Builder extends org.spongepowered.api.util.Builder { /** * Sets the recipe matcher. @@ -95,16 +93,7 @@ interface ResultStep extends Builder { EndStep result(ItemStackLike result); } - interface EndStep extends Builder, org.spongepowered.api.util.Builder { - - /** - * Sets the data pack for the recipe. - * - * @param pack The data pack - * - * @return This builder, for chaining - */ - EndStep pack(DataPack pack); + interface EndStep extends Builder, org.spongepowered.api.util.Builder { /** * Builds the {@link SpecialCraftingRecipe}. @@ -113,7 +102,7 @@ interface EndStep extends Builder, org.spongepowered.api.util.Builder type(); /** * Builds a simple stonecutter recipe */ - interface Builder extends ResourceKeyedBuilder { + interface Builder extends org.spongepowered.api.util.Builder { /** * Sets the ingredient and returns this builder. @@ -112,7 +116,7 @@ interface ResultStep extends StoneCutterRecipe.Builder { } interface EndStep extends StoneCutterRecipe.Builder, - org.spongepowered.api.util.Builder { + org.spongepowered.api.util.Builder { /** * Sets the group of the recipe. @@ -123,24 +127,14 @@ interface EndStep extends StoneCutterRecipe.Builder, */ EndStep group(@Nullable String name); - /** - * Sets the data pack for the recipe. - * - * @param pack The data pack - * - * @return This builder, for chaining - */ - EndStep pack(DataPack pack); - /** * Builds the {@link StoneCutterRecipe}. * * @return The built stone cutter recipe - * @throws IllegalStateException If not all the recipe builder steps are completed - * or the {@link #key(ResourceKey)} isn't set. + * @throws IllegalStateException If not all the recipe builder steps are completed. */ @Override - RecipeRegistration build() throws IllegalStateException; + StoneCutterRecipe build() throws IllegalStateException; } } } diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/SmithingRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/SmithingRecipe.java index dc344d53f34..1f2063f2116 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/smithing/SmithingRecipe.java +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/SmithingRecipe.java @@ -25,18 +25,16 @@ package org.spongepowered.api.item.recipe.smithing; import org.checkerframework.checker.nullness.qual.Nullable; -import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPack; import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.inventory.ItemStackLike; import org.spongepowered.api.item.recipe.Recipe; -import org.spongepowered.api.item.recipe.RecipeRegistration; import org.spongepowered.api.item.recipe.RecipeType; import org.spongepowered.api.item.recipe.crafting.Ingredient; import org.spongepowered.api.item.recipe.crafting.RecipeInput; -import org.spongepowered.api.util.ResourceKeyedBuilder; +import org.spongepowered.api.util.Builder; +import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; @@ -49,13 +47,34 @@ static SmithingRecipe.Builder builder() { return Sponge.game().builderProvider().provide(SmithingRecipe.Builder.class); } + /** + * Returns the smithing template {@link Ingredient} for this {@link SmithingRecipe}. + * + * @return The smithing template {@link Ingredient} for this {@link SmithingRecipe}. + */ + Optional templateIngredient(); + + /** + * Returns the base {@link Ingredient} for this {@link SmithingRecipe}. + * + * @return The base {@link Ingredient} for this {@link SmithingRecipe}. + */ + Optional baseIngredient(); + + /** + * Returns the additional {@link Ingredient} for this {@link SmithingRecipe}. + * + * @return The additional {@link Ingredient} for this {@link SmithingRecipe}. + */ + Optional additionalIngredient(); + @Override RecipeType type(); /** * Builds a simple smithing recipe */ - interface Builder extends ResourceKeyedBuilder { + interface Builder extends org.spongepowered.api.util.Builder { // TODO Trim recipe? @@ -176,7 +195,7 @@ interface ResultStep extends SmithingRecipe.Builder { } - interface EndStep extends SmithingRecipe.Builder, org.spongepowered.api.util.Builder { + interface EndStep extends SmithingRecipe.Builder, org.spongepowered.api.util.Builder { /** * Sets the group of the recipe. @@ -187,24 +206,14 @@ interface EndStep extends SmithingRecipe.Builder, org.spongepowered.api.util.Bui */ EndStep group(@Nullable String name); - /** - * Sets the data pack for the recipe. - * - * @param pack The data pack - * - * @return This builder, for chaining - */ - EndStep pack(DataPack pack); - /** * Builds the {@link SmithingRecipe}. * * @return The built stone cutter recipe - * @throws IllegalStateException If not all the recipe builder steps are completed - * or the {@link #key(ResourceKey)} isn't set. + * @throws IllegalStateException If not all the recipe builder steps are completed. */ @Override - RecipeRegistration build() throws IllegalStateException; + SmithingRecipe build() throws IllegalStateException; } } } diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterial.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterial.java index 88585747eca..73300783490 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterial.java +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterial.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(TrimMaterials.class) -public interface TrimMaterial extends DefaultedRegistryValue { +public interface TrimMaterial extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterials.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterials.java index c536f03443d..97fe0c34725 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterials.java +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimMaterials.java @@ -33,6 +33,9 @@ import org.spongepowered.api.registry.RegistryScopes; import org.spongepowered.api.registry.RegistryTypes; +/** + * + */ @SuppressWarnings("unused") @RegistryScopes(scopes = RegistryScope.ENGINE) public final class TrimMaterials { @@ -57,6 +60,8 @@ public final class TrimMaterials { public static final DefaultedRegistryReference REDSTONE = TrimMaterials.key(ResourceKey.minecraft("redstone")); + public static final DefaultedRegistryReference RESIN = TrimMaterials.key(ResourceKey.minecraft("resin")); + private TrimMaterials() { } @@ -65,6 +70,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.TRIM_MATERIAL, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.TRIM_MATERIAL, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPattern.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPattern.java index 5846c44fb96..c0500837174 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPattern.java +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPattern.java @@ -28,5 +28,5 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(TrimPatterns.class) -public interface TrimPattern extends DefaultedRegistryValue { +public interface TrimPattern extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPatterns.java b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPatterns.java index 228aa006327..e185858d0a9 100644 --- a/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPatterns.java +++ b/src/main/java/org/spongepowered/api/item/recipe/smithing/TrimPatterns.java @@ -33,6 +33,9 @@ import org.spongepowered.api.registry.RegistryScopes; import org.spongepowered.api.registry.RegistryTypes; +/** + * + */ @SuppressWarnings("unused") @RegistryScopes(scopes = RegistryScope.ENGINE) public final class TrimPatterns { @@ -81,6 +84,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.TRIM_PATTERN, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.TRIM_PATTERN, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/map/color/MapColorType.java b/src/main/java/org/spongepowered/api/map/color/MapColorType.java index 17e0cdfc02d..bb8531c8b28 100644 --- a/src/main/java/org/spongepowered/api/map/color/MapColorType.java +++ b/src/main/java/org/spongepowered/api/map/color/MapColorType.java @@ -33,7 +33,7 @@ * Represents a color that can be used when drawing on a {@link MapCanvas}. */ @CatalogedBy(MapColorTypes.class) -public interface MapColorType extends DefaultedRegistryValue { +public interface MapColorType extends DefaultedRegistryValue { /** * Gets the {@link Color} that this type represents. diff --git a/src/main/java/org/spongepowered/api/map/color/MapShade.java b/src/main/java/org/spongepowered/api/map/color/MapShade.java index a2c3dddf179..2a26974e844 100644 --- a/src/main/java/org/spongepowered/api/map/color/MapShade.java +++ b/src/main/java/org/spongepowered/api/map/color/MapShade.java @@ -32,5 +32,5 @@ * to form a {@link MapColor} */ @CatalogedBy(MapShades.class) -public interface MapShade extends DefaultedRegistryValue { +public interface MapShade extends DefaultedRegistryValue { } 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 72549a60d4c..90b33164e66 100644 --- a/src/main/java/org/spongepowered/api/map/decoration/MapDecorationType.java +++ b/src/main/java/org/spongepowered/api/map/decoration/MapDecorationType.java @@ -35,7 +35,7 @@ * 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 { +public interface MapDecorationType extends DefaultedRegistryValue { /** * Gets the corresponding {@link DyeColor} that this banner decoration type is. diff --git a/src/main/java/org/spongepowered/api/map/decoration/orientation/MapDecorationOrientation.java b/src/main/java/org/spongepowered/api/map/decoration/orientation/MapDecorationOrientation.java index 82a7c8e1003..3a70735d3e5 100644 --- a/src/main/java/org/spongepowered/api/map/decoration/orientation/MapDecorationOrientation.java +++ b/src/main/java/org/spongepowered/api/map/decoration/orientation/MapDecorationOrientation.java @@ -32,6 +32,6 @@ * pointing in on a {@link org.spongepowered.api.map.MapInfo}. */ @CatalogedBy(MapDecorationOrientations.class) -public interface MapDecorationOrientation extends DefaultedRegistryValue { +public interface MapDecorationOrientation extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/placeholder/PlaceholderParser.java b/src/main/java/org/spongepowered/api/placeholder/PlaceholderParser.java index ca769b877ff..3046473f6be 100644 --- a/src/main/java/org/spongepowered/api/placeholder/PlaceholderParser.java +++ b/src/main/java/org/spongepowered/api/placeholder/PlaceholderParser.java @@ -35,7 +35,7 @@ * Provides the logic of how to parse a placeholder token. */ @CatalogedBy(PlaceholderParsers.class) -public interface PlaceholderParser extends DefaultedRegistryValue { +public interface PlaceholderParser extends DefaultedRegistryValue { /** * Returns a {@link Builder} that allows for the creation of simple diff --git a/src/main/java/org/spongepowered/api/plugin/PluginManager.java b/src/main/java/org/spongepowered/api/plugin/PluginManager.java index cbc54ec1835..6c619ecad1e 100644 --- a/src/main/java/org/spongepowered/api/plugin/PluginManager.java +++ b/src/main/java/org/spongepowered/api/plugin/PluginManager.java @@ -43,6 +43,7 @@ public interface PluginManager { * @param instance The instance * @return The container */ + @Deprecated(forRemoval = true, since = "18") Optional fromInstance(Object instance); /** diff --git a/src/main/java/org/spongepowered/api/raid/Raid.java b/src/main/java/org/spongepowered/api/raid/Raid.java index 6e82aa196a4..db8a24104fe 100644 --- a/src/main/java/org/spongepowered/api/raid/Raid.java +++ b/src/main/java/org/spongepowered/api/raid/Raid.java @@ -29,20 +29,12 @@ import org.spongepowered.api.entity.living.Living; import org.spongepowered.api.entity.living.monster.raider.Raider; import org.spongepowered.api.world.difficulty.Difficulties; -import org.spongepowered.api.world.server.ServerWorld; import java.util.List; import java.util.Optional; public interface Raid { - /** - * Gets the {@link ServerWorld} this raid is taking place in. - * - * @return The world - */ - ServerWorld world(); - /** * Gets the {@link BossBar} being displayed to clients of this raid. * diff --git a/src/main/java/org/spongepowered/api/registry/DefaultedRegistryValue.java b/src/main/java/org/spongepowered/api/registry/DefaultedRegistryValue.java index 8ac7b5036ea..d7c9c5fac86 100644 --- a/src/main/java/org/spongepowered/api/registry/DefaultedRegistryValue.java +++ b/src/main/java/org/spongepowered/api/registry/DefaultedRegistryValue.java @@ -34,17 +34,17 @@ * within a {@link DefaultedRegistryType defaulted registry}. */ @SuppressWarnings("unchecked") -public interface DefaultedRegistryValue { +public interface DefaultedRegistryValue> { - default ResourceKey key(final DefaultedRegistryType type) { + default ResourceKey key(final DefaultedRegistryType type) { return Objects.requireNonNull(type, "type").get().valueKey((T) this); } - default Optional findKey(final DefaultedRegistryType type) { + default Optional findKey(final DefaultedRegistryType type) { return Objects.requireNonNull(type, "type").find().flatMap(r -> r.findValueKey((T) this)); } - default DefaultedRegistryReference asDefaultedReference(final DefaultedRegistryType type) { + default DefaultedRegistryReference asDefaultedReference(final DefaultedRegistryType type) { return RegistryKey.of(Objects.requireNonNull(type, "type"), this.key(type)).asDefaultedReference(type.defaultHolder()); } } diff --git a/src/main/java/org/spongepowered/api/registry/Registry.java b/src/main/java/org/spongepowered/api/registry/Registry.java index 47ed441b07b..63e5a1e4147 100644 --- a/src/main/java/org/spongepowered/api/registry/Registry.java +++ b/src/main/java/org/spongepowered/api/registry/Registry.java @@ -30,7 +30,6 @@ import java.util.Objects; import java.util.Optional; -import java.util.Set; import java.util.stream.Stream; /** @@ -128,7 +127,7 @@ default Optional findValue(final RegistryKey key) { * * @return The registered types associated with given tag */ - Set taggedValues(Tag tag); + Stream taggedValues(Tag tag); /** * Gets the tags associated with this registry. diff --git a/src/main/java/org/spongepowered/api/registry/RegistryHolder.java b/src/main/java/org/spongepowered/api/registry/RegistryHolder.java index 87b995c8305..3723734618c 100644 --- a/src/main/java/org/spongepowered/api/registry/RegistryHolder.java +++ b/src/main/java/org/spongepowered/api/registry/RegistryHolder.java @@ -57,6 +57,13 @@ public interface RegistryHolder { */ Optional> findRegistry(final RegistryType type); + /** + * Gets a {@link Stream} of the {@link Registry registries} in this holder. + * + * @return The stream + */ + Stream> streamRegistries(); + /** * Gets a {@link Stream} of the {@link Registry registries} in this holder within a root. * diff --git a/src/main/java/org/spongepowered/api/registry/RegistryKey.java b/src/main/java/org/spongepowered/api/registry/RegistryKey.java index f0a7a70ba12..a5718cc9a0f 100644 --- a/src/main/java/org/spongepowered/api/registry/RegistryKey.java +++ b/src/main/java/org/spongepowered/api/registry/RegistryKey.java @@ -73,6 +73,14 @@ static RegistryKey of(final RegistryType registry, final ResourceKey l */ DefaultedRegistryReference asDefaultedReference(final Supplier defaultHolder); + /** + * Generates a utility {@link DefaultedRegistryReference reference} used to assist in querying a value from this key. + * This uses the current Cause to determine the {@link RegistryHolder} + * + * @return The reference + */ + DefaultedRegistryReference asScopedReference(); + interface Factory { RegistryKey of(RegistryType registry, ResourceKey location); diff --git a/src/main/java/org/spongepowered/api/registry/RegistryRegistrationSet.java b/src/main/java/org/spongepowered/api/registry/RegistryRegistrationSet.java new file mode 100644 index 00000000000..337d9fa1c69 --- /dev/null +++ b/src/main/java/org/spongepowered/api/registry/RegistryRegistrationSet.java @@ -0,0 +1,57 @@ +/* + * 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.registry; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.Sponge; + +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; + +public interface RegistryRegistrationSet { + + RegistryType registryType(); + + Map> values(); + + static Builder builder(RegistryType registryType, Supplier defaultHolder) { + return Sponge.game().factoryProvider().provide(Factory.class).builder(registryType, defaultHolder); + } + + interface Builder extends org.spongepowered.api.util.Builder, Builder> { + + default DefaultedRegistryReference register(ResourceKey key, Supplier value) { + return this.register(key, (h) -> value.get()); + } + + DefaultedRegistryReference register(ResourceKey key, Function value); + } + + interface Factory { + + Builder builder(RegistryType registryType, Supplier defaultHolder); + } +} diff --git a/src/main/java/org/spongepowered/api/registry/RegistryType.java b/src/main/java/org/spongepowered/api/registry/RegistryType.java index cae4d402862..770d3e815b0 100644 --- a/src/main/java/org/spongepowered/api/registry/RegistryType.java +++ b/src/main/java/org/spongepowered/api/registry/RegistryType.java @@ -58,6 +58,8 @@ default RegistryReference referenced(final ResourceKey key) { */ DefaultedRegistryType asDefaultedType(Supplier defaultHolder); + DefaultedRegistryType asScopedType(); + interface Factory { RegistryType create(final ResourceKey root, ResourceKey location); diff --git a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java index 45ab49c05f7..3a9dc5f3a4d 100644 --- a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java +++ b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java @@ -24,9 +24,9 @@ */ package org.spongepowered.api.registry; -import org.checkerframework.checker.nullness.qual.NonNull; import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; +import org.spongepowered.api.advancement.Advancement; import org.spongepowered.api.advancement.AdvancementType; import org.spongepowered.api.advancement.criteria.trigger.Trigger; import org.spongepowered.api.adventure.ChatType; @@ -46,14 +46,19 @@ import org.spongepowered.api.data.type.ArmorMaterial; import org.spongepowered.api.data.type.ArtType; import org.spongepowered.api.data.type.AttachmentSurface; +import org.spongepowered.api.data.type.AxolotlVariant; import org.spongepowered.api.data.type.BambooLeavesType; import org.spongepowered.api.data.type.BannerPatternShape; import org.spongepowered.api.data.type.BellAttachmentType; -import org.spongepowered.api.data.type.BoatType; import org.spongepowered.api.data.type.BodyPart; import org.spongepowered.api.data.type.CatType; import org.spongepowered.api.data.type.ChestAttachmentType; +import org.spongepowered.api.data.type.ChickenVariant; import org.spongepowered.api.data.type.ComparatorMode; +import org.spongepowered.api.data.type.CopperGolemPose; +import org.spongepowered.api.data.type.CopperOxidation; +import org.spongepowered.api.data.type.CowVariant; +import org.spongepowered.api.data.type.CreakingHeartState; import org.spongepowered.api.data.type.DoorHinge; import org.spongepowered.api.data.type.DripstoneSegment; import org.spongepowered.api.data.type.DyeColor; @@ -64,6 +69,7 @@ import org.spongepowered.api.data.type.HorseColor; import org.spongepowered.api.data.type.HorseStyle; import org.spongepowered.api.data.type.InstrumentType; +import org.spongepowered.api.data.type.ItemActionType; import org.spongepowered.api.data.type.ItemTier; import org.spongepowered.api.data.type.JigsawBlockOrientation; import org.spongepowered.api.data.type.LlamaType; @@ -74,6 +80,7 @@ import org.spongepowered.api.data.type.ParrotType; import org.spongepowered.api.data.type.PhantomPhase; import org.spongepowered.api.data.type.PickupRule; +import org.spongepowered.api.data.type.PigType; import org.spongepowered.api.data.type.PistonType; import org.spongepowered.api.data.type.PortionType; import org.spongepowered.api.data.type.ProfessionType; @@ -81,12 +88,15 @@ import org.spongepowered.api.data.type.RabbitType; import org.spongepowered.api.data.type.RaidStatus; import org.spongepowered.api.data.type.RailDirection; +import org.spongepowered.api.data.type.SalmonSize; import org.spongepowered.api.data.type.SculkSensorState; +import org.spongepowered.api.data.type.SideChain; import org.spongepowered.api.data.type.SkinPart; import org.spongepowered.api.data.type.SlabPortion; import org.spongepowered.api.data.type.SpellType; import org.spongepowered.api.data.type.StairShape; import org.spongepowered.api.data.type.StructureMode; +import org.spongepowered.api.data.type.TestBlockMode; import org.spongepowered.api.data.type.Tilt; import org.spongepowered.api.data.type.TrialSpawnerState; import org.spongepowered.api.data.type.TropicalFishShape; @@ -94,13 +104,13 @@ import org.spongepowered.api.data.type.VillagerType; import org.spongepowered.api.data.type.WallConnectionState; import org.spongepowered.api.data.type.WireAttachmentType; +import org.spongepowered.api.data.type.WolfSoundVariant; import org.spongepowered.api.data.type.WolfVariant; import org.spongepowered.api.effect.particle.ParticleOption; import org.spongepowered.api.effect.particle.ParticleType; import org.spongepowered.api.effect.potion.PotionEffectType; import org.spongepowered.api.effect.sound.SoundType; import org.spongepowered.api.effect.sound.music.MusicDisc; -import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.EntityCategory; import org.spongepowered.api.entity.EntityType; import org.spongepowered.api.entity.ai.goal.GoalExecutorType; @@ -117,8 +127,8 @@ import org.spongepowered.api.event.cause.entity.MovementType; import org.spongepowered.api.event.cause.entity.SpawnType; import org.spongepowered.api.event.cause.entity.damage.DamageEffect; -import org.spongepowered.api.event.cause.entity.damage.DamageModifierType; import org.spongepowered.api.event.cause.entity.damage.DamageScaling; +import org.spongepowered.api.event.cause.entity.damage.DamageStepType; import org.spongepowered.api.event.cause.entity.damage.DamageType; import org.spongepowered.api.fluid.FluidType; import org.spongepowered.api.item.FireworkShape; @@ -126,6 +136,7 @@ import org.spongepowered.api.item.ItemType; import org.spongepowered.api.item.enchantment.EnchantmentType; import org.spongepowered.api.item.inventory.ContainerType; +import org.spongepowered.api.item.inventory.equipment.EquipmentCondition; import org.spongepowered.api.item.inventory.equipment.EquipmentGroup; import org.spongepowered.api.item.inventory.equipment.EquipmentType; import org.spongepowered.api.item.inventory.menu.ClickType; @@ -165,10 +176,10 @@ import org.spongepowered.api.world.biome.climate.TemperatureModifier; import org.spongepowered.api.world.chunk.ChunkState; import org.spongepowered.api.world.difficulty.Difficulty; +import org.spongepowered.api.world.explosion.ExplosionBlockInteraction; import org.spongepowered.api.world.gamerule.GameRule; import org.spongepowered.api.world.generation.carver.Carver; import org.spongepowered.api.world.generation.carver.CarverType; -import org.spongepowered.api.world.generation.carver.CarvingStep; import org.spongepowered.api.world.generation.config.flat.FlatGeneratorConfig; import org.spongepowered.api.world.generation.config.noise.DensityFunction; import org.spongepowered.api.world.generation.config.noise.Noise; @@ -186,6 +197,8 @@ import org.spongepowered.api.world.generation.structure.jigsaw.ProcessorList; import org.spongepowered.api.world.generation.structure.jigsaw.ProcessorType; import org.spongepowered.api.world.schematic.PaletteType; +import org.spongepowered.api.world.server.TicketType; +import org.spongepowered.api.world.server.WorldArchetypeType; import org.spongepowered.api.world.teleport.TeleportHelperFilter; import org.spongepowered.api.world.weather.WeatherType; @@ -198,12 +211,16 @@ public final class RegistryTypes { // @formatter:off + public static final DefaultedRegistryType ADVANCEMENT = RegistryTypes.spongeKeyInServer("advancement"); + public static final DefaultedRegistryType ART_TYPE = RegistryTypes.minecraftKeyInServer("painting_variant"); - public static final DefaultedRegistryType ARMOR_MATERIAL = RegistryTypes.minecraftKeyInGame("armor_material"); + public static final DefaultedRegistryType ARMOR_MATERIAL = RegistryTypes.spongeKeyInGame("armor_material"); public static final DefaultedRegistryType ATTRIBUTE_TYPE = RegistryTypes.minecraftKeyInGame("attribute"); + public static final DefaultedRegistryType AXOLOTL_VARIANT = RegistryTypes.spongeKeyInGame("axolotl_variant"); + public static final DefaultedRegistryType BIOME = RegistryTypes.minecraftKeyInServer("worldgen/biome"); public static final DefaultedRegistryType BLOCK_TYPE = RegistryTypes.minecraftKeyInGame("block"); @@ -218,6 +235,8 @@ public final class RegistryTypes { public static final DefaultedRegistryType CHUNK_STATE = RegistryTypes.minecraftKeyInGame("chunk_status"); + public static final DefaultedRegistryType ITEM_ACTION_TYPE = RegistryTypes.minecraftKeyInGame("consume_effect_type"); + public static final DefaultedRegistryType CONTAINER_TYPE = RegistryTypes.minecraftKeyInGame("menu"); public static final DefaultedRegistryType DENSITY_FUNCTION = RegistryTypes.minecraftKeyInServer("worldgen/density_function"); @@ -226,7 +245,7 @@ public final class RegistryTypes { public static final DefaultedRegistryType ENTITY_CATEGORY = RegistryTypes.spongeKeyInGame("mob_category"); - public static final DefaultedRegistryType> ENTITY_TYPE = RegistryTypes.minecraftKeyInGame("entity_type"); + public static final DefaultedRegistryType> ENTITY_TYPE = RegistryTypes.minecraftKeyInGame("entity_type"); public static final DefaultedRegistryType FEATURE = RegistryTypes.minecraftKeyInServer("worldgen/configured_feature"); @@ -262,7 +281,7 @@ public final class RegistryTypes { public static final DefaultedRegistryType POTION_TYPE = RegistryTypes.minecraftKeyInGame("potion"); - public static final DefaultedRegistryType>> RECIPE_TYPE = RegistryTypes.minecraftKeyInGame("recipe_type"); + public static final DefaultedRegistryType> RECIPE_TYPE = RegistryTypes.minecraftKeyInGame("recipe_type"); public static final DefaultedRegistryType SOUND_TYPE = RegistryTypes.minecraftKeyInGame("sound_event"); @@ -276,7 +295,9 @@ public final class RegistryTypes { public static final DefaultedRegistryType STRUCTURE_TYPE = RegistryTypes.minecraftKeyInGame("worldgen/structure_type"); - public static final DefaultedRegistryType> TRIGGER = RegistryTypes.minecraftKeyInGame("trigger_type"); + public static final DefaultedRegistryType TICKET_TYPE = RegistryTypes.minecraftKeyInGame("ticket_type"); + + public static final DefaultedRegistryType> TRIGGER = RegistryTypes.minecraftKeyInGame("trigger_type"); public static final DefaultedRegistryType TRIM_MATERIAL = RegistryTypes.minecraftKeyInServer("trim_material"); @@ -307,18 +328,16 @@ public final class RegistryTypes { public static final DefaultedRegistryType BILLBOARD_TYPE = RegistryTypes.spongeKeyInGame("billboard_type"); - public static final DefaultedRegistryType BOAT_TYPE = RegistryTypes.spongeKeyInGame("boat_type"); - public static final DefaultedRegistryType BODY_PART = RegistryTypes.spongeKeyInGame("body_part"); public static final DefaultedRegistryType CAT_TYPE = RegistryTypes.minecraftKeyInGame("cat_variant"); - public static final DefaultedRegistryType CARVING_STEP = RegistryTypes.spongeKeyInGame("carving_step"); - public static final DefaultedRegistryType CHAT_VISIBILITY = RegistryTypes.spongeKeyInGame("chat_visibility"); public static final DefaultedRegistryType CHEST_ATTACHMENT_TYPE = RegistryTypes.spongeKeyInGame("chest_attachment_type"); + public static final DefaultedRegistryType CHICKEN_VARIANT = RegistryTypes.minecraftKeyInGame("chicken_variant"); + public static final DefaultedRegistryType CHUNK_REGENERATE_FLAG = RegistryTypes.spongeKeyInGame("chunk_regenerate_flag"); public static final DefaultedRegistryType> CLICK_TYPE = RegistryTypes.spongeKeyInGame("click_type"); @@ -331,18 +350,28 @@ public final class RegistryTypes { public static final DefaultedRegistryType> COMMAND_REGISTRAR_TYPE = RegistryTypes.spongeKeyInGame("command_registrar_type"); - public static final DefaultedRegistryType> COMMAND_TREE_NODE_TYPE = RegistryTypes.spongeKeyInGame("command_tree_node_type"); + public static final DefaultedRegistryType> COMMAND_TREE_NODE_TYPE = RegistryTypes.spongeKeyInServer("command_tree_node_type"); public static final DefaultedRegistryType COMPARATOR_MODE = RegistryTypes.spongeKeyInGame("comparator_mode"); + public static final DefaultedRegistryType COPPER_GOLEM_POSE = RegistryTypes.spongeKeyInGame("copper_golem_pose"); + + public static final DefaultedRegistryType COPPER_OXIDATION = RegistryTypes.spongeKeyInGame("copper_oxidation"); + + public static final DefaultedRegistryType COW_VARIANT = RegistryTypes.minecraftKeyInServer("cow_variant"); + + public static final DefaultedRegistryType CREAKING_HEART_STATES = RegistryTypes.spongeKeyInGame("creaking_heart_state"); + public static final DefaultedRegistryType CRITERION = RegistryTypes.spongeKeyInGame("criterion"); public static final DefaultedRegistryType CURRENCY = RegistryTypes.spongeKeyInGame("currency"); - public static final DefaultedRegistryType DAMAGE_MODIFIER_TYPE = RegistryTypes.spongeKeyInGame("damage_modifier_type"); + public static final DefaultedRegistryType DAMAGE_STEP_TYPE = RegistryTypes.spongeKeyInGame("damage_step_type"); public static final DefaultedRegistryType DAMAGE_TYPE = RegistryTypes.minecraftKeyInServer("damage_type"); + public static final DefaultedRegistryType DAMAGE_SCALING = RegistryTypes.spongeKeyInGame("damage_scaling"); + public static final DefaultedRegistryType DAMAGE_EFFECT = RegistryTypes.spongeKeyInGame("damage_effect"); public static final DefaultedRegistryType DATA_FORMAT = RegistryTypes.spongeKeyInGame("data_format"); @@ -363,13 +392,17 @@ public final class RegistryTypes { public static final DefaultedRegistryType DYE_COLOR = RegistryTypes.spongeKeyInGame("dye_color"); + public static final DefaultedRegistryType EQUIPMENT_CONDITION = RegistryTypes.spongeKeyInGame("equipment_condition"); + public static final DefaultedRegistryType EQUIPMENT_GROUP = RegistryTypes.spongeKeyInGame("equipment_group"); public static final DefaultedRegistryType EQUIPMENT_TYPE = RegistryTypes.spongeKeyInGame("equipment_type"); + public static final DefaultedRegistryType EXPLOSION_BLOCK_INTERACTION = RegistryTypes.spongeKeyInGame("explosion_block_interaction"); + public static final DefaultedRegistryType FIREWORK_SHAPE = RegistryTypes.spongeKeyInGame("firework_shape"); - public static final DefaultedRegistryType FLAT_GENERATOR_CONFIG = RegistryTypes.spongeKeyInGame("flat_generator_config"); + public static final DefaultedRegistryType FLAT_GENERATOR_CONFIG = RegistryTypes.spongeKeyInServer("flat_generator_config"); public static final DefaultedRegistryType FOX_TYPE = RegistryTypes.spongeKeyInGame("fox_type"); @@ -377,7 +410,7 @@ public final class RegistryTypes { public static final DefaultedRegistryType GAME_MODE = RegistryTypes.spongeKeyInGame("game_mode"); - public static final DefaultedRegistryType> GAME_RULE = RegistryTypes.spongeKeyInGame("game_rule"); + public static final DefaultedRegistryType> GAME_RULE = RegistryTypes.minecraftKeyInGame("game_rule"); public static final DefaultedRegistryType GOAL_EXECUTOR_TYPE = RegistryTypes.spongeKeyInGame("goal_executor_type"); @@ -449,6 +482,8 @@ public final class RegistryTypes { public static final DefaultedRegistryType PICKUP_RULE = RegistryTypes.spongeKeyInGame("pickup_rule"); + public static final DefaultedRegistryType PIG_TYPE = RegistryTypes.minecraftKeyInGame("pig_variant"); + public static final DefaultedRegistryType PISTON_TYPE = RegistryTypes.spongeKeyInGame("piston_type"); public static final DefaultedRegistryType PLACEHOLDER_PARSER = RegistryTypes.spongeKeyInGame("placeholder_parser"); @@ -465,6 +500,8 @@ public final class RegistryTypes { public static final DefaultedRegistryType RAIL_DIRECTION = RegistryTypes.spongeKeyInGame("rail_direction"); + public static final DefaultedRegistryType> RECIPE = RegistryTypes.spongeKeyInServer("recipe"); + public static final DefaultedRegistryType> REGISTRY_KEYED_VALUE_PARAMETER = RegistryTypes.spongeKeyInGame("value_parameter"); public static final DefaultedRegistryType RESOLVE_OPERATION = RegistryTypes.spongeKeyInGame("resolve_operation"); @@ -473,8 +510,12 @@ public final class RegistryTypes { public static final DefaultedRegistryType ROTATION = RegistryTypes.spongeKeyInGame("rotation"); + public static final DefaultedRegistryType SALMON_SIZE = RegistryTypes.spongeKeyInGame("salmon_size"); + public static final DefaultedRegistryType SCULK_SENSOR_STATE = RegistryTypes.spongeKeyInGame("sculk_sensor_state"); + public static final DefaultedRegistryType SIDE_CHAIN = RegistryTypes.spongeKeyInGame("side_chain"); + public static final DefaultedRegistryType SELECTOR_SORT_ALGORITHM = RegistryTypes.spongeKeyInGame("selector_sort_algorithm"); public static final DefaultedRegistryType SELECTOR_TYPE = RegistryTypes.spongeKeyInGame("selector_type"); @@ -495,6 +536,8 @@ public final class RegistryTypes { public static final DefaultedRegistryType TELEPORT_HELPER_FILTER = RegistryTypes.spongeKeyInGame("teleport_helper_filter"); + public static final DefaultedRegistryType TEST_BLOCK_MODE = RegistryTypes.spongeKeyInGame("test_block_mode"); + public static final DefaultedRegistryType TEXT_ALIGNMENT = RegistryTypes.spongeKeyInGame("text_alignment"); public static final DefaultedRegistryType TRANSACTION_TYPE = RegistryTypes.spongeKeyInGame("transaction_type"); @@ -505,7 +548,7 @@ public final class RegistryTypes { public static final DefaultedRegistryType TILT = RegistryTypes.spongeKeyInGame("tilt"); - public static final RegistryType VAULT_STATE = RegistryTypes.spongeKeyInGame("vault_state"); + public static final DefaultedRegistryType VAULT_STATE = RegistryTypes.spongeKeyInGame("vault_state"); public static final DefaultedRegistryType VISIBILITY = RegistryTypes.spongeKeyInGame("visibility"); @@ -513,7 +556,11 @@ public final class RegistryTypes { public static final DefaultedRegistryType WEATHER_TYPE = RegistryTypes.spongeKeyInGame("weather_type"); - public static final DefaultedRegistryType WOLF_VAIRANT = RegistryTypes.minecraftKeyInServer("wolf_vairant"); + public static final DefaultedRegistryType WOLF_VARIANT = RegistryTypes.minecraftKeyInServer("wolf_variant"); + + public static final DefaultedRegistryType WOLF_SOUND_VARIANT = RegistryTypes.spongeKeyInGame("wolf_sound_variant"); + + public static final DefaultedRegistryType WORLD_ARCHETYPE_TYPE = RegistryTypes.minecraftKeyInServer("dimension"); public static final DefaultedRegistryType WIRE_ATTACHMENT_TYPE = RegistryTypes.spongeKeyInGame("wire_attachment_type"); @@ -524,10 +571,14 @@ private static DefaultedRegistryType minecraftKeyInGame(final String key) } private static DefaultedRegistryType minecraftKeyInServer(final String key) { - return RegistryType.of(RegistryRoots.MINECRAFT, ResourceKey.minecraft(Objects.requireNonNull(key, "key"))).asDefaultedType(Sponge::server); + return RegistryType.of(RegistryRoots.MINECRAFT, ResourceKey.minecraft(Objects.requireNonNull(key, "key"))).asScopedType(); } private static DefaultedRegistryType spongeKeyInGame(final String key) { return RegistryType.of(RegistryRoots.SPONGE, ResourceKey.sponge(Objects.requireNonNull(key, "key"))).asDefaultedType(Sponge::game); } + + private static DefaultedRegistryType spongeKeyInServer(final String key) { + return RegistryType.of(RegistryRoots.SPONGE, ResourceKey.sponge(Objects.requireNonNull(key, "key"))).asScopedType(); + } } diff --git a/src/main/java/org/spongepowered/api/scheduler/TaskPriority.java b/src/main/java/org/spongepowered/api/scheduler/TaskPriority.java index 5fcb72fdbf7..8a1c1f6431c 100644 --- a/src/main/java/org/spongepowered/api/scheduler/TaskPriority.java +++ b/src/main/java/org/spongepowered/api/scheduler/TaskPriority.java @@ -28,6 +28,6 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(TaskPriorities.class) -public interface TaskPriority extends DefaultedRegistryValue { +public interface TaskPriority extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/scoreboard/CollisionRule.java b/src/main/java/org/spongepowered/api/scoreboard/CollisionRule.java index c61cc55d741..2c156a0e18b 100644 --- a/src/main/java/org/spongepowered/api/scoreboard/CollisionRule.java +++ b/src/main/java/org/spongepowered/api/scoreboard/CollisionRule.java @@ -35,6 +35,6 @@ * a {@link Team} collide with other entities.

    */ @CatalogedBy(CollisionRules.class) -public interface CollisionRule extends DefaultedRegistryValue, ComponentLike { +public interface CollisionRule extends DefaultedRegistryValue, ComponentLike { } diff --git a/src/main/java/org/spongepowered/api/scoreboard/Visibility.java b/src/main/java/org/spongepowered/api/scoreboard/Visibility.java index ed27d3eb11e..ff4c952d57e 100644 --- a/src/main/java/org/spongepowered/api/scoreboard/Visibility.java +++ b/src/main/java/org/spongepowered/api/scoreboard/Visibility.java @@ -34,6 +34,6 @@ *

    Usages include nametags and death messages.

    */ @CatalogedBy(Visibilities.class) -public interface Visibility extends DefaultedRegistryValue, ComponentLike { +public interface Visibility extends DefaultedRegistryValue, ComponentLike { } diff --git a/src/main/java/org/spongepowered/api/scoreboard/criteria/Criterion.java b/src/main/java/org/spongepowered/api/scoreboard/criteria/Criterion.java index 1ddf95c1647..d44a80ac383 100644 --- a/src/main/java/org/spongepowered/api/scoreboard/criteria/Criterion.java +++ b/src/main/java/org/spongepowered/api/scoreboard/criteria/Criterion.java @@ -33,7 +33,7 @@ * automatically updated. */ @CatalogedBy(Criteria.class) -public interface Criterion extends DefaultedRegistryValue { +public interface Criterion extends DefaultedRegistryValue { ObjectiveDisplayMode displayMode(); } diff --git a/src/main/java/org/spongepowered/api/scoreboard/displayslot/DisplaySlot.java b/src/main/java/org/spongepowered/api/scoreboard/displayslot/DisplaySlot.java index 9ba8b304db7..eb366787985 100644 --- a/src/main/java/org/spongepowered/api/scoreboard/displayslot/DisplaySlot.java +++ b/src/main/java/org/spongepowered/api/scoreboard/displayslot/DisplaySlot.java @@ -26,6 +26,7 @@ import net.kyori.adventure.text.format.NamedTextColor; import org.spongepowered.api.Sponge; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.scoreboard.Team; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -36,7 +37,7 @@ * Represents an area to display an objective. */ @CatalogedBy(DisplaySlots.class) -public interface DisplaySlot extends DefaultedRegistryValue { +public interface DisplaySlot extends DefaultedRegistryValue, StringRepresentable { /** * Finds and retrieves the sidebar display slot for the specified diff --git a/src/main/java/org/spongepowered/api/scoreboard/objective/displaymode/ObjectiveDisplayMode.java b/src/main/java/org/spongepowered/api/scoreboard/objective/displaymode/ObjectiveDisplayMode.java index 14a757c3ef6..a19ed4d96be 100644 --- a/src/main/java/org/spongepowered/api/scoreboard/objective/displaymode/ObjectiveDisplayMode.java +++ b/src/main/java/org/spongepowered/api/scoreboard/objective/displaymode/ObjectiveDisplayMode.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.scoreboard.objective.displaymode; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.scoreboard.objective.Objective; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -32,6 +33,6 @@ * Represents the mode in which to display scores for an {@link Objective}. */ @CatalogedBy(ObjectiveDisplayModes.class) -public interface ObjectiveDisplayMode extends DefaultedRegistryValue { +public interface ObjectiveDisplayMode extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/service/ban/BanType.java b/src/main/java/org/spongepowered/api/service/ban/BanType.java index 09895361312..cce561b99de 100644 --- a/src/main/java/org/spongepowered/api/service/ban/BanType.java +++ b/src/main/java/org/spongepowered/api/service/ban/BanType.java @@ -31,7 +31,7 @@ * Represents the possible types of bans. */ @CatalogedBy(BanTypes.class) -public interface BanType extends DefaultedRegistryValue { +public interface BanType extends DefaultedRegistryValue { /** * Gets the {@link Ban} class that this type represents. diff --git a/src/main/java/org/spongepowered/api/service/economy/Currency.java b/src/main/java/org/spongepowered/api/service/economy/Currency.java index 4b8c6f4b611..4eae4ce184f 100644 --- a/src/main/java/org/spongepowered/api/service/economy/Currency.java +++ b/src/main/java/org/spongepowered/api/service/economy/Currency.java @@ -40,7 +40,7 @@ * *

    Depending on the provider of the {@link EconomyService}, more currencies may be available.

    */ -public interface Currency extends DefaultedRegistryValue { +public interface Currency extends DefaultedRegistryValue { /** * The currency's display name, in singular form. Ex: Dollar. diff --git a/src/main/java/org/spongepowered/api/service/economy/account/AccountDeletionResultType.java b/src/main/java/org/spongepowered/api/service/economy/account/AccountDeletionResultType.java index 38007fc4335..c3095ad28b7 100644 --- a/src/main/java/org/spongepowered/api/service/economy/account/AccountDeletionResultType.java +++ b/src/main/java/org/spongepowered/api/service/economy/account/AccountDeletionResultType.java @@ -31,7 +31,7 @@ * Indicates whether the deletion of an {@link Account} succeeded. */ @CatalogedBy(AccountDeletionResultTypes.class) -public interface AccountDeletionResultType extends DefaultedRegistryValue { +public interface AccountDeletionResultType extends DefaultedRegistryValue { /** * Returns whether this result type represents a successful deletion. diff --git a/src/main/java/org/spongepowered/api/service/economy/transaction/TransactionType.java b/src/main/java/org/spongepowered/api/service/economy/transaction/TransactionType.java index 542e0e8949c..9e84fa1f26b 100644 --- a/src/main/java/org/spongepowered/api/service/economy/transaction/TransactionType.java +++ b/src/main/java/org/spongepowered/api/service/economy/transaction/TransactionType.java @@ -31,6 +31,6 @@ * Represents the type of a transaction. */ @CatalogedBy(TransactionTypes.class) -public interface TransactionType extends DefaultedRegistryValue { +public interface TransactionType extends DefaultedRegistryValue { } diff --git a/src/main/java/org/spongepowered/api/service/permission/PermissionService.java b/src/main/java/org/spongepowered/api/service/permission/PermissionService.java index d4aa92d2e14..b7b9f1fc924 100644 --- a/src/main/java/org/spongepowered/api/service/permission/PermissionService.java +++ b/src/main/java/org/spongepowered/api/service/permission/PermissionService.java @@ -102,6 +102,12 @@ public interface PermissionService { */ String SUBJECTS_COMMAND_BLOCK = "commandblock"; + /** + * The standard identifier for the collection which stores function + * subjects. + */ + String SUBJECTS_FUNCTION = "function"; + /** * The standard identifier for the collection which stores role templates. * diff --git a/src/main/java/org/spongepowered/api/state/BooleanStateProperties.java b/src/main/java/org/spongepowered/api/state/BooleanStateProperties.java index 266edcd50fc..acd3d6bf50a 100644 --- a/src/main/java/org/spongepowered/api/state/BooleanStateProperties.java +++ b/src/main/java/org/spongepowered/api/state/BooleanStateProperties.java @@ -53,30 +53,6 @@ public static BooleanStateProperty property_CAN_SUMMON() { return BooleanStateProperty.of("CAN_SUMMON"); } - public static BooleanStateProperty property_CHISELED_BOOKSHELF_SLOT_0_OCCUPIED() { - return BooleanStateProperty.of("CHISELED_BOOKSHELF_SLOT_0_OCCUPIED"); - } - - public static BooleanStateProperty property_CHISELED_BOOKSHELF_SLOT_1_OCCUPIED() { - return BooleanStateProperty.of("CHISELED_BOOKSHELF_SLOT_1_OCCUPIED"); - } - - public static BooleanStateProperty property_CHISELED_BOOKSHELF_SLOT_2_OCCUPIED() { - return BooleanStateProperty.of("CHISELED_BOOKSHELF_SLOT_2_OCCUPIED"); - } - - public static BooleanStateProperty property_CHISELED_BOOKSHELF_SLOT_3_OCCUPIED() { - return BooleanStateProperty.of("CHISELED_BOOKSHELF_SLOT_3_OCCUPIED"); - } - - public static BooleanStateProperty property_CHISELED_BOOKSHELF_SLOT_4_OCCUPIED() { - return BooleanStateProperty.of("CHISELED_BOOKSHELF_SLOT_4_OCCUPIED"); - } - - public static BooleanStateProperty property_CHISELED_BOOKSHELF_SLOT_5_OCCUPIED() { - return BooleanStateProperty.of("CHISELED_BOOKSHELF_SLOT_5_OCCUPIED"); - } - public static BooleanStateProperty property_CONDITIONAL() { return BooleanStateProperty.of("CONDITIONAL"); } @@ -157,6 +133,10 @@ public static BooleanStateProperty property_LOCKED() { return BooleanStateProperty.of("LOCKED"); } + public static BooleanStateProperty property_NATURAL() { + return BooleanStateProperty.of("NATURAL"); + } + public static BooleanStateProperty property_NORTH() { return BooleanStateProperty.of("NORTH"); } @@ -193,6 +173,30 @@ public static BooleanStateProperty property_SIGNAL_FIRE() { return BooleanStateProperty.of("SIGNAL_FIRE"); } + public static BooleanStateProperty property_SLOT_0_OCCUPIED() { + return BooleanStateProperty.of("SLOT_0_OCCUPIED"); + } + + public static BooleanStateProperty property_SLOT_1_OCCUPIED() { + return BooleanStateProperty.of("SLOT_1_OCCUPIED"); + } + + public static BooleanStateProperty property_SLOT_2_OCCUPIED() { + return BooleanStateProperty.of("SLOT_2_OCCUPIED"); + } + + public static BooleanStateProperty property_SLOT_3_OCCUPIED() { + return BooleanStateProperty.of("SLOT_3_OCCUPIED"); + } + + public static BooleanStateProperty property_SLOT_4_OCCUPIED() { + return BooleanStateProperty.of("SLOT_4_OCCUPIED"); + } + + public static BooleanStateProperty property_SLOT_5_OCCUPIED() { + return BooleanStateProperty.of("SLOT_5_OCCUPIED"); + } + public static BooleanStateProperty property_SNOWY() { return BooleanStateProperty.of("SNOWY"); } @@ -201,6 +205,10 @@ public static BooleanStateProperty property_SOUTH() { return BooleanStateProperty.of("SOUTH"); } + public static BooleanStateProperty property_TIP() { + return BooleanStateProperty.of("TIP"); + } + public static BooleanStateProperty property_TRIGGERED() { return BooleanStateProperty.of("TRIGGERED"); } diff --git a/src/main/java/org/spongepowered/api/state/EnumStateProperties.java b/src/main/java/org/spongepowered/api/state/EnumStateProperties.java index 8cdaa8c716e..43ee145ad3e 100644 --- a/src/main/java/org/spongepowered/api/state/EnumStateProperties.java +++ b/src/main/java/org/spongepowered/api/state/EnumStateProperties.java @@ -29,6 +29,8 @@ import org.spongepowered.api.data.type.BellAttachmentType; import org.spongepowered.api.data.type.ChestAttachmentType; import org.spongepowered.api.data.type.ComparatorMode; +import org.spongepowered.api.data.type.CopperGolemPose; +import org.spongepowered.api.data.type.CreakingHeartState; import org.spongepowered.api.data.type.DoorHinge; import org.spongepowered.api.data.type.DripstoneSegment; import org.spongepowered.api.data.type.InstrumentType; @@ -37,9 +39,11 @@ import org.spongepowered.api.data.type.PortionType; import org.spongepowered.api.data.type.RailDirection; import org.spongepowered.api.data.type.SculkSensorState; +import org.spongepowered.api.data.type.SideChain; import org.spongepowered.api.data.type.SlabPortion; import org.spongepowered.api.data.type.StairShape; import org.spongepowered.api.data.type.StructureMode; +import org.spongepowered.api.data.type.TestBlockMode; import org.spongepowered.api.data.type.Tilt; import org.spongepowered.api.data.type.TrialSpawnerState; import org.spongepowered.api.data.type.VaultState; @@ -81,6 +85,14 @@ public static EnumStateProperty property_CHEST_TYPE() { return EnumStateProperty.of("CHEST_TYPE"); } + public static EnumStateProperty property_COPPER_GOLEM_POSE() { + return EnumStateProperty.of("COPPER_GOLEM_POSE"); + } + + public static EnumStateProperty property_CREAKING_HEART_STATE() { + return EnumStateProperty.of("CREAKING_HEART_STATE"); + } + public static EnumStateProperty property_DOOR_HINGE() { return EnumStateProperty.of("DOOR_HINGE"); } @@ -157,6 +169,10 @@ public static EnumStateProperty property_SCULK_SENSOR_PHASE() return EnumStateProperty.of("SCULK_SENSOR_PHASE"); } + public static EnumStateProperty property_SIDE_CHAIN_PART() { + return EnumStateProperty.of("SIDE_CHAIN_PART"); + } + public static EnumStateProperty property_SLAB_TYPE() { return EnumStateProperty.of("SLAB_TYPE"); } @@ -177,6 +193,10 @@ public static EnumStateProperty property_STRUCTUREBLOCK_MODE() { return EnumStateProperty.of("STRUCTUREBLOCK_MODE"); } + public static EnumStateProperty property_TEST_BLOCK_MODE() { + return EnumStateProperty.of("TEST_BLOCK_MODE"); + } + public static EnumStateProperty property_TILT() { return EnumStateProperty.of("TILT"); } diff --git a/src/main/java/org/spongepowered/api/state/IntegerStateProperties.java b/src/main/java/org/spongepowered/api/state/IntegerStateProperties.java index 850a11ff5b5..4ecc6fc9d31 100644 --- a/src/main/java/org/spongepowered/api/state/IntegerStateProperties.java +++ b/src/main/java/org/spongepowered/api/state/IntegerStateProperties.java @@ -81,6 +81,10 @@ public static IntegerStateProperty property_DISTANCE() { return IntegerStateProperty.of("DISTANCE"); } + public static IntegerStateProperty property_DRIED_GHAST_HYDRATION_LEVELS() { + return IntegerStateProperty.of("DRIED_GHAST_HYDRATION_LEVELS"); + } + public static IntegerStateProperty property_DUSTED() { return IntegerStateProperty.of("DUSTED"); } @@ -141,6 +145,10 @@ public static IntegerStateProperty property_ROTATION_16() { return IntegerStateProperty.of("ROTATION_16"); } + public static IntegerStateProperty property_SEGMENT_AMOUNT() { + return IntegerStateProperty.of("SEGMENT_AMOUNT"); + } + public static IntegerStateProperty property_STABILITY_DISTANCE() { return IntegerStateProperty.of("STABILITY_DISTANCE"); } diff --git a/src/main/java/org/spongepowered/api/statistic/Statistic.java b/src/main/java/org/spongepowered/api/statistic/Statistic.java index b52c416f801..852e1eecd61 100644 --- a/src/main/java/org/spongepowered/api/statistic/Statistic.java +++ b/src/main/java/org/spongepowered/api/statistic/Statistic.java @@ -24,6 +24,7 @@ */ package org.spongepowered.api.statistic; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.scoreboard.criteria.Criterion; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -34,7 +35,7 @@ * Represents some statistic in minecraft. */ @CatalogedBy(Statistics.class) -public interface Statistic { +public interface Statistic extends DefaultedRegistryValue { /** * Returns the objective {@link Criterion} for this statistic. diff --git a/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java b/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java index 417704dd9f7..2b338f823cd 100644 --- a/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java +++ b/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java @@ -50,8 +50,10 @@ public final class StatisticCategories { public static final DefaultedRegistryReference> DROPPED = StatisticCategories.typedKey(ResourceKey.minecraft("dropped")); + @SuppressWarnings("rawtypes") public static final DefaultedRegistryReference> KILLED = StatisticCategories.typedKey(ResourceKey.minecraft("killed")); + @SuppressWarnings("rawtypes") public static final DefaultedRegistryReference> KILLED_BY = StatisticCategories.typedKey(ResourceKey.minecraft("killed_by")); public static final DefaultedRegistryReference> MINED = StatisticCategories.typedKey(ResourceKey.minecraft("mined")); diff --git a/src/main/java/org/spongepowered/api/statistic/StatisticCategory.java b/src/main/java/org/spongepowered/api/statistic/StatisticCategory.java index 5611afcd8a8..99fb9d90759 100644 --- a/src/main/java/org/spongepowered/api/statistic/StatisticCategory.java +++ b/src/main/java/org/spongepowered/api/statistic/StatisticCategory.java @@ -25,12 +25,13 @@ package org.spongepowered.api.statistic; import io.leangen.geantyref.TypeToken; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; import java.util.Collection; @CatalogedBy(StatisticCategories.class) -public interface StatisticCategory { +public interface StatisticCategory extends DefaultedRegistryValue { /** * Gets all the {@link Statistic}s that are listed diff --git a/src/main/java/org/spongepowered/api/statistic/Statistics.java b/src/main/java/org/spongepowered/api/statistic/Statistics.java index 228d0426ab5..f42995170a2 100644 --- a/src/main/java/org/spongepowered/api/statistic/Statistics.java +++ b/src/main/java/org/spongepowered/api/statistic/Statistics.java @@ -88,6 +88,8 @@ public final class Statistics { public static final DefaultedRegistryReference FLY_ONE_CM = Statistics.key(ResourceKey.minecraft("fly_one_cm")); + public static final DefaultedRegistryReference HAPPY_GHAST_ONE_CM = Statistics.key(ResourceKey.minecraft("happy_ghast_one_cm")); + public static final DefaultedRegistryReference HORSE_ONE_CM = Statistics.key(ResourceKey.minecraft("horse_one_cm")); public static final DefaultedRegistryReference INSPECT_DISPENSER = Statistics.key(ResourceKey.minecraft("inspect_dispenser")); @@ -132,6 +134,8 @@ public final class Statistics { public static final DefaultedRegistryReference MOB_KILLS = Statistics.key(ResourceKey.minecraft("mob_kills")); + public static final DefaultedRegistryReference NAUTILUS_ONE_CM = Statistics.key(ResourceKey.minecraft("nautilus_one_cm")); + public static final DefaultedRegistryReference OPEN_BARREL = Statistics.key(ResourceKey.minecraft("open_barrel")); public static final DefaultedRegistryReference OPEN_CHEST = Statistics.key(ResourceKey.minecraft("open_chest")); diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunctionTemplate.java b/src/main/java/org/spongepowered/api/tag/ArtTypeTags.java similarity index 62% rename from src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunctionTemplate.java rename to src/main/java/org/spongepowered/api/tag/ArtTypeTags.java index e5f434e3c91..790787baa1f 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunctionTemplate.java +++ b/src/main/java/org/spongepowered/api/tag/ArtTypeTags.java @@ -22,32 +22,27 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.world.generation.config.noise; +package org.spongepowered.api.tag; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.data.type.ArtType; +import org.spongepowered.api.registry.RegistryScope; +import org.spongepowered.api.registry.RegistryScopes; +import org.spongepowered.api.registry.RegistryTypes; /** - * A template for {@link DensityFunction density functions} + * */ -public interface DensityFunctionTemplate extends DataPackEntry { +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.GAME) +public final class ArtTypeTags { - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the density function - * - * @return The density function - */ - DensityFunction densityFunction(); - - interface Builder extends DataPackEntryBuilder { - - // TODO advanced + public static final DefaultedTag PLACEABLE = ArtTypeTags.key(ResourceKey.minecraft("placeable")); + private ArtTypeTags() { } + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.ART_TYPE, key); + } } diff --git a/src/main/java/org/spongepowered/api/tag/BannerPatternShapeTags.java b/src/main/java/org/spongepowered/api/tag/BannerPatternShapeTags.java new file mode 100644 index 00000000000..e4510896d5f --- /dev/null +++ b/src/main/java/org/spongepowered/api/tag/BannerPatternShapeTags.java @@ -0,0 +1,68 @@ +/* + * 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.tag; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.data.type.BannerPatternShape; +import org.spongepowered.api.registry.RegistryScope; +import org.spongepowered.api.registry.RegistryScopes; +import org.spongepowered.api.registry.RegistryTypes; + +/** + * + */ +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.GAME) +public final class BannerPatternShapeTags { + + public static final DefaultedTag NO_ITEM_REQUIRED = BannerPatternShapeTags.key(ResourceKey.minecraft("no_item_required")); + + public static final DefaultedTag PATTERN_ITEM_BORDURE_INDENTED = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/bordure_indented")); + + public static final DefaultedTag PATTERN_ITEM_CREEPER = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/creeper")); + + public static final DefaultedTag PATTERN_ITEM_FIELD_MASONED = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/field_masoned")); + + public static final DefaultedTag PATTERN_ITEM_FLOW = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/flow")); + + public static final DefaultedTag PATTERN_ITEM_FLOWER = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/flower")); + + public static final DefaultedTag PATTERN_ITEM_GLOBE = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/globe")); + + public static final DefaultedTag PATTERN_ITEM_GUSTER = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/guster")); + + public static final DefaultedTag PATTERN_ITEM_MOJANG = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/mojang")); + + public static final DefaultedTag PATTERN_ITEM_PIGLIN = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/piglin")); + + public static final DefaultedTag PATTERN_ITEM_SKULL = BannerPatternShapeTags.key(ResourceKey.minecraft("pattern_item/skull")); + + private BannerPatternShapeTags() { + } + + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.BANNER_PATTERN_SHAPE, key); + } +} diff --git a/src/main/java/org/spongepowered/api/tag/BiomeTags.java b/src/main/java/org/spongepowered/api/tag/BiomeTags.java index c7d7e68f007..1f0a833ba9b 100644 --- a/src/main/java/org/spongepowered/api/tag/BiomeTags.java +++ b/src/main/java/org/spongepowered/api/tag/BiomeTags.java @@ -37,150 +37,146 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class BiomeTags { - public static final Tag ALLOWS_SURFACE_SLIME_SPAWNS = BiomeTags.key(ResourceKey.minecraft("allows_surface_slime_spawns")); + public static final DefaultedTag ALLOWS_SURFACE_SLIME_SPAWNS = BiomeTags.key(ResourceKey.minecraft("allows_surface_slime_spawns")); - public static final Tag ALLOWS_TROPICAL_FISH_SPAWNS_AT_ANY_HEIGHT = BiomeTags.key(ResourceKey.minecraft("allows_tropical_fish_spawns_at_any_height")); + public static final DefaultedTag ALLOWS_TROPICAL_FISH_SPAWNS_AT_ANY_HEIGHT = BiomeTags.key(ResourceKey.minecraft("allows_tropical_fish_spawns_at_any_height")); - public static final Tag HAS_CLOSER_WATER_FOG = BiomeTags.key(ResourceKey.minecraft("has_closer_water_fog")); + public static final DefaultedTag HAS_STRUCTURE_ANCIENT_CITY = BiomeTags.key(ResourceKey.minecraft("has_structure/ancient_city")); - public static final Tag HAS_STRUCTURE_ANCIENT_CITY = BiomeTags.key(ResourceKey.minecraft("has_structure/ancient_city")); + public static final DefaultedTag HAS_STRUCTURE_BASTION_REMNANT = BiomeTags.key(ResourceKey.minecraft("has_structure/bastion_remnant")); - public static final Tag HAS_STRUCTURE_BASTION_REMNANT = BiomeTags.key(ResourceKey.minecraft("has_structure/bastion_remnant")); + public static final DefaultedTag HAS_STRUCTURE_BURIED_TREASURE = BiomeTags.key(ResourceKey.minecraft("has_structure/buried_treasure")); - public static final Tag HAS_STRUCTURE_BURIED_TREASURE = BiomeTags.key(ResourceKey.minecraft("has_structure/buried_treasure")); + public static final DefaultedTag HAS_STRUCTURE_DESERT_PYRAMID = BiomeTags.key(ResourceKey.minecraft("has_structure/desert_pyramid")); - public static final Tag HAS_STRUCTURE_DESERT_PYRAMID = BiomeTags.key(ResourceKey.minecraft("has_structure/desert_pyramid")); + public static final DefaultedTag HAS_STRUCTURE_END_CITY = BiomeTags.key(ResourceKey.minecraft("has_structure/end_city")); - public static final Tag HAS_STRUCTURE_END_CITY = BiomeTags.key(ResourceKey.minecraft("has_structure/end_city")); + public static final DefaultedTag HAS_STRUCTURE_IGLOO = BiomeTags.key(ResourceKey.minecraft("has_structure/igloo")); - public static final Tag HAS_STRUCTURE_IGLOO = BiomeTags.key(ResourceKey.minecraft("has_structure/igloo")); + public static final DefaultedTag HAS_STRUCTURE_JUNGLE_TEMPLE = BiomeTags.key(ResourceKey.minecraft("has_structure/jungle_temple")); - public static final Tag HAS_STRUCTURE_JUNGLE_TEMPLE = BiomeTags.key(ResourceKey.minecraft("has_structure/jungle_temple")); + public static final DefaultedTag HAS_STRUCTURE_MINESHAFT = BiomeTags.key(ResourceKey.minecraft("has_structure/mineshaft")); - public static final Tag HAS_STRUCTURE_MINESHAFT = BiomeTags.key(ResourceKey.minecraft("has_structure/mineshaft")); + public static final DefaultedTag HAS_STRUCTURE_MINESHAFT_MESA = BiomeTags.key(ResourceKey.minecraft("has_structure/mineshaft_mesa")); - public static final Tag HAS_STRUCTURE_MINESHAFT_MESA = BiomeTags.key(ResourceKey.minecraft("has_structure/mineshaft_mesa")); + public static final DefaultedTag HAS_STRUCTURE_NETHER_FORTRESS = BiomeTags.key(ResourceKey.minecraft("has_structure/nether_fortress")); - public static final Tag HAS_STRUCTURE_NETHER_FORTRESS = BiomeTags.key(ResourceKey.minecraft("has_structure/nether_fortress")); + public static final DefaultedTag HAS_STRUCTURE_NETHER_FOSSIL = BiomeTags.key(ResourceKey.minecraft("has_structure/nether_fossil")); - public static final Tag HAS_STRUCTURE_NETHER_FOSSIL = BiomeTags.key(ResourceKey.minecraft("has_structure/nether_fossil")); + public static final DefaultedTag HAS_STRUCTURE_OCEAN_MONUMENT = BiomeTags.key(ResourceKey.minecraft("has_structure/ocean_monument")); - public static final Tag HAS_STRUCTURE_OCEAN_MONUMENT = BiomeTags.key(ResourceKey.minecraft("has_structure/ocean_monument")); + public static final DefaultedTag HAS_STRUCTURE_OCEAN_RUIN_COLD = BiomeTags.key(ResourceKey.minecraft("has_structure/ocean_ruin_cold")); - public static final Tag HAS_STRUCTURE_OCEAN_RUIN_COLD = BiomeTags.key(ResourceKey.minecraft("has_structure/ocean_ruin_cold")); + public static final DefaultedTag HAS_STRUCTURE_OCEAN_RUIN_WARM = BiomeTags.key(ResourceKey.minecraft("has_structure/ocean_ruin_warm")); - public static final Tag HAS_STRUCTURE_OCEAN_RUIN_WARM = BiomeTags.key(ResourceKey.minecraft("has_structure/ocean_ruin_warm")); + public static final DefaultedTag HAS_STRUCTURE_PILLAGER_OUTPOST = BiomeTags.key(ResourceKey.minecraft("has_structure/pillager_outpost")); - public static final Tag HAS_STRUCTURE_PILLAGER_OUTPOST = BiomeTags.key(ResourceKey.minecraft("has_structure/pillager_outpost")); + public static final DefaultedTag HAS_STRUCTURE_RUINED_PORTAL_DESERT = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_desert")); - public static final Tag HAS_STRUCTURE_RUINED_PORTAL_DESERT = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_desert")); + public static final DefaultedTag HAS_STRUCTURE_RUINED_PORTAL_JUNGLE = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_jungle")); - public static final Tag HAS_STRUCTURE_RUINED_PORTAL_JUNGLE = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_jungle")); + public static final DefaultedTag HAS_STRUCTURE_RUINED_PORTAL_MOUNTAIN = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_mountain")); - public static final Tag HAS_STRUCTURE_RUINED_PORTAL_MOUNTAIN = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_mountain")); + public static final DefaultedTag HAS_STRUCTURE_RUINED_PORTAL_NETHER = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_nether")); - public static final Tag HAS_STRUCTURE_RUINED_PORTAL_NETHER = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_nether")); + public static final DefaultedTag HAS_STRUCTURE_RUINED_PORTAL_OCEAN = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_ocean")); - public static final Tag HAS_STRUCTURE_RUINED_PORTAL_OCEAN = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_ocean")); + public static final DefaultedTag HAS_STRUCTURE_RUINED_PORTAL_STANDARD = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_standard")); - public static final Tag HAS_STRUCTURE_RUINED_PORTAL_STANDARD = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_standard")); + public static final DefaultedTag HAS_STRUCTURE_RUINED_PORTAL_SWAMP = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_swamp")); - public static final Tag HAS_STRUCTURE_RUINED_PORTAL_SWAMP = BiomeTags.key(ResourceKey.minecraft("has_structure/ruined_portal_swamp")); + public static final DefaultedTag HAS_STRUCTURE_SHIPWRECK = BiomeTags.key(ResourceKey.minecraft("has_structure/shipwreck")); - public static final Tag HAS_STRUCTURE_SHIPWRECK = BiomeTags.key(ResourceKey.minecraft("has_structure/shipwreck")); + public static final DefaultedTag HAS_STRUCTURE_SHIPWRECK_BEACHED = BiomeTags.key(ResourceKey.minecraft("has_structure/shipwreck_beached")); - public static final Tag HAS_STRUCTURE_SHIPWRECK_BEACHED = BiomeTags.key(ResourceKey.minecraft("has_structure/shipwreck_beached")); + public static final DefaultedTag HAS_STRUCTURE_STRONGHOLD = BiomeTags.key(ResourceKey.minecraft("has_structure/stronghold")); - public static final Tag HAS_STRUCTURE_STRONGHOLD = BiomeTags.key(ResourceKey.minecraft("has_structure/stronghold")); + public static final DefaultedTag HAS_STRUCTURE_SWAMP_HUT = BiomeTags.key(ResourceKey.minecraft("has_structure/swamp_hut")); - public static final Tag HAS_STRUCTURE_SWAMP_HUT = BiomeTags.key(ResourceKey.minecraft("has_structure/swamp_hut")); + public static final DefaultedTag HAS_STRUCTURE_TRAIL_RUINS = BiomeTags.key(ResourceKey.minecraft("has_structure/trail_ruins")); - public static final Tag HAS_STRUCTURE_TRAIL_RUINS = BiomeTags.key(ResourceKey.minecraft("has_structure/trail_ruins")); + public static final DefaultedTag HAS_STRUCTURE_TRIAL_CHAMBERS = BiomeTags.key(ResourceKey.minecraft("has_structure/trial_chambers")); - public static final Tag HAS_STRUCTURE_TRIAL_CHAMBERS = BiomeTags.key(ResourceKey.minecraft("has_structure/trial_chambers")); + public static final DefaultedTag HAS_STRUCTURE_VILLAGE_DESERT = BiomeTags.key(ResourceKey.minecraft("has_structure/village_desert")); - public static final Tag HAS_STRUCTURE_VILLAGE_DESERT = BiomeTags.key(ResourceKey.minecraft("has_structure/village_desert")); + public static final DefaultedTag HAS_STRUCTURE_VILLAGE_PLAINS = BiomeTags.key(ResourceKey.minecraft("has_structure/village_plains")); - public static final Tag HAS_STRUCTURE_VILLAGE_PLAINS = BiomeTags.key(ResourceKey.minecraft("has_structure/village_plains")); + public static final DefaultedTag HAS_STRUCTURE_VILLAGE_SAVANNA = BiomeTags.key(ResourceKey.minecraft("has_structure/village_savanna")); - public static final Tag HAS_STRUCTURE_VILLAGE_SAVANNA = BiomeTags.key(ResourceKey.minecraft("has_structure/village_savanna")); + public static final DefaultedTag HAS_STRUCTURE_VILLAGE_SNOWY = BiomeTags.key(ResourceKey.minecraft("has_structure/village_snowy")); - public static final Tag HAS_STRUCTURE_VILLAGE_SNOWY = BiomeTags.key(ResourceKey.minecraft("has_structure/village_snowy")); + public static final DefaultedTag HAS_STRUCTURE_VILLAGE_TAIGA = BiomeTags.key(ResourceKey.minecraft("has_structure/village_taiga")); - public static final Tag HAS_STRUCTURE_VILLAGE_TAIGA = BiomeTags.key(ResourceKey.minecraft("has_structure/village_taiga")); + public static final DefaultedTag HAS_STRUCTURE_WOODLAND_MANSION = BiomeTags.key(ResourceKey.minecraft("has_structure/woodland_mansion")); - public static final Tag HAS_STRUCTURE_WOODLAND_MANSION = BiomeTags.key(ResourceKey.minecraft("has_structure/woodland_mansion")); + public static final DefaultedTag IS_BADLANDS = BiomeTags.key(ResourceKey.minecraft("is_badlands")); - public static final Tag INCREASED_FIRE_BURNOUT = BiomeTags.key(ResourceKey.minecraft("increased_fire_burnout")); + public static final DefaultedTag IS_BEACH = BiomeTags.key(ResourceKey.minecraft("is_beach")); - public static final Tag IS_BADLANDS = BiomeTags.key(ResourceKey.minecraft("is_badlands")); + public static final DefaultedTag IS_DEEP_OCEAN = BiomeTags.key(ResourceKey.minecraft("is_deep_ocean")); - public static final Tag IS_BEACH = BiomeTags.key(ResourceKey.minecraft("is_beach")); + public static final DefaultedTag IS_END = BiomeTags.key(ResourceKey.minecraft("is_end")); - public static final Tag IS_DEEP_OCEAN = BiomeTags.key(ResourceKey.minecraft("is_deep_ocean")); + public static final DefaultedTag IS_FOREST = BiomeTags.key(ResourceKey.minecraft("is_forest")); - public static final Tag IS_END = BiomeTags.key(ResourceKey.minecraft("is_end")); + public static final DefaultedTag IS_HILL = BiomeTags.key(ResourceKey.minecraft("is_hill")); - public static final Tag IS_FOREST = BiomeTags.key(ResourceKey.minecraft("is_forest")); + public static final DefaultedTag IS_JUNGLE = BiomeTags.key(ResourceKey.minecraft("is_jungle")); - public static final Tag IS_HILL = BiomeTags.key(ResourceKey.minecraft("is_hill")); + public static final DefaultedTag IS_MOUNTAIN = BiomeTags.key(ResourceKey.minecraft("is_mountain")); - public static final Tag IS_JUNGLE = BiomeTags.key(ResourceKey.minecraft("is_jungle")); + public static final DefaultedTag IS_NETHER = BiomeTags.key(ResourceKey.minecraft("is_nether")); - public static final Tag IS_MOUNTAIN = BiomeTags.key(ResourceKey.minecraft("is_mountain")); + public static final DefaultedTag IS_OCEAN = BiomeTags.key(ResourceKey.minecraft("is_ocean")); - public static final Tag IS_NETHER = BiomeTags.key(ResourceKey.minecraft("is_nether")); + public static final DefaultedTag IS_OVERWORLD = BiomeTags.key(ResourceKey.minecraft("is_overworld")); - public static final Tag IS_OCEAN = BiomeTags.key(ResourceKey.minecraft("is_ocean")); + public static final DefaultedTag IS_RIVER = BiomeTags.key(ResourceKey.minecraft("is_river")); - public static final Tag IS_OVERWORLD = BiomeTags.key(ResourceKey.minecraft("is_overworld")); + public static final DefaultedTag IS_SAVANNA = BiomeTags.key(ResourceKey.minecraft("is_savanna")); - public static final Tag IS_RIVER = BiomeTags.key(ResourceKey.minecraft("is_river")); + public static final DefaultedTag IS_TAIGA = BiomeTags.key(ResourceKey.minecraft("is_taiga")); - public static final Tag IS_SAVANNA = BiomeTags.key(ResourceKey.minecraft("is_savanna")); + public static final DefaultedTag MINESHAFT_BLOCKING = BiomeTags.key(ResourceKey.minecraft("mineshaft_blocking")); - public static final Tag IS_TAIGA = BiomeTags.key(ResourceKey.minecraft("is_taiga")); + public static final DefaultedTag MORE_FREQUENT_DROWNED_SPAWNS = BiomeTags.key(ResourceKey.minecraft("more_frequent_drowned_spawns")); - public static final Tag MINESHAFT_BLOCKING = BiomeTags.key(ResourceKey.minecraft("mineshaft_blocking")); + public static final DefaultedTag POLAR_BEARS_SPAWN_ON_ALTERNATE_BLOCKS = BiomeTags.key(ResourceKey.minecraft("polar_bears_spawn_on_alternate_blocks")); - public static final Tag MORE_FREQUENT_DROWNED_SPAWNS = BiomeTags.key(ResourceKey.minecraft("more_frequent_drowned_spawns")); + public static final DefaultedTag PRODUCES_CORALS_FROM_BONEMEAL = BiomeTags.key(ResourceKey.minecraft("produces_corals_from_bonemeal")); - public static final Tag PLAYS_UNDERWATER_MUSIC = BiomeTags.key(ResourceKey.minecraft("plays_underwater_music")); + public static final DefaultedTag REDUCE_WATER_AMBIENT_SPAWNS = BiomeTags.key(ResourceKey.minecraft("reduce_water_ambient_spawns")); - public static final Tag POLAR_BEARS_SPAWN_ON_ALTERNATE_BLOCKS = BiomeTags.key(ResourceKey.minecraft("polar_bears_spawn_on_alternate_blocks")); + public static final DefaultedTag REQUIRED_OCEAN_MONUMENT_SURROUNDING = BiomeTags.key(ResourceKey.minecraft("required_ocean_monument_surrounding")); - public static final Tag PRODUCES_CORALS_FROM_BONEMEAL = BiomeTags.key(ResourceKey.minecraft("produces_corals_from_bonemeal")); + public static final DefaultedTag SPAWNS_COLD_VARIANT_FARM_ANIMALS = BiomeTags.key(ResourceKey.minecraft("spawns_cold_variant_farm_animals")); - public static final Tag REDUCE_WATER_AMBIENT_SPAWNS = BiomeTags.key(ResourceKey.minecraft("reduce_water_ambient_spawns")); + public static final DefaultedTag SPAWNS_COLD_VARIANT_FROGS = BiomeTags.key(ResourceKey.minecraft("spawns_cold_variant_frogs")); - public static final Tag REQUIRED_OCEAN_MONUMENT_SURROUNDING = BiomeTags.key(ResourceKey.minecraft("required_ocean_monument_surrounding")); + public static final DefaultedTag SPAWNS_CORAL_VARIANT_ZOMBIE_NAUTILUS = BiomeTags.key(ResourceKey.minecraft("spawns_coral_variant_zombie_nautilus")); - public static final Tag SNOW_GOLEM_MELTS = BiomeTags.key(ResourceKey.minecraft("snow_golem_melts")); + public static final DefaultedTag SPAWNS_GOLD_RABBITS = BiomeTags.key(ResourceKey.minecraft("spawns_gold_rabbits")); - public static final Tag SPAWNS_COLD_VARIANT_FROGS = BiomeTags.key(ResourceKey.minecraft("spawns_cold_variant_frogs")); + public static final DefaultedTag SPAWNS_SNOW_FOXES = BiomeTags.key(ResourceKey.minecraft("spawns_snow_foxes")); - public static final Tag SPAWNS_GOLD_RABBITS = BiomeTags.key(ResourceKey.minecraft("spawns_gold_rabbits")); + public static final DefaultedTag SPAWNS_WARM_VARIANT_FARM_ANIMALS = BiomeTags.key(ResourceKey.minecraft("spawns_warm_variant_farm_animals")); - public static final Tag SPAWNS_SNOW_FOXES = BiomeTags.key(ResourceKey.minecraft("spawns_snow_foxes")); + public static final DefaultedTag SPAWNS_WARM_VARIANT_FROGS = BiomeTags.key(ResourceKey.minecraft("spawns_warm_variant_frogs")); - public static final Tag SPAWNS_WARM_VARIANT_FROGS = BiomeTags.key(ResourceKey.minecraft("spawns_warm_variant_frogs")); + public static final DefaultedTag SPAWNS_WHITE_RABBITS = BiomeTags.key(ResourceKey.minecraft("spawns_white_rabbits")); - public static final Tag SPAWNS_WHITE_RABBITS = BiomeTags.key(ResourceKey.minecraft("spawns_white_rabbits")); + public static final DefaultedTag STRONGHOLD_BIASED_TO = BiomeTags.key(ResourceKey.minecraft("stronghold_biased_to")); - public static final Tag STRONGHOLD_BIASED_TO = BiomeTags.key(ResourceKey.minecraft("stronghold_biased_to")); + public static final DefaultedTag WATER_ON_MAP_OUTLINES = BiomeTags.key(ResourceKey.minecraft("water_on_map_outlines")); - public static final Tag WATER_ON_MAP_OUTLINES = BiomeTags.key(ResourceKey.minecraft("water_on_map_outlines")); + public static final DefaultedTag WITHOUT_WANDERING_TRADER_SPAWNS = BiomeTags.key(ResourceKey.minecraft("without_wandering_trader_spawns")); - public static final Tag WITHOUT_PATROL_SPAWNS = BiomeTags.key(ResourceKey.minecraft("without_patrol_spawns")); - - public static final Tag WITHOUT_WANDERING_TRADER_SPAWNS = BiomeTags.key(ResourceKey.minecraft("without_wandering_trader_spawns")); - - public static final Tag WITHOUT_ZOMBIE_SIEGES = BiomeTags.key(ResourceKey.minecraft("without_zombie_sieges")); + public static final DefaultedTag WITHOUT_ZOMBIE_SIEGES = BiomeTags.key(ResourceKey.minecraft("without_zombie_sieges")); private BiomeTags() { } - private static Tag key(final ResourceKey key) { - return Tag.of(RegistryTypes.BIOME, key); + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.BIOME, key); } } diff --git a/src/main/java/org/spongepowered/api/tag/BlockTypeTags.java b/src/main/java/org/spongepowered/api/tag/BlockTypeTags.java index 3092ea4f44d..56f226c41d0 100644 --- a/src/main/java/org/spongepowered/api/tag/BlockTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/BlockTypeTags.java @@ -37,378 +37,418 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class BlockTypeTags { - public static final Tag ACACIA_LOGS = BlockTypeTags.key(ResourceKey.minecraft("acacia_logs")); + public static final DefaultedTag ACACIA_LOGS = BlockTypeTags.key(ResourceKey.minecraft("acacia_logs")); - public static final Tag AIR = BlockTypeTags.key(ResourceKey.minecraft("air")); + public static final DefaultedTag AIR = BlockTypeTags.key(ResourceKey.minecraft("air")); - public static final Tag ALL_HANGING_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("all_hanging_signs")); + public static final DefaultedTag ALL_HANGING_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("all_hanging_signs")); - public static final Tag ALL_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("all_signs")); + public static final DefaultedTag ALL_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("all_signs")); - public static final Tag ANCIENT_CITY_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("ancient_city_replaceable")); + public static final DefaultedTag ANCIENT_CITY_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("ancient_city_replaceable")); - public static final Tag ANIMALS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("animals_spawnable_on")); + public static final DefaultedTag ANIMALS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("animals_spawnable_on")); - public static final Tag ANVIL = BlockTypeTags.key(ResourceKey.minecraft("anvil")); + public static final DefaultedTag ANVIL = BlockTypeTags.key(ResourceKey.minecraft("anvil")); - public static final Tag ARMADILLO_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("armadillo_spawnable_on")); + public static final DefaultedTag 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 DefaultedTag 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 DefaultedTag 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 DefaultedTag 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 DefaultedTag BADLANDS_TERRACOTTA = BlockTypeTags.key(ResourceKey.minecraft("badlands_terracotta")); - public static final Tag BAMBOO_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("bamboo_blocks")); + public static final DefaultedTag BAMBOO_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("bamboo_blocks")); - public static final Tag BAMBOO_PLANTABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("bamboo_plantable_on")); + public static final DefaultedTag BAMBOO_PLANTABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("bamboo_plantable_on")); - public static final Tag BANNERS = BlockTypeTags.key(ResourceKey.minecraft("banners")); + public static final DefaultedTag BANNERS = BlockTypeTags.key(ResourceKey.minecraft("banners")); - public static final Tag BASE_STONE_NETHER = BlockTypeTags.key(ResourceKey.minecraft("base_stone_nether")); + public static final DefaultedTag BARS = BlockTypeTags.key(ResourceKey.minecraft("bars")); - public static final Tag BASE_STONE_OVERWORLD = BlockTypeTags.key(ResourceKey.minecraft("base_stone_overworld")); + public static final DefaultedTag BASE_STONE_NETHER = BlockTypeTags.key(ResourceKey.minecraft("base_stone_nether")); - public static final Tag BEACON_BASE_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("beacon_base_blocks")); + public static final DefaultedTag BASE_STONE_OVERWORLD = BlockTypeTags.key(ResourceKey.minecraft("base_stone_overworld")); - public static final Tag BEDS = BlockTypeTags.key(ResourceKey.minecraft("beds")); + public static final DefaultedTag BATS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("bats_spawnable_on")); - public static final Tag BEE_GROWABLES = BlockTypeTags.key(ResourceKey.minecraft("bee_growables")); + public static final DefaultedTag BEACON_BASE_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("beacon_base_blocks")); - public static final Tag BEEHIVES = BlockTypeTags.key(ResourceKey.minecraft("beehives")); + public static final DefaultedTag BEDS = BlockTypeTags.key(ResourceKey.minecraft("beds")); - public static final Tag BIG_DRIPLEAF_PLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("big_dripleaf_placeable")); + public static final DefaultedTag BEE_ATTRACTIVE = BlockTypeTags.key(ResourceKey.minecraft("bee_attractive")); - public static final Tag BIRCH_LOGS = BlockTypeTags.key(ResourceKey.minecraft("birch_logs")); + public static final DefaultedTag BEE_GROWABLES = BlockTypeTags.key(ResourceKey.minecraft("bee_growables")); - public static final Tag BLOCKS_WIND_CHARGE_EXPLOSIONS = BlockTypeTags.key(ResourceKey.minecraft("blocks_wind_charge_explosions")); + public static final DefaultedTag BEEHIVES = BlockTypeTags.key(ResourceKey.minecraft("beehives")); - public static final Tag BUTTONS = BlockTypeTags.key(ResourceKey.minecraft("buttons")); + public static final DefaultedTag BIG_DRIPLEAF_PLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("big_dripleaf_placeable")); - public static final Tag CAMEL_SAND_STEP_SOUND_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("camel_sand_step_sound_blocks")); + public static final DefaultedTag BIRCH_LOGS = BlockTypeTags.key(ResourceKey.minecraft("birch_logs")); - public static final Tag CAMPFIRES = BlockTypeTags.key(ResourceKey.minecraft("campfires")); + public static final DefaultedTag BLOCKS_WIND_CHARGE_EXPLOSIONS = BlockTypeTags.key(ResourceKey.minecraft("blocks_wind_charge_explosions")); - public static final Tag CANDLE_CAKES = BlockTypeTags.key(ResourceKey.minecraft("candle_cakes")); + public static final DefaultedTag BUTTONS = BlockTypeTags.key(ResourceKey.minecraft("buttons")); - public static final Tag CANDLES = BlockTypeTags.key(ResourceKey.minecraft("candles")); + public static final DefaultedTag CAMEL_SAND_STEP_SOUND_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("camel_sand_step_sound_blocks")); - public static final Tag CAULDRONS = BlockTypeTags.key(ResourceKey.minecraft("cauldrons")); + public static final DefaultedTag CAMELS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("camels_spawnable_on")); - public static final Tag CAVE_VINES = BlockTypeTags.key(ResourceKey.minecraft("cave_vines")); + public static final DefaultedTag CAMPFIRES = BlockTypeTags.key(ResourceKey.minecraft("campfires")); - public static final Tag CEILING_HANGING_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("ceiling_hanging_signs")); + public static final DefaultedTag CAN_GLIDE_THROUGH = BlockTypeTags.key(ResourceKey.minecraft("can_glide_through")); - public static final Tag CHERRY_LOGS = BlockTypeTags.key(ResourceKey.minecraft("cherry_logs")); + public static final DefaultedTag CANDLE_CAKES = BlockTypeTags.key(ResourceKey.minecraft("candle_cakes")); - public static final Tag CLIMBABLE = BlockTypeTags.key(ResourceKey.minecraft("climbable")); + public static final DefaultedTag CANDLES = BlockTypeTags.key(ResourceKey.minecraft("candles")); - public static final Tag COAL_ORES = BlockTypeTags.key(ResourceKey.minecraft("coal_ores")); + public static final DefaultedTag CAULDRONS = BlockTypeTags.key(ResourceKey.minecraft("cauldrons")); - public static final Tag COMBINATION_STEP_SOUND_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("combination_step_sound_blocks")); + public static final DefaultedTag CAVE_VINES = BlockTypeTags.key(ResourceKey.minecraft("cave_vines")); - public static final Tag COMPLETES_FIND_TREE_TUTORIAL = BlockTypeTags.key(ResourceKey.minecraft("completes_find_tree_tutorial")); + public static final DefaultedTag CEILING_HANGING_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("ceiling_hanging_signs")); - public static final Tag CONCRETE_POWDER = BlockTypeTags.key(ResourceKey.minecraft("concrete_powder")); + public static final DefaultedTag CHAINS = BlockTypeTags.key(ResourceKey.minecraft("chains")); - public static final Tag CONVERTABLE_TO_MUD = BlockTypeTags.key(ResourceKey.minecraft("convertable_to_mud")); + public static final DefaultedTag CHERRY_LOGS = BlockTypeTags.key(ResourceKey.minecraft("cherry_logs")); - public static final Tag COPPER_ORES = BlockTypeTags.key(ResourceKey.minecraft("copper_ores")); + public static final DefaultedTag CLIMBABLE = BlockTypeTags.key(ResourceKey.minecraft("climbable")); - public static final Tag CORAL_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("coral_blocks")); + public static final DefaultedTag COAL_ORES = BlockTypeTags.key(ResourceKey.minecraft("coal_ores")); - public static final Tag CORAL_PLANTS = BlockTypeTags.key(ResourceKey.minecraft("coral_plants")); + public static final DefaultedTag COMBINATION_STEP_SOUND_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("combination_step_sound_blocks")); - public static final Tag CORALS = BlockTypeTags.key(ResourceKey.minecraft("corals")); + public static final DefaultedTag COMPLETES_FIND_TREE_TUTORIAL = BlockTypeTags.key(ResourceKey.minecraft("completes_find_tree_tutorial")); - public static final Tag CRIMSON_STEMS = BlockTypeTags.key(ResourceKey.minecraft("crimson_stems")); + public static final DefaultedTag CONCRETE_POWDER = BlockTypeTags.key(ResourceKey.minecraft("concrete_powder")); - public static final Tag CROPS = BlockTypeTags.key(ResourceKey.minecraft("crops")); + public static final DefaultedTag CONVERTABLE_TO_MUD = BlockTypeTags.key(ResourceKey.minecraft("convertable_to_mud")); - public static final Tag CRYSTAL_SOUND_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("crystal_sound_blocks")); + public static final DefaultedTag COPPER = BlockTypeTags.key(ResourceKey.minecraft("copper")); - public static final Tag DAMPENS_VIBRATIONS = BlockTypeTags.key(ResourceKey.minecraft("dampens_vibrations")); + public static final DefaultedTag COPPER_CHESTS = BlockTypeTags.key(ResourceKey.minecraft("copper_chests")); - public static final Tag DARK_OAK_LOGS = BlockTypeTags.key(ResourceKey.minecraft("dark_oak_logs")); + public static final DefaultedTag COPPER_GOLEM_STATUES = BlockTypeTags.key(ResourceKey.minecraft("copper_golem_statues")); - public static final Tag DEAD_BUSH_MAY_PLACE_ON = BlockTypeTags.key(ResourceKey.minecraft("dead_bush_may_place_on")); + public static final DefaultedTag COPPER_ORES = BlockTypeTags.key(ResourceKey.minecraft("copper_ores")); - public static final Tag DEEPSLATE_ORE_REPLACEABLES = BlockTypeTags.key(ResourceKey.minecraft("deepslate_ore_replaceables")); + public static final DefaultedTag CORAL_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("coral_blocks")); - public static final Tag DIAMOND_ORES = BlockTypeTags.key(ResourceKey.minecraft("diamond_ores")); + public static final DefaultedTag CORAL_PLANTS = BlockTypeTags.key(ResourceKey.minecraft("coral_plants")); - public static final Tag DIRT = BlockTypeTags.key(ResourceKey.minecraft("dirt")); + public static final DefaultedTag CORALS = BlockTypeTags.key(ResourceKey.minecraft("corals")); - public static final Tag DOES_NOT_BLOCK_HOPPERS = BlockTypeTags.key(ResourceKey.minecraft("does_not_block_hoppers")); + public static final DefaultedTag CRIMSON_STEMS = BlockTypeTags.key(ResourceKey.minecraft("crimson_stems")); - public static final Tag DOORS = BlockTypeTags.key(ResourceKey.minecraft("doors")); + public static final DefaultedTag CROPS = BlockTypeTags.key(ResourceKey.minecraft("crops")); - public static final Tag DRAGON_IMMUNE = BlockTypeTags.key(ResourceKey.minecraft("dragon_immune")); + public static final DefaultedTag CRYSTAL_SOUND_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("crystal_sound_blocks")); - public static final Tag DRAGON_TRANSPARENT = BlockTypeTags.key(ResourceKey.minecraft("dragon_transparent")); + public static final DefaultedTag DAMPENS_VIBRATIONS = BlockTypeTags.key(ResourceKey.minecraft("dampens_vibrations")); - public static final Tag DRIPSTONE_REPLACEABLE_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("dripstone_replaceable_blocks")); + public static final DefaultedTag DARK_OAK_LOGS = BlockTypeTags.key(ResourceKey.minecraft("dark_oak_logs")); - public static final Tag EMERALD_ORES = BlockTypeTags.key(ResourceKey.minecraft("emerald_ores")); + public static final DefaultedTag DEEPSLATE_ORE_REPLACEABLES = BlockTypeTags.key(ResourceKey.minecraft("deepslate_ore_replaceables")); - public static final Tag ENCHANTMENT_POWER_PROVIDER = BlockTypeTags.key(ResourceKey.minecraft("enchantment_power_provider")); + public static final DefaultedTag DIAMOND_ORES = BlockTypeTags.key(ResourceKey.minecraft("diamond_ores")); - public static final Tag ENCHANTMENT_POWER_TRANSMITTER = BlockTypeTags.key(ResourceKey.minecraft("enchantment_power_transmitter")); + public static final DefaultedTag DIRT = BlockTypeTags.key(ResourceKey.minecraft("dirt")); - public static final Tag ENDERMAN_HOLDABLE = BlockTypeTags.key(ResourceKey.minecraft("enderman_holdable")); + public static final DefaultedTag DOES_NOT_BLOCK_HOPPERS = BlockTypeTags.key(ResourceKey.minecraft("does_not_block_hoppers")); - public static final Tag FALL_DAMAGE_RESETTING = BlockTypeTags.key(ResourceKey.minecraft("fall_damage_resetting")); + public static final DefaultedTag DOORS = BlockTypeTags.key(ResourceKey.minecraft("doors")); - public static final Tag FEATURES_CANNOT_REPLACE = BlockTypeTags.key(ResourceKey.minecraft("features_cannot_replace")); + public static final DefaultedTag DRAGON_IMMUNE = BlockTypeTags.key(ResourceKey.minecraft("dragon_immune")); - public static final Tag FENCE_GATES = BlockTypeTags.key(ResourceKey.minecraft("fence_gates")); + public static final DefaultedTag DRAGON_TRANSPARENT = BlockTypeTags.key(ResourceKey.minecraft("dragon_transparent")); - public static final Tag FENCES = BlockTypeTags.key(ResourceKey.minecraft("fences")); + public static final DefaultedTag DRIPSTONE_REPLACEABLE_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("dripstone_replaceable_blocks")); - public static final Tag FIRE = BlockTypeTags.key(ResourceKey.minecraft("fire")); + public static final DefaultedTag DRY_VEGETATION_MAY_PLACE_ON = BlockTypeTags.key(ResourceKey.minecraft("dry_vegetation_may_place_on")); - public static final Tag FLOWER_POTS = BlockTypeTags.key(ResourceKey.minecraft("flower_pots")); + public static final DefaultedTag EDIBLE_FOR_SHEEP = BlockTypeTags.key(ResourceKey.minecraft("edible_for_sheep")); - public static final Tag FLOWERS = BlockTypeTags.key(ResourceKey.minecraft("flowers")); + public static final DefaultedTag EMERALD_ORES = BlockTypeTags.key(ResourceKey.minecraft("emerald_ores")); - public static final Tag FOXES_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("foxes_spawnable_on")); + public static final DefaultedTag ENCHANTMENT_POWER_PROVIDER = BlockTypeTags.key(ResourceKey.minecraft("enchantment_power_provider")); - public static final Tag FROG_PREFER_JUMP_TO = BlockTypeTags.key(ResourceKey.minecraft("frog_prefer_jump_to")); + public static final DefaultedTag ENCHANTMENT_POWER_TRANSMITTER = BlockTypeTags.key(ResourceKey.minecraft("enchantment_power_transmitter")); - public static final Tag FROGS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("frogs_spawnable_on")); + public static final DefaultedTag ENDERMAN_HOLDABLE = BlockTypeTags.key(ResourceKey.minecraft("enderman_holdable")); - public static final Tag GEODE_INVALID_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("geode_invalid_blocks")); + public static final DefaultedTag FALL_DAMAGE_RESETTING = BlockTypeTags.key(ResourceKey.minecraft("fall_damage_resetting")); - public static final Tag GOATS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("goats_spawnable_on")); + public static final DefaultedTag FEATURES_CANNOT_REPLACE = BlockTypeTags.key(ResourceKey.minecraft("features_cannot_replace")); - public static final Tag GOLD_ORES = BlockTypeTags.key(ResourceKey.minecraft("gold_ores")); + public static final DefaultedTag FENCE_GATES = BlockTypeTags.key(ResourceKey.minecraft("fence_gates")); - public static final Tag GUARDED_BY_PIGLINS = BlockTypeTags.key(ResourceKey.minecraft("guarded_by_piglins")); + public static final DefaultedTag FENCES = BlockTypeTags.key(ResourceKey.minecraft("fences")); - public static final Tag HOGLIN_REPELLENTS = BlockTypeTags.key(ResourceKey.minecraft("hoglin_repellents")); + public static final DefaultedTag FIRE = BlockTypeTags.key(ResourceKey.minecraft("fire")); - public static final Tag ICE = BlockTypeTags.key(ResourceKey.minecraft("ice")); + public static final DefaultedTag FLOWER_POTS = BlockTypeTags.key(ResourceKey.minecraft("flower_pots")); - public static final Tag IMPERMEABLE = BlockTypeTags.key(ResourceKey.minecraft("impermeable")); + public static final DefaultedTag FLOWERS = BlockTypeTags.key(ResourceKey.minecraft("flowers")); - public static final Tag INCORRECT_FOR_DIAMOND_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_diamond_tool")); + public static final DefaultedTag FOXES_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("foxes_spawnable_on")); - public static final Tag INCORRECT_FOR_GOLD_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_gold_tool")); + public static final DefaultedTag FROG_PREFER_JUMP_TO = BlockTypeTags.key(ResourceKey.minecraft("frog_prefer_jump_to")); - public static final Tag INCORRECT_FOR_IRON_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_iron_tool")); + public static final DefaultedTag FROGS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("frogs_spawnable_on")); - public static final Tag INCORRECT_FOR_NETHERITE_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_netherite_tool")); + public static final DefaultedTag GEODE_INVALID_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("geode_invalid_blocks")); - public static final Tag INCORRECT_FOR_STONE_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_stone_tool")); + public static final DefaultedTag GOATS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("goats_spawnable_on")); - public static final Tag INCORRECT_FOR_WOODEN_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_wooden_tool")); + public static final DefaultedTag GOLD_ORES = BlockTypeTags.key(ResourceKey.minecraft("gold_ores")); - public static final Tag INFINIBURN_END = BlockTypeTags.key(ResourceKey.minecraft("infiniburn_end")); + public static final DefaultedTag GUARDED_BY_PIGLINS = BlockTypeTags.key(ResourceKey.minecraft("guarded_by_piglins")); - public static final Tag INFINIBURN_NETHER = BlockTypeTags.key(ResourceKey.minecraft("infiniburn_nether")); + public static final DefaultedTag HAPPY_GHAST_AVOIDS = BlockTypeTags.key(ResourceKey.minecraft("happy_ghast_avoids")); - public static final Tag INFINIBURN_OVERWORLD = BlockTypeTags.key(ResourceKey.minecraft("infiniburn_overworld")); + public static final DefaultedTag HOGLIN_REPELLENTS = BlockTypeTags.key(ResourceKey.minecraft("hoglin_repellents")); - public static final Tag INSIDE_STEP_SOUND_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("inside_step_sound_blocks")); + public static final DefaultedTag ICE = BlockTypeTags.key(ResourceKey.minecraft("ice")); - public static final Tag INVALID_SPAWN_INSIDE = BlockTypeTags.key(ResourceKey.minecraft("invalid_spawn_inside")); + public static final DefaultedTag IMPERMEABLE = BlockTypeTags.key(ResourceKey.minecraft("impermeable")); - public static final Tag IRON_ORES = BlockTypeTags.key(ResourceKey.minecraft("iron_ores")); + public static final DefaultedTag INCORRECT_FOR_COPPER_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_copper_tool")); - public static final Tag JUNGLE_LOGS = BlockTypeTags.key(ResourceKey.minecraft("jungle_logs")); + public static final DefaultedTag INCORRECT_FOR_DIAMOND_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_diamond_tool")); - public static final Tag LAPIS_ORES = BlockTypeTags.key(ResourceKey.minecraft("lapis_ores")); + public static final DefaultedTag INCORRECT_FOR_GOLD_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_gold_tool")); - public static final Tag LAVA_POOL_STONE_CANNOT_REPLACE = BlockTypeTags.key(ResourceKey.minecraft("lava_pool_stone_cannot_replace")); + public static final DefaultedTag INCORRECT_FOR_IRON_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_iron_tool")); - public static final Tag LEAVES = BlockTypeTags.key(ResourceKey.minecraft("leaves")); + public static final DefaultedTag INCORRECT_FOR_NETHERITE_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_netherite_tool")); - public static final Tag LOGS = BlockTypeTags.key(ResourceKey.minecraft("logs")); + public static final DefaultedTag INCORRECT_FOR_STONE_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_stone_tool")); - public static final Tag LOGS_THAT_BURN = BlockTypeTags.key(ResourceKey.minecraft("logs_that_burn")); + public static final DefaultedTag INCORRECT_FOR_WOODEN_TOOL = BlockTypeTags.key(ResourceKey.minecraft("incorrect_for_wooden_tool")); - public static final Tag LUSH_GROUND_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("lush_ground_replaceable")); + public static final DefaultedTag INFINIBURN_END = BlockTypeTags.key(ResourceKey.minecraft("infiniburn_end")); - public static final Tag MAINTAINS_FARMLAND = BlockTypeTags.key(ResourceKey.minecraft("maintains_farmland")); + public static final DefaultedTag INFINIBURN_NETHER = BlockTypeTags.key(ResourceKey.minecraft("infiniburn_nether")); - public static final Tag MANGROVE_LOGS = BlockTypeTags.key(ResourceKey.minecraft("mangrove_logs")); + public static final DefaultedTag INFINIBURN_OVERWORLD = BlockTypeTags.key(ResourceKey.minecraft("infiniburn_overworld")); - public static final Tag MANGROVE_LOGS_CAN_GROW_THROUGH = BlockTypeTags.key(ResourceKey.minecraft("mangrove_logs_can_grow_through")); + public static final DefaultedTag INSIDE_STEP_SOUND_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("inside_step_sound_blocks")); - public static final Tag MANGROVE_ROOTS_CAN_GROW_THROUGH = BlockTypeTags.key(ResourceKey.minecraft("mangrove_roots_can_grow_through")); + public static final DefaultedTag INVALID_SPAWN_INSIDE = BlockTypeTags.key(ResourceKey.minecraft("invalid_spawn_inside")); - public static final Tag MINEABLE_AXE = BlockTypeTags.key(ResourceKey.minecraft("mineable/axe")); + public static final DefaultedTag IRON_ORES = BlockTypeTags.key(ResourceKey.minecraft("iron_ores")); - public static final Tag MINEABLE_HOE = BlockTypeTags.key(ResourceKey.minecraft("mineable/hoe")); + public static final DefaultedTag JUNGLE_LOGS = BlockTypeTags.key(ResourceKey.minecraft("jungle_logs")); - public static final Tag MINEABLE_PICKAXE = BlockTypeTags.key(ResourceKey.minecraft("mineable/pickaxe")); + public static final DefaultedTag LANTERNS = BlockTypeTags.key(ResourceKey.minecraft("lanterns")); - public static final Tag MINEABLE_SHOVEL = BlockTypeTags.key(ResourceKey.minecraft("mineable/shovel")); + public static final DefaultedTag LAPIS_ORES = BlockTypeTags.key(ResourceKey.minecraft("lapis_ores")); - public static final Tag MOB_INTERACTABLE_DOORS = BlockTypeTags.key(ResourceKey.minecraft("mob_interactable_doors")); + public static final DefaultedTag LAVA_POOL_STONE_CANNOT_REPLACE = BlockTypeTags.key(ResourceKey.minecraft("lava_pool_stone_cannot_replace")); - public static final Tag MOOSHROOMS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("mooshrooms_spawnable_on")); + public static final DefaultedTag LEAVES = BlockTypeTags.key(ResourceKey.minecraft("leaves")); - public static final Tag MOSS_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("moss_replaceable")); + public static final DefaultedTag LIGHTNING_RODS = BlockTypeTags.key(ResourceKey.minecraft("lightning_rods")); - public static final Tag MUSHROOM_GROW_BLOCK = BlockTypeTags.key(ResourceKey.minecraft("mushroom_grow_block")); + public static final DefaultedTag LOGS = BlockTypeTags.key(ResourceKey.minecraft("logs")); - public static final Tag NEEDS_DIAMOND_TOOL = BlockTypeTags.key(ResourceKey.minecraft("needs_diamond_tool")); + public static final DefaultedTag LOGS_THAT_BURN = BlockTypeTags.key(ResourceKey.minecraft("logs_that_burn")); - public static final Tag NEEDS_IRON_TOOL = BlockTypeTags.key(ResourceKey.minecraft("needs_iron_tool")); + public static final DefaultedTag LUSH_GROUND_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("lush_ground_replaceable")); - public static final Tag NEEDS_STONE_TOOL = BlockTypeTags.key(ResourceKey.minecraft("needs_stone_tool")); + public static final DefaultedTag MAINTAINS_FARMLAND = BlockTypeTags.key(ResourceKey.minecraft("maintains_farmland")); - public static final Tag NETHER_CARVER_REPLACEABLES = BlockTypeTags.key(ResourceKey.minecraft("nether_carver_replaceables")); + public static final DefaultedTag MANGROVE_LOGS = BlockTypeTags.key(ResourceKey.minecraft("mangrove_logs")); - public static final Tag NYLIUM = BlockTypeTags.key(ResourceKey.minecraft("nylium")); + public static final DefaultedTag MANGROVE_LOGS_CAN_GROW_THROUGH = BlockTypeTags.key(ResourceKey.minecraft("mangrove_logs_can_grow_through")); - public static final Tag OAK_LOGS = BlockTypeTags.key(ResourceKey.minecraft("oak_logs")); + public static final DefaultedTag MANGROVE_ROOTS_CAN_GROW_THROUGH = BlockTypeTags.key(ResourceKey.minecraft("mangrove_roots_can_grow_through")); - public static final Tag OCCLUDES_VIBRATION_SIGNALS = BlockTypeTags.key(ResourceKey.minecraft("occludes_vibration_signals")); + public static final DefaultedTag MINEABLE_AXE = BlockTypeTags.key(ResourceKey.minecraft("mineable/axe")); - public static final Tag OVERWORLD_CARVER_REPLACEABLES = BlockTypeTags.key(ResourceKey.minecraft("overworld_carver_replaceables")); + public static final DefaultedTag MINEABLE_HOE = BlockTypeTags.key(ResourceKey.minecraft("mineable/hoe")); - public static final Tag OVERWORLD_NATURAL_LOGS = BlockTypeTags.key(ResourceKey.minecraft("overworld_natural_logs")); + public static final DefaultedTag MINEABLE_PICKAXE = BlockTypeTags.key(ResourceKey.minecraft("mineable/pickaxe")); - public static final Tag PARROTS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("parrots_spawnable_on")); + public static final DefaultedTag MINEABLE_SHOVEL = BlockTypeTags.key(ResourceKey.minecraft("mineable/shovel")); - public static final Tag PIGLIN_REPELLENTS = BlockTypeTags.key(ResourceKey.minecraft("piglin_repellents")); + public static final DefaultedTag MOB_INTERACTABLE_DOORS = BlockTypeTags.key(ResourceKey.minecraft("mob_interactable_doors")); - public static final Tag PLANKS = BlockTypeTags.key(ResourceKey.minecraft("planks")); + public static final DefaultedTag MOOSHROOMS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("mooshrooms_spawnable_on")); - public static final Tag POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = BlockTypeTags.key(ResourceKey.minecraft("polar_bears_spawnable_on_alternate")); + public static final DefaultedTag MOSS_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("moss_replaceable")); - public static final Tag PORTALS = BlockTypeTags.key(ResourceKey.minecraft("portals")); + public static final DefaultedTag MUSHROOM_GROW_BLOCK = BlockTypeTags.key(ResourceKey.minecraft("mushroom_grow_block")); - public static final Tag PRESSURE_PLATES = BlockTypeTags.key(ResourceKey.minecraft("pressure_plates")); + public static final DefaultedTag NEEDS_DIAMOND_TOOL = BlockTypeTags.key(ResourceKey.minecraft("needs_diamond_tool")); - public static final Tag PREVENT_MOB_SPAWNING_INSIDE = BlockTypeTags.key(ResourceKey.minecraft("prevent_mob_spawning_inside")); + public static final DefaultedTag NEEDS_IRON_TOOL = BlockTypeTags.key(ResourceKey.minecraft("needs_iron_tool")); - public static final Tag RABBITS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("rabbits_spawnable_on")); + public static final DefaultedTag NEEDS_STONE_TOOL = BlockTypeTags.key(ResourceKey.minecraft("needs_stone_tool")); - public static final Tag RAILS = BlockTypeTags.key(ResourceKey.minecraft("rails")); + public static final DefaultedTag NETHER_CARVER_REPLACEABLES = BlockTypeTags.key(ResourceKey.minecraft("nether_carver_replaceables")); - public static final Tag REDSTONE_ORES = BlockTypeTags.key(ResourceKey.minecraft("redstone_ores")); + public static final DefaultedTag NYLIUM = BlockTypeTags.key(ResourceKey.minecraft("nylium")); - public static final Tag REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("replaceable")); + public static final DefaultedTag OAK_LOGS = BlockTypeTags.key(ResourceKey.minecraft("oak_logs")); - public static final Tag REPLACEABLE_BY_TREES = BlockTypeTags.key(ResourceKey.minecraft("replaceable_by_trees")); + public static final DefaultedTag OCCLUDES_VIBRATION_SIGNALS = BlockTypeTags.key(ResourceKey.minecraft("occludes_vibration_signals")); - public static final Tag SAND = BlockTypeTags.key(ResourceKey.minecraft("sand")); + public static final DefaultedTag OVERWORLD_CARVER_REPLACEABLES = BlockTypeTags.key(ResourceKey.minecraft("overworld_carver_replaceables")); - public static final Tag SAPLINGS = BlockTypeTags.key(ResourceKey.minecraft("saplings")); + public static final DefaultedTag OVERWORLD_NATURAL_LOGS = BlockTypeTags.key(ResourceKey.minecraft("overworld_natural_logs")); - public static final Tag SCULK_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("sculk_replaceable")); + public static final DefaultedTag PALE_OAK_LOGS = BlockTypeTags.key(ResourceKey.minecraft("pale_oak_logs")); - public static final Tag SCULK_REPLACEABLE_WORLD_GEN = BlockTypeTags.key(ResourceKey.minecraft("sculk_replaceable_world_gen")); + public static final DefaultedTag PARROTS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("parrots_spawnable_on")); - public static final Tag SHULKER_BOXES = BlockTypeTags.key(ResourceKey.minecraft("shulker_boxes")); + public static final DefaultedTag PIGLIN_REPELLENTS = BlockTypeTags.key(ResourceKey.minecraft("piglin_repellents")); - public static final Tag SIGNS = BlockTypeTags.key(ResourceKey.minecraft("signs")); + public static final DefaultedTag PLANKS = BlockTypeTags.key(ResourceKey.minecraft("planks")); - public static final Tag SLABS = BlockTypeTags.key(ResourceKey.minecraft("slabs")); + public static final DefaultedTag POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = BlockTypeTags.key(ResourceKey.minecraft("polar_bears_spawnable_on_alternate")); - public static final Tag SMALL_DRIPLEAF_PLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("small_dripleaf_placeable")); + public static final DefaultedTag PORTALS = BlockTypeTags.key(ResourceKey.minecraft("portals")); - public static final Tag SMALL_FLOWERS = BlockTypeTags.key(ResourceKey.minecraft("small_flowers")); + public static final DefaultedTag PRESSURE_PLATES = BlockTypeTags.key(ResourceKey.minecraft("pressure_plates")); - public static final Tag SMELTS_TO_GLASS = BlockTypeTags.key(ResourceKey.minecraft("smelts_to_glass")); + public static final DefaultedTag PREVENT_MOB_SPAWNING_INSIDE = BlockTypeTags.key(ResourceKey.minecraft("prevent_mob_spawning_inside")); - public static final Tag SNAPS_GOAT_HORN = BlockTypeTags.key(ResourceKey.minecraft("snaps_goat_horn")); + public static final DefaultedTag RABBITS_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("rabbits_spawnable_on")); - public static final Tag SNIFFER_DIGGABLE_BLOCK = BlockTypeTags.key(ResourceKey.minecraft("sniffer_diggable_block")); + public static final DefaultedTag RAILS = BlockTypeTags.key(ResourceKey.minecraft("rails")); - public static final Tag SNIFFER_EGG_HATCH_BOOST = BlockTypeTags.key(ResourceKey.minecraft("sniffer_egg_hatch_boost")); + public static final DefaultedTag REDSTONE_ORES = BlockTypeTags.key(ResourceKey.minecraft("redstone_ores")); - public static final Tag SNOW = BlockTypeTags.key(ResourceKey.minecraft("snow")); + public static final DefaultedTag REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("replaceable")); - public static final Tag SNOW_LAYER_CAN_SURVIVE_ON = BlockTypeTags.key(ResourceKey.minecraft("snow_layer_can_survive_on")); + public static final DefaultedTag REPLACEABLE_BY_MUSHROOMS = BlockTypeTags.key(ResourceKey.minecraft("replaceable_by_mushrooms")); - public static final Tag SNOW_LAYER_CANNOT_SURVIVE_ON = BlockTypeTags.key(ResourceKey.minecraft("snow_layer_cannot_survive_on")); + public static final DefaultedTag REPLACEABLE_BY_TREES = BlockTypeTags.key(ResourceKey.minecraft("replaceable_by_trees")); - public static final Tag SOUL_FIRE_BASE_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("soul_fire_base_blocks")); + public static final DefaultedTag SAND = BlockTypeTags.key(ResourceKey.minecraft("sand")); - public static final Tag SOUL_SPEED_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("soul_speed_blocks")); + public static final DefaultedTag SAPLINGS = BlockTypeTags.key(ResourceKey.minecraft("saplings")); - public static final Tag SPRUCE_LOGS = BlockTypeTags.key(ResourceKey.minecraft("spruce_logs")); + public static final DefaultedTag SCULK_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("sculk_replaceable")); - public static final Tag STAIRS = BlockTypeTags.key(ResourceKey.minecraft("stairs")); + public static final DefaultedTag SCULK_REPLACEABLE_WORLD_GEN = BlockTypeTags.key(ResourceKey.minecraft("sculk_replaceable_world_gen")); - public static final Tag STANDING_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("standing_signs")); + public static final DefaultedTag SHULKER_BOXES = BlockTypeTags.key(ResourceKey.minecraft("shulker_boxes")); - public static final Tag STONE_BRICKS = BlockTypeTags.key(ResourceKey.minecraft("stone_bricks")); + public static final DefaultedTag SIGNS = BlockTypeTags.key(ResourceKey.minecraft("signs")); - public static final Tag STONE_BUTTONS = BlockTypeTags.key(ResourceKey.minecraft("stone_buttons")); + public static final DefaultedTag SLABS = BlockTypeTags.key(ResourceKey.minecraft("slabs")); - public static final Tag STONE_ORE_REPLACEABLES = BlockTypeTags.key(ResourceKey.minecraft("stone_ore_replaceables")); + public static final DefaultedTag SMALL_DRIPLEAF_PLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("small_dripleaf_placeable")); - public static final Tag STONE_PRESSURE_PLATES = BlockTypeTags.key(ResourceKey.minecraft("stone_pressure_plates")); + public static final DefaultedTag SMALL_FLOWERS = BlockTypeTags.key(ResourceKey.minecraft("small_flowers")); - public static final Tag STRIDER_WARM_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("strider_warm_blocks")); + public static final DefaultedTag SMELTS_TO_GLASS = BlockTypeTags.key(ResourceKey.minecraft("smelts_to_glass")); - public static final Tag SWORD_EFFICIENT = BlockTypeTags.key(ResourceKey.minecraft("sword_efficient")); + public static final DefaultedTag SNAPS_GOAT_HORN = BlockTypeTags.key(ResourceKey.minecraft("snaps_goat_horn")); - public static final Tag TALL_FLOWERS = BlockTypeTags.key(ResourceKey.minecraft("tall_flowers")); + public static final DefaultedTag SNIFFER_DIGGABLE_BLOCK = BlockTypeTags.key(ResourceKey.minecraft("sniffer_diggable_block")); - public static final Tag TERRACOTTA = BlockTypeTags.key(ResourceKey.minecraft("terracotta")); + public static final DefaultedTag SNIFFER_EGG_HATCH_BOOST = BlockTypeTags.key(ResourceKey.minecraft("sniffer_egg_hatch_boost")); - public static final Tag TRAIL_RUINS_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("trail_ruins_replaceable")); + public static final DefaultedTag SNOW = BlockTypeTags.key(ResourceKey.minecraft("snow")); - public static final Tag TRAPDOORS = BlockTypeTags.key(ResourceKey.minecraft("trapdoors")); + public static final DefaultedTag SNOW_LAYER_CAN_SURVIVE_ON = BlockTypeTags.key(ResourceKey.minecraft("snow_layer_can_survive_on")); - public static final Tag UNDERWATER_BONEMEALS = BlockTypeTags.key(ResourceKey.minecraft("underwater_bonemeals")); + public static final DefaultedTag SNOW_LAYER_CANNOT_SURVIVE_ON = BlockTypeTags.key(ResourceKey.minecraft("snow_layer_cannot_survive_on")); - public static final Tag UNSTABLE_BOTTOM_CENTER = BlockTypeTags.key(ResourceKey.minecraft("unstable_bottom_center")); + public static final DefaultedTag SOUL_FIRE_BASE_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("soul_fire_base_blocks")); - public static final Tag VALID_SPAWN = BlockTypeTags.key(ResourceKey.minecraft("valid_spawn")); + public static final DefaultedTag SOUL_SPEED_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("soul_speed_blocks")); - public static final Tag VIBRATION_RESONATORS = BlockTypeTags.key(ResourceKey.minecraft("vibration_resonators")); + public static final DefaultedTag SPRUCE_LOGS = BlockTypeTags.key(ResourceKey.minecraft("spruce_logs")); - public static final Tag WALL_CORALS = BlockTypeTags.key(ResourceKey.minecraft("wall_corals")); + public static final DefaultedTag STAIRS = BlockTypeTags.key(ResourceKey.minecraft("stairs")); - public static final Tag WALL_HANGING_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("wall_hanging_signs")); + public static final DefaultedTag STANDING_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("standing_signs")); - public static final Tag WALL_POST_OVERRIDE = BlockTypeTags.key(ResourceKey.minecraft("wall_post_override")); + public static final DefaultedTag STONE_BRICKS = BlockTypeTags.key(ResourceKey.minecraft("stone_bricks")); - public static final Tag WALL_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("wall_signs")); + public static final DefaultedTag STONE_BUTTONS = BlockTypeTags.key(ResourceKey.minecraft("stone_buttons")); - public static final Tag WALLS = BlockTypeTags.key(ResourceKey.minecraft("walls")); + public static final DefaultedTag STONE_ORE_REPLACEABLES = BlockTypeTags.key(ResourceKey.minecraft("stone_ore_replaceables")); - public static final Tag WARPED_STEMS = BlockTypeTags.key(ResourceKey.minecraft("warped_stems")); + public static final DefaultedTag STONE_PRESSURE_PLATES = BlockTypeTags.key(ResourceKey.minecraft("stone_pressure_plates")); - public static final Tag WART_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("wart_blocks")); + public static final DefaultedTag STRIDER_WARM_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("strider_warm_blocks")); - public static final Tag WITHER_IMMUNE = BlockTypeTags.key(ResourceKey.minecraft("wither_immune")); + public static final DefaultedTag SWORD_EFFICIENT = BlockTypeTags.key(ResourceKey.minecraft("sword_efficient")); - public static final Tag WITHER_SUMMON_BASE_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("wither_summon_base_blocks")); + public static final DefaultedTag SWORD_INSTANTLY_MINES = BlockTypeTags.key(ResourceKey.minecraft("sword_instantly_mines")); - public static final Tag WOLVES_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("wolves_spawnable_on")); + public static final DefaultedTag TERRACOTTA = BlockTypeTags.key(ResourceKey.minecraft("terracotta")); - public static final Tag WOODEN_BUTTONS = BlockTypeTags.key(ResourceKey.minecraft("wooden_buttons")); + public static final DefaultedTag TRAIL_RUINS_REPLACEABLE = BlockTypeTags.key(ResourceKey.minecraft("trail_ruins_replaceable")); - public static final Tag WOODEN_DOORS = BlockTypeTags.key(ResourceKey.minecraft("wooden_doors")); + public static final DefaultedTag TRAPDOORS = BlockTypeTags.key(ResourceKey.minecraft("trapdoors")); - public static final Tag WOODEN_FENCES = BlockTypeTags.key(ResourceKey.minecraft("wooden_fences")); + public static final DefaultedTag TRIGGERS_AMBIENT_DESERT_DRY_VEGETATION_BLOCK_SOUNDS = BlockTypeTags.key(ResourceKey.minecraft("triggers_ambient_desert_dry_vegetation_block_sounds")); - public static final Tag WOODEN_PRESSURE_PLATES = BlockTypeTags.key(ResourceKey.minecraft("wooden_pressure_plates")); + public static final DefaultedTag TRIGGERS_AMBIENT_DESERT_SAND_BLOCK_SOUNDS = BlockTypeTags.key(ResourceKey.minecraft("triggers_ambient_desert_sand_block_sounds")); - public static final Tag WOODEN_SLABS = BlockTypeTags.key(ResourceKey.minecraft("wooden_slabs")); + public static final DefaultedTag TRIGGERS_AMBIENT_DRIED_GHAST_BLOCK_SOUNDS = BlockTypeTags.key(ResourceKey.minecraft("triggers_ambient_dried_ghast_block_sounds")); - public static final Tag WOODEN_STAIRS = BlockTypeTags.key(ResourceKey.minecraft("wooden_stairs")); + public static final DefaultedTag UNDERWATER_BONEMEALS = BlockTypeTags.key(ResourceKey.minecraft("underwater_bonemeals")); - public static final Tag WOODEN_TRAPDOORS = BlockTypeTags.key(ResourceKey.minecraft("wooden_trapdoors")); + public static final DefaultedTag UNSTABLE_BOTTOM_CENTER = BlockTypeTags.key(ResourceKey.minecraft("unstable_bottom_center")); - public static final Tag WOOL = BlockTypeTags.key(ResourceKey.minecraft("wool")); + public static final DefaultedTag VALID_SPAWN = BlockTypeTags.key(ResourceKey.minecraft("valid_spawn")); - public static final Tag WOOL_CARPETS = BlockTypeTags.key(ResourceKey.minecraft("wool_carpets")); + public static final DefaultedTag VIBRATION_RESONATORS = BlockTypeTags.key(ResourceKey.minecraft("vibration_resonators")); + + public static final DefaultedTag WALL_CORALS = BlockTypeTags.key(ResourceKey.minecraft("wall_corals")); + + public static final DefaultedTag WALL_HANGING_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("wall_hanging_signs")); + + public static final DefaultedTag WALL_POST_OVERRIDE = BlockTypeTags.key(ResourceKey.minecraft("wall_post_override")); + + public static final DefaultedTag WALL_SIGNS = BlockTypeTags.key(ResourceKey.minecraft("wall_signs")); + + public static final DefaultedTag WALLS = BlockTypeTags.key(ResourceKey.minecraft("walls")); + + public static final DefaultedTag WARPED_STEMS = BlockTypeTags.key(ResourceKey.minecraft("warped_stems")); + + public static final DefaultedTag WART_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("wart_blocks")); + + public static final DefaultedTag WITHER_IMMUNE = BlockTypeTags.key(ResourceKey.minecraft("wither_immune")); + + public static final DefaultedTag WITHER_SUMMON_BASE_BLOCKS = BlockTypeTags.key(ResourceKey.minecraft("wither_summon_base_blocks")); + + public static final DefaultedTag WOLVES_SPAWNABLE_ON = BlockTypeTags.key(ResourceKey.minecraft("wolves_spawnable_on")); + + public static final DefaultedTag WOODEN_BUTTONS = BlockTypeTags.key(ResourceKey.minecraft("wooden_buttons")); + + public static final DefaultedTag WOODEN_DOORS = BlockTypeTags.key(ResourceKey.minecraft("wooden_doors")); + + public static final DefaultedTag WOODEN_FENCES = BlockTypeTags.key(ResourceKey.minecraft("wooden_fences")); + + public static final DefaultedTag WOODEN_PRESSURE_PLATES = BlockTypeTags.key(ResourceKey.minecraft("wooden_pressure_plates")); + + public static final DefaultedTag WOODEN_SHELVES = BlockTypeTags.key(ResourceKey.minecraft("wooden_shelves")); + + public static final DefaultedTag WOODEN_SLABS = BlockTypeTags.key(ResourceKey.minecraft("wooden_slabs")); + + public static final DefaultedTag WOODEN_STAIRS = BlockTypeTags.key(ResourceKey.minecraft("wooden_stairs")); + + public static final DefaultedTag WOODEN_TRAPDOORS = BlockTypeTags.key(ResourceKey.minecraft("wooden_trapdoors")); + + public static final DefaultedTag WOOL = BlockTypeTags.key(ResourceKey.minecraft("wool")); + + public static final DefaultedTag WOOL_CARPETS = BlockTypeTags.key(ResourceKey.minecraft("wool_carpets")); private BlockTypeTags() { } - private static Tag key(final ResourceKey key) { - return Tag.of(RegistryTypes.BLOCK_TYPE, key); + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.BLOCK_TYPE, key); } } diff --git a/src/main/java/org/spongepowered/api/tag/DamageTypeTags.java b/src/main/java/org/spongepowered/api/tag/DamageTypeTags.java index 60759cb5242..742bc524b73 100644 --- a/src/main/java/org/spongepowered/api/tag/DamageTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/DamageTypeTags.java @@ -37,74 +37,76 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class DamageTypeTags { - public static final Tag ALWAYS_HURTS_ENDER_DRAGONS = DamageTypeTags.key(ResourceKey.minecraft("always_hurts_ender_dragons")); + public static final DefaultedTag ALWAYS_HURTS_ENDER_DRAGONS = DamageTypeTags.key(ResourceKey.minecraft("always_hurts_ender_dragons")); - public static final Tag ALWAYS_KILLS_ARMOR_STANDS = DamageTypeTags.key(ResourceKey.minecraft("always_kills_armor_stands")); + public static final DefaultedTag ALWAYS_KILLS_ARMOR_STANDS = DamageTypeTags.key(ResourceKey.minecraft("always_kills_armor_stands")); - public static final Tag ALWAYS_MOST_SIGNIFICANT_FALL = DamageTypeTags.key(ResourceKey.minecraft("always_most_significant_fall")); + public static final DefaultedTag ALWAYS_MOST_SIGNIFICANT_FALL = DamageTypeTags.key(ResourceKey.minecraft("always_most_significant_fall")); - public static final Tag ALWAYS_TRIGGERS_SILVERFISH = DamageTypeTags.key(ResourceKey.minecraft("always_triggers_silverfish")); + public static final DefaultedTag ALWAYS_TRIGGERS_SILVERFISH = DamageTypeTags.key(ResourceKey.minecraft("always_triggers_silverfish")); - public static final Tag AVOIDS_GUARDIAN_THORNS = DamageTypeTags.key(ResourceKey.minecraft("avoids_guardian_thorns")); + public static final DefaultedTag AVOIDS_GUARDIAN_THORNS = DamageTypeTags.key(ResourceKey.minecraft("avoids_guardian_thorns")); - public static final Tag BURN_FROM_STEPPING = DamageTypeTags.key(ResourceKey.minecraft("burn_from_stepping")); + public static final DefaultedTag BURN_FROM_STEPPING = DamageTypeTags.key(ResourceKey.minecraft("burn_from_stepping")); - public static final Tag BURNS_ARMOR_STANDS = DamageTypeTags.key(ResourceKey.minecraft("burns_armor_stands")); + public static final DefaultedTag BURNS_ARMOR_STANDS = DamageTypeTags.key(ResourceKey.minecraft("burns_armor_stands")); - public static final Tag BYPASSES_ARMOR = DamageTypeTags.key(ResourceKey.minecraft("bypasses_armor")); + public static final DefaultedTag BYPASSES_ARMOR = DamageTypeTags.key(ResourceKey.minecraft("bypasses_armor")); - public static final Tag BYPASSES_EFFECTS = DamageTypeTags.key(ResourceKey.minecraft("bypasses_effects")); + public static final DefaultedTag BYPASSES_EFFECTS = DamageTypeTags.key(ResourceKey.minecraft("bypasses_effects")); - public static final Tag BYPASSES_ENCHANTMENTS = DamageTypeTags.key(ResourceKey.minecraft("bypasses_enchantments")); + public static final DefaultedTag BYPASSES_ENCHANTMENTS = DamageTypeTags.key(ResourceKey.minecraft("bypasses_enchantments")); - public static final Tag BYPASSES_INVULNERABILITY = DamageTypeTags.key(ResourceKey.minecraft("bypasses_invulnerability")); + public static final DefaultedTag BYPASSES_INVULNERABILITY = DamageTypeTags.key(ResourceKey.minecraft("bypasses_invulnerability")); - public static final Tag BYPASSES_RESISTANCE = DamageTypeTags.key(ResourceKey.minecraft("bypasses_resistance")); + public static final DefaultedTag BYPASSES_RESISTANCE = DamageTypeTags.key(ResourceKey.minecraft("bypasses_resistance")); - public static final Tag BYPASSES_SHIELD = DamageTypeTags.key(ResourceKey.minecraft("bypasses_shield")); + public static final DefaultedTag 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 DefaultedTag 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 DefaultedTag CAN_BREAK_ARMOR_STAND = DamageTypeTags.key(ResourceKey.minecraft("can_break_armor_stand")); - public static final Tag DAMAGES_HELMET = DamageTypeTags.key(ResourceKey.minecraft("damages_helmet")); + public static final DefaultedTag DAMAGES_HELMET = DamageTypeTags.key(ResourceKey.minecraft("damages_helmet")); - public static final Tag IGNITES_ARMOR_STANDS = DamageTypeTags.key(ResourceKey.minecraft("ignites_armor_stands")); + public static final DefaultedTag IGNITES_ARMOR_STANDS = DamageTypeTags.key(ResourceKey.minecraft("ignites_armor_stands")); - public static final Tag IS_DROWNING = DamageTypeTags.key(ResourceKey.minecraft("is_drowning")); + public static final DefaultedTag IS_DROWNING = DamageTypeTags.key(ResourceKey.minecraft("is_drowning")); - public static final Tag IS_EXPLOSION = DamageTypeTags.key(ResourceKey.minecraft("is_explosion")); + public static final DefaultedTag IS_EXPLOSION = DamageTypeTags.key(ResourceKey.minecraft("is_explosion")); - public static final Tag IS_FALL = DamageTypeTags.key(ResourceKey.minecraft("is_fall")); + public static final DefaultedTag IS_FALL = DamageTypeTags.key(ResourceKey.minecraft("is_fall")); - public static final Tag IS_FIRE = DamageTypeTags.key(ResourceKey.minecraft("is_fire")); + public static final DefaultedTag IS_FIRE = DamageTypeTags.key(ResourceKey.minecraft("is_fire")); - public static final Tag IS_FREEZING = DamageTypeTags.key(ResourceKey.minecraft("is_freezing")); + public static final DefaultedTag IS_FREEZING = DamageTypeTags.key(ResourceKey.minecraft("is_freezing")); - public static final Tag IS_LIGHTNING = DamageTypeTags.key(ResourceKey.minecraft("is_lightning")); + public static final DefaultedTag 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 DefaultedTag 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 DefaultedTag IS_PROJECTILE = DamageTypeTags.key(ResourceKey.minecraft("is_projectile")); - public static final Tag NO_ANGER = DamageTypeTags.key(ResourceKey.minecraft("no_anger")); + public static final DefaultedTag MACE_SMASH = DamageTypeTags.key(ResourceKey.minecraft("mace_smash")); - public static final Tag NO_IMPACT = DamageTypeTags.key(ResourceKey.minecraft("no_impact")); + public static final DefaultedTag NO_ANGER = DamageTypeTags.key(ResourceKey.minecraft("no_anger")); - public static final Tag NO_KNOCKBACK = DamageTypeTags.key(ResourceKey.minecraft("no_knockback")); + public static final DefaultedTag NO_IMPACT = DamageTypeTags.key(ResourceKey.minecraft("no_impact")); - public static final Tag PANIC_CAUSES = DamageTypeTags.key(ResourceKey.minecraft("panic_causes")); + public static final DefaultedTag NO_KNOCKBACK = DamageTypeTags.key(ResourceKey.minecraft("no_knockback")); - public static final Tag PANIC_ENVIRONMENTAL_CAUSES = DamageTypeTags.key(ResourceKey.minecraft("panic_environmental_causes")); + public static final DefaultedTag PANIC_CAUSES = DamageTypeTags.key(ResourceKey.minecraft("panic_causes")); - public static final Tag WITCH_RESISTANT_TO = DamageTypeTags.key(ResourceKey.minecraft("witch_resistant_to")); + public static final DefaultedTag PANIC_ENVIRONMENTAL_CAUSES = DamageTypeTags.key(ResourceKey.minecraft("panic_environmental_causes")); - public static final Tag WITHER_IMMUNE_TO = DamageTypeTags.key(ResourceKey.minecraft("wither_immune_to")); + public static final DefaultedTag WITCH_RESISTANT_TO = DamageTypeTags.key(ResourceKey.minecraft("witch_resistant_to")); + + public static final DefaultedTag WITHER_IMMUNE_TO = DamageTypeTags.key(ResourceKey.minecraft("wither_immune_to")); private DamageTypeTags() { } - private static Tag key(final ResourceKey key) { - return Tag.of(RegistryTypes.DAMAGE_TYPE, key); + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.DAMAGE_TYPE, key); } } diff --git a/src/main/java/org/spongepowered/api/tag/DefaultedTag.java b/src/main/java/org/spongepowered/api/tag/DefaultedTag.java new file mode 100644 index 00000000000..41d3fe99afd --- /dev/null +++ b/src/main/java/org/spongepowered/api/tag/DefaultedTag.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.tag; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.registry.DefaultedRegistryType; +import org.spongepowered.api.registry.RegistryHolder; +import org.spongepowered.api.registry.ValueNotFoundException; + +import java.util.function.Supplier; +import java.util.stream.Stream; + +/** + * A {@link Tag} paired with the {@link RegistryHolder}. + */ +public interface DefaultedTag extends Tag { + + static DefaultedTag of(final DefaultedRegistryType registryType, final ResourceKey location) { + return Tag.of(registryType, location).asDefaultedTag(registryType.defaultHolder()); + } + + Supplier defaultHolder(); + + /** + * Returns the {@link Stream} of values tagged by this tag. + * + *

    Great care needs to be made in calling this method with any uncertainty as to + * if the {@link #registry()} will exist in the holder. Should the key lack a value, + * a {@link ValueNotFoundException} will be thrown. Therefore, it is advised to call + * {@link #findValues()} instead.

    + * + * @return The {@link Stream} of values + */ + default Stream values() { + return this.defaultHolder().get().registry(this.registry()).taggedValues(this); + } + + /** + * Returns the {@link Stream} of values tagged by this tag in the holder + * if it contains this tag's {@link #registry()}, or {@link Stream#empty()} otherwise. + * + * @return The {@link Stream} of values + */ + default Stream findValues() { + return this.defaultHolder().get().findRegistry(this.registry()).map(r -> r.taggedValues(this)).orElseGet(Stream::empty); + } + + /** + * Returns whether this tag is associated with the given value. + * + * @param value The value + * @return true if this tag is associated with the given value + */ + boolean contains(T value); +} diff --git a/src/main/java/org/spongepowered/api/tag/EnchantmenTypeTags.java b/src/main/java/org/spongepowered/api/tag/EnchantmenTypeTags.java deleted file mode 100644 index 8aa8690bbf8..00000000000 --- a/src/main/java/org/spongepowered/api/tag/EnchantmenTypeTags.java +++ /dev/null @@ -1,90 +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.tag; - -import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.item.enchantment.EnchantmentType; -import org.spongepowered.api.registry.RegistryScope; -import org.spongepowered.api.registry.RegistryScopes; -import org.spongepowered.api.registry.RegistryTypes; - -/** - * - */ -@SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.GAME) -public final class EnchantmenTypeTags { - - public static final Tag CURSE = EnchantmenTypeTags.key(ResourceKey.minecraft("curse")); - - public static final Tag DOUBLE_TRADE_PRICE = EnchantmenTypeTags.key(ResourceKey.minecraft("double_trade_price")); - - public static final Tag EXCLUSIVE_SET_ARMOR = EnchantmenTypeTags.key(ResourceKey.minecraft("exclusive_set/armor")); - - public static final Tag EXCLUSIVE_SET_BOOTS = EnchantmenTypeTags.key(ResourceKey.minecraft("exclusive_set/boots")); - - public static final Tag EXCLUSIVE_SET_BOW = EnchantmenTypeTags.key(ResourceKey.minecraft("exclusive_set/bow")); - - public static final Tag EXCLUSIVE_SET_CROSSBOW = EnchantmenTypeTags.key(ResourceKey.minecraft("exclusive_set/crossbow")); - - public static final Tag EXCLUSIVE_SET_DAMAGE = EnchantmenTypeTags.key(ResourceKey.minecraft("exclusive_set/damage")); - - public static final Tag EXCLUSIVE_SET_MINING = EnchantmenTypeTags.key(ResourceKey.minecraft("exclusive_set/mining")); - - public static final Tag EXCLUSIVE_SET_RIPTIDE = EnchantmenTypeTags.key(ResourceKey.minecraft("exclusive_set/riptide")); - - public static final Tag IN_ENCHANTING_TABLE = EnchantmenTypeTags.key(ResourceKey.minecraft("in_enchanting_table")); - - public static final Tag NON_TREASURE = EnchantmenTypeTags.key(ResourceKey.minecraft("non_treasure")); - - public static final Tag ON_MOB_SPAWN_EQUIPMENT = EnchantmenTypeTags.key(ResourceKey.minecraft("on_mob_spawn_equipment")); - - public static final Tag ON_RANDOM_LOOT = EnchantmenTypeTags.key(ResourceKey.minecraft("on_random_loot")); - - public static final Tag ON_TRADED_EQUIPMENT = EnchantmenTypeTags.key(ResourceKey.minecraft("on_traded_equipment")); - - public static final Tag PREVENTS_BEE_SPAWNS_WHEN_MINING = EnchantmenTypeTags.key(ResourceKey.minecraft("prevents_bee_spawns_when_mining")); - - public static final Tag PREVENTS_DECORATED_POT_SHATTERING = EnchantmenTypeTags.key(ResourceKey.minecraft("prevents_decorated_pot_shattering")); - - public static final Tag PREVENTS_ICE_MELTING = EnchantmenTypeTags.key(ResourceKey.minecraft("prevents_ice_melting")); - - public static final Tag PREVENTS_INFESTED_SPAWNS = EnchantmenTypeTags.key(ResourceKey.minecraft("prevents_infested_spawns")); - - public static final Tag SMELTS_LOOT = EnchantmenTypeTags.key(ResourceKey.minecraft("smelts_loot")); - - public static final Tag TOOLTIP_ORDER = EnchantmenTypeTags.key(ResourceKey.minecraft("tooltip_order")); - - public static final Tag TRADEABLE = EnchantmenTypeTags.key(ResourceKey.minecraft("tradeable")); - - public static final Tag TREASURE = EnchantmenTypeTags.key(ResourceKey.minecraft("treasure")); - - private EnchantmenTypeTags() { - } - - private static Tag key(final ResourceKey key) { - return Tag.of(RegistryTypes.ENCHANTMENT_TYPE, key); - } -} diff --git a/src/main/java/org/spongepowered/api/tag/EnchantmentTypeTags.java b/src/main/java/org/spongepowered/api/tag/EnchantmentTypeTags.java new file mode 100644 index 00000000000..0c1f5e5d981 --- /dev/null +++ b/src/main/java/org/spongepowered/api/tag/EnchantmentTypeTags.java @@ -0,0 +1,90 @@ +/* + * 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.tag; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.item.enchantment.EnchantmentType; +import org.spongepowered.api.registry.RegistryScope; +import org.spongepowered.api.registry.RegistryScopes; +import org.spongepowered.api.registry.RegistryTypes; + +/** + * + */ +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.GAME) +public final class EnchantmentTypeTags { + + public static final DefaultedTag CURSE = EnchantmentTypeTags.key(ResourceKey.minecraft("curse")); + + public static final DefaultedTag DOUBLE_TRADE_PRICE = EnchantmentTypeTags.key(ResourceKey.minecraft("double_trade_price")); + + public static final DefaultedTag EXCLUSIVE_SET_ARMOR = EnchantmentTypeTags.key(ResourceKey.minecraft("exclusive_set/armor")); + + public static final DefaultedTag EXCLUSIVE_SET_BOOTS = EnchantmentTypeTags.key(ResourceKey.minecraft("exclusive_set/boots")); + + public static final DefaultedTag EXCLUSIVE_SET_BOW = EnchantmentTypeTags.key(ResourceKey.minecraft("exclusive_set/bow")); + + public static final DefaultedTag EXCLUSIVE_SET_CROSSBOW = EnchantmentTypeTags.key(ResourceKey.minecraft("exclusive_set/crossbow")); + + public static final DefaultedTag EXCLUSIVE_SET_DAMAGE = EnchantmentTypeTags.key(ResourceKey.minecraft("exclusive_set/damage")); + + public static final DefaultedTag EXCLUSIVE_SET_MINING = EnchantmentTypeTags.key(ResourceKey.minecraft("exclusive_set/mining")); + + public static final DefaultedTag EXCLUSIVE_SET_RIPTIDE = EnchantmentTypeTags.key(ResourceKey.minecraft("exclusive_set/riptide")); + + public static final DefaultedTag IN_ENCHANTING_TABLE = EnchantmentTypeTags.key(ResourceKey.minecraft("in_enchanting_table")); + + public static final DefaultedTag NON_TREASURE = EnchantmentTypeTags.key(ResourceKey.minecraft("non_treasure")); + + public static final DefaultedTag ON_MOB_SPAWN_EQUIPMENT = EnchantmentTypeTags.key(ResourceKey.minecraft("on_mob_spawn_equipment")); + + public static final DefaultedTag ON_RANDOM_LOOT = EnchantmentTypeTags.key(ResourceKey.minecraft("on_random_loot")); + + public static final DefaultedTag ON_TRADED_EQUIPMENT = EnchantmentTypeTags.key(ResourceKey.minecraft("on_traded_equipment")); + + public static final DefaultedTag PREVENTS_BEE_SPAWNS_WHEN_MINING = EnchantmentTypeTags.key(ResourceKey.minecraft("prevents_bee_spawns_when_mining")); + + public static final DefaultedTag PREVENTS_DECORATED_POT_SHATTERING = EnchantmentTypeTags.key(ResourceKey.minecraft("prevents_decorated_pot_shattering")); + + public static final DefaultedTag PREVENTS_ICE_MELTING = EnchantmentTypeTags.key(ResourceKey.minecraft("prevents_ice_melting")); + + public static final DefaultedTag PREVENTS_INFESTED_SPAWNS = EnchantmentTypeTags.key(ResourceKey.minecraft("prevents_infested_spawns")); + + public static final DefaultedTag SMELTS_LOOT = EnchantmentTypeTags.key(ResourceKey.minecraft("smelts_loot")); + + public static final DefaultedTag TOOLTIP_ORDER = EnchantmentTypeTags.key(ResourceKey.minecraft("tooltip_order")); + + public static final DefaultedTag TRADEABLE = EnchantmentTypeTags.key(ResourceKey.minecraft("tradeable")); + + public static final DefaultedTag TREASURE = EnchantmentTypeTags.key(ResourceKey.minecraft("treasure")); + + private EnchantmentTypeTags() { + } + + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.ENCHANTMENT_TYPE, key); + } +} diff --git a/src/main/java/org/spongepowered/api/tag/EntityTypeTags.java b/src/main/java/org/spongepowered/api/tag/EntityTypeTags.java index ae6ce29463e..3e8fc51dbdc 100644 --- a/src/main/java/org/spongepowered/api/tag/EntityTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/EntityTypeTags.java @@ -37,78 +37,102 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class EntityTypeTags { - public static final Tag> AQUATIC = EntityTypeTags.key(ResourceKey.minecraft("aquatic")); + public static final DefaultedTag> ACCEPTS_IRON_GOLEM_GIFT = EntityTypeTags.key(ResourceKey.minecraft("accepts_iron_golem_gift")); - public static final Tag> ARROWS = EntityTypeTags.key(ResourceKey.minecraft("arrows")); + public static final DefaultedTag> AQUATIC = EntityTypeTags.key(ResourceKey.minecraft("aquatic")); - public static final Tag> ARTHROPOD = EntityTypeTags.key(ResourceKey.minecraft("arthropod")); + public static final DefaultedTag> ARROWS = EntityTypeTags.key(ResourceKey.minecraft("arrows")); - public static final Tag> AXOLOTL_ALWAYS_HOSTILES = EntityTypeTags.key(ResourceKey.minecraft("axolotl_always_hostiles")); + public static final DefaultedTag> ARTHROPOD = EntityTypeTags.key(ResourceKey.minecraft("arthropod")); - public static final Tag> AXOLOTL_HUNT_TARGETS = EntityTypeTags.key(ResourceKey.minecraft("axolotl_hunt_targets")); + public static final DefaultedTag> AXOLOTL_ALWAYS_HOSTILES = EntityTypeTags.key(ResourceKey.minecraft("axolotl_always_hostiles")); - public static final Tag> BEEHIVE_INHABITORS = EntityTypeTags.key(ResourceKey.minecraft("beehive_inhabitors")); + public static final DefaultedTag> AXOLOTL_HUNT_TARGETS = EntityTypeTags.key(ResourceKey.minecraft("axolotl_hunt_targets")); - public static final Tag> CAN_BREATHE_UNDER_WATER = EntityTypeTags.key(ResourceKey.minecraft("can_breathe_under_water")); + public static final DefaultedTag> BEEHIVE_INHABITORS = EntityTypeTags.key(ResourceKey.minecraft("beehive_inhabitors")); - public static final Tag> CAN_TURN_IN_BOATS = EntityTypeTags.key(ResourceKey.minecraft("can_turn_in_boats")); + public static final DefaultedTag> BOAT = EntityTypeTags.key(ResourceKey.minecraft("boat")); - public static final Tag> DEFLECTS_PROJECTILES = EntityTypeTags.key(ResourceKey.minecraft("deflects_projectiles")); + public static final DefaultedTag> BURN_IN_DAYLIGHT = EntityTypeTags.key(ResourceKey.minecraft("burn_in_daylight")); - public static final Tag> DISMOUNTS_UNDERWATER = EntityTypeTags.key(ResourceKey.minecraft("dismounts_underwater")); + public static final DefaultedTag> CAN_BREATHE_UNDER_WATER = EntityTypeTags.key(ResourceKey.minecraft("can_breathe_under_water")); - public static final Tag> FALL_DAMAGE_IMMUNE = EntityTypeTags.key(ResourceKey.minecraft("fall_damage_immune")); + public static final DefaultedTag> CAN_EQUIP_HARNESS = EntityTypeTags.key(ResourceKey.minecraft("can_equip_harness")); - public static final Tag> FREEZE_HURTS_EXTRA_TYPES = EntityTypeTags.key(ResourceKey.minecraft("freeze_hurts_extra_types")); + public static final DefaultedTag> CAN_EQUIP_SADDLE = EntityTypeTags.key(ResourceKey.minecraft("can_equip_saddle")); - public static final Tag> FREEZE_IMMUNE_ENTITY_TYPES = EntityTypeTags.key(ResourceKey.minecraft("freeze_immune_entity_types")); + public static final DefaultedTag> CAN_FLOAT_WHILE_RIDDEN = EntityTypeTags.key(ResourceKey.minecraft("can_float_while_ridden")); - public static final Tag> FROG_FOOD = EntityTypeTags.key(ResourceKey.minecraft("frog_food")); + public static final DefaultedTag> CAN_TURN_IN_BOATS = EntityTypeTags.key(ResourceKey.minecraft("can_turn_in_boats")); - public static final Tag> IGNORES_POISON_AND_REGEN = EntityTypeTags.key(ResourceKey.minecraft("ignores_poison_and_regen")); + public static final DefaultedTag> CAN_WEAR_HORSE_ARMOR = EntityTypeTags.key(ResourceKey.minecraft("can_wear_horse_armor")); - public static final Tag> ILLAGER = EntityTypeTags.key(ResourceKey.minecraft("illager")); + public static final DefaultedTag> CAN_WEAR_NAUTILUS_ARMOR = EntityTypeTags.key(ResourceKey.minecraft("can_wear_nautilus_armor")); - public static final Tag> ILLAGER_FRIENDS = EntityTypeTags.key(ResourceKey.minecraft("illager_friends")); + public static final DefaultedTag> CANDIDATE_FOR_IRON_GOLEM_GIFT = EntityTypeTags.key(ResourceKey.minecraft("candidate_for_iron_golem_gift")); - public static final Tag> IMMUNE_TO_INFESTED = EntityTypeTags.key(ResourceKey.minecraft("immune_to_infested")); + public static final DefaultedTag> CANNOT_BE_PUSHED_ONTO_BOATS = EntityTypeTags.key(ResourceKey.minecraft("cannot_be_pushed_onto_boats")); - public static final Tag> IMMUNE_TO_OOZING = EntityTypeTags.key(ResourceKey.minecraft("immune_to_oozing")); + public static final DefaultedTag> DEFLECTS_PROJECTILES = EntityTypeTags.key(ResourceKey.minecraft("deflects_projectiles")); - public static final Tag> IMPACT_PROJECTILES = EntityTypeTags.key(ResourceKey.minecraft("impact_projectiles")); + public static final DefaultedTag> DISMOUNTS_UNDERWATER = EntityTypeTags.key(ResourceKey.minecraft("dismounts_underwater")); - public static final Tag> INVERTED_HEALING_AND_HARM = EntityTypeTags.key(ResourceKey.minecraft("inverted_healing_and_harm")); + public static final DefaultedTag> FALL_DAMAGE_IMMUNE = EntityTypeTags.key(ResourceKey.minecraft("fall_damage_immune")); - public static final Tag> NO_ANGER_FROM_WIND_CHARGE = EntityTypeTags.key(ResourceKey.minecraft("no_anger_from_wind_charge")); + public static final DefaultedTag> FOLLOWABLE_FRIENDLY_MOBS = EntityTypeTags.key(ResourceKey.minecraft("followable_friendly_mobs")); - public static final Tag> NON_CONTROLLING_RIDER = EntityTypeTags.key(ResourceKey.minecraft("non_controlling_rider")); + public static final DefaultedTag> FREEZE_HURTS_EXTRA_TYPES = EntityTypeTags.key(ResourceKey.minecraft("freeze_hurts_extra_types")); - public static final Tag> NOT_SCARY_FOR_PUFFERFISH = EntityTypeTags.key(ResourceKey.minecraft("not_scary_for_pufferfish")); + public static final DefaultedTag> FREEZE_IMMUNE_ENTITY_TYPES = EntityTypeTags.key(ResourceKey.minecraft("freeze_immune_entity_types")); - public static final Tag> POWDER_SNOW_WALKABLE_MOBS = EntityTypeTags.key(ResourceKey.minecraft("powder_snow_walkable_mobs")); + public static final DefaultedTag> FROG_FOOD = EntityTypeTags.key(ResourceKey.minecraft("frog_food")); - public static final Tag> RAIDERS = EntityTypeTags.key(ResourceKey.minecraft("raiders")); + public static final DefaultedTag> IGNORES_POISON_AND_REGEN = EntityTypeTags.key(ResourceKey.minecraft("ignores_poison_and_regen")); - public static final Tag> REDIRECTABLE_PROJECTILE = EntityTypeTags.key(ResourceKey.minecraft("redirectable_projectile")); + public static final DefaultedTag> ILLAGER = EntityTypeTags.key(ResourceKey.minecraft("illager")); - public static final Tag> SENSITIVE_TO_BANE_OF_ARTHROPODS = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_bane_of_arthropods")); + public static final DefaultedTag> ILLAGER_FRIENDS = EntityTypeTags.key(ResourceKey.minecraft("illager_friends")); - public static final Tag> SENSITIVE_TO_IMPALING = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_impaling")); + public static final DefaultedTag> IMMUNE_TO_INFESTED = EntityTypeTags.key(ResourceKey.minecraft("immune_to_infested")); - public static final Tag> SENSITIVE_TO_SMITE = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_smite")); + public static final DefaultedTag> IMMUNE_TO_OOZING = EntityTypeTags.key(ResourceKey.minecraft("immune_to_oozing")); - public static final Tag> SKELETONS = EntityTypeTags.key(ResourceKey.minecraft("skeletons")); + public static final DefaultedTag> IMPACT_PROJECTILES = EntityTypeTags.key(ResourceKey.minecraft("impact_projectiles")); - public static final Tag> UNDEAD = EntityTypeTags.key(ResourceKey.minecraft("undead")); + public static final DefaultedTag> INVERTED_HEALING_AND_HARM = EntityTypeTags.key(ResourceKey.minecraft("inverted_healing_and_harm")); - public static final Tag> WITHER_FRIENDS = EntityTypeTags.key(ResourceKey.minecraft("wither_friends")); + public static final DefaultedTag> NAUTILUS_HOSTILES = EntityTypeTags.key(ResourceKey.minecraft("nautilus_hostiles")); - public static final Tag> ZOMBIES = EntityTypeTags.key(ResourceKey.minecraft("zombies")); + public static final DefaultedTag> NO_ANGER_FROM_WIND_CHARGE = EntityTypeTags.key(ResourceKey.minecraft("no_anger_from_wind_charge")); + + public static final DefaultedTag> NON_CONTROLLING_RIDER = EntityTypeTags.key(ResourceKey.minecraft("non_controlling_rider")); + + public static final DefaultedTag> NOT_SCARY_FOR_PUFFERFISH = EntityTypeTags.key(ResourceKey.minecraft("not_scary_for_pufferfish")); + + public static final DefaultedTag> POWDER_SNOW_WALKABLE_MOBS = EntityTypeTags.key(ResourceKey.minecraft("powder_snow_walkable_mobs")); + + public static final DefaultedTag> RAIDERS = EntityTypeTags.key(ResourceKey.minecraft("raiders")); + + public static final DefaultedTag> REDIRECTABLE_PROJECTILE = EntityTypeTags.key(ResourceKey.minecraft("redirectable_projectile")); + + public static final DefaultedTag> SENSITIVE_TO_BANE_OF_ARTHROPODS = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_bane_of_arthropods")); + + public static final DefaultedTag> SENSITIVE_TO_IMPALING = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_impaling")); + + public static final DefaultedTag> SENSITIVE_TO_SMITE = EntityTypeTags.key(ResourceKey.minecraft("sensitive_to_smite")); + + public static final DefaultedTag> SKELETONS = EntityTypeTags.key(ResourceKey.minecraft("skeletons")); + + public static final DefaultedTag> UNDEAD = EntityTypeTags.key(ResourceKey.minecraft("undead")); + + public static final DefaultedTag> WITHER_FRIENDS = EntityTypeTags.key(ResourceKey.minecraft("wither_friends")); + + public static final DefaultedTag> ZOMBIES = EntityTypeTags.key(ResourceKey.minecraft("zombies")); private EntityTypeTags() { } - private static Tag> key(final ResourceKey key) { - return Tag.of(RegistryTypes.ENTITY_TYPE, key); + private static DefaultedTag> key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.ENTITY_TYPE, key); } } diff --git a/src/main/java/org/spongepowered/api/tag/FluidTypeTags.java b/src/main/java/org/spongepowered/api/tag/FluidTypeTags.java index 7e6e151e92f..303932643cb 100644 --- a/src/main/java/org/spongepowered/api/tag/FluidTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/FluidTypeTags.java @@ -37,14 +37,14 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class FluidTypeTags { - public static final Tag LAVA = FluidTypeTags.key(ResourceKey.minecraft("lava")); + public static final DefaultedTag LAVA = FluidTypeTags.key(ResourceKey.minecraft("lava")); - public static final Tag WATER = FluidTypeTags.key(ResourceKey.minecraft("water")); + public static final DefaultedTag WATER = FluidTypeTags.key(ResourceKey.minecraft("water")); private FluidTypeTags() { } - private static Tag key(final ResourceKey key) { - return Tag.of(RegistryTypes.FLUID_TYPE, key); + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.FLUID_TYPE, key); } } diff --git a/src/main/java/org/spongepowered/api/tag/ItemTypeTags.java b/src/main/java/org/spongepowered/api/tag/ItemTypeTags.java index 0e6b7e6722e..e0ab36c8eb9 100644 --- a/src/main/java/org/spongepowered/api/tag/ItemTypeTags.java +++ b/src/main/java/org/spongepowered/api/tag/ItemTypeTags.java @@ -37,304 +37,406 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class ItemTypeTags { - public static final Tag ACACIA_LOGS = ItemTypeTags.key(ResourceKey.minecraft("acacia_logs")); + public static final DefaultedTag ACACIA_LOGS = ItemTypeTags.key(ResourceKey.minecraft("acacia_logs")); - public static final Tag ANVIL = ItemTypeTags.key(ResourceKey.minecraft("anvil")); + public static final DefaultedTag ANVIL = ItemTypeTags.key(ResourceKey.minecraft("anvil")); - public static final Tag ARMADILLO_FOOD = ItemTypeTags.key(ResourceKey.minecraft("armadillo_food")); + public static final DefaultedTag ARMADILLO_FOOD = ItemTypeTags.key(ResourceKey.minecraft("armadillo_food")); - public static final Tag ARROWS = ItemTypeTags.key(ResourceKey.minecraft("arrows")); + public static final DefaultedTag ARROWS = ItemTypeTags.key(ResourceKey.minecraft("arrows")); - public static final Tag AXES = ItemTypeTags.key(ResourceKey.minecraft("axes")); + public static final DefaultedTag AXES = ItemTypeTags.key(ResourceKey.minecraft("axes")); - public static final Tag AXOLOTL_FOOD = ItemTypeTags.key(ResourceKey.minecraft("axolotl_food")); + public static final DefaultedTag AXOLOTL_FOOD = ItemTypeTags.key(ResourceKey.minecraft("axolotl_food")); - public static final Tag BAMBOO_BLOCKS = ItemTypeTags.key(ResourceKey.minecraft("bamboo_blocks")); + public static final DefaultedTag BAMBOO_BLOCKS = ItemTypeTags.key(ResourceKey.minecraft("bamboo_blocks")); - public static final Tag BANNERS = ItemTypeTags.key(ResourceKey.minecraft("banners")); + public static final DefaultedTag BANNERS = ItemTypeTags.key(ResourceKey.minecraft("banners")); - public static final Tag BEACON_PAYMENT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("beacon_payment_items")); + public static final DefaultedTag BARS = ItemTypeTags.key(ResourceKey.minecraft("bars")); - public static final Tag BEDS = ItemTypeTags.key(ResourceKey.minecraft("beds")); + public static final DefaultedTag BEACON_PAYMENT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("beacon_payment_items")); - public static final Tag BEE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("bee_food")); + public static final DefaultedTag BEDS = ItemTypeTags.key(ResourceKey.minecraft("beds")); - public static final Tag BIRCH_LOGS = ItemTypeTags.key(ResourceKey.minecraft("birch_logs")); + public static final DefaultedTag BEE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("bee_food")); - public static final Tag BOATS = ItemTypeTags.key(ResourceKey.minecraft("boats")); + public static final DefaultedTag BIRCH_LOGS = ItemTypeTags.key(ResourceKey.minecraft("birch_logs")); - public static final Tag BOOKSHELF_BOOKS = ItemTypeTags.key(ResourceKey.minecraft("bookshelf_books")); + public static final DefaultedTag BOATS = ItemTypeTags.key(ResourceKey.minecraft("boats")); - public static final Tag BREAKS_DECORATED_POTS = ItemTypeTags.key(ResourceKey.minecraft("breaks_decorated_pots")); + public static final DefaultedTag BOOK_CLONING_TARGET = ItemTypeTags.key(ResourceKey.minecraft("book_cloning_target")); - public static final Tag BUTTONS = ItemTypeTags.key(ResourceKey.minecraft("buttons")); + public static final DefaultedTag BOOKSHELF_BOOKS = ItemTypeTags.key(ResourceKey.minecraft("bookshelf_books")); - public static final Tag CAMEL_FOOD = ItemTypeTags.key(ResourceKey.minecraft("camel_food")); + public static final DefaultedTag BREAKS_DECORATED_POTS = ItemTypeTags.key(ResourceKey.minecraft("breaks_decorated_pots")); - public static final Tag CANDLES = ItemTypeTags.key(ResourceKey.minecraft("candles")); + public static final DefaultedTag BREWING_FUEL = ItemTypeTags.key(ResourceKey.minecraft("brewing_fuel")); - public static final Tag CAT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("cat_food")); + public static final DefaultedTag BUNDLES = ItemTypeTags.key(ResourceKey.minecraft("bundles")); - public static final Tag CHERRY_LOGS = ItemTypeTags.key(ResourceKey.minecraft("cherry_logs")); + public static final DefaultedTag BUTTONS = ItemTypeTags.key(ResourceKey.minecraft("buttons")); - public static final Tag CHEST_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("chest_armor")); + public static final DefaultedTag CAMEL_FOOD = ItemTypeTags.key(ResourceKey.minecraft("camel_food")); - public static final Tag CHEST_BOATS = ItemTypeTags.key(ResourceKey.minecraft("chest_boats")); + public static final DefaultedTag CAMEL_HUSK_FOOD = ItemTypeTags.key(ResourceKey.minecraft("camel_husk_food")); - public static final Tag CHICKEN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("chicken_food")); + public static final DefaultedTag CANDLES = ItemTypeTags.key(ResourceKey.minecraft("candles")); - public static final Tag CLUSTER_MAX_HARVESTABLES = ItemTypeTags.key(ResourceKey.minecraft("cluster_max_harvestables")); + public static final DefaultedTag CAT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("cat_food")); - public static final Tag COAL_ORES = ItemTypeTags.key(ResourceKey.minecraft("coal_ores")); + public static final DefaultedTag CHAINS = ItemTypeTags.key(ResourceKey.minecraft("chains")); - public static final Tag COALS = ItemTypeTags.key(ResourceKey.minecraft("coals")); + public static final DefaultedTag CHERRY_LOGS = ItemTypeTags.key(ResourceKey.minecraft("cherry_logs")); - public static final Tag COMPASSES = ItemTypeTags.key(ResourceKey.minecraft("compasses")); + public static final DefaultedTag CHEST_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("chest_armor")); - public static final Tag COMPLETES_FIND_TREE_TUTORIAL = ItemTypeTags.key(ResourceKey.minecraft("completes_find_tree_tutorial")); + public static final DefaultedTag CHEST_BOATS = ItemTypeTags.key(ResourceKey.minecraft("chest_boats")); - public static final Tag COPPER_ORES = ItemTypeTags.key(ResourceKey.minecraft("copper_ores")); + public static final DefaultedTag CHICKEN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("chicken_food")); - public static final Tag COW_FOOD = ItemTypeTags.key(ResourceKey.minecraft("cow_food")); + public static final DefaultedTag CLUSTER_MAX_HARVESTABLES = ItemTypeTags.key(ResourceKey.minecraft("cluster_max_harvestables")); - public static final Tag CREEPER_DROP_MUSIC_DISCS = ItemTypeTags.key(ResourceKey.minecraft("creeper_drop_music_discs")); + public static final DefaultedTag COAL_ORES = ItemTypeTags.key(ResourceKey.minecraft("coal_ores")); - public static final Tag CREEPER_IGNITERS = ItemTypeTags.key(ResourceKey.minecraft("creeper_igniters")); + public static final DefaultedTag COALS = ItemTypeTags.key(ResourceKey.minecraft("coals")); - public static final Tag CRIMSON_STEMS = ItemTypeTags.key(ResourceKey.minecraft("crimson_stems")); + public static final DefaultedTag COMPASSES = ItemTypeTags.key(ResourceKey.minecraft("compasses")); - public static final Tag DAMPENS_VIBRATIONS = ItemTypeTags.key(ResourceKey.minecraft("dampens_vibrations")); + public static final DefaultedTag COMPLETES_FIND_TREE_TUTORIAL = ItemTypeTags.key(ResourceKey.minecraft("completes_find_tree_tutorial")); - public static final Tag DARK_OAK_LOGS = ItemTypeTags.key(ResourceKey.minecraft("dark_oak_logs")); + public static final DefaultedTag COPPER = ItemTypeTags.key(ResourceKey.minecraft("copper")); - public static final Tag DECORATED_POT_INGREDIENTS = ItemTypeTags.key(ResourceKey.minecraft("decorated_pot_ingredients")); + public static final DefaultedTag COPPER_CHESTS = ItemTypeTags.key(ResourceKey.minecraft("copper_chests")); - public static final Tag DECORATED_POT_SHERDS = ItemTypeTags.key(ResourceKey.minecraft("decorated_pot_sherds")); + public static final DefaultedTag COPPER_GOLEM_STATUES = ItemTypeTags.key(ResourceKey.minecraft("copper_golem_statues")); - public static final Tag DIAMOND_ORES = ItemTypeTags.key(ResourceKey.minecraft("diamond_ores")); + public static final DefaultedTag COPPER_ORES = ItemTypeTags.key(ResourceKey.minecraft("copper_ores")); - public static final Tag DIRT = ItemTypeTags.key(ResourceKey.minecraft("dirt")); + public static final DefaultedTag COPPER_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("copper_tool_materials")); - public static final Tag DOORS = ItemTypeTags.key(ResourceKey.minecraft("doors")); + public static final DefaultedTag COW_FOOD = ItemTypeTags.key(ResourceKey.minecraft("cow_food")); - public static final Tag DYEABLE = ItemTypeTags.key(ResourceKey.minecraft("dyeable")); + public static final DefaultedTag CREEPER_DROP_MUSIC_DISCS = ItemTypeTags.key(ResourceKey.minecraft("creeper_drop_music_discs")); - public static final Tag EMERALD_ORES = ItemTypeTags.key(ResourceKey.minecraft("emerald_ores")); + public static final DefaultedTag CREEPER_IGNITERS = ItemTypeTags.key(ResourceKey.minecraft("creeper_igniters")); - public static final Tag ENCHANTABLE_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/armor")); + public static final DefaultedTag CRIMSON_STEMS = ItemTypeTags.key(ResourceKey.minecraft("crimson_stems")); - public static final Tag ENCHANTABLE_BOW = ItemTypeTags.key(ResourceKey.minecraft("enchantable/bow")); + public static final DefaultedTag DAMPENS_VIBRATIONS = ItemTypeTags.key(ResourceKey.minecraft("dampens_vibrations")); - public static final Tag ENCHANTABLE_CHEST_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/chest_armor")); + public static final DefaultedTag DARK_OAK_LOGS = ItemTypeTags.key(ResourceKey.minecraft("dark_oak_logs")); - public static final Tag ENCHANTABLE_CROSSBOW = ItemTypeTags.key(ResourceKey.minecraft("enchantable/crossbow")); + public static final DefaultedTag DECORATED_POT_INGREDIENTS = ItemTypeTags.key(ResourceKey.minecraft("decorated_pot_ingredients")); - public static final Tag ENCHANTABLE_DURABILITY = ItemTypeTags.key(ResourceKey.minecraft("enchantable/durability")); + public static final DefaultedTag DECORATED_POT_SHERDS = ItemTypeTags.key(ResourceKey.minecraft("decorated_pot_sherds")); - public static final Tag ENCHANTABLE_EQUIPPABLE = ItemTypeTags.key(ResourceKey.minecraft("enchantable/equippable")); + public static final DefaultedTag DIAMOND_ORES = ItemTypeTags.key(ResourceKey.minecraft("diamond_ores")); - public static final Tag ENCHANTABLE_FIRE_ASPECT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/fire_aspect")); + public static final DefaultedTag DIAMOND_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("diamond_tool_materials")); - public static final Tag ENCHANTABLE_FISHING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/fishing")); + public static final DefaultedTag DIRT = ItemTypeTags.key(ResourceKey.minecraft("dirt")); - public static final Tag ENCHANTABLE_FOOT_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/foot_armor")); + public static final DefaultedTag DOORS = ItemTypeTags.key(ResourceKey.minecraft("doors")); - public static final Tag ENCHANTABLE_HEAD_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/head_armor")); + public static final DefaultedTag DROWNED_PREFERRED_WEAPONS = ItemTypeTags.key(ResourceKey.minecraft("drowned_preferred_weapons")); - public static final Tag ENCHANTABLE_LEG_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/leg_armor")); + public static final DefaultedTag DUPLICATES_ALLAYS = ItemTypeTags.key(ResourceKey.minecraft("duplicates_allays")); - public static final Tag ENCHANTABLE_MACE = ItemTypeTags.key(ResourceKey.minecraft("enchantable/mace")); + public static final DefaultedTag DYEABLE = ItemTypeTags.key(ResourceKey.minecraft("dyeable")); - public static final Tag ENCHANTABLE_MINING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/mining")); + public static final DefaultedTag EGGS = ItemTypeTags.key(ResourceKey.minecraft("eggs")); - public static final Tag ENCHANTABLE_MINING_LOOT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/mining_loot")); + public static final DefaultedTag EMERALD_ORES = ItemTypeTags.key(ResourceKey.minecraft("emerald_ores")); - public static final Tag ENCHANTABLE_SHARP_WEAPON = ItemTypeTags.key(ResourceKey.minecraft("enchantable/sharp_weapon")); + public static final DefaultedTag ENCHANTABLE_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/armor")); - public static final Tag ENCHANTABLE_SWORD = ItemTypeTags.key(ResourceKey.minecraft("enchantable/sword")); + public static final DefaultedTag ENCHANTABLE_BOW = ItemTypeTags.key(ResourceKey.minecraft("enchantable/bow")); - public static final Tag ENCHANTABLE_TRIDENT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/trident")); + public static final DefaultedTag ENCHANTABLE_CHEST_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/chest_armor")); - public static final Tag ENCHANTABLE_VANISHING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/vanishing")); + public static final DefaultedTag ENCHANTABLE_CROSSBOW = ItemTypeTags.key(ResourceKey.minecraft("enchantable/crossbow")); - public static final Tag ENCHANTABLE_WEAPON = ItemTypeTags.key(ResourceKey.minecraft("enchantable/weapon")); + public static final DefaultedTag ENCHANTABLE_DURABILITY = ItemTypeTags.key(ResourceKey.minecraft("enchantable/durability")); - public static final Tag FENCE_GATES = ItemTypeTags.key(ResourceKey.minecraft("fence_gates")); + public static final DefaultedTag ENCHANTABLE_EQUIPPABLE = ItemTypeTags.key(ResourceKey.minecraft("enchantable/equippable")); - public static final Tag FENCES = ItemTypeTags.key(ResourceKey.minecraft("fences")); + public static final DefaultedTag ENCHANTABLE_FIRE_ASPECT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/fire_aspect")); - public static final Tag FISHES = ItemTypeTags.key(ResourceKey.minecraft("fishes")); + public static final DefaultedTag ENCHANTABLE_FISHING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/fishing")); - public static final Tag FLOWERS = ItemTypeTags.key(ResourceKey.minecraft("flowers")); + public static final DefaultedTag ENCHANTABLE_FOOT_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/foot_armor")); - public static final Tag FOOT_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("foot_armor")); + public static final DefaultedTag ENCHANTABLE_HEAD_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/head_armor")); - public static final Tag FOX_FOOD = ItemTypeTags.key(ResourceKey.minecraft("fox_food")); + public static final DefaultedTag ENCHANTABLE_LEG_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("enchantable/leg_armor")); - public static final Tag FREEZE_IMMUNE_WEARABLES = ItemTypeTags.key(ResourceKey.minecraft("freeze_immune_wearables")); + public static final DefaultedTag ENCHANTABLE_LUNGE = ItemTypeTags.key(ResourceKey.minecraft("enchantable/lunge")); - public static final Tag FROG_FOOD = ItemTypeTags.key(ResourceKey.minecraft("frog_food")); + public static final DefaultedTag ENCHANTABLE_MACE = ItemTypeTags.key(ResourceKey.minecraft("enchantable/mace")); - public static final Tag GOAT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("goat_food")); + public static final DefaultedTag ENCHANTABLE_MELEE_WEAPON = ItemTypeTags.key(ResourceKey.minecraft("enchantable/melee_weapon")); - public static final Tag GOLD_ORES = ItemTypeTags.key(ResourceKey.minecraft("gold_ores")); + public static final DefaultedTag ENCHANTABLE_MINING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/mining")); - public static final Tag HANGING_SIGNS = ItemTypeTags.key(ResourceKey.minecraft("hanging_signs")); + public static final DefaultedTag ENCHANTABLE_MINING_LOOT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/mining_loot")); - public static final Tag HEAD_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("head_armor")); + public static final DefaultedTag ENCHANTABLE_SHARP_WEAPON = ItemTypeTags.key(ResourceKey.minecraft("enchantable/sharp_weapon")); - public static final Tag HOES = ItemTypeTags.key(ResourceKey.minecraft("hoes")); + public static final DefaultedTag ENCHANTABLE_SWEEPING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/sweeping")); - public static final Tag HOGLIN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("hoglin_food")); + public static final DefaultedTag ENCHANTABLE_TRIDENT = ItemTypeTags.key(ResourceKey.minecraft("enchantable/trident")); - public static final Tag HORSE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("horse_food")); + public static final DefaultedTag ENCHANTABLE_VANISHING = ItemTypeTags.key(ResourceKey.minecraft("enchantable/vanishing")); - public static final Tag HORSE_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("horse_tempt_items")); + public static final DefaultedTag ENCHANTABLE_WEAPON = ItemTypeTags.key(ResourceKey.minecraft("enchantable/weapon")); - public static final Tag IGNORED_BY_PIGLIN_BABIES = ItemTypeTags.key(ResourceKey.minecraft("ignored_by_piglin_babies")); + public static final DefaultedTag FENCE_GATES = ItemTypeTags.key(ResourceKey.minecraft("fence_gates")); - public static final Tag IRON_ORES = ItemTypeTags.key(ResourceKey.minecraft("iron_ores")); + public static final DefaultedTag FENCES = ItemTypeTags.key(ResourceKey.minecraft("fences")); - public static final Tag JUNGLE_LOGS = ItemTypeTags.key(ResourceKey.minecraft("jungle_logs")); + public static final DefaultedTag FISHES = ItemTypeTags.key(ResourceKey.minecraft("fishes")); - public static final Tag LAPIS_ORES = ItemTypeTags.key(ResourceKey.minecraft("lapis_ores")); + public static final DefaultedTag FLOWERS = ItemTypeTags.key(ResourceKey.minecraft("flowers")); - public static final Tag LEAVES = ItemTypeTags.key(ResourceKey.minecraft("leaves")); + public static final DefaultedTag FOOT_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("foot_armor")); - public static final Tag LECTERN_BOOKS = ItemTypeTags.key(ResourceKey.minecraft("lectern_books")); + public static final DefaultedTag FOX_FOOD = ItemTypeTags.key(ResourceKey.minecraft("fox_food")); - public static final Tag LEG_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("leg_armor")); + public static final DefaultedTag FREEZE_IMMUNE_WEARABLES = ItemTypeTags.key(ResourceKey.minecraft("freeze_immune_wearables")); - public static final Tag LLAMA_FOOD = ItemTypeTags.key(ResourceKey.minecraft("llama_food")); + public static final DefaultedTag FROG_FOOD = ItemTypeTags.key(ResourceKey.minecraft("frog_food")); - public static final Tag LLAMA_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("llama_tempt_items")); + public static final DefaultedTag FURNACE_MINECART_FUEL = ItemTypeTags.key(ResourceKey.minecraft("furnace_minecart_fuel")); - public static final Tag LOGS = ItemTypeTags.key(ResourceKey.minecraft("logs")); + public static final DefaultedTag GAZE_DISGUISE_EQUIPMENT = ItemTypeTags.key(ResourceKey.minecraft("gaze_disguise_equipment")); - public static final Tag LOGS_THAT_BURN = ItemTypeTags.key(ResourceKey.minecraft("logs_that_burn")); + public static final DefaultedTag GOAT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("goat_food")); - public static final Tag MANGROVE_LOGS = ItemTypeTags.key(ResourceKey.minecraft("mangrove_logs")); + public static final DefaultedTag GOLD_ORES = ItemTypeTags.key(ResourceKey.minecraft("gold_ores")); - public static final Tag MEAT = ItemTypeTags.key(ResourceKey.minecraft("meat")); + public static final DefaultedTag GOLD_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("gold_tool_materials")); - public static final Tag NON_FLAMMABLE_WOOD = ItemTypeTags.key(ResourceKey.minecraft("non_flammable_wood")); + public static final DefaultedTag HANGING_SIGNS = ItemTypeTags.key(ResourceKey.minecraft("hanging_signs")); - public static final Tag NOTEBLOCK_TOP_INSTRUMENTS = ItemTypeTags.key(ResourceKey.minecraft("noteblock_top_instruments")); + public static final DefaultedTag HAPPY_GHAST_FOOD = ItemTypeTags.key(ResourceKey.minecraft("happy_ghast_food")); - public static final Tag OAK_LOGS = ItemTypeTags.key(ResourceKey.minecraft("oak_logs")); + public static final DefaultedTag HAPPY_GHAST_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("happy_ghast_tempt_items")); - public static final Tag OCELOT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("ocelot_food")); + public static final DefaultedTag HARNESSES = ItemTypeTags.key(ResourceKey.minecraft("harnesses")); - public static final Tag PANDA_FOOD = ItemTypeTags.key(ResourceKey.minecraft("panda_food")); + public static final DefaultedTag HEAD_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("head_armor")); - public static final Tag PARROT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("parrot_food")); + public static final DefaultedTag HOES = ItemTypeTags.key(ResourceKey.minecraft("hoes")); - public static final Tag PARROT_POISONOUS_FOOD = ItemTypeTags.key(ResourceKey.minecraft("parrot_poisonous_food")); + public static final DefaultedTag HOGLIN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("hoglin_food")); - public static final Tag PICKAXES = ItemTypeTags.key(ResourceKey.minecraft("pickaxes")); + public static final DefaultedTag HORSE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("horse_food")); - public static final Tag PIG_FOOD = ItemTypeTags.key(ResourceKey.minecraft("pig_food")); + public static final DefaultedTag HORSE_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("horse_tempt_items")); - public static final Tag PIGLIN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("piglin_food")); + public static final DefaultedTag IGNORED_BY_PIGLIN_BABIES = ItemTypeTags.key(ResourceKey.minecraft("ignored_by_piglin_babies")); - public static final Tag PIGLIN_LOVED = ItemTypeTags.key(ResourceKey.minecraft("piglin_loved")); + public static final DefaultedTag IRON_ORES = ItemTypeTags.key(ResourceKey.minecraft("iron_ores")); - public static final Tag PIGLIN_REPELLENTS = ItemTypeTags.key(ResourceKey.minecraft("piglin_repellents")); + public static final DefaultedTag IRON_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("iron_tool_materials")); - public static final Tag PLANKS = ItemTypeTags.key(ResourceKey.minecraft("planks")); + public static final DefaultedTag JUNGLE_LOGS = ItemTypeTags.key(ResourceKey.minecraft("jungle_logs")); - public static final Tag RABBIT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("rabbit_food")); + public static final DefaultedTag LANTERNS = ItemTypeTags.key(ResourceKey.minecraft("lanterns")); - public static final Tag RAILS = ItemTypeTags.key(ResourceKey.minecraft("rails")); + public static final DefaultedTag LAPIS_ORES = ItemTypeTags.key(ResourceKey.minecraft("lapis_ores")); - public static final Tag REDSTONE_ORES = ItemTypeTags.key(ResourceKey.minecraft("redstone_ores")); + public static final DefaultedTag LEAVES = ItemTypeTags.key(ResourceKey.minecraft("leaves")); - public static final Tag SAND = ItemTypeTags.key(ResourceKey.minecraft("sand")); + public static final DefaultedTag LECTERN_BOOKS = ItemTypeTags.key(ResourceKey.minecraft("lectern_books")); - public static final Tag SAPLINGS = ItemTypeTags.key(ResourceKey.minecraft("saplings")); + public static final DefaultedTag LEG_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("leg_armor")); - public static final Tag SHEEP_FOOD = ItemTypeTags.key(ResourceKey.minecraft("sheep_food")); + public static final DefaultedTag LIGHTNING_RODS = ItemTypeTags.key(ResourceKey.minecraft("lightning_rods")); - public static final Tag SHOVELS = ItemTypeTags.key(ResourceKey.minecraft("shovels")); + public static final DefaultedTag LLAMA_FOOD = ItemTypeTags.key(ResourceKey.minecraft("llama_food")); - public static final Tag SIGNS = ItemTypeTags.key(ResourceKey.minecraft("signs")); + public static final DefaultedTag LLAMA_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("llama_tempt_items")); - public static final Tag SKULLS = ItemTypeTags.key(ResourceKey.minecraft("skulls")); + public static final DefaultedTag LOGS = ItemTypeTags.key(ResourceKey.minecraft("logs")); - public static final Tag SLABS = ItemTypeTags.key(ResourceKey.minecraft("slabs")); + public static final DefaultedTag LOGS_THAT_BURN = ItemTypeTags.key(ResourceKey.minecraft("logs_that_burn")); - public static final Tag SMALL_FLOWERS = ItemTypeTags.key(ResourceKey.minecraft("small_flowers")); + public static final DefaultedTag MANGROVE_LOGS = ItemTypeTags.key(ResourceKey.minecraft("mangrove_logs")); - public static final Tag SMELTS_TO_GLASS = ItemTypeTags.key(ResourceKey.minecraft("smelts_to_glass")); + public static final DefaultedTag MAP_INVISIBILITY_EQUIPMENT = ItemTypeTags.key(ResourceKey.minecraft("map_invisibility_equipment")); - public static final Tag SNIFFER_FOOD = ItemTypeTags.key(ResourceKey.minecraft("sniffer_food")); + public static final DefaultedTag MEAT = ItemTypeTags.key(ResourceKey.minecraft("meat")); - public static final Tag SOUL_FIRE_BASE_BLOCKS = ItemTypeTags.key(ResourceKey.minecraft("soul_fire_base_blocks")); + public static final DefaultedTag NAUTILUS_BUCKET_FOOD = ItemTypeTags.key(ResourceKey.minecraft("nautilus_bucket_food")); - public static final Tag SPRUCE_LOGS = ItemTypeTags.key(ResourceKey.minecraft("spruce_logs")); + public static final DefaultedTag NAUTILUS_FOOD = ItemTypeTags.key(ResourceKey.minecraft("nautilus_food")); - public static final Tag STAIRS = ItemTypeTags.key(ResourceKey.minecraft("stairs")); + public static final DefaultedTag NAUTILUS_TAMING_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("nautilus_taming_items")); - public static final Tag STONE_BRICKS = ItemTypeTags.key(ResourceKey.minecraft("stone_bricks")); + public static final DefaultedTag NETHERITE_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("netherite_tool_materials")); - public static final Tag STONE_BUTTONS = ItemTypeTags.key(ResourceKey.minecraft("stone_buttons")); + public static final DefaultedTag NON_FLAMMABLE_WOOD = ItemTypeTags.key(ResourceKey.minecraft("non_flammable_wood")); - public static final Tag STONE_CRAFTING_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("stone_crafting_materials")); + public static final DefaultedTag NOTEBLOCK_TOP_INSTRUMENTS = ItemTypeTags.key(ResourceKey.minecraft("noteblock_top_instruments")); - public static final Tag STONE_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("stone_tool_materials")); + public static final DefaultedTag OAK_LOGS = ItemTypeTags.key(ResourceKey.minecraft("oak_logs")); - public static final Tag STRIDER_FOOD = ItemTypeTags.key(ResourceKey.minecraft("strider_food")); + public static final DefaultedTag OCELOT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("ocelot_food")); - public static final Tag STRIDER_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("strider_tempt_items")); + public static final DefaultedTag PALE_OAK_LOGS = ItemTypeTags.key(ResourceKey.minecraft("pale_oak_logs")); - public static final Tag SWORDS = ItemTypeTags.key(ResourceKey.minecraft("swords")); + public static final DefaultedTag PANDA_EATS_FROM_GROUND = ItemTypeTags.key(ResourceKey.minecraft("panda_eats_from_ground")); - public static final Tag TALL_FLOWERS = ItemTypeTags.key(ResourceKey.minecraft("tall_flowers")); + public static final DefaultedTag PANDA_FOOD = ItemTypeTags.key(ResourceKey.minecraft("panda_food")); - public static final Tag TERRACOTTA = ItemTypeTags.key(ResourceKey.minecraft("terracotta")); + public static final DefaultedTag PARROT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("parrot_food")); - public static final Tag TRAPDOORS = ItemTypeTags.key(ResourceKey.minecraft("trapdoors")); + public static final DefaultedTag PARROT_POISONOUS_FOOD = ItemTypeTags.key(ResourceKey.minecraft("parrot_poisonous_food")); - public static final Tag TRIM_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("trim_materials")); + public static final DefaultedTag PICKAXES = ItemTypeTags.key(ResourceKey.minecraft("pickaxes")); - public static final Tag TRIM_TEMPLATES = ItemTypeTags.key(ResourceKey.minecraft("trim_templates")); + public static final DefaultedTag PIG_FOOD = ItemTypeTags.key(ResourceKey.minecraft("pig_food")); - public static final Tag TRIMMABLE_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("trimmable_armor")); + public static final DefaultedTag PIGLIN_FOOD = ItemTypeTags.key(ResourceKey.minecraft("piglin_food")); - public static final Tag TURTLE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("turtle_food")); + public static final DefaultedTag PIGLIN_LOVED = ItemTypeTags.key(ResourceKey.minecraft("piglin_loved")); - public static final Tag VILLAGER_PLANTABLE_SEEDS = ItemTypeTags.key(ResourceKey.minecraft("villager_plantable_seeds")); + public static final DefaultedTag PIGLIN_PREFERRED_WEAPONS = ItemTypeTags.key(ResourceKey.minecraft("piglin_preferred_weapons")); - public static final Tag WALLS = ItemTypeTags.key(ResourceKey.minecraft("walls")); + public static final DefaultedTag PIGLIN_REPELLENTS = ItemTypeTags.key(ResourceKey.minecraft("piglin_repellents")); - public static final Tag WARPED_STEMS = ItemTypeTags.key(ResourceKey.minecraft("warped_stems")); + public static final DefaultedTag PIGLIN_SAFE_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("piglin_safe_armor")); - public static final Tag WART_BLOCKS = ItemTypeTags.key(ResourceKey.minecraft("wart_blocks")); + public static final DefaultedTag PILLAGER_PREFERRED_WEAPONS = ItemTypeTags.key(ResourceKey.minecraft("pillager_preferred_weapons")); - public static final Tag WOLF_FOOD = ItemTypeTags.key(ResourceKey.minecraft("wolf_food")); + public static final DefaultedTag PLANKS = ItemTypeTags.key(ResourceKey.minecraft("planks")); - public static final Tag WOODEN_BUTTONS = ItemTypeTags.key(ResourceKey.minecraft("wooden_buttons")); + public static final DefaultedTag RABBIT_FOOD = ItemTypeTags.key(ResourceKey.minecraft("rabbit_food")); - public static final Tag WOODEN_DOORS = ItemTypeTags.key(ResourceKey.minecraft("wooden_doors")); + public static final DefaultedTag RAILS = ItemTypeTags.key(ResourceKey.minecraft("rails")); - public static final Tag WOODEN_FENCES = ItemTypeTags.key(ResourceKey.minecraft("wooden_fences")); + public static final DefaultedTag REDSTONE_ORES = ItemTypeTags.key(ResourceKey.minecraft("redstone_ores")); - public static final Tag WOODEN_PRESSURE_PLATES = ItemTypeTags.key(ResourceKey.minecraft("wooden_pressure_plates")); + public static final DefaultedTag REPAIRS_CHAIN_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("repairs_chain_armor")); - public static final Tag WOODEN_SLABS = ItemTypeTags.key(ResourceKey.minecraft("wooden_slabs")); + public static final DefaultedTag REPAIRS_COPPER_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("repairs_copper_armor")); - public static final Tag WOODEN_STAIRS = ItemTypeTags.key(ResourceKey.minecraft("wooden_stairs")); + public static final DefaultedTag REPAIRS_DIAMOND_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("repairs_diamond_armor")); - public static final Tag WOODEN_TRAPDOORS = ItemTypeTags.key(ResourceKey.minecraft("wooden_trapdoors")); + public static final DefaultedTag REPAIRS_GOLD_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("repairs_gold_armor")); - public static final Tag WOOL = ItemTypeTags.key(ResourceKey.minecraft("wool")); + public static final DefaultedTag REPAIRS_IRON_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("repairs_iron_armor")); - public static final Tag WOOL_CARPETS = ItemTypeTags.key(ResourceKey.minecraft("wool_carpets")); + public static final DefaultedTag REPAIRS_LEATHER_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("repairs_leather_armor")); + + public static final DefaultedTag REPAIRS_NETHERITE_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("repairs_netherite_armor")); + + public static final DefaultedTag REPAIRS_TURTLE_HELMET = ItemTypeTags.key(ResourceKey.minecraft("repairs_turtle_helmet")); + + public static final DefaultedTag REPAIRS_WOLF_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("repairs_wolf_armor")); + + public static final DefaultedTag SAND = ItemTypeTags.key(ResourceKey.minecraft("sand")); + + public static final DefaultedTag SAPLINGS = ItemTypeTags.key(ResourceKey.minecraft("saplings")); + + public static final DefaultedTag SHEARABLE_FROM_COPPER_GOLEM = ItemTypeTags.key(ResourceKey.minecraft("shearable_from_copper_golem")); + + public static final DefaultedTag SHEEP_FOOD = ItemTypeTags.key(ResourceKey.minecraft("sheep_food")); + + public static final DefaultedTag SHOVELS = ItemTypeTags.key(ResourceKey.minecraft("shovels")); + + public static final DefaultedTag SHULKER_BOXES = ItemTypeTags.key(ResourceKey.minecraft("shulker_boxes")); + + public static final DefaultedTag SIGNS = ItemTypeTags.key(ResourceKey.minecraft("signs")); + + public static final DefaultedTag SKELETON_PREFERRED_WEAPONS = ItemTypeTags.key(ResourceKey.minecraft("skeleton_preferred_weapons")); + + public static final DefaultedTag SKULLS = ItemTypeTags.key(ResourceKey.minecraft("skulls")); + + public static final DefaultedTag SLABS = ItemTypeTags.key(ResourceKey.minecraft("slabs")); + + public static final DefaultedTag SMALL_FLOWERS = ItemTypeTags.key(ResourceKey.minecraft("small_flowers")); + + public static final DefaultedTag SMELTS_TO_GLASS = ItemTypeTags.key(ResourceKey.minecraft("smelts_to_glass")); + + public static final DefaultedTag SNIFFER_FOOD = ItemTypeTags.key(ResourceKey.minecraft("sniffer_food")); + + public static final DefaultedTag SOUL_FIRE_BASE_BLOCKS = ItemTypeTags.key(ResourceKey.minecraft("soul_fire_base_blocks")); + + public static final DefaultedTag SPEARS = ItemTypeTags.key(ResourceKey.minecraft("spears")); + + public static final DefaultedTag SPRUCE_LOGS = ItemTypeTags.key(ResourceKey.minecraft("spruce_logs")); + + public static final DefaultedTag STAIRS = ItemTypeTags.key(ResourceKey.minecraft("stairs")); + + public static final DefaultedTag STONE_BRICKS = ItemTypeTags.key(ResourceKey.minecraft("stone_bricks")); + + public static final DefaultedTag STONE_BUTTONS = ItemTypeTags.key(ResourceKey.minecraft("stone_buttons")); + + public static final DefaultedTag STONE_CRAFTING_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("stone_crafting_materials")); + + public static final DefaultedTag STONE_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("stone_tool_materials")); + + public static final DefaultedTag STRIDER_FOOD = ItemTypeTags.key(ResourceKey.minecraft("strider_food")); + + public static final DefaultedTag STRIDER_TEMPT_ITEMS = ItemTypeTags.key(ResourceKey.minecraft("strider_tempt_items")); + + public static final DefaultedTag SWORDS = ItemTypeTags.key(ResourceKey.minecraft("swords")); + + public static final DefaultedTag TERRACOTTA = ItemTypeTags.key(ResourceKey.minecraft("terracotta")); + + public static final DefaultedTag TRAPDOORS = ItemTypeTags.key(ResourceKey.minecraft("trapdoors")); + + public static final DefaultedTag TRIM_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("trim_materials")); + + public static final DefaultedTag TRIMMABLE_ARMOR = ItemTypeTags.key(ResourceKey.minecraft("trimmable_armor")); + + public static final DefaultedTag TURTLE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("turtle_food")); + + public static final DefaultedTag VILLAGER_PICKS_UP = ItemTypeTags.key(ResourceKey.minecraft("villager_picks_up")); + + public static final DefaultedTag VILLAGER_PLANTABLE_SEEDS = ItemTypeTags.key(ResourceKey.minecraft("villager_plantable_seeds")); + + public static final DefaultedTag WALLS = ItemTypeTags.key(ResourceKey.minecraft("walls")); + + public static final DefaultedTag WARPED_STEMS = ItemTypeTags.key(ResourceKey.minecraft("warped_stems")); + + public static final DefaultedTag WART_BLOCKS = ItemTypeTags.key(ResourceKey.minecraft("wart_blocks")); + + public static final DefaultedTag WITHER_SKELETON_DISLIKED_WEAPONS = ItemTypeTags.key(ResourceKey.minecraft("wither_skeleton_disliked_weapons")); + + public static final DefaultedTag WOLF_FOOD = ItemTypeTags.key(ResourceKey.minecraft("wolf_food")); + + public static final DefaultedTag WOODEN_BUTTONS = ItemTypeTags.key(ResourceKey.minecraft("wooden_buttons")); + + public static final DefaultedTag WOODEN_DOORS = ItemTypeTags.key(ResourceKey.minecraft("wooden_doors")); + + public static final DefaultedTag WOODEN_FENCES = ItemTypeTags.key(ResourceKey.minecraft("wooden_fences")); + + public static final DefaultedTag WOODEN_PRESSURE_PLATES = ItemTypeTags.key(ResourceKey.minecraft("wooden_pressure_plates")); + + public static final DefaultedTag WOODEN_SHELVES = ItemTypeTags.key(ResourceKey.minecraft("wooden_shelves")); + + public static final DefaultedTag WOODEN_SLABS = ItemTypeTags.key(ResourceKey.minecraft("wooden_slabs")); + + public static final DefaultedTag WOODEN_STAIRS = ItemTypeTags.key(ResourceKey.minecraft("wooden_stairs")); + + public static final DefaultedTag WOODEN_TOOL_MATERIALS = ItemTypeTags.key(ResourceKey.minecraft("wooden_tool_materials")); + + public static final DefaultedTag WOODEN_TRAPDOORS = ItemTypeTags.key(ResourceKey.minecraft("wooden_trapdoors")); + + public static final DefaultedTag WOOL = ItemTypeTags.key(ResourceKey.minecraft("wool")); + + public static final DefaultedTag WOOL_CARPETS = ItemTypeTags.key(ResourceKey.minecraft("wool_carpets")); + + public static final DefaultedTag ZOMBIE_HORSE_FOOD = ItemTypeTags.key(ResourceKey.minecraft("zombie_horse_food")); private ItemTypeTags() { } - private static Tag key(final ResourceKey key) { - return Tag.of(RegistryTypes.ITEM_TYPE, key); + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.ITEM_TYPE, key); } } diff --git a/src/main/java/org/spongepowered/api/tag/StructureTags.java b/src/main/java/org/spongepowered/api/tag/StructureTags.java new file mode 100644 index 00000000000..e1c64144e40 --- /dev/null +++ b/src/main/java/org/spongepowered/api/tag/StructureTags.java @@ -0,0 +1,86 @@ +/* + * 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.tag; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.registry.RegistryScope; +import org.spongepowered.api.registry.RegistryScopes; +import org.spongepowered.api.registry.RegistryTypes; +import org.spongepowered.api.world.generation.structure.Structure; + +/** + * + */ +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.GAME) +public final class StructureTags { + + public static final DefaultedTag CATS_SPAWN_AS_BLACK = StructureTags.key(ResourceKey.minecraft("cats_spawn_as_black")); + + public static final DefaultedTag CATS_SPAWN_IN = StructureTags.key(ResourceKey.minecraft("cats_spawn_in")); + + public static final DefaultedTag DOLPHIN_LOCATED = StructureTags.key(ResourceKey.minecraft("dolphin_located")); + + public static final DefaultedTag EYE_OF_ENDER_LOCATED = StructureTags.key(ResourceKey.minecraft("eye_of_ender_located")); + + public static final DefaultedTag MINESHAFT = StructureTags.key(ResourceKey.minecraft("mineshaft")); + + public static final DefaultedTag OCEAN_RUIN = StructureTags.key(ResourceKey.minecraft("ocean_ruin")); + + public static final DefaultedTag ON_DESERT_VILLAGE_MAPS = StructureTags.key(ResourceKey.minecraft("on_desert_village_maps")); + + public static final DefaultedTag ON_JUNGLE_EXPLORER_MAPS = StructureTags.key(ResourceKey.minecraft("on_jungle_explorer_maps")); + + public static final DefaultedTag ON_OCEAN_EXPLORER_MAPS = StructureTags.key(ResourceKey.minecraft("on_ocean_explorer_maps")); + + public static final DefaultedTag ON_PLAINS_VILLAGE_MAPS = StructureTags.key(ResourceKey.minecraft("on_plains_village_maps")); + + public static final DefaultedTag ON_SAVANNA_VILLAGE_MAPS = StructureTags.key(ResourceKey.minecraft("on_savanna_village_maps")); + + public static final DefaultedTag ON_SNOWY_VILLAGE_MAPS = StructureTags.key(ResourceKey.minecraft("on_snowy_village_maps")); + + public static final DefaultedTag ON_SWAMP_EXPLORER_MAPS = StructureTags.key(ResourceKey.minecraft("on_swamp_explorer_maps")); + + public static final DefaultedTag ON_TAIGA_VILLAGE_MAPS = StructureTags.key(ResourceKey.minecraft("on_taiga_village_maps")); + + public static final DefaultedTag ON_TREASURE_MAPS = StructureTags.key(ResourceKey.minecraft("on_treasure_maps")); + + public static final DefaultedTag ON_TRIAL_CHAMBERS_MAPS = StructureTags.key(ResourceKey.minecraft("on_trial_chambers_maps")); + + public static final DefaultedTag ON_WOODLAND_EXPLORER_MAPS = StructureTags.key(ResourceKey.minecraft("on_woodland_explorer_maps")); + + public static final DefaultedTag RUINED_PORTAL = StructureTags.key(ResourceKey.minecraft("ruined_portal")); + + public static final DefaultedTag SHIPWRECK = StructureTags.key(ResourceKey.minecraft("shipwreck")); + + public static final DefaultedTag VILLAGE = StructureTags.key(ResourceKey.minecraft("village")); + + private StructureTags() { + } + + private static DefaultedTag key(final ResourceKey key) { + return DefaultedTag.of(RegistryTypes.STRUCTURE, key); + } +} diff --git a/src/main/java/org/spongepowered/api/tag/Tag.java b/src/main/java/org/spongepowered/api/tag/Tag.java index 42d4b2f4a73..0e237911f5b 100644 --- a/src/main/java/org/spongepowered/api/tag/Tag.java +++ b/src/main/java/org/spongepowered/api/tag/Tag.java @@ -29,9 +29,11 @@ import org.spongepowered.api.ResourceKeyed; import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockType; -import org.spongepowered.api.registry.DefaultedRegistryType; +import org.spongepowered.api.registry.RegistryHolder; import org.spongepowered.api.registry.RegistryType; +import java.util.function.Supplier; + /** * A {@link ResourceKey resource keyed} collection of {@link Taggable} values * (of type {@code T}). @@ -50,6 +52,10 @@ */ public interface Tag extends ResourceKeyed { + static Tag of(final RegistryType registryType, final ResourceKey key) { + return Sponge.game().factoryProvider().provide(Tag.Factory.class).of(registryType, key); + } + /** * Gets the {@link RegistryType location} defining the parent registry. * @@ -57,19 +63,11 @@ public interface Tag extends ResourceKeyed { */ RegistryType registry(); - interface Factory { - default Tag of(DefaultedRegistryType registryType, ResourceKey key) { - return this.of((RegistryType) registryType, key); - } + DefaultedTag asDefaultedTag(Supplier holder); - Tag of(RegistryType registryType, ResourceKey key); - } + DefaultedTag asScopedTag(); - static Tag of(DefaultedRegistryType registryType, ResourceKey key) { - return Sponge.game().factoryProvider().provide(Tag.Factory.class).of(registryType, key); - } - - static Tag of(RegistryType registryType, ResourceKey key) { - return Sponge.game().factoryProvider().provide(Tag.Factory.class).of(registryType, key); + interface Factory { + Tag of(RegistryType registryType, ResourceKey key); } } diff --git a/src/main/java/org/spongepowered/api/tag/TagTemplate.java b/src/main/java/org/spongepowered/api/tag/TagTemplate.java deleted file mode 100644 index 138f4a1ae78..00000000000 --- a/src/main/java/org/spongepowered/api/tag/TagTemplate.java +++ /dev/null @@ -1,250 +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.tag; - -import org.checkerframework.checker.nullness.qual.NonNull; -import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPack; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.event.lifecycle.RegisterDataPackValueEvent; -import org.spongepowered.api.registry.RegistryKey; -import org.spongepowered.api.registry.RegistryType; - -import java.util.Collection; -import java.util.Map; - -/** - * A template that creates a or modifies a {@link Tag}. - */ -public interface TagTemplate> extends DataPackEntry> { - - /** - * Returns a {@link Builder} that creates {@link TagTemplate}s. - * - * @param pack The {@link DataPack} of the builder - * @return The builder. - */ - static > Builder builder(final DataPack> pack) { - return Sponge.game().factoryProvider().provide(Factory.class).builder(pack); - } - - interface Builder> extends org.spongepowered.api.util.ResourceKeyedBuilder, Builder> { - - /** - * Sets whether the values contained by a tag template will replace - * existing values if a tag with the same {@link #key()} and - * {@link RegistryType} already exists when datapacks are (re)loaded. - * - *

    If this is set to {@code true}, any previous entries for this - * given key-tag type combination will be discarded and the data - * in the built template will replace the data. If - * this is set to {@code false}, the entries in this template will - * be merged with any existing data. The default - * behavior is to merge data.

    - * - *

    As no guarantees are made to the order in which templates are - * applied when datapacks are (re)loaded, note that replacement will - * only act upon templates that have previously been applied.

    - * - * @param replace Whether to replace instead of merge. - * @return This builder, for chaining. - */ - Builder replace(boolean replace); - - /** - * Indicates that any existing values of a tag with the same - * {@link #key()} and {@link RegistryType} during datapack (re)loading will - * have their values discarded and replaced by this template. - * - * @see #replace(boolean) - * @return This builder, for chaining - */ - default Builder replace() { - return this.replace(true); - } - - /** - * Adds the {@link RegistryKey} for a value to the builder. - * - *

    As the objects that this tag will contain may be available at this - * stage, their {@link ResourceKey resource key ID} should be provided - * instead. However, this gives rise to the possibility that a value - * may not be available when tags are generated. The behavior during tag - * generation if the a value for the supplied key is not present can be - * controlled with the argument passed to the {@code required} - * parameter:

    - * - *
      - *
    • if {@code true}, the entire tag will not be applied.
    • - *
    • if {@code false}, the tag will be applied without the value. - *
    • - *
    - * - * @param value Value to add - * @param required Whether this tag should fail to load if - * the value is not found while loading. - * @return This builder, for chaining - */ - Builder addValue(RegistryKey value, boolean required); - - /** - * Adds the {@link RegistryKey} for a value to the builder, marking it - * as required. - * - * @see #addValue(RegistryKey, boolean) - * @param value Value to add - * @return This builder, for chaining - */ - default Builder addValue(final RegistryKey value) { - return this.addValue(value, true); - } - - /** - * Adds a collection of {@link RegistryKey}s for values to this builder. - * - * @see #addValue(RegistryKey, boolean) - * @param values Values to add - * @param required Whether the values are required. If required, - * the tag will fail to load if they are not found - * while loading. - * @return This builder, for chaining. - */ - Builder addValues(Collection> values, boolean required); - - /** - * Adds a collection of {@link RegistryKey}s for values to this builder, - * marking all as required. - * - * @see #addValue(RegistryKey, boolean) - * @param values Values to add - * @return This builder, for chaining. - */ - default Builder addValues(final Collection> values) { - return this.addValues(values, true); - } - - /** - * Marks a tag with a given {@link RegistryKey} as a child of the tag - * generated by this template. - * - *

    A child {@link Tag} is considered a subset of its parent, that is, - * the tag generated from this template will include all values from all - * its children, as well as those directly provided via the addValue(s) - * methods.

    - * - *

    As {@link Tag}s may not be available at this stage, their - * {@link #key()} should be provided instead. If the key does not point - * to a valid tag (or tag template) when datapacks are reloaded, the - * argument supplied to {@code required} determines whether this tag - * is ultimately generated, that is, if the supplied child key does - * not represent a tag:

    - * - *
      - *
    • if {@code true}, no tag will be generated.
    • - *
    • if {@code false}, a tag will be generated without the given - * child.
    • - *
    - * - * @param childTag {@link RegistryKey} for tag to be added. - * @param required Whether loading this tag should fail if the child tag is not found. - * @return This builder, for chaining - */ - Builder addChild(final Tag childTag, final boolean required); - - /** - * Marks a tag with a given {@link RegistryKey} as a required child of - * the tag generated by this template. - * - * @see #addChild(Tag) - * @param childTag {@link RegistryKey} for tag to be added. - * @return This builder, for chaining - */ - default Builder addChild(final Tag childTag) { - return this.addChild(childTag, true); - } - - /** - * Adds a child tag to this builder, using a {@link TagTemplate}. - * - * @see #addChild(Tag, boolean) - * @param childTag The child to be added. - * @return This builder, for chaining - * @throws IllegalArgumentException If this TagTemplate is not the same {@link RegistryType} - * as this builder. - */ - Builder addChild(TagTemplate childTag) throws IllegalArgumentException; - - /** - * Adds multiple children to this template. - * - * @see #addChild(Tag, boolean) - * @param children Children to add. - * @param required Whether to fail loading the tag if these children are - * not found. - * @return This builder, for chaining - */ - Builder addChildren(Collection> children, boolean required); - - /** - * Adds multiple required children to this template. - * - * @see #addChild(Tag, boolean) - * @param children Children to add. - * @return This builder, for chaining - */ - default Builder addChildren(final Collection> children) { - return this.addChildren(children, true); - } - - /** - * Adds multiple required children to this template, where each - * key-value pair in this map represents a child {@link ResourceKey} - * and whether the child is required. - * - * @see #addChild(Tag, boolean) - * @param childrenMap Map of children, RegistryKey - * @return This builder, for chaining. - */ - Builder addChildren(Map, Boolean> childrenMap); - - /** - * Creates a {@link TagTemplate} that should be registered during the - * {@link RegisterDataPackValueEvent}. - * - * @return The built {@link TagTemplate}. - */ - @Override - @NonNull TagTemplate build(); - - } - - interface Factory { - - > Builder builder(DataPack> pack); - - } - -} diff --git a/src/main/java/org/spongepowered/api/tag/Taggable.java b/src/main/java/org/spongepowered/api/tag/Taggable.java index 716e2042175..962412e47bc 100644 --- a/src/main/java/org/spongepowered/api/tag/Taggable.java +++ b/src/main/java/org/spongepowered/api/tag/Taggable.java @@ -26,35 +26,29 @@ import org.spongepowered.api.registry.DefaultedRegistryType; import org.spongepowered.api.registry.DefaultedRegistryValue; -import org.spongepowered.api.registry.RegistryType; -import java.util.Collection; +import java.util.stream.Stream; /** * A type that may be included in one or more {@link Tag} collections. */ -public interface Taggable> extends DefaultedRegistryValue { +public interface Taggable> extends DefaultedRegistryValue { /** - * Gets the {@link RegistryType} that holds the types of {@link Tag tags} - * that can be associated with this object. + * Gets all {@link Tag}s that have been associated with this object in the given registry. * - * @return The {@link RegistryType} + * @return The {@link Stream} of {@link Tag}s. */ - DefaultedRegistryType registryType(); + Stream> tags(DefaultedRegistryType registryType); /** - * Gets all {@link Tag tags} that have been associated with this object. + * Returns whether the given tag is associated with this object. * - * @return The {@link Collection} of {@link Tag}s. - */ - Collection> tags(); - - /** - * Returns true when given tag is associated with this object * @param tag The tag - * @return true when given tag is associated with this object + * @return true if the given tag is associated with this object */ - boolean is(Tag tag); - + @SuppressWarnings("unchecked") + default boolean is(DefaultedTag tag) { + return tag.contains((T) this); + } } diff --git a/src/main/java/org/spongepowered/api/util/DataPackEntryBuilder.java b/src/main/java/org/spongepowered/api/util/DataPackEntryBuilder.java deleted file mode 100644 index b4395134fd9..00000000000 --- a/src/main/java/org/spongepowered/api/util/DataPackEntryBuilder.java +++ /dev/null @@ -1,63 +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.util; - -import org.spongepowered.api.data.persistence.DataView; -import org.spongepowered.api.datapack.DataPack; -import org.spongepowered.api.datapack.DataPackEntry; - -import java.io.IOException; - -public interface DataPackEntryBuilder, B extends DataPackEntryBuilder> extends - ResourceKeyedBuilder, - CopyableBuilder { - - /** - * Sets the data pack - * - * @param pack The data pack - * @return This builder, for chaining - */ - B pack(DataPack pack); - - /** - * Initializes the builder with given value. - * - * @param value The template value - * @return This builder, for chaining - */ - B fromValue(T value); - - /** - * Initializes the builder with the data from given {@link DataView}. - *

    {@link DataPackEntry#toContainer()}

    - * - * @param datapack The data pack entry data - * @return This builder, for chaining - */ - B fromDataPack(DataView datapack) throws IOException; - - -} diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/AbsoluteSortPosition.java b/src/main/java/org/spongepowered/api/util/annotation/eventgen/AbsoluteSortPosition.java deleted file mode 100644 index 1a3cd472954..00000000000 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/AbsoluteSortPosition.java +++ /dev/null @@ -1,55 +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.util.annotation.eventgen; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Used to indicate the absolute position of a property when sorted. - * - *

    A value of 0 indicates that a property would always be sorted first, - * a value of 1 indicates that a property would always be sorted second, - * and so on.

    - * - *

    If a gap is left in the absolute ordering of properties, the - * next-highest-numbered property will be placed next. For example, - * properties with the absolute ordering 0, 1, and 3 will still be adjacent to - * each other.

    - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface AbsoluteSortPosition { - - /** - * Gets the absolute position for the annotated property. - * - * @return the absolute position - */ - int value(); - -} diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/FactoryMethod.java b/src/main/java/org/spongepowered/api/util/annotation/eventgen/FactoryMethod.java deleted file mode 100644 index 53def2d9327..00000000000 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/FactoryMethod.java +++ /dev/null @@ -1,45 +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.util.annotation.eventgen; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Marks the annotated method as a factory method. - * A matching method will be generated in the factory class, which forwards - * to this method. - * - *

    This annotation can be used to make backwards-compatible - * changes to an event class. By creating a method matching the old - * factory method signature, code expecting the old event signature - * will continue to function.

    - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface FactoryMethod { -} diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/ImplementedBy.java b/src/main/java/org/spongepowered/api/util/annotation/eventgen/ImplementedBy.java deleted file mode 100644 index a9d133ba950..00000000000 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/ImplementedBy.java +++ /dev/null @@ -1,59 +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.util.annotation.eventgen; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Used to indicate the base class that a generated event class extends from. - */ -@Inherited -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface ImplementedBy { - - /** - * Gets the class which serves as the base class which the generated class - * for this event interface will extend. - * - * @return The base class to use - */ - Class value(); - - /** - * Gets the priority for this annotation, relative to other annotations in - * the same hierarchy of the event interface. - * - *

    The annotation with the highest priority will be used.

    - * - * @return The priority to use - */ - int priority() default 1; - -} diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/PropertySettings.java b/src/main/java/org/spongepowered/api/util/annotation/eventgen/PropertySettings.java deleted file mode 100644 index 4f0eb1c25b0..00000000000 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/PropertySettings.java +++ /dev/null @@ -1,64 +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.util.annotation.eventgen; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Used to specify the settings used when generating code for a property. - * - *

    This annotation should always be placed on the getter method of a - * property.

    - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface PropertySettings { - - /** - * Indicates whether the annotated property is required to be passed in - * to the generated constructor. - * - * @return Whether the annotated property is required to be passed in to - * the generated constructor. - */ - boolean requiredParameter() default true; - - /** - * Indicates whether the annotated property should have methods generated - * for it. - * - *

    If this value is set to true, - * {@link #requiredParameter()} can only be set to false if - * the annotated property is a primitive.

    - * - * @return Whether the annotated property should have methods generated - * for it. - */ - boolean generateMethods() default true; - -} diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/TransformResult.java b/src/main/java/org/spongepowered/api/util/annotation/eventgen/TransformResult.java deleted file mode 100644 index 86b8cbfcb21..00000000000 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/TransformResult.java +++ /dev/null @@ -1,58 +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.util.annotation.eventgen; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Used to indicate that the return type of a method should be transformed by - * calling a method on it, indicated by the {@link TransformWith} annotation. - * - *

    This annotation should be placed on the method with the least specific - * return type, if covariant return types are used.

    - * - *

    The return type of the annotation, or a superclass/superinterface of it, - * must have a method annotated with {@link TransformWith}, with a matching - * {@link #value()}.

    - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface TransformResult { - - /** - * Gets the name used to match this annotation to a {@link TransformWith} - * annotation. - * - *

    Changing this is only necessary when multiple {@link TransformWith} - * annotations are present in the annotated method's return type's class. - *

    - * - * @return The name to use - */ - String value() default ""; -} diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/TransformWith.java b/src/main/java/org/spongepowered/api/util/annotation/eventgen/TransformWith.java deleted file mode 100644 index 71574ca4f1c..00000000000 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/TransformWith.java +++ /dev/null @@ -1,58 +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.util.annotation.eventgen; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Used to indicate a method that will be called from the method with the - * corresponding {@link TransformResult} annotation. - * - *

    This annotation should be placed on the method with the least specific - * return type, if covariant return types are used.

    - * - *

    The method annotated with this annotation must either return - * an instance of the method's class, or Object (for compatibility with - * generics).

    - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface TransformWith { - - /** - * Gets the name used to match this annotation to a {@link TransformResult} - * annotation. - * - *

    Changing this is only necessary when this annotation is present on - * multiple methods in a class, or its superinterfaces/superclass.

    - * - * @return The name to use - */ - String value() default ""; - -} diff --git a/src/main/java/org/spongepowered/api/util/annotation/eventgen/UseField.java b/src/main/java/org/spongepowered/api/util/annotation/eventgen/UseField.java deleted file mode 100644 index 71df58e886a..00000000000 --- a/src/main/java/org/spongepowered/api/util/annotation/eventgen/UseField.java +++ /dev/null @@ -1,55 +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.util.annotation.eventgen; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Used to mark fields which should be used by the class generator. - * - *

    The class generator will reference the annotated field when - * generating methods, and set it from the constructor arguments

    - * - *

    Any field in an abstract class without this field will not be - * set automatically, even if it matches a property from the implemented - * event.

    - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface UseField { - - /** - * Indicates whether to use the annotated field directly in the - * generated '{@link #toString()}' method, rather than calling the - * normal accessor method. - * - * @return Whether to override the toString - */ - boolean overrideToString() default false; - -} diff --git a/src/main/java/org/spongepowered/api/util/mirror/Mirror.java b/src/main/java/org/spongepowered/api/util/mirror/Mirror.java index 96543f071b1..284abe64250 100644 --- a/src/main/java/org/spongepowered/api/util/mirror/Mirror.java +++ b/src/main/java/org/spongepowered/api/util/mirror/Mirror.java @@ -24,10 +24,11 @@ */ package org.spongepowered.api.util.mirror; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(Mirrors.class) -public interface Mirror extends DefaultedRegistryValue { +public interface Mirror extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/util/orientation/Orientation.java b/src/main/java/org/spongepowered/api/util/orientation/Orientation.java index c2fe1574719..bb745c3fa72 100644 --- a/src/main/java/org/spongepowered/api/util/orientation/Orientation.java +++ b/src/main/java/org/spongepowered/api/util/orientation/Orientation.java @@ -34,7 +34,7 @@ * Represents an orientation in relative for an ItemFrame as an example. */ @CatalogedBy(Orientations.class) -public interface Orientation extends DefaultedRegistryValue { +public interface Orientation extends DefaultedRegistryValue { /** * Gets the {@link Orientation} that represents the provided {@link Angle}. diff --git a/src/main/java/org/spongepowered/api/util/rotation/Rotation.java b/src/main/java/org/spongepowered/api/util/rotation/Rotation.java index 1c03888f80a..174128e3475 100644 --- a/src/main/java/org/spongepowered/api/util/rotation/Rotation.java +++ b/src/main/java/org/spongepowered/api/util/rotation/Rotation.java @@ -24,13 +24,14 @@ */ package org.spongepowered.api.util.rotation; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.Angle; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.math.matrix.Matrix4d; @CatalogedBy(Rotations.class) -public interface Rotation extends DefaultedRegistryValue { +public interface Rotation extends DefaultedRegistryValue, StringRepresentable { Rotation and(final Rotation rotation); diff --git a/src/main/java/org/spongepowered/api/world/BlockChangeFlag.java b/src/main/java/org/spongepowered/api/world/BlockChangeFlag.java index af63cd3725b..a35bb3e07e8 100644 --- a/src/main/java/org/spongepowered/api/world/BlockChangeFlag.java +++ b/src/main/java/org/spongepowered/api/world/BlockChangeFlag.java @@ -26,6 +26,7 @@ import org.spongepowered.api.block.BlockTypes; import org.spongepowered.api.block.entity.BlockEntity; +import org.spongepowered.api.block.entity.carrier.chest.Chest; /** * A flag of sorts that determines whether a block change will perform various @@ -104,9 +105,8 @@ public interface BlockChangeFlag { /** * Gets whether this flag is considering that blocks are being moved * in the world, much like how pistons will move blocks. This has some - * effect on {@link org.spongepowered.api.block.entity.BlockEntity} creation - * reaction or drop delays. The behaviors are dependent on the block in - * particular. + * effect on {@link BlockEntity} creation reaction or drop delays. The + * behaviors are dependent on the block in particular. * * @return True if the flag is considering blocks are moving */ @@ -137,7 +137,8 @@ public interface BlockChangeFlag { /** * Gets whatever this block change is going to perform natural * block destruction logic, which can potentially cause other - * side effects like block drops from a {@link BlockEntity}. + * side effects like block drops from a {@link BlockEntity}, + * like a {@link Chest chest} dropping its contents. * The behaviors are dependent on the block in particular. * * @return True if the block change should perform diff --git a/src/main/java/org/spongepowered/api/world/ChunkRegenerateFlag.java b/src/main/java/org/spongepowered/api/world/ChunkRegenerateFlag.java index 2a664bb49fc..cec31697f08 100644 --- a/src/main/java/org/spongepowered/api/world/ChunkRegenerateFlag.java +++ b/src/main/java/org/spongepowered/api/world/ChunkRegenerateFlag.java @@ -32,7 +32,7 @@ * various tasks such as creating a chunk, or preserving entities. */ @CatalogedBy(ChunkRegenerateFlags.class) -public interface ChunkRegenerateFlag extends DefaultedRegistryValue { +public interface ChunkRegenerateFlag extends DefaultedRegistryValue { /** * Gets whether this flag defines that a chunk should be created if it does diff --git a/src/main/java/org/spongepowered/api/world/HeightType.java b/src/main/java/org/spongepowered/api/world/HeightType.java index 6f8a4b273e6..b1b790cea1d 100644 --- a/src/main/java/org/spongepowered/api/world/HeightType.java +++ b/src/main/java/org/spongepowered/api/world/HeightType.java @@ -25,12 +25,13 @@ package org.spongepowered.api.world; import org.spongepowered.api.block.BlockState; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.BlockReaderAwareMatcher; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(HeightTypes.class) -public interface HeightType extends DefaultedRegistryValue { +public interface HeightType extends DefaultedRegistryValue, StringRepresentable { BlockReaderAwareMatcher matcher(); diff --git a/src/main/java/org/spongepowered/api/world/LightType.java b/src/main/java/org/spongepowered/api/world/LightType.java index bccccb6f9ae..6c4512d2bf9 100644 --- a/src/main/java/org/spongepowered/api/world/LightType.java +++ b/src/main/java/org/spongepowered/api/world/LightType.java @@ -29,7 +29,7 @@ import org.spongepowered.api.world.volume.game.EnvironmentalVolume; @CatalogedBy(LightTypes.class) -public interface LightType extends DefaultedRegistryValue { +public interface LightType extends DefaultedRegistryValue { /** * Gets the default light value for this light type. Useful diff --git a/src/main/java/org/spongepowered/api/world/World.java b/src/main/java/org/spongepowered/api/world/World.java index 40f46a19d86..8e2162488e7 100644 --- a/src/main/java/org/spongepowered/api/world/World.java +++ b/src/main/java/org/spongepowered/api/world/World.java @@ -29,7 +29,9 @@ import org.spongepowered.api.effect.Viewer; import org.spongepowered.api.entity.Entity; import org.spongepowered.api.entity.living.player.Player; +import org.spongepowered.api.event.CauseStackManager; import org.spongepowered.api.registry.RegistryHolder; +import org.spongepowered.api.scheduler.Scheduler; import org.spongepowered.api.service.context.ContextSource; import org.spongepowered.api.util.annotation.DoNotStore; import org.spongepowered.api.world.chunk.WorldChunk; @@ -227,4 +229,38 @@ default Optional loadChunk(final Vector3i chunkPosition, final boole */ Iterable loadedChunks(); + /** + * Gets the {@link Scheduler} used to schedule sync tasks on this {@link World}. + * + *

    Note: Accessing objects outside of this {@link World} + * from the scheduled tasks can lead to hard to diagnose problems + * or unrecoverable crashes.

    + * + * @return The sync scheduler + */ + default Scheduler scheduler() { + return this.engine().scheduler(); + } + + /** + * Gets the {@link CauseStackManager} for handling the current event cause + * stack and context information. + * + *

    Note: Accessing this outside of {@link World#onWorldThread()} + * can lead to hard to diagnose problems or unrecoverable crashes.

    + * + * @return The cause stack manager + */ + default CauseStackManager causeStackManager() { + return this.engine().causeStackManager(); + } + + /** + * Checks if the {@link Thread#currentThread() current thread} is the main thread of the world. + * + * @return {@code true} if main thread, {@code false} if not + */ + default boolean onWorldThread() { + return this.engine().onMainThread(); + } } diff --git a/src/main/java/org/spongepowered/api/world/WorldType.java b/src/main/java/org/spongepowered/api/world/WorldType.java index f30e912d7c7..417b4cd4300 100644 --- a/src/main/java/org/spongepowered/api/world/WorldType.java +++ b/src/main/java/org/spongepowered/api/world/WorldType.java @@ -24,11 +24,25 @@ */ package org.spongepowered.api.world; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.data.Key; +import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.service.context.ContextSource; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(WorldTypes.class) -public interface WorldType extends DefaultedRegistryValue, ContextSource, WorldTypeDataFetcher { +public interface WorldType extends DefaultedRegistryValue, ContextSource, WorldTypeDataFetcher, DataPackSerializable { + static WorldType.Builder builder() { + return Sponge.game().builderProvider().provide(WorldType.Builder.class); + } + + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + Builder add(Key> key, V value); + } } diff --git a/src/main/java/org/spongepowered/api/world/WorldTypeTemplate.java b/src/main/java/org/spongepowered/api/world/WorldTypeTemplate.java deleted file mode 100644 index dbf335ea1be..00000000000 --- a/src/main/java/org/spongepowered/api/world/WorldTypeTemplate.java +++ /dev/null @@ -1,80 +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; - -import org.spongepowered.api.Sponge; -import org.spongepowered.api.data.Key; -import org.spongepowered.api.data.persistence.DataView; -import org.spongepowered.api.data.value.Value; -import org.spongepowered.api.datapack.DataPack; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; - -import java.io.IOException; - -/** - * A template for a {@link WorldType}. - */ -public interface WorldTypeTemplate extends DataPackEntry, WorldTypeDataFetcher { - - static WorldTypeTemplate.Builder overworld() { - return WorldTypeTemplate.builder().fromValue(WorldTypes.OVERWORLD.get()); - } - - static WorldTypeTemplate.Builder overworldCaves() { - return WorldTypeTemplate.builder().fromValue(WorldTypes.OVERWORLD_CAVES.get()); - } - - static WorldTypeTemplate.Builder theNether() { - return WorldTypeTemplate.builder().fromValue(WorldTypes.THE_NETHER.get()); - } - - static WorldTypeTemplate.Builder theEnd() { - return WorldTypeTemplate.builder().fromValue(WorldTypes.THE_END.get()); - } - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - interface Builder extends DataPackEntryBuilder { - - Builder add(Key> key, V value); - - /** - * Creates a world template based on the given data view. - *

    The given data must be equivalent to a data-pack for world-templates (dimension)

    - * - * @param pack The data - * @return This builder, for chaining - */ - Builder fromDataPack(DataView pack) throws IOException; - - Builder from(WorldType type); - - Builder pack(DataPack pack); - } - -} diff --git a/src/main/java/org/spongepowered/api/world/WorldTypes.java b/src/main/java/org/spongepowered/api/world/WorldTypes.java index aca95c6a74a..e6e0f068afa 100644 --- a/src/main/java/org/spongepowered/api/world/WorldTypes.java +++ b/src/main/java/org/spongepowered/api/world/WorldTypes.java @@ -56,6 +56,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.WORLD_TYPE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.WORLD_TYPE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/biome/Biome.java b/src/main/java/org/spongepowered/api/world/biome/Biome.java index 15051bf2356..6178b61114c 100644 --- a/src/main/java/org/spongepowered/api/world/biome/Biome.java +++ b/src/main/java/org/spongepowered/api/world/biome/Biome.java @@ -24,15 +24,21 @@ */ package org.spongepowered.api.world.biome; +import org.spongepowered.api.Sponge; import org.spongepowered.api.data.DataHolder; +import org.spongepowered.api.data.Key; import org.spongepowered.api.data.Keys; +import org.spongepowered.api.data.value.Value; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.effect.sound.SoundType; import org.spongepowered.api.entity.EntityCategories; import org.spongepowered.api.entity.EntityCategory; import org.spongepowered.api.entity.EntityType; import org.spongepowered.api.entity.living.golem.SnowGolem; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.tag.Taggable; import org.spongepowered.api.util.Color; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.world.biome.ambient.ParticleConfig; import org.spongepowered.api.world.biome.ambient.SoundConfig; @@ -42,7 +48,6 @@ import org.spongepowered.api.world.biome.spawner.NaturalSpawnCost; import org.spongepowered.api.world.biome.spawner.NaturalSpawner; import org.spongepowered.api.world.generation.carver.Carver; -import org.spongepowered.api.world.generation.carver.CarvingStep; import org.spongepowered.api.world.generation.feature.DecorationStep; import org.spongepowered.api.world.generation.feature.PlacedFeature; @@ -54,7 +59,16 @@ * Represents a biome. */ @CatalogedBy(Biomes.class) -public interface Biome extends DataHolder, Taggable { +public interface Biome extends DefaultedRegistryValue, DataHolder, Taggable, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create a {@link Biome}. + * + * @return The new builder + */ + static Builder builder() { + return Sponge.game().builderProvider().provide(Builder.class); + } // Biome Climate @@ -116,7 +130,7 @@ default TemperatureModifier temperatureModifier() { * * @return The carvers */ - default Map> carvers() { + default List carvers() { return this.require(Keys.CARVERS); } @@ -271,4 +285,19 @@ default Optional backgroundMusic() { return this.get(Keys.BACKGROUND_MUSIC); } + /** + * A builder to create {@link Biome}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Adds the given {@link Key} with the given value. + * + * @param key The key to assign the value with + * @param value The value to assign with the key + * @param The type of the value + * @return This builder, for chaining + */ + Builder add(Key> key, V value); + } } diff --git a/src/main/java/org/spongepowered/api/world/biome/Biomes.java b/src/main/java/org/spongepowered/api/world/biome/Biomes.java index 046c61934ec..b2603f37611 100644 --- a/src/main/java/org/spongepowered/api/world/biome/Biomes.java +++ b/src/main/java/org/spongepowered/api/world/biome/Biomes.java @@ -25,157 +25,159 @@ package org.spongepowered.api.world.biome; 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.RegistryReference; import org.spongepowered.api.registry.RegistryScope; import org.spongepowered.api.registry.RegistryScopes; import org.spongepowered.api.registry.RegistryTypes; -import org.spongepowered.api.world.server.ServerWorld; /** * */ @SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.WORLD) +@RegistryScopes(scopes = RegistryScope.ENGINE) public final class Biomes { - public static final RegistryReference BADLANDS = Biomes.key(ResourceKey.minecraft("badlands")); + public static final DefaultedRegistryReference BADLANDS = Biomes.key(ResourceKey.minecraft("badlands")); - public static final RegistryReference BAMBOO_JUNGLE = Biomes.key(ResourceKey.minecraft("bamboo_jungle")); + public static final DefaultedRegistryReference BAMBOO_JUNGLE = Biomes.key(ResourceKey.minecraft("bamboo_jungle")); - public static final RegistryReference BASALT_DELTAS = Biomes.key(ResourceKey.minecraft("basalt_deltas")); + public static final DefaultedRegistryReference BASALT_DELTAS = Biomes.key(ResourceKey.minecraft("basalt_deltas")); - public static final RegistryReference BEACH = Biomes.key(ResourceKey.minecraft("beach")); + public static final DefaultedRegistryReference BEACH = Biomes.key(ResourceKey.minecraft("beach")); - public static final RegistryReference BIRCH_FOREST = Biomes.key(ResourceKey.minecraft("birch_forest")); + public static final DefaultedRegistryReference BIRCH_FOREST = Biomes.key(ResourceKey.minecraft("birch_forest")); - public static final RegistryReference CHERRY_GROVE = Biomes.key(ResourceKey.minecraft("cherry_grove")); + public static final DefaultedRegistryReference CHERRY_GROVE = Biomes.key(ResourceKey.minecraft("cherry_grove")); - public static final RegistryReference COLD_OCEAN = Biomes.key(ResourceKey.minecraft("cold_ocean")); + public static final DefaultedRegistryReference COLD_OCEAN = Biomes.key(ResourceKey.minecraft("cold_ocean")); - public static final RegistryReference CRIMSON_FOREST = Biomes.key(ResourceKey.minecraft("crimson_forest")); + public static final DefaultedRegistryReference CRIMSON_FOREST = Biomes.key(ResourceKey.minecraft("crimson_forest")); - public static final RegistryReference DARK_FOREST = Biomes.key(ResourceKey.minecraft("dark_forest")); + public static final DefaultedRegistryReference DARK_FOREST = Biomes.key(ResourceKey.minecraft("dark_forest")); - public static final RegistryReference DEEP_COLD_OCEAN = Biomes.key(ResourceKey.minecraft("deep_cold_ocean")); + public static final DefaultedRegistryReference DEEP_COLD_OCEAN = Biomes.key(ResourceKey.minecraft("deep_cold_ocean")); - public static final RegistryReference DEEP_DARK = Biomes.key(ResourceKey.minecraft("deep_dark")); + public static final DefaultedRegistryReference DEEP_DARK = Biomes.key(ResourceKey.minecraft("deep_dark")); - public static final RegistryReference DEEP_FROZEN_OCEAN = Biomes.key(ResourceKey.minecraft("deep_frozen_ocean")); + public static final DefaultedRegistryReference DEEP_FROZEN_OCEAN = Biomes.key(ResourceKey.minecraft("deep_frozen_ocean")); - public static final RegistryReference DEEP_LUKEWARM_OCEAN = Biomes.key(ResourceKey.minecraft("deep_lukewarm_ocean")); + public static final DefaultedRegistryReference DEEP_LUKEWARM_OCEAN = Biomes.key(ResourceKey.minecraft("deep_lukewarm_ocean")); - public static final RegistryReference DEEP_OCEAN = Biomes.key(ResourceKey.minecraft("deep_ocean")); + public static final DefaultedRegistryReference DEEP_OCEAN = Biomes.key(ResourceKey.minecraft("deep_ocean")); - public static final RegistryReference DESERT = Biomes.key(ResourceKey.minecraft("desert")); + public static final DefaultedRegistryReference DESERT = Biomes.key(ResourceKey.minecraft("desert")); - public static final RegistryReference DRIPSTONE_CAVES = Biomes.key(ResourceKey.minecraft("dripstone_caves")); + public static final DefaultedRegistryReference DRIPSTONE_CAVES = Biomes.key(ResourceKey.minecraft("dripstone_caves")); - public static final RegistryReference END_BARRENS = Biomes.key(ResourceKey.minecraft("end_barrens")); + public static final DefaultedRegistryReference END_BARRENS = Biomes.key(ResourceKey.minecraft("end_barrens")); - public static final RegistryReference END_HIGHLANDS = Biomes.key(ResourceKey.minecraft("end_highlands")); + public static final DefaultedRegistryReference END_HIGHLANDS = Biomes.key(ResourceKey.minecraft("end_highlands")); - public static final RegistryReference END_MIDLANDS = Biomes.key(ResourceKey.minecraft("end_midlands")); + public static final DefaultedRegistryReference END_MIDLANDS = Biomes.key(ResourceKey.minecraft("end_midlands")); - public static final RegistryReference ERODED_BADLANDS = Biomes.key(ResourceKey.minecraft("eroded_badlands")); + public static final DefaultedRegistryReference ERODED_BADLANDS = Biomes.key(ResourceKey.minecraft("eroded_badlands")); - public static final RegistryReference FLOWER_FOREST = Biomes.key(ResourceKey.minecraft("flower_forest")); + public static final DefaultedRegistryReference FLOWER_FOREST = Biomes.key(ResourceKey.minecraft("flower_forest")); - public static final RegistryReference FOREST = Biomes.key(ResourceKey.minecraft("forest")); + public static final DefaultedRegistryReference FOREST = Biomes.key(ResourceKey.minecraft("forest")); - public static final RegistryReference FROZEN_OCEAN = Biomes.key(ResourceKey.minecraft("frozen_ocean")); + public static final DefaultedRegistryReference FROZEN_OCEAN = Biomes.key(ResourceKey.minecraft("frozen_ocean")); - public static final RegistryReference FROZEN_PEAKS = Biomes.key(ResourceKey.minecraft("frozen_peaks")); + public static final DefaultedRegistryReference FROZEN_PEAKS = Biomes.key(ResourceKey.minecraft("frozen_peaks")); - public static final RegistryReference FROZEN_RIVER = Biomes.key(ResourceKey.minecraft("frozen_river")); + public static final DefaultedRegistryReference FROZEN_RIVER = Biomes.key(ResourceKey.minecraft("frozen_river")); - public static final RegistryReference GROVE = Biomes.key(ResourceKey.minecraft("grove")); + public static final DefaultedRegistryReference GROVE = Biomes.key(ResourceKey.minecraft("grove")); - public static final RegistryReference ICE_SPIKES = Biomes.key(ResourceKey.minecraft("ice_spikes")); + public static final DefaultedRegistryReference ICE_SPIKES = Biomes.key(ResourceKey.minecraft("ice_spikes")); - public static final RegistryReference JAGGED_PEAKS = Biomes.key(ResourceKey.minecraft("jagged_peaks")); + public static final DefaultedRegistryReference JAGGED_PEAKS = Biomes.key(ResourceKey.minecraft("jagged_peaks")); - public static final RegistryReference JUNGLE = Biomes.key(ResourceKey.minecraft("jungle")); + public static final DefaultedRegistryReference JUNGLE = Biomes.key(ResourceKey.minecraft("jungle")); - public static final RegistryReference LUKEWARM_OCEAN = Biomes.key(ResourceKey.minecraft("lukewarm_ocean")); + public static final DefaultedRegistryReference LUKEWARM_OCEAN = Biomes.key(ResourceKey.minecraft("lukewarm_ocean")); - public static final RegistryReference LUSH_CAVES = Biomes.key(ResourceKey.minecraft("lush_caves")); + public static final DefaultedRegistryReference LUSH_CAVES = Biomes.key(ResourceKey.minecraft("lush_caves")); - public static final RegistryReference MANGROVE_SWAMP = Biomes.key(ResourceKey.minecraft("mangrove_swamp")); + public static final DefaultedRegistryReference MANGROVE_SWAMP = Biomes.key(ResourceKey.minecraft("mangrove_swamp")); - public static final RegistryReference MEADOW = Biomes.key(ResourceKey.minecraft("meadow")); + public static final DefaultedRegistryReference MEADOW = Biomes.key(ResourceKey.minecraft("meadow")); - public static final RegistryReference MUSHROOM_FIELDS = Biomes.key(ResourceKey.minecraft("mushroom_fields")); + public static final DefaultedRegistryReference MUSHROOM_FIELDS = Biomes.key(ResourceKey.minecraft("mushroom_fields")); - public static final RegistryReference NETHER_WASTES = Biomes.key(ResourceKey.minecraft("nether_wastes")); + public static final DefaultedRegistryReference NETHER_WASTES = Biomes.key(ResourceKey.minecraft("nether_wastes")); - public static final RegistryReference OCEAN = Biomes.key(ResourceKey.minecraft("ocean")); + public static final DefaultedRegistryReference OCEAN = Biomes.key(ResourceKey.minecraft("ocean")); - public static final RegistryReference OLD_GROWTH_BIRCH_FOREST = Biomes.key(ResourceKey.minecraft("old_growth_birch_forest")); + public static final DefaultedRegistryReference OLD_GROWTH_BIRCH_FOREST = Biomes.key(ResourceKey.minecraft("old_growth_birch_forest")); - public static final RegistryReference OLD_GROWTH_PINE_TAIGA = Biomes.key(ResourceKey.minecraft("old_growth_pine_taiga")); + public static final DefaultedRegistryReference OLD_GROWTH_PINE_TAIGA = Biomes.key(ResourceKey.minecraft("old_growth_pine_taiga")); - public static final RegistryReference OLD_GROWTH_SPRUCE_TAIGA = Biomes.key(ResourceKey.minecraft("old_growth_spruce_taiga")); + public static final DefaultedRegistryReference OLD_GROWTH_SPRUCE_TAIGA = Biomes.key(ResourceKey.minecraft("old_growth_spruce_taiga")); - public static final RegistryReference PLAINS = Biomes.key(ResourceKey.minecraft("plains")); + public static final DefaultedRegistryReference PALE_GARDEN = Biomes.key(ResourceKey.minecraft("pale_garden")); - public static final RegistryReference RIVER = Biomes.key(ResourceKey.minecraft("river")); + public static final DefaultedRegistryReference PLAINS = Biomes.key(ResourceKey.minecraft("plains")); - public static final RegistryReference SAVANNA = Biomes.key(ResourceKey.minecraft("savanna")); + public static final DefaultedRegistryReference RIVER = Biomes.key(ResourceKey.minecraft("river")); - public static final RegistryReference SAVANNA_PLATEAU = Biomes.key(ResourceKey.minecraft("savanna_plateau")); + public static final DefaultedRegistryReference SAVANNA = Biomes.key(ResourceKey.minecraft("savanna")); - public static final RegistryReference SMALL_END_ISLANDS = Biomes.key(ResourceKey.minecraft("small_end_islands")); + public static final DefaultedRegistryReference SAVANNA_PLATEAU = Biomes.key(ResourceKey.minecraft("savanna_plateau")); - public static final RegistryReference SNOWY_BEACH = Biomes.key(ResourceKey.minecraft("snowy_beach")); + public static final DefaultedRegistryReference SMALL_END_ISLANDS = Biomes.key(ResourceKey.minecraft("small_end_islands")); - public static final RegistryReference SNOWY_PLAINS = Biomes.key(ResourceKey.minecraft("snowy_plains")); + public static final DefaultedRegistryReference SNOWY_BEACH = Biomes.key(ResourceKey.minecraft("snowy_beach")); - public static final RegistryReference SNOWY_SLOPES = Biomes.key(ResourceKey.minecraft("snowy_slopes")); + public static final DefaultedRegistryReference SNOWY_PLAINS = Biomes.key(ResourceKey.minecraft("snowy_plains")); - public static final RegistryReference SNOWY_TAIGA = Biomes.key(ResourceKey.minecraft("snowy_taiga")); + public static final DefaultedRegistryReference SNOWY_SLOPES = Biomes.key(ResourceKey.minecraft("snowy_slopes")); - public static final RegistryReference SOUL_SAND_VALLEY = Biomes.key(ResourceKey.minecraft("soul_sand_valley")); + public static final DefaultedRegistryReference SNOWY_TAIGA = Biomes.key(ResourceKey.minecraft("snowy_taiga")); - public static final RegistryReference SPARSE_JUNGLE = Biomes.key(ResourceKey.minecraft("sparse_jungle")); + public static final DefaultedRegistryReference SOUL_SAND_VALLEY = Biomes.key(ResourceKey.minecraft("soul_sand_valley")); - public static final RegistryReference STONY_PEAKS = Biomes.key(ResourceKey.minecraft("stony_peaks")); + public static final DefaultedRegistryReference SPARSE_JUNGLE = Biomes.key(ResourceKey.minecraft("sparse_jungle")); - public static final RegistryReference STONY_SHORE = Biomes.key(ResourceKey.minecraft("stony_shore")); + public static final DefaultedRegistryReference STONY_PEAKS = Biomes.key(ResourceKey.minecraft("stony_peaks")); - public static final RegistryReference SUNFLOWER_PLAINS = Biomes.key(ResourceKey.minecraft("sunflower_plains")); + public static final DefaultedRegistryReference STONY_SHORE = Biomes.key(ResourceKey.minecraft("stony_shore")); - public static final RegistryReference SWAMP = Biomes.key(ResourceKey.minecraft("swamp")); + public static final DefaultedRegistryReference SUNFLOWER_PLAINS = Biomes.key(ResourceKey.minecraft("sunflower_plains")); - public static final RegistryReference TAIGA = Biomes.key(ResourceKey.minecraft("taiga")); + public static final DefaultedRegistryReference SWAMP = Biomes.key(ResourceKey.minecraft("swamp")); - public static final RegistryReference THE_END = Biomes.key(ResourceKey.minecraft("the_end")); + public static final DefaultedRegistryReference TAIGA = Biomes.key(ResourceKey.minecraft("taiga")); - public static final RegistryReference THE_VOID = Biomes.key(ResourceKey.minecraft("the_void")); + public static final DefaultedRegistryReference THE_END = Biomes.key(ResourceKey.minecraft("the_end")); - public static final RegistryReference WARM_OCEAN = Biomes.key(ResourceKey.minecraft("warm_ocean")); + public static final DefaultedRegistryReference THE_VOID = Biomes.key(ResourceKey.minecraft("the_void")); - public static final RegistryReference WARPED_FOREST = Biomes.key(ResourceKey.minecraft("warped_forest")); + public static final DefaultedRegistryReference WARM_OCEAN = Biomes.key(ResourceKey.minecraft("warm_ocean")); - public static final RegistryReference WINDSWEPT_FOREST = Biomes.key(ResourceKey.minecraft("windswept_forest")); + public static final DefaultedRegistryReference WARPED_FOREST = Biomes.key(ResourceKey.minecraft("warped_forest")); - public static final RegistryReference WINDSWEPT_GRAVELLY_HILLS = Biomes.key(ResourceKey.minecraft("windswept_gravelly_hills")); + public static final DefaultedRegistryReference WINDSWEPT_FOREST = Biomes.key(ResourceKey.minecraft("windswept_forest")); - public static final RegistryReference WINDSWEPT_HILLS = Biomes.key(ResourceKey.minecraft("windswept_hills")); + public static final DefaultedRegistryReference WINDSWEPT_GRAVELLY_HILLS = Biomes.key(ResourceKey.minecraft("windswept_gravelly_hills")); - public static final RegistryReference WINDSWEPT_SAVANNA = Biomes.key(ResourceKey.minecraft("windswept_savanna")); + public static final DefaultedRegistryReference WINDSWEPT_HILLS = Biomes.key(ResourceKey.minecraft("windswept_hills")); - public static final RegistryReference WOODED_BADLANDS = Biomes.key(ResourceKey.minecraft("wooded_badlands")); + public static final DefaultedRegistryReference WINDSWEPT_SAVANNA = Biomes.key(ResourceKey.minecraft("windswept_savanna")); + + public static final DefaultedRegistryReference WOODED_BADLANDS = Biomes.key(ResourceKey.minecraft("wooded_badlands")); private Biomes() { } - public static Registry registry(final ServerWorld world) { - return world.registry(RegistryTypes.BIOME); + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.BIOME); } - private static RegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.BIOME, location).asReference(); + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.BIOME, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/biome/climate/GrassColorModifier.java b/src/main/java/org/spongepowered/api/world/biome/climate/GrassColorModifier.java index bef9d2ff2eb..2a0a856b6ff 100644 --- a/src/main/java/org/spongepowered/api/world/biome/climate/GrassColorModifier.java +++ b/src/main/java/org/spongepowered/api/world/biome/climate/GrassColorModifier.java @@ -24,6 +24,8 @@ */ package org.spongepowered.api.world.biome.climate; +import org.spongepowered.api.data.type.StringRepresentable; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.world.biome.Biome; @@ -31,6 +33,6 @@ * A modifier for grass color in a {@link Biome} */ @CatalogedBy(GrassColorModifiers.class) -public interface GrassColorModifier { +public interface GrassColorModifier extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/world/biome/climate/Precipitation.java b/src/main/java/org/spongepowered/api/world/biome/climate/Precipitation.java index 2209c0c0b25..4c666a5ab21 100644 --- a/src/main/java/org/spongepowered/api/world/biome/climate/Precipitation.java +++ b/src/main/java/org/spongepowered/api/world/biome/climate/Precipitation.java @@ -24,6 +24,8 @@ */ package org.spongepowered.api.world.biome.climate; +import org.spongepowered.api.data.type.StringRepresentable; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.world.biome.Biome; @@ -31,6 +33,6 @@ * The type of precipitation in a {@link Biome}. */ @CatalogedBy(Precipitations.class) -public interface Precipitation { +public interface Precipitation extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/world/biome/climate/TemperatureModifier.java b/src/main/java/org/spongepowered/api/world/biome/climate/TemperatureModifier.java index 823982b2e82..7149c930e22 100644 --- a/src/main/java/org/spongepowered/api/world/biome/climate/TemperatureModifier.java +++ b/src/main/java/org/spongepowered/api/world/biome/climate/TemperatureModifier.java @@ -24,12 +24,14 @@ */ package org.spongepowered.api.world.biome.climate; +import org.spongepowered.api.data.type.StringRepresentable; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; /** * The temperature modifier of a biome */ @CatalogedBy(TemperatureModifiers.class) -public interface TemperatureModifier { +public interface TemperatureModifier extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/world/border/WorldBorder.java b/src/main/java/org/spongepowered/api/world/border/WorldBorder.java index 0d4ed8931e9..a0715dd6419 100644 --- a/src/main/java/org/spongepowered/api/world/border/WorldBorder.java +++ b/src/main/java/org/spongepowered/api/world/border/WorldBorder.java @@ -26,9 +26,9 @@ import org.spongepowered.api.Sponge; import org.spongepowered.api.util.CopyableBuilder; +import org.spongepowered.api.util.Ticks; import org.spongepowered.math.vector.Vector2d; -import java.time.Duration; /** * A world border is a square boundary, extending through the entire y-axis. @@ -103,15 +103,15 @@ default Builder toBuilder() { double targetDiameter(); /** - * Gets the time remaining until the world border stops expanding or + * Gets the remaining transition time in ticks until the world border stops expanding or * contracting to the {@link #targetDiameter()}. * *

    If {@link #diameter()} and {@link #targetDiameter()} are the same, - * this will be {@link Duration#ZERO}.

    + * this will be {@link Ticks#zero()}.

    * - * @return The time remaining + * @return The ticks remaining */ - Duration timeUntilTargetDiameter(); + Ticks timeUntilTargetDiameter(); /** * Gets the distance a player may be outside the world border before taking @@ -131,14 +131,14 @@ default Builder toBuilder() { /** * Gets the time when a contracting world border will warn a player for whom - * the world border will reach in {@code time} seconds. + * the world border will reach in {@code time} ticks. * *

    In Minecraft, the warning is displayed in the form of a reddish * tint.

    * * @return The warning time */ - Duration warningTime(); + Ticks warningTime(); /** * Gets the distance when a contracting world border will warn a player for @@ -189,7 +189,7 @@ interface Builder extends CopyableBuilder, org.spongepower *

    If this differs from the the value supplied to * {@link #targetDiameter(double)}, then the border size starts at the * diameter specified here, growing or shrinking at a constant speed for - * the time provided in {@link #timeToTargetDiameter(Duration)} where it + * the time provided in {@link #timeToTargetDiameter(Ticks)} where it * will stop at the supplied target. If the supplied time is zero or not * given, then this value is ignored and the target diameter is used.

    * @@ -205,8 +205,8 @@ interface Builder extends CopyableBuilder, org.spongepower /** * Sets the final diameter of this world border. * - *

    If no {@link #timeToTargetDiameter(Duration)} is set, or it is set - * to {@link Duration#ZERO}, then the {@link #initialDiameter(double)} + *

    If no {@link #timeToTargetDiameter(Ticks)} is set, or it is set + * to {@link Ticks#zero()}, then the {@link #initialDiameter(double)} * is ignored and this is the only diameter used.

    * *

    If this is set but {@link #initialDiameter(double)} has not, then @@ -222,10 +222,10 @@ interface Builder extends CopyableBuilder, org.spongepower * {@link #initialDiameter(double) the initial diameter} to * {@link #targetDiameter(double) its target diameter}. * - * @param time The time, as a {@link Duration} + * @param ticks The transition duration in ticks * @return The builder, for chaining. */ - Builder timeToTargetDiameter(final Duration time); + Builder timeToTargetDiameter(final Ticks ticks); /** * Sets the distance beyond this world border that an entity may travel @@ -250,7 +250,7 @@ interface Builder extends CopyableBuilder, org.spongepower * @param warningTime The warning time * @return The builder, for chaining */ - Builder warningTime(final Duration warningTime); + Builder warningTime(final Ticks warningTime); /** * Sets the warning distance of this world border. diff --git a/src/main/java/org/spongepowered/api/world/chunk/ChunkState.java b/src/main/java/org/spongepowered/api/world/chunk/ChunkState.java index beb2266f037..96b249915c0 100644 --- a/src/main/java/org/spongepowered/api/world/chunk/ChunkState.java +++ b/src/main/java/org/spongepowered/api/world/chunk/ChunkState.java @@ -37,7 +37,7 @@ * */ @CatalogedBy(ChunkStates.class) -public interface ChunkState extends DefaultedRegistryValue { +public interface ChunkState extends DefaultedRegistryValue { /** * Checks whether this state is considered "after" diff --git a/src/main/java/org/spongepowered/api/world/difficulty/Difficulty.java b/src/main/java/org/spongepowered/api/world/difficulty/Difficulty.java index fd56ea5ca74..552599957d8 100644 --- a/src/main/java/org/spongepowered/api/world/difficulty/Difficulty.java +++ b/src/main/java/org/spongepowered/api/world/difficulty/Difficulty.java @@ -25,6 +25,7 @@ package org.spongepowered.api.world.difficulty; import net.kyori.adventure.text.ComponentLike; +import org.spongepowered.api.data.type.StringRepresentable; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -32,6 +33,6 @@ * Represents a possible difficulty setting. */ @CatalogedBy(Difficulties.class) -public interface Difficulty extends DefaultedRegistryValue, ComponentLike { +public interface Difficulty extends DefaultedRegistryValue, ComponentLike, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/world/explosion/Explosion.java b/src/main/java/org/spongepowered/api/world/explosion/Explosion.java index 0701c0c2d15..4f157b8b7ad 100644 --- a/src/main/java/org/spongepowered/api/world/explosion/Explosion.java +++ b/src/main/java/org/spongepowered/api/world/explosion/Explosion.java @@ -184,12 +184,12 @@ interface Builder extends org.spongepowered.api.util.Builder Builder shouldPlaySmoke(boolean smoke); /** - * Sets whether the affected blocks should be destroyed on explosion. + * Sets the desired block interaction. * - * @param destroy Whether the affected blocks should be destroyed + * @param interaction the desired block interaction * @return The builder, for chaining */ - Builder shouldBreakBlocks(boolean destroy); + Builder blockInteraction(ExplosionBlockInteraction interaction); /** * Sets the resolution of the explosion. @@ -244,4 +244,5 @@ default Builder knockback(double knockback) { Explosion build() throws IllegalArgumentException; } + } diff --git a/src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteraction.java b/src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteraction.java new file mode 100644 index 00000000000..44567c53770 --- /dev/null +++ b/src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteraction.java @@ -0,0 +1,34 @@ +/* + * 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.explosion; + +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.annotation.CatalogedBy; + +@CatalogedBy(ExplosionBlockInteractions.class) +public interface ExplosionBlockInteraction extends DefaultedRegistryValue { + // TODO mixin + +} diff --git a/src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteractions.java b/src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteractions.java new file mode 100644 index 00000000000..62d1365f8c9 --- /dev/null +++ b/src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteractions.java @@ -0,0 +1,57 @@ +/* + * 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.explosion; + +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 ExplosionBlockInteractions { + + public static final DefaultedRegistryReference DESTROY = ExplosionBlockInteractions.key(ResourceKey.sponge("destroy")); + + public static final DefaultedRegistryReference DESTROY_WITH_DECAY = ExplosionBlockInteractions.key(ResourceKey.sponge("destroy_with_decay")); + + public static final DefaultedRegistryReference KEEP = ExplosionBlockInteractions.key(ResourceKey.sponge("keep")); + + public static final DefaultedRegistryReference TRIGGER_BLOCK = ExplosionBlockInteractions.key(ResourceKey.sponge("trigger_block")); + + private ExplosionBlockInteractions() { + } + + public static Registry registry() { + return Sponge.game().registry(RegistryTypes.EXPLOSION_BLOCK_INTERACTION); + } + + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.EXPLOSION_BLOCK_INTERACTION, location).asDefaultedReference(Sponge::game); + } +} diff --git a/src/main/java/org/spongepowered/api/world/gamerule/GameRule.java b/src/main/java/org/spongepowered/api/world/gamerule/GameRule.java index 39f2e411c52..7c3688cd6da 100644 --- a/src/main/java/org/spongepowered/api/world/gamerule/GameRule.java +++ b/src/main/java/org/spongepowered/api/world/gamerule/GameRule.java @@ -37,7 +37,7 @@ * @param The type of the value */ @CatalogedBy(GameRules.class) -public interface GameRule extends DefaultedRegistryValue, Nameable { +public interface GameRule extends DefaultedRegistryValue>, Nameable { /** * Gets the value {@link TypeToken type}. 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 d3cfe5cb420..7a973822eb4 100644 --- a/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java +++ b/src/main/java/org/spongepowered/api/world/gamerule/GameRules.java @@ -40,107 +40,123 @@ @RegistryScopes(scopes = RegistryScope.GAME) public final class GameRules { - public static final DefaultedRegistryReference> ANNOUNCE_ADVANCEMENTS = GameRules.key(ResourceKey.sponge("announce_advancements")); + public static final DefaultedRegistryReference> ADVANCE_TIME = GameRules.key(ResourceKey.minecraft("advance_time")); - public static final DefaultedRegistryReference> BLOCK_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.sponge("block_explosion_drop_decay")); + public static final DefaultedRegistryReference> ADVANCE_WEATHER = GameRules.key(ResourceKey.minecraft("advance_weather")); - public static final DefaultedRegistryReference> COMMAND_BLOCK_OUTPUT = GameRules.key(ResourceKey.sponge("command_block_output")); + public static final DefaultedRegistryReference> ALLOW_ENTERING_NETHER_USING_PORTALS = GameRules.key(ResourceKey.minecraft("allow_entering_nether_using_portals")); - public static final DefaultedRegistryReference> COMMAND_MODIFICATION_BLOCK_LIMIT = GameRules.key(ResourceKey.sponge("command_modification_block_limit")); + public static final DefaultedRegistryReference> BLOCK_DROPS = GameRules.key(ResourceKey.minecraft("block_drops")); - public static final DefaultedRegistryReference> DISABLE_ELYTRA_MOVEMENT_CHECK = GameRules.key(ResourceKey.sponge("disable_elytra_movement_check")); + public static final DefaultedRegistryReference> BLOCK_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.minecraft("block_explosion_drop_decay")); - public static final DefaultedRegistryReference> DISABLE_RAIDS = GameRules.key(ResourceKey.sponge("disable_raids")); + public static final DefaultedRegistryReference> COMMAND_BLOCKS_WORK = GameRules.key(ResourceKey.minecraft("command_blocks_work")); - public static final DefaultedRegistryReference> DO_DAYLIGHT_CYCLE = GameRules.key(ResourceKey.sponge("do_daylight_cycle")); + public static final DefaultedRegistryReference> COMMAND_BLOCK_OUTPUT = GameRules.key(ResourceKey.minecraft("command_block_output")); - public static final DefaultedRegistryReference> DO_ENTITY_DROPS = GameRules.key(ResourceKey.sponge("do_entity_drops")); + public static final DefaultedRegistryReference> DROWNING_DAMAGE = GameRules.key(ResourceKey.minecraft("drowning_damage")); - public static final DefaultedRegistryReference> DO_FIRE_TICK = GameRules.key(ResourceKey.sponge("do_fire_tick")); + public static final DefaultedRegistryReference> ELYTRA_MOVEMENT_CHECK = GameRules.key(ResourceKey.minecraft("elytra_movement_check")); - public static final DefaultedRegistryReference> DO_IMMEDIATE_RESPAWN = GameRules.key(ResourceKey.sponge("do_immediate_respawn")); + public static final DefaultedRegistryReference> ENDER_PEARLS_VANISH_ON_DEATH = GameRules.key(ResourceKey.minecraft("ender_pearls_vanish_on_death")); - public static final DefaultedRegistryReference> DO_INSOMNIA = GameRules.key(ResourceKey.sponge("do_insomnia")); + public static final DefaultedRegistryReference> ENTITY_DROPS = GameRules.key(ResourceKey.minecraft("entity_drops")); - public static final DefaultedRegistryReference> DO_LIMITED_CRAFTING = GameRules.key(ResourceKey.sponge("do_limited_crafting")); + public static final DefaultedRegistryReference> FALL_DAMAGE = GameRules.key(ResourceKey.minecraft("fall_damage")); - public static final DefaultedRegistryReference> DO_MOB_LOOT = GameRules.key(ResourceKey.sponge("do_mob_loot")); + public static final DefaultedRegistryReference> FIRE_DAMAGE = GameRules.key(ResourceKey.minecraft("fire_damage")); - public static final DefaultedRegistryReference> DO_MOB_SPAWNING = GameRules.key(ResourceKey.sponge("do_mob_spawning")); + public static final DefaultedRegistryReference> FIRE_SPREAD_RADIUS_AROUND_PLAYER = GameRules.key(ResourceKey.minecraft("fire_spread_radius_around_player")); - public static final DefaultedRegistryReference> DO_PATROL_SPAWNING = GameRules.key(ResourceKey.sponge("do_patrol_spawning")); + public static final DefaultedRegistryReference> FORGIVE_DEAD_PLAYERS = GameRules.key(ResourceKey.minecraft("forgive_dead_players")); - public static final DefaultedRegistryReference> DO_TILE_DROPS = GameRules.key(ResourceKey.sponge("do_tile_drops")); + public static final DefaultedRegistryReference> FREEZE_DAMAGE = GameRules.key(ResourceKey.minecraft("freeze_damage")); - public static final DefaultedRegistryReference> DO_TRADER_SPAWNING = GameRules.key(ResourceKey.sponge("do_trader_spawning")); + public static final DefaultedRegistryReference> GLOBAL_SOUND_EVENTS = GameRules.key(ResourceKey.minecraft("global_sound_events")); - public static final DefaultedRegistryReference> DO_VINES_SPREAD = GameRules.key(ResourceKey.sponge("do_vines_spread")); + public static final DefaultedRegistryReference> IMMEDIATE_RESPAWN = GameRules.key(ResourceKey.minecraft("immediate_respawn")); - public static final DefaultedRegistryReference> DO_WARDEN_SPAWNING = GameRules.key(ResourceKey.sponge("do_warden_spawning")); + public static final DefaultedRegistryReference> KEEP_INVENTORY = GameRules.key(ResourceKey.minecraft("keep_inventory")); - public static final DefaultedRegistryReference> DO_WEATHER_CYCLE = GameRules.key(ResourceKey.sponge("do_weather_cycle")); + public static final DefaultedRegistryReference> LAVA_SOURCE_CONVERSION = GameRules.key(ResourceKey.minecraft("lava_source_conversion")); - public static final DefaultedRegistryReference> DROWNING_DAMAGE = GameRules.key(ResourceKey.sponge("drowning_damage")); + public static final DefaultedRegistryReference> LIMITED_CRAFTING = GameRules.key(ResourceKey.minecraft("limited_crafting")); - public static final DefaultedRegistryReference> ENDER_PEARLS_VANISH_ON_DEATH = GameRules.key(ResourceKey.sponge("ender_pearls_vanish_on_death")); + public static final DefaultedRegistryReference> LOCATOR_BAR = GameRules.key(ResourceKey.minecraft("locator_bar")); - public static final DefaultedRegistryReference> FALL_DAMAGE = GameRules.key(ResourceKey.sponge("fall_damage")); + public static final DefaultedRegistryReference> LOG_ADMIN_COMMANDS = GameRules.key(ResourceKey.minecraft("log_admin_commands")); - public static final DefaultedRegistryReference> FIRE_DAMAGE = GameRules.key(ResourceKey.sponge("fire_damage")); + public static final DefaultedRegistryReference> MAX_BLOCK_MODIFICATIONS = GameRules.key(ResourceKey.minecraft("max_block_modifications")); - public static final DefaultedRegistryReference> FORGIVE_DEAD_PLAYERS = GameRules.key(ResourceKey.sponge("forgive_dead_players")); + public static final DefaultedRegistryReference> MAX_COMMAND_FORKS = GameRules.key(ResourceKey.minecraft("max_command_forks")); - public static final DefaultedRegistryReference> FREEZE_DAMAGE = GameRules.key(ResourceKey.sponge("freeze_damage")); + public static final DefaultedRegistryReference> MAX_COMMAND_SEQUENCE_LENGTH = GameRules.key(ResourceKey.minecraft("max_command_sequence_length")); - public static final DefaultedRegistryReference> GLOBAL_SOUND_EVENTS = GameRules.key(ResourceKey.sponge("global_sound_events")); + public static final DefaultedRegistryReference> MAX_ENTITY_CRAMMING = GameRules.key(ResourceKey.minecraft("max_entity_cramming")); - public static final DefaultedRegistryReference> KEEP_INVENTORY = GameRules.key(ResourceKey.sponge("keep_inventory")); + public static final DefaultedRegistryReference> MAX_MINECART_SPEED = GameRules.key(ResourceKey.minecraft("max_minecart_speed")); - public static final DefaultedRegistryReference> LAVA_SOURCE_CONVERSION = GameRules.key(ResourceKey.sponge("lava_source_conversion")); + public static final DefaultedRegistryReference> MAX_SNOW_ACCUMULATION_HEIGHT = GameRules.key(ResourceKey.minecraft("max_snow_accumulation_height")); - public static final DefaultedRegistryReference> LOG_ADMIN_COMMANDS = GameRules.key(ResourceKey.sponge("log_admin_commands")); + public static final DefaultedRegistryReference> MOB_DROPS = GameRules.key(ResourceKey.minecraft("mob_drops")); - public static final DefaultedRegistryReference> MAX_COMMAND_CHAIN_LENGTH = GameRules.key(ResourceKey.sponge("max_command_chain_length")); + public static final DefaultedRegistryReference> MOB_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.minecraft("mob_explosion_drop_decay")); - public static final DefaultedRegistryReference> MAX_COMMAND_FORK_COUNT = GameRules.key(ResourceKey.sponge("max_command_fork_count")); + public static final DefaultedRegistryReference> MOB_GRIEFING = GameRules.key(ResourceKey.minecraft("mob_griefing")); - public static final DefaultedRegistryReference> MAX_ENTITY_CRAMMING = GameRules.key(ResourceKey.sponge("max_entity_cramming")); + public static final DefaultedRegistryReference> NATURAL_HEALTH_REGENERATION = GameRules.key(ResourceKey.minecraft("natural_health_regeneration")); - public static final DefaultedRegistryReference> MOB_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.sponge("mob_explosion_drop_decay")); + public static final DefaultedRegistryReference> PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = GameRules.key(ResourceKey.minecraft("players_nether_portal_creative_delay")); - public static final DefaultedRegistryReference> MOB_GRIEFING = GameRules.key(ResourceKey.sponge("mob_griefing")); + public static final DefaultedRegistryReference> PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = GameRules.key(ResourceKey.minecraft("players_nether_portal_default_delay")); - public static final DefaultedRegistryReference> NATURAL_REGENERATION = GameRules.key(ResourceKey.sponge("natural_regeneration")); + public static final DefaultedRegistryReference> PLAYERS_SLEEPING_PERCENTAGE = GameRules.key(ResourceKey.minecraft("players_sleeping_percentage")); - public static final DefaultedRegistryReference> PLAYERS_NETHER_PORTAL_CREATIVE_DELAY = GameRules.key(ResourceKey.sponge("players_nether_portal_creative_delay")); + public static final DefaultedRegistryReference> PLAYER_MOVEMENT_CHECK = GameRules.key(ResourceKey.minecraft("player_movement_check")); - public static final DefaultedRegistryReference> PLAYERS_NETHER_PORTAL_DEFAULT_DELAY = GameRules.key(ResourceKey.sponge("players_nether_portal_default_delay")); + public static final DefaultedRegistryReference> PROJECTILES_CAN_BREAK_BLOCKS = GameRules.key(ResourceKey.minecraft("projectiles_can_break_blocks")); - public static final DefaultedRegistryReference> PLAYERS_SLEEPING_PERCENTAGE = GameRules.key(ResourceKey.sponge("players_sleeping_percentage")); + public static final DefaultedRegistryReference> PVP = GameRules.key(ResourceKey.minecraft("pvp")); - public static final DefaultedRegistryReference> PROJECTILES_CAN_BREAK_BLOCKS = GameRules.key(ResourceKey.sponge("projectiles_can_break_blocks")); + public static final DefaultedRegistryReference> RAIDS = GameRules.key(ResourceKey.minecraft("raids")); - public static final DefaultedRegistryReference> RANDOM_TICK_SPEED = GameRules.key(ResourceKey.sponge("random_tick_speed")); + public static final DefaultedRegistryReference> RANDOM_TICK_SPEED = GameRules.key(ResourceKey.minecraft("random_tick_speed")); - public static final DefaultedRegistryReference> REDUCED_DEBUG_INFO = GameRules.key(ResourceKey.sponge("reduced_debug_info")); + public static final DefaultedRegistryReference> REDUCED_DEBUG_INFO = GameRules.key(ResourceKey.minecraft("reduced_debug_info")); - public static final DefaultedRegistryReference> SEND_COMMAND_FEEDBACK = GameRules.key(ResourceKey.sponge("send_command_feedback")); + public static final DefaultedRegistryReference> RESPAWN_RADIUS = GameRules.key(ResourceKey.minecraft("respawn_radius")); - public static final DefaultedRegistryReference> SHOW_DEATH_MESSAGES = GameRules.key(ResourceKey.sponge("show_death_messages")); + public static final DefaultedRegistryReference> SEND_COMMAND_FEEDBACK = GameRules.key(ResourceKey.minecraft("send_command_feedback")); - public static final DefaultedRegistryReference> SNOW_ACCUMULATION_HEIGHT = GameRules.key(ResourceKey.sponge("snow_accumulation_height")); + public static final DefaultedRegistryReference> SHOW_ADVANCEMENT_MESSAGES = GameRules.key(ResourceKey.minecraft("show_advancement_messages")); - public static final DefaultedRegistryReference> SPAWN_CHUNK_RADIUS = GameRules.key(ResourceKey.sponge("spawn_chunk_radius")); + public static final DefaultedRegistryReference> SHOW_DEATH_MESSAGES = GameRules.key(ResourceKey.minecraft("show_death_messages")); - public static final DefaultedRegistryReference> SPAWN_RADIUS = GameRules.key(ResourceKey.sponge("spawn_radius")); + public static final DefaultedRegistryReference> SPAWNER_BLOCKS_WORK = GameRules.key(ResourceKey.minecraft("spawner_blocks_work")); - public static final DefaultedRegistryReference> SPECTATORS_GENERATE_CHUNKS = GameRules.key(ResourceKey.sponge("spectators_generate_chunks")); + public static final DefaultedRegistryReference> SPAWN_MOBS = GameRules.key(ResourceKey.minecraft("spawn_mobs")); - public static final DefaultedRegistryReference> TNT_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.sponge("tnt_explosion_drop_decay")); + public static final DefaultedRegistryReference> SPAWN_MONSTERS = GameRules.key(ResourceKey.minecraft("spawn_monsters")); - public static final DefaultedRegistryReference> UNIVERSAL_ANGER = GameRules.key(ResourceKey.sponge("universal_anger")); + public static final DefaultedRegistryReference> SPAWN_PATROLS = GameRules.key(ResourceKey.minecraft("spawn_patrols")); - public static final DefaultedRegistryReference> WATER_SOURCE_CONVERSION = GameRules.key(ResourceKey.sponge("water_source_conversion")); + public static final DefaultedRegistryReference> SPAWN_PHANTOMS = GameRules.key(ResourceKey.minecraft("spawn_phantoms")); + + public static final DefaultedRegistryReference> SPAWN_WANDERING_TRADERS = GameRules.key(ResourceKey.minecraft("spawn_wandering_traders")); + + public static final DefaultedRegistryReference> SPAWN_WARDENS = GameRules.key(ResourceKey.minecraft("spawn_wardens")); + + public static final DefaultedRegistryReference> SPECTATORS_GENERATE_CHUNKS = GameRules.key(ResourceKey.minecraft("spectators_generate_chunks")); + + public static final DefaultedRegistryReference> SPREAD_VINES = GameRules.key(ResourceKey.minecraft("spread_vines")); + + public static final DefaultedRegistryReference> TNT_EXPLODES = GameRules.key(ResourceKey.minecraft("tnt_explodes")); + + public static final DefaultedRegistryReference> TNT_EXPLOSION_DROP_DECAY = GameRules.key(ResourceKey.minecraft("tnt_explosion_drop_decay")); + + public static final DefaultedRegistryReference> UNIVERSAL_ANGER = GameRules.key(ResourceKey.minecraft("universal_anger")); + + public static final DefaultedRegistryReference> WATER_SOURCE_CONVERSION = GameRules.key(ResourceKey.minecraft("water_source_conversion")); private GameRules() { } diff --git a/src/main/java/org/spongepowered/api/world/generation/ChunkGenerator.java b/src/main/java/org/spongepowered/api/world/generation/ChunkGenerator.java index be1f7ca2094..3a81c01eb42 100644 --- a/src/main/java/org/spongepowered/api/world/generation/ChunkGenerator.java +++ b/src/main/java/org/spongepowered/api/world/generation/ChunkGenerator.java @@ -25,15 +25,12 @@ package org.spongepowered.api.world.generation; import org.spongepowered.api.Sponge; -import org.spongepowered.api.data.persistence.DataView; import org.spongepowered.api.world.WorldTypes; import org.spongepowered.api.world.biome.provider.BiomeProvider; import org.spongepowered.api.world.generation.config.flat.FlatGeneratorConfig; import org.spongepowered.api.world.generation.config.noise.NoiseGeneratorConfig; import org.spongepowered.api.world.server.ServerWorld; -import org.spongepowered.api.world.server.WorldTemplate; -import java.io.IOException; import java.util.Objects; /** @@ -45,8 +42,6 @@ *

    * Other chunk generators may be provided by third parties and may be obtained from * - {@link ServerWorld#generator()} - * - {@link WorldTemplate#generator()} - * - {@link ChunkGenerator.Factory#fromDataPack} using {@link WorldTemplate} data. */ public interface ChunkGenerator { @@ -116,15 +111,5 @@ interface Factory { * @return The new chunk generator */ ConfigurableChunkGenerator theEnd(); - - /** - * Creates a chunk generator based on the given data view. - *

    The data must be equivalent to a data-pack for {@link WorldTemplate}

    - * see {@link WorldTemplate.Builder#fromDataPack} - * - * @param pack the data - * @return the created ChunkGenerator - */ - ChunkGenerator fromDataPack(DataView pack) throws IOException; } } diff --git a/src/main/java/org/spongepowered/api/world/generation/carver/Carver.java b/src/main/java/org/spongepowered/api/world/generation/carver/Carver.java index 2ce889ebbd1..56a5ca57eb7 100644 --- a/src/main/java/org/spongepowered/api/world/generation/carver/Carver.java +++ b/src/main/java/org/spongepowered/api/world/generation/carver/Carver.java @@ -24,14 +24,27 @@ */ package org.spongepowered.api.world.generation.carver; -import org.spongepowered.api.data.persistence.DataView; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; /** * A carver used in world generation. */ @CatalogedBy(Carvers.class) -public interface Carver { +public interface Carver extends DefaultedRegistryValue, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create a {@link Carver}. + * + * @return The new builder + */ + static Carver.Builder builder() { + return Sponge.game().builderProvider().provide(Carver.Builder.class); + } /** * Returns the carver type @@ -41,10 +54,16 @@ public interface Carver { CarverType type(); /** - * Returns the serialized carver configuration. - *

    Reconfigure a carver using {@link CarverType#configure(DataView)}

    - * - * @return The serialized carver configuration + * A builder to create {@link Carver}s. */ - DataView toContainer(); + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the {@link CarverType} + * + * @param type The carver type + * @return This builder, for chaining + */ + Builder type(CarverType type); + } } diff --git a/src/main/java/org/spongepowered/api/world/generation/carver/CarverType.java b/src/main/java/org/spongepowered/api/world/generation/carver/CarverType.java index 0f19d5cddb6..d83168f1683 100644 --- a/src/main/java/org/spongepowered/api/world/generation/carver/CarverType.java +++ b/src/main/java/org/spongepowered/api/world/generation/carver/CarverType.java @@ -25,13 +25,14 @@ package org.spongepowered.api.world.generation.carver; import org.spongepowered.api.data.persistence.DataView; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; /** * A type of {@link Carver}. */ @CatalogedBy(CarverTypes.class) -public interface CarverType { +public interface CarverType extends DefaultedRegistryValue { /** * Returns the configured carver diff --git a/src/main/java/org/spongepowered/api/world/generation/carver/Carvers.java b/src/main/java/org/spongepowered/api/world/generation/carver/Carvers.java index 7464144b261..a79493ef937 100644 --- a/src/main/java/org/spongepowered/api/world/generation/carver/Carvers.java +++ b/src/main/java/org/spongepowered/api/world/generation/carver/Carvers.java @@ -56,6 +56,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.CARVER, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.CARVER, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/config/flat/FlatGeneratorConfig.java b/src/main/java/org/spongepowered/api/world/generation/config/flat/FlatGeneratorConfig.java index 238e49520a5..03e8c95fc23 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/flat/FlatGeneratorConfig.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/flat/FlatGeneratorConfig.java @@ -26,6 +26,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.Sponge; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.registry.RegistryReference; import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -41,7 +42,7 @@ * See {@link FlatGeneratorConfigs} for the vanilla provided presets. */ @CatalogedBy(FlatGeneratorConfigs.class) -public interface FlatGeneratorConfig extends ChunkGeneratorConfig { +public interface FlatGeneratorConfig extends ChunkGeneratorConfig, DefaultedRegistryValue { static Builder builder() { return Sponge.game().builderProvider().provide(Builder.class); diff --git a/src/main/java/org/spongepowered/api/world/generation/config/flat/FlatGeneratorConfigs.java b/src/main/java/org/spongepowered/api/world/generation/config/flat/FlatGeneratorConfigs.java index 21818992038..b054aef6a32 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/flat/FlatGeneratorConfigs.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/flat/FlatGeneratorConfigs.java @@ -37,7 +37,7 @@ * */ @SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.GAME) +@RegistryScopes(scopes = RegistryScope.ENGINE) public final class FlatGeneratorConfigs { public static final DefaultedRegistryReference BOTTOMLESS_PIT = FlatGeneratorConfigs.key(ResourceKey.minecraft("bottomless_pit")); @@ -62,10 +62,10 @@ private FlatGeneratorConfigs() { } public static Registry registry() { - return Sponge.game().registry(RegistryTypes.FLAT_GENERATOR_CONFIG); + return Sponge.server().registry(RegistryTypes.FLAT_GENERATOR_CONFIG); } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.FLAT_GENERATOR_CONFIG, location).asDefaultedReference(Sponge::game); + return RegistryKey.of(RegistryTypes.FLAT_GENERATOR_CONFIG, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunction.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunction.java index 71dce99e362..1307280fc4f 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunction.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunction.java @@ -24,11 +24,13 @@ */ package org.spongepowered.api.world.generation.config.noise; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.math.vector.Vector3i; @CatalogedBy(DensityFunctions.class) -public interface DensityFunction { +public interface DensityFunction extends DefaultedRegistryValue, DataPackSerializable { /** * Returns the minimum value possible. @@ -59,5 +61,4 @@ public interface DensityFunction { * @return The noise value at given position */ double compute(int x, int y, int z); - } diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunctions.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunctions.java index 7e40a7a3355..c33e37d14eb 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunctions.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/noise/DensityFunctions.java @@ -118,6 +118,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.DENSITY_FUNCTION, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.DENSITY_FUNCTION, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/Noise.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/Noise.java index 2e8f6158a18..85f4430b5b1 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/Noise.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/noise/Noise.java @@ -24,6 +24,11 @@ */ package org.spongepowered.api.world.generation.config.noise; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; import java.util.List; @@ -32,7 +37,16 @@ * Noise used in world generation */ @CatalogedBy(Noises.class) -public interface Noise { +public interface Noise extends DefaultedRegistryValue, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create a {@link Noise}. + * + * @return The new builder + */ + static Noise.Builder builder() { + return Sponge.game().builderProvider().provide(Noise.Builder.class); + } /** * Returns the first octave @@ -47,4 +61,34 @@ public interface Noise { * @return The amplitudes */ List amplitudes(); + + /** + * A builder to create {@link Noise}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the octave. + * + * @param octave The octave. + * @return This builder, for chaining + */ + Builder octave(int octave); + + /** + * Sets the amplitudes. + * + * @param amplitudes The amplitudes + * @return This builder, for chaining + */ + Builder amplitudes(double... amplitudes); + + /** + * Sets the amplitudes. + * + * @param amplitudes The amplitudes + * @return This builder, for chaining + */ + Builder amplitudes(List amplitudes); + } } diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfig.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfig.java index 4bea7b18caf..b0db9609316 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfig.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfig.java @@ -26,6 +26,10 @@ import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockState; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.world.biome.BiomeAttributes; import org.spongepowered.api.world.generation.ConfigurableChunkGenerator; @@ -39,10 +43,15 @@ * Noise generator config used in {@link ConfigurableChunkGenerator configurable chunk generators}. */ @CatalogedBy(NoiseGeneratorConfigs.class) -public interface NoiseGeneratorConfig extends ChunkGeneratorConfig { +public interface NoiseGeneratorConfig extends ChunkGeneratorConfig, DefaultedRegistryValue, DataPackSerializable { - static NoiseGeneratorConfigTemplate.Builder builder() { - return Sponge.game().builderProvider().provide(NoiseGeneratorConfigTemplate.Builder.class); + /** + * Creates a new {@link Builder} to create a {@link NoiseGeneratorConfig}. + * + * @return The new builder + */ + static NoiseGeneratorConfig.Builder builder() { + return Sponge.game().builderProvider().provide(NoiseGeneratorConfig.Builder.class); } /** @@ -124,4 +133,95 @@ static NoiseGeneratorConfigTemplate.Builder builder() { */ boolean mobGeneration(); + /** + * A builder to create {@link NoiseGeneratorConfig}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the noise configuration + * + * @param config The noise configuration + * @return This builder, for chaining + */ + Builder noiseConfig(NoiseConfig config); + + /** + * Sets the surface rule. + * + * @param rule The surface rule + * @return This builder, for chaining + */ + Builder surfaceRule(SurfaceRule rule); + + /** + * Sets the default block used for terrain. + * + * @param block The block + * @return This builder, for chaining + */ + Builder defaultBlock(BlockState block); + + /** + * Sets the default fluid used for seas and lakes. + * + * @param fluid The fluid + * @return This builder, for chaining + */ + Builder defaultFluid(BlockState fluid); + + /** + * Sets the sea level. + * + * @param y The sea level + * @return This builder, for chaining + */ + Builder seaLevel(int y); + + /** + * Sets whether to generate aquifers. + * + * @param enableAquifers true to enable aquifers + * @return This builder, for chaining + */ + Builder aquifers(boolean enableAquifers); + + /** + * Sets whether to generate or veins. + * + * @param enableOreVeins true to enable ore veins + * @return This builder, for chaining + */ + Builder oreVeins(boolean enableOreVeins); + + /** + * Sets whether to enable mob generation. + * + * @param mobGeneration true to enable mob generation + * @return This builder, for chaining + */ + Builder mobGeneration(boolean mobGeneration); + + /** + * Sets whether to use the legacy random source. + * @param useLegacyRandomSource true when using the legacy random source + * @return This builder, for chaining + */ + Builder randomSource(boolean useLegacyRandomSource); + + /** + * Sets the noise router. + * @param router The noise router + * @return This builder, for chaining + */ + Builder noiseRouter(NoiseRouter router); + + /** + * Sets the biome attributes in which the initial {@link ServerWorldProperties#spawnPosition()} is allowed. + * + * @param spawnTargets The spawn targets + * @return This builder, for chaining + */ + Builder spawnTargets(List spawnTargets); + } } diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfigTemplate.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfigTemplate.java deleted file mode 100644 index b2e041e3728..00000000000 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfigTemplate.java +++ /dev/null @@ -1,137 +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.generation.config.noise; - -import org.spongepowered.api.Sponge; -import org.spongepowered.api.block.BlockState; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; -import org.spongepowered.api.world.biome.BiomeAttributes; -import org.spongepowered.api.world.generation.ConfigurableChunkGenerator; -import org.spongepowered.api.world.generation.config.SurfaceRule; -import org.spongepowered.api.world.server.storage.ServerWorldProperties; - -import java.util.List; - -/** - * A template for noise generator configs used in {@link ConfigurableChunkGenerator configurable chunk generators}. - */ -public interface NoiseGeneratorConfigTemplate extends DataPackEntry { - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - NoiseGeneratorConfig config(); - - interface Builder extends DataPackEntryBuilder { - - /** - * Sets the noise configuration - * - * @param config The noise configuration - * @return This builder, for chaining - */ - Builder noiseConfig(NoiseConfig config); - - /** - * Sets the surface rule. - * - * @param rule The surface rule - * @return This builder, for chaining - */ - Builder surfaceRule(SurfaceRule rule); - - /** - * Sets the default block used for terrain. - * - * @param block The block - * @return This builder, for chaining - */ - Builder defaultBlock(BlockState block); - - /** - * Sets the default fluid used for seas and lakes. - * - * @param fluid The fluid - * @return This builder, for chaining - */ - Builder defaultFluid(BlockState fluid); - - /** - * Sets the sea level. - * - * @param y The sea level - * @return This builder, for chaining - */ - Builder seaLevel(int y); - - /** - * Sets whether to generate aquifers. - * - * @param enableAquifers true to enable aquifers - * @return This builder, for chaining - */ - Builder aquifers(boolean enableAquifers); - - /** - * Sets whether to generate or veins. - * - * @param enableOreVeins true to enable ore veins - * @return This builder, for chaining - */ - Builder oreVeins(boolean enableOreVeins); - - /** - * Sets whether to enable mob generation. - * - * @param mobGeneration true to enable mob generation - * @return This builder, for chaining - */ - Builder mobGeneration(boolean mobGeneration); - - /** - * Sets whether to use the legacy random source. - * @param useLegacyRandomSource true when using the legacy random source - * @return This builder, for chaining - */ - Builder randomSource(boolean useLegacyRandomSource); - - /** - * Sets the noise router. - * @param router The noise router - * @return This builder, for chaining - */ - Builder noiseRouter(NoiseRouter router); - - /** - * Sets the biome attributes in which the initial {@link ServerWorldProperties#spawnPosition()} is allowed. - * - * @param spawnTargets The spawn targets - * @return This builder, for chaining - */ - Builder spawnTargets(List spawnTargets); - } -} diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfigs.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfigs.java index ab6cbc2bab3..7fa89295d95 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfigs.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseGeneratorConfigs.java @@ -62,6 +62,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.NOISE_GENERATOR_CONFIG, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.NOISE_GENERATOR_CONFIG, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseRouter.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseRouter.java index 04851409986..39b11da0891 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseRouter.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseRouter.java @@ -100,13 +100,6 @@ public interface NoiseRouter { */ DensityFunction ridges(); - /** - * Returns the density function for initialDensityWithoutJaggedness - * - * @return The density function - */ - DensityFunction initialDensityWithoutJaggedness(); - /** * Returns the density function for finalDensity * diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseTemplate.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseTemplate.java deleted file mode 100644 index 29f3d9a2e69..00000000000 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/NoiseTemplate.java +++ /dev/null @@ -1,76 +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.generation.config.noise; - -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; - -import java.util.List; - -/** - * A template for {@link Noise}. - */ -public interface NoiseTemplate extends DataPackEntry { - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the noise. - * - * @return The noise - */ - Noise noise(); - - interface Builder extends DataPackEntryBuilder { - - /** - * Sets the octave. - * - * @param octave The octave. - * @return This builder, for chaining - */ - Builder octave(int octave); - - /** - * Sets the amplitudes. - * - * @param amplitudes The amplitudes - * @return This builder, for chaining - */ - Builder amplitudes(double... amplitudes); - - /** - * Sets the amplitudes. - * - * @param amplitudes The amplitudes - * @return This builder, for chaining - */ - Builder amplitudes(List amplitudes); - - } -} diff --git a/src/main/java/org/spongepowered/api/world/generation/config/noise/Noises.java b/src/main/java/org/spongepowered/api/world/generation/config/noise/Noises.java index 27d68a3d0f1..9b165e7f826 100644 --- a/src/main/java/org/spongepowered/api/world/generation/config/noise/Noises.java +++ b/src/main/java/org/spongepowered/api/world/generation/config/noise/Noises.java @@ -168,6 +168,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.NOISE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.NOISE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/DecorationStep.java b/src/main/java/org/spongepowered/api/world/generation/feature/DecorationStep.java index a7f0c057286..52890184feb 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/DecorationStep.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/DecorationStep.java @@ -24,6 +24,8 @@ */ package org.spongepowered.api.world.generation.feature; +import org.spongepowered.api.data.type.StringRepresentable; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.world.biome.Biome; @@ -31,6 +33,6 @@ * A step in which {@link PlacedFeature features} are placed for a {@link Biome} during world generation. */ @CatalogedBy(DecorationSteps.class) -public interface DecorationStep { +public interface DecorationStep extends DefaultedRegistryValue, StringRepresentable { } diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/Feature.java b/src/main/java/org/spongepowered/api/world/generation/feature/Feature.java index 672839055a0..a18e4a3d6e9 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/Feature.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/Feature.java @@ -25,8 +25,12 @@ package org.spongepowered.api.world.generation.feature; +import org.spongepowered.api.Sponge; import org.spongepowered.api.data.persistence.DataView; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.api.world.server.ServerWorld; @@ -37,7 +41,16 @@ *

    Features are used in world generation as a part of {@link PlacedFeature placed features}

    */ @CatalogedBy(Features.class) -public interface Feature extends DefaultedRegistryValue { +public interface Feature extends DefaultedRegistryValue, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create a {@link Feature}. + * + * @return The new builder + */ + static Feature.Builder builder() { + return Sponge.game().builderProvider().provide(Feature.Builder.class); + } /** * Returns the feature type. @@ -73,4 +86,17 @@ public interface Feature extends DefaultedRegistryValue { */ boolean place(ServerLocation location); + /** + * A builder to create {@link Feature}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the given {@link FeatureType}. + * + * @param type The feature type + * @return The builder, for chaining + */ + Builder type(FeatureType type); + } } diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/FeatureType.java b/src/main/java/org/spongepowered/api/world/generation/feature/FeatureType.java index ccc74f558bd..73813c7e9bb 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/FeatureType.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/FeatureType.java @@ -29,7 +29,7 @@ import org.spongepowered.api.util.annotation.CatalogedBy; @CatalogedBy(FeatureTypes.class) -public interface FeatureType extends DefaultedRegistryValue { +public interface FeatureType extends DefaultedRegistryValue { /** * Returns the configured feature diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/FeatureTypes.java b/src/main/java/org/spongepowered/api/world/generation/feature/FeatureTypes.java index 868924aeb89..c13eae1cb2a 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/FeatureTypes.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/FeatureTypes.java @@ -78,6 +78,8 @@ public final class FeatureTypes { public static final DefaultedRegistryReference END_SPIKE = FeatureTypes.key(ResourceKey.minecraft("end_spike")); + public static final DefaultedRegistryReference FALLEN_TREE = FeatureTypes.key(ResourceKey.minecraft("fallen_tree")); + public static final DefaultedRegistryReference FILL_LAYER = FeatureTypes.key(ResourceKey.minecraft("fill_layer")); public static final DefaultedRegistryReference FLOWER = FeatureTypes.key(ResourceKey.minecraft("flower")); @@ -172,6 +174,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.FEATURE_TYPE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.FEATURE_TYPE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/Features.java b/src/main/java/org/spongepowered/api/world/generation/feature/Features.java index f3bbaf8ec81..6c10c877f2c 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/Features.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/Features.java @@ -60,10 +60,14 @@ public final class Features { public static final DefaultedRegistryReference BIRCH_BEES_0002 = Features.key(ResourceKey.minecraft("birch_bees_0002")); + public static final DefaultedRegistryReference BIRCH_BEES_0002_LEAF_LITTER = Features.key(ResourceKey.minecraft("birch_bees_0002_leaf_litter")); + public static final DefaultedRegistryReference BIRCH_BEES_002 = Features.key(ResourceKey.minecraft("birch_bees_002")); public static final DefaultedRegistryReference BIRCH_BEES_005 = Features.key(ResourceKey.minecraft("birch_bees_005")); + public static final DefaultedRegistryReference BIRCH_LEAF_LITTER = Features.key(ResourceKey.minecraft("birch_leaf_litter")); + public static final DefaultedRegistryReference BIRCH_TALL = Features.key(ResourceKey.minecraft("birch_tall")); public static final DefaultedRegistryReference BLACKSTONE_BLOBS = Features.key(ResourceKey.minecraft("blackstone_blobs")); @@ -98,6 +102,8 @@ public final class Features { public static final DefaultedRegistryReference DARK_OAK = Features.key(ResourceKey.minecraft("dark_oak")); + public static final DefaultedRegistryReference DARK_OAK_LEAF_LITTER = Features.key(ResourceKey.minecraft("dark_oak_leaf_litter")); + public static final DefaultedRegistryReference DELTA = Features.key(ResourceKey.minecraft("delta")); public static final DefaultedRegistryReference DESERT_WELL = Features.key(ResourceKey.minecraft("desert_well")); @@ -124,16 +130,28 @@ public final class Features { public static final DefaultedRegistryReference END_SPIKE = Features.key(ResourceKey.minecraft("end_spike")); + public static final DefaultedRegistryReference FALLEN_BIRCH_TREE = Features.key(ResourceKey.minecraft("fallen_birch_tree")); + + public static final DefaultedRegistryReference FALLEN_JUNGLE_TREE = Features.key(ResourceKey.minecraft("fallen_jungle_tree")); + + public static final DefaultedRegistryReference FALLEN_OAK_TREE = Features.key(ResourceKey.minecraft("fallen_oak_tree")); + + public static final DefaultedRegistryReference FALLEN_SPRUCE_TREE = Features.key(ResourceKey.minecraft("fallen_spruce_tree")); + + public static final DefaultedRegistryReference FALLEN_SUPER_BIRCH_TREE = Features.key(ResourceKey.minecraft("fallen_super_birch_tree")); + public static final DefaultedRegistryReference FANCY_OAK = Features.key(ResourceKey.minecraft("fancy_oak")); public static final DefaultedRegistryReference FANCY_OAK_BEES = Features.key(ResourceKey.minecraft("fancy_oak_bees")); - public static final DefaultedRegistryReference FANCY_OAK_BEES_0002 = Features.key(ResourceKey.minecraft("fancy_oak_bees_0002")); + public static final DefaultedRegistryReference FANCY_OAK_BEES_0002_LEAF_LITTER = Features.key(ResourceKey.minecraft("fancy_oak_bees_0002_leaf_litter")); public static final DefaultedRegistryReference FANCY_OAK_BEES_002 = Features.key(ResourceKey.minecraft("fancy_oak_bees_002")); public static final DefaultedRegistryReference FANCY_OAK_BEES_005 = Features.key(ResourceKey.minecraft("fancy_oak_bees_005")); + public static final DefaultedRegistryReference FANCY_OAK_LEAF_LITTER = Features.key(ResourceKey.minecraft("fancy_oak_leaf_litter")); + public static final DefaultedRegistryReference FLOWER_CHERRY = Features.key(ResourceKey.minecraft("flower_cherry")); public static final DefaultedRegistryReference FLOWER_DEFAULT = Features.key(ResourceKey.minecraft("flower_default")); @@ -142,6 +160,8 @@ public final class Features { public static final DefaultedRegistryReference FLOWER_MEADOW = Features.key(ResourceKey.minecraft("flower_meadow")); + public static final DefaultedRegistryReference FLOWER_PALE_GARDEN = Features.key(ResourceKey.minecraft("flower_pale_garden")); + public static final DefaultedRegistryReference FLOWER_PLAIN = Features.key(ResourceKey.minecraft("flower_plain")); public static final DefaultedRegistryReference FLOWER_SWAMP = Features.key(ResourceKey.minecraft("flower_swamp")); @@ -218,12 +238,14 @@ public final class Features { public static final DefaultedRegistryReference OAK = Features.key(ResourceKey.minecraft("oak")); - public static final DefaultedRegistryReference OAK_BEES_0002 = Features.key(ResourceKey.minecraft("oak_bees_0002")); + public static final DefaultedRegistryReference OAK_BEES_0002_LEAF_LITTER = Features.key(ResourceKey.minecraft("oak_bees_0002_leaf_litter")); public static final DefaultedRegistryReference OAK_BEES_002 = Features.key(ResourceKey.minecraft("oak_bees_002")); public static final DefaultedRegistryReference OAK_BEES_005 = Features.key(ResourceKey.minecraft("oak_bees_005")); + public static final DefaultedRegistryReference OAK_LEAF_LITTER = Features.key(ResourceKey.minecraft("oak_leaf_litter")); + public static final DefaultedRegistryReference ORE_ANCIENT_DEBRIS_LARGE = Features.key(ResourceKey.minecraft("ore_ancient_debris_large")); public static final DefaultedRegistryReference ORE_ANCIENT_DEBRIS_SMALL = Features.key(ResourceKey.minecraft("ore_ancient_debris_small")); @@ -288,24 +310,50 @@ public final class Features { public static final DefaultedRegistryReference ORE_TUFF = Features.key(ResourceKey.minecraft("ore_tuff")); + public static final DefaultedRegistryReference PALE_FOREST_FLOWERS = Features.key(ResourceKey.minecraft("pale_forest_flowers")); + + public static final DefaultedRegistryReference PALE_GARDEN_VEGETATION = Features.key(ResourceKey.minecraft("pale_garden_vegetation")); + + public static final DefaultedRegistryReference PALE_MOSS_PATCH = Features.key(ResourceKey.minecraft("pale_moss_patch")); + + public static final DefaultedRegistryReference PALE_MOSS_PATCH_BONEMEAL = Features.key(ResourceKey.minecraft("pale_moss_patch_bonemeal")); + + public static final DefaultedRegistryReference PALE_MOSS_VEGETATION = Features.key(ResourceKey.minecraft("pale_moss_vegetation")); + + public static final DefaultedRegistryReference PALE_OAK = Features.key(ResourceKey.minecraft("pale_oak")); + + public static final DefaultedRegistryReference PALE_OAK_BONEMEAL = Features.key(ResourceKey.minecraft("pale_oak_bonemeal")); + + public static final DefaultedRegistryReference PALE_OAK_CREAKING = Features.key(ResourceKey.minecraft("pale_oak_creaking")); + public static final DefaultedRegistryReference PATCH_BERRY_BUSH = Features.key(ResourceKey.minecraft("patch_berry_bush")); public static final DefaultedRegistryReference PATCH_BROWN_MUSHROOM = Features.key(ResourceKey.minecraft("patch_brown_mushroom")); + public static final DefaultedRegistryReference PATCH_BUSH = Features.key(ResourceKey.minecraft("patch_bush")); + public static final DefaultedRegistryReference PATCH_CACTUS = Features.key(ResourceKey.minecraft("patch_cactus")); public static final DefaultedRegistryReference PATCH_CRIMSON_ROOTS = Features.key(ResourceKey.minecraft("patch_crimson_roots")); public static final DefaultedRegistryReference PATCH_DEAD_BUSH = Features.key(ResourceKey.minecraft("patch_dead_bush")); + public static final DefaultedRegistryReference PATCH_DRY_GRASS = Features.key(ResourceKey.minecraft("patch_dry_grass")); + public static final DefaultedRegistryReference PATCH_FIRE = Features.key(ResourceKey.minecraft("patch_fire")); + public static final DefaultedRegistryReference PATCH_FIREFLY_BUSH = Features.key(ResourceKey.minecraft("patch_firefly_bush")); + public static final DefaultedRegistryReference PATCH_GRASS = Features.key(ResourceKey.minecraft("patch_grass")); public static final DefaultedRegistryReference PATCH_GRASS_JUNGLE = Features.key(ResourceKey.minecraft("patch_grass_jungle")); + public static final DefaultedRegistryReference PATCH_GRASS_MEADOW = Features.key(ResourceKey.minecraft("patch_grass_meadow")); + public static final DefaultedRegistryReference PATCH_LARGE_FERN = Features.key(ResourceKey.minecraft("patch_large_fern")); + public static final DefaultedRegistryReference PATCH_LEAF_LITTER = Features.key(ResourceKey.minecraft("patch_leaf_litter")); + public static final DefaultedRegistryReference PATCH_MELON = Features.key(ResourceKey.minecraft("patch_melon")); public static final DefaultedRegistryReference PATCH_PUMPKIN = Features.key(ResourceKey.minecraft("patch_pumpkin")); @@ -350,8 +398,6 @@ public final class Features { public static final DefaultedRegistryReference SEAGRASS_SHORT = Features.key(ResourceKey.minecraft("seagrass_short")); - public static final DefaultedRegistryReference SEAGRASS_SIMPLE = Features.key(ResourceKey.minecraft("seagrass_simple")); - public static final DefaultedRegistryReference SEAGRASS_SLIGHTLY_LESS_SHORT = Features.key(ResourceKey.minecraft("seagrass_slightly_less_short")); public static final DefaultedRegistryReference SEAGRASS_TALL = Features.key(ResourceKey.minecraft("seagrass_tall")); @@ -386,7 +432,11 @@ public final class Features { public static final DefaultedRegistryReference TALL_MANGROVE = Features.key(ResourceKey.minecraft("tall_mangrove")); - public static final DefaultedRegistryReference TREES_BIRCH_AND_OAK = Features.key(ResourceKey.minecraft("trees_birch_and_oak")); + public static final DefaultedRegistryReference TREES_BADLANDS = Features.key(ResourceKey.minecraft("trees_badlands")); + + public static final DefaultedRegistryReference TREES_BIRCH = Features.key(ResourceKey.minecraft("trees_birch")); + + public static final DefaultedRegistryReference TREES_BIRCH_AND_OAK_LEAF_LITTER = Features.key(ResourceKey.minecraft("trees_birch_and_oak_leaf_litter")); public static final DefaultedRegistryReference TREES_FLOWER_FOREST = Features.key(ResourceKey.minecraft("trees_flower_forest")); @@ -402,6 +452,8 @@ public final class Features { public static final DefaultedRegistryReference TREES_SAVANNA = Features.key(ResourceKey.minecraft("trees_savanna")); + public static final DefaultedRegistryReference TREES_SNOWY = Features.key(ResourceKey.minecraft("trees_snowy")); + public static final DefaultedRegistryReference TREES_SPARSE_JUNGLE = Features.key(ResourceKey.minecraft("trees_sparse_jungle")); public static final DefaultedRegistryReference TREES_TAIGA = Features.key(ResourceKey.minecraft("trees_taiga")); @@ -432,6 +484,10 @@ public final class Features { public static final DefaultedRegistryReference WEEPING_VINES = Features.key(ResourceKey.minecraft("weeping_vines")); + public static final DefaultedRegistryReference WILDFLOWERS_BIRCH_FOREST = Features.key(ResourceKey.minecraft("wildflowers_birch_forest")); + + public static final DefaultedRegistryReference WILDFLOWERS_MEADOW = Features.key(ResourceKey.minecraft("wildflowers_meadow")); + private Features() { } @@ -440,6 +496,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.FEATURE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.FEATURE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeature.java b/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeature.java index d91583d8be9..fb983833939 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeature.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeature.java @@ -24,7 +24,11 @@ */ package org.spongepowered.api.world.generation.feature; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.api.world.server.ServerWorld; @@ -37,7 +41,16 @@ *

    Modifiers can impact position, rarity, count and more.

    */ @CatalogedBy(PlacedFeatures.class) -public interface PlacedFeature extends DefaultedRegistryValue { +public interface PlacedFeature extends DefaultedRegistryValue, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create a {@link PlacedFeature}. + * + * @return The new builder + */ + static PlacedFeature.Builder builder() { + return Sponge.game().builderProvider().provide(PlacedFeature.Builder.class); + } /** * Returns the feature. @@ -72,4 +85,25 @@ public interface PlacedFeature extends DefaultedRegistryValue { */ boolean place(ServerLocation location); + /** + * A builder to create {@link PlacedFeature}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the {@link Feature}. + * + * @param feature The feature + * @return The builder, for chaining + */ + Builder feature(Feature feature); + + /** + * Adds a {@link PlacementModifier placement modifier}. + * + * @param modifier The placement modifier + * @return The builder, for chaining + */ + Builder addModifier(PlacementModifier modifier); + } } diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeatureTemplate.java b/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeatureTemplate.java deleted file mode 100644 index 98b0a2b53ad..00000000000 --- a/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeatureTemplate.java +++ /dev/null @@ -1,75 +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.generation.feature; - -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; - -/** - * A template for {@link PlacedFeature placed features} - */ -public interface PlacedFeatureTemplate extends DataPackEntry { - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the placed feature. - * - * @return The placed feature - */ - PlacedFeature feature(); - - interface Builder extends DataPackEntryBuilder { - - /** - * Sets the {@link Feature}. - * - * @param feature The feature - * @return The builder, for chaining - */ - Builder feature(Feature feature); - - /** - * Initializes the builder with all data from given {@link FeatureTemplate}. - * - * @param feature The feature template - * @return The builder, for chaining - */ - Builder feature(FeatureTemplate feature); - - /** - * Adds a {@link PlacementModifier placement modifier}. - * - * @param modifier The placement modifier - * @return The builder, for chaining - */ - Builder addModifier(PlacementModifier modifier); - - } - -} diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeatures.java b/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeatures.java index 4e7ff7baa97..fa889906ae6 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeatures.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/PlacedFeatures.java @@ -58,10 +58,14 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference BIRCH_BEES_0002 = PlacedFeatures.key(ResourceKey.minecraft("birch_bees_0002")); + public static final DefaultedRegistryReference BIRCH_BEES_0002_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("birch_bees_0002_leaf_litter")); + public static final DefaultedRegistryReference BIRCH_BEES_002 = PlacedFeatures.key(ResourceKey.minecraft("birch_bees_002")); public static final DefaultedRegistryReference BIRCH_CHECKED = PlacedFeatures.key(ResourceKey.minecraft("birch_checked")); + public static final DefaultedRegistryReference BIRCH_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("birch_leaf_litter")); + public static final DefaultedRegistryReference BIRCH_TALL = PlacedFeatures.key(ResourceKey.minecraft("birch_tall")); public static final DefaultedRegistryReference BLACKSTONE_BLOBS = PlacedFeatures.key(ResourceKey.minecraft("blackstone_blobs")); @@ -96,6 +100,8 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference DARK_OAK_CHECKED = PlacedFeatures.key(ResourceKey.minecraft("dark_oak_checked")); + public static final DefaultedRegistryReference DARK_OAK_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("dark_oak_leaf_litter")); + public static final DefaultedRegistryReference DELTA = PlacedFeatures.key(ResourceKey.minecraft("delta")); public static final DefaultedRegistryReference DESERT_WELL = PlacedFeatures.key(ResourceKey.minecraft("desert_well")); @@ -118,14 +124,26 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference END_SPIKE = PlacedFeatures.key(ResourceKey.minecraft("end_spike")); + public static final DefaultedRegistryReference FALLEN_BIRCH_TREE = PlacedFeatures.key(ResourceKey.minecraft("fallen_birch_tree")); + + public static final DefaultedRegistryReference FALLEN_JUNGLE_TREE = PlacedFeatures.key(ResourceKey.minecraft("fallen_jungle_tree")); + + public static final DefaultedRegistryReference FALLEN_OAK_TREE = PlacedFeatures.key(ResourceKey.minecraft("fallen_oak_tree")); + + public static final DefaultedRegistryReference FALLEN_SPRUCE_TREE = PlacedFeatures.key(ResourceKey.minecraft("fallen_spruce_tree")); + + public static final DefaultedRegistryReference FALLEN_SUPER_BIRCH_TREE = PlacedFeatures.key(ResourceKey.minecraft("fallen_super_birch_tree")); + public static final DefaultedRegistryReference FANCY_OAK_BEES = PlacedFeatures.key(ResourceKey.minecraft("fancy_oak_bees")); - public static final DefaultedRegistryReference FANCY_OAK_BEES_0002 = PlacedFeatures.key(ResourceKey.minecraft("fancy_oak_bees_0002")); + public static final DefaultedRegistryReference FANCY_OAK_BEES_0002_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("fancy_oak_bees_0002_leaf_litter")); public static final DefaultedRegistryReference FANCY_OAK_BEES_002 = PlacedFeatures.key(ResourceKey.minecraft("fancy_oak_bees_002")); public static final DefaultedRegistryReference FANCY_OAK_CHECKED = PlacedFeatures.key(ResourceKey.minecraft("fancy_oak_checked")); + public static final DefaultedRegistryReference FANCY_OAK_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("fancy_oak_leaf_litter")); + public static final DefaultedRegistryReference FLOWER_CHERRY = PlacedFeatures.key(ResourceKey.minecraft("flower_cherry")); public static final DefaultedRegistryReference FLOWER_DEFAULT = PlacedFeatures.key(ResourceKey.minecraft("flower_default")); @@ -136,6 +154,8 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference FLOWER_MEADOW = PlacedFeatures.key(ResourceKey.minecraft("flower_meadow")); + public static final DefaultedRegistryReference FLOWER_PALE_GARDEN = PlacedFeatures.key(ResourceKey.minecraft("flower_pale_garden")); + public static final DefaultedRegistryReference FLOWER_PLAIN = PlacedFeatures.key(ResourceKey.minecraft("flower_plain")); public static final DefaultedRegistryReference FLOWER_PLAINS = PlacedFeatures.key(ResourceKey.minecraft("flower_plains")); @@ -210,12 +230,14 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference OAK = PlacedFeatures.key(ResourceKey.minecraft("oak")); - public static final DefaultedRegistryReference OAK_BEES_0002 = PlacedFeatures.key(ResourceKey.minecraft("oak_bees_0002")); + public static final DefaultedRegistryReference OAK_BEES_0002_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("oak_bees_0002_leaf_litter")); public static final DefaultedRegistryReference OAK_BEES_002 = PlacedFeatures.key(ResourceKey.minecraft("oak_bees_002")); public static final DefaultedRegistryReference OAK_CHECKED = PlacedFeatures.key(ResourceKey.minecraft("oak_checked")); + public static final DefaultedRegistryReference OAK_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("oak_leaf_litter")); + public static final DefaultedRegistryReference ORE_ANCIENT_DEBRIS_LARGE = PlacedFeatures.key(ResourceKey.minecraft("ore_ancient_debris_large")); public static final DefaultedRegistryReference ORE_ANDESITE_LOWER = PlacedFeatures.key(ResourceKey.minecraft("ore_andesite_lower")); @@ -296,12 +318,24 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference ORE_TUFF = PlacedFeatures.key(ResourceKey.minecraft("ore_tuff")); + public static final DefaultedRegistryReference PALE_GARDEN_FLOWERS = PlacedFeatures.key(ResourceKey.minecraft("pale_garden_flowers")); + + public static final DefaultedRegistryReference PALE_GARDEN_VEGETATION = PlacedFeatures.key(ResourceKey.minecraft("pale_garden_vegetation")); + + public static final DefaultedRegistryReference PALE_MOSS_PATCH = PlacedFeatures.key(ResourceKey.minecraft("pale_moss_patch")); + + public static final DefaultedRegistryReference PALE_OAK_CHECKED = PlacedFeatures.key(ResourceKey.minecraft("pale_oak_checked")); + + public static final DefaultedRegistryReference PALE_OAK_CREAKING_CHECKED = PlacedFeatures.key(ResourceKey.minecraft("pale_oak_creaking_checked")); + public static final DefaultedRegistryReference PATCH_BERRY_BUSH = PlacedFeatures.key(ResourceKey.minecraft("patch_berry_bush")); public static final DefaultedRegistryReference PATCH_BERRY_COMMON = PlacedFeatures.key(ResourceKey.minecraft("patch_berry_common")); public static final DefaultedRegistryReference PATCH_BERRY_RARE = PlacedFeatures.key(ResourceKey.minecraft("patch_berry_rare")); + public static final DefaultedRegistryReference PATCH_BUSH = PlacedFeatures.key(ResourceKey.minecraft("patch_bush")); + public static final DefaultedRegistryReference PATCH_CACTUS = PlacedFeatures.key(ResourceKey.minecraft("patch_cactus")); public static final DefaultedRegistryReference PATCH_CACTUS_DECORATED = PlacedFeatures.key(ResourceKey.minecraft("patch_cactus_decorated")); @@ -316,14 +350,26 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference PATCH_DEAD_BUSH_BADLANDS = PlacedFeatures.key(ResourceKey.minecraft("patch_dead_bush_badlands")); + public static final DefaultedRegistryReference PATCH_DRY_GRASS_BADLANDS = PlacedFeatures.key(ResourceKey.minecraft("patch_dry_grass_badlands")); + + public static final DefaultedRegistryReference PATCH_DRY_GRASS_DESERT = PlacedFeatures.key(ResourceKey.minecraft("patch_dry_grass_desert")); + public static final DefaultedRegistryReference PATCH_FIRE = PlacedFeatures.key(ResourceKey.minecraft("patch_fire")); + public static final DefaultedRegistryReference PATCH_FIREFLY_BUSH_NEAR_WATER = PlacedFeatures.key(ResourceKey.minecraft("patch_firefly_bush_near_water")); + + public static final DefaultedRegistryReference PATCH_FIREFLY_BUSH_NEAR_WATER_SWAMP = PlacedFeatures.key(ResourceKey.minecraft("patch_firefly_bush_near_water_swamp")); + + public static final DefaultedRegistryReference PATCH_FIREFLY_BUSH_SWAMP = PlacedFeatures.key(ResourceKey.minecraft("patch_firefly_bush_swamp")); + public static final DefaultedRegistryReference PATCH_GRASS_BADLANDS = PlacedFeatures.key(ResourceKey.minecraft("patch_grass_badlands")); public static final DefaultedRegistryReference PATCH_GRASS_FOREST = PlacedFeatures.key(ResourceKey.minecraft("patch_grass_forest")); public static final DefaultedRegistryReference PATCH_GRASS_JUNGLE = PlacedFeatures.key(ResourceKey.minecraft("patch_grass_jungle")); + public static final DefaultedRegistryReference PATCH_GRASS_MEADOW = PlacedFeatures.key(ResourceKey.minecraft("patch_grass_meadow")); + public static final DefaultedRegistryReference PATCH_GRASS_NORMAL = PlacedFeatures.key(ResourceKey.minecraft("patch_grass_normal")); public static final DefaultedRegistryReference PATCH_GRASS_PLAIN = PlacedFeatures.key(ResourceKey.minecraft("patch_grass_plain")); @@ -336,6 +382,8 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference PATCH_LARGE_FERN = PlacedFeatures.key(ResourceKey.minecraft("patch_large_fern")); + public static final DefaultedRegistryReference PATCH_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("patch_leaf_litter")); + public static final DefaultedRegistryReference PATCH_MELON = PlacedFeatures.key(ResourceKey.minecraft("patch_melon")); public static final DefaultedRegistryReference PATCH_MELON_SPARSE = PlacedFeatures.key(ResourceKey.minecraft("patch_melon_sparse")); @@ -410,8 +458,6 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference SEAGRASS_RIVER = PlacedFeatures.key(ResourceKey.minecraft("seagrass_river")); - public static final DefaultedRegistryReference SEAGRASS_SIMPLE = PlacedFeatures.key(ResourceKey.minecraft("seagrass_simple")); - public static final DefaultedRegistryReference SEAGRASS_SWAMP = PlacedFeatures.key(ResourceKey.minecraft("seagrass_swamp")); public static final DefaultedRegistryReference SEAGRASS_WARM = PlacedFeatures.key(ResourceKey.minecraft("seagrass_warm")); @@ -452,7 +498,7 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference TREES_BIRCH = PlacedFeatures.key(ResourceKey.minecraft("trees_birch")); - public static final DefaultedRegistryReference TREES_BIRCH_AND_OAK = PlacedFeatures.key(ResourceKey.minecraft("trees_birch_and_oak")); + public static final DefaultedRegistryReference TREES_BIRCH_AND_OAK_LEAF_LITTER = PlacedFeatures.key(ResourceKey.minecraft("trees_birch_and_oak_leaf_litter")); public static final DefaultedRegistryReference TREES_CHERRY = PlacedFeatures.key(ResourceKey.minecraft("trees_cherry")); @@ -506,6 +552,10 @@ public final class PlacedFeatures { public static final DefaultedRegistryReference WEEPING_VINES = PlacedFeatures.key(ResourceKey.minecraft("weeping_vines")); + public static final DefaultedRegistryReference WILDFLOWERS_BIRCH_FOREST = PlacedFeatures.key(ResourceKey.minecraft("wildflowers_birch_forest")); + + public static final DefaultedRegistryReference WILDFLOWERS_MEADOW = PlacedFeatures.key(ResourceKey.minecraft("wildflowers_meadow")); + private PlacedFeatures() { } @@ -514,6 +564,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.PLACED_FEATURE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.PLACED_FEATURE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierType.java b/src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierType.java index a6a90e02ead..78f7a8ced42 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierType.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierType.java @@ -25,13 +25,14 @@ package org.spongepowered.api.world.generation.feature; import org.spongepowered.api.data.persistence.DataView; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; /** * A type of {@link PlacementModifier}. */ @CatalogedBy(PlacementModifierTypes.class) -public interface PlacementModifierType { +public interface PlacementModifierType extends DefaultedRegistryValue { /** * Returns the placement modifier. diff --git a/src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierTypes.java b/src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierTypes.java index f8b2ec1cdc3..14db885ec0e 100644 --- a/src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierTypes.java +++ b/src/main/java/org/spongepowered/api/world/generation/feature/PlacementModifierTypes.java @@ -44,8 +44,6 @@ public final class PlacementModifierTypes { public static final DefaultedRegistryReference BLOCK_PREDICATE_FILTER = PlacementModifierTypes.key(ResourceKey.minecraft("block_predicate_filter")); - public static final DefaultedRegistryReference CARVING_MASK = PlacementModifierTypes.key(ResourceKey.minecraft("carving_mask")); - public static final DefaultedRegistryReference COUNT = PlacementModifierTypes.key(ResourceKey.minecraft("count")); public static final DefaultedRegistryReference COUNT_ON_EVERY_LAYER = PlacementModifierTypes.key(ResourceKey.minecraft("count_on_every_layer")); @@ -80,6 +78,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.PLACEMENT_MODIFIER, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.PLACEMENT_MODIFIER, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/Structure.java b/src/main/java/org/spongepowered/api/world/generation/structure/Structure.java index 77317352816..e3bbd90de4a 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/Structure.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/Structure.java @@ -25,6 +25,7 @@ package org.spongepowered.api.world.generation.structure; import org.spongepowered.api.data.persistence.DataView; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.entity.EntityCategory; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; @@ -43,7 +44,7 @@ * A structure used in world generation. */ @CatalogedBy(Structures.class) -public interface Structure extends DefaultedRegistryValue { +public interface Structure extends DefaultedRegistryValue, DataPackSerializable { /** * Places the structure at given position and world diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/StructureSet.java b/src/main/java/org/spongepowered/api/world/generation/structure/StructureSet.java index b2f35b866f1..e562f2427ed 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/StructureSet.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/StructureSet.java @@ -24,6 +24,11 @@ */ package org.spongepowered.api.world.generation.structure; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.util.weighted.WeightedTable; @@ -31,7 +36,16 @@ * A weighted list of {@link Structure structures}. */ @CatalogedBy(StructureSets.class) -public interface StructureSet { +public interface StructureSet extends DefaultedRegistryValue, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create a {@link StructureSet}. + * + * @return The new builder + */ + static StructureSet.Builder builder() { + return Sponge.game().builderProvider().provide(StructureSet.Builder.class); + } /** * Returns the structures included in the structure set. @@ -47,4 +61,26 @@ public interface StructureSet { */ StructurePlacement placement(); + /** + * A builder to create {@link StructureSet}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the structure placement. + * + * @param placement The placement + * @return This builder, for chaining + */ + Builder placement(StructurePlacement placement); + + /** + * Adds a structure with given weight. + * + * @param structure The structure + * @param weight The weight + * @return This builder, for chaining + */ + Builder add(Structure structure, int weight); + } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/StructureSetTemplate.java b/src/main/java/org/spongepowered/api/world/generation/structure/StructureSetTemplate.java deleted file mode 100644 index 66e5beaaa9d..00000000000 --- a/src/main/java/org/spongepowered/api/world/generation/structure/StructureSetTemplate.java +++ /dev/null @@ -1,66 +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.generation.structure; - -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; - -/** - * A template for {@link StructureSet structure sets} - */ -public interface StructureSetTemplate extends DataPackEntry { - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the structure set. - * - * @return The structure set - */ - StructureSet structureSet(); - - interface Builder extends DataPackEntryBuilder { - - /** - * Sets the structure placement. - * - * @param placement The placement - * @return This builder, for chaining - */ - Builder placement(StructurePlacement placement); - - /** - * Adds a structure with given weight. - * - * @param structure The structure - * @param weight The weight - * @return This builder, for chaining - */ - Builder add(Structure structure, int weight); - } -} diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/StructureSets.java b/src/main/java/org/spongepowered/api/world/generation/structure/StructureSets.java index 88430148c8b..257326a79c7 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/StructureSets.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/StructureSets.java @@ -88,6 +88,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.STRUCTURE_SET, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.STRUCTURE_SET, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/StructureTemplate.java b/src/main/java/org/spongepowered/api/world/generation/structure/StructureTemplate.java deleted file mode 100644 index 5f559f3ba81..00000000000 --- a/src/main/java/org/spongepowered/api/world/generation/structure/StructureTemplate.java +++ /dev/null @@ -1,81 +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.generation.structure; - -import org.spongepowered.api.Sponge; -import org.spongepowered.api.data.persistence.DataView; -import org.spongepowered.api.datapack.DataPack; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.util.DataPackEntryBuilder; - -import java.io.IOException; - -/** - * A template for {@link Structure structures} - */ -public interface StructureTemplate extends DataPackEntry { - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the structure. - * - * @return The structure. - */ - Structure structure(); - - interface Builder extends DataPackEntryBuilder { - - /** - * Initializes the builder with given structure. - * - * @param structure The structure - * @return This builder, for chaining - */ - @Override - Builder fromValue(Structure structure); - - /** - * Initializes the builder with the data from given {@link DataView}. - * {@link StructureTemplate#toContainer()} - * - * @param datapack The data pack data - * @return This builder, for chaining - */ - @Override - Builder fromDataPack(DataView datapack) throws IOException; - - /** - * Sets the data pack - * - * @param pack The data pack - * @return This builder, for chaining - */ - @Override - Builder pack(DataPack pack); - } -} diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/StructureType.java b/src/main/java/org/spongepowered/api/world/generation/structure/StructureType.java index 3bdbdf27d5a..315834472ef 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/StructureType.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/StructureType.java @@ -32,7 +32,7 @@ * A type of {@link Structure} */ @CatalogedBy(StructureTypes.class) -public interface StructureType extends DefaultedRegistryValue { +public interface StructureType extends DefaultedRegistryValue { /** * Returns the configured structure diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/Structures.java b/src/main/java/org/spongepowered/api/world/generation/structure/Structures.java index 9916854cefb..d3001b2a8f5 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/Structures.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/Structures.java @@ -116,6 +116,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.STRUCTURE, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.STRUCTURE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPool.java b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPool.java index d1cfbcde84b..c05d328c5fe 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPool.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPool.java @@ -24,7 +24,13 @@ */ package org.spongepowered.api.world.generation.structure.jigsaw; +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.registry.RegistryReference; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; import org.spongepowered.api.util.weighted.WeightedTable; import org.spongepowered.api.world.generation.structure.Structure; @@ -33,7 +39,16 @@ * A pool to generate {@link Structure structures} using jigsaw blocks. */ @CatalogedBy(JigsawPools.class) -public interface JigsawPool extends DefaultedRegistryValue { +public interface JigsawPool extends DefaultedRegistryValue, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create a {@link JigsawPool}. + * + * @return The new builder + */ + static JigsawPool.Builder builder() { + return Sponge.game().builderProvider().provide(JigsawPool.Builder.class); + } /** * Returns the fallback pool, used when the selec @@ -50,4 +65,42 @@ public interface JigsawPool extends DefaultedRegistryValue { */ WeightedTable elements(); + /** + * A builder to create {@link JigsawPool}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Adds a jigsaw element with given weight. + * + * @param element The element + * @param weight The weight + * @return This builder, for chaining + */ + Builder add(JigsawPoolElement element, int weight); + + /** + * Sets the name of the jigsaw pool. + * + * @param name The name + * @return This builder, for chaining + */ + Builder name(ResourceKey name); + + /** + * Sets the fallback for the jigsaw pool. + * + * @param fallback The fallback jigsaw pool + * @return This builder, for chaining + */ + Builder fallback(RegistryReference fallback); + + /** + * Sets the fallback for the jigsaw pool. + * + * @param fallback the fallback jigsaw pool + * @return This builder, for chaining + */ + Builder fallback(JigsawPool fallback); + } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPoolElement.java b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPoolElement.java index b56f417cae2..06a586e22da 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPoolElement.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPoolElement.java @@ -27,7 +27,7 @@ import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; import org.spongepowered.api.world.generation.feature.PlacedFeature; -import org.spongepowered.api.world.generation.structure.SchematicTemplate; +import org.spongepowered.api.world.schematic.Schematic; import org.spongepowered.api.world.server.ServerLocation; import java.util.List; @@ -92,7 +92,7 @@ interface Factory { /** * Returns a function providing a legacy element. * - * @param template The template key of a {@link SchematicTemplate} + * @param template The template key of a {@link Schematic} * @param processors The processor list * @return The function */ @@ -101,7 +101,7 @@ interface Factory { /** * Returns a function providing a single element. * - * @param template The template key of a {@link SchematicTemplate} + * @param template The template key of a {@link Schematic} * @param processors The processor list * @return The function */ diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPoolTemplate.java b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPoolTemplate.java deleted file mode 100644 index 9a638ba8d1d..00000000000 --- a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPoolTemplate.java +++ /dev/null @@ -1,84 +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.generation.structure.jigsaw; - -import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.registry.RegistryReference; -import org.spongepowered.api.util.DataPackEntryBuilder; - -/** - * A template for {@link JigsawPool jigsaw pools} - */ -public interface JigsawPoolTemplate extends DataPackEntry { - - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - /** - * Returns the jigsaw pool. - * - * @return The jigsaw pool - */ - JigsawPool jigsawPool(); - - interface Builder extends DataPackEntryBuilder { - - /** - * Adds a jigsaw element with given weight. - * - * @param element The element - * @param weight The weight - * @return This builder, for chaining - */ - Builder add(JigsawPoolElement element, int weight); - - /** - * Sets the name of the jigsaw pool. - * - * @param name The name - * @return This builder, for chaining - */ - Builder name(ResourceKey name); - - /** - * Sets the fallback for the jigsaw pool. - * - * @param fallback The fallback jigsaw pool - * @return This builder, for chaining - */ - Builder fallback(RegistryReference fallback); - - /** - * Sets the fallback for the jigsaw pool. - * - * @param fallback the fallback jigsaw pool - * @return This builder, for chaining - */ - Builder fallback(JigsawPoolTemplate fallback); - } -} diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPools.java b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPools.java index 0a1b234579c..8725ee5fa03 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPools.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/JigsawPools.java @@ -232,8 +232,12 @@ public final class JigsawPools { public static final DefaultedRegistryReference TRIAL_CHAMBERS_DECOR = JigsawPools.key(ResourceKey.minecraft("trial_chambers/decor")); + public static final DefaultedRegistryReference TRIAL_CHAMBERS_DECOR_BED = JigsawPools.key(ResourceKey.minecraft("trial_chambers/decor/bed")); + public static final DefaultedRegistryReference TRIAL_CHAMBERS_DECOR_CHAMBER = JigsawPools.key(ResourceKey.minecraft("trial_chambers/decor/chamber")); + public static final DefaultedRegistryReference TRIAL_CHAMBERS_DECOR_DISPOSAL = JigsawPools.key(ResourceKey.minecraft("trial_chambers/decor/disposal")); + public static final DefaultedRegistryReference TRIAL_CHAMBERS_DISPENSERS_CHAMBER = JigsawPools.key(ResourceKey.minecraft("trial_chambers/dispensers/chamber")); public static final DefaultedRegistryReference TRIAL_CHAMBERS_ENTRANCE = JigsawPools.key(ResourceKey.minecraft("trial_chambers/entrance")); @@ -420,6 +424,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.JIGSAW_POOL, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.JIGSAW_POOL, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorList.java b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorList.java index a6b1d89a375..397cd6ae58c 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorList.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorList.java @@ -24,6 +24,11 @@ */ package org.spongepowered.api.world.generation.structure.jigsaw; +import org.spongepowered.api.Sponge; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; +import org.spongepowered.api.util.Builder; +import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.CatalogedBy; import java.util.List; @@ -32,7 +37,16 @@ * A list of {@link Processor processors}. */ @CatalogedBy(ProcessorLists.class) -public interface ProcessorList { +public interface ProcessorList extends DefaultedRegistryValue, DataPackSerializable { + + /** + * Creates a new {@link Builder} to create a {@link ProcessorList}. + * + * @return The new builder + */ + static ProcessorList.Builder builder() { + return Sponge.game().builderProvider().provide(ProcessorList.Builder.class); + } /** * Returns the list of processors @@ -41,4 +55,17 @@ public interface ProcessorList { */ List processors(); + /** + * A builder to create {@link ProcessorList}s. + */ + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { + + /** + * Sets the list of processors. + * + * @param processors The list of processors + * @return This builder, for chaining + */ + Builder fromValues(List processors); + } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorLists.java b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorLists.java index b2b44501941..309e00250ac 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorLists.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorLists.java @@ -128,6 +128,6 @@ public static Registry registry() { } private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.PROCESSOR_LIST, location).asDefaultedReference(Sponge::server); + return RegistryKey.of(RegistryTypes.PROCESSOR_LIST, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorType.java b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorType.java index a5763e5ece7..6b11aa7d069 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorType.java +++ b/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorType.java @@ -25,6 +25,7 @@ package org.spongepowered.api.world.generation.structure.jigsaw; import org.spongepowered.api.data.persistence.DataView; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.annotation.CatalogedBy; import java.io.IOException; @@ -33,7 +34,7 @@ * A type of {@link Processor}. */ @CatalogedBy(ProcessorTypes.class) -public interface ProcessorType { +public interface ProcessorType extends DefaultedRegistryValue { /** * Returns the configured processor. diff --git a/src/main/java/org/spongepowered/api/world/schematic/PaletteType.java b/src/main/java/org/spongepowered/api/world/schematic/PaletteType.java index dbc39b6f871..9a8abf58ef6 100644 --- a/src/main/java/org/spongepowered/api/world/schematic/PaletteType.java +++ b/src/main/java/org/spongepowered/api/world/schematic/PaletteType.java @@ -35,7 +35,7 @@ import java.util.function.BiFunction; @CatalogedBy(PaletteTypes.class) -public interface PaletteType extends DefaultedRegistryValue { +public interface PaletteType extends DefaultedRegistryValue> { @SuppressWarnings("unchecked") static Builder builder() { diff --git a/src/main/java/org/spongepowered/api/world/schematic/Schematic.java b/src/main/java/org/spongepowered/api/world/schematic/Schematic.java index 5ce9b7d0284..6843f016288 100644 --- a/src/main/java/org/spongepowered/api/world/schematic/Schematic.java +++ b/src/main/java/org/spongepowered/api/world/schematic/Schematic.java @@ -67,6 +67,7 @@ static Builder builder() { * * @return The block palette */ + @Override Palette blockPalette(); /** 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 9e3ebbfda52..6e8d7e391c9 100644 --- a/src/main/java/org/spongepowered/api/world/server/ChunkManager.java +++ b/src/main/java/org/spongepowered/api/world/server/ChunkManager.java @@ -33,7 +33,6 @@ import java.util.Collection; import java.util.Objects; -import java.util.Optional; import java.util.concurrent.CompletableFuture; /** @@ -56,14 +55,14 @@ public interface ChunkManager { * @param ticket The ticket to check. * @return true if so */ - boolean valid(Ticket ticket); + boolean valid(Ticket ticket); /** * Gets the {@link Ticks} remaining on the supplied ticket. * * @return The {@link Ticks} */ - Ticks timeLeft(Ticket ticket); + Ticks timeLeft(Ticket ticket); /** * Request a {@link Ticket} for the given {@link TicketType}. @@ -71,24 +70,22 @@ public interface ChunkManager { * @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. - * @param The type of the supplied {@code value}. * @return The ticket, if granted. */ - Optional> requestTicket(TicketType type, Vector3i chunkOrigin, T value, int radius); + Ticket requestTicket(TicketType type, Vector3i chunkOrigin, int radius); /** * Attempts to renew this ticket, resetting the lifetime to the default. * *

    If this ticket is no longer valid, it cannot be renewed. Instead, - * you should {@link #requestTicket(TicketType, Vector3i, Object, int)} a new one.

    + * you should {@link #requestTicket(TicketType, Vector3i, int)} a new one.

    * * @param ticket The ticket to attempt to renew * @return {@code true} if successful */ - boolean renewTicket(Ticket ticket); + boolean renewTicket(Ticket ticket); /** * Releases the provided {@link Ticket}, allowing the chunk position @@ -97,7 +94,7 @@ public interface ChunkManager { * * @param ticket The ticket to release. */ - boolean releaseTicket(Ticket ticket); + boolean releaseTicket(Ticket ticket); /** * Gets all currently active {@link Ticket tickets} that are of the @@ -107,7 +104,7 @@ public interface ChunkManager { * @param The type of value the {@link Ticket} holds * @return A {@link Collection} of {@link Ticket tickets} */ - Collection> findTickets(TicketType type); + Collection findTickets(TicketType type); /** * Regenerates a chunk at the given chunk coordinate position. diff --git a/src/main/java/org/spongepowered/api/world/server/DataPackManager.java b/src/main/java/org/spongepowered/api/world/server/DataPackManager.java index 81f253701af..277ee481389 100644 --- a/src/main/java/org/spongepowered/api/world/server/DataPackManager.java +++ b/src/main/java/org/spongepowered/api/world/server/DataPackManager.java @@ -24,132 +24,14 @@ */ package org.spongepowered.api.world.server; -import org.spongepowered.api.ResourceKey; -import org.spongepowered.api.datapack.DataPack; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.datapack.DataPackType; - -import java.io.IOException; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Optional; import java.util.concurrent.CompletableFuture; public interface DataPackManager { /** * Reloads all reloadable datapacks. - * Also causes {@link org.spongepowered.api.event.lifecycle.RegisterDataPackValueEvent} to fire * * @return The future when reloading is complete */ CompletableFuture reload(); - - /** - * Saves given data pack entry. If the datapack is reloadable the type is available after {@link #reload()} - * otherwise the server will load the persisted datapack at startup. - *

    To load a world from a {@link WorldTemplate} use {@link WorldManager#loadWorld(WorldTemplate)}

    - * - * @param entry the data pack entry to save - * - * @return True when the type represented by the datapack entry will be available after reloading - */ - > CompletableFuture save(T entry); - - /** - * Loads a {@link DataPackEntry} from given data pack. - * Returned object may not be able to interact well with the active server. - * - * @param pack The data pack - * @param key The data pack entry key - * - * @return The loaded DataPackEntry - */ - > CompletableFuture> load(DataPack pack, ResourceKey key); - - /** - * Deletes the data pack entry in given data pack. - * - * @param pack The data pack - * @param key The data pack entry key - * - * @return True when deleted - */ - boolean delete(DataPack pack, ResourceKey key) throws IOException; - - /** - * Copies a data pack entry in given data pack - * - * @param pack The data pack - * @param from The data pack entry key to copy from - * @param to The data pack entry key to copy to - */ - void copy(final DataPack pack, final ResourceKey from, final ResourceKey to) throws IOException; - - /** - * Copies a data pack entry into another data pack - * - * @param fromPack The data pack to copy from - * @param from The data pack entry key to copy from - * @param toPack The data pack to copy to - * @param to The data pack entry key to copy to - */ - void copy(final DataPack fromPack, final ResourceKey from, final DataPack toPack, final ResourceKey to) throws IOException; - - /** - * Moves a data pack entry in the given data pack - * @param pack The data pack - * @param from The data pack entry key to move from - * @param to The data pack entry key to move to - */ - void move(final DataPack pack, final ResourceKey from, final ResourceKey to) throws IOException; - - /** - * Moves a data pack entry into another data pack - * - * @param fromPack The data pack to move from - * @param from The data pack entry key to move from - * @param toPack The data pack to move to - * @param to The data pack entry key to move to - */ - void move(final DataPack fromPack, final ResourceKey from, final DataPack toPack, final ResourceKey to) throws IOException; - - /** - * Lists the data pack entries of the given data pack. - * - * @param pack The data pack - * - * @return The data pack entries - */ - List list(DataPack pack); - - /** - * Returns a map of all data pack to data pack entry keys matching the given type. - * - * @param packType The data pack type - * - * @return The data pack entries found by data pack - */ - > Map, Collection> find(DataPackType packType); - - /** - * Returns the data pack containing a data pack entry with given key and pack type - * - * @param packType The data pack type - * @param key The data pack entry key - * - * @return The data pack containing the data pack entry - */ - > Optional> findPack(DataPackType packType, ResourceKey key); - - /** - * Returns whether a data pack entry exists in given data pack. - * - * @param pack The data pack - * @param key The data pack entry key - * - * @return True when the data pack entry exists - */ - boolean exists(DataPack pack, ResourceKey key); } diff --git a/src/main/java/org/spongepowered/api/world/server/Ticket.java b/src/main/java/org/spongepowered/api/world/server/Ticket.java index 20e85217f58..e205015117a 100644 --- a/src/main/java/org/spongepowered/api/world/server/Ticket.java +++ b/src/main/java/org/spongepowered/api/world/server/Ticket.java @@ -26,8 +26,20 @@ /** * Represents a chunk loading ticket. - * - * @param The type of value this ticket holds. */ -public interface Ticket { +public interface Ticket { + + /** + * Gets the {@link TicketType} of this ticket. + * + * @return The {@link TicketType} + */ + TicketType type(); + + /** + * Gets the radius of this ticket. + * + * @return The radius + */ + int radius(); } 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 f16f082d405..2ee69086fff 100644 --- a/src/main/java/org/spongepowered/api/world/server/TicketType.java +++ b/src/main/java/org/spongepowered/api/world/server/TicketType.java @@ -24,34 +24,50 @@ */ 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.registry.DefaultedRegistryValue; import org.spongepowered.api.util.ResettableBuilder; import org.spongepowered.api.util.Ticks; - -import java.util.Comparator; +import org.spongepowered.api.util.annotation.CatalogedBy; /** * Represents a type of {@link Ticket chunk loading ticket} that can be obtained * to ensure chunks remain loaded in a {@link ServerWorld}. - * - * @param The type of value that is associated with a {@link Ticket} of this - * type. */ -@SuppressWarnings("unchecked") -public interface TicketType { +@CatalogedBy(TicketTypes.class) +public interface TicketType extends DefaultedRegistryValue { - static Builder builder() { + static Builder builder() { return Sponge.game().builderProvider().provide(Builder.class); } /** - * The name of this type. + * @return Whether tickets of this type are persisted when the world is shut down. + */ + boolean persists(); + + /** + * @return Whether tickets of this type will load chunks. + */ + boolean loadsChunks(); + + /** + * @return Whether tickets of this type will cause chunks to update their blocks and entities. + */ + boolean simulatesChunks(); + + /** + * Gets whether tickets of this type keeps the world active. + * The world may stop processing after being inactive for a certain amount of time. * - * @return The name + * @return Whether tickets of this type keeps the world active. + */ + boolean keepsWorldActive(); + + /** + * @return Whether tickets of this type count down their remaining ticks even their chunks are not loaded. */ - String name(); + boolean canExpireIfUnloaded(); /** * Gets the lifetime of any {@link Ticket tickets} of this type. @@ -61,27 +77,40 @@ static Builder builder() { */ Ticks lifetime(); - interface Builder extends ResettableBuilder> { + interface Builder extends ResettableBuilder { /** - * Sets the name of the {@link TicketType type}. - * - * @param name The name - * @return The builder, for chaining + * @param persists Whether tickets of this type are persisted when the world is shut down. + * @return This builder, for chaining */ - Builder name(@NonNull String name); + Builder persists(boolean persists); /** - * 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 loadsChunks Whether tickets of this type will load chunks. + * @return This builder, for chaining + */ + Builder loadsChunks(boolean loadsChunks); + + /** + * @param simulatesChunks Whether tickets of this type will cause chunks to update their blocks and entities. + * @return This builder, for chaining + */ + Builder simulatesChunks(boolean simulatesChunks); + + /** + * Sets whether tickets of this type keeps the world active. + * The world may stop processing after being inactive for a certain amount of time. * - * @param comparator The comparator - * @return The builder, for chaining + * @param keepsWorldActive Whether tickets of this type keeps the world active. + * @return This builder, for chaining + */ + Builder keepsWorldActive(boolean keepsWorldActive); + + /** + * @param canExpireIfUnloaded Whether tickets of this type count down their remaining ticks even their chunks are not loaded. + * @return This builder, for chaining */ - Builder comparator(@Nullable Comparator comparator); + Builder canExpireIfUnloaded(boolean canExpireIfUnloaded); /** * Sets the lifetime of the {@link TicketType type}. @@ -89,13 +118,13 @@ interface Builder extends ResettableBuilder> { * @param lifetime The lifetime * @return The builder, for chaining */ - Builder lifetime(Ticks lifetime); + Builder lifetime(Ticks lifetime); /** * Builds a new {@link TicketType type}. * * @return The type */ - TicketType build(); + 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 new file mode 100644 index 00000000000..bb6fff8aac4 --- /dev/null +++ b/src/main/java/org/spongepowered/api/world/server/TicketTypes.java @@ -0,0 +1,71 @@ +/* + * 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.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; + +/** + * + */ +@SuppressWarnings("unused") +@RegistryScopes(scopes = RegistryScope.GAME) +public final class TicketTypes { + + public static final DefaultedRegistryReference DRAGON = TicketTypes.key(ResourceKey.minecraft("dragon")); + + public static final DefaultedRegistryReference ENDER_PEARL = TicketTypes.key(ResourceKey.minecraft("ender_pearl")); + + public static final DefaultedRegistryReference FORCED = TicketTypes.key(ResourceKey.minecraft("forced")); + + public static final DefaultedRegistryReference PLAYER_LOADING = TicketTypes.key(ResourceKey.minecraft("player_loading")); + + public static final DefaultedRegistryReference PLAYER_SIMULATION = TicketTypes.key(ResourceKey.minecraft("player_simulation")); + + public static final DefaultedRegistryReference PLAYER_SPAWN = TicketTypes.key(ResourceKey.minecraft("player_spawn")); + + public static final DefaultedRegistryReference PORTAL = TicketTypes.key(ResourceKey.minecraft("portal")); + + public static final DefaultedRegistryReference SPAWN_SEARCH = TicketTypes.key(ResourceKey.minecraft("spawn_search")); + + public static final DefaultedRegistryReference UNKNOWN = TicketTypes.key(ResourceKey.minecraft("unknown")); + + 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/generation/structure/jigsaw/ProcessorListTemplate.java b/src/main/java/org/spongepowered/api/world/server/WorldArchetype.java similarity index 58% rename from src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorListTemplate.java rename to src/main/java/org/spongepowered/api/world/server/WorldArchetype.java index ea1ea220492..5c69d0ca030 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/jigsaw/ProcessorListTemplate.java +++ b/src/main/java/org/spongepowered/api/world/server/WorldArchetype.java @@ -22,39 +22,36 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.world.generation.structure.jigsaw; +package org.spongepowered.api.world.server; import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPackEntry; import org.spongepowered.api.util.CopyableBuilder; -import org.spongepowered.api.util.DataPackEntryBuilder; +import org.spongepowered.api.world.generation.config.WorldGenerationConfig; -import java.util.List; +import java.util.Optional; -/** - * A template for {@link ProcessorList}. - */ -public interface ProcessorListTemplate extends DataPackEntry { +public interface WorldArchetype { + + static WorldArchetype.Builder builder() { + return Sponge.game().builderProvider().provide(WorldArchetype.Builder.class); + } - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); + static WorldArchetype of(WorldArchetypeType type) { + return WorldArchetype.builder().type(type).build(); } - /** - * Returns the processor list. - * @return The processor list - */ - ProcessorList processorList(); + static WorldArchetype of(WorldArchetypeType type, WorldGenerationConfig generationConfig) { + return WorldArchetype.builder().type(type).generationConfig(generationConfig).build(); + } + + WorldArchetypeType type(); + + Optional generationConfig(); - interface Builder extends DataPackEntryBuilder, CopyableBuilder { + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { - /** - * Sets the list of processors. - * - * @param processors The list of processors - * @return This builder, for chaining - */ - Builder fromValues(List processors); + Builder type(WorldArchetypeType type); + Builder generationConfig(WorldGenerationConfig generationConfig); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/structure/SchematicTemplate.java b/src/main/java/org/spongepowered/api/world/server/WorldArchetypeType.java similarity index 53% rename from src/main/java/org/spongepowered/api/world/generation/structure/SchematicTemplate.java rename to src/main/java/org/spongepowered/api/world/server/WorldArchetypeType.java index 08af5043d21..1ba5e0c5c72 100644 --- a/src/main/java/org/spongepowered/api/world/generation/structure/SchematicTemplate.java +++ b/src/main/java/org/spongepowered/api/world/server/WorldArchetypeType.java @@ -22,40 +22,38 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.world.generation.structure; +package org.spongepowered.api.world.server; import org.spongepowered.api.Sponge; -import org.spongepowered.api.datapack.DataPack; -import org.spongepowered.api.datapack.DataPackEntry; +import org.spongepowered.api.datapack.DataPackSerializable; +import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.util.CopyableBuilder; -import org.spongepowered.api.util.ResourceKeyedBuilder; -import org.spongepowered.api.world.schematic.Schematic; +import org.spongepowered.api.util.annotation.CatalogedBy; +import org.spongepowered.api.world.WorldType; +import org.spongepowered.api.world.generation.ChunkGenerator; -/** - * The template for a vanilla structure schematic. - */ -public interface SchematicTemplate extends DataPackEntry { +@CatalogedBy(WorldArchetypeTypes.class) +public interface WorldArchetypeType extends DefaultedRegistryValue, DataPackSerializable { + + static WorldArchetypeType.Builder builder() { + return Sponge.game().builderProvider().provide(WorldArchetypeType.Builder.class); + } - static Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); + static WorldArchetypeType of(WorldType worldType, ChunkGenerator chunkGenerator) { + return WorldArchetypeType.builder() + .worldType(worldType) + .chunkGenerator(chunkGenerator) + .build(); } - /** - * Returns the schematic. - * - * @return The schematic - */ - Schematic schematic(); + WorldType worldType(); + + ChunkGenerator chunkGenerator(); - interface Builder extends ResourceKeyedBuilder, CopyableBuilder { + interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder { - /** - * Sets the data pack - * - * @param pack The data pack - * @return This builder, for chaining - */ - Builder pack(DataPack pack); + Builder worldType(WorldType worldType); + Builder chunkGenerator(ChunkGenerator chunkGenerator); } } diff --git a/src/main/java/org/spongepowered/api/world/generation/carver/CarvingSteps.java b/src/main/java/org/spongepowered/api/world/server/WorldArchetypeTypes.java similarity index 69% rename from src/main/java/org/spongepowered/api/world/generation/carver/CarvingSteps.java rename to src/main/java/org/spongepowered/api/world/server/WorldArchetypeTypes.java index e2707fe9d21..e6b58104481 100644 --- a/src/main/java/org/spongepowered/api/world/generation/carver/CarvingSteps.java +++ b/src/main/java/org/spongepowered/api/world/server/WorldArchetypeTypes.java @@ -22,7 +22,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.spongepowered.api.world.generation.carver; +package org.spongepowered.api.world.server; import org.spongepowered.api.ResourceKey; import org.spongepowered.api.Sponge; @@ -33,25 +33,21 @@ import org.spongepowered.api.registry.RegistryScopes; import org.spongepowered.api.registry.RegistryTypes; +/** + * + */ @SuppressWarnings("unused") -@RegistryScopes(scopes = RegistryScope.GAME) -public final class CarvingSteps { - // @formatter:off - - public static final DefaultedRegistryReference AIR = CarvingSteps.key(ResourceKey.sponge("air")); - - public static final DefaultedRegistryReference LIQUID = CarvingSteps.key(ResourceKey.sponge("liquid")); - - // @formatter:on +@RegistryScopes(scopes = RegistryScope.ENGINE) +public final class WorldArchetypeTypes { - private CarvingSteps() { + private WorldArchetypeTypes() { } - public static Registry registry() { - return Sponge.game().registry(RegistryTypes.CARVING_STEP); + public static Registry registry() { + return Sponge.server().registry(RegistryTypes.WORLD_ARCHETYPE_TYPE); } - private static DefaultedRegistryReference key(final ResourceKey location) { - return RegistryKey.of(RegistryTypes.CARVING_STEP, location).asDefaultedReference(Sponge::game); + private static DefaultedRegistryReference key(final ResourceKey location) { + return RegistryKey.of(RegistryTypes.WORLD_ARCHETYPE_TYPE, location).asScopedReference(); } } diff --git a/src/main/java/org/spongepowered/api/world/server/WorldManager.java b/src/main/java/org/spongepowered/api/world/server/WorldManager.java index 4c25519eb8c..4aa96c62bf0 100644 --- a/src/main/java/org/spongepowered/api/world/server/WorldManager.java +++ b/src/main/java/org/spongepowered/api/world/server/WorldManager.java @@ -55,15 +55,14 @@ public interface WorldManager { Optional world(ResourceKey key); /** - * Gets a {@link Path directory} that exists for the provided {@link ResourceKey world key}. + * Gets a {@link Path directory} that is used for the world's data + * identified by {@link ResourceKey world key}. It is not guaranteed + * the path will exist until the world is formally loaded by the game. * - *

    It is not required for the implementation to validate that the directory contains a proper world, - * only that the directory exists.

    - * - * @param key The key - * @return The directory or {@link Optional#empty()} if not found + * @param key The world's identifier key + * @return The directory to be used if it doesn't exist */ - Optional worldDirectory(ResourceKey key); + Path worldDirectory(ResourceKey key); /** * Gets all currently loaded {@link ServerWorld worlds}. @@ -119,25 +118,26 @@ default List offlineWorldKeys() { Collection worldsOfType(WorldType type); /** - * Loads a {@link ServerWorld world} from a {@link WorldTemplate template}. + * Loads a {@link ServerWorld world} by a {@link ResourceKey key}. * - *

    If a world is already loaded by the {@link ResourceKey key} of the template, - * the world will be returned instead.

    + *

    If a world with the given name is already loaded, the operation fails.

    * - * @param template The template - * @return The world + * @param key The key + * @return The world, if loaded. */ - CompletableFuture loadWorld(WorldTemplate template); + default CompletableFuture> loadWorld(ResourceKey key) { + return this.loadWorld(key, ServerWorldProperties.LoadOptions.load()); + } /** - * Loads a {@link ServerWorld world} by a {@link ResourceKey key}. - * - *

    If a world with the given name is already loaded then it is returned instead.

    + * Loads a {@link ServerWorld world} by a {@link ResourceKey key} + * with the provided {@link ServerWorldProperties.LoadOptions load options}. * * @param key The key - * @return The world + * @param propertiesLoadOptions The options used to load the {@link ServerWorldProperties properties}. + * @return The world, if found. */ - CompletableFuture loadWorld(ResourceKey key); + CompletableFuture> loadWorld(ResourceKey key, ServerWorldProperties.LoadOptions propertiesLoadOptions); /** * Unloads a {@link ServerWorld world} by a {@link ResourceKey key}. @@ -162,14 +162,26 @@ default List offlineWorldKeys() { CompletableFuture unloadWorld(ServerWorld world); /** - * Loads an offline {@link ServerWorldProperties properties}. + * Loads the {@link ServerWorldProperties properties}. * *

    It is left up to the implementation on what conditions cause a failure of loading properties.

    * * @param key The key * @return The properties */ - CompletableFuture> loadProperties(ResourceKey key); + default CompletableFuture> loadProperties(ResourceKey key) { + return this.loadProperties(key, ServerWorldProperties.LoadOptions.load()); + } + + /** + * Loads the {@link ServerWorldProperties properties} with + * the provided {@link ServerWorldProperties.LoadOptions load options}. + * + * @param key The key + * @param propertiesLoadOptions The options used to load the {@link ServerWorldProperties properties}. + * @return The properties + */ + CompletableFuture> loadProperties(ResourceKey key, ServerWorldProperties.LoadOptions propertiesLoadOptions); /** * Saves a {@link ServerWorldProperties properties}. diff --git a/src/main/java/org/spongepowered/api/world/server/WorldTemplate.java b/src/main/java/org/spongepowered/api/world/server/WorldTemplate.java deleted file mode 100644 index 9adf08f6f23..00000000000 --- a/src/main/java/org/spongepowered/api/world/server/WorldTemplate.java +++ /dev/null @@ -1,169 +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 net.kyori.adventure.text.Component; -import org.spongepowered.api.ResourceKeyed; -import org.spongepowered.api.Sponge; -import org.spongepowered.api.data.DataHolder; -import org.spongepowered.api.data.Key; -import org.spongepowered.api.data.Keys; -import org.spongepowered.api.data.persistence.DataView; -import org.spongepowered.api.data.value.Value; -import org.spongepowered.api.datapack.DataPack; -import org.spongepowered.api.datapack.DataPackEntry; -import org.spongepowered.api.entity.living.player.gamemode.GameMode; -import org.spongepowered.api.util.CopyableBuilder; -import org.spongepowered.api.util.ResourceKeyedBuilder; -import org.spongepowered.api.world.SerializationBehavior; -import org.spongepowered.api.world.WorldType; -import org.spongepowered.api.world.difficulty.Difficulty; -import org.spongepowered.api.world.generation.ChunkGenerator; -import org.spongepowered.api.world.server.storage.ServerWorldProperties; -import org.spongepowered.math.vector.Vector3i; - -import java.io.IOException; -import java.util.Optional; - -/** - * A template for a {@link ServerWorld}. - */ -public interface WorldTemplate extends ResourceKeyed, DataPackEntry, DataHolder { - - static WorldTemplate overworld() { - return Sponge.game().factoryProvider().provide(Factory.class).overworld(); - } - - static WorldTemplate overworldCaves() { - return Sponge.game().factoryProvider().provide(Factory.class).overworldCaves(); - } - - static WorldTemplate theNether() { - return Sponge.game().factoryProvider().provide(Factory.class).theNether(); - } - - static WorldTemplate theEnd() { - return Sponge.game().factoryProvider().provide(Factory.class).theEnd(); - } - - static WorldTemplate.Builder builder() { - return Sponge.game().builderProvider().provide(Builder.class).reset(); - } - - default Optional displayName() { - return this.get(Keys.DISPLAY_NAME); - } - - default WorldType worldType() { - return this.require(Keys.WORLD_TYPE); - } - - default ChunkGenerator generator() { - return this.require(Keys.CHUNK_GENERATOR); - } - - default Optional gameMode() { - return this.get(Keys.GAME_MODE); - } - - default Optional difficulty() { - return this.get(Keys.WORLD_DIFFICULTY); - } - - default Optional serializationBehavior() { - return this.get(Keys.SERIALIZATION_BEHAVIOR); - } - - default boolean loadOnStartup() { - return this.require(Keys.IS_LOAD_ON_STARTUP); - } - - default boolean performsSpawnLogic() { - return this.require(Keys.PERFORM_SPAWN_LOGIC); - } - - default Optional hardcore() { - return this.get(Keys.HARDCORE); - } - - default Optional commands() { - return this.get(Keys.COMMANDS); - } - - default Optional pvp() { - return this.get(Keys.PVP); - } - - default Optional viewDistance() { - return this.get(Keys.VIEW_DISTANCE); - } - - default Optional spawnPosition() { - return this.get(Keys.SPAWN_POSITION); - } - - default Optional seed() { - return this.get(Keys.SEED); - } - - default Optional createDragonFight() { - return this.get(Keys.CREATE_DRAGON_FIGHT); - } - - default Builder asBuilder() { - return Sponge.game().builderProvider().provide(Builder.class).from(this); - } - - interface Builder extends ResourceKeyedBuilder, CopyableBuilder { - - Builder add(Key> key, V value); - - /** - * Creates a world template based on the given data view. - *

    The given data must be equivalent to a data-pack for world-templates (dimension)

    - * - * @param pack The data - * @return This builder, for chaining - */ - Builder fromDataPack(DataView pack) throws IOException; - - Builder from(ServerWorld world); - - Builder from(ServerWorldProperties worldProperties); - - Builder pack(DataPack pack); - } - - interface Factory { - - WorldTemplate overworld(); - - WorldTemplate overworldCaves(); - - WorldTemplate theNether(); - - WorldTemplate theEnd(); - } -} diff --git a/src/main/java/org/spongepowered/api/world/server/storage/ServerWorldProperties.java b/src/main/java/org/spongepowered/api/world/server/storage/ServerWorldProperties.java index 93efda5eced..63c8be9a91f 100644 --- a/src/main/java/org/spongepowered/api/world/server/storage/ServerWorldProperties.java +++ b/src/main/java/org/spongepowered/api/world/server/storage/ServerWorldProperties.java @@ -29,6 +29,7 @@ import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.ResourceKeyed; +import org.spongepowered.api.Sponge; import org.spongepowered.api.data.Keys; import org.spongepowered.api.entity.living.player.gamemode.GameMode; import org.spongepowered.api.entity.living.trader.WanderingTrader; @@ -40,8 +41,11 @@ import org.spongepowered.api.world.WorldType; import org.spongepowered.api.world.border.WorldBorder; import org.spongepowered.api.world.difficulty.Difficulty; +import org.spongepowered.api.world.gamerule.GameRuleHolder; import org.spongepowered.api.world.generation.config.WorldGenerationConfig; import org.spongepowered.api.world.server.ServerWorld; +import org.spongepowered.api.world.server.WorldArchetype; +import org.spongepowered.api.world.server.WorldArchetypeType; import org.spongepowered.api.world.storage.WorldProperties; import org.spongepowered.api.world.weather.Weather; import org.spongepowered.api.world.weather.WeatherUniverse; @@ -49,8 +53,9 @@ import java.util.List; import java.util.Optional; import java.util.UUID; +import java.util.function.Consumer; -public interface ServerWorldProperties extends WorldProperties, Nameable, Identifiable, ResourceKeyed, WeatherUniverse.Mutable { +public interface ServerWorldProperties extends WorldProperties, GameRuleHolder, Nameable, Identifiable, ResourceKeyed, WeatherUniverse.Mutable { /** * Gets the {@link ServerWorld} that correlates to this properties, if available. @@ -372,4 +377,297 @@ default WorldBorder worldBorder() { default Weather weather() { return this.require(Keys.WEATHER); } + + default WorldArchetypeType worldArchetypeType() { + return this.require(Keys.WORLD_ARCHETYPE_TYPE); + } + + default WorldArchetype worldArchetype() { + return this.require(Keys.WORLD_ARCHETYPE); + } + + /** + * Customize the load process of a {@link ServerWorldProperties}. + * + *

    Each {@link LoadOptions load options} can define + * multiple operations at once that will be exhausted + * until one of them succeeds.

    + * + *

    The operations will be consumed in the following order:

    + *
      + *
    • Get
    • + *
    • Load
    • + *
    • Create
    • + *
    + */ + interface LoadOptions { + + static LoadOptions.Builder builder() { + return Sponge.game().builderProvider().provide(LoadOptions.Builder.class); + } + + /** + * Load a new {@link ServerWorldProperties} from disk + * but do not attempt to use the already loaded instance + * or to create a new one. + * + *

    The operation fails if properties could not be loaded + * from disk.

    + * + * @return The load options. + */ + static LoadOptions load() { + return LoadOptions.builder() + .load() + .build(); + } + + /** + * Load a new {@link ServerWorldProperties} from disk + * but do not attempt to use the already loaded instance + * or to create a new one. + * + *

    The operation fails if properties could not be loaded + * from disk.

    + * + * @param loadCallback The consumer to call after successful + * load operation for additional configuration. + * @return The load options. + */ + static LoadOptions load(Consumer loadCallback) { + return LoadOptions.builder() + .load() + .loadCallback(loadCallback) + .build(); + } + + /** + * Get the already loaded {@link ServerWorldProperties} + * instance but do not attempt load it from the disk + * or create it. + * + *

    The operation fails if properties were not already loaded.

    + * + * @return The load options. + */ + static LoadOptions get() { + return LoadOptions.builder() + .get() + .build(); + } + + /** + * Get the already loaded {@link ServerWorldProperties} + * instance but do not attempt load it from the disk + * or create it. + * + *

    The operation fails if properties were not already loaded.

    + * + * @param getCallback The consumer to call after successful + * get operation for additional configuration. + * @return The load options. + */ + static LoadOptions get(Consumer getCallback) { + return LoadOptions.builder() + .get() + .getCallback(getCallback) + .build(); + } + + /** + * Get the already loaded {@link ServerWorldProperties} + * or attempt to load it from disk but do not create a new one. + * + *

    The operation fails if properties were not loaded + * nor could it be loaded from disk.

    + * + * @return The load options. + */ + static LoadOptions getOrLoad() { + return LoadOptions.builder() + .get() + .load() + .build(); + } + + /** + * Get the already loaded {@link ServerWorldProperties} + * or attempt to load it from disk but do not create a new one. + * + *

    The operation fails if properties were not loaded + * nor could it be loaded from disk.

    + * + * @param getCallback The consumer to call after successful + * get operation for additional configuration. + * @param loadCallback The consumer to call after successful + * load operation for additional configuration. + * @return The load options. + */ + static LoadOptions getOrLoad(Consumer getCallback, Consumer loadCallback) { + return LoadOptions.builder() + .get() + .getCallback(getCallback) + .load() + .loadCallback(loadCallback) + .build(); + } + + /** + * Create a new {@link ServerWorldProperties} with the given + * {@link WorldArchetype} but do not attempt to load + * it from disk or use the already loaded instance. + * + *

    The operation fails if properties could not be created.

    + * + * @param worldArchetype The archetype to use. + * @return The load options. + */ + static LoadOptions create(WorldArchetype worldArchetype) { + return LoadOptions.builder() + .create(worldArchetype) + .build(); + } + + /** + * Create a new {@link ServerWorldProperties} with the given + * {@link WorldArchetype} but do not attempt to load + * it from disk or use the already loaded instance. + * + *

    The operation fails if properties could not be created.

    + * + * @param worldArchetype The archetype to use. + * @param createCallback The consumer to call after successful + * creation for additional configuration. + * @return The load options. + */ + static LoadOptions create(WorldArchetype worldArchetype, Consumer createCallback) { + return LoadOptions.builder() + .create(worldArchetype) + .createCallback(createCallback) + .build(); + } + + /** + * Gets the {@link GetOperation get operation} for this option. + * + *

    If not present, the operation should fail on get.

    + * + * @return The option when found, if present. + */ + Optional getOperation(); + + /** + * Gets the {@link LoadOperation load operation} for this option. + * + *

    If not present, the operation should fail on load.

    + * + * @return The option when found, if present. + */ + Optional loadOperation(); + + /** + * Gets the {@link CreateOperation creation operation} for this option. + * + *

    If not present, the operation should fail on creation.

    + * + * @return The operation when created, if present. + */ + Optional createOperation(); + + interface GetOperation { + + Optional> getCallback(); + } + + interface LoadOperation { + + Optional overrideWorldArchetype(); + + Optional fallbackWorldArchetype(); + + Optional> loadCallback(); + } + + interface CreateOperation { + + WorldArchetype worldArchetype(); + + Optional> createCallback(); + } + + /** + * A builder to create {@link LoadOptions}. + */ + interface Builder extends org.spongepowered.api.util.Builder { + + /** + * Appends a get operation to this option + * which will attempt to find an already + * loaded instance. + * + * @return This builder, for chaining + */ + Builder.GetStep get(); + + /** + * Appends a load operation to this option + * which will attempt to load an existing + * world from the disk. + * + * @return This builder, for chaining + */ + Builder.LoadStep load(); + + /** + * Appends a create operation to this option + * which will attempt to create a new world + * with the given {@link WorldArchetype}. + * + * @param worldArchetype The archetype to use for world creation + * @return This builder, for chaining + */ + Builder.CreateStep create(WorldArchetype worldArchetype); + + interface GetStep extends Builder { + + GetStep getCallback(Consumer getCallback); + } + + interface LoadStep extends Builder { + + /** + * Sets the {@link WorldArchetype} to use instead of the + * one that was persisted on the disk. + * + *

    Note: This may impact world generation, + * causing new terrain to not blend seamlessly with existing terrain. + * Additionally, the world will be saved with the new {@link WorldArchetype}.

    + * + * @param worldArchetype The new archetype + * @return This builder, for chaining + */ + LoadStep overrideWorldArchetype(WorldArchetype worldArchetype); + + /** + * Sets the {@link WorldArchetype} that will be used as fallback + * in case no valid archetype could be determined. + * + *

    Note: This may impact world generation, + * causing new terrain to not blend seamlessly with existing terrain. + * Additionally, the world will be saved with the new {@link WorldArchetype}.

    + * + * @param worldArchetype The archetype to use as fallback + * @return This builder, for chaining + */ + LoadStep fallbackWorldArchetype(WorldArchetype worldArchetype); + + LoadStep loadCallback(Consumer loadCallback); + } + + interface CreateStep extends Builder { + + CreateStep createCallback(Consumer initializeCallback); + } + } + } } diff --git a/src/main/java/org/spongepowered/api/world/storage/WorldProperties.java b/src/main/java/org/spongepowered/api/world/storage/WorldProperties.java index 801ca3ded1d..0296213793b 100644 --- a/src/main/java/org/spongepowered/api/world/storage/WorldProperties.java +++ b/src/main/java/org/spongepowered/api/world/storage/WorldProperties.java @@ -29,14 +29,13 @@ import org.spongepowered.api.util.MinecraftDayTime; import org.spongepowered.api.world.World; import org.spongepowered.api.world.difficulty.Difficulty; -import org.spongepowered.api.world.gamerule.GameRuleHolder; import org.spongepowered.api.world.weather.WeatherUniverse; import org.spongepowered.math.vector.Vector3i; /** * Represents the properties of a {@link World} which are persisted across runtime instances. */ -public interface WorldProperties extends WeatherUniverse, GameRuleHolder, DataHolder.Mutable { +public interface WorldProperties extends WeatherUniverse, DataHolder.Mutable { /** * Gets the default spawn position. diff --git a/src/main/java/org/spongepowered/api/world/teleport/TeleportHelperFilter.java b/src/main/java/org/spongepowered/api/world/teleport/TeleportHelperFilter.java index 1a889d346bd..374c5e93cc4 100644 --- a/src/main/java/org/spongepowered/api/world/teleport/TeleportHelperFilter.java +++ b/src/main/java/org/spongepowered/api/world/teleport/TeleportHelperFilter.java @@ -37,7 +37,7 @@ * location is a suitable candidate for teleporting to safely. */ @CatalogedBy(TeleportHelperFilters.class) -public interface TeleportHelperFilter extends DefaultedRegistryValue { +public interface TeleportHelperFilter extends DefaultedRegistryValue { /** * Tests whether the location in question is valid, regardless of whether diff --git a/src/main/java/org/spongepowered/api/world/weather/WeatherType.java b/src/main/java/org/spongepowered/api/world/weather/WeatherType.java index 0cd7e8dd5b1..10d3d8c4fe6 100644 --- a/src/main/java/org/spongepowered/api/world/weather/WeatherType.java +++ b/src/main/java/org/spongepowered/api/world/weather/WeatherType.java @@ -31,6 +31,6 @@ * Represents a type of weather. */ @CatalogedBy(WeatherTypes.class) -public interface WeatherType extends DefaultedRegistryValue { +public interface WeatherType extends DefaultedRegistryValue { } diff --git a/src/test/java/org/spongepowered/api/event/SpongeAbstractDamageEntityEventTest.java b/src/test/java/org/spongepowered/api/event/SpongeAbstractDamageEntityEventTest.java deleted file mode 100644 index 38ad45d342a..00000000000 --- a/src/test/java/org/spongepowered/api/event/SpongeAbstractDamageEntityEventTest.java +++ /dev/null @@ -1,251 +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.event; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.event.cause.entity.damage.DamageFunction; -import org.spongepowered.api.event.cause.entity.damage.DamageModifier; -import org.spongepowered.api.event.entity.DamageEntityEvent; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.function.DoubleUnaryOperator; - -class SpongeAbstractDamageEntityEventTest { - - private static final double ERROR = 0.03; - - @Test - void testParams() { - final Entity targetEntity = this.mockParam(Entity.class); - final int originalDamage = 5; - - final DamageEntityEvent event = SpongeEventFactory.createDamageEntityEvent(Cause.of(EventContext.empty(), "none"), - targetEntity, new ArrayList<>(), originalDamage); - - Assertions.assertEquals(event.originalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalFinalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.finalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.baseDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - } - - @Test - void testSetBaseDamage() { - final Entity targetEntity = this.mockParam(Entity.class); - final int originalDamage = 5; - - final DamageEntityEvent event = SpongeEventFactory.createDamageEntityEvent(Cause.of(EventContext.empty(), "none"), - targetEntity, new ArrayList<>(), originalDamage); - - Assertions.assertEquals(event.originalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalFinalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - event.setBaseDamage(20); - - Assertions.assertEquals(event.baseDamage(), 20, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.finalDamage(), 20, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalFinalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - } - - @Test - void testUseModifiers() { - final Entity targetEntity = this.mockParam(Entity.class); - - final int originalDamage = 1; - final int originalFinalDamage = 18; - - final int firstModifierDamage = 3; - final int secondModifierDamage = 18; - - final DamageModifier firstModifer = this.mockParam(DamageModifier.class); - final DamageModifier secondModifier = this.mockParam(DamageModifier.class); - - final var firstDamageFunction = DamageFunction.of(firstModifer, p -> p + p * 2); - final var secondDamageFunction = DamageFunction.of(secondModifier, p -> p + p * 5); - - final List originalFunctions = Arrays.asList(firstDamageFunction, secondDamageFunction); - - final DamageEntityEvent event = SpongeEventFactory.createDamageEntityEvent(Cause.of(EventContext.empty(), "none"), - targetEntity, originalFunctions, originalDamage); - - final List originalFunctions1 = event.originalFunctions(); - Assertions.assertEquals(originalFunctions1, originalFunctions); - - Assertions.assertEquals(event.originalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalFinalDamage(), originalFinalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - final var originalDamages = event.originalDamages(); - - Assertions.assertEquals(originalDamages.size(), originalFunctions.size()); - - Assertions.assertEquals(originalDamages.get(firstModifer).second(), firstModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(originalDamages.get(secondModifier).second(), secondModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalModifierDamage(firstModifer).second(), firstModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalModifierDamage(secondModifier).second(), secondModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalFunctions(), originalFunctions); - } - - @Test - void testSetModifiers() { - final Entity targetEntity = this.mockParam(Entity.class); - - final int originalDamage = 1; - final int originalFinalDamage = 18; - - final int firstModifierDamage = 3; - final int secondModifierDamage = 18; - - final int firstChangedDamage = 1; - final int secondChangedDamage = 6; - - final int modifiedFinalDamage = 6; - - final DamageModifier firstModifer = this.mockParam(DamageModifier.class); - final DamageModifier secondModifier = this.mockParam(DamageModifier.class); - - - final var firstDamageFunction = DamageFunction.of(firstModifer, p -> p + p * 2); - final DoubleUnaryOperator newFirstDamageFunction = p -> p; - final var secondDamageFunction = DamageFunction.of(secondModifier, p -> p + p * 5); - final List originalFunctions = Arrays.asList(firstDamageFunction, secondDamageFunction); - - final DamageEntityEvent event = SpongeEventFactory.createDamageEntityEvent(Cause.of(EventContext.empty(), "none"), - targetEntity, originalFunctions, originalDamage); - - Assertions.assertEquals(event.originalFunctions(), originalFunctions); - - event.setDamage(firstModifer, newFirstDamageFunction); - - Assertions.assertEquals(event.damage(firstModifer).second(), firstChangedDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.damage(secondModifier).second(), secondChangedDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalModifierDamage(firstModifer).second(), firstModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalModifierDamage(secondModifier).second(), secondModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalFinalDamage(), originalFinalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.finalDamage(), modifiedFinalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalFunctions(), originalFunctions); - - Assertions.assertEquals(event.modifiers(), Arrays.asList(DamageFunction.of(firstModifer, newFirstDamageFunction), originalFunctions.get(1))); - } - - @Test - void testAddModifier() { - final Entity targetEntity = this.mockParam(Entity.class); - - final int originalDamage = 1; - final int originalFinalDamage = 18; - - final int firstModifierDamage = 3; - final int secondModifierDamage = 18; - - final int modifiedFinalDamage = 36; - - final int thirdDamage = 36; - - final DamageModifier firstModifier = this.mockParam(DamageModifier.class); - final DamageModifier secondModifier = this.mockParam(DamageModifier.class); - final DamageModifier thirdModifier = this.mockParam(DamageModifier.class); - - final var firstDamageFunction = DamageFunction.of(firstModifier, p -> p + p * 2); - final var secondDamageFunction = DamageFunction.of(secondModifier, p -> p + p * 5); - final DoubleUnaryOperator thirdDamageFunction = p -> p + p; - - final List originalFunctions = Arrays.asList(firstDamageFunction, secondDamageFunction); - final List newFunctions = new ArrayList<>(originalFunctions); - newFunctions.add(DamageFunction.of(thirdModifier, thirdDamageFunction)); - - final DamageEntityEvent event = SpongeEventFactory.createDamageEntityEvent(Cause.of(EventContext.empty(), "none"), targetEntity, - originalFunctions, originalDamage); - - Assertions.assertEquals(event.originalFunctions(), originalFunctions); - - Assertions.assertFalse(event.isModifierApplicable(thirdModifier)); - - event.setDamage(thirdModifier, thirdDamageFunction); - - Assertions.assertEquals(event.damage(firstModifier).second(), firstModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.damage(secondModifier).second(), secondModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.damage(thirdModifier).second(), thirdDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalModifierDamage(firstModifier).second(), firstModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalModifierDamage(secondModifier).second(), secondModifierDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalDamage(), originalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.originalFinalDamage(), originalFinalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - Assertions.assertEquals(event.finalDamage(), modifiedFinalDamage, SpongeAbstractDamageEntityEventTest.ERROR); - - Assertions.assertEquals(event.originalFunctions(), originalFunctions); - - Assertions.assertEquals(event.modifiers(), newFunctions); - } - - @Test - void testModifiersApplicable() { - final Entity targetEntity = this.mockParam(Entity.class); - - final DamageModifier firstModifer = this.mockParam(DamageModifier.class); - final DamageModifier secondModifier = this.mockParam(DamageModifier.class); - - final List - originalFunctions = Arrays.asList(DamageFunction.of(firstModifer, p -> p), DamageFunction.of(secondModifier, p -> p)); - - final DamageEntityEvent event = SpongeEventFactory.createDamageEntityEvent(Cause.of(EventContext.empty(), "none"), targetEntity, - originalFunctions, 0); - - Assertions.assertTrue(event.isModifierApplicable(firstModifer)); - Assertions.assertTrue(event.isModifierApplicable(secondModifier)); - Assertions.assertFalse(event.isModifierApplicable(this.mockParam(DamageModifier.class))); - } - - @Test - void testNotApplicableModifer() { - final DamageEntityEvent event = SpongeEventFactory.createDamageEntityEvent(Cause.of(EventContext.empty(), "none"), this.mockParam(Entity.class), - new ArrayList<>(), 0); - - final DamageModifier modifier = this.mockParam(DamageModifier.class); - - Assertions.assertFalse(event.isModifierApplicable(modifier)); - - Assertions.assertThrows(IllegalArgumentException.class, () -> event.originalModifierDamage(modifier)); - } - - @SuppressWarnings("unchecked") - private T mockParam(Class clazz) { - return (T) Objects.requireNonNull(SpongeEventFactoryTest.mockParam(clazz)); - } - -} diff --git a/src/test/java/org/spongepowered/api/util/ColorTest.java b/src/test/java/org/spongepowered/api/util/ColorTest.java new file mode 100644 index 00000000000..da00ee6758b --- /dev/null +++ b/src/test/java/org/spongepowered/api/util/ColorTest.java @@ -0,0 +1,146 @@ +/* + * 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.util; + + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +import org.junit.jupiter.api.Test; +import org.spongepowered.math.vector.Vector3d; +import org.spongepowered.math.vector.Vector3f; +import org.spongepowered.math.vector.Vector3i; + +public class ColorTest { + + @Test + public void testOfRgbHex() { + final Color colorGray = Color.ofRgb(0x808080); + assertEquals(Color.GRAY, colorGray); + } + + @Test + public void testOfRgbForRedGreenBlue() { + final Color colorGray = Color.ofRgb(128, 128, 128); + assertEquals(Color.GRAY, colorGray); + } + + @Test + public void testOfColor() { + final Color blueColor = Color.of(java.awt.Color.BLUE); + assertEquals(blueColor, Color.BLUE); + } + + @Test + public void testOfVector3i() { + final Vector3i vecGray = new Vector3i(128, 128, 384); + final Color colorGray = Color.of(vecGray); + assertEquals(Color.GRAY, colorGray); + } + + @Test + public void testOfVector3f() { + final Vector3f vecGray = new Vector3f(128.0, 128.459, 127.5); + final Color colorGray = Color.of(vecGray); + assertEquals(Color.GRAY, colorGray); + } + + @Test + public void testOfVector3d() { + final Vector3d vecGray = new Vector3d(128.0, 128.459, 127.5); + final Color colorGray = Color.of(vecGray); + assertEquals(Color.GRAY, colorGray); + } + + @Test + public void testMixColors() { + final Color grey = Color.GRAY; + final Color test = Color.WHITE.mixWithColors(Color.BLACK); + assertEquals(grey, test); + } + + @Test + public void testGetRed() { + assertEquals(0xFF, Color.RED.red()); + } + + @Test + public void testWithRed() { + final Color cyan = Color.CYAN; + final Color merged = cyan.withRed(0xFF); + final int rgb = merged.rgb(); + assertEquals(0xFFFFFF, rgb); + } + + @Test + public void testGetGreen() { + assertEquals(0x80, Color.GREEN.green()); + } + + @Test + public void testWithGreen() { + final Color magenta = Color.MAGENTA; + final Color merged = magenta.withGreen(0xFF); + final int rgb = merged.rgb(); + assertEquals(0xFFFFFF, rgb); + } + + @Test + public void testGetBlue() { + assertEquals(0x0000FF, Color.BLUE.blue()); + } + + @Test + public void testWithBlue() { + final Color yellow = Color.YELLOW; + final Color merged = yellow.withBlue(0xFF); + final int rgb = merged.rgb(); + assertEquals(0xFFFFFF, rgb); + } + + @Test + public void testAsJavaColor() { + final int color = 0xFF00FF; + final Color apiColor = Color.ofRgb(color); + final java.awt.Color javaColor = apiColor.asJavaColor(); + final java.awt.Color testColor = new java.awt.Color(color); + assertEquals(javaColor, testColor); + } + + @Test + public void testGetRgb() { + final int color = 0x808080; + final Color color1 = Color.ofRgb(color); + final int rgb = color1.rgb(); + assertEquals(color, rgb); + } + + @Test + public void testEquals() { + assertEquals(Color.GREEN, Color.ofRgb(0x008000)); + assertNotEquals(Color.GREEN, Color.GRAY); + } + +}