當前位置: 首頁>>代碼示例>>Java>>正文


Java ForgeDirection.ordinal方法代碼示例

本文整理匯總了Java中net.minecraftforge.common.util.ForgeDirection.ordinal方法的典型用法代碼示例。如果您正苦於以下問題:Java ForgeDirection.ordinal方法的具體用法?Java ForgeDirection.ordinal怎麽用?Java ForgeDirection.ordinal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.common.util.ForgeDirection的用法示例。


在下文中一共展示了ForgeDirection.ordinal方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBlockPlaced

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
public int onBlockPlaced(final World par1World, final int par2, final int par3, final int par4, int par5, final float par6, final float par7, final float par8, final int par9) {
    final int meta = par5 % 6;
    final int flag = 0;
    final ForgeDirection side = ForgeDirection.getOrientation(meta);
    if (!par1World.isSideSolid(par2 - side.offsetX, par3 - side.offsetY, par4 - side.offsetZ, side.getOpposite())) {
        for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            if (side != dir) {
                if (par1World.isSideSolid(par2 - dir.offsetX, par3 - dir.offsetY, par4 - dir.offsetZ, dir.getOpposite())) {
                    return flag + dir.ordinal();
                }
                if (par1World.getBlock(par2 - dir.offsetX, par3 - dir.offsetY, par4 - dir.offsetZ) == this) {
                    par5 = par1World.getBlockMetadata(par2 - dir.offsetX, par3 - dir.offsetY, par4 - dir.offsetZ) % 6;
                }
            }
        }
    }
    return flag + par5;
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:19,代碼來源:BlockSpike.java

