public abstract class Container
extends java.lang.Object
修飾子とタイプ | フィールドと説明 |
---|---|
java.util.List<Slot> |
inventorySlots |
int |
windowId |
修飾子 | コンストラクタと説明 |
---|---|
protected |
Container(ContainerType<?> type,
int id) |
修飾子とタイプ | メソッドと説明 |
---|---|
void |
addListener(IContainerListener listener) |
protected Slot |
addSlot(Slot slotIn)
Adds an item slot to this container
|
static boolean |
areItemsAndTagsEqual(ItemStack stack1,
ItemStack stack2) |
protected static void |
assertIntArraySize(IIntArray intArrayIn,
int minSize) |
protected static void |
assertInventorySize(IInventory inventoryIn,
int minSize) |
static int |
calcRedstone(TileEntity te)
Like the version that takes an inventory.
|
static int |
calcRedstoneFromInventory(IInventory inv) |
static boolean |
canAddItemToSlot(Slot slotIn,
ItemStack stack,
boolean stackSizeMatters)
Checks if it's possible to add the given itemstack to the given slot.
|
boolean |
canDragIntoSlot(Slot slotIn)
Returns true if the player can "drag-spilt" items into this slot,. returns true by default.
|
abstract boolean |
canInteractWith(PlayerEntity playerIn)
Determines whether supplied player can use this container
|
boolean |
canMergeSlot(ItemStack stack,
Slot slotIn)
Called to determine if the current slot is valid for the stack merging (double-click) code.
|
protected void |
clearContainer(PlayerEntity playerIn,
World worldIn,
IInventory inventoryIn) |
static void |
computeStackSize(java.util.Set<Slot> dragSlotsIn,
int dragModeIn,
ItemStack stack,
int slotStackSize)
Compute the new stack size, Returns the stack with the new size.
|
void |
detectAndSendChanges()
Looks for changes made in the container, sends them to every listener.
|
boolean |
enchantItem(PlayerEntity playerIn,
int id)
Handles the given Button-click on the server, currently only used by enchanting.
|
static int |
extractDragMode(int eventButton)
Extracts the drag mode.
|
boolean |
getCanCraft(PlayerEntity player)
gets whether or not the player can craft in this inventory or not
|
static int |
getDragEvent(int clickedButton)
Args : clickedButton, Returns (0 : start drag, 1 : add slot, 2 : end drag)
|
NonNullList<ItemStack> |
getInventory()
returns a list if itemStacks, for each slot.
|
short |
getNextTransactionID(PlayerInventory invPlayer)
Gets a unique transaction ID.
|
static int |
getQuickcraftMask(int p_94534_0_,
int p_94534_1_) |
Slot |
getSlot(int slotId) |
ContainerType<?> |
getType() |
static boolean |
isValidDragMode(int dragModeIn,
PlayerEntity player) |
protected static boolean |
isWithinUsableDistance(IWorldPosCallable worldPos,
PlayerEntity playerIn,
Block targetBlock) |
protected boolean |
mergeItemStack(ItemStack stack,
int startIndex,
int endIndex,
boolean reverseDirection)
Merges provided ItemStack with the first avaliable one in the container/player inventor between minIndex
(included) and maxIndex (excluded).
|
void |
onContainerClosed(PlayerEntity playerIn)
Called when the container is closed.
|
void |
onCraftMatrixChanged(IInventory inventoryIn)
Callback for when the crafting matrix is changed.
|
void |
putStackInSlot(int slotID,
ItemStack stack)
Puts an ItemStack in a slot.
|
void |
removeListener(IContainerListener listener)
Remove the given Listener.
|
protected void |
resetDrag()
Reset the drag fields
|
void |
setAll(java.util.List<ItemStack> p_190896_1_) |
void |
setCanCraft(PlayerEntity player,
boolean canCraft)
sets whether the player can craft in this inventory or not
|
ItemStack |
slotClick(int slotId,
int dragType,
ClickType clickTypeIn,
PlayerEntity player) |
protected IntReferenceHolder |
trackInt(IntReferenceHolder intIn) |
protected void |
trackIntArray(IIntArray arrayIn) |
ItemStack |
transferStackInSlot(PlayerEntity playerIn,
int index)
Handle when the stack in slot
index is shift-clicked. |
void |
updateProgressBar(int id,
int data) |
public final java.util.List<Slot> inventorySlots
public final int windowId
protected Container(@Nullable ContainerType<?> type, int id)
protected static boolean isWithinUsableDistance(IWorldPosCallable worldPos, PlayerEntity playerIn, Block targetBlock)
public ContainerType<?> getType()
protected static void assertInventorySize(IInventory inventoryIn, int minSize)
protected static void assertIntArraySize(IIntArray intArrayIn, int minSize)
protected IntReferenceHolder trackInt(IntReferenceHolder intIn)
protected void trackIntArray(IIntArray arrayIn)
public void addListener(IContainerListener listener)
public void removeListener(IContainerListener listener)
public NonNullList<ItemStack> getInventory()
public void detectAndSendChanges()
public boolean enchantItem(PlayerEntity playerIn, int id)
public Slot getSlot(int slotId)
public ItemStack transferStackInSlot(PlayerEntity playerIn, int index)
index
is shift-clicked. Normally this moves the stack between the player
inventory and the other inventory(s).public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player)
public boolean canMergeSlot(ItemStack stack, Slot slotIn)
public void onContainerClosed(PlayerEntity playerIn)
protected void clearContainer(PlayerEntity playerIn, World worldIn, IInventory inventoryIn)
public void onCraftMatrixChanged(IInventory inventoryIn)
public void putStackInSlot(int slotID, ItemStack stack)
public void setAll(java.util.List<ItemStack> p_190896_1_)
public void updateProgressBar(int id, int data)
public short getNextTransactionID(PlayerInventory invPlayer)
public boolean getCanCraft(PlayerEntity player)
public void setCanCraft(PlayerEntity player, boolean canCraft)
public abstract boolean canInteractWith(PlayerEntity playerIn)
protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection)
public static int extractDragMode(int eventButton)
public static int getDragEvent(int clickedButton)
public static int getQuickcraftMask(int p_94534_0_, int p_94534_1_)
public static boolean isValidDragMode(int dragModeIn, PlayerEntity player)
protected void resetDrag()
public static boolean canAddItemToSlot(@Nullable Slot slotIn, ItemStack stack, boolean stackSizeMatters)
public static void computeStackSize(java.util.Set<Slot> dragSlotsIn, int dragModeIn, ItemStack stack, int slotStackSize)
public boolean canDragIntoSlot(Slot slotIn)
public static int calcRedstone(@Nullable TileEntity te)
public static int calcRedstoneFromInventory(@Nullable IInventory inv)