Class HopperBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BaseContainerBlockEntity
net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity
net.minecraft.world.level.block.entity.HopperBlockEntity
- All Implemented Interfaces:
Clearable,Container,MenuConstructor,Hopper,MenuProvider,Nameable,RandomizableContainer,IAttachmentHolder,IMenuProviderExtension,IBlockEntityExtension
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
BlockEntity.ComponentHelper, BlockEntity.DataComponentInputNested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int[][]private intprivate Directionstatic final intprivate NonNullList<ItemStack> static final intprivate longFields inherited from class net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity
lootTable, lootTableSeedFields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFERFields inherited from interface net.minecraft.world.RandomizableContainer
LOOT_TABLE_SEED_TAG, LOOT_TABLE_TAG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ItemStackstatic booleanaddItem(Container p_59332_, ItemEntity p_59333_) private static booleancanMergeItems(ItemStack p_59345_, ItemStack p_59346_) private static booleancanPlaceItemInContainer(Container p_59335_, ItemStack p_59336_, int p_59337_, Direction p_59338_) private static booleancanTakeItemFromContainer(Container p_273433_, Container p_273542_, ItemStack p_273400_, int p_273519_, Direction p_273088_) private static int[]createFlatSlots(int p_326328_) protected AbstractContainerMenucreateMenu(int p_59312_, Inventory p_59313_) private static booleanejectItems(Level p_155563_, BlockPos p_155564_, HopperBlockEntity p_326256_) static voidentityInside(Level p_155568_, BlockPos p_155569_, BlockState p_155570_, Entity p_155571_, HopperBlockEntity p_155572_) private static ContainergetAttachedContainer(Level p_155593_, BlockPos p_155594_, HopperBlockEntity p_326320_) private static ContainergetBlockContainer(Level p_326127_, BlockPos p_326017_, BlockState p_326108_) static ContainergetContainerAt(Level p_59391_, BlockPos p_59392_) private static ContainergetContainerAt(Level p_59348_, BlockPos p_326114_, BlockState p_326445_, double p_59349_, double p_59350_, double p_59351_) intprotected Componentprivate static ContainergetEntityContainer(Level p_326325_, double p_326012_, double p_326191_, double p_326289_) protected NonNullList<ItemStack> getItems()static List<ItemEntity> getItemsAtAndAbove(Level p_155590_, Hopper p_155591_) longdoubledoubledoubleprivate static int[]private static ContainergetSourceContainer(Level p_155597_, Hopper p_155598_, BlockPos p_326315_, BlockState p_326093_) private booleanprivate static booleanisFullContainer(Container p_59386_, Direction p_59387_) booleanprivate booleanbooleanprotected voidloadAdditional(CompoundTag p_155588_, HolderLookup.Provider p_324320_) static voidpushItemsTick(Level p_155574_, BlockPos p_155575_, BlockState p_155576_, HopperBlockEntity p_155577_) removeItem(int p_59309_, int p_59310_) protected voidsaveAdditional(CompoundTag p_187502_, HolderLookup.Provider p_324174_) voidsetBlockState(BlockState p_326468_) voidsetCooldown(int p_59396_) voidprotected voidsetItems(NonNullList<ItemStack> p_59371_) static booleansuckInItems(Level p_155553_, Hopper p_155554_) private static ItemStacktryMoveInItem(Container p_59321_, Container p_59322_, ItemStack p_59323_, int p_59324_, Direction p_59325_) private static booleantryMoveItems(Level p_155579_, BlockPos p_155580_, BlockState p_155581_, HopperBlockEntity p_155582_, BooleanSupplier p_155583_) private static booleantryTakeInItemFromSlot(Hopper p_59355_, Container p_59356_, int p_59357_, Direction p_59358_) Methods inherited from class net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity
applyImplicitComponents, canOpen, collectImplicitComponents, createMenu, getItem, getLootTable, getLootTableSeed, isEmpty, removeComponentsFromTag, removeItemNoUpdate, setLootTable, setLootTableSeedMethods inherited from class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
canUnlock, clearContent, getCustomName, getDisplayName, getName, stillValidMethods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, clearRemoved, collectComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingData, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.Clearable
clearContentMethods inherited from interface net.minecraft.world.Container
canPlaceItem, canTakeItem, countItem, getItem, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, isEmpty, removeItemNoUpdate, setChanged, startOpen, stillValid, stopOpenMethods inherited from interface net.minecraft.world.level.block.entity.Hopper
getSuckAabbMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, hasData, removeData, setDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface net.neoforged.neoforge.client.extensions.IMenuProviderExtension
shouldTriggerClientSideContainerClosingOnOpenMethods inherited from interface net.minecraft.world.Nameable
hasCustomNameMethods inherited from interface net.minecraft.world.RandomizableContainer
getBlockPos, getLevel, setLootTable, tryLoadLootTable, trySaveLootTable, unpackLootTable
-
Field Details
-
MOVE_ITEM_SPEED
public static final int MOVE_ITEM_SPEED- See Also:
-
HOPPER_CONTAINER_SIZE
public static final int HOPPER_CONTAINER_SIZE- See Also:
-
CACHED_SLOTS
private static final int[][] CACHED_SLOTS -
items
-
cooldownTime
private int cooldownTime -
tickedGameTime
private long tickedGameTime -
facing
-
-
Constructor Details
-
HopperBlockEntity
-
-
Method Details
-
loadAdditional
- Overrides:
loadAdditionalin classBaseContainerBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBaseContainerBlockEntity
-
getContainerSize
public int getContainerSize()- Specified by:
getContainerSizein interfaceContainer
-
removeItem
- Specified by:
removeItemin interfaceContainer- Overrides:
removeItemin classRandomizableContainerBlockEntity
-
setItem
- Specified by:
setItemin interfaceContainer- Overrides:
setItemin classRandomizableContainerBlockEntity
-
setBlockState
- Overrides:
setBlockStatein classBlockEntity
-
getDefaultName
- Specified by:
getDefaultNamein classBaseContainerBlockEntity
-
pushItemsTick
public static void pushItemsTick(Level p_155574_, BlockPos p_155575_, BlockState p_155576_, HopperBlockEntity p_155577_) -
tryMoveItems
private static boolean tryMoveItems(Level p_155579_, BlockPos p_155580_, BlockState p_155581_, HopperBlockEntity p_155582_, BooleanSupplier p_155583_) -
inventoryFull
private boolean inventoryFull() -
ejectItems
-
getSlots
-
createFlatSlots
private static int[] createFlatSlots(int p_326328_) -
isFullContainer
-
suckInItems
-
tryTakeInItemFromSlot
-
addItem
-
addItem
-
canPlaceItemInContainer
-
canTakeItemFromContainer
-
tryMoveInItem
-
getAttachedContainer
@Nullable private static Container getAttachedContainer(Level p_155593_, BlockPos p_155594_, HopperBlockEntity p_326320_) -
getSourceContainer
@Nullable private static Container getSourceContainer(Level p_155597_, Hopper p_155598_, BlockPos p_326315_, BlockState p_326093_) -
getItemsAtAndAbove
-
getContainerAt
-
getContainerAt
@Nullable private static Container getContainerAt(Level p_59348_, BlockPos p_326114_, BlockState p_326445_, double p_59349_, double p_59350_, double p_59351_) -
getBlockContainer
@Nullable private static Container getBlockContainer(Level p_326127_, BlockPos p_326017_, BlockState p_326108_) -
getEntityContainer
-
canMergeItems
-
getLevelX
public double getLevelX() -
getLevelY
public double getLevelY() -
getLevelZ
public double getLevelZ() -
isGridAligned
public boolean isGridAligned()- Specified by:
isGridAlignedin interfaceHopper
-
setCooldown
public void setCooldown(int p_59396_) -
isOnCooldown
private boolean isOnCooldown() -
isOnCustomCooldown
public boolean isOnCustomCooldown() -
getItems
- Specified by:
getItemsin classBaseContainerBlockEntity
-
setItems
- Specified by:
setItemsin classBaseContainerBlockEntity
-
entityInside
public static void entityInside(Level p_155568_, BlockPos p_155569_, BlockState p_155570_, Entity p_155571_, HopperBlockEntity p_155572_) -
createMenu
- Specified by:
createMenuin classBaseContainerBlockEntity
-
getLastUpdateTime
public long getLastUpdateTime()
-