本文整理汇总了Java中cofh.api.energy.IEnergyStorage类的典型用法代码示例。如果您正苦于以下问题:Java IEnergyStorage类的具体用法?Java IEnergyStorage怎么用?Java IEnergyStorage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IEnergyStorage类属于cofh.api.energy包,在下文中一共展示了IEnergyStorage类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTELoad
import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
@SubscribeEvent
public void onTELoad(AttachCapabilitiesEvent.TileEntity event) {
TileEntity tile = event.getTileEntity();
if (tile instanceof IEnergyConnection || tile instanceof IEnergyStorage) {
if(tile.hasCapability(TeslaCapabilities.CAPABILITY_CONSUMER, null) || !tile.hasCapability(TeslaCapabilities.CAPABILITY_HOLDER, null) || !tile.hasCapability(TeslaCapabilities.CAPABILITY_PRODUCER, null)){
return;
}
event.addCapability(new ResourceLocation("teslaflux:tesla"), new TeslaCapabilityProvider(tile));
}
}
示例2: GuiPowerBar
import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
public GuiPowerBar(IGui gui, final IEnergyStorage energyStorage, ResourceLocation defaultResource, int x, int y) {
this(gui, new IPowerInfoHandler() {
@Override
public String getTooltip() {
return EnergyUtils.getEnergyDisplay(energyStorage.getEnergyStored());
}
@Override
public double getLevel() {
return energyStorage.getEnergyStored() / energyStorage.getMaxEnergyStored();
}
}, defaultResource, x, y);
}
示例3: getEnergyStorage
import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
public static IEnergyStorage getEnergyStorage(IDrone entity){
ExtendedPropertyRF property = (ExtendedPropertyRF)entity.getProperty("PneumaticCraft_RF");
if(property == null) {
property = new ExtendedPropertyRF();
entity.setProperty("PneumaticCraft_RF", property);
} else {
property.energy.setCapacity(100000 + 100000 * entity.getUpgrades(ItemMachineUpgrade.UPGRADE_DISPENSER_DAMAGE));
property.energy.setMaxExtract(property.energy.getMaxEnergyStored() / 100);
property.energy.setMaxReceive(property.energy.getMaxExtract());
}
return property.energy;
}
示例4: doInteract
import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
@Override
public boolean doInteract(ChunkPosition pos, IDrone drone, IBlockInteractHandler interactHandler, boolean simulate){
IEnergyStorage droneEnergy = CoFHCore.getEnergyStorage(drone);
if(droneEnergy.getEnergyStored() == droneEnergy.getMaxEnergyStored()) {
interactHandler.abort();
return false;
} else {
TileEntity te = drone.getWorld().getTileEntity(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
if(te instanceof IEnergyProvider) {
IEnergyProvider provider = (IEnergyProvider)te;
for(ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if(interactHandler.getSides()[d.ordinal()]) {
int transferedEnergy = droneEnergy.receiveEnergy(provider.extractEnergy(d, interactHandler.useCount() ? interactHandler.getRemainingCount() : Integer.MAX_VALUE, true), true);
if(transferedEnergy > 0) {
if(!simulate) {
interactHandler.decreaseCount(transferedEnergy);
droneEnergy.receiveEnergy(transferedEnergy, false);
provider.extractEnergy(d, transferedEnergy, false);
}
return true;
}
}
}
}
return false;
}
}
示例5: doInteract
import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
@Override
public boolean doInteract(ChunkPosition pos, IDrone drone, IBlockInteractHandler interactHandler, boolean simulate){
IEnergyStorage droneEnergy = CoFHCore.getEnergyStorage(drone);
if(droneEnergy.getEnergyStored() == 0) {
interactHandler.abort();
return false;
} else {
TileEntity te = drone.getWorld().getTileEntity(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
if(te instanceof IEnergyReceiver) {
IEnergyReceiver receiver = (IEnergyReceiver)te;
for(ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if(interactHandler.getSides()[d.ordinal()]) {
int transferedEnergy = droneEnergy.extractEnergy(receiver.receiveEnergy(d, interactHandler.useCount() ? interactHandler.getRemainingCount() : Integer.MAX_VALUE, true), true);
if(transferedEnergy > 0) {
if(!simulate) {
interactHandler.decreaseCount(transferedEnergy);
droneEnergy.extractEnergy(transferedEnergy, false);
receiver.receiveEnergy(d, transferedEnergy, false);
}
return true;
}
}
}
}
return false;
}
}
示例6: EnergyGauge
import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
public EnergyGauge(GuiBase guibase, int i, int j, IEnergyStorage ienergystorage) {
super(guibase, i, j, ienergystorage);
}
示例7: ElementEnergyStoredAdv
import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
public ElementEnergyStoredAdv(GuiBase gui, int posX, int posY, IEnergyStorage storage) {
super(gui, posX, posY, storage);
this.texture = new ResourceLocation(SimplyJetpacks.RESOURCE_PREFIX + "textures/gui/elements/energy.png");
}
示例8: getBattery
import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
public abstract IEnergyStorage getBattery();