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:
Clearable,Container,ContainerSingleItem,ContainerSingleItem.BlockContainerSingleItem,IAttachmentHolder,IBlockEntityExtension
public class JukeboxBlockEntity
extends BlockEntity
implements Clearable, ContainerSingleItem.BlockContainerSingleItem
-
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.AsFieldNested classes/interfaces inherited from interface net.minecraft.world.ticks.ContainerSingleItem
ContainerSingleItem.BlockContainerSingleItem -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ItemStackprivate final JukeboxSongPlayerstatic final Stringstatic final StringFields 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_BUFFER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanPlaceItem(int pSlot, ItemStack pStack) Returnstrueif automation is allowed to insert the given stack (ignoring stack size) into the given slot.booleancanTakeItem(Container pTarget, int pSlot, ItemStack pStack) Returnstrueif the given stack can be extracted into the target inventory.intintprotected voidloadAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) private voidnotifyItemChangedInJukebox(boolean pHasRecord) voidvoidprotected voidsaveAdditional(CompoundTag pTag, HolderLookup.Provider pRegistries) voidsetSongItemWithoutPlaying(ItemStack pStack) voidsetTheItem(ItemStack pItem) splitTheItem(int pAmount) static voidtick(Level pLevel, BlockPos pPos, BlockState pState, JukeboxBlockEntity pJukebox) voidMethods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, onlyOpCanSetNbt, parseCustomNameSafe, removeComponentsFromTag, removeData, saveCustomAndMetadata, saveCustomOnly, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, syncData, 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.Container
countItem, getMaxStackSize, hasAnyMatching, hasAnyOf, setChanged, startOpen, stopOpenMethods inherited from interface net.minecraft.world.ticks.ContainerSingleItem
clearContent, getContainerSize, getItem, isEmpty, removeItem, removeItemNoUpdate, removeTheItem, setItemMethods inherited from interface net.minecraft.world.ticks.ContainerSingleItem.BlockContainerSingleItem
stillValidMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate
-
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:
loadAdditionalin classBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBlockEntity
-
getTheItem
- Specified by:
getTheItemin interfaceContainerSingleItem
-
splitTheItem
- Specified by:
splitTheItemin interfaceContainerSingleItem
-
setTheItem
- Specified by:
setTheItemin interfaceContainerSingleItem
-
getMaxStackSize
public int getMaxStackSize()- Specified by:
getMaxStackSizein interfaceContainer
-
getContainerBlockEntity
- Specified by:
getContainerBlockEntityin interfaceContainerSingleItem.BlockContainerSingleItem
-
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
-
canTakeItem
Returnstrueif the given stack can be extracted into the target inventory.- Specified by:
canTakeItemin 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:
trueif the given stack can be extracted into the target inventory
-
setSongItemWithoutPlaying
-
tryForcePlaySong
public void tryForcePlaySong()
-