當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。