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 givenLocationa type ofNetworkComponentfor classification.Map<org.bukkit.Location, EnergyNetComponent> This creates an immutableMapofEnergyNetComponentType.CAPACITOREnergyNetComponents within thisEnergyNetinstance.Map<org.bukkit.Location, EnergyNetComponent> This creates an immutableMapofEnergyNetComponentType.CONSUMEREnergyNetComponents within thisEnergyNetinstance.Map<org.bukkit.Location, EnergyNetProvider> getId()Returns the identifier of the associatedSlimefunItem.static EnergyNetgetNetworkFromLocation(org.bukkit.Location l) This attempts to get anEnergyNetfrom a givenLocation.static EnergyNetgetNetworkFromLocationOrCreate(org.bukkit.Location l) This attempts to get anEnergyNetfrom a givenLocation.intgetRange()This method returns the range of theNetwork.voidonClassificationChange(org.bukkit.Location l, NetworkComponent from, NetworkComponent to) This method is called whenever aLocationin thisNetworkchanges its classification.voidtick(org.bukkit.block.Block b, SlimefunBlockData blockData) Methods inherited from class io.github.thebusybiscuit.slimefun4.api.network.Network
addLocationToNetwork, connectsTo, display, getRegulator, getSize, markDirty, tickMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
Mapof generators
-
getCapacitors
This creates an immutableMapofEnergyNetComponentType.CAPACITOREnergyNetComponents within thisEnergyNetinstance.- Returns:
- An immutable
Mapof capacitors
-
getConsumers
This creates an immutableMapofEnergyNetComponentType.CONSUMEREnergyNetComponents within thisEnergyNetinstance.- Returns:
- An immutable
Mapof consumers
-
getId
Description copied from interface:ItemAttributeReturns the identifier of the associatedSlimefunItem.- Specified by:
getIdin interfaceItemAttribute- Returns:
- the identifier of the
SlimefunItem
-
classifyLocation
Description copied from class:NetworkThis method assigns the givenLocationa type ofNetworkComponentfor classification.- Specified by:
classifyLocationin classNetwork- Parameters:
l- TheLocationto classify- Returns:
- The assigned type of
NetworkComponentfor thisLocation
-
onClassificationChange
public void onClassificationChange(org.bukkit.Location l, NetworkComponent from, NetworkComponent to) Description copied from class:NetworkThis method is called whenever aLocationin thisNetworkchanges its classification.- Specified by:
onClassificationChangein classNetwork- Parameters:
l- TheLocationthat is changing its classificationfrom- TheNetworkComponentthisLocationwas previously classified asto- TheNetworkComponentthisLocationis changing to
-
tick
-
getNetworkFromLocation
This attempts to get anEnergyNetfrom a givenLocation. If no suitableEnergyNetcould be found,nullwill be returned.- Parameters:
l- The targetLocation- Returns:
- The
EnergyNetat thatLocation, ornull
-
getNetworkFromLocationOrCreate
This attempts to get anEnergyNetfrom a givenLocation. If no suitableEnergyNetcould be found, a new one will be created.- Parameters:
l- The targetLocation- Returns:
- The
EnergyNetat thatLocation, or a new one
-