本文整理匯總了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;
}
}