From a9e5275ee1951b39618a03a1ca95235595abeafc Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Sun, 25 Aug 2024 13:06:00 -0700
Subject: [PATCH 01/14] wip: start updating to 24w34a
A lot doesn't compile with some registries having changed. Some kinds have migrated to
records, moving away from enums. This poses some slight problem with representing the kinds themselves for API usage.
---
.../java/org/spongepowered/api/data/Keys.java | 3 +-
.../entity/living/monster/zombie/Zombie.java | 1 +
.../api/registry/RegistryTypes.java | 3 -
.../api/world/WorldTypeTemplate.java | 2 +
.../spongepowered/api/world/biome/Biome.java | 3 +-
.../world/generation/carver/CarvingStep.java | 35 ------------
.../world/generation/carver/CarvingSteps.java | 57 -------------------
.../api/world/schematic/Schematic.java | 1 +
8 files changed, 6 insertions(+), 99 deletions(-)
delete mode 100644 src/main/java/org/spongepowered/api/world/generation/carver/CarvingStep.java
delete mode 100644 src/main/java/org/spongepowered/api/world/generation/carver/CarvingSteps.java
diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java
index cc9a70bc0a..0d6a38083c 100644
--- a/src/main/java/org/spongepowered/api/data/Keys.java
+++ b/src/main/java/org/spongepowered/api/data/Keys.java
@@ -265,7 +265,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;
@@ -656,7 +655,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}.
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 12a8bf17bd..17aaa51335 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/registry/RegistryTypes.java b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java
index 4b1c9a8767..a108e65405 100644
--- a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java
+++ b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java
@@ -165,7 +165,6 @@
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;
@@ -306,8 +305,6 @@ public final class RegistryTypes {
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");
diff --git a/src/main/java/org/spongepowered/api/world/WorldTypeTemplate.java b/src/main/java/org/spongepowered/api/world/WorldTypeTemplate.java
index dbf335ea1b..ed35998388 100644
--- a/src/main/java/org/spongepowered/api/world/WorldTypeTemplate.java
+++ b/src/main/java/org/spongepowered/api/world/WorldTypeTemplate.java
@@ -70,10 +70,12 @@ interface Builder extends DataPackEntryBuilder pack);
}
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 15051bf235..afd1c20497 100644
--- a/src/main/java/org/spongepowered/api/world/biome/Biome.java
+++ b/src/main/java/org/spongepowered/api/world/biome/Biome.java
@@ -42,7 +42,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;
@@ -116,7 +115,7 @@ default TemperatureModifier temperatureModifier() {
*
* @return The carvers
*/
- default Map> carvers() {
+ default List carvers() {
return this.require(Keys.CARVERS);
}
diff --git a/src/main/java/org/spongepowered/api/world/generation/carver/CarvingStep.java b/src/main/java/org/spongepowered/api/world/generation/carver/CarvingStep.java
deleted file mode 100644
index f83e599d45..0000000000
--- a/src/main/java/org/spongepowered/api/world/generation/carver/CarvingStep.java
+++ /dev/null
@@ -1,35 +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.carver;
-
-import org.spongepowered.api.util.annotation.CatalogedBy;
-
-/**
- * A carving step for {@link Carver carvers}
- */
-@CatalogedBy(CarvingSteps.class)
-public interface CarvingStep {
-
-}
diff --git a/src/main/java/org/spongepowered/api/world/generation/carver/CarvingSteps.java b/src/main/java/org/spongepowered/api/world/generation/carver/CarvingSteps.java
deleted file mode 100644
index e2707fe9d2..0000000000
--- a/src/main/java/org/spongepowered/api/world/generation/carver/CarvingSteps.java
+++ /dev/null
@@ -1,57 +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.carver;
-
-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 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
-
- private CarvingSteps() {
- }
-
- public static Registry registry() {
- return Sponge.game().registry(RegistryTypes.CARVING_STEP);
- }
-
- private static DefaultedRegistryReference key(final ResourceKey location) {
- return RegistryKey.of(RegistryTypes.CARVING_STEP, location).asDefaultedReference(Sponge::game);
- }
-}
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 5ce9b7d028..6843f01628 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();
/**
From 30055c2aa785d67d4a595f933af9100254fe731e Mon Sep 17 00:00:00 2001
From: Anselm Brehme
Date: Tue, 27 Aug 2024 16:36:44 +0200
Subject: [PATCH 02/14] fixing explosions
---
.../java/org/spongepowered/api/data/Keys.java | 2 +-
.../api/entity/explosive/Explosive.java | 2 +-
.../api/registry/RegistryTypes.java | 3 ++
.../api/world/explosion/Explosion.java | 7 +--
.../explosion/ExplosionBlockInteraction.java | 33 ++++++++++++
.../explosion/ExplosionBlockInteractions.java | 50 +++++++++++++++++++
6 files changed, 92 insertions(+), 5 deletions(-)
create mode 100644 src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteraction.java
create mode 100644 src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteractions.java
diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java
index 0d6a38083c..454d9f681e 100644
--- a/src/main/java/org/spongepowered/api/data/Keys.java
+++ b/src/main/java/org/spongepowered/api/data/Keys.java
@@ -1020,7 +1020,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}.
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 ab0cff20ac..23e3a18a65 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/registry/RegistryTypes.java b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java
index a108e65405..119f59aeb8 100644
--- a/src/main/java/org/spongepowered/api/registry/RegistryTypes.java
+++ b/src/main/java/org/spongepowered/api/registry/RegistryTypes.java
@@ -162,6 +162,7 @@
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;
@@ -357,6 +358,8 @@ public final class RegistryTypes {
public static final DefaultedRegistryType EQUIPMENT_TYPE = RegistryTypes.spongeKeyInGame("equipment_type");
+ public static final RegistryType 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");
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 0701c0c2d1..4f157b8b7a 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 0000000000..ac030daaae
--- /dev/null
+++ b/src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteraction.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.world.explosion;
+
+import org.spongepowered.api.util.annotation.CatalogedBy;
+
+@CatalogedBy(ExplosionBlockInteractions.class)
+public interface ExplosionBlockInteraction {
+ // 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 0000000000..83f79020d3
--- /dev/null
+++ b/src/main/java/org/spongepowered/api/world/explosion/ExplosionBlockInteractions.java
@@ -0,0 +1,50 @@
+/*
+ * 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 KEEP = ExplosionBlockInteractions.key(ResourceKey.sponge("keep"));
+ 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 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);
+ }
+}
From 0141ef74ad3a775b7a160f634cf3922d3379302f Mon Sep 17 00:00:00 2001
From: Anselm Brehme
Date: Tue, 27 Aug 2024 19:03:09 +0200
Subject: [PATCH 03/14] AgeableWaterCreature
---
.../org/spongepowered/api/entity/living/aquatic/Dolphin.java | 3 ++-
.../org/spongepowered/api/entity/living/aquatic/Squid.java | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
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 c0f7399565..4f63568e25 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 3d85e1e914..39cc635e77 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 {
}
From 3de210ac24eb838976c41e36559ca1135195eb1a Mon Sep 17 00:00:00 2001
From: Anselm Brehme
Date: Tue, 27 Aug 2024 19:22:36 +0200
Subject: [PATCH 04/14] fix ArmorMaterial repairIngredient
---
.../org/spongepowered/api/data/type/ArmorMaterial.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
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 cdcc6cfa1a..c59de8bfcc 100644
--- a/src/main/java/org/spongepowered/api/data/type/ArmorMaterial.java
+++ b/src/main/java/org/spongepowered/api/data/type/ArmorMaterial.java
@@ -26,11 +26,11 @@
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
@@ -40,11 +40,10 @@
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();
}
From d174770869ef946ffcbcdb6c5356d5bc25dc73c5 Mon Sep 17 00:00:00 2001
From: Anselm Brehme
Date: Wed, 28 Aug 2024 10:16:55 +0200
Subject: [PATCH 05/14] fix recipe getIngredients
---
.../spongepowered/api/item/recipe/Recipe.java | 8 -------
.../recipe/crafting/ShapedCraftingRecipe.java | 7 ++++++
.../crafting/ShapelessCraftingRecipe.java | 7 ++++++
.../item/recipe/single/StoneCutterRecipe.java | 9 ++++++++
.../item/recipe/smithing/SmithingRecipe.java | 22 +++++++++++++++++++
5 files changed, 45 insertions(+), 8 deletions(-)
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 cb06bb9f0d..ac58e59485 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/Recipe.java
@@ -34,7 +34,6 @@
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;
@@ -124,13 +123,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/crafting/ShapedCraftingRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/crafting/ShapedCraftingRecipe.java
index 570df7e2a8..3b3ee859be 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
@@ -42,6 +42,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}.
*
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 b8c9dbe5a2..8f23242548 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
@@ -44,6 +44,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}.
*
diff --git a/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
index 407e74c2f3..b937a0e97e 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
@@ -34,10 +34,12 @@
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.cooking.CookingRecipe;
import org.spongepowered.api.item.recipe.crafting.Ingredient;
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.util.ResourceKeyedBuilder;
+import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -50,6 +52,13 @@ static StoneCutterRecipe.Builder builder() {
return Sponge.game().builderProvider().provide(StoneCutterRecipe.Builder.class);
}
+ /**
+ * Returns the {@link Ingredient} for this {@link StoneCutterRecipe}.
+ *
+ * @return The {@link Ingredient} for this {@link StoneCutterRecipe}.
+ */
+ Ingredient ingredient();
+
@Override
RecipeType extends StoneCutterRecipe> type();
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 9c57d1c057..b31a1b1713 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
@@ -38,6 +38,7 @@
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.util.ResourceKeyedBuilder;
+import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -50,6 +51,27 @@ 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 extends SmithingRecipe> type();
From 587166fe62e139311793bbc07873fc761811643c Mon Sep 17 00:00:00 2001
From: Anselm Brehme
Date: Wed, 28 Aug 2024 12:16:06 +0200
Subject: [PATCH 06/14] fix cooldowns
---
.../entity/living/player/CooldownTracker.java | 17 ++++++++++++-----
.../entity/living/player/CooldownEvent.java | 5 +++--
2 files changed, 15 insertions(+), 7 deletions(-)
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 9a0c181506..2cc55b36fe 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;
@@ -42,7 +44,8 @@ public interface CooldownTracker {
* @param type 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
@@ -52,7 +55,8 @@ public interface CooldownTracker {
* @return The cooldown remaining for this item type in ticks, if not
* on cooldown
*/
- Optional cooldown(ItemType type);
+ Optional cooldown(ItemStack stack);
+ Optional cooldown(ResourceKey group);
/**
* Sets the cooldown for the specified {@link ItemType} for the
@@ -63,7 +67,8 @@ public interface CooldownTracker {
* @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
@@ -73,7 +78,8 @@ public interface CooldownTracker {
* @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
@@ -85,6 +91,7 @@ public interface CooldownTracker {
* @param type 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/event/entity/living/player/CooldownEvent.java b/src/main/java/org/spongepowered/api/event/entity/living/player/CooldownEvent.java
index 65555c1227..2fdb6f8f99 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}.
From bb588e3b09040b4f9e06782000abda2504113ae4 Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Sun, 8 Sep 2024 16:32:25 -0700
Subject: [PATCH 07/14] feat: update to 24w36a
---
.../api/entity/living/player/CooldownTracker.java | 10 +++++-----
.../api/statistic/StatisticCategories.java | 1 +
2 files changed, 6 insertions(+), 5 deletions(-)
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 2cc55b36fe..8d3accafeb 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
@@ -41,7 +41,7 @@ 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(ItemStack stack);
@@ -51,7 +51,7 @@ public interface CooldownTracker {
* 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
*/
@@ -62,7 +62,7 @@ public interface CooldownTracker {
* 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
@@ -74,7 +74,7 @@ public interface CooldownTracker {
* 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
*/
@@ -88,7 +88,7 @@ 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(ItemStack stack);
diff --git a/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java b/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java
index 417704dd9f..f6e4cd600a 100644
--- a/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java
+++ b/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java
@@ -52,6 +52,7 @@ public final class StatisticCategories {
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"));
From b3b13e92bf80ffb4761008d1c523bbe956ef9e9d Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Wed, 11 Sep 2024 21:22:51 -0700
Subject: [PATCH 08/14] feat: update to 24w37a
---
src/main/java/org/spongepowered/api/data/type/BoatType.java | 2 --
.../org/spongepowered/api/statistic/StatisticCategories.java | 1 +
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/main/java/org/spongepowered/api/data/type/BoatType.java b/src/main/java/org/spongepowered/api/data/type/BoatType.java
index bece42a412..4ad6140ffa 100644
--- a/src/main/java/org/spongepowered/api/data/type/BoatType.java
+++ b/src/main/java/org/spongepowered/api/data/type/BoatType.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 {
- BlockType representedBlock();
}
diff --git a/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java b/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java
index f6e4cd600a..2b338f823c 100644
--- a/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java
+++ b/src/main/java/org/spongepowered/api/statistic/StatisticCategories.java
@@ -50,6 +50,7 @@ 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")
From 942b191aa039f3a4088ced1ee9a38f82de6d71e1 Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Thu, 12 Sep 2024 22:48:25 -0700
Subject: [PATCH 09/14] chore: fix some nits
Signed-off-by: Gabriel Harris-Rouquette
---
.../api/entity/living/player/CooldownTracker.java | 5 +++++
.../api/item/recipe/single/StoneCutterRecipe.java | 2 --
2 files changed, 5 insertions(+), 2 deletions(-)
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 8d3accafeb..16993e5583 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
@@ -45,6 +45,7 @@ public interface CooldownTracker {
* @return Whether or not the specified item type is cooldown
*/
boolean hasCooldown(ItemStack stack);
+
boolean hasCooldown(ResourceKey group);
/**
@@ -56,6 +57,7 @@ public interface CooldownTracker {
* on cooldown
*/
Optional cooldown(ItemStack stack);
+
Optional cooldown(ResourceKey group);
/**
@@ -68,6 +70,7 @@ public interface CooldownTracker {
* being cancelled
*/
boolean setCooldown(ItemStack stack, Ticks ticks);
+
boolean setCooldown(ResourceKey group, Ticks ticks);
/**
@@ -79,6 +82,7 @@ public interface CooldownTracker {
* being cancelled
*/
boolean resetCooldown(ItemStack stack);
+
boolean resetCooldown(ResourceKey group);
/**
@@ -92,6 +96,7 @@ public interface CooldownTracker {
* @return The fraction of cooldown remaining for the specified item type
*/
OptionalDouble fractionRemaining(ItemStack stack);
+
OptionalDouble fractionRemaining(ResourceKey group);
}
diff --git a/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
index b937a0e97e..e70e13c91d 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
@@ -34,12 +34,10 @@
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.cooking.CookingRecipe;
import org.spongepowered.api.item.recipe.crafting.Ingredient;
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.util.ResourceKeyedBuilder;
-import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
From 144e45c2731ea5149feb4844b73ab5b98695047e Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Wed, 2 Oct 2024 23:48:01 -0700
Subject: [PATCH 10/14] chore(update): update to 24w39a
Signed-off-by: Gabriel Harris-Rouquette
---
src/main/java/org/spongepowered/api/entity/Entity.java | 4 ++++
.../ai/goal/builtin/creature/AvoidLivingGoal.java | 10 ++++++++--
.../world/server/storage/ServerWorldProperties.java | 3 ++-
.../api/world/storage/WorldProperties.java | 2 +-
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/spongepowered/api/entity/Entity.java b/src/main/java/org/spongepowered/api/entity/Entity.java
index 2f39680f34..10f3250a41 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 extends DamageSourc
*/
boolean damage(double damage, DamageSource damageSource);
+ default void foo() {
+
+ }
+
/**
* Gets the nearby entities within the desired distance.
*
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 fee7413384..d3ed6ace73 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/world/server/storage/ServerWorldProperties.java b/src/main/java/org/spongepowered/api/world/server/storage/ServerWorldProperties.java
index 93efda5ece..0b1ffaf810 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
@@ -40,6 +40,7 @@
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.storage.WorldProperties;
@@ -50,7 +51,7 @@
import java.util.Optional;
import java.util.UUID;
-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.
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 801ca3ded1..4243fcd663 100644
--- a/src/main/java/org/spongepowered/api/world/storage/WorldProperties.java
+++ b/src/main/java/org/spongepowered/api/world/storage/WorldProperties.java
@@ -36,7 +36,7 @@
/**
* 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.
From 2a43df043f11843eac7cc2fa45677bc62afa0f80 Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Wed, 9 Oct 2024 17:49:26 -0700
Subject: [PATCH 11/14] feat!: remove deprecated ItemStack methods
Signed-off-by: Gabriel Harris-Rouquette
---
.../api/advancement/DisplayInfo.java | 16 --
.../api/block/entity/Jukebox.java | 9 --
.../cause/entity/damage/DamageModifier.java | 16 --
.../api/item/enchantment/EnchantmentType.java | 17 --
.../api/item/inventory/ArmorEquipable.java | 48 ------
.../api/item/inventory/Container.java | 8 -
.../api/item/inventory/Equipable.java | 32 ----
.../api/item/inventory/Inventory.java | 48 ------
.../api/item/inventory/ItemStack.java | 8 -
.../api/item/inventory/ItemStackSnapshot.java | 8 -
.../api/item/inventory/Slot.java | 8 -
.../equipment/EquipmentInventory.java | 15 --
.../item/inventory/slot/FilteringSlot.java | 9 --
.../api/item/inventory/slot/SidedSlot.java | 25 ---
.../InventoryTransactionResult.java | 16 --
.../transaction/SlotTransaction.java | 9 --
.../item/inventory/type/GridInventory.java | 8 -
.../api/item/inventory/type/Inventory2D.java | 8 -
.../inventory/type/ViewableInventory.java | 9 --
.../api/item/merchant/TradeOffer.java | 25 ---
.../api/item/recipe/RecipeManager.java | 33 ----
.../item/recipe/cooking/CookingRecipe.java | 42 -----
.../item/recipe/cooking/CookingResult.java | 47 ++----
.../api/item/recipe/crafting/Ingredient.java | 75 ++-------
.../api/item/recipe/crafting/RecipeInput.java | 16 --
.../item/recipe/crafting/RecipeResult.java | 8 -
.../recipe/crafting/ShapedCraftingRecipe.java | 26 ----
.../crafting/ShapelessCraftingRecipe.java | 26 ----
.../crafting/SpecialCraftingRecipe.java | 9 --
.../item/recipe/single/StoneCutterRecipe.java | 26 ----
.../item/recipe/smithing/SmithingRecipe.java | 26 ----
.../api/world/storage/WorldProperties.java | 1 -
.../org/spongepowered/api/util/ColorTest.java | 146 ++++++++++++++++++
33 files changed, 165 insertions(+), 658 deletions(-)
create mode 100644 src/test/java/org/spongepowered/api/util/ColorTest.java
diff --git a/src/main/java/org/spongepowered/api/advancement/DisplayInfo.java b/src/main/java/org/spongepowered/api/advancement/DisplayInfo.java
index 14cee4b0ab..952cebd81b 100644
--- a/src/main/java/org/spongepowered/api/advancement/DisplayInfo.java
+++ b/src/main/java/org/spongepowered/api/advancement/DisplayInfo.java
@@ -164,22 +164,6 @@ default Builder icon(ItemType itemType) {
return this.icon(ItemStack.of(itemType, 1));
}
- /**
- * @deprecated Use {@link #icon(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Builder icon(ItemStack itemStack) {
- return this.icon((ItemStackLike) itemStack);
- }
-
- /**
- * @deprecated Use {@link #icon(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Builder icon(ItemStackSnapshot itemStackSnapshot) {
- return this.icon((ItemStackLike) itemStackSnapshot);
- }
-
/**
* Sets the icon of the advancement with the
* specified {@link ItemStackLike}.
diff --git a/src/main/java/org/spongepowered/api/block/entity/Jukebox.java b/src/main/java/org/spongepowered/api/block/entity/Jukebox.java
index c85906436e..39ca0dffd2 100644
--- a/src/main/java/org/spongepowered/api/block/entity/Jukebox.java
+++ b/src/main/java/org/spongepowered/api/block/entity/Jukebox.java
@@ -26,7 +26,6 @@
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
-import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
@@ -60,14 +59,6 @@ default Value.Mutable item() {
*/
void eject();
- /**
- * @deprecated Use {@link #insert(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default void insert(ItemStack disc) {
- this.insert((ItemStackLike) disc);
- }
-
/**
* Ejects the current music disc item in this Jukebox and inserts the given one.
*
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 19079591c3..65e99fa592 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
@@ -163,22 +163,6 @@ public Builder group(final String group) {
return this;
}
- /**
- * @deprecated Use {@link #item(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- public Builder item(final ItemStack itemStack) {
- return this.item((ItemStackLike) itemStack);
- }
-
- /**
- * @deprecated Use {@link #item(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- public Builder item(final ItemStackSnapshot snapshot) {
- return this.item((ItemStackLike) snapshot);
- }
-
public Builder item(final ItemStackLike item) {
this.snapshot = java.util.Objects.requireNonNull(item, "item").asImmutable();
return this;
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 2d324dabc2..804eaa1bc8 100644
--- a/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentType.java
+++ b/src/main/java/org/spongepowered/api/item/enchantment/EnchantmentType.java
@@ -26,7 +26,6 @@
import net.kyori.adventure.text.ComponentLike;
import org.spongepowered.api.block.entity.EnchantmentTable;
-import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.registry.DefaultedRegistryValue;
import org.spongepowered.api.tag.EnchantmenTypeTags;
@@ -82,14 +81,6 @@ public interface EnchantmentType extends DefaultedRegistryValue, ComponentLike,
*/
int maximumEnchantabilityForLevel(int level);
- /**
- * @deprecated Use {@link #canBeAppliedToStack(ItemStackLike)} instead,
- */
- @Deprecated(forRemoval = true)
- default boolean canBeAppliedToStack(ItemStack stack) {
- return this.canBeAppliedToStack((ItemStackLike) stack);
- }
-
/**
* Test if this enchantment type can be applied to an {@link ItemStackLike}.
*
@@ -98,14 +89,6 @@ default boolean canBeAppliedToStack(ItemStack stack) {
*/
boolean canBeAppliedToStack(ItemStackLike stack);
- /**
- * @deprecated Use {@link #canBeAppliedToStack(ItemStackLike)} instead,
- */
- @Deprecated(forRemoval = true)
- default boolean canBeAppliedByTable(ItemStack stack) {
- return this.canBeAppliedByTable((ItemStackLike) stack);
- }
-
/**
* Test if this enchantment type can be applied to an {@link ItemStackLike} by
* the {@link EnchantmentTable}.
diff --git a/src/main/java/org/spongepowered/api/item/inventory/ArmorEquipable.java b/src/main/java/org/spongepowered/api/item/inventory/ArmorEquipable.java
index 964fd3e6d8..6f238811ce 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/ArmorEquipable.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/ArmorEquipable.java
@@ -46,14 +46,6 @@ public interface ArmorEquipable extends Equipable {
*/
ItemStack head();
- /**
- * @deprecated Use {@link #setHead(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default void setHead(ItemStack head) {
- this.setHead((ItemStackLike) head);
- }
-
/**
* Sets the head.
*
@@ -68,14 +60,6 @@ default void setHead(ItemStack head) {
*/
ItemStack chest();
- /**
- * @deprecated Use {@link #setChest(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default void setChest(ItemStack chest) {
- this.setChest((ItemStackLike) chest);
- }
-
/**
* Sets the chest.
*
@@ -90,14 +74,6 @@ default void setChest(ItemStack chest) {
*/
ItemStack legs();
- /**
- * @deprecated Use {@link #setLegs(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default void setLegs(ItemStack legs) {
- this.setLegs((ItemStackLike) legs);
- }
-
/**
* Sets the legs.
*
@@ -112,14 +88,6 @@ default void setLegs(ItemStack legs) {
*/
ItemStack feet();
- /**
- * @deprecated Use {@link #setFeet(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default void setFeet(ItemStack feet) {
- this.setFeet((ItemStackLike) feet);
- }
-
/**
* Sets the feet.
*
@@ -145,14 +113,6 @@ default ItemStack itemInHand(Supplier extends HandType> handType) {
*/
ItemStack itemInHand(HandType handType);
- /**
- * @deprecated Use {@link #setItemInHand(Supplier, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default void setItemInHand(Supplier extends HandType> handType, ItemStack itemInHand) {
- this.setItemInHand(handType, (ItemStackLike) itemInHand);
- }
-
/**
* Sets the equipped item in hand.
*
@@ -163,14 +123,6 @@ default void setItemInHand(Supplier extends HandType> handType, ItemStackLike
this.setItemInHand(handType.get(), itemInHand);
}
- /**
- * @deprecated Use {@link #setItemInHand(HandType, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default void setItemInHand(HandType handType, ItemStack itemInHand) {
- this.setItemInHand(handType, (ItemStackLike) itemInHand);
- }
-
/**
* Sets the equipped item in hand.
*
diff --git a/src/main/java/org/spongepowered/api/item/inventory/Container.java b/src/main/java/org/spongepowered/api/item/inventory/Container.java
index 35e360e428..f68406c003 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/Container.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/Container.java
@@ -59,14 +59,6 @@ public interface Container extends Inventory {
*/
List viewed();
- /**
- * @deprecated Use {@link #setCursor(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean setCursor(ItemStack item) {
- return this.setCursor((ItemStackLike) item);
- }
-
/**
* Sets the viewing players cursor item.
* Returns false when the container is no longer open.
diff --git a/src/main/java/org/spongepowered/api/item/inventory/Equipable.java b/src/main/java/org/spongepowered/api/item/inventory/Equipable.java
index 974c5c16d2..f7d75f15dc 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/Equipable.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/Equipable.java
@@ -56,14 +56,6 @@ default boolean canEquip(final Supplier extends EquipmentType> type) {
return this.canEquip(type.get());
}
- /**
- * @deprecated Use {@link #canEquip(EquipmentType, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean canEquip(EquipmentType type, ItemStack equipment) {
- return this.canEquip(type, (ItemStackLike) equipment);
- }
-
/**
* Gets whether this {@link Equipable} can equip the supplied equipment in its slot of
* the specified type (eg. whether calling {@link #equip} with the specified
@@ -75,14 +67,6 @@ default boolean canEquip(EquipmentType type, ItemStack equipment) {
*/
boolean canEquip(EquipmentType type, ItemStackLike equipment);
- /**
- * @deprecated Use {@link #canEquip(Supplier, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean canEquip(final Supplier extends EquipmentType> type, final ItemStack equipment) {
- return this.canEquip(type, (ItemStackLike) equipment);
- }
-
default boolean canEquip(final Supplier extends EquipmentType> type, final ItemStackLike equipment) {
return this.canEquip(type.get(), equipment);
}
@@ -100,14 +84,6 @@ default Optional equipped(final Supplier extends EquipmentType> typ
return this.equipped(type.get());
}
- /**
- * @deprecated Use {@link #equip(EquipmentType, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean equip(EquipmentType type, ItemStack equipment) {
- return this.equip(type, (ItemStackLike) equipment);
- }
-
/**
* Sets the item currently equipped by the {@link Equipable} in the specified slot, if
* the equipable has such a slot.
@@ -121,14 +97,6 @@ default boolean equip(EquipmentType type, ItemStack equipment) {
*/
boolean equip(EquipmentType type, ItemStackLike equipment);
- /**
- * @deprecated Use {@link #equip(Supplier, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean equip(final Supplier extends EquipmentType> type, final ItemStack equipment) {
- return this.equip(type, (ItemStackLike) equipment);
- }
-
default boolean equip(final Supplier extends EquipmentType> type, final ItemStackLike equipment) {
return this.equip(type.get(), equipment);
}
diff --git a/src/main/java/org/spongepowered/api/item/inventory/Inventory.java b/src/main/java/org/spongepowered/api/item/inventory/Inventory.java
index a28eb59808..e74de518aa 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/Inventory.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/Inventory.java
@@ -142,14 +142,6 @@ static Builder builder() {
*/
ItemStack peek();
- /**
- * @deprecated Use {@link #offer(ItemStackLike...)} instead.
- */
- @Deprecated(forRemoval = true)
- default InventoryTransactionResult offer(ItemStack... stacks) {
- return this.offer((ItemStackLike[]) stacks);
- }
-
/**
* Adds one or more ItemStacks to this inventory.
*
@@ -160,14 +152,6 @@ default InventoryTransactionResult offer(ItemStack... stacks) {
*/
InventoryTransactionResult offer(ItemStackLike... stacks);
- /**
- * @deprecated Use {@link #canFit(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean canFit(ItemStack stack) {
- return this.canFit((ItemStackLike) stack);
- }
-
/**
* Returns true if the entire stack can fit in this inventory.
*
@@ -214,14 +198,6 @@ default boolean canFit(ItemStack stack) {
*/
Optional peekAt(int index);
- /**
- * @deprecated Use {@link #offer(int, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default InventoryTransactionResult offer(int index, ItemStack stack) {
- return this.offer(index, (ItemStackLike) stack);
- }
-
/**
* Adds an ItemStack to the slot at given index.
* Returns a {@link InventoryTransactionResult.Type#SUCCESS} only if the entire {@link ItemStackLike} fits the slot.
@@ -234,14 +210,6 @@ default InventoryTransactionResult offer(int index, ItemStack stack) {
*/
InventoryTransactionResult offer(int index, ItemStackLike stack);
- /**
- * @deprecated Use {@link #set(int, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default InventoryTransactionResult set(int index, ItemStack stack) {
- return this.set(index, (ItemStackLike) stack);
- }
-
/**
* Adds the ItemStack to the slot at given index overwriting the existing item.
*
@@ -292,14 +260,6 @@ default InventoryTransactionResult set(int index, ItemStack stack) {
*/
int capacity();
- /**
- * @deprecated Use {@link #contains(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean contains(ItemStack stack) {
- return this.contains((ItemStackLike) stack);
- }
-
/**
* Checks whether the stacks quantity or more of given stack is contained in this Inventory.
* To check if an inventory contains any amount use {@link #containsAny(ItemStackLike)}.
@@ -319,14 +279,6 @@ default boolean contains(ItemStack stack) {
*/
boolean contains(ItemType type);
- /**
- * @deprecated Use {@link #containsAny(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean containsAny(ItemStack stack) {
- return this.containsAny((ItemStackLike) stack);
- }
-
/**
* Checks whether the given stack is contained in this Inventory.
* The stack size is ignored.
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 5732149556..991261f164 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 e6fa6e98f9..35314f96e9 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/Slot.java b/src/main/java/org/spongepowered/api/item/inventory/Slot.java
index 446f005b3a..4ff3b1cb66 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/Slot.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/Slot.java
@@ -38,14 +38,6 @@ public interface Slot extends Inventory {
*/
Slot viewedSlot();
- /**
- * @deprecated Use {@link #set(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default InventoryTransactionResult set(ItemStack stack) {
- return this.set((ItemStackLike) stack);
- }
-
/**
* Adds the ItemStack to this slot overwriting the existing item.
*
diff --git a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentInventory.java b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentInventory.java
index 321069ebb1..699f05e9a3 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentInventory.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentInventory.java
@@ -89,14 +89,6 @@ default Optional peek(final Supplier extends EquipmentType> equipme
return this.peek(equipmentType.get());
}
- /**
- * @deprecated Use {@link #set(EquipmentType, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default InventoryTransactionResult set(EquipmentType equipmentType, ItemStack stack) {
- return this.set(equipmentType, (ItemStackLike) stack);
- }
-
/**
* Sets the item for the specified equipment type.
*
@@ -107,13 +99,6 @@ default InventoryTransactionResult set(EquipmentType equipmentType, ItemStack st
*/
InventoryTransactionResult set(EquipmentType equipmentType, ItemStackLike stack);
- /**
- * @deprecated Use {@link #set(Supplier, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default InventoryTransactionResult set(final Supplier extends EquipmentType> equipmentType, final ItemStack stack) {
- return this.set(equipmentType, (ItemStackLike) stack);
- }
default InventoryTransactionResult set(final Supplier extends EquipmentType> equipmentType, final ItemStackLike stack) {
return this.set(equipmentType.get(), stack);
diff --git a/src/main/java/org/spongepowered/api/item/inventory/slot/FilteringSlot.java b/src/main/java/org/spongepowered/api/item/inventory/slot/FilteringSlot.java
index 97e94d11e0..a54883c7ba 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/slot/FilteringSlot.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/slot/FilteringSlot.java
@@ -25,7 +25,6 @@
package org.spongepowered.api.item.inventory.slot;
import org.spongepowered.api.item.ItemType;
-import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.item.inventory.Slot;
@@ -34,14 +33,6 @@
*/
public interface FilteringSlot extends Slot {
- /**
- * @deprecated Use {@link #isValidItem(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean isValidItem(ItemStack stack) {
- return this.isValidItem((ItemStackLike) stack);
- }
-
/**
* Check whether the supplied item can be inserted into this slot. Returning
* false from this method implies that {@link #offer} would always return
diff --git a/src/main/java/org/spongepowered/api/item/inventory/slot/SidedSlot.java b/src/main/java/org/spongepowered/api/item/inventory/slot/SidedSlot.java
index 754977e8a5..eb6eda3aa5 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/slot/SidedSlot.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/slot/SidedSlot.java
@@ -25,7 +25,6 @@
package org.spongepowered.api.item.inventory.slot;
import org.spongepowered.api.item.inventory.Inventory;
-import org.spongepowered.api.item.inventory.ItemStack;
import org.spongepowered.api.item.inventory.ItemStackLike;
import org.spongepowered.api.item.inventory.Slot;
import org.spongepowered.api.util.Direction;
@@ -35,14 +34,6 @@
*/
public interface SidedSlot extends Slot {
- /**
- * @deprecated Use {@link #canAccept(ItemStackLike, Direction)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean canAccept(ItemStack stack, Direction from) {
- return this.canAccept((ItemStackLike) stack, from);
- }
-
/**
* Gets whether this slot can accept the specified item from the specified
* direction.
@@ -54,14 +45,6 @@ default boolean canAccept(ItemStack stack, Direction from) {
*/
boolean canAccept(ItemStackLike stack, Direction from);
- /**
- * @deprecated Use {@link #offer(ItemStackLike, Direction)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean offer(ItemStack stack, Direction from) {
- return this.offer((ItemStackLike) stack, from);
- }
-
/**
* Attempts to insert the supplied stack into this inventory from the
* specified direction.
@@ -74,14 +57,6 @@ default boolean offer(ItemStack stack, Direction from) {
*/
boolean offer(ItemStackLike stack, Direction from);
- /**
- * @deprecated Use {@link #canGet(ItemStackLike, Direction)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean canGet(ItemStack stack, Direction from) {
- return this.canGet((ItemStackLike) stack, from);
- }
-
/**
* Gets whether automation can extract the specified item from the specified
* direction.
diff --git a/src/main/java/org/spongepowered/api/item/inventory/transaction/InventoryTransactionResult.java b/src/main/java/org/spongepowered/api/item/inventory/transaction/InventoryTransactionResult.java
index a516faaa56..a4a626c002 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/transaction/InventoryTransactionResult.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/transaction/InventoryTransactionResult.java
@@ -179,14 +179,6 @@ interface Builder extends org.spongepowered.api.util.Builder itemStacks);
- /**
- * @deprecated Use {@link #poll(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Builder.PollBuilder poll(ItemStackSnapshot itemStack) {
- return this.poll((ItemStackLike) itemStack);
- }
-
/**
* Sets the provided {@link ItemStackLike} as the stack that has been polled from the inventory.
*
diff --git a/src/main/java/org/spongepowered/api/item/inventory/transaction/SlotTransaction.java b/src/main/java/org/spongepowered/api/item/inventory/transaction/SlotTransaction.java
index da31f15953..5caa09f7bd 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/transaction/SlotTransaction.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/transaction/SlotTransaction.java
@@ -25,7 +25,6 @@
package org.spongepowered.api.item.inventory.transaction;
import org.spongepowered.api.data.Transaction;
-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.item.inventory.Slot;
@@ -51,14 +50,6 @@ public SlotTransaction(Slot slot, ItemStackSnapshot original, ItemStackSnapshot
this.slot = Objects.requireNonNull(slot, "Slot cannot be null!");
}
- /**
- * @deprecated Use {@link #setCustom(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- public void setCustom(ItemStack stack) {
- this.setCustom((ItemStackLike) stack);
- }
-
/**
* Sets the custom {@link ItemStackLike} output of this
* {@link SlotTransaction}.
diff --git a/src/main/java/org/spongepowered/api/item/inventory/type/GridInventory.java b/src/main/java/org/spongepowered/api/item/inventory/type/GridInventory.java
index 48b6fd8470..ef26ed275a 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/type/GridInventory.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/type/GridInventory.java
@@ -96,14 +96,6 @@ public interface GridInventory extends Inventory2D {
*/
Optional peek(int x, int y);
- /**
- * @deprecated Use {@link #set(int, int, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default InventoryTransactionResult set(int x, int y, ItemStack stack) {
- return this.set(x, y, (ItemStackLike) stack);
- }
-
/**
* Sets the item in the specified slot.
*
diff --git a/src/main/java/org/spongepowered/api/item/inventory/type/Inventory2D.java b/src/main/java/org/spongepowered/api/item/inventory/type/Inventory2D.java
index 990fa0dbcf..45d8c6db6a 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/type/Inventory2D.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/type/Inventory2D.java
@@ -74,14 +74,6 @@ default Optional peek(Vector2i pos) {
return this.slot(pos).map(Inventory::peek);
}
- /**
- * @deprecated Use {@link #set(Vector2i, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default InventoryTransactionResult set(Vector2i pos, ItemStack stack) {
- return this.set(pos, (ItemStackLike) stack);
- }
-
/**
* Sets the item in the specified slot.
*
diff --git a/src/main/java/org/spongepowered/api/item/inventory/type/ViewableInventory.java b/src/main/java/org/spongepowered/api/item/inventory/type/ViewableInventory.java
index af76ba85db..3287ee2a97 100644
--- a/src/main/java/org/spongepowered/api/item/inventory/type/ViewableInventory.java
+++ b/src/main/java/org/spongepowered/api/item/inventory/type/ViewableInventory.java
@@ -33,7 +33,6 @@
import org.spongepowered.api.item.inventory.ContainerType;
import org.spongepowered.api.item.inventory.Inventory;
import org.spongepowered.api.item.inventory.ItemStackLike;
-import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.api.item.inventory.Slot;
import org.spongepowered.api.item.inventory.menu.InventoryMenu;
import org.spongepowered.math.vector.Vector2i;
@@ -248,14 +247,6 @@ interface BuildingStep {
interface DummyStep extends BuildingStep {
- /**
- * @deprecated Use {@link #item(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default BuildingStep item(ItemStackSnapshot item) {
- return this.item((ItemStackLike) item);
- }
-
/**
* Sets the default item for the dummy-slots.
*
diff --git a/src/main/java/org/spongepowered/api/item/merchant/TradeOffer.java b/src/main/java/org/spongepowered/api/item/merchant/TradeOffer.java
index b57641df73..bbb93ff2f0 100644
--- a/src/main/java/org/spongepowered/api/item/merchant/TradeOffer.java
+++ b/src/main/java/org/spongepowered/api/item/merchant/TradeOffer.java
@@ -28,7 +28,6 @@
import org.spongepowered.api.data.persistence.DataBuilder;
import org.spongepowered.api.data.persistence.DataSerializable;
import org.spongepowered.api.entity.living.Humanoid;
-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;
@@ -165,14 +164,6 @@ static Builder builder() {
*/
interface Builder extends org.spongepowered.api.util.Builder, CopyableBuilder, DataBuilder {
- /**
- * @deprecated Use {@link #firstBuyingItem(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Builder firstBuyingItem(ItemStack item) {
- return this.firstBuyingItem((ItemStackLike) item);
- }
-
/**
* Sets the first selling item of the trade offer to be
* generated.
@@ -184,14 +175,6 @@ default Builder firstBuyingItem(ItemStack item) {
*/
Builder firstBuyingItem(ItemStackLike item);
- /**
- * @deprecated Use {@link #secondBuyingItem(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Builder secondBuyingItem(ItemStack item) {
- return this.secondBuyingItem((ItemStackLike) item);
- }
-
/**
* Sets the second selling item of the trade offer to be generated.
*
@@ -200,14 +183,6 @@ default Builder secondBuyingItem(ItemStack item) {
*/
Builder secondBuyingItem(ItemStackLike item);
- /**
- * @deprecated Use {@link #sellingItem(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Builder sellingItem(ItemStack item) {
- return this.sellingItem((ItemStackLike) item);
- }
-
/**
* Sets the selling item of the trade offer to be generated.
*
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 5ddae2894c..84ea899a8a 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/RecipeManager.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/RecipeManager.java
@@ -26,7 +26,6 @@
import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.item.inventory.ItemStackLike;
-import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.api.item.recipe.cooking.CookingRecipe;
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.world.server.ServerWorld;
@@ -77,14 +76,6 @@ default > Collection allOfType(Supplier extends RecipeT
return this.allOfType(supplier.get());
}
- /**
- * @deprecated Use {@link #findByResult(RecipeType, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default > Collection findByResult(RecipeType type, ItemStackSnapshot result) {
- return this.findByResult(type, (ItemStackLike) result);
- }
-
/**
* Returns all registered recipes of given type and with given item as a result.
*
@@ -95,14 +86,6 @@ default > Collection findByResult(RecipeType type, Ite
*/
> Collection findByResult(RecipeType type, ItemStackLike result);
- /**
- * @deprecated Use {@link #findByResult(Supplier, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default > Collection findByResult(Supplier extends RecipeType> supplier, ItemStackSnapshot result) {
- return this.findByResult(supplier, (ItemStackLike) result);
- }
-
/**
* Gets all recipes with given item as a result.
*
@@ -138,14 +121,6 @@ default > Optional findMatchingRec
return this.findMatchingRecipe(supplier.get(), input, world);
}
- /**
- * @deprecated Use {@link #findCookingRecipe(RecipeType, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Optional findCookingRecipe(RecipeType type, ItemStackSnapshot ingredient) {
- return this.findCookingRecipe(type, (ItemStackLike) ingredient);
- }
-
/**
* Finds a matching cooking recipe for given type and ingredient
*
@@ -156,14 +131,6 @@ default Optional findCookingRecipe(RecipeType ty
*/
Optional findCookingRecipe(RecipeType type, ItemStackLike ingredient);
- /**
- * @deprecated Use {@link #findCookingRecipe(Supplier, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Optional findCookingRecipe(Supplier extends RecipeType> supplier, ItemStackSnapshot ingredient) {
- return this.findCookingRecipe(supplier, (ItemStackLike) ingredient);
- }
-
/**
* Finds a matching cooking recipe for given type and ingredient
*
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 776725f7e0..4961745192 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
@@ -28,9 +28,7 @@
import org.spongepowered.api.Sponge;
import org.spongepowered.api.datapack.DataPack;
import org.spongepowered.api.item.ItemType;
-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.item.recipe.Recipe;
import org.spongepowered.api.item.recipe.RecipeRegistration;
import org.spongepowered.api.item.recipe.RecipeType;
@@ -64,14 +62,6 @@ static Builder builder() {
*/
Ingredient ingredient();
- /**
- * @deprecated Use {@link #isValid(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default boolean isValid(ItemStackSnapshot ingredient) {
- return this.isValid((ItemStackLike) ingredient);
- }
-
/**
* Checks if the given {@link ItemStackLike} fits the required
* constraints to craft this {@link CookingRecipe}.
@@ -82,14 +72,6 @@ default boolean isValid(ItemStackSnapshot ingredient) {
*/
boolean isValid(ItemStackLike ingredient);
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default Optional result(ItemStackSnapshot ingredient) {
- return this.result((ItemStackLike) ingredient);
- }
-
/**
* Returns the {@link CookingResult} containing the resulting
* {@link ItemStackLike} and the amount of experience released.
@@ -199,22 +181,6 @@ default EndStep result(Supplier extends ItemType> result) {
return this.result(result.get());
}
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStack result) {
- return this.result((ItemStackLike) result);
- }
-
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStackSnapshot result) {
- return this.result((ItemStackLike) result);
- }
-
/**
* Changes the result and returns this builder. The result is the
* {@link ItemStackLike} created when the recipe is fulfilled.
@@ -225,14 +191,6 @@ default EndStep result(ItemStackSnapshot result) {
*/
EndStep result(ItemStackLike result);
- /**
- * @deprecated Use {@link #result(Function, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(final Function resultFunction, final ItemStack exemplaryResult) {
- return this.result(resultFunction, (ItemStackLike) exemplaryResult);
- }
-
/**
* Sets the result function and an exemplary result.
*
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 8cb100ba48..447a67cd89 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 abefa1b908..ac32a09903 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
@@ -54,15 +54,6 @@ static Ingredient empty() {
return Sponge.game().factoryProvider().provide(Factory.class).empty();
}
- /**
- * @deprecated Use {@link #test(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- @Override
- default boolean test(ItemStack itemStack) {
- return this.test((ItemStackLike) itemStack);
- }
-
boolean test(ItemStackLike item);
/**
@@ -95,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.
*
@@ -139,11 +101,16 @@ static Ingredient of(DefaultedRegistryReference extends ItemType> @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();
}
/**
@@ -197,14 +164,6 @@ interface Builder extends org.spongepowered.api.util.Builder... types);
- /**
- * @deprecated Use {@link #with(ItemStackLike...)} instead
- */
- @Deprecated(forRemoval = true)
- default Builder with(ItemStack... types) {
- return this.with((ItemStackLike[]) types);
- }
-
/**
* Sets one or more ItemStackLike for matching the ingredient.
*
@@ -213,14 +172,6 @@ default Builder with(ItemStack... types) {
*/
Builder with(ItemStackLike... types);
- /**
- * @deprecated Use {@link #with(ResourceKey, Predicate, ItemStackLike...)} instead.
- */
- @Deprecated(forRemoval = true)
- default Builder with(ResourceKey resourceKey, Predicate predicate, ItemStack... exemplaryTypes) {
- return this.with(resourceKey, itemStack -> predicate.test(itemStack.asMutable()), (ItemStackLike[]) exemplaryTypes);
- }
-
/**
* Sets a Predicate for matching the ingredient.
* Exemplary types are used for the vanilla recipe book.
@@ -232,14 +183,6 @@ default Builder with(ResourceKey resourceKey, Predicate predicate, It
*/
Builder with(ResourceKey resourceKey, Predicate super ItemStackLike> predicate, ItemStackLike... exemplaryTypes);
- /**
- * @deprecated Use {@link #with(ItemStackLike...)} instead
- */
- @Deprecated(forRemoval = true)
- default Builder with(ItemStackSnapshot... types) {
- return this.with((ItemStackLike[]) types);
- }
-
/**
* Sets the item tag for matching the ingredient.
*
diff --git a/src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeInput.java b/src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeInput.java
index d31e8dcd1b..7ed37af433 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeInput.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeInput.java
@@ -66,14 +66,6 @@ interface Crafting extends RecipeInput {
interface Factory {
- /**
- * @deprecated Use {@link #single(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default RecipeInput.Single single(ItemStack stack) {
- return this.single((ItemStackLike) stack);
- }
-
/**
* Creates a recipe input for
* {@link CookingRecipe} and
@@ -85,14 +77,6 @@ default RecipeInput.Single single(ItemStack stack) {
*/
RecipeInput.Single single(ItemStackLike stack);
- /**
- * @deprecated Use {@link #smithing(ItemStackLike, ItemStackLike, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default RecipeInput.Smithing smithing(ItemStack templateStack, ItemStack baseStack, ItemStack additionStack) {
- return this.smithing((ItemStackLike) templateStack, (ItemStackLike) baseStack, (ItemStackLike) additionStack);
- }
-
/**
* Creates a recipe input for {@link SmithingRecipe}
*
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 489eadcbf0..99690df799 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 extends ItemStackLike>) 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 5101f396be..eab86229be 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
@@ -30,7 +30,6 @@
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.inventory.ItemStackSnapshot;
import org.spongepowered.api.item.recipe.RecipeRegistration;
import org.spongepowered.api.util.ResourceKeyedBuilder;
@@ -222,27 +221,9 @@ interface ResultStep extends Builder {
* @param remainingItemsFunction the remaining items function
*
* @return This builder, for chaining
- * @deprecated Will be replaced with ItemStackLike variant
*/
- @Deprecated
ResultStep remainingItems(Function> remainingItemsFunction);
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStackSnapshot result) {
- return this.result((ItemStackLike) result);
- }
-
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStack result) {
- return this.result((ItemStackLike) result);
- }
-
/**
* Sets the resultant {@link ItemStackLike} for when this shaped
* recipe is correctly crafted.
@@ -253,13 +234,6 @@ default EndStep result(ItemStack result) {
*/
EndStep result(ItemStackLike result);
- /**
- * @deprecated Use {@link #result(Function, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(Function resultFunction, ItemStack exemplaryResult) {
- return this.result(resultFunction, (ItemStackLike) exemplaryResult);
- }
/**
* Sets the result function and an exemplary result.
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 946a286b18..9eeac6ba06 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
@@ -29,9 +29,7 @@
import org.spongepowered.api.Sponge;
import org.spongepowered.api.datapack.DataPack;
import org.spongepowered.api.item.ItemType;
-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.item.recipe.RecipeRegistration;
import org.spongepowered.api.util.ResourceKeyedBuilder;
@@ -108,22 +106,6 @@ interface ResultStep extends Builder {
*/
ResultStep remainingItems(Function> remainingItemsFunction);
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStackSnapshot result) {
- return this.result((ItemStackLike) result);
- }
-
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStack result) {
- return this.result((ItemStackLike) result);
- }
-
/**
* Sets the result and returns this builder. The result is the
* {@link ItemStackLike} created when the recipe is fulfilled.
@@ -134,14 +116,6 @@ default EndStep result(ItemStack result) {
*/
EndStep result(ItemStackLike result);
- /**
- * @deprecated Use {@link #result(Function, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(Function resultFunction, ItemStack exemplaryResult) {
- return this.result(resultFunction, (ItemStackLike) exemplaryResult);
- }
-
/**
* Sets the result function and an exemplary result.
* The exemplary result is used for the recipe book.
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 8f5e35d5bc..c8be1acd85 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
@@ -26,7 +26,6 @@
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;
@@ -86,14 +85,6 @@ interface ResultStep extends Builder {
*/
EndStep result(Function resultFunction);
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead;
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStack result) {
- return this.result((ItemStackLike) result);
- }
-
/**
* Sets the result
*
diff --git a/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java b/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
index 13d383788a..ca7eae9bf3 100644
--- a/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
+++ b/src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
@@ -29,9 +29,7 @@
import org.spongepowered.api.Sponge;
import org.spongepowered.api.datapack.DataPack;
import org.spongepowered.api.item.ItemType;
-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.item.recipe.Recipe;
import org.spongepowered.api.item.recipe.RecipeRegistration;
import org.spongepowered.api.item.recipe.RecipeType;
@@ -97,22 +95,6 @@ default ResultStep ingredient(Supplier extends ItemType> ingredient) {
interface ResultStep extends StoneCutterRecipe.Builder {
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStackSnapshot result) {
- return this.result((ItemStackLike) result);
- }
-
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStack result) {
- return this.result((ItemStackLike) result);
- }
-
/**
* Changes the result and returns this builder. The result is the
* {@link ItemStackLike} created when the recipe is fulfilled.
@@ -123,14 +105,6 @@ default EndStep result(ItemStack result) {
*/
EndStep result(ItemStackLike result);
- /**
- * @deprecated Use {@link #result(Function, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(Function resultFunction, ItemStack exemplaryResult) {
- return this.result(resultFunction, (ItemStackLike) exemplaryResult);
- }
-
/**
* Changes the result and returns this builder. The result is the
* {@link ItemStackLike} created when the recipe is fulfilled.
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 dd5fe78dfe..b3c8034885 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
@@ -29,9 +29,7 @@
import org.spongepowered.api.Sponge;
import org.spongepowered.api.datapack.DataPack;
import org.spongepowered.api.item.ItemType;
-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.item.recipe.Recipe;
import org.spongepowered.api.item.recipe.RecipeRegistration;
import org.spongepowered.api.item.recipe.RecipeType;
@@ -177,22 +175,6 @@ default ResultStep addition(Supplier extends ItemType> ingredient) {
interface ResultStep extends SmithingRecipe.Builder {
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStackSnapshot result) {
- return this.result((ItemStackLike) result);
- }
-
- /**
- * @deprecated Use {@link #result(ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(ItemStack result) {
- return this.result((ItemStackLike) result);
- }
-
/**
* Changes the result and returns this builder. The result is the
* {@link ItemStackLike} created when the recipe is fulfilled.
@@ -203,14 +185,6 @@ default EndStep result(ItemStack result) {
*/
EndStep result(ItemStackLike result);
- /**
- * @deprecated Use {@link #result(Function, ItemStackLike)} instead.
- */
- @Deprecated(forRemoval = true)
- default EndStep result(Function resultFunction, ItemStack exemplaryResult) {
- return this.result(resultFunction, (ItemStackLike) exemplaryResult);
- }
-
/**
* Changes the result and returns this builder. The result is the
* {@link ItemStackLike} created when the recipe is fulfilled.
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 4243fcd663..0296213793 100644
--- a/src/main/java/org/spongepowered/api/world/storage/WorldProperties.java
+++ b/src/main/java/org/spongepowered/api/world/storage/WorldProperties.java
@@ -29,7 +29,6 @@
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;
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 0000000000..da00ee6758
--- /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);
+ }
+
+}
From 89c82c20c1eea16f81cc471cb367d197a69552e4 Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Mon, 14 Oct 2024 22:11:04 -0700
Subject: [PATCH 12/14] feat: add creaking data
Signed-off-by: Gabriel Harris-Rouquette
---
.../java/org/spongepowered/api/data/Keys.java | 19 +++++++++++++++++++
.../api/entity/living/monster/Creaking.java | 18 ++++++++++++++++++
.../spongepowered/api/world/biome/Biomes.java | 6 ++++++
3 files changed, 43 insertions(+)
diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java
index 454d9f681e..dc5fa5f608 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.EndGateway;
import org.spongepowered.api.block.entity.Jukebox;
import org.spongepowered.api.block.entity.Lectern;
@@ -163,6 +164,7 @@
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;
@@ -208,6 +210,7 @@
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.source.DamageSource;
import org.spongepowered.api.event.cause.entity.damage.source.DamageSources;
import org.spongepowered.api.fluid.FluidStackSnapshot;
import org.spongepowered.api.fluid.FluidTypes;
@@ -763,6 +766,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.
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
index f22acd0cbc..59b7c798a3 100644
--- a/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java
+++ b/src/main/java/org/spongepowered/api/entity/living/monster/Creaking.java
@@ -24,7 +24,25 @@
*/
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.api.util.annotation.Experimental;
+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}
+ */
+@Experimental("winter_drop")
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/world/biome/Biomes.java b/src/main/java/org/spongepowered/api/world/biome/Biomes.java
index 046c61934e..b9837ff747 100644
--- a/src/main/java/org/spongepowered/api/world/biome/Biomes.java
+++ b/src/main/java/org/spongepowered/api/world/biome/Biomes.java
@@ -24,6 +24,7 @@
*/
package org.spongepowered.api.world.biome;
+import org.jetbrains.annotations.ApiStatus;
import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
@@ -31,6 +32,7 @@
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;
+import org.spongepowered.api.util.annotation.Experimental;
import org.spongepowered.api.world.server.ServerWorld;
/**
@@ -118,6 +120,10 @@ public final class Biomes {
public static final RegistryReference OLD_GROWTH_SPRUCE_TAIGA = Biomes.key(ResourceKey.minecraft("old_growth_spruce_taiga"));
+ @Experimental("winter_drop")
+ @ApiStatus.Experimental
+ public static final RegistryReference PALE_GARDEN = Biomes.key(ResourceKey.minecraft("pale_garden"));
+
public static final RegistryReference PLAINS = Biomes.key(ResourceKey.minecraft("plains"));
public static final RegistryReference RIVER = Biomes.key(ResourceKey.minecraft("river"));
From a0bfac5d6a7f1ed6b2f8e0e3d0a4d621b9b267fa Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Tue, 15 Oct 2024 20:25:31 -0700
Subject: [PATCH 13/14] chore: bump to next major version
Signed-off-by: Gabriel Harris-Rouquette
---
gradle.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gradle.properties b/gradle.properties
index 6722e4e5a5..7517a26242 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,5 +1,5 @@
group=org.spongepowered
-version=12.0.0-SNAPSHOT
+version=13.0.0-SNAPSHOT
organization=SpongePowered
projectUrl=https://www.spongepowered.org
projectDescription=A plugin API for Minecraft: Java Edition
From 8e1c091ecea15b3e81c3c491a3efca270d0574d0 Mon Sep 17 00:00:00 2001
From: Gabriel Harris-Rouquette
Date: Tue, 15 Oct 2024 20:35:13 -0700
Subject: [PATCH 14/14] feat: enable cooldown group data keys
Signed-off-by: Gabriel Harris-Rouquette
---
.../java/org/spongepowered/api/data/Keys.java | 19 +++++++++++++++++++
.../entity/living/player/CooldownTracker.java | 7 +++++++
2 files changed, 26 insertions(+)
diff --git a/src/main/java/org/spongepowered/api/data/Keys.java b/src/main/java/org/spongepowered/api/data/Keys.java
index dc5fa5f608..9a8e751fc0 100644
--- a/src/main/java/org/spongepowered/api/data/Keys.java
+++ b/src/main/java/org/spongepowered/api/data/Keys.java
@@ -100,6 +100,7 @@
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;
@@ -185,6 +186,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;
@@ -223,6 +225,7 @@
import org.spongepowered.api.item.enchantment.EnchantmentTypes;
import org.spongepowered.api.item.inventory.Inventory;
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.item.inventory.Slot;
import org.spongepowered.api.item.inventory.equipment.EquipmentType;
@@ -239,6 +242,7 @@
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.Tag;
import org.spongepowered.api.util.Axis;
@@ -752,9 +756,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}.
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 16993e5583..d6e2448688 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
@@ -58,6 +58,13 @@ public interface CooldownTracker {
*/
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);
/**