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
private void
addTriggered
(CompoundTag tag) boolean
canPlaceItem
(int slot, ItemStack stack) Returnstrue
if automation is allowed to insert the given stack (ignoring stack size) into the given slot.protected AbstractContainerMenu
createMenu
(int containerId, Inventory inventory) void
fillStackedContents
(StackedContents contents) int
protected Component
int
getItem
(int index) Returns the stack in the given slot.getItems()
int
int
getWidth()
boolean
isEmpty()
boolean
isSlotDisabled
(int slot) boolean
protected void
loadAdditional
(CompoundTag tag, HolderLookup.Provider registries) protected void
saveAdditional
(CompoundTag tag, HolderLookup.Provider registries) static void
serverTick
(Level level, BlockPos pos, BlockState state, CrafterBlockEntity crafter) void
setCraftingTicksRemaining
(int craftingTicksRemaining) void
Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).protected void
setItems
(NonNullList<ItemStack> items) void
setSlotState
(int slot, boolean state) void
setTriggered
(boolean triggered) private boolean
slotCanBeDisabled
(int slot) private boolean
smallerStackExist
(int currentSize, ItemStack stack, int slot) boolean
stillValid
(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, 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 slot, boolean state) -
isSlotDisabled
public boolean isSlotDisabled(int slot) -
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 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)
-