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


Java ForgeDirection.getOpposite方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:27,代码来源:TileEntityResistor.java

示例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();
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:8,代码来源:EndRod.java

示例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);
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:12,代码来源:PipeCrossOver.java

示例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;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:11,代码来源:PipeBase.java

示例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;
    }
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:15,代码来源:TileEntityTransistor.java

示例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;
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:11,代码来源:TileEntityDiode.java

示例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;
    }
}
 
开发者ID:XFactHD,项目名称:RFUtilities,代码行数:16,代码来源:TileEntityRFMeter.java


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