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>, TypedInstance<BlockEntityType<?>>, DebugValueSource, Clearable, Container, SlotProvider, ContainerSingleItem, ContainerSingleItem.BlockContainerSingleItem, IAttachmentHolder, ContainerExtension, IBlockEntityExtension
public class JukeboxBlockEntity
extends BlockEntity
implements ContainerSingleItem.BlockContainerSingleItem
-
Nested Class Summary
Nested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface Container
Container.ContainerIteratorNested classes/interfaces inherited from interface ContainerSingleItem
ContainerSingleItem.BlockContainerSingleItemNested classes/interfaces inherited from interface DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ItemStackprivate final RootCommitJournalprivate final JukeboxSongPlayerstatic final Stringstatic final StringFields inherited from class BlockEntity
level, remove, worldPositionFields inherited from class AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface Container
DEFAULT_DISTANCE_BUFFER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanPlaceItem(int slot, ItemStack itemStack) booleancanTakeItem(Container into, int slot, ItemStack itemStack) intintprivate voidprotected voidloadAdditional(ValueInput input) private voidnotifyItemChangedInJukebox(boolean wasInserted) voidvoidonTransfer(int slot, int amountChange, TransactionContext transaction) Perform additional logic during the transaction, immediately after a successful transfer (i.e.voidvoidpreRemoveSideEffects(BlockPos pos, BlockState state) protected voidsaveAdditional(ValueOutput output) voidAn extension ofContainer.setItem(int, ItemStack)that allows non-transactional side-effects to be skipped.voidvoidsetSongItemWithoutPlaying(ItemStack itemStack) voidsetTheItem(ItemStack itemStack) splitTheItem(int count) static voidtick(Level level, BlockPos blockPos, BlockState blockState, JukeboxBlockEntity jukebox) voidMethods inherited from class BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, applyImplicitComponents, clearRemoved, collectComponents, collectImplicitComponents, components, fillCrashReportCategory, getAndClearAttachmentTypesToSync, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, problemPath, registerDebugValues, removeComponentsFromTag, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, syncData, triggerEvent, typeHolderMethods inherited from class AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Container
countItem, getEntitiesWithContainerOpen, getMaxStackSize, getSlot, hasAnyMatching, hasAnyOf, iterator, setChanged, startOpen, stopOpenMethods inherited from interface ContainerSingleItem
clearContent, getContainerSize, getItem, isEmpty, removeItem, removeItemNoUpdate, removeTheItem, setItemMethods inherited from interface ContainerSingleItem.BlockContainerSingleItem
stillValidMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface SlotProvider
getSlotsFromRange
-
Field Details
-
SONG_ITEM_TAG_ID
- See Also:
-
TICKS_SINCE_SONG_STARTED_TAG_ID
- See Also:
-
item
-
jukeboxSongPlayer
-
itemChangedJournal
-
-
Constructor Details
-
JukeboxBlockEntity
-
-
Method Details
-
getSongPlayer
-
onSongChanged
public void onSongChanged() -
notifyItemChangedInJukebox
private void notifyItemChangedInJukebox(boolean wasInserted) -
popOutTheItem
public void popOutTheItem() -
tick
public static void tick(Level level, BlockPos blockPos, BlockState blockState, JukeboxBlockEntity jukebox) -
getComparatorOutput
public int getComparatorOutput() -
loadAdditional
- Overrides:
loadAdditionalin classBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBlockEntity
-
getTheItem
- Specified by:
getTheItemin interfaceContainerSingleItem
-
splitTheItem
- Specified by:
splitTheItemin interfaceContainerSingleItem
-
onTransfer
Description copied from interface:ContainerExtensionPerform additional logic during the transaction, immediately after a successful transfer (i.e. insert or extract with result > 0). Any logic performed by this method should be fully transactional, and support being rolled back. In other words, the transaction is still ongoing.- Specified by:
onTransferin interfaceContainerExtension- Parameters:
amountChange- If positive, the amount of items that were just inserted into this slot. If negative, minus the amount of items that were just extracted from this slot.
-
setItem
Description copied from interface:ContainerExtensionAn extension ofContainer.setItem(int, ItemStack)that allows non-transactional side-effects to be skipped. Non-transactional side-effects include for example callingsetChangedor making changes to the world.- Specified by:
setItemin interfaceContainerExtension- Parameters:
insideTransaction- Whentrue, non-transactional actions should be deferred. Whenfalse, non-transactional actions can be performed immediately.- See Also:
-
setTheItem
- Specified by:
setTheItemin interfaceContainerSingleItem
-
itemChanged
private void itemChanged() -
setRemoved
public void setRemoved()- Overrides:
setRemovedin classBlockEntity
-
getMaxStackSize
public int getMaxStackSize()- Specified by:
getMaxStackSizein interfaceContainer
-
getContainerBlockEntity
- Specified by:
getContainerBlockEntityin interfaceContainerSingleItem.BlockContainerSingleItem
-
canPlaceItem
- Specified by:
canPlaceItemin interfaceContainer
-
canTakeItem
- Specified by:
canTakeItemin interfaceContainer
-
preRemoveSideEffects
- Overrides:
preRemoveSideEffectsin classBlockEntity
-
setSongItemWithoutPlaying
-
tryForcePlaySong
public void tryForcePlaySong()
-