Class CrafterBlockEntity
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.CrafterBlockEntity
- All Implemented Interfaces:
Clearable,Container,CraftingContainer,MenuConstructor,StackedContentsCompatible,MenuProvider,Nameable,RandomizableContainer,IAttachmentHolder,IMenuProviderExtension,IBlockEntityExtension
public class CrafterBlockEntity
extends RandomizableContainerBlockEntity
implements CraftingContainer
-
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 TypeFieldDescriptionstatic final intstatic final intstatic final intprotected final ContainerDataprivate intstatic final intprivate NonNullList<ItemStack> static final intstatic final intstatic final intFields 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 TypeMethodDescriptionprivate voidprivate voidaddTriggered(CompoundTag tag) booleancanPlaceItem(int slot, ItemStack stack) Returnstrueif automation is allowed to insert the given stack (ignoring stack size) into the given slot.protected AbstractContainerMenucreateMenu(int containerId, Inventory inventory) voidfillStackedContents(StackedContents contents) intprotected ComponentintgetItem(int index) Returns the stack in the given slot.getItems()intintgetWidth()booleanisEmpty()booleanisSlotDisabled(int slot) booleanprotected voidloadAdditional(CompoundTag tag, HolderLookup.Provider registries) protected voidsaveAdditional(CompoundTag tag, HolderLookup.Provider registries) static voidserverTick(Level level, BlockPos pos, BlockState state, CrafterBlockEntity crafter) voidsetCraftingTicksRemaining(int craftingTicksRemaining) voidSets the given item stack to the specified slot in the inventory (can be crafting or armor sections).protected voidsetItems(NonNullList<ItemStack> items) voidsetSlotState(int slot, boolean state) voidsetTriggered(boolean triggered) private booleanslotCanBeDisabled(int slot) private booleansmallerStackExist(int currentSize, ItemStack stack, int slot) booleanstillValid(Player player) Don't rename this method to canInteractWith due to conflicts with ContainerMethods inherited from class net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity
applyImplicitComponents, canOpen, collectImplicitComponents, createMenu, getLootTable, getLootTableSeed, removeComponentsFromTag, removeItem, removeItemNoUpdate, setLootTable, setLootTableSeedMethods inherited from class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
canUnlock, clearContent, getCustomName, getDisplayName, getNameMethods 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, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, 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
canTakeItem, countItem, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, removeItem, removeItemNoUpdate, setChanged, startOpen, stopOpenMethods inherited from interface net.minecraft.world.inventory.CraftingContainer
asCraftInput, asPositionedCraftInputMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, 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
shouldTriggerClientSideContainerClosingOnOpen, writeClientSideDataMethods inherited from interface net.minecraft.world.Nameable
hasCustomNameMethods inherited from interface net.minecraft.world.RandomizableContainer
getBlockPos, getLevel, setLootTable, tryLoadLootTable, trySaveLootTable, unpackLootTable
-
Field Details
-
CONTAINER_WIDTH
public static final int CONTAINER_WIDTH- See Also:
-
CONTAINER_HEIGHT
public static final int CONTAINER_HEIGHT- See Also:
-
CONTAINER_SIZE
public static final int CONTAINER_SIZE- See Also:
-
SLOT_DISABLED
public static final int SLOT_DISABLED- See Also:
-
SLOT_ENABLED
public static final int SLOT_ENABLED- See Also:
-
DATA_TRIGGERED
public static final int DATA_TRIGGERED- See Also:
-
NUM_DATA
public static final int NUM_DATA- See Also:
-
items
-
craftingTicksRemaining
private int craftingTicksRemaining -
containerData
-
-
Constructor Details
-
CrafterBlockEntity
-
-
Method Details
-
getDefaultName
- Specified by:
getDefaultNamein classBaseContainerBlockEntity
-
createMenu
- Specified by:
createMenuin classBaseContainerBlockEntity
-
setSlotState
public void setSlotState(int slot, boolean state) -
isSlotDisabled
public boolean isSlotDisabled(int slot) -
canPlaceItem
Returnstrueif automation is allowed to insert the given stack (ignoring stack size) into the given slot. For guis use Slot.isItemValid- Specified by:
canPlaceItemin interfaceContainer
-
smallerStackExist
-
loadAdditional
- Overrides:
loadAdditionalin classBaseContainerBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBaseContainerBlockEntity
-
getContainerSize
public int getContainerSize()- Specified by:
getContainerSizein interfaceContainer
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceContainer- Overrides:
isEmptyin classRandomizableContainerBlockEntity
-
getItem
Description copied from class:RandomizableContainerBlockEntityReturns the stack in the given slot.- Specified by:
getItemin interfaceContainer- Overrides:
getItemin classRandomizableContainerBlockEntity
-
setItem
Description copied from class:RandomizableContainerBlockEntitySets the given item stack to the specified slot in the inventory (can be crafting or armor sections).- Specified by:
setItemin interfaceContainer- Overrides:
setItemin classRandomizableContainerBlockEntity
-
stillValid
Don't rename this method to canInteractWith due to conflicts with Container- Specified by:
stillValidin interfaceContainer- Overrides:
stillValidin classBaseContainerBlockEntity
-
getItems
- Specified by:
getItemsin interfaceCraftingContainer- Specified by:
getItemsin classBaseContainerBlockEntity
-
setItems
- Specified by:
setItemsin classBaseContainerBlockEntity
-
getWidth
public int getWidth()- Specified by:
getWidthin interfaceCraftingContainer
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceCraftingContainer
-
fillStackedContents
- Specified by:
fillStackedContentsin interfaceStackedContentsCompatible
-
addDisabledSlots
-
addTriggered
-
setTriggered
public void setTriggered(boolean triggered) -
isTriggered
public boolean isTriggered() -
serverTick
public static void serverTick(Level level, BlockPos pos, BlockState state, CrafterBlockEntity crafter) -
setCraftingTicksRemaining
public void setCraftingTicksRemaining(int craftingTicksRemaining) -
getRedstoneSignal
public int getRedstoneSignal() -
slotCanBeDisabled
private boolean slotCanBeDisabled(int slot)
-