当前位置: 首页>>代码示例>>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;未经允许,请勿转载。