Class PartTypeReadBase<P extends IPartTypeReader<P,S>,S extends IPartStateReader<P>>
java.lang.Object
org.cyclops.integrateddynamics.api.part.PartTypeAdapter<P,S>
org.cyclops.integrateddynamics.core.part.PartTypeBase<P,S>
org.cyclops.integrateddynamics.core.part.PartTypeConfigurable<P,S>
org.cyclops.integrateddynamics.core.part.PartTypeAspects<P,S>
org.cyclops.integrateddynamics.core.part.read.PartTypeReadBase<P,S>
- All Implemented Interfaces:
INetworkEventListener<IPartNetworkElement<P,,S>> IPartType<P,,S> IPartTypeReader<P,S>
- Direct Known Subclasses:
PartTypeAudioReader,PartTypeBlockReader,PartTypeEntityReader,PartTypeExtraDimensionalReader,PartTypeFluidReader,PartTypeInventoryReader,PartTypeMachineReader,PartTypeNetworkReader,PartTypeRedstoneReader,PartTypeWorldReader
public abstract class PartTypeReadBase<P extends IPartTypeReader<P,S>,S extends IPartStateReader<P>>
extends PartTypeAspects<P,S>
implements IPartTypeReader<P,S>
An abstract
IPartTypeReader.-
Nested Class Summary
Nested classes/interfaces inherited from class org.cyclops.integrateddynamics.core.part.PartTypeBase
PartTypeBase.IEventAction<P extends IPartType<P,S>, S extends IPartState<P>, E extends INetworkEvent> -
Constructor Summary
ConstructorsConstructorDescriptionPartTypeReadBase(String name) PartTypeReadBase(String name, PartRenderPosition partRenderPosition) -
Method Summary
Modifier and TypeMethodDescriptionOptional<net.minecraft.world.MenuProvider>protected Set<IAspectRead>getUpdateAspects(AspectUpdateType updateType) <V extends IValue,T extends IValueType<V>>
IAspectVariable<V>getVariable(PartTarget target, S partState, IAspectRead<V, T> aspect) Get the singleton variable for an aspect.booleanvoidonBlockNeighborChange(INetwork network, IPartNetwork partNetwork, PartTarget target, S state, net.minecraft.world.level.BlockGetter world, net.minecraft.world.level.block.Block neighbourBlock, net.minecraft.core.BlockPos neighbourBlockPos) Called when a neighbouring block is updated, more specifically whenBlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, BlockPos, boolean),IForgeBlock.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos)orBlockBehaviour.updateShape(BlockState, Direction, BlockState, LevelAccessor, BlockPos, BlockPos)is called.booleansetTargetOffset(S state, PartPos center, net.minecraft.core.Vec3i offset) voidsetTargetSideOverride(S state, net.minecraft.core.Direction side) Indicate that the given part should interact with the given side of the target.voidupdate(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) Update at the tick interval specified.voidwriteExtraGuiData(net.minecraft.network.FriendlyByteBuf packetBuffer, PartPos pos, net.minecraft.server.level.ServerPlayer player) This method can be overridden for cases when additional data needs to be sent to clients when opening containers.Methods inherited from class org.cyclops.integrateddynamics.core.part.PartTypeAspects
getAspects, getConsumptionRate, isUpdate, loadTooltipMethods inherited from class org.cyclops.integrateddynamics.core.part.PartTypeConfigurable
getContainerProviderOffsets, getContainerProviderSettings, writeExtraGuiDataOffsets, writeExtraGuiDataSettingsMethods inherited from class org.cyclops.integrateddynamics.core.part.PartTypeBase
addDrops, constructNetworkEventActions, createBlock, createItem, createNetworkElement, createTranslationKey, forceLightTransparency, getBaseBlockState, getBlockModelPath, getBlockState, getMod, getModId, getSubscribedEvents, getUniqueName, hasEventSubscriptions, loadTooltip, onEvent, onPartActivated, registerBlockMethods inherited from class org.cyclops.integrateddynamics.api.part.PartTypeAdapter
afterNetworkAlive, afterNetworkReAlive, beforeNetworkKill, constructDefaultState, defaultBlockState, fromNBT, getChannel, getCloneItemStack, getItemStack, getMinimumUpdateInterval, getPriority, getState, getTarget, getTargetOffset, getTargetSideOverride, getTranslationKey, getUpdateInterval, hasOffsetVariables, isEnabled, onNetworkAddition, onNetworkRemoval, onOffsetVariablesChanged, onPostRemoved, onPreRemoved, postUpdate, setEnabled, setPriorityAndChannel, setUpdateInterval, shouldTriggerBlockRenderUpdate, toNBT, updateTickMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cyclops.integrateddynamics.api.network.INetworkEventListener
getSubscribedEvents, hasEventSubscriptions, onEventMethods inherited from interface org.cyclops.integrateddynamics.api.part.IPartType
addDrops, afterNetworkAlive, afterNetworkReAlive, beforeNetworkKill, createNetworkElement, defaultBlockState, forceLightTransparency, fromNBT, getBaseBlockState, getBlockModelPath, getBlockState, getChannel, getCloneItemStack, getConsumptionRate, getContainerProviderOffsets, getContainerProviderSettings, getItem, getItemStack, getMinimumUpdateInterval, getPartRenderPosition, getPriority, getState, getTarget, getTargetOffset, getTargetSideOverride, getTranslationKey, getUniqueName, getUpdateInterval, isEnabled, isUpdate, loadTooltip, loadTooltip, onNetworkAddition, onNetworkRemoval, onOffsetVariablesChanged, onPartActivated, onPostRemoved, onPreRemoved, postUpdate, setEnabled, setPriorityAndChannel, setUpdateInterval, shouldTriggerBlockRenderUpdate, supportsOffsets, toNBT, updateTick, writeExtraGuiDataOffsets, writeExtraGuiDataSettings
-
Constructor Details
-
PartTypeReadBase
-
PartTypeReadBase
-
-
Method Details
-
getUpdateAspects
-
isSolid
- Specified by:
isSolidin interfaceIPartType<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Overrides:
isSolidin classPartTypeAdapter<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Parameters:
state- The state- Returns:
- If this element is solid.
-
update
Description copied from interface:IPartTypeUpdate at the tick interval specified.- Specified by:
updatein interfaceIPartType<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Overrides:
updatein classPartTypeAdapter<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Parameters:
network- The network to update in.partNetwork- The part network to update in.target- The target block.state- The state
-
onBlockNeighborChange
public void onBlockNeighborChange(INetwork network, IPartNetwork partNetwork, PartTarget target, S state, net.minecraft.world.level.BlockGetter world, net.minecraft.world.level.block.Block neighbourBlock, net.minecraft.core.BlockPos neighbourBlockPos) Description copied from interface:IPartTypeCalled when a neighbouring block is updated, more specifically whenBlockBehaviour.neighborChanged(BlockState, Level, BlockPos, Block, BlockPos, boolean),IForgeBlock.onNeighborChange(BlockState, LevelReader, BlockPos, BlockPos)orBlockBehaviour.updateShape(BlockState, Direction, BlockState, LevelAccessor, BlockPos, BlockPos)is called.- Specified by:
onBlockNeighborChangein interfaceIPartType<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Overrides:
onBlockNeighborChangein classPartTypeAdapter<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Parameters:
network- The network to update in.partNetwork- The part network to update in.target- The target block.state- The stateworld- The world in which the neighbour was updated.neighbourBlock- The block type of the neighbour that was updated.neighbourBlockPos- The position of the neighbour that was updated.
-
getReadAspects
- Specified by:
getReadAspectsin interfaceIPartTypeReader<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Returns:
- All possible read aspects that can be used in this part type.
-
getVariable
public <V extends IValue,T extends IValueType<V>> IAspectVariable<V> getVariable(PartTarget target, S partState, IAspectRead<V, T> aspect) Description copied from interface:IPartTypeReaderGet the singleton variable for an aspect.- Specified by:
getVariablein interfaceIPartTypeReader<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Type Parameters:
V- The value type.T- The value type type.- Parameters:
target- The target block.partState- The state of this part.aspect- The aspect from the part of this state.- Returns:
- The variable that exists only once for an aspect in the given part state.
-
setTargetOffset
- Specified by:
setTargetOffsetin interfaceIPartType<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Overrides:
setTargetOffsetin classPartTypeAdapter<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Parameters:
state- The statecenter- The center position.offset- The target position offset.- Returns:
- True if the offset was valid
-
setTargetSideOverride
Description copied from interface:IPartTypeIndicate that the given part should interact with the given side of the target.- Specified by:
setTargetSideOverridein interfaceIPartType<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Overrides:
setTargetSideOverridein classPartTypeAdapter<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Parameters:
state- The stateside- The side of the target block to interact with. Null removes the side override.
-
getContainerProvider
Description copied from interface:IPartType- Specified by:
getContainerProviderin interfaceIPartType<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Parameters:
pos- The part position. May be null when called client-side, for checking presence.- Returns:
- The optional container provider for the part type gui.
-
writeExtraGuiData
public void writeExtraGuiData(net.minecraft.network.FriendlyByteBuf packetBuffer, PartPos pos, net.minecraft.server.level.ServerPlayer player) Description copied from interface:IPartTypeThis method can be overridden for cases when additional data needs to be sent to clients when opening containers.- Specified by:
writeExtraGuiDatain interfaceIPartType<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Overrides:
writeExtraGuiDatain classPartTypeBase<P extends IPartTypeReader<P,S>, S extends IPartStateReader<P>> - Parameters:
packetBuffer- A packet buffer that can be written to.pos- A part position.player- The player opening the gui.
-