public class HopperBlockEntity extends LootableContainerBlockEntity implements Hopper, Tickable
| Modifier and Type | Field and Description |
|---|---|
private DefaultedList<ItemStack> |
inventory |
private long |
lastTickTime |
private int |
transferCooldown |
lootTableId, lootTableSeedpos, removed, worldABOVE_SHAPE, INPUT_AREA_SHAPE, INSIDE_SHAPE| Constructor and Description |
|---|
HopperBlockEntity() |
| Modifier and Type | Method and Description |
|---|---|
private static boolean |
canExtract(Inventory inv,
ItemStack stack,
int slot,
Direction facing) |
private static boolean |
canInsert(Inventory inventory,
ItemStack stack,
int slot,
Direction side) |
private static boolean |
canMergeItems(ItemStack first,
ItemStack second) |
protected ScreenHandler |
createScreenHandler(int syncId,
PlayerInventory playerInventory) |
static boolean |
extract(Hopper hopper) |
private static boolean |
extract(Hopper hopper,
Inventory inventory,
int slot,
Direction side) |
static boolean |
extract(Inventory inventory,
ItemEntity itemEntity) |
void |
fromTag(BlockState state,
CompoundTag tag) |
private static IntStream |
getAvailableSlots(Inventory inventory,
Direction side) |
protected Text |
getContainerName() |
double |
getHopperX() |
double |
getHopperY() |
double |
getHopperZ() |
static Inventory |
getInputInventory(Hopper hopper) |
static List<ItemEntity> |
getInputItemEntities(Hopper hopper) |
static Inventory |
getInventoryAt(World world,
BlockPos blockPos) |
static Inventory |
getInventoryAt(World world,
double x,
double y,
double z) |
protected DefaultedList<ItemStack> |
getInvStackList() |
private Inventory |
getOutputInventory() |
private boolean |
insert() |
private boolean |
insertAndExtract(Supplier<Boolean> extractMethod) |
private boolean |
isDisabled() |
private boolean |
isFull() |
private static boolean |
isInventoryEmpty(Inventory inv,
Direction facing) |
private boolean |
isInventoryFull(Inventory inv,
Direction direction) |
private boolean |
needsCooldown() |
void |
onEntityCollided(Entity entity) |
ItemStack |
removeStack(int slot,
int amount)
Removes a specific number of items from the given slot.
|
private void |
setCooldown(int cooldown) |
protected void |
setInvStackList(DefaultedList<ItemStack> list) |
void |
setStack(int slot,
ItemStack stack) |
int |
size() |
void |
tick() |
CompoundTag |
toTag(CompoundTag tag) |
static ItemStack |
transfer(Inventory from,
Inventory to,
ItemStack stack,
Direction side) |
private static ItemStack |
transfer(Inventory from,
Inventory to,
ItemStack stack,
int slot,
Direction direction) |
canPlayerUse, checkLootInteraction, checkUnlocked, clear, createMenu, deserializeLootTable, getStack, isEmpty, removeStack, serializeLootTable, setLootTable, setLootTablecheckUnlocked, getCustomName, getDisplayName, getName, setCustomNameapplyMirror, applyRotation, cancelRemoval, copyItemDataRequiresOperator, createFromTag, getCachedState, getPos, getSquaredRenderDistance, getType, getWorld, hasWorld, isRemoved, markDirty, markInvalid, markRemoved, onSyncedBlockEvent, populateCrashReport, resetBlock, setLocation, setPos, toInitialChunkDataTag, toUpdatePacketclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetInputAreaShape, getWorldcanPlayerUse, containsAny, count, getMaxCountPerStack, getStack, isEmpty, isValid, markDirty, onClose, onOpen, removeStackhasCustomNameprivate DefaultedList<ItemStack> inventory
private int transferCooldown
private long lastTickTime
public void fromTag(BlockState state, CompoundTag tag)
fromTag in class LockableContainerBlockEntitypublic CompoundTag toTag(CompoundTag tag)
toTag in class LockableContainerBlockEntitypublic ItemStack removeStack(int slot, int amount)
removeStack in interface InventoryremoveStack in class LootableContainerBlockEntitypublic void setStack(int slot,
ItemStack stack)
setStack in interface InventorysetStack in class LootableContainerBlockEntityprotected Text getContainerName()
getContainerName in class LockableContainerBlockEntityprivate boolean isFull()
private boolean insert()
public static boolean extract(Hopper hopper)
private static boolean extract(Hopper hopper, Inventory inventory, int slot, Direction side)
public static boolean extract(Inventory inventory, ItemEntity itemEntity)
public static ItemStack transfer(@Nullable Inventory from, Inventory to, ItemStack stack, @Nullable Direction side)
private static boolean canInsert(Inventory inventory, ItemStack stack, int slot, @Nullable Direction side)
private static boolean canExtract(Inventory inv, ItemStack stack, int slot, Direction facing)
private static ItemStack transfer(@Nullable Inventory from, Inventory to, ItemStack stack, int slot, @Nullable Direction direction)
public static List<ItemEntity> getInputItemEntities(Hopper hopper)
@Nullable public static Inventory getInventoryAt(World world, double x, double y, double z)
public double getHopperX()
getHopperX in interface Hopperpublic double getHopperY()
getHopperY in interface Hopperpublic double getHopperZ()
getHopperZ in interface Hopperprivate void setCooldown(int cooldown)
private boolean needsCooldown()
private boolean isDisabled()
protected DefaultedList<ItemStack> getInvStackList()
getInvStackList in class LootableContainerBlockEntityprotected void setInvStackList(DefaultedList<ItemStack> list)
setInvStackList in class LootableContainerBlockEntitypublic void onEntityCollided(Entity entity)
protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory)
createScreenHandler in class LockableContainerBlockEntity