Class CrafterNetworkNode
java.lang.Object
com.refinedmods.refinedstorage.apiimpl.network.node.NetworkNode
com.refinedmods.refinedstorage.apiimpl.network.node.CrafterNetworkNode
- All Implemented Interfaces:
ICraftingPatternContainer,INetworkNodeVisitor,INetworkNode
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.refinedmods.refinedstorage.api.network.INetworkNodeVisitor
INetworkNodeVisitor.Operator -
Field Summary
FieldsFields inherited from class com.refinedmods.refinedstorage.apiimpl.network.node.NetworkNode
level, network, owner, pos, redstoneMode, ticks, version -
Constructor Summary
ConstructorsConstructorDescriptionCrafterNetworkNode(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.level.block.entity.BlockEntitynet.neoforged.neoforge.fluids.capability.IFluidHandlernet.neoforged.neoforge.items.IItemHandlernet.minecraft.network.chat.ComponentThe custom name of this container, as set in an anvil for example.net.minecraft.network.chat.Componentnet.neoforged.neoforge.items.IItemHandlergetDrops()intnet.minecraft.resources.ResourceLocationgetId()intReturns the amount of successful crafting updates that this container can have per crafting step update.getMode()net.minecraft.network.chat.ComponentgetName()The name of this container for categorizing in the Crafting Manager GUI.net.neoforged.neoforge.items.IItemHandlerModifiablenet.minecraft.core.BlockPosContainers may be daisy-chained together.intReturns the interval of when a crafting step with a pattern in this container can update.net.neoforged.neoforge.items.IItemHandlergetUuid()booleanisLocked()protected voidonConnectedStateChange(INetwork network, boolean state, ConnectivityStateChangeCause cause) voidonDirectionChanged(net.minecraft.core.Direction direction) voidonDisconnected(INetwork network) Called when this node is disconnected from a network.voidCalled when this container is used by a processing pattern to insert items or fluids in the connected inventory.voidread(net.minecraft.nbt.CompoundTag tag) voidsetDisplayName(net.minecraft.network.chat.Component displayName) voidvoidunlock()Unlock the container so it may be used by processing patternvoidupdate()Updates a network node.net.minecraft.nbt.CompoundTagwrite(net.minecraft.nbt.CompoundTag tag) Writes the network node data to NBT.Methods inherited from class com.refinedmods.refinedstorage.apiimpl.network.node.NetworkNode
canConduct, canUpdate, getDirection, getFacingBlockEntity, getItemStack, getLevel, getNetwork, getOwner, getPos, getRedstoneMode, getUpdateThrottleActiveToInactive, getUpdateThrottleInactiveToActive, isActive, markDirty, onConnected, readConfiguration, setOwner, setRedstoneMode, setRedstonePowered, shouldRebuildGraphOnChange, visit, writeConfigurationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.refinedmods.refinedstorage.api.autocrafting.ICraftingPatternContainer
getDirection, getFacingBlockEntity, hasConnectedFluidInventory, hasConnectedInventory, insertFluidsIntoInventory, insertItemsIntoInventoryMethods inherited from interface com.refinedmods.refinedstorage.api.network.node.INetworkNode
canReceive
-
Field Details
-
ID
public static final net.minecraft.resources.ResourceLocation ID
-
-
Constructor Details
-
CrafterNetworkNode
public CrafterNetworkNode(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
-
-
Method Details
-
getEnergyUsage
public int getEnergyUsage()- Specified by:
getEnergyUsagein interfaceINetworkNode- Returns:
- the energy usage of this node
-
update
public void update()Description copied from interface:INetworkNodeUpdates a network node.- Specified by:
updatein interfaceINetworkNode- Overrides:
updatein classNetworkNode
-
onConnectedStateChange
protected void onConnectedStateChange(INetwork network, boolean state, ConnectivityStateChangeCause cause) - Overrides:
onConnectedStateChangein classNetworkNode
-
onDisconnected
Description copied from interface:INetworkNodeCalled when this node is disconnected from a network. This happens when the node is removed, or if the network is removed. If the network runs out of power or no longer runs due to redstone mode settings, this won't be called and has to be detected manually.- Specified by:
onDisconnectedin interfaceINetworkNode- Overrides:
onDisconnectedin classNetworkNode- Parameters:
network- the network
-
onDirectionChanged
public void onDirectionChanged(net.minecraft.core.Direction direction) - Overrides:
onDirectionChangedin classNetworkNode
-
read
public void read(net.minecraft.nbt.CompoundTag tag) - Overrides:
readin classNetworkNode
-
getId
public net.minecraft.resources.ResourceLocation getId()- Specified by:
getIdin interfaceINetworkNode- Returns:
- the id of this node as specified in
INetworkNodeRegistry
-
write
public net.minecraft.nbt.CompoundTag write(net.minecraft.nbt.CompoundTag tag) Description copied from interface:INetworkNodeWrites the network node data to NBT.- Specified by:
writein interfaceINetworkNode- Overrides:
writein classNetworkNode- Parameters:
tag- the tag- Returns:
- the written tag
-
getUpdateInterval
public int getUpdateInterval()Description copied from interface:ICraftingPatternContainerReturns the interval of when a crafting step with a pattern in this container can update. Minimum value is 0 (each tick).Note: rather than maxing out the update interval, implementors might want to balance around
ICraftingPatternContainer.getMaximumSuccessfulCraftingUpdates(). This method merely speeds up the update rate, it might be more interesting to increase the output rate inICraftingPatternContainer.getMaximumSuccessfulCraftingUpdates().- Specified by:
getUpdateIntervalin interfaceICraftingPatternContainer- Returns:
- the update interval
-
getMaximumSuccessfulCraftingUpdates
public int getMaximumSuccessfulCraftingUpdates()Description copied from interface:ICraftingPatternContainerReturns the amount of successful crafting updates that this container can have per crafting step update. If this limit is reached, crafting patterns from this container won't be able to update until the next eligible crafting step update interval fromICraftingPatternContainer.getUpdateInterval().- Specified by:
getMaximumSuccessfulCraftingUpdatesin interfaceICraftingPatternContainer- Returns:
- the maximum amount of successful crafting updates
-
getConnectedInventory
@Nullable public net.neoforged.neoforge.items.IItemHandler getConnectedInventory()- Specified by:
getConnectedInventoryin interfaceICraftingPatternContainer- Returns:
- the inventory that this container is connected to, or null if no inventory is present
-
getConnectedFluidInventory
@Nullable public net.neoforged.neoforge.fluids.capability.IFluidHandler getConnectedFluidInventory()- Specified by:
getConnectedFluidInventoryin interfaceICraftingPatternContainer- Returns:
- the fluid inventory that this container is connected to, or null if no fluid inventory is present
-
getConnectedBlockEntity
@Nullable public net.minecraft.world.level.block.entity.BlockEntity getConnectedBlockEntity()- Specified by:
getConnectedBlockEntityin interfaceICraftingPatternContainer- Returns:
- the block entity that this container is connected to, or null if no block entity is present
-
getPatterns
- Specified by:
getPatternsin interfaceICraftingPatternContainer- Returns:
- the patterns stored in this container
-
getPatternInventory
@Nullable public net.neoforged.neoforge.items.IItemHandlerModifiable getPatternInventory()- Specified by:
getPatternInventoryin interfaceICraftingPatternContainer- Returns:
- the pattern inventory, or null if no pattern inventory is present
-
getCustomName
@Nullable public net.minecraft.network.chat.Component getCustomName()Description copied from interface:ICraftingPatternContainerThe custom name of this container, as set in an anvil for example. Can be null.- Specified by:
getCustomNamein interfaceICraftingPatternContainer- Returns:
- the name of this container
-
getName
public net.minecraft.network.chat.Component getName()Description copied from interface:ICraftingPatternContainerThe name of this container for categorizing in the Crafting Manager GUI. Will return the name of the root container if we're in a chained scenario.- Specified by:
getNamein interfaceICraftingPatternContainer- Returns:
- the name of this container
-
getDisplayName
@Nullable public net.minecraft.network.chat.Component getDisplayName() -
setDisplayName
public void setDisplayName(net.minecraft.network.chat.Component displayName) -
getPosition
public net.minecraft.core.BlockPos getPosition()- Specified by:
getPositionin interfaceICraftingPatternContainer- Returns:
- the position of this container
-
getMode
-
setMode
-
getUpgrades
public net.neoforged.neoforge.items.IItemHandler getUpgrades() -
getDrops
public net.neoforged.neoforge.items.IItemHandler getDrops()- Overrides:
getDropsin classNetworkNode
-
getRootContainer
Description copied from interface:ICraftingPatternContainerContainers may be daisy-chained together. If this container points to another one, gets the root container in the chain. If containers are not daisy-chained, returns this container. If there was a container loop, returns null.- Specified by:
getRootContainerin interfaceICraftingPatternContainer- Returns:
- the root pattern container
-
getRootContainerNotSelf
-
getUuid
- Specified by:
getUuidin interfaceICraftingPatternContainer- Returns:
- the UUID of this container
-
isLocked
public boolean isLocked()- Specified by:
isLockedin interfaceICraftingPatternContainer- Returns:
- true if the connected inventory is locked for processing patterns, false otherwise
-
unlock
public void unlock()Description copied from interface:ICraftingPatternContainerUnlock the container so it may be used by processing pattern- Specified by:
unlockin interfaceICraftingPatternContainer
-
onUsedForProcessing
public void onUsedForProcessing()Description copied from interface:ICraftingPatternContainerCalled when this container is used by a processing pattern to insert items or fluids in the connected inventory.- Specified by:
onUsedForProcessingin interfaceICraftingPatternContainer
-