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


Java PowerReceiver类代码示例

本文整理汇总了Java中buildcraft.api.power.PowerHandler.PowerReceiver的典型用法代码示例。如果您正苦于以下问题:Java PowerReceiver类的具体用法?Java PowerReceiver怎么用?Java PowerReceiver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PowerReceiver类属于buildcraft.api.power.PowerHandler包,在下文中一共展示了PowerReceiver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
/**
 * BuildCraft functions
 */
@RuntimeInterface(clazz = "buildcraft.api.power.IPowerReceptor", modID = "")
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
    if (this.getNetwork() == null)
    {
        return null;
    }

    double requiredEnergy = this.getNetwork().getRequest(this) / EnergyConfigHandler.BC3_RATIO;
    
    if (requiredEnergy <= 0.1D)
    {
    	requiredEnergy = 0;
    }
    
    ((PowerHandler) this.powerHandlerBC).configure(0, requiredEnergy, 0, requiredEnergy);
    return ((PowerHandler) this.powerHandlerBC).getPowerReceiver();
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:22,代码来源:TileBaseUniversalConductor.java

示例2: attemptToSendBCEnergy

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
private void attemptToSendBCEnergy(ForgeDirection orientation) {
  int x1 = xCoord + orientation.offsetX;
  int y1 = yCoord + orientation.offsetY;
  int z1 = zCoord + orientation.offsetZ;
  if (y1 < 0 || y1 > 255) return;
  Chunk c1 = ChunkCache.getChunk(worldObj, x1 >> 4, z1 >> 4, false);
  if (c1 == null) return;
  TileEntity entity = c1.getChunkBlockTileEntity(x1 & 15, y1, z1 & 15);
  if (!isPoweredTile(entity, orientation)) return;
  PowerReceiver receptor = ((IPowerReceptor) entity).getPowerReceiver(orientation.getOpposite());
  double minEnergyToSend = receptor.getMinEnergyReceived();
  double maxEnergyToSend = receptor.getMaxEnergyReceived();
  maxEnergyToSend = Math.min(maxEnergyToSend, getFFMaxSendableEnergy() * ffToBcEnergy);
  // Too little energy, don't send anything
  if (ffEnergy * ffToBcEnergy < minEnergyToSend) return;
  float energySent = (float) Math.min(ffEnergy * ffToBcEnergy, maxEnergyToSend);
  energySent = receptor.receiveEnergy(PowerHandler.Type.ENGINE, energySent, orientation.getOpposite());
  ffEnergy -= energySent / ffToBcEnergy;
  //System.out.println("Sending energy: " + energySent);
}
 
开发者ID:mbrx,项目名称:FysiksFun,代码行数:21,代码来源:TileEntityTurbineBase.java

示例3: pushOutEnergy

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
private void pushOutEnergy()
{
    ForgeDirection side = getOrientation();
    TileEntity output = worldObj.getBlockTileEntity(xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ);

    if (output instanceof IPowerReceptor)
    {
        IPowerReceptor receptor = (IPowerReceptor) output;
        PowerReceiver reciver = receptor.getPowerReceiver(side);

        if (reciver != null)
        {
            float amount = reciver.receiveEnergy(Type.ENGINE, m_StoredMJ, side.getOpposite());
            m_StoredMJ -= amount;
        }
    }
}
 
开发者ID:kiljacken,项目名称:AestusCraft,代码行数:18,代码来源:TileEricssonEngine.java

示例4: sendPower

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
private void sendPower()
{
    TileEntity tile = this.tilesOnSides[this.orientation.ordinal()];

    if (tile instanceof IPowerReceptor)
    {
        if (((IPowerReceptor)tile).getPowerReceiver(this.orientation) != null)
        {
            PowerReceiver receptor = ((IPowerReceptor)tile).getPowerReceiver(this.orientation);
            float needed = extractEnergy(receptor.getMinEnergyReceived(), receptor.getMaxEnergyReceived(), false);

            if (needed > 0)
            {
                currentOutput = receptor.receiveEnergy(PowerHandler.Type.ENGINE, needed, this.orientation.getOpposite());
                extractEnergy(receptor.getMinEnergyReceived(), currentOutput, true);
            }
        }
    }
}
 
