Class CargoNet
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.network.Network
io.github.thebusybiscuit.slimefun4.core.networks.cargo.CargoNet
- All Implemented Interfaces:
HologramOwner
,ItemAttribute
The
CargoNet
is a type of Network
which deals with ItemStack
transportation.
It is also an extension of AbstractItemNetwork
which provides methods to deal
with the addon ChestTerminal.- Author:
- meiamsome, Poslovitch, John000708, BigBadE, SoSeDiK, TheBusyBiscuit, Walshy, DNx5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map
<org.bukkit.Location, org.bukkit.block.BlockFace> This is a cache for theBlockFace
a node is facing, so we don't need to request theBlockData
each time we visit a nodeprotected Map
<org.bukkit.Location, io.github.thebusybiscuit.slimefun4.core.networks.cargo.ItemFilter> This is our cache for theItemFilter
for each node.Fields inherited from class io.github.thebusybiscuit.slimefun4.api.network.Network
connectedLocations, connectorNodes, regulator, regulatorNodes, terminusNodes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclassifyLocation
(org.bukkit.Location l) This method assigns the givenLocation
a type ofNetworkComponent
for classification.protected Optional
<org.bukkit.block.Block> getAttachedBlock
(org.bukkit.Location l) getId()
Returns the identifier of the associatedSlimefunItem
.protected io.github.thebusybiscuit.slimefun4.core.networks.cargo.ItemFilter
getItemFilter
(org.bukkit.block.Block node) static CargoNet
getNetworkFromLocation
(org.bukkit.Location l) static CargoNet
getNetworkFromLocationOrCreate
(org.bukkit.Location l) int
getRange()
This method returns the range of theNetwork
.void
markCargoNodeConfigurationDirty
(org.bukkit.Location node) This will mark theItemFilter
of the given node dirty.void
markDirty
(org.bukkit.Location l) This method marks the givenLocation
as dirty and adds it to aQueue
to handle this update.void
onClassificationChange
(org.bukkit.Location l, NetworkComponent from, NetworkComponent to) This method is called whenever aLocation
in thisNetwork
changes its classification.void
tick
(org.bukkit.block.Block b, SlimefunBlockData blockData) Methods inherited from class io.github.thebusybiscuit.slimefun4.api.network.Network
addLocationToNetwork, connectsTo, display, getRegulator, getSize, tick
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.thebusybiscuit.slimefun4.core.attributes.HologramOwner
getHologramOffset, removeHologram, updateHologram, updateHologram
-
Field Details
-
roundRobin
-
connectorCache
This is a cache for theBlockFace
a node is facing, so we don't need to request theBlockData
each time we visit a node -
filterCache
protected Map<org.bukkit.Location,io.github.thebusybiscuit.slimefun4.core.networks.cargo.ItemFilter> filterCacheThis is our cache for theItemFilter
for each node.
-
-
Constructor Details
-
Method Details
-
getNetworkFromLocation
-
getNetworkFromLocationOrCreate
-
getId
Description copied from interface:ItemAttribute
Returns the identifier of the associatedSlimefunItem
.- Specified by:
getId
in interfaceItemAttribute
- Returns:
- the identifier of the
SlimefunItem
-
getRange
public int getRange()Description copied from class:Network
-
classifyLocation
Description copied from class:Network
This method assigns the givenLocation
a type ofNetworkComponent
for classification.- Specified by:
classifyLocation
in classNetwork
- Parameters:
l
- TheLocation
to classify- Returns:
- The assigned type of
NetworkComponent
for thisLocation
-
onClassificationChange
public void onClassificationChange(org.bukkit.Location l, NetworkComponent from, NetworkComponent to) Description copied from class:Network
This method is called whenever aLocation
in thisNetwork
changes its classification.- Specified by:
onClassificationChange
in classNetwork
- Parameters:
l
- TheLocation
that is changing its classificationfrom
- TheNetworkComponent
thisLocation
was previously classified asto
- TheNetworkComponent
thisLocation
is changing to
-
tick
-
getAttachedBlock
-
markDirty
public void markDirty(@Nonnull org.bukkit.Location l) Description copied from class:Network
This method marks the givenLocation
as dirty and adds it to aQueue
to handle this update. -
markCargoNodeConfigurationDirty
public void markCargoNodeConfigurationDirty(@Nonnull org.bukkit.Location node) This will mark theItemFilter
of the given node dirty. It will also invalidate the cached rotation.- Parameters:
node
- TheLocation
of the cargo node
-
getItemFilter
@Nonnull protected io.github.thebusybiscuit.slimefun4.core.networks.cargo.ItemFilter getItemFilter(@Nonnull org.bukkit.block.Block node)
-