-
Notifications
You must be signed in to change notification settings - Fork 5
Using the API
SimElectricity provides a set of powerful APIs. Most of them are located in the package simelectricity.api
.
Expose the API functions that you can call. isSELoaded
indicates the existence of SimElectricity EnergyNet, it becomes true after the initialization phase, if SimElectricity is installed. energyNetAgent
provides access to the EnergyNet, e.g. change connection and parameters of machines and cables, retrieve simulation results, these concepts will be covered in later sections. SETab
points to the SimElectricity CreativeTab, managementToolItem
points to the Item "EnergyNet Management Tool" (the one with a frog icon). configManager
allows you to add custom settings to the SimElectricity configuration page, custom configuration handler should implement interface ISEConfigHandler
and should be register in the pre-init phase, See this for an example.
Note: Before uisng the SEAPI, you should add dependencies = "required-after:simelectricity"
to your @Mod
annotation (Usually in the main file of your mod), so that SimElectricity will always be loaded when you need to call the API.
These interfaces should be implement by machine/cable if they need to support corresponding function. ISEWrenchable
handles the changes to machines' functional side (the side connected to the EnergyNet). ISESidedFacing
controls the machine appearance and orientation, sometimes the function, in SimElectricity Essential, the item "Glove" will attempt to call this interface. ISECrowbarTarget
handles the interaction between machine/cable and item "Crowbar", in most case crowbar is used to removed cover panels from machines/cable.
Note: The actual action (call to onWrenchAction
, setFacing
and onCrowbarAction
) is performed on server-side only, it is the developer's responsibility to inform the client about the changes!