From d391876adcac72f9ab537ffc517c02fac7e7c26f Mon Sep 17 00:00:00 2001 From: MrHell228 Date: Sat, 12 Oct 2024 02:58:15 +0300 Subject: [PATCH 1/4] Move deprecated ItemStackLike related methods to Common --- SpongeAPI | 2 +- ...isplayInfo_BuilderMixin_ItemStackLike.java | 42 +++++++++++++ .../entity/JukeboxMixin_ItemStackLike.java | 37 ++++++++++++ ...geModifier_BuilderMixin_ItemStackLike.java | 42 +++++++++++++ .../EnchantmentTypeMixin_ItemStackLike.java | 41 +++++++++++++ .../ArmorEquipableMixin_ItemStackLike.java | 60 +++++++++++++++++++ .../ContainerMixin_ItemStackLike.java | 37 ++++++++++++ .../EquipableMixin_ItemStackLike.java | 52 ++++++++++++++++ .../InventoryMixin_ItemStackLike.java | 58 ++++++++++++++++++ .../inventory/SlotMixin_ItemStackLike.java | 38 ++++++++++++ ...EquipmentInventoryMixin_ItemStackLike.java | 45 ++++++++++++++ .../FilteringSlotMixin_ItemStackLike.java | 37 ++++++++++++ .../slot/SidedSlotMixin_ItemStackLike.java | 46 ++++++++++++++ ...tionResult_BuilderMixin_ItemStackLike.java | 42 +++++++++++++ .../SlotTransactionMixin_ItemStackLike.java | 37 ++++++++++++ .../GridInventoryMixin_ItemStackLike.java | 38 ++++++++++++ .../type/Inventory2DMixin_ItemStackLike.java | 39 ++++++++++++ ..._Builder_DummyStepMixin_ItemStackLike.java | 37 ++++++++++++ ...TradeOffer_BuilderMixin_ItemStackLike.java | 45 ++++++++++++++ .../RecipeManagerMixin_ItemStackLike.java | 56 +++++++++++++++++ .../CookingRecipeMixin_ItemStackLike.java | 44 ++++++++++++++ ...Builder_ResultStepMixin_ItemStackLike.java | 49 +++++++++++++++ .../IngredientMixin_ItemStackLike.java | 37 ++++++++++++ ...Ingredient_BuilderMixin_ItemStackLike.java | 49 +++++++++++++++ ...ecipeInput_FactoryMixin_ItemStackLike.java | 41 +++++++++++++ ...Builder_ResultStepMixin_ItemStackLike.java | 49 +++++++++++++++ ...Builder_ResultStepMixin_ItemStackLike.java | 49 +++++++++++++++ ...Builder_ResultStepMixin_ItemStackLike.java | 39 ++++++++++++ ...Builder_ResultStepMixin_ItemStackLike.java | 49 +++++++++++++++ ...Builder_ResultStepMixin_ItemStackLike.java | 49 +++++++++++++++ src/mixins/resources/mixins.sponge.api.json | 33 +++++++++- 31 files changed, 1316 insertions(+), 3 deletions(-) create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/advancement/DisplayInfo_BuilderMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/block/entity/JukeboxMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/event/cause/entity/damage/DamageModifier_BuilderMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/enchantment/EnchantmentTypeMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ArmorEquipableMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ContainerMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/EquipableMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/InventoryMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/SlotMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/equipment/EquipmentInventoryMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/FilteringSlotMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/SidedSlotMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/InventoryTransactionResult_BuilderMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/SlotTransactionMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/GridInventoryMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/Inventory2DMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/ViewableInventory_Builder_DummyStepMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/merchant/TradeOffer_BuilderMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/RecipeManagerMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/cooking/CookingRecipeMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/cooking/CookingRecipe_Builder_ResultStepMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/IngredientMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/Ingredient_BuilderMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/RecipeInput_FactoryMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/ShapedCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/ShapelessCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/SpecialCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/single/StoneCutterRecipe_Builder_ResultStepMixin_ItemStackLike.java create mode 100644 src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/smithing/SmithingRecipe_Builder_ResultStepMixin_ItemStackLike.java diff --git a/SpongeAPI b/SpongeAPI index 723d5c2f6bf..0f54724976d 160000 --- a/SpongeAPI +++ b/SpongeAPI @@ -1 +1 @@ -Subproject commit 723d5c2f6bf5eeb834980da725d43610790b33d5 +Subproject commit 0f54724976df35166a06b8f7bbf3a9b808f81c49 diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/advancement/DisplayInfo_BuilderMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/advancement/DisplayInfo_BuilderMixin_ItemStackLike.java new file mode 100644 index 00000000000..e752998a343 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/advancement/DisplayInfo_BuilderMixin_ItemStackLike.java @@ -0,0 +1,42 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.advancement; + +import org.spongepowered.api.advancement.DisplayInfo; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = DisplayInfo.Builder.class, remap = false) +public interface DisplayInfo_BuilderMixin_ItemStackLike { + + default DisplayInfo.Builder icon(ItemStack itemStack) { + return ((DisplayInfo.Builder) this).icon(itemStack); + } + + default DisplayInfo.Builder icon(ItemStackSnapshot itemStackSnapshot) { + return ((DisplayInfo.Builder) this).icon(itemStackSnapshot); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/block/entity/JukeboxMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/block/entity/JukeboxMixin_ItemStackLike.java new file mode 100644 index 00000000000..23bbd9d7eca --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/block/entity/JukeboxMixin_ItemStackLike.java @@ -0,0 +1,37 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.block.entity; + +import org.spongepowered.api.block.entity.Jukebox; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = Jukebox.class, remap = false) +public interface JukeboxMixin_ItemStackLike { + + default void insert(ItemStack disc) { + ((Jukebox) this).insert(disc); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/event/cause/entity/damage/DamageModifier_BuilderMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/event/cause/entity/damage/DamageModifier_BuilderMixin_ItemStackLike.java new file mode 100644 index 00000000000..651609ec6ac --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/event/cause/entity/damage/DamageModifier_BuilderMixin_ItemStackLike.java @@ -0,0 +1,42 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.event.cause.entity.damage; + +import org.spongepowered.api.event.cause.entity.damage.DamageModifier; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = DamageModifier.Builder.class, remap = false) +public abstract class DamageModifier_BuilderMixin_ItemStackLike { + + public DamageModifier.Builder item(ItemStack itemStack) { + return ((DamageModifier.Builder) (Object) this).item(itemStack); + } + + public DamageModifier.Builder item(ItemStackSnapshot snapshot) { + return ((DamageModifier.Builder) (Object) this).item(snapshot); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/enchantment/EnchantmentTypeMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/enchantment/EnchantmentTypeMixin_ItemStackLike.java new file mode 100644 index 00000000000..64fbebeb6ca --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/enchantment/EnchantmentTypeMixin_ItemStackLike.java @@ -0,0 +1,41 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.enchantment; + +import org.spongepowered.api.item.enchantment.EnchantmentType; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = EnchantmentType.class, remap = false) +public interface EnchantmentTypeMixin_ItemStackLike { + + default boolean canBeAppliedToStack(ItemStack stack) { + return ((EnchantmentType) this).canBeAppliedToStack(stack); + } + + default boolean canBeAppliedByTable(ItemStack stack) { + return ((EnchantmentType) this).canBeAppliedByTable(stack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ArmorEquipableMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ArmorEquipableMixin_ItemStackLike.java new file mode 100644 index 00000000000..364cfa752b8 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ArmorEquipableMixin_ItemStackLike.java @@ -0,0 +1,60 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory; + +import org.spongepowered.api.data.type.HandType; +import org.spongepowered.api.item.inventory.ArmorEquipable; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.Supplier; + +@Mixin(value = ArmorEquipable.class, remap = false) +public interface ArmorEquipableMixin_ItemStackLike { + + default void setHead(ItemStack head) { + ((ArmorEquipable) this).setHead(head); + } + + default void setChest(ItemStack chest) { + ((ArmorEquipable) this).setChest(chest); + } + + default void setLegs(ItemStack legs) { + ((ArmorEquipable) this).setLegs(legs); + } + + default void setFeet(ItemStack feet) { + ((ArmorEquipable) this).setFeet(feet); + } + + default void setItemInHand(Supplier handType, ItemStack itemInHand) { + ((ArmorEquipable) this).setItemInHand(handType, itemInHand); + } + + default void setItemInHand(HandType handType, ItemStack itemInHand) { + ((ArmorEquipable) this).setItemInHand(handType, itemInHand); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ContainerMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ContainerMixin_ItemStackLike.java new file mode 100644 index 00000000000..41d156060d8 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/ContainerMixin_ItemStackLike.java @@ -0,0 +1,37 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory; + +import org.spongepowered.api.item.inventory.Container; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = Container.class, remap = false) +public interface ContainerMixin_ItemStackLike { + + default boolean setCursor(ItemStack item) { + return ((Container) this).setCursor(item); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/EquipableMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/EquipableMixin_ItemStackLike.java new file mode 100644 index 00000000000..a1b9f45069e --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/EquipableMixin_ItemStackLike.java @@ -0,0 +1,52 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory; + +import org.spongepowered.api.item.inventory.Equipable; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.equipment.EquipmentType; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.Supplier; + +@Mixin(value = Equipable.class, remap = false) +public interface EquipableMixin_ItemStackLike { + + default boolean canEquip(EquipmentType type, ItemStack equipment) { + return ((Equipable) this).canEquip(type, equipment); + } + + default boolean canEquip(Supplier type, ItemStack equipment) { + return ((Equipable) this).canEquip(type, equipment); + } + + default boolean equip(EquipmentType type, ItemStack equipment) { + return ((Equipable) this).equip(type, equipment); + } + + default boolean equip(Supplier type, ItemStack equipment) { + return ((Equipable) this).equip(type, equipment); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/InventoryMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/InventoryMixin_ItemStackLike.java new file mode 100644 index 00000000000..1c3e2e1d5b3 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/InventoryMixin_ItemStackLike.java @@ -0,0 +1,58 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory; + +import org.spongepowered.api.item.inventory.Inventory; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = Inventory.class, remap = false) +public interface InventoryMixin_ItemStackLike { + + default InventoryTransactionResult offer(ItemStack... stacks) { + return ((Inventory) this).offer(stacks); + } + + default boolean canFit(ItemStack stack) { + return ((Inventory) this).canFit(stack); + } + + default InventoryTransactionResult offer(int index, ItemStack stack) { + return ((Inventory) this).offer(index, stack); + } + + default InventoryTransactionResult set(int index, ItemStack stack) { + return ((Inventory) this).set(index, stack); + } + + default boolean contains(ItemStack stack) { + return ((Inventory) this).contains(stack); + } + + default boolean containsAny(ItemStack stack) { + return ((Inventory) this).containsAny(stack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/SlotMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/SlotMixin_ItemStackLike.java new file mode 100644 index 00000000000..aa7d328d3bb --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/SlotMixin_ItemStackLike.java @@ -0,0 +1,38 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.Slot; +import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = Slot.class, remap = false) +public interface SlotMixin_ItemStackLike { + + default InventoryTransactionResult set(ItemStack stack) { + return ((Slot) this).set(stack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/equipment/EquipmentInventoryMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/equipment/EquipmentInventoryMixin_ItemStackLike.java new file mode 100644 index 00000000000..87611017b43 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/equipment/EquipmentInventoryMixin_ItemStackLike.java @@ -0,0 +1,45 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory.equipment; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.equipment.EquipmentInventory; +import org.spongepowered.api.item.inventory.equipment.EquipmentType; +import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.Supplier; + +@Mixin(value = EquipmentInventory.class, remap = false) +public interface EquipmentInventoryMixin_ItemStackLike { + + default InventoryTransactionResult set(EquipmentType equipmentType, ItemStack stack) { + return ((EquipmentInventory) this).set(equipmentType, stack); + } + + default InventoryTransactionResult set(Supplier equipmentType, ItemStack stack) { + return ((EquipmentInventory) this).set(equipmentType, stack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/FilteringSlotMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/FilteringSlotMixin_ItemStackLike.java new file mode 100644 index 00000000000..47ad0ab29f4 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/FilteringSlotMixin_ItemStackLike.java @@ -0,0 +1,37 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory.slot; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.slot.FilteringSlot; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = FilteringSlot.class, remap = false) +public interface FilteringSlotMixin_ItemStackLike { + + default boolean isValidItem(ItemStack stack) { + return ((FilteringSlot) this).isValidItem(stack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/SidedSlotMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/SidedSlotMixin_ItemStackLike.java new file mode 100644 index 00000000000..4a411b0d7f8 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/slot/SidedSlotMixin_ItemStackLike.java @@ -0,0 +1,46 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory.slot; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.slot.SidedSlot; +import org.spongepowered.api.util.Direction; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = SidedSlot.class, remap = false) +public interface SidedSlotMixin_ItemStackLike { + + default boolean canAccept(ItemStack stack, Direction from) { + return ((SidedSlot) this).canAccept(stack, from); + } + + default boolean offer(ItemStack stack, Direction from) { + return ((SidedSlot) this).offer(stack, from); + } + + default boolean canGet(ItemStack stack, Direction from) { + return ((SidedSlot) this).canGet(stack, from); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/InventoryTransactionResult_BuilderMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/InventoryTransactionResult_BuilderMixin_ItemStackLike.java new file mode 100644 index 00000000000..51c5d822d0d --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/InventoryTransactionResult_BuilderMixin_ItemStackLike.java @@ -0,0 +1,42 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory.transaction; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = InventoryTransactionResult.Builder.class, remap = false) +public interface InventoryTransactionResult_BuilderMixin_ItemStackLike { + + default InventoryTransactionResult.Builder reject(ItemStack... itemStacks) { + return ((InventoryTransactionResult.Builder) this).reject(itemStacks); + } + + default InventoryTransactionResult.Builder.PollBuilder poll(ItemStackSnapshot itemStack) { + return ((InventoryTransactionResult.Builder) this).poll(itemStack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/SlotTransactionMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/SlotTransactionMixin_ItemStackLike.java new file mode 100644 index 00000000000..90faa9215ae --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/transaction/SlotTransactionMixin_ItemStackLike.java @@ -0,0 +1,37 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory.transaction; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.transaction.SlotTransaction; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = SlotTransaction.class, remap = false) +public abstract class SlotTransactionMixin_ItemStackLike { + + public void setCustom(ItemStack stack) { + ((SlotTransaction) (Object) this).setCustom(stack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/GridInventoryMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/GridInventoryMixin_ItemStackLike.java new file mode 100644 index 00000000000..54ece4cfa91 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/GridInventoryMixin_ItemStackLike.java @@ -0,0 +1,38 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory.type; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult; +import org.spongepowered.api.item.inventory.type.GridInventory; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = GridInventory.class, remap = false) +public interface GridInventoryMixin_ItemStackLike { + + default InventoryTransactionResult set(int x, int y, ItemStack stack) { + return ((GridInventory) this).set(x, y, stack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/Inventory2DMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/Inventory2DMixin_ItemStackLike.java new file mode 100644 index 00000000000..58dbb68f0d2 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/Inventory2DMixin_ItemStackLike.java @@ -0,0 +1,39 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory.type; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.transaction.InventoryTransactionResult; +import org.spongepowered.api.item.inventory.type.Inventory2D; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.math.vector.Vector2i; + +@Mixin(value = Inventory2D.class, remap = false) +public interface Inventory2DMixin_ItemStackLike { + + default InventoryTransactionResult set(Vector2i pos, ItemStack stack) { + return ((Inventory2D) this).set(pos, stack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/ViewableInventory_Builder_DummyStepMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/ViewableInventory_Builder_DummyStepMixin_ItemStackLike.java new file mode 100644 index 00000000000..7044bb40170 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/inventory/type/ViewableInventory_Builder_DummyStepMixin_ItemStackLike.java @@ -0,0 +1,37 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.inventory.type; + +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.inventory.type.ViewableInventory; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = ViewableInventory.Builder.DummyStep.class, remap = false) +public interface ViewableInventory_Builder_DummyStepMixin_ItemStackLike { + + default ViewableInventory.Builder.BuildingStep item(ItemStackSnapshot item) { + return ((ViewableInventory.Builder.DummyStep) this).item(item); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/merchant/TradeOffer_BuilderMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/merchant/TradeOffer_BuilderMixin_ItemStackLike.java new file mode 100644 index 00000000000..44317b114a9 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/merchant/TradeOffer_BuilderMixin_ItemStackLike.java @@ -0,0 +1,45 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.merchant; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.merchant.TradeOffer; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = TradeOffer.Builder.class, remap = false) +public interface TradeOffer_BuilderMixin_ItemStackLike { + + default TradeOffer.Builder firstBuyingItem(ItemStack item) { + return ((TradeOffer.Builder) this).firstBuyingItem(item); + } + + default TradeOffer.Builder secondBuyingItem(ItemStack item) { + return ((TradeOffer.Builder) this).secondBuyingItem(item); + } + + default TradeOffer.Builder sellingItem(ItemStack item) { + return ((TradeOffer.Builder) this).sellingItem(item); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/RecipeManagerMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/RecipeManagerMixin_ItemStackLike.java new file mode 100644 index 00000000000..7fa4d9312c2 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/RecipeManagerMixin_ItemStackLike.java @@ -0,0 +1,56 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe; + +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.recipe.Recipe; +import org.spongepowered.api.item.recipe.RecipeManager; +import org.spongepowered.api.item.recipe.RecipeType; +import org.spongepowered.api.item.recipe.cooking.CookingRecipe; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.Collection; +import java.util.Optional; +import java.util.function.Supplier; + +@Mixin(value = RecipeManager.class, remap = false) +public interface RecipeManagerMixin_ItemStackLike { + + default > Collection findByResult(RecipeType type, ItemStackSnapshot result) { + return ((RecipeManager) this).findByResult(type, result); + } + + default > Collection findByResult(Supplier> supplier, ItemStackSnapshot result) { + return ((RecipeManager) this).findByResult(supplier, result); + } + + default Optional findCookingRecipe(RecipeType type, ItemStackSnapshot ingredient) { + return ((RecipeManager) this).findCookingRecipe(type, ingredient); + } + + default Optional findCookingRecipe(Supplier> supplier, ItemStackSnapshot ingredient) { + return ((RecipeManager) this).findCookingRecipe(supplier, ingredient); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/cooking/CookingRecipeMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/cooking/CookingRecipeMixin_ItemStackLike.java new file mode 100644 index 00000000000..fd50a0ed82d --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/cooking/CookingRecipeMixin_ItemStackLike.java @@ -0,0 +1,44 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.cooking; + +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.recipe.cooking.CookingRecipe; +import org.spongepowered.api.item.recipe.cooking.CookingResult; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.Optional; + +@Mixin(value = CookingRecipe.class, remap = false) +public interface CookingRecipeMixin_ItemStackLike { + + default boolean isValid(ItemStackSnapshot ingredient) { + return ((CookingRecipe) this).isValid(ingredient); + } + + default Optional result(ItemStackSnapshot ingredient) { + return ((CookingRecipe) this).result(ingredient); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/cooking/CookingRecipe_Builder_ResultStepMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/cooking/CookingRecipe_Builder_ResultStepMixin_ItemStackLike.java new file mode 100644 index 00000000000..2a214b60a64 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/cooking/CookingRecipe_Builder_ResultStepMixin_ItemStackLike.java @@ -0,0 +1,49 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.cooking; + +import org.spongepowered.api.item.inventory.ItemStack; +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.asm.mixin.Mixin; + +import java.util.function.Function; + +@Mixin(value = CookingRecipe.Builder.ResultStep.class, remap = false) +public interface CookingRecipe_Builder_ResultStepMixin_ItemStackLike { + + default CookingRecipe.Builder.EndStep result(ItemStack result) { + return ((CookingRecipe.Builder.ResultStep) this).result(result); + } + + default CookingRecipe.Builder.EndStep result(ItemStackSnapshot result) { + return ((CookingRecipe.Builder.ResultStep) this).result(result); + } + + default CookingRecipe.Builder.EndStep result(Function resultFunction, ItemStack exemplaryResult) { + return ((CookingRecipe.Builder.ResultStep) this).result(resultFunction, exemplaryResult); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/IngredientMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/IngredientMixin_ItemStackLike.java new file mode 100644 index 00000000000..9fa21b80a57 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/IngredientMixin_ItemStackLike.java @@ -0,0 +1,37 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.crafting; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.recipe.crafting.Ingredient; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = Ingredient.class, remap = false) +public interface IngredientMixin_ItemStackLike { + + default boolean test(ItemStack itemStack) { + return ((Ingredient) this).test(itemStack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/Ingredient_BuilderMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/Ingredient_BuilderMixin_ItemStackLike.java new file mode 100644 index 00000000000..459f8203986 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/Ingredient_BuilderMixin_ItemStackLike.java @@ -0,0 +1,49 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.crafting; + +import org.spongepowered.api.ResourceKey; +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.recipe.crafting.Ingredient; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.Predicate; + +@Mixin(value = Ingredient.Builder.class, remap = false) +public interface Ingredient_BuilderMixin_ItemStackLike { + + default Ingredient.Builder with(ItemStack... types) { + return ((Ingredient.Builder) this).with(types); + } + + default Ingredient.Builder with(ResourceKey resourceKey, Predicate predicate, ItemStack... exemplaryTypes) { + return ((Ingredient.Builder) this).with(resourceKey, itemStack -> predicate.test(itemStack.asMutable()), exemplaryTypes); + } + + default Ingredient.Builder with(ItemStackSnapshot... types) { + return ((Ingredient.Builder) this).with(types); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/RecipeInput_FactoryMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/RecipeInput_FactoryMixin_ItemStackLike.java new file mode 100644 index 00000000000..e5bf505f383 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/RecipeInput_FactoryMixin_ItemStackLike.java @@ -0,0 +1,41 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.crafting; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.recipe.crafting.RecipeInput; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = RecipeInput.Factory.class, remap = false) +public interface RecipeInput_FactoryMixin_ItemStackLike { + + default RecipeInput.Single single(ItemStack stack) { + return ((RecipeInput.Factory) this).single(stack); + } + + default RecipeInput.Smithing smithing(ItemStack templateStack, ItemStack baseStack, ItemStack additionStack) { + return ((RecipeInput.Factory) this).smithing(templateStack, baseStack, additionStack); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/ShapedCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/ShapedCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java new file mode 100644 index 00000000000..d02c9ae6dd1 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/ShapedCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java @@ -0,0 +1,49 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.crafting; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.recipe.crafting.RecipeInput; +import org.spongepowered.api.item.recipe.crafting.ShapedCraftingRecipe; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.Function; + +@Mixin(value = ShapedCraftingRecipe.Builder.ResultStep.class, remap = false) +public interface ShapedCraftingRecipe_Builder_ResultStepMixin_ItemStackLike { + + default ShapedCraftingRecipe.Builder.EndStep result(ItemStackSnapshot result) { + return ((ShapedCraftingRecipe.Builder.ResultStep) this).result(result); + } + + default ShapedCraftingRecipe.Builder.EndStep result(ItemStack result) { + return ((ShapedCraftingRecipe.Builder.ResultStep) this).result(result); + } + + default ShapedCraftingRecipe.Builder.EndStep result(Function resultFunction, ItemStack exemplaryResult) { + return ((ShapedCraftingRecipe.Builder.ResultStep) this).result(resultFunction, exemplaryResult); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/ShapelessCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/ShapelessCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java new file mode 100644 index 00000000000..c0cee571a57 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/ShapelessCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java @@ -0,0 +1,49 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.crafting; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.recipe.crafting.RecipeInput; +import org.spongepowered.api.item.recipe.crafting.ShapelessCraftingRecipe; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.Function; + +@Mixin(value = ShapelessCraftingRecipe.Builder.ResultStep.class, remap = false) +public interface ShapelessCraftingRecipe_Builder_ResultStepMixin_ItemStackLike { + + default ShapelessCraftingRecipe.Builder.EndStep result(ItemStackSnapshot result) { + return ((ShapelessCraftingRecipe.Builder.ResultStep) this).result(result); + } + + default ShapelessCraftingRecipe.Builder.EndStep result(ItemStack result) { + return ((ShapelessCraftingRecipe.Builder.ResultStep) this).result(result); + } + + default ShapelessCraftingRecipe.Builder.EndStep result(Function resultFunction, ItemStack exemplaryResult) { + return ((ShapelessCraftingRecipe.Builder.ResultStep) this).result(resultFunction, exemplaryResult); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/SpecialCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/SpecialCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java new file mode 100644 index 00000000000..9678264a3c2 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/crafting/SpecialCraftingRecipe_Builder_ResultStepMixin_ItemStackLike.java @@ -0,0 +1,39 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.crafting; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.recipe.crafting.SpecialCraftingRecipe; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = SpecialCraftingRecipe.Builder.ResultStep.class, remap = false) +public interface SpecialCraftingRecipe_Builder_ResultStepMixin_ItemStackLike { + + default SpecialCraftingRecipe.Builder.EndStep result(ItemStack result) { + return ((SpecialCraftingRecipe.Builder.ResultStep) this).result(result); + } + + +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/single/StoneCutterRecipe_Builder_ResultStepMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/single/StoneCutterRecipe_Builder_ResultStepMixin_ItemStackLike.java new file mode 100644 index 00000000000..00ff09262bd --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/single/StoneCutterRecipe_Builder_ResultStepMixin_ItemStackLike.java @@ -0,0 +1,49 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.single; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.recipe.crafting.RecipeInput; +import org.spongepowered.api.item.recipe.single.StoneCutterRecipe; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.Function; + +@Mixin(value = StoneCutterRecipe.Builder.ResultStep.class, remap = false) +public interface StoneCutterRecipe_Builder_ResultStepMixin_ItemStackLike { + + default StoneCutterRecipe.Builder.EndStep result(ItemStackSnapshot result) { + return ((StoneCutterRecipe.Builder.ResultStep) this).result(result); + } + + default StoneCutterRecipe.Builder.EndStep result(ItemStack result) { + return ((StoneCutterRecipe.Builder.ResultStep) this).result(result); + } + + default StoneCutterRecipe.Builder.EndStep result(Function resultFunction, ItemStack exemplaryResult) { + return ((StoneCutterRecipe.Builder.ResultStep) this).result(resultFunction, exemplaryResult); + } +} diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/smithing/SmithingRecipe_Builder_ResultStepMixin_ItemStackLike.java b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/smithing/SmithingRecipe_Builder_ResultStepMixin_ItemStackLike.java new file mode 100644 index 00000000000..29d7ced7021 --- /dev/null +++ b/src/mixins/java/org/spongepowered/common/mixin/api/itemstacklike/item/recipe/smithing/SmithingRecipe_Builder_ResultStepMixin_ItemStackLike.java @@ -0,0 +1,49 @@ +/* + * This file is part of Sponge, 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.common.mixin.api.itemstacklike.item.recipe.smithing; + +import org.spongepowered.api.item.inventory.ItemStack; +import org.spongepowered.api.item.inventory.ItemStackSnapshot; +import org.spongepowered.api.item.recipe.crafting.RecipeInput; +import org.spongepowered.api.item.recipe.smithing.SmithingRecipe; +import org.spongepowered.asm.mixin.Mixin; + +import java.util.function.Function; + +@Mixin(value = SmithingRecipe.Builder.ResultStep.class, remap = false) +public interface SmithingRecipe_Builder_ResultStepMixin_ItemStackLike { + + default SmithingRecipe.Builder.EndStep result(ItemStackSnapshot result) { + return ((SmithingRecipe.Builder.ResultStep) this).result(result); + } + + default SmithingRecipe.Builder.EndStep result(ItemStack result) { + return ((SmithingRecipe.Builder.ResultStep) this).result(result); + } + + default SmithingRecipe.Builder.EndStep result(Function resultFunction, ItemStack exemplaryResult) { + return ((SmithingRecipe.Builder.ResultStep) this).result(resultFunction, exemplaryResult); + } +} diff --git a/src/mixins/resources/mixins.sponge.api.json b/src/mixins/resources/mixins.sponge.api.json index fc1ac639d46..e370254598e 100644 --- a/src/mixins/resources/mixins.sponge.api.json +++ b/src/mixins/resources/mixins.sponge.api.json @@ -9,6 +9,35 @@ "data.persistence.DataContainerMixin_API", "entity.ai.goal.AbstractGoalMixin_API", "item.merchant.MerchantMixin_API", + "itemstacklike.advancement.DisplayInfo_BuilderMixin_ItemStackLike", + "itemstacklike.block.entity.JukeboxMixin_ItemStackLike", + "itemstacklike.event.cause.entity.damage.DamageModifier_BuilderMixin_ItemStackLike", + "itemstacklike.item.enchantment.EnchantmentTypeMixin_ItemStackLike", + "itemstacklike.item.inventory.ArmorEquipableMixin_ItemStackLike", + "itemstacklike.item.inventory.ContainerMixin_ItemStackLike", + "itemstacklike.item.inventory.EquipableMixin_ItemStackLike", + "itemstacklike.item.inventory.InventoryMixin_ItemStackLike", + "itemstacklike.item.inventory.SlotMixin_ItemStackLike", + "itemstacklike.item.inventory.equipment.EquipmentInventoryMixin_ItemStackLike", + "itemstacklike.item.inventory.slot.FilteringSlotMixin_ItemStackLike", + "itemstacklike.item.inventory.slot.SidedSlotMixin_ItemStackLike", + "itemstacklike.item.inventory.transaction.InventoryTransactionResult_BuilderMixin_ItemStackLike", + "itemstacklike.item.inventory.transaction.SlotTransactionMixin_ItemStackLike", + "itemstacklike.item.inventory.type.GridInventoryMixin_ItemStackLike", + "itemstacklike.item.inventory.type.Inventory2DMixin_ItemStackLike", + "itemstacklike.item.inventory.type.ViewableInventory_Builder_DummyStepMixin_ItemStackLike", + "itemstacklike.item.merchant.TradeOffer_BuilderMixin_ItemStackLike", + "itemstacklike.item.recipe.RecipeManagerMixin_ItemStackLike", + "itemstacklike.item.recipe.cooking.CookingRecipe_Builder_ResultStepMixin_ItemStackLike", + "itemstacklike.item.recipe.cooking.CookingRecipeMixin_ItemStackLike", + "itemstacklike.item.recipe.crafting.Ingredient_BuilderMixin_ItemStackLike", + "itemstacklike.item.recipe.crafting.IngredientMixin_ItemStackLike", + "itemstacklike.item.recipe.crafting.RecipeInput_FactoryMixin_ItemStackLike", + "itemstacklike.item.recipe.crafting.ShapedCraftingRecipe_Builder_ResultStepMixin_ItemStackLike", + "itemstacklike.item.recipe.crafting.ShapelessCraftingRecipe_Builder_ResultStepMixin_ItemStackLike", + "itemstacklike.item.recipe.crafting.SpecialCraftingRecipe_Builder_ResultStepMixin_ItemStackLike", + "itemstacklike.item.recipe.single.StoneCutterRecipe_Builder_ResultStepMixin_ItemStackLike", + "itemstacklike.item.recipe.smithing.SmithingRecipe_Builder_ResultStepMixin_ItemStackLike", "minecraft.advancements.AdvancementMixin_API", "minecraft.advancements.AdvancementNodeMixin_API", "minecraft.advancements.AdvancementProgressMixin_API", @@ -177,8 +206,8 @@ "minecraft.world.entity.animal.WaterAnimalMixin_API", "minecraft.world.entity.animal.WolfMixin_API", "minecraft.world.entity.animal.allay.AllayMixin_API", - "minecraft.world.entity.animal.axolotl.AxolotlMixin_API", "minecraft.world.entity.animal.armadillo.ArmadilloMixin_API", + "minecraft.world.entity.animal.axolotl.AxolotlMixin_API", "minecraft.world.entity.animal.camel.CamelMixin_API", "minecraft.world.entity.animal.frog.FrogMixin_API", "minecraft.world.entity.animal.frog.TadpoleMixin_API", @@ -272,7 +301,6 @@ "minecraft.world.entity.projectile.AbstractArrow_PickupMixin_API", "minecraft.world.entity.projectile.AbstractArrowMixin_API", "minecraft.world.entity.projectile.AbstractHurtingProjectileMixin_API", - "minecraft.world.entity.projectile.windcharge.AbstractWindChargeMixin_API", "minecraft.world.entity.projectile.ArrowMixin_API", "minecraft.world.entity.projectile.DragonFireballMixin_API", "minecraft.world.entity.projectile.EvokerFangsMixin_API", @@ -296,6 +324,7 @@ "minecraft.world.entity.projectile.ThrownPotionMixin_API", "minecraft.world.entity.projectile.ThrownTridentMixin_API", "minecraft.world.entity.projectile.WitherSkullMixin_API", + "minecraft.world.entity.projectile.windcharge.AbstractWindChargeMixin_API", "minecraft.world.entity.projectile.windcharge.BreezeWindChargeMixin_API", "minecraft.world.entity.projectile.windcharge.WindChargeMixin_API", "minecraft.world.entity.raid.Raid_RaidStatusMixin_API", From 012edf9d59b2d2cf0110e1be7f957279ac5ec077 Mon Sep 17 00:00:00 2001 From: MrHell228 Date: Thu, 10 Oct 2024 00:18:22 +0300 Subject: [PATCH 2/4] Fix ingredient api mixin --- .../minecraft/world/item/crafting/IngredientMixin_API.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/item/crafting/IngredientMixin_API.java b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/item/crafting/IngredientMixin_API.java index b9b54a45b56..34d48fb56a0 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/item/crafting/IngredientMixin_API.java +++ b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/item/crafting/IngredientMixin_API.java @@ -27,6 +27,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import org.checkerframework.checker.nullness.qual.Nullable; +import org.spongepowered.api.item.inventory.ItemStackLike; import org.spongepowered.asm.mixin.Implements; import org.spongepowered.asm.mixin.Interface; import org.spongepowered.asm.mixin.Interface.Remap; @@ -52,8 +53,8 @@ public abstract class IngredientMixin_API { return Arrays.stream(this.shadow$getItems()).map(ItemStackUtil::snapshotOf).collect(Collectors.toList()); } - public boolean ingredient$test(final org.spongepowered.api.item.inventory.ItemStack itemStack) { - return this.shadow$test(ItemStackUtil.toNative(itemStack)); + public boolean ingredient$test(final ItemStackLike itemStack) { + return this.shadow$test(ItemStackUtil.fromLikeToNative(itemStack)); } } From f88ba5c673a9695519ef72da6956c21487458013 Mon Sep 17 00:00:00 2001 From: aromaa Date: Sat, 12 Oct 2024 18:24:09 +0300 Subject: [PATCH 3/4] Bump API --- SpongeAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpongeAPI b/SpongeAPI index 0f54724976d..723d5c2f6bf 160000 --- a/SpongeAPI +++ b/SpongeAPI @@ -1 +1 @@ -Subproject commit 0f54724976df35166a06b8f7bbf3a9b808f81c49 +Subproject commit 723d5c2f6bf5eeb834980da725d43610790b33d5 From e2d18a4b4e9f8d2ccbe2f50b8d439ebae3d916d9 Mon Sep 17 00:00:00 2001 From: aromaa Date: Sat, 12 Oct 2024 18:35:32 +0300 Subject: [PATCH 4/4] Bump API --- SpongeAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpongeAPI b/SpongeAPI index 723d5c2f6bf..196f5d5d701 160000 --- a/SpongeAPI +++ b/SpongeAPI @@ -1 +1 @@ -Subproject commit 723d5c2f6bf5eeb834980da725d43610790b33d5 +Subproject commit 196f5d5d701555a3a5e7d27bf1a877dc18360a70