Class AuditoryBlockEntity
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntity
com.codinglitch.simpleradio.central.AuditoryBlockEntity
- All Implemented Interfaces:
Socket,net.minecraftforge.common.capabilities.ICapabilityProvider,net.minecraftforge.common.capabilities.ICapabilityProviderImpl<net.minecraft.world.level.block.entity.BlockEntity>,net.minecraftforge.common.capabilities.ICapabilitySerializable<net.minecraft.nbt.CompoundTag>,net.minecraftforge.common.extensions.IForgeBlockEntity,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- Direct Known Subclasses:
CatalyzingBlockEntity,MicrophoneBlockEntity,RadioBlockEntity,SpeakerBlockEntity
public abstract class AuditoryBlockEntity
extends net.minecraft.world.level.block.entity.BlockEntity
implements Socket
A block entity which interacts with audio in some way;
Although this is not required to be extended, it provides helper methods and overrides to simplify the creation of auditory blocks.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
net.minecraftforge.common.capabilities.CapabilityProvider.AsField<B extends net.minecraftforge.common.capabilities.ICapabilityProviderImpl<B>> -
Field Summary
FieldsModifier and TypeFieldDescriptionboolean@Nullable Listener@Nullable Receiver@Nullable Speaker@Nullable TransmitterFields inherited from class net.minecraft.world.level.block.entity.BlockEntity
level, remove, worldPositionFields inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
INFINITE_EXTENT_AABB -
Constructor Summary
ConstructorsConstructorDescriptionAuditoryBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> blockEntityType, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()This is called whenever the block is initially activated (placed, on world load, chunk loaded, etc.) Use this to create and register the associated routers for this block.voidThis is called whenever the block is deactivated (chunk unloaded, block broken, etc.) Use this to clean up the associated routers.net.minecraft.world.phys.Vec3Override this to expose a given router to wires.@Nullable net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener>net.minecraft.nbt.CompoundTagvoidloadFromItem(net.minecraft.world.item.ItemStack stack) voidloadTag(net.minecraft.nbt.CompoundTag tag) protected voidsaveAdditional(net.minecraft.nbt.CompoundTag tag) voidsaveTag(net.minecraft.nbt.CompoundTag tag) voidsetLevel(net.minecraft.world.level.Level level) voidvoidvalidate()Checks if this block should be deactivated due to an invalid router.Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, clearRemoved, fillCrashReportCategory, getBlockPos, getBlockState, getLevel, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, load, loadStatic, onChunkUnloaded, onlyOpCanSetNbt, saveToItem, saveWithFullMetadata, saveWithId, saveWithoutMetadata, setBlockState, setChanged, setChanged, triggerEventMethods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCapsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability, getCapabilityMethods inherited from interface net.minecraftforge.common.extensions.IForgeBlockEntity
deserializeNBT, getModelData, getRenderBoundingBox, handleUpdateTag, hasCustomOutlineRendering, onDataPacket, onLoad, requestModelDataUpdate, serializeNBTMethods inherited from interface com.codinglitch.simpleradio.central.Socket
canConnect, canConnectTo, connect, disconnect, disconnect, distribute, getIdentifier, getReference, getWires, hasWire, hasWire, shortCircuit
-
Field Details
-
frequency
-
id
-
receiver
-
transmitter
-
listener
-
speaker
-
active
public boolean active
-
-
Constructor Details
-
AuditoryBlockEntity
public AuditoryBlockEntity(net.minecraft.world.level.block.entity.BlockEntityType<?> blockEntityType, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
-
-
Method Details
-
validate
public void validate()Checks if this block should be deactivated due to an invalid router.Ideally, you should call this every tick.
-
activate
public void activate()This is called whenever the block is initially activated (placed, on world load, chunk loaded, etc.) Use this to create and register the associated routers for this block. -
deactivate
public void deactivate()This is called whenever the block is deactivated (chunk unloaded, block broken, etc.) Use this to clean up the associated routers.This method will also set all invalid routers to null.
-
setLevel
public void setLevel(net.minecraft.world.level.Level level) - Overrides:
setLevelin classnet.minecraft.world.level.block.entity.BlockEntity
-
setRemoved
public void setRemoved()- Overrides:
setRemovedin classnet.minecraft.world.level.block.entity.BlockEntity
-
getRouter
Description copied from interface:SocketOverride this to expose a given router to wires.
Allows blocks with more than one router to choose which of their routers wires will connect to. -
getConnectionPosition
public net.minecraft.world.phys.Vec3 getConnectionPosition() -
loadFromItem
public void loadFromItem(net.minecraft.world.item.ItemStack stack) -
loadTag
public void loadTag(net.minecraft.nbt.CompoundTag tag) -
saveTag
public void saveTag(net.minecraft.nbt.CompoundTag tag) -
saveAdditional
protected void saveAdditional(net.minecraft.nbt.CompoundTag tag) - Overrides:
saveAdditionalin classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdateTag
public net.minecraft.nbt.CompoundTag getUpdateTag()- Overrides:
getUpdateTagin classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdatePacket
@Nullable public @Nullable net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getUpdatePacket()- Overrides:
getUpdatePacketin classnet.minecraft.world.level.block.entity.BlockEntity
-