Class PartTypeWriteBase<P extends IPartTypeWriter<P,S>,S extends IPartStateWriter<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.write.PartTypeWriteBase<P,S>
- All Implemented Interfaces:
INetworkEventListener<IPartNetworkElement<P,,S>> IPartType<P,,S> IPartTypeActiveVariable<P,,S> IPartTypeWriter<P,S>
- Direct Known Subclasses:
PartTypeAudioWriter,PartTypeEffectWriter,PartTypeEntityWriter,PartTypeInventoryWriter,PartTypeMachineWriter,PartTypeRedstoneWriter
public abstract class PartTypeWriteBase<P extends IPartTypeWriter<P,S>,S extends IPartStateWriter<P>>
extends PartTypeAspects<P,S>
implements IPartTypeWriter<P,S>
An abstract
IPartTypeWriter.-
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
ConstructorsConstructorDescriptionPartTypeWriteBase(String name) PartTypeWriteBase(String name, PartRenderPosition partRenderPosition) -
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.voidafterNetworkAlive(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) Called right after this network is initialized.voidbeforeNetworkKill(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) Called right before the network is terminated or will be reset.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.getActiveAspect(PartTarget target, S partState) Get the aspect that is currently active in this part, can be null.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.StatusgetStatus(IPartStateWriter state) booleanhasActiveVariable(IPartNetwork network, PartTarget target, S partState) voidloadTooltip(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.protected voidonVariableContentsUpdated(IPartNetwork network, PartTarget target, S state) booleansetTargetOffset(S state, PartPos center, net.minecraft.core.Vec3i offset) 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.voidupdateActivation(PartTarget target, S partState, net.minecraft.world.entity.player.Player player) Update the active aspect and active variable for this part.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
createItem, createNetworkElement, createTranslationKey, forceLightTransparency, getBaseBlockState, getBlockModelPath, getMod, getModId, getSubscribedEvents, getUniqueName, hasEventSubscriptions, onEvent, onPartActivated, registerBlockMethods inherited from class org.cyclops.integrateddynamics.api.part.PartTypeAdapter
afterNetworkReAlive, constructDefaultState, defaultBlockState, fromNBT, getChannel, getCloneItemStack, getItemStack, getMinimumUpdateInterval, getPriority, getState, getTarget, getTargetOffset, getTargetSideOverride, getTranslationKey, getUpdateInterval, hasOffsetVariables, isEnabled, isSolid, onBlockNeighborChange, onNetworkAddition, onNetworkRemoval, onOffsetVariablesChanged, onPostRemoved, onPreRemoved, postUpdate, setEnabled, setPriorityAndChannel, 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
afterNetworkReAlive, 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, isUpdate, loadTooltip, onBlockNeighborChange, onNetworkAddition, onNetworkRemoval, onOffsetVariablesChanged, onPartActivated, onPostRemoved, onPreRemoved, postUpdate, setEnabled, setPriorityAndChannel, setTargetSideOverride, setUpdateInterval, supportsOffsets, toNBT, updateTick, writeExtraGuiDataOffsets, writeExtraGuiDataSettings
-
Constructor Details
-
PartTypeWriteBase
-
PartTypeWriteBase
-
-
Method Details
-
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 IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Returns:
- The event actions.
-
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 classPartTypeBase<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
blockConfig- The config to register the block for.- Returns:
- The block instance.
-
update
Description copied from interface:IPartTypeUpdate at the tick interval specified.- Specified by:
updatein interfaceIPartType<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
updatein classPartTypeAdapter<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
network- The network to update in.partNetwork- The part network to update in.target- The target block.state- The state
-
setTargetOffset
- Specified by:
setTargetOffsetin interfaceIPartType<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
setTargetOffsetin classPartTypeAdapter<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
state- The statecenter- The center position.offset- The target position offset.- Returns:
- True if the offset was valid
-
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 IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
addDropsin classPartTypeBase<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - 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.
-
beforeNetworkKill
public void beforeNetworkKill(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) Description copied from interface:IPartTypeCalled right before the network is terminated or will be reset.- Specified by:
beforeNetworkKillin interfaceIPartType<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
beforeNetworkKillin classPartTypeAdapter<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
network- The network to update in.partNetwork- The part network to update in.target- The target block.state- The state
-
afterNetworkAlive
public void afterNetworkAlive(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) Description copied from interface:IPartTypeCalled right after this network is initialized.- Specified by:
afterNetworkAlivein interfaceIPartType<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
afterNetworkAlivein classPartTypeAdapter<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
network- The network to update in.partNetwork- The part network to update in.target- The target block.state- The state
-
getWriteAspects
- Specified by:
getWriteAspectsin interfaceIPartTypeWriter<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Returns:
- All possible write aspects that can be used in this part type.
-
hasActiveVariable
- Specified by:
hasActiveVariablein interfaceIPartTypeActiveVariable<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - 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 IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - 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.
-
getActiveAspect
Description copied from interface:IPartTypeWriterGet the aspect that is currently active in this part, can be null.- Specified by:
getActiveAspectin interfaceIPartTypeWriter<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
target- The target block.partState- The state of this part.- Returns:
- The active aspect.
-
updateActivation
public void updateActivation(PartTarget target, S partState, @Nullable net.minecraft.world.entity.player.Player player) Description copied from interface:IPartTypeWriterUpdate the active aspect and active variable for this part.- Specified by:
updateActivationin interfaceIPartTypeWriter<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
target- The target block.partState- The state of this part.player- The player activating the aspect, can be null.
-
onVariableContentsUpdated
-
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 IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
getBlockStatein classPartTypeBase<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
partContainer- The part entity.side- The position of the part.- Returns:
- The block state to render with.
-
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 IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
loadTooltipin classPartTypeBase<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
state- The state.lines- The list to add lines to.
-
getContainerProvider
Description copied from interface:IPartType- Specified by:
getContainerProviderin interfaceIPartType<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<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 IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
writeExtraGuiDatain classPartTypeBase<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
packetBuffer- A packet buffer that can be written to.pos- A part position.player- The player opening the gui.
-
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 IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Overrides:
shouldTriggerBlockRenderUpdatein classPartTypeAdapter<P extends IPartTypeWriter<P,S>, S extends IPartStateWriter<P>> - Parameters:
oldPartState- The old part state.newPartState- The new part state.- Returns:
- If it should trigger a block render update.
-