示例2: modifyPositionFromSide

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
public Vector3 modifyPositionFromSide(Vector3 vec, ForgeDirection side, double amount)
{
    switch (side.ordinal())
    {
    case 0:
        vec.y -= amount;
        break;
    case 1:
        vec.y += amount;
        break;
    case 2:
        vec.z -= amount;
        break;
    case 3:
        vec.z += amount;
        break;
    case 4:
        vec.x -= amount;
        break;
    case 5:
        vec.x += amount;
        break;
    }
    return vec;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:26,代碼來源:BlockAirLockFrame.java

示例3: canConnect

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
@Override
public boolean canConnect(ForgeDirection direction, NetworkType type)
{
    if (direction == null || direction.equals(ForgeDirection.UNKNOWN))
    {
        return false;
    }

    if (type == NetworkType.OXYGEN)
    {
        return this.getOxygenOutputDirection() == direction.ordinal();
    }

    if (type == NetworkType.HYDROGEN)
    {
        return this.getHydrogenOutputDirection() == direction.ordinal();
    }

    if (type == NetworkType.POWER)
    {
    	return direction == this.getElectricInputDirection();
    }
    
    return false;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:26,代碼來源:TileEntityElectrolyzer.java

示例4: getConnectedAcceptors

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
/**
 * Gets all the acceptors around a tile entity.
 * @param tileEntity - center tile entity
 * @return array of IGasAcceptors
 */
public static IGasHandler[] getConnectedAcceptors(TileEntity tileEntity)
{
	IGasHandler[] acceptors = new IGasHandler[] {null, null, null, null, null, null};

	for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
	{
		TileEntity acceptor = Coord4D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.getWorldObj());

		if(acceptor instanceof IGasHandler)
		{
			acceptors[orientation.ordinal()] = (IGasHandler)acceptor;
		}
	}

	return acceptors;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:22,代碼來源:GasTransmission.java

示例5: drain

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
    int metaside = this.getBlockMetadata() + 2;
    int side = from.ordinal();
    if (side == (metaside ^ 1))
    {
        if (resource != null && resource.isFluidEqual(this.liquidTank2.getFluid()))
            return this.liquidTank2.drain(resource.amount, doDrain);
    }

    //2->5 3->4 4->2 5->3
    if (7 - (metaside ^ (metaside > 3 ? 0 : 1)) == (side ^ 1))
    {
        if (resource != null && resource.isFluidEqual(this.liquidTank.getFluid()))
            return this.liquidTank.drain(resource.amount, doDrain);
    }

    return null;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:21,代碼來源:TileEntityElectrolyzer.java

示例6: 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

示例7: receiveHydrogen

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
public float receiveHydrogen(ForgeDirection from, float receive, boolean doReceive)
{
	if (from.ordinal() == this.getBlockMetadata() + 2 && this.shouldPullHydrogen())
   	{
        FluidStack fluidToFill = FluidRegistry.getFluidStack("hydrogen", (int) (receive));
    	return this.gasTank.fill(fluidToFill, doReceive);
   	}
   	
   	return 0;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:11,代碼來源:TileEntityMethaneSynthesizer.java

示例8: reloadBlockMasks

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
public void reloadBlockMasks() {
    this.blockMasks = 0;
    for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
        PipePart.dummyPipes[dir.ordinal()].h = 0.5f - this.baseSize();
        if (!this.tile().canAddPart((TMultiPart)PipePart.dummyPipes[dir.ordinal()])) {
            this.blockMasks |= this.flagmasks[dir.ordinal()];
        }
    }
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:10,代碼來源:PipePart.java

示例9: receiveOxygen

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
@Override
public float receiveOxygen(ForgeDirection from, float receive, boolean doReceive)
{
	if (from.ordinal() == this.getBlockMetadata() + 2 && this.shouldPullOxygen())
   	{
		float conversion = 2F * Constants.LOX_GAS_RATIO;
        FluidStack fluidToFill = new FluidStack(AsteroidsModule.fluidOxygenGas, (int) (receive * conversion));
    	int used = MathHelper.ceiling_float_int(this.gasTank.fill(fluidToFill, doReceive) / conversion);
		return used;
   	}
   	
   	return 0;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:14,代碼來源:TileEntityGasLiquefier.java

示例10: canFill

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
    if (from.ordinal() == this.getBlockMetadata() + 2)
    {
        //Can fill with water
        return fluid != null && fluid.getName().equals(FluidRegistry.WATER.getName());
    }

    return false;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:12,代碼來源:TileEntityElectrolyzer.java

示例11: getIconIndex

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
@Override
public int getIconIndex(ForgeDirection direction) {
	if (direction == ForgeDirection.UNKNOWN) {
		return standardIconIndex;
	} else {
		int metadata = container.getBlockMetadata();

		if (metadata != direction.ordinal()) {
			return solidIconIndex;
		} else {
			return standardIconIndex;
		}
	}
}
 
開發者ID:Shurgent,項目名稱:TFCTech,代碼行數:15,代碼來源:PipeItemsWroughtIron.java

示例12: getAdjacentHydrogenConnections

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
public static TileEntity[] getAdjacentHydrogenConnections(TileEntity tile)
{
    TileEntity[] adjacentConnections = new TileEntity[ForgeDirection.VALID_DIRECTIONS.length];

    boolean isMekLoaded = EnergyConfigHandler.isMekanismLoaded();

    BlockVec3 thisVec = new BlockVec3(tile);
    for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
    {
        TileEntity tileEntity = thisVec.getTileEntityOnSide(tile.getWorldObj(), direction);

        if (tileEntity instanceof IConnector)
        {
            if (((IConnector) tileEntity).canConnect(direction.getOpposite(), NetworkType.HYDROGEN))
            {
                adjacentConnections[direction.ordinal()] = tileEntity;
            }
        }
        else if (isMekLoaded)
        {
            if (tileEntity instanceof ITubeConnection && (!(tileEntity instanceof IGasTransmitter) || TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, tileEntity)))
            {
                if (((ITubeConnection) tileEntity).canTubeConnect(direction))
                {
                    adjacentConnections[direction.ordinal()] = tileEntity;
                }
            }
        }
    }

    return adjacentConnections;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:33,代碼來源:TileEntityHydrogenPipe.java

示例13: canDrain

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
    int metaside = this.getBlockMetadata() + 2;
    int side = from.ordinal();
    if (side == (metaside ^ 1))
        return this.liquidTank2.getFluid() != null && this.liquidTank2.getFluidAmount() > 0;

    //2->5 3->4 4->2 5->3
    if (7 - (metaside ^ (metaside > 3 ? 0 : 1)) == (side ^ 1))
        return this.liquidTank.getFluid() != null && this.liquidTank.getFluidAmount() > 0;

    return false;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:15,代碼來源:TileEntityElectrolyzer.java

示例14: updateSources

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
private void updateSources(ForgeDirection source) {
	if (sourcesTracker.markTimeIfDelay(receptor.getWorld(), 1)) {
		for (int i = 0; i < 6; ++i) {
			powerSources[i] -= sourcesTracker.durationOfLastDelay();
			if (powerSources[i] < 0) {
				powerSources[i] = 0;
			}
		}
	}

	if (source != null) {
		powerSources[source.ordinal()] = 10;
	}
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:15,代碼來源:PowerHandler.java

示例15: drain

import net.minecraftforge.common.util.ForgeDirection; //導入方法依賴的package包/類
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
    int metaside = this.getBlockMetadata() + 2;
    int side = from.ordinal();
    if (side == (metaside ^ 1))
    {
        if (resource != null && resource.isFluidEqual(this.liquidTank.getFluid()))
            return this.liquidTank.drain(resource.amount, doDrain);
    }

    return null;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:14,代碼來源:TileEntityMethaneSynthesizer.java


注:本文中的net.minecraftforge.common.util.ForgeDirection.ordinal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。