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 classes/interfaces inherited from interface com.refinedmods.refinedstorage.api.network.INetworkNodeVisitor
INetworkNodeVisitor.Operator
-
Field Summary
Fields inherited from class com.refinedmods.refinedstorage.apiimpl.network.node.NetworkNode
level, network, owner, pos, redstoneMode, ticks, version
-
Constructor Summary
ConstructorDescriptionCrafterNetworkNode
(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.level.block.entity.BlockEntity
net.neoforged.neoforge.fluids.capability.IFluidHandler
net.neoforged.neoforge.items.IItemHandler
net.minecraft.network.chat.Component
The custom name of this container, as set in an anvil for example.net.minecraft.network.chat.Component
net.neoforged.neoforge.items.IItemHandler
getDrops()
int
net.minecraft.resources.ResourceLocation
getId()
int
Returns the amount of successful crafting updates that this container can have per crafting step update.getMode()
net.minecraft.network.chat.Component
getName()
The name of this container for categorizing in the Crafting Manager GUI.net.neoforged.neoforge.items.IItemHandlerModifiable
net.minecraft.core.BlockPos
Containers may be daisy-chained together.int
Returns the interval of when a crafting step with a pattern in this container can update.net.neoforged.neoforge.items.IItemHandler
getUuid()
boolean
isLocked()
protected void
onConnectedStateChange
(INetwork network, boolean state, ConnectivityStateChangeCause cause) void
onDirectionChanged
(net.minecraft.core.Direction direction) void
onDisconnected
(INetwork network) Called when this node is disconnected from a network.void
Called when this container is used by a processing pattern to insert items or fluids in the connected inventory.void
read
(net.minecraft.nbt.CompoundTag tag) void
setDisplayName
(net.minecraft.network.chat.Component displayName) void
void
unlock()
Unlock the container so it may be used by processing patternvoid
update()
Updates a network node.net.minecraft.nbt.CompoundTag
write
(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, writeConfiguration
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.refinedmods.refinedstorage.api.autocrafting.ICraftingPatternContainer
getDirection, getFacingBlockEntity, hasConnectedFluidInventory, hasConnectedInventory, insertFluidsIntoInventory, insertItemsIntoInventory
Methods 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:
getEnergyUsage
in interfaceINetworkNode
- Returns:
- the energy usage of this node
-
update
public void update()Description copied from interface:INetworkNode
Updates a network node.- Specified by:
update
in interfaceINetworkNode
- Overrides:
update
in classNetworkNode
-
onConnectedStateChange
protected void onConnectedStateChange(INetwork network, boolean state, ConnectivityStateChangeCause cause) - Overrides:
onConnectedStateChange
in classNetworkNode
-
onDisconnected
Description copied from interface:INetworkNode
Called 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:
onDisconnected
in interfaceINetworkNode
- Overrides:
onDisconnected
in classNetworkNode
- Parameters:
network
- the network
-
onDirectionChanged
public void onDirectionChanged(net.minecraft.core.Direction direction) - Overrides:
onDirectionChanged
in classNetworkNode
-
read
public void read(net.minecraft.nbt.CompoundTag tag) - Overrides:
read
in classNetworkNode
-
getId
public net.minecraft.resources.ResourceLocation getId()- Specified by:
getId
in 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:INetworkNode
Writes the network node data to NBT.- Specified by:
write
in interfaceINetworkNode
- Overrides:
write
in classNetworkNode
- Parameters:
tag
- the tag- Returns:
- the written tag
-
getUpdateInterval
public int getUpdateInterval()Description copied from interface:ICraftingPatternContainer
Returns 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:
getUpdateInterval
in interfaceICraftingPatternContainer
- Returns:
- the update interval
-
getMaximumSuccessfulCraftingUpdates
public int getMaximumSuccessfulCraftingUpdates()Description copied from interface:ICraftingPatternContainer
Returns 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:
getMaximumSuccessfulCraftingUpdates
in interfaceICraftingPatternContainer
- Returns:
- the maximum amount of successful crafting updates
-
getConnectedInventory
@Nullable public net.neoforged.neoforge.items.IItemHandler getConnectedInventory()- Specified by:
getConnectedInventory
in 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:
getConnectedFluidInventory
in 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:
getConnectedBlockEntity
in interfaceICraftingPatternContainer
- Returns:
- the block entity that this container is connected to, or null if no block entity is present
-
getPatterns
- Specified by:
getPatterns
in interfaceICraftingPatternContainer
- Returns:
- the patterns stored in this container
-
getPatternInventory
@Nullable public net.neoforged.neoforge.items.IItemHandlerModifiable getPatternInventory()- Specified by:
getPatternInventory
in 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:ICraftingPatternContainer
The custom name of this container, as set in an anvil for example. Can be null.- Specified by:
getCustomName
in interfaceICraftingPatternContainer
- Returns:
- the name of this container
-
getName
public net.minecraft.network.chat.Component getName()Description copied from interface:ICraftingPatternContainer
The 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:
getName
in 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:
getPosition
in 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:
getDrops
in classNetworkNode
-
getRootContainer
Description copied from interface:ICraftingPatternContainer
Containers 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:
getRootContainer
in interfaceICraftingPatternContainer
- Returns:
- the root pattern container
-
getRootContainerNotSelf
-
getUuid
- Specified by:
getUuid
in interfaceICraftingPatternContainer
- Returns:
- the UUID of this container
-
isLocked
public boolean isLocked()- Specified by:
isLocked
in interfaceICraftingPatternContainer
- Returns:
- true if the connected inventory is locked for processing patterns, false otherwise
-
unlock
public void unlock()Description copied from interface:ICraftingPatternContainer
Unlock the container so it may be used by processing pattern- Specified by:
unlock
in interfaceICraftingPatternContainer
-
onUsedForProcessing
public void onUsedForProcessing()Description copied from interface:ICraftingPatternContainer
Called when this container is used by a processing pattern to insert items or fluids in the connected inventory.- Specified by:
onUsedForProcessing
in interfaceICraftingPatternContainer
-