Class JukeboxBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.JukeboxBlockEntity
- All Implemented Interfaces:
Iterable<ItemStack>
,Clearable
,Container
,ContainerSingleItem
,ContainerSingleItem.BlockContainerSingleItem
,IAttachmentHolder
,IBlockEntityExtension
public class JukeboxBlockEntity
extends BlockEntity
implements ContainerSingleItem.BlockContainerSingleItem
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.level.block.entity.BlockEntity
BlockEntity.BlockEntityPathElement
Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
AttachmentHolder.AsField
Nested classes/interfaces inherited from interface net.minecraft.world.Container
Container.ContainerIterator
Nested classes/interfaces inherited from interface net.minecraft.world.ticks.ContainerSingleItem
ContainerSingleItem.BlockContainerSingleItem
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ItemStack
private final JukeboxSongPlayer
static final String
static final String
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canPlaceItem
(int pSlot, ItemStack pStack) Returnstrue
if automation is allowed to insert the given stack (ignoring stack size) into the given slot.boolean
canTakeItem
(Container pTarget, int pSlot, ItemStack pStack) Returnstrue
if the given stack can be extracted into the target inventory.int
int
protected void
loadAdditional
(ValueInput pInput) private void
notifyItemChangedInJukebox
(boolean pHasRecord) void
void
void
preRemoveSideEffects
(BlockPos pPos, BlockState pState) protected void
saveAdditional
(ValueOutput pOutput) void
setSongItemWithoutPlaying
(ItemStack pStack) void
setTheItem
(ItemStack pItem) splitTheItem
(int pAmount) static void
tick
(Level pLevel, BlockPos pPos, BlockState pState, JukeboxBlockEntity pJukebox) void
Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, problemPath, removeComponentsFromTag, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, 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.Container
countItem, getMaxStackSize, hasAnyMatching, hasAnyOf, iterator, setChanged, startOpen, stopOpen
Methods inherited from interface net.minecraft.world.ticks.ContainerSingleItem
clearContent, getContainerSize, getItem, isEmpty, removeItem, removeItemNoUpdate, removeTheItem, setItem
Methods inherited from interface net.minecraft.world.ticks.ContainerSingleItem.BlockContainerSingleItem
stillValid
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, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
SONG_ITEM_TAG_ID
- See Also:
-
TICKS_SINCE_SONG_STARTED_TAG_ID
- See Also:
-
item
-
jukeboxSongPlayer
-
-
Constructor Details
-
JukeboxBlockEntity
-
-
Method Details
-
getSongPlayer
-
onSongChanged
public void onSongChanged() -
notifyItemChangedInJukebox
private void notifyItemChangedInJukebox(boolean pHasRecord) -
popOutTheItem
public void popOutTheItem() -
tick
public static void tick(Level pLevel, BlockPos pPos, BlockState pState, JukeboxBlockEntity pJukebox) -
getComparatorOutput
public int getComparatorOutput() -
loadAdditional
- Overrides:
loadAdditional
in classBlockEntity
-
saveAdditional
- Overrides:
saveAdditional
in classBlockEntity
-
getTheItem
- Specified by:
getTheItem
in interfaceContainerSingleItem
-
splitTheItem
- Specified by:
splitTheItem
in interfaceContainerSingleItem
-
setTheItem
- Specified by:
setTheItem
in interfaceContainerSingleItem
-
getMaxStackSize
public int getMaxStackSize()- Specified by:
getMaxStackSize
in interfaceContainer
-
getContainerBlockEntity
- Specified by:
getContainerBlockEntity
in interfaceContainerSingleItem.BlockContainerSingleItem
-
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
-
canTakeItem
Returnstrue
if the given stack can be extracted into the target inventory.- Specified by:
canTakeItem
in interfaceContainer
- Parameters:
pTarget
- the container into which the item should be extractedpSlot
- the slot from which to extract the itempStack
- the item to extract- Returns:
true
if the given stack can be extracted into the target inventory
-
preRemoveSideEffects
- Overrides:
preRemoveSideEffects
in classBlockEntity
-
setSongItemWithoutPlaying
-
tryForcePlaySong
public void tryForcePlaySong()
-