本文整理匯總了Java中cofh.api.energy.IEnergyHandler.getEnergyStored方法的典型用法代碼示例。如果您正苦於以下問題:Java IEnergyHandler.getEnergyStored方法的具體用法?Java IEnergyHandler.getEnergyStored怎麽用?Java IEnergyHandler.getEnergyStored使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cofh.api.energy.IEnergyHandler
的用法示例。
在下文中一共展示了IEnergyHandler.getEnergyStored方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doBlockDamage
import cofh.api.energy.IEnergyHandler; //導入方法依賴的package包/類
@Override
public void doBlockDamage() {
List<Location> locations = ShapeUtil.getSphere(new Location(world, vector), SIZE);
for (Location loc : locations) {
if (loc.hasTileEntity() && loc.getTileEntity() instanceof IEnergyHandler) {
IEnergyHandler energy = (IEnergyHandler) loc.getTileEntity();
while (energy.getEnergyStored(ForgeDirection.UNKNOWN) > 0) {
energy.extractEnergy(ForgeDirection.UNKNOWN, energy.getEnergyStored(ForgeDirection.UNKNOWN), false);
}
}
}
}
示例2: updateEntity
import cofh.api.energy.IEnergyHandler; //導入方法依賴的package包/類
@Override
public void updateEntity() {
if(cooldown==0){
TileEntity tile = getTileFromOrientation();
if(tile!=null&&tile instanceof IEnergyHandler){
IEnergyHandler teen = (IEnergyHandler) tile;
switch(this.blockMetadata){
case 0:
if(teen.getEnergyStored(getDirFromOrientation())==teen.getMaxEnergyStored(getDirFromOrientation())){
setRedstoneOutput(true);
} else {
setRedstoneOutput(false);
}
break;
case 1:
if(teen.getEnergyStored(getDirFromOrientation())==0){
setRedstoneOutput(true);
} else {
setRedstoneOutput(false);
}
break;
case 2:
if(teen.getEnergyStored(getDirFromOrientation())<=(teen.getMaxEnergyStored(getDirFromOrientation()))*0.8F){
setRedstoneOutput(true);
} else {
setRedstoneOutput(false);
}
break;
case 3:
if(teen.getEnergyStored(getDirFromOrientation())<=(teen.getMaxEnergyStored(getDirFromOrientation()))*0.2F){
setRedstoneOutput(true);
} else {
setRedstoneOutput(false);
}
break;
}
}
cooldown = 20;
} else if(cooldown==5){
int id = getBlockIdOppositeFromOrientation();
if(id!=Ids.actualPowerBlock){
if(id<0){
setBlockIdOppositeFromOrientation(Ids.actualPowerBlock);
} else {
}
}
} else {
cooldown--;
}
}