Class EnergyNet
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.network.Network
io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNet
- All Implemented Interfaces:
HologramOwner
,ItemAttribute
The
EnergyNet
is an implementation of Network
that deals with
electrical energy being sent from and to nodes.- Author:
- meiamsome, TheBusyBiscuit
- See Also:
-
Field Summary
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.Map
<org.bukkit.Location, EnergyNetComponent> This creates an immutableMap
ofEnergyNetComponentType.CAPACITOR
EnergyNetComponent
s within thisEnergyNet
instance.Map
<org.bukkit.Location, EnergyNetComponent> This creates an immutableMap
ofEnergyNetComponentType.CONSUMER
EnergyNetComponent
s within thisEnergyNet
instance.Map
<org.bukkit.Location, EnergyNetProvider> getId()
Returns the identifier of the associatedSlimefunItem
.static EnergyNet
getNetworkFromLocation
(org.bukkit.Location l) This attempts to get anEnergyNet
from a givenLocation
.static EnergyNet
getNetworkFromLocationOrCreate
(org.bukkit.Location l) This attempts to get anEnergyNet
from a givenLocation
.int
getRange()
This method returns the range of theNetwork
.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, markDirty, 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
-
Constructor Details
-
EnergyNet
protected EnergyNet(@Nonnull org.bukkit.Location l)
-
-
Method Details
-
getRange
public int getRange()Description copied from class:Network
-
getGenerators
- Returns:
- An immutable
Map
of generators
-
getCapacitors
This creates an immutableMap
ofEnergyNetComponentType.CAPACITOR
EnergyNetComponent
s within thisEnergyNet
instance.- Returns:
- An immutable
Map
of capacitors
-
getConsumers
This creates an immutableMap
ofEnergyNetComponentType.CONSUMER
EnergyNetComponent
s within thisEnergyNet
instance.- Returns:
- An immutable
Map
of consumers
-
getId
Description copied from interface:ItemAttribute
Returns the identifier of the associatedSlimefunItem
.- Specified by:
getId
in interfaceItemAttribute
- Returns:
- the identifier of the
SlimefunItem
-
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
-
getNetworkFromLocation
This attempts to get anEnergyNet
from a givenLocation
. If no suitableEnergyNet
could be found,null
will be returned.- Parameters:
l
- The targetLocation
- Returns:
- The
EnergyNet
at thatLocation
, ornull
-
getNetworkFromLocationOrCreate
This attempts to get anEnergyNet
from a givenLocation
. If no suitableEnergyNet
could be found, a new one will be created.- Parameters:
l
- The targetLocation
- Returns:
- The
EnergyNet
at thatLocation
, or a new one
-