本文整理汇总了Java中cofh.api.energy.EnergyStorage类的典型用法代码示例。如果您正苦于以下问题:Java EnergyStorage类的具体用法?Java EnergyStorage怎么用?Java EnergyStorage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnergyStorage类属于cofh.api.energy包,在下文中一共展示了EnergyStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TileEntityTransferNodeEnergy
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public TileEntityTransferNodeEnergy(final String s, final INodeBuffer buffer) {
super(s, buffer);
this.powerHandler = new EnergyStorage(10000);
this.powerHandlerIC2 = null;
this.powerInserted = 0;
this.lastStep = false;
this.searchLocations = new ArrayList<ChunkPos>();
this.clientele = new ArrayList<EnergyPosition>();
this.clientele_temp = new ArrayList<EnergyPosition>();
this.battery = null;
this.pr = 1.0f;
this.pg = 0.7f;
this.pb = 0.0f;
if (Loader.isModLoaded("IC2")) {
this.powerHandlerIC2 = new IC2EnergyHandler(this, 512, 1);
}
}
示例2: addInformation
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4) {
if (GuiScreen.isShiftKeyDown()) {
NBTTagCompound data = itemstack.stackTagCompound;
String renamingName = "";
EnergyStorage energy = new EnergyStorage(TileEntityRenamer.ENERGY_STORAGE);
energy.setEnergyStored(0);
if (data != null && data.hasKey("blockData")) {
NBTTagCompound tileEntity = data.getCompoundTag("blockData");
energy.readFromNBT(tileEntity);
renamingName = tileEntity.getString("settingName");
}
list.add(StatCollector.translateToLocal("message.rorysmod.energyStored") + " : " + energy.getEnergyStored() + "/" + energy.getMaxEnergyStored() + " RF");
list.add(StatCollector.translateToLocal("message.rorysmod.custName") + " : " + renamingName);
} else list.add(StatCollector.translateToLocal("message.rorysmod.holdShift1") + " " + EnumChatFormatting.YELLOW + EnumChatFormatting.ITALIC + StatCollector.translateToLocal("message.rorysmod.holdShift2") + EnumChatFormatting.RESET + EnumChatFormatting.GRAY + " " + StatCollector.translateToLocal("message.rorysmod.holdShift3"));
}
示例3: ContainerPack
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public ContainerPack(ItemStack chestplate, ItemPack packItem, PackBase pack) {
this.chestplate = chestplate;
this.packItem = packItem;
this.pack = pack;
int fuel = packItem.getFuelStored(chestplate);
int maxFuel = pack.tier > 9000 ? -1 : packItem.getMaxFuelStored(chestplate);
switch (pack.fuelType) {
case ENERGY:
this.energyStored = new EnergyStorage(maxFuel);
this.energyStored.setEnergyStored(fuel);
this.fluidStored = null;
break;
case FLUID:
this.energyStored = null;
this.fluidStored = new FluidTank(FluidRegistry.getFluid(pack.fuelFluid), fuel, maxFuel);
break;
default:
this.energyStored = null;
this.fluidStored = null;
}
this.lastFuel = fuel;
}
示例4: TileEntityEnderQuarry
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public TileEntityEnderQuarry() {
this.items = new ArrayList<ItemStack>();
this.dx = 1;
this.dy = 0;
this.dz = 0;
this.energy = new EnergyStorage(10000000);
this.inventoryMask = -1;
this.fluidMask = -1;
this.progress = 0L;
this.neededEnergy = -1;
this.started = false;
this.finished = false;
this.fluid = null;
this.chunk_x = 0;
this.chunk_z = 0;
this.chunk_y = 0;
this.t = 0;
this.searching = false;
this.fence_x = this.xCoord;
this.fence_y = this.yCoord;
this.fence_z = this.zCoord;
this.fence_dir = 2;
this.fence_elev = -1;
this.min_x = this.xCoord;
this.max_x = this.xCoord;
this.min_z = this.zCoord;
this.max_z = this.zCoord;
this.overClock = false;
this.upgrades = new boolean[16];
}
示例5: transferTo
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
@Override
public boolean transferTo(final INodeBuffer receptor, final int no) {
if (this.isEmpty() || !this.getBufferType().equals(receptor.getBufferType())) {
return false;
}
final EnergyStorage t = (EnergyStorage)receptor.getBuffer();
final int e = t.receiveEnergy(this.getBuffer().extractEnergy(no * 240, true), true);
if (e <= 0) {
return false;
}
t.receiveEnergy(this.getBuffer().extractEnergy(e, false), false);
return true;
}
示例6: TileEntityEnderThermicLavaPump
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public TileEntityEnderThermicLavaPump() {
this.owner = null;
this.finished = false;
this.pump_y = -1;
this.chunk_x = 0;
this.chunk_z = 0;
this.b = 0;
this.find_new_block = false;
this.init = false;
this.chunk_no = -1;
this.p = 0.95f;
this.cofhEnergy = new EnergyStorage(10000);
this.tank = new FluidTank(1000);
}
示例7: TileEntityGenerator
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public TileEntityGenerator() {
this.storage = new EnergyStorage(100000);
this.rotation = 0;
this.coolDown = 0.0;
this.c = -1;
this.initPower = true;
this.playSound = false;
this.multiplier = -1;
this.divisor = -1.0;
this.shouldInit = true;
}
示例8: getStorage
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public EnergyStorage getStorage() {
if (this.initPower && this.worldObj != null && !this.worldObj.isRemote && this.worldObj.blockExists(this.x(), this.y(), this.z())) {
this.initPower = false;
this.storage.setCapacity(100000 * this.getMultiplier());
this.storage.setMaxTransfer(100000 * this.getMultiplier());
}
return this.storage;
}
示例9: TEInductionSmelter
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public TEInductionSmelter() {
this.storage = new ItemStack[3];
this.broadcastRange = 8;
this.model = new ModelInductionSmelter();
this.maxTemp = 3500;
this.minTemp = 3300;
this.heating = false;
this.textureAnimationDir = 1;
this.battery = new EnergyStorage(ModOptions.cfgInductionSmelterRFStorage, EnergyTier.getRate(EnergyTier.HV));
}
示例10: TileSolarGenerator
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public TileSolarGenerator()
{
battery = new EnergyStorage(30000,0,120);
tank = new FluidTank(4000);
generationTimer = 0;
timer = 0;
}
示例11: TileEntityEnergyPrefab
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
protected TileEntityEnergyPrefab(TileEntityFactoryProduct registeredMachine)
{
super( registeredMachine );
// Grab energy information from factory product.
EnergySupported[] energySupported = registeredMachine.getEnergySupported();
if (energySupported != null && energySupported.length >= 1)
{
for (int i = 0; i < energySupported.length; i++)
{
EnergySupported energyInterface = energySupported[i];
// TODO: Only 1 energy storage handler is supported at this time.
this.energy = new EnergyStorage( energyInterface.getEnergyCapacity(),
energyInterface.getEnergyMaxRecieve(),
energyInterface.getEnergyMaxExtract() );
// Consumption and production information for generators.
this.energyConsumeRate = energyInterface.getConsumptionRate();
this.energyProduceRate = energyInterface.getProductionRate();
}
}
else
{
// No energy is used if we just call to the object without the other overload.
this.energy = new EnergyStorage( 0,
0,
0 );
}
}
示例12: readFromNBT
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT( nbt );
// Load only the amount of power since everything will be established if this exists.
if (this.energy != null)
{
// Current amount of energy.
this.energy.readFromNBT( nbt );
}
else
{
// Consumption amount.
this.energyConsumeRate = nbt.getInteger( "energyConsumeRate" );
// Production amount.
this.energyProduceRate = nbt.getInteger( "energyProduceRate" );
// Current energy levels.
int currentEnergy = nbt.getInteger( "energy" );
// Maximum amount of energy.
int maximumEnergy = nbt.getInteger( "energyMax" );
// Maximum receive energy.
int maxRecieve = nbt.getInteger( "energyMaxReceive" );
// Maximum extract energy.
int maxExtract = nbt.getInteger( "energyMaxExtract" );
// Re-create energy state from NBT save data.
this.energy = new EnergyStorage( maximumEnergy,
maxRecieve,
maxExtract );
this.energy.modifyEnergyStored( currentEnergy );
}
}
示例13: ContainerRF
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
public ContainerRF(InventoryPlayer inventoryPlayer, TileEntityPneumaticBase te){
super(inventoryPlayer, te);
energyHandler = (IEnergyInfo)te;
try {
addSyncedField(new SyncedField.SyncedInt(((IRFConverter)te).getEnergyStorage(), EnergyStorage.class.getDeclaredField("energy")));
} catch(Throwable e) {
e.printStackTrace();
}
}
示例14: readFromNBT
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
@Override
public EnergyStorage readFromNBT(final NBTTagCompound nbt) {
return super.readFromNBT(nbt);
}
示例15: getBuffer
import cofh.api.energy.EnergyStorage; //导入依赖的package包/类
@Override
public EnergyStorage getBuffer() {
return this.node.powerHandler;
}