Package net.minecraft.item
Class ItemUsage
java.lang.Object
net.minecraft.item.ItemUsage
Utility methods related to item usage.
- Mappings:
Namespace Name named net/minecraft/item/ItemUsage
intermediary net/minecraft/class_5328
official cus
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TypedActionResult
<ItemStack> consumeHeldItem
(World world, PlayerEntity player, Hand hand) Consumes the item thatplayer
holds.static ItemStack
exchangeStack
(ItemStack inputStack, PlayerEntity player, ItemStack outputStack) Returns the stack to put in the player's hand after exchanging stacks.static ItemStack
exchangeStack
(ItemStack inputStack, PlayerEntity player, ItemStack outputStack, boolean creativeOverride) Returns the stack to put in the player's hand after exchanging stacks.static void
spawnItemContents
(ItemEntity itemEntity, Iterable<ItemStack> contents) Spawns item entity's contents at the item entity's position.
-
Constructor Details
-
ItemUsage
public ItemUsage()
-
-
Method Details
-
consumeHeldItem
public static TypedActionResult<ItemStack> consumeHeldItem(World world, PlayerEntity player, Hand hand) Consumes the item thatplayer
holds. This should be called insideItem.use(net.minecraft.world.World, net.minecraft.entity.player.PlayerEntity, net.minecraft.util.Hand)
for consumable items, such as milk bucket.- Returns:
- the action result of consuming
- Mappings:
Namespace Name Mixin selector named consumeHeldItem
Lnet/minecraft/item/ItemUsage;consumeHeldItem(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/TypedActionResult;
intermediary method_29282
Lnet/minecraft/class_5328;method_29282(Lnet/minecraft/class_1937;Lnet/minecraft/class_1657;Lnet/minecraft/class_1268;)Lnet/minecraft/class_1271;
official a
Lcus;a(Ldcw;Lcmx;Lbqq;)Lbqs;
-
exchangeStack
public static ItemStack exchangeStack(ItemStack inputStack, PlayerEntity player, ItemStack outputStack, boolean creativeOverride) Returns the stack to put in the player's hand after exchanging stacks.Exchanging stacks causes the input stack to be decremented and the output stack to be inserted to the player's inventory (or dropped if it cannot be inserted.) For example, milking a cow exchanges one empty bucket and one milk bucket. If
creativeOverride
istrue
and the player is in creative mode, the player only receives the new stack when they do not have the output stack.- Returns:
- the stack to put in the player's hand after exchanging stacks
- See Also:
- Mappings:
Namespace Name Mixin selector named exchangeStack
Lnet/minecraft/item/ItemUsage;exchangeStack(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;Z)Lnet/minecraft/item/ItemStack;
intermediary method_30270
Lnet/minecraft/class_5328;method_30270(Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;Z)Lnet/minecraft/class_1799;
official a
Lcus;a(Lcuq;Lcmx;Lcuq;Z)Lcuq;
-
exchangeStack
public static ItemStack exchangeStack(ItemStack inputStack, PlayerEntity player, ItemStack outputStack) Returns the stack to put in the player's hand after exchanging stacks.Exchanging stacks causes the input stack to be decremented and the output stack to be inserted to the player's inventory (or dropped if it cannot be inserted.) For example, milking a cow exchanges one empty bucket and one milk bucket. If the player is in creative mode, the player only receives the new stack when they do not have the output stack.
- Returns:
- the stack to put in the player's hand after exchanging stacks
- See Also:
- Mappings:
Namespace Name Mixin selector named exchangeStack
Lnet/minecraft/item/ItemUsage;exchangeStack(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;
intermediary method_30012
Lnet/minecraft/class_5328;method_30012(Lnet/minecraft/class_1799;Lnet/minecraft/class_1657;Lnet/minecraft/class_1799;)Lnet/minecraft/class_1799;
official a
Lcus;a(Lcuq;Lcmx;Lcuq;)Lcuq;
-
spawnItemContents
Spawns item entity's contents at the item entity's position. This should be called insideItem.onItemEntityDestroyed(net.minecraft.entity.ItemEntity)
for items that hold other items, such as shulker boxes.- See Also:
- Mappings:
Namespace Name Mixin selector named spawnItemContents
Lnet/minecraft/item/ItemUsage;spawnItemContents(Lnet/minecraft/entity/ItemEntity;Ljava/lang/Iterable;)V
intermediary method_33263
Lnet/minecraft/class_5328;method_33263(Lnet/minecraft/class_1542;Ljava/lang/Iterable;)V
official a
Lcus;a(Lcjh;Ljava/lang/Iterable;)V
-