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.DataComponentInput
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
protected final ContainerData
private int
static final int
private NonNullList
<ItemStack> static final int
static final int
static final int
Fields inherited from class net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity
lootTable, lootTableSeed
Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPosition
Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEY
Fields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFER
Fields inherited from interface net.minecraft.world.RandomizableContainer
LOOT_TABLE_SEED_TAG, LOOT_TABLE_TAG
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addDisabledSlots
(CompoundTag pTag) private void
addTriggered
(CompoundTag pTag) boolean
canPlaceItem
(int pSlot, ItemStack pStack) Returnstrue
if automation is allowed to insert the given stack (ignoring stack size) into the given slot.protected AbstractContainerMenu
createMenu
(int pContainerId, Inventory pInventory) void
fillStackedContents
(StackedContents pContents) int
protected Component
int
getItem
(int pIndex) Returns the stack in the given slot.getItems()
int
int
getWidth()
boolean
isEmpty()
boolean
isSlotDisabled
(int pSlot) boolean
protected void
loadAdditional
(CompoundTag pTag, HolderLookup.Provider pRegistries) protected void
saveAdditional
(CompoundTag pTag, HolderLookup.Provider pRegistries) static void
serverTick
(Level pLevel, BlockPos pPos, BlockState pState, CrafterBlockEntity pCrafter) void
setCraftingTicksRemaining
(int pCraftingTicksRemaining) void
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).protected void
setItems
(NonNullList<ItemStack> pItems) void
setSlotState
(int pSlot, boolean pState) void
setTriggered
(boolean pTriggered) private boolean
slotCanBeDisabled
(int pSlot) private boolean
smallerStackExist
(int pCurrentSize, ItemStack pStack, int pSlot) boolean
stillValid
(Player pPlayer) 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, setLootTableSeed
Methods inherited from class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
canUnlock, clearContent, getCustomName, getDisplayName, getName
Methods 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, triggerEvent
Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachments
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.Clearable
clearContent
Methods inherited from interface net.minecraft.world.Container
canTakeItem, countItem, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, removeItem, removeItemNoUpdate, setChanged, startOpen, stopOpen
Methods inherited from interface net.minecraft.world.inventory.CraftingContainer
asCraftInput, asPositionedCraftInput
Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData
Methods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
Methods inherited from interface net.neoforged.neoforge.client.extensions.IMenuProviderExtension
shouldTriggerClientSideContainerClosingOnOpen, writeClientSideData
Methods inherited from interface net.minecraft.world.Nameable
hasCustomName
Methods 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:
getDefaultName
in classBaseContainerBlockEntity
-
createMenu
- Specified by:
createMenu
in classBaseContainerBlockEntity
-
setSlotState
public void setSlotState(int pSlot, boolean pState) -
isSlotDisabled
public boolean isSlotDisabled(int pSlot) -
canPlaceItem
Returnstrue
if automation is allowed to insert the given stack (ignoring stack size) into the given slot. For guis use Slot.isItemValid- Specified by:
canPlaceItem
in interfaceContainer
-
smallerStackExist
-
loadAdditional
- Overrides:
loadAdditional
in classBaseContainerBlockEntity
-
saveAdditional
- Overrides:
saveAdditional
in classBaseContainerBlockEntity
-
getContainerSize
public int getContainerSize()- Specified by:
getContainerSize
in interfaceContainer
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceContainer
- Overrides:
isEmpty
in classRandomizableContainerBlockEntity
-
getItem
Description copied from class:RandomizableContainerBlockEntity
Returns the stack in the given slot.- Specified by:
getItem
in interfaceContainer
- Overrides:
getItem
in classRandomizableContainerBlockEntity
-
setItem
Description copied from class:RandomizableContainerBlockEntity
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).- Specified by:
setItem
in interfaceContainer
- Overrides:
setItem
in classRandomizableContainerBlockEntity
-
stillValid
Don't rename this method to canInteractWith due to conflicts with Container- Specified by:
stillValid
in interfaceContainer
- Overrides:
stillValid
in classBaseContainerBlockEntity
-
getItems
- Specified by:
getItems
in interfaceCraftingContainer
- Specified by:
getItems
in classBaseContainerBlockEntity
-
setItems
- Specified by:
setItems
in classBaseContainerBlockEntity
-
getWidth
public int getWidth()- Specified by:
getWidth
in interfaceCraftingContainer
-
getHeight
public int getHeight()- Specified by:
getHeight
in interfaceCraftingContainer
-
fillStackedContents
- Specified by:
fillStackedContents
in interfaceStackedContentsCompatible
-
addDisabledSlots
-
addTriggered
-
setTriggered
public void setTriggered(boolean pTriggered) -
isTriggered
public boolean isTriggered() -
serverTick
public static void serverTick(Level pLevel, BlockPos pPos, BlockState pState, CrafterBlockEntity pCrafter) -
setCraftingTicksRemaining
public void setCraftingTicksRemaining(int pCraftingTicksRemaining) -
getRedstoneSignal
public int getRedstoneSignal() -
slotCanBeDisabled
private boolean slotCanBeDisabled(int pSlot)
-