开发者ID:adamros,项目名称:Transducers,代码行数:20,代码来源:AbstractElectricEngine.java

示例5: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@RuntimeInterface(clazz = "buildcraft.api.power.IPowerReceptor", modID = "")
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
    if (this.getElectricalInputDirections().contains(side))
    {
        this.initBuildCraft();
        return ((PowerHandler) this.powerHandlerBC).getPowerReceiver();
    }

    return null;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:12,代码来源:TileBaseUniversalElectrical.java

示例6: produceBuildCraft

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
public boolean produceBuildCraft(ForgeDirection outputDirection)
{
	if (!this.worldObj.isRemote && outputDirection != null && outputDirection != ForgeDirection.UNKNOWN)
	{
		float provide = this.getProvide(outputDirection);

		if (this.getEnergyStored() >= provide && provide > 0)
		{
			if (Compatibility.isBuildcraftLoaded())
			{
				TileEntity tileEntity = new Vector3(this).modifyPositionFromSide(outputDirection).getTileEntity(this.worldObj);

				if (tileEntity instanceof IPowerReceptor)
				{
					PowerReceiver receiver = ((IPowerReceptor) tileEntity).getPowerReceiver(outputDirection.getOpposite());

					if (receiver != null)
					{
						if (receiver.powerRequest() > 0)
						{
							float bc3Provide = provide * Compatibility.TO_BC_RATIO;
							float energyUsed = Math.min(receiver.receiveEnergy(this.bcBlockType, bc3Provide, outputDirection.getOpposite()), bc3Provide);
							this.provideElectricity(energyUsed * Compatibility.TO_BC_RATIO, true);
						}
					}

					return true;
				}
			}
		}
	}

	return false;
}
 
开发者ID:tterrag1098,项目名称:SimpleTransmutations,代码行数:35,代码来源:TileEntityUniversalElectrical.java

示例7: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side) {
	return powerHandler.getPowerReceiver();
}
 
开发者ID:ZippyIO,项目名称:IgnitionUtilities,代码行数:5,代码来源:TilePulverizier.java

示例8: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side) {
    return this.buildcraftPowerHandler.getPowerReceiver();
}
 
开发者ID:myoKun345,项目名称:ElementalExperimentation,代码行数:5,代码来源:TileEntityCentrifuge.java

示例9: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side) {
    return buildcraftPowerHandler.getPowerReceiver();
}
 
开发者ID:myoKun345,项目名称:ElementalExperimentation,代码行数:5,代码来源:TileEntityCondensator.java

示例10: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
    return m_PowerHandler.getPowerReceiver();
}
 
开发者ID:kiljacken,项目名称:AestusCraft,代码行数:6,代码来源:TileFrictionHeater.java

示例11: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
/**
 * BuildCraft functions
 */
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
	return this.powerHandler.getPowerReceiver();
}
 
开发者ID:tterrag1098,项目名称:SimpleTransmutations,代码行数:9,代码来源:TileEntityUniversalConductor.java

示例12: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
	this.initBuildCraft();
	return this.bcPowerHandler.getPowerReceiver();
}
 
开发者ID:tterrag1098,项目名称:SimpleTransmutations,代码行数:7,代码来源:TileEntityUniversalElectrical.java

示例13: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
    return powerHandler.getPowerReceiver();
}
 
开发者ID:adamros,项目名称:Transducers,代码行数:6,代码来源:HighThroughputPowerPipe.java

示例14: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
    return this.powerHandler.getPowerReceiver();
}
 
开发者ID:adamros,项目名称:Transducers,代码行数:6,代码来源:AbstractElectricEngine.java

示例15: getPowerReceiver

import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
/**
 * Get the PowerReceiver for this side of the block. You can return the same
 * PowerReceiver for all sides or one for each side.
 *
 * You should NOT return null to this method unless you mean to NEVER
 * receive power from that side. Returning null, after previous returning a
 * PowerReceiver, will most likely cause pipe connections to derp out and
 * engines to eventually explode.
 *
 * @param side
 * @return
 */
public PowerReceiver getPowerReceiver(ForgeDirection side);
 
开发者ID:kiljacken,项目名称:AestusCraft,代码行数:14,代码来源:IPowerReceptor.java


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