Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move deprecated ItemStackLike related methods to Common #4136

Merged
merged 4 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SpongeAPI
Submodule SpongeAPI updated 27 files
+0 −16 src/main/java/org/spongepowered/api/advancement/DisplayInfo.java
+0 −9 src/main/java/org/spongepowered/api/block/entity/Jukebox.java
+0 −16 src/main/java/org/spongepowered/api/event/cause/entity/damage/DamageModifier.java
+0 −17 src/main/java/org/spongepowered/api/item/enchantment/EnchantmentType.java
+0 −48 src/main/java/org/spongepowered/api/item/inventory/ArmorEquipable.java
+0 −8 src/main/java/org/spongepowered/api/item/inventory/Container.java
+0 −32 src/main/java/org/spongepowered/api/item/inventory/Equipable.java
+0 −48 src/main/java/org/spongepowered/api/item/inventory/Inventory.java
+0 −8 src/main/java/org/spongepowered/api/item/inventory/Slot.java
+0 −16 src/main/java/org/spongepowered/api/item/inventory/equipment/EquipmentInventory.java
+0 −9 src/main/java/org/spongepowered/api/item/inventory/slot/FilteringSlot.java
+0 −25 src/main/java/org/spongepowered/api/item/inventory/slot/SidedSlot.java
+0 −16 src/main/java/org/spongepowered/api/item/inventory/transaction/InventoryTransactionResult.java
+0 −9 src/main/java/org/spongepowered/api/item/inventory/transaction/SlotTransaction.java
+0 −8 src/main/java/org/spongepowered/api/item/inventory/type/GridInventory.java
+0 −8 src/main/java/org/spongepowered/api/item/inventory/type/Inventory2D.java
+0 −9 src/main/java/org/spongepowered/api/item/inventory/type/ViewableInventory.java
+0 −25 src/main/java/org/spongepowered/api/item/merchant/TradeOffer.java
+0 −33 src/main/java/org/spongepowered/api/item/recipe/RecipeManager.java
+0 −42 src/main/java/org/spongepowered/api/item/recipe/cooking/CookingRecipe.java
+0 −33 src/main/java/org/spongepowered/api/item/recipe/crafting/Ingredient.java
+0 −16 src/main/java/org/spongepowered/api/item/recipe/crafting/RecipeInput.java
+0 −27 src/main/java/org/spongepowered/api/item/recipe/crafting/ShapedCraftingRecipe.java
+0 −26 src/main/java/org/spongepowered/api/item/recipe/crafting/ShapelessCraftingRecipe.java
+0 −9 src/main/java/org/spongepowered/api/item/recipe/crafting/SpecialCraftingRecipe.java
+0 −26 src/main/java/org/spongepowered/api/item/recipe/single/StoneCutterRecipe.java
+0 −26 src/main/java/org/spongepowered/api/item/recipe/smithing/SmithingRecipe.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.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<? extends HandType> handType, ItemStack itemInHand) {
((ArmorEquipable) this).setItemInHand(handType, itemInHand);
}

default void setItemInHand(HandType handType, ItemStack itemInHand) {
((ArmorEquipable) this).setItemInHand(handType, itemInHand);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.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<? extends EquipmentType> 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<? extends EquipmentType> type, ItemStack equipment) {
return ((Equipable) this).equip(type, equipment);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.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);
}
}
Loading