本文整理汇总了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();
}
示例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);
}
示例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;
}
}
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
示例7: getPowerReceiver
import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side) {
return powerHandler.getPowerReceiver();
}
示例8: getPowerReceiver
import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side) {
return this.buildcraftPowerHandler.getPowerReceiver();
}
示例9: getPowerReceiver
import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side) {
return buildcraftPowerHandler.getPowerReceiver();
}
示例10: getPowerReceiver
import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
return m_PowerHandler.getPowerReceiver();
}
示例11: getPowerReceiver
import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
/**
* BuildCraft functions
*/
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
return this.powerHandler.getPowerReceiver();
}
示例12: getPowerReceiver
import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
this.initBuildCraft();
return this.bcPowerHandler.getPowerReceiver();
}
示例13: getPowerReceiver
import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
return powerHandler.getPowerReceiver();
}
示例14: getPowerReceiver
import buildcraft.api.power.PowerHandler.PowerReceiver; //导入依赖的package包/类
@Override
public PowerReceiver getPowerReceiver(ForgeDirection side)
{
return this.powerHandler.getPowerReceiver();
}
示例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);