public class ValidatedSlot
extends net.minecraft.screen.slot.Slot
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.collect.Multimap<WItemSlot,WItemSlot.ChangeListener> |
listeners |
| Constructor and Description |
|---|
ValidatedSlot(net.minecraft.inventory.Inventory inventory,
int index,
int x,
int y) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(WItemSlot owner,
WItemSlot.ChangeListener listener)
Adds a change listener to this slot.
|
boolean |
canInsert(net.minecraft.item.ItemStack stack) |
boolean |
canTakeItems(net.minecraft.entity.player.PlayerEntity player) |
java.util.function.Predicate<net.minecraft.item.ItemStack> |
getFilter()
Gets the item stack filter of this slot.
|
int |
getInventoryIndex()
Gets the index of this slot in its inventory.
|
net.minecraft.item.ItemStack |
getStack() |
boolean |
isInsertingAllowed()
Returns whether items can be inserted into this slot.
|
boolean |
isTakingAllowed()
Returns whether items can be taken from this slot.
|
boolean |
isVisible()
Tests whether this slot is visible.
|
void |
markDirty() |
void |
setFilter(java.util.function.Predicate<net.minecraft.item.ItemStack> filter)
Sets the item stack filter of this slot.
|
void |
setInsertingAllowed(boolean insertingAllowed)
Sets whether inserting items into this slot is allowed.
|
void |
setTakingAllowed(boolean takingAllowed)
Sets whether taking items from this slot is allowed.
|
void |
setVisible(boolean visible)
Sets whether this slot is visible.
|
canTakePartial, doDrawHoveringEffect, getBackgroundSprite, getIndex, getMaxItemCount, getMaxItemCount, hasStack, insertStack, insertStack, onCrafted, onCrafted, onStackChanged, onTake, onTakeItem, setStack, takeStack, takeStackRange, tryTakeStackRangeprotected final com.google.common.collect.Multimap<WItemSlot,WItemSlot.ChangeListener> listeners
public ValidatedSlot(net.minecraft.inventory.Inventory inventory,
int index,
int x,
int y)
public boolean canInsert(net.minecraft.item.ItemStack stack)
canInsert in class net.minecraft.screen.slot.Slotpublic boolean canTakeItems(net.minecraft.entity.player.PlayerEntity player)
canTakeItems in class net.minecraft.screen.slot.Slotpublic net.minecraft.item.ItemStack getStack()
getStack in class net.minecraft.screen.slot.Slotpublic void markDirty()
markDirty in class net.minecraft.screen.slot.Slotpublic int getInventoryIndex()
public boolean isInsertingAllowed()
public void setInsertingAllowed(boolean insertingAllowed)
insertingAllowed - true if items can be inserted, false otherwisepublic boolean isTakingAllowed()
public void setTakingAllowed(boolean takingAllowed)
takingAllowed - true if items can be taken, false otherwisepublic java.util.function.Predicate<net.minecraft.item.ItemStack> getFilter()
public void setFilter(java.util.function.Predicate<net.minecraft.item.ItemStack> filter)
filter - the new item filterpublic void addChangeListener(WItemSlot owner, WItemSlot.ChangeListener listener)
owner - the owner of this slotlistener - the listenerjava.lang.NullPointerException - if either parameter is nullpublic boolean isVisible()
public void setVisible(boolean visible)
visible - true if this slot if visible, false otherwise