本文整理汇总了Java中net.minecraftforge.common.util.ForgeDirection.getOpposite方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeDirection.getOpposite方法的具体用法?Java ForgeDirection.getOpposite怎么用?Java ForgeDirection.getOpposite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.util.ForgeDirection
的用法示例。
在下文中一共展示了ForgeDirection.getOpposite方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: receiveEnergy
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public int receiveEnergy(ForgeDirection fd, int amount, boolean simulate)
{
//if (transferOncePerTick && !wait)
//{
// wait = true;
//}
ForgeDirection opposite = fd.getOpposite();
TileEntity te = worldObj.getTileEntity(xCoord + opposite.offsetX, yCoord, zCoord + opposite.offsetZ);
if (canConnectEnergy(fd) && te instanceof IEnergyReceiver && (((IEnergyReceiver)te).receiveEnergy(fd, amount, true) > 0))
{
if (amount<=throughput)
{
return ((IEnergyReceiver)te).receiveEnergy(fd, amount, simulate);
}
else
{
return ((IEnergyReceiver)te).receiveEnergy(fd, throughput, simulate);
}
}
else
{
return 0;
}
}
示例2: onBlockPlaced
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) {
ForgeDirection dir = ForgeDirection.getOrientation(side).getOpposite();
if (world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) != this)
dir = dir.getOpposite();
return dir.ordinal();
}
示例3: canInput
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public boolean canInput(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection dir) {
if (dir == ForgeDirection.UNKNOWN) {
return false;
}
final IPipe pipe = TNHelper.getPipe(world, x + dir.getOpposite().offsetX, y + dir.getOpposite().offsetY, z + dir.getOpposite().offsetZ);
if (pipe == null) {
return super.shouldConnectToTile(world, x, y, z, dir.getOpposite());
}
return pipe.getPipeType().equals(this.getPipeType()) || pipe.canInput(world, x + dir.getOpposite().offsetX, y + dir.getOpposite().offsetY, z + dir.getOpposite().offsetZ, dir);
}
示例4: getOutputDirections
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public ArrayList<ForgeDirection> getOutputDirections(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection dir, final INodeBuffer buffer) {
final ArrayList<ForgeDirection> results = new ArrayList<ForgeDirection>();
for (final ForgeDirection d : TNHelper.randomDirections()) {
if (d != dir.getOpposite() && TNHelper.canOutput(world, x, y, z, d) && TNHelper.canInput(world, x + d.offsetX, y + d.offsetY, z + d.offsetZ, d.getOpposite())) {
results.add(d);
}
}
return results;
}
示例5: receiveEnergy
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public int receiveEnergy(ForgeDirection fd, int amount, boolean simulate)
{
ForgeDirection opposite = fd.getOpposite();
TileEntity te = worldObj.getTileEntity(xCoord + opposite.offsetX, yCoord, zCoord + opposite.offsetZ);
if (canConnectEnergy(fd) && te instanceof IEnergyReceiver && (((IEnergyReceiver)te).receiveEnergy(fd, amount, true) > 0) && isOn)
{
return ((IEnergyReceiver)te).receiveEnergy(fd, amount, simulate);
}
else
{
return 0;
}
}
示例6: receivePower
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
private int receivePower(ForgeDirection fd, int amount, boolean simulate)
{
ForgeDirection opposite = fd.getOpposite();
TileEntity te = worldObj.getTileEntity(xCoord+opposite.offsetX, yCoord, zCoord+opposite.offsetZ);
if (te instanceof IEnergyReceiver && ((IEnergyReceiver)te).receiveEnergy(fd, amount, true) > 0)
{
return ((IEnergyReceiver)te).receiveEnergy(fd, amount, simulate);
}
return 0;
}
示例7: receiveEnergy
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public int receiveEnergy(ForgeDirection fd, int amount, boolean simulate)
{
ForgeDirection opposite = fd.getOpposite();
TileEntity te = worldObj.getTileEntity(xCoord + opposite.offsetX, yCoord, zCoord + opposite.offsetZ);
if (canConnectEnergy(fd) && te instanceof IEnergyHandler && (((IEnergyHandler)te).receiveEnergy(fd, amount, true) > 0))
{
transferedRF = transferedRF + ((IEnergyHandler)te).receiveEnergy(fd, amount, true);
return lastRF = ((IEnergyHandler)te).receiveEnergy(fd, amount, simulate);
}
else
{
return 0;
}
}