Class PartTypePanelVariableDriven<P extends PartTypePanelVariableDriven<P,S>,S extends PartTypePanelVariableDriven.State<P,S>>
java.lang.Object
org.cyclops.integrateddynamics.api.part.PartTypeAdapter<P,S>
org.cyclops.integrateddynamics.core.part.PartTypeBase<P,S>
org.cyclops.integrateddynamics.core.part.panel.PartTypePanel<P,S>
org.cyclops.integrateddynamics.core.part.panel.PartTypePanelVariableDriven<P,S>
- All Implemented Interfaces:
INetworkEventListener<IPartNetworkElement<P,,S>> IPartType<P,,S> IPartTypeActiveVariable<P,S>
- Direct Known Subclasses:
PartTypePanelDisplay,PartTypePanelLightDynamic
public abstract class PartTypePanelVariableDriven<P extends PartTypePanelVariableDriven<P,S>,S extends PartTypePanelVariableDriven.State<P,S>>
extends PartTypePanel<P,S>
implements IPartTypeActiveVariable<P,S>
A panel part that is driven by a contained variable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPartTypePanelVariableDriven.State<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDrops(PartTarget target, S state, List<net.minecraft.world.item.ItemStack> itemStacks, boolean dropMainElement, boolean saveState) Add the itemstacks to drop when this element is removed.protected Map<Class<? extends INetworkEvent>,PartTypeBase.IEventAction> Override this to register your network event actions.protected net.minecraft.world.level.block.BlockcreateBlock(org.cyclops.cyclopscore.config.extendedconfig.BlockConfig blockConfig) Factory method for creating a block instance.getActiveVariable(INetwork network, IPartNetwork partNetwork, PartTarget target, S partState) Get the variable that is currently active for this part, the value in this variable will be used to write something.net.minecraft.world.level.block.state.BlockStategetBlockState(IPartContainer partContainer, net.minecraft.core.Direction side) Get the base block state that will be rendered for this part.Optional<net.minecraft.world.MenuProvider>protected IgnoredBlockStatus.StatusbooleanhasActiveVariable(IPartNetwork network, PartTarget target, S partState) booleanvoidloadTooltip(S state, List<net.minecraft.network.chat.Component> lines) Add tooltip lines for this aspect when this part is being hovered by a mod like WAILA.net.minecraft.world.InteractionResultonPartActivated(S partState, net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.item.ItemStack heldItem, net.minecraft.world.phys.BlockHitResult hit) Called when a part is right-clicked.protected voidonValueChanged(INetwork network, IPartNetwork partNetwork, PartTarget target, S state, IValue lastValue, IValue newValue) protected voidonVariableContentsUpdated(IPartNetwork network, PartTarget target, S state) booleanshouldTriggerBlockRenderUpdate(S oldPartState, S newPartState) Check if the given state change should trigger a block render update.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.PartTypeBase
createItem, createNetworkElement, createTranslationKey, forceLightTransparency, getBaseBlockState, getBlockModelPath, getMod, getModId, getSubscribedEvents, getUniqueName, hasEventSubscriptions, loadTooltip, onEvent, registerBlockMethods inherited from class org.cyclops.integrateddynamics.api.part.PartTypeAdapter
afterNetworkAlive, afterNetworkReAlive, beforeNetworkKill, constructDefaultState, defaultBlockState, fromNBT, getChannel, getCloneItemStack, getConsumptionRate, getItemStack, getMinimumUpdateInterval, getPriority, getState, getTarget, getTargetOffset, getTargetSideOverride, getTranslationKey, getUpdateInterval, hasOffsetVariables, isEnabled, isSolid, onBlockNeighborChange, onNetworkAddition, onNetworkRemoval, onOffsetVariablesChanged, onPostRemoved, onPreRemoved, postUpdate, setEnabled, setPriorityAndChannel, setTargetOffset, setTargetSideOverride, setUpdateInterval, 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
afterNetworkAlive, afterNetworkReAlive, beforeNetworkKill, createNetworkElement, defaultBlockState, forceLightTransparency, fromNBT, getBaseBlockState, getBlockModelPath, getChannel, getCloneItemStack, getConsumptionRate, getContainerProviderOffsets, getContainerProviderSettings, getItem, getItemStack, getMinimumUpdateInterval, getPartRenderPosition, getPriority, getState, getTarget, getTargetOffset, getTargetSideOverride, getTranslationKey, getUniqueName, getUpdateInterval, isEnabled, isSolid, loadTooltip, onBlockNeighborChange, onNetworkAddition, onNetworkRemoval, onOffsetVariablesChanged, onPostRemoved, onPreRemoved, postUpdate, setEnabled, setPriorityAndChannel, setTargetOffset, setTargetSideOverride, setUpdateInterval, supportsOffsets, toNBT, updateTick, writeExtraGuiDataOffsets, writeExtraGuiDataSettings
-
Constructor Details
-
PartTypePanelVariableDriven
-
-
Method Details
-
createBlock
protected net.minecraft.world.level.block.Block createBlock(org.cyclops.cyclopscore.config.extendedconfig.BlockConfig blockConfig) Description copied from class:PartTypeBaseFactory method for creating a block instance.- Overrides:
createBlockin classPartTypePanel<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
blockConfig- The config to register the block for.- Returns:
- The block instance.
-
constructNetworkEventActions
protected Map<Class<? extends INetworkEvent>,PartTypeBase.IEventAction> constructNetworkEventActions()Description copied from class:PartTypeBaseOverride this to register your network event actions.- Overrides:
constructNetworkEventActionsin classPartTypeBase<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Returns:
- The event actions.
-
addDrops
public void addDrops(PartTarget target, S state, List<net.minecraft.world.item.ItemStack> itemStacks, boolean dropMainElement, boolean saveState) Description copied from interface:IPartTypeAdd the itemstacks to drop when this element is removed.- Specified by:
addDropsin interfaceIPartType<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Overrides:
addDropsin classPartTypeBase<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
target- The target.state- The stateitemStacks- The itemstack list to add to.dropMainElement- If the part itself should also be dropped.saveState- If the part state should be saved in the item.
-
isUpdate
- Specified by:
isUpdatein interfaceIPartType<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Overrides:
isUpdatein classPartTypeAdapter<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
state- The state- Returns:
- If this element should be updated. This method is only called once during network initialization.
-
update
Description copied from interface:IPartTypeUpdate at the tick interval specified.- Specified by:
updatein interfaceIPartType<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Overrides:
updatein classPartTypeAdapter<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
network- The network to update in.partNetwork- The part network to update in.target- The target block.state- The state
-
hasActiveVariable
- Specified by:
hasActiveVariablein interfaceIPartTypeActiveVariable<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
network- The network this part belongs to.target- The target block.partState- The state of this part.- Returns:
- If there is an active variable present.
-
getActiveVariable
public <V extends IValue> IVariable<V> getActiveVariable(INetwork network, IPartNetwork partNetwork, PartTarget target, S partState) Description copied from interface:IPartTypeActiveVariableGet the variable that is currently active for this part, the value in this variable will be used to write something.- Specified by:
getActiveVariablein interfaceIPartTypeActiveVariable<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Type Parameters:
V- The value type.- Parameters:
network- The network this part belongs to.partNetwork- The part network this part belongs to.target- The target block.partState- The state of this part.- Returns:
- The variable reference to some other value that needs to be written by this part.
-
onValueChanged
protected void onValueChanged(INetwork network, IPartNetwork partNetwork, PartTarget target, S state, IValue lastValue, IValue newValue) -
getContainerProvider
Description copied from interface:IPartType- Specified by:
getContainerProviderin interfaceIPartType<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - 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 PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Overrides:
writeExtraGuiDatain classPartTypeBase<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
packetBuffer- A packet buffer that can be written to.pos- A part position.player- The player opening the gui.
-
getStatus
-
getBlockState
public net.minecraft.world.level.block.state.BlockState getBlockState(IPartContainer partContainer, net.minecraft.core.Direction side) Description copied from interface:IPartTypeGet the base block state that will be rendered for this part. An appropriateIgnoredBlock.FACINGproperty will be set.- Specified by:
getBlockStatein interfaceIPartType<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Overrides:
getBlockStatein classPartTypeBase<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
partContainer- The part entity.side- The position of the part.- Returns:
- The block state to render with.
-
onVariableContentsUpdated
-
onPartActivated
public net.minecraft.world.InteractionResult onPartActivated(S partState, net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand, net.minecraft.world.item.ItemStack heldItem, net.minecraft.world.phys.BlockHitResult hit) Description copied from interface:IPartTypeCalled when a part is right-clicked.- Specified by:
onPartActivatedin interfaceIPartType<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Overrides:
onPartActivatedin classPartTypeBase<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
partState- The state of this part.pos- The position of the block this part is part of.world- The world.player- The player activating the part.hand- The hand in use by the player.heldItem- The held item.hit- The ray trace hit result.- Returns:
- The action result.
-
loadTooltip
Description copied from interface:IPartTypeAdd tooltip lines for this aspect when this part is being hovered by a mod like WAILA.- Specified by:
loadTooltipin interfaceIPartType<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Overrides:
loadTooltipin classPartTypeBase<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
state- The state.lines- The list to add lines to.
-
shouldTriggerBlockRenderUpdate
Description copied from interface:IPartTypeCheck if the given state change should trigger a block render update. This is only called client-side. The new and old partstates are never both null, at most one will be null.- Specified by:
shouldTriggerBlockRenderUpdatein interfaceIPartType<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Overrides:
shouldTriggerBlockRenderUpdatein classPartTypeAdapter<P extends PartTypePanelVariableDriven<P,S>, S extends PartTypePanelVariableDriven.State<P, S>> - Parameters:
oldPartState- The old part state.newPartState- The new part state.- Returns:
- If it should trigger a block render update.
-