This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
EnergonRelics/src/main/java/com/thebrokenrail/energonrelics/api/block/entity/helper/EnergyGenerator.java

37 lines
855 B
Java

package com.thebrokenrail.energonrelics.api.block.entity.helper;
import com.thebrokenrail.energonrelics.api.energy.Action;
/**
* Interface Of A Block That Generates Energy
*/
public interface EnergyGenerator {
/**
* Handle Propagated Action
* @param action Action
*/
default void handlePropagatedActionWithGenerator(Action.PropagatedAction action) {
long amount = Math.min(getEnergy(), action.amountOwed());
setEnergy(getEnergy() - amount);
action.pay(amount);
}
/**
* Get Current Energy level
* @return Energy Level
*/
long getEnergy();
/**
* Set New Energy Level
* @param value New Energy Level
*/
void setEnergy(long value);
/**
* Get Energy To Be Displayed On Multimeter
* @return Energy Level
*/
long getDisplayEnergy();
}