Package net.minecraft.inventory
Class CraftingInventory
java.lang.Object
net.minecraft.inventory.CraftingInventory
- All Implemented Interfaces:
Inventory
,RecipeInputProvider
,Clearable
public class CraftingInventory extends Object implements Inventory, RecipeInputProvider
-
Field Summary
Fields Modifier and Type Field Description private ScreenHandler
handler
private int
height
private DefaultedList<ItemStack>
stacks
private int
width
-
Constructor Summary
Constructors Constructor Description CraftingInventory(ScreenHandler handler, int width, int height)
-
Method Summary
Modifier and Type Method Description boolean
canPlayerUse(PlayerEntity player)
void
clear()
int
getHeight()
ItemStack
getStack(int slot)
Fetches the stack currently stored at the given slot.int
getWidth()
boolean
isEmpty()
void
markDirty()
void
provideRecipeInputs(RecipeFinder finder)
ItemStack
removeStack(int slot)
Removes the stack currently stored at the indicated slot.ItemStack
removeStack(int slot, int amount)
Removes a specific number of items from the given slot.void
setStack(int slot, ItemStack stack)
int
size()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.inventory.Inventory
containsAny, count, getMaxCountPerStack, isValid, onClose, onOpen
-
Field Details
-
stacks
-
width
private final int width -
height
private final int height -
handler
-
-
Constructor Details
-
CraftingInventory
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
getStack
Fetches the stack currently stored at the given slot. If the slot is empty, or is outside the bounds of this inventory, returns seeItemStack.EMPTY
. -
removeStack
Removes the stack currently stored at the indicated slot.- Specified by:
removeStack
in interfaceInventory
- Returns:
- the stack previously stored at the indicated slot.
-
removeStack
Removes a specific number of items from the given slot.- Specified by:
removeStack
in interfaceInventory
- Returns:
- the removed items as a stack
-
setStack
-
markDirty
public void markDirty() -
canPlayerUse
- Specified by:
canPlayerUse
in interfaceInventory
-
clear
public void clear() -
getHeight
public int getHeight() -
getWidth
public int getWidth() -
provideRecipeInputs
- Specified by:
provideRecipeInputs
in interfaceRecipeInputProvider
-