当前位置: 首页>>代码示例>>Java>>正文


Java IEnergyStorage类代码示例

本文整理汇总了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));
    }
}
 
开发者ID:modmuss50,项目名称:Tesla-Flux,代码行数:11,代码来源:TeslaFlux.java

示例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);
}
 
开发者ID:halvors,项目名称:Electrometrics,代码行数:14,代码来源:GuiPowerBar.java

示例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;
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:13,代码来源:CoFHCore.java

示例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;
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:28,代码来源:DroneInteractRFImport.java

示例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;
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:28,代码来源:DroneInteractRFExport.java

示例6: EnergyGauge

import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
public EnergyGauge(GuiBase guibase, int i, int j, IEnergyStorage ienergystorage) {
	super(guibase, i, j, ienergystorage);
}
 
开发者ID:OreCruncher,项目名称:ThermalRecycling,代码行数:4,代码来源:EnergyGauge.java

示例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");
}
 
开发者ID:Tonius,项目名称:SimplyJetpacks,代码行数:5,代码来源:ElementEnergyStoredAdv.java

示例8: getBattery

import cofh.api.energy.IEnergyStorage; //导入依赖的package包/类
public abstract IEnergyStorage getBattery(); 
开发者ID:amadornes,项目名称:Connected,代码行数:2,代码来源:EntityRobotBase.java


注:本文中的cofh.api.energy.IEnergyStorage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。