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


Java ForgeDirection.VALID_DIRECTIONS属性代码示例

本文整理汇总了Java中net.minecraftforge.common.util.ForgeDirection.VALID_DIRECTIONS属性的典型用法代码示例。如果您正苦于以下问题:Java ForgeDirection.VALID_DIRECTIONS属性的具体用法?Java ForgeDirection.VALID_DIRECTIONS怎么用?Java ForgeDirection.VALID_DIRECTIONS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraftforge.common.util.ForgeDirection的用法示例。


在下文中一共展示了ForgeDirection.VALID_DIRECTIONS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canPlantStay

public static boolean canPlantStay(World world, int x, int y, int z) {
	Block block = world.getBlock(x, y - 1, z);
	if (block != ModBlocks.chorus_plant && block != Blocks.end_stone) {
		if (block.isAir(world, x, y - 1, z)) {
			int adjecentCount = 0;
			for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
				Block adjecentBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
				if (adjecentBlock == ModBlocks.chorus_plant)
					adjecentCount++;
				else if (!adjecentBlock.isAir(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
					return false;
			}
			return adjecentCount == 1;
		} else
			return false;
	} else
		return true;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:18,代码来源:ChorusFlower.java

示例2: updateTick

@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
	if (world.isRemote)
		return;

	int surroundingBlockCount = 0;
	for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
		Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
		if (block == this || block == Blocks.ice || block == Blocks.packed_ice)
			if (++surroundingBlockCount >= 4)
				break;
	}

	if (surroundingBlockCount < 4 || rand.nextInt(100) <= 33) {
		int meta = world.getBlockMetadata(x, y, z);
		if (meta < 3)
			world.setBlockMetadataWithNotify(x, y, z, meta + 1, 2);
		else
			world.setBlock(x, y, z, Blocks.water);
	}

	world.scheduleBlockUpdate(x, y, z, this, 40 + rand.nextInt(40));
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:23,代码来源:FrostedIce.java

示例3: onBlockPlaced

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,代码行数:18,代码来源:BlockSpike.java

示例4: getConnectedTubes

/**
 * Gets all the tubes around a tile entity.
 * @param tileEntity - center tile entity
 * @return array of TileEntities
 */
public static TileEntity[] getConnectedTubes(TileEntity tileEntity)
{
	TileEntity[] tubes = new TileEntity[] {null, null, null, null, null, null};

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

		if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, tileEntity))
		{
			tubes[orientation.ordinal()] = tube;
		}
	}

	return tubes;
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:21,代码来源:GasTransmission.java

示例5: getConnectedAcceptors

/**
 * 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,代码行数:21,代码来源:GasTransmission.java

示例6: refresh

@Override
public void refresh()
{
    if (!this.worldObj.isRemote)
    {
        this.adjacentConnections = null;

        for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
        {
            TileEntity tileEntity = new BlockVec3(this).getTileEntityOnSide(this.worldObj, side);

            if (tileEntity != null)
            {
                if (tileEntity.getClass() == this.getClass() && tileEntity instanceof INetworkProvider && !this.getNetwork().equals(((INetworkProvider) tileEntity).getNetwork()))
                {
                    this.setNetwork((IGridNetwork) this.getNetwork().merge(((INetworkProvider) tileEntity).getNetwork()));
                }
            }
        }

        this.getNetwork().refresh();
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:23,代码来源:TileEntityOxygenTransmitter.java

示例7: absorb

private boolean absorb(World world, int x, int y, int z) {
	LinkedList<Tuple> linkedlist = Lists.newLinkedList();
	ArrayList<WorldCoord> arraylist = Lists.newArrayList();
	linkedlist.add(new Tuple(new WorldCoord(x, y, z), 0));
	int i = 0;
	WorldCoord blockpos1;

	while (!linkedlist.isEmpty()) {
		Tuple tuple = linkedlist.poll();
		blockpos1 = (WorldCoord) tuple.getFirst();
		int j = (Integer) tuple.getSecond();

		for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
			WorldCoord blockpos2 = blockpos1.add(dir);

			if (world.getBlock(blockpos2.x, blockpos2.y, blockpos2.z).getMaterial() == Material.water) {
				world.setBlockToAir(blockpos2.x, blockpos2.y, blockpos2.z);
				arraylist.add(blockpos2);
				i++;
				if (j < 6)
					linkedlist.add(new Tuple(blockpos2, j + 1));
			}
		}

		if (i > 64)
			break;
	}

	Iterator<WorldCoord> iterator = arraylist.iterator();

	while (iterator.hasNext()) {
		blockpos1 = iterator.next();
		world.notifyBlockOfNeighborChange(blockpos1.x, blockpos1.y, blockpos1.z, Blocks.air);
	}

	return i > 0;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:37,代码来源:Sponge.java

示例8: getWorldModel

public BoxModel getWorldModel(final IBlockAccess world, final int x, final int y, final int z) {
    final BoxModel model = new BoxModel();
    model.addBoxI(7, 0, 7, 9, 13, 9).fillIcons(this, 0);
    for (final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
        if (world.isSideSolid(x + d.offsetX, y + d.offsetY, z + d.offsetZ, d.getOpposite(), false)) {
            model.rotateToSideTex(d);
            return model;
        }
    }
    return model;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:11,代码来源:BlockEnderMarkers.java

示例9: getWorldModel

public BoxModel getWorldModel(final IBlockAccess world, final int x, final int y, final int z) {
    final int metadata = world.getBlockMetadata(x, y, z);
    final BoxModel model = this.getInventoryModel(metadata);
    model.get(0).textureSide[2] = this.iconsFlipped[metadata];
    model.get(0).textureSide[3] = null;
    for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
        if (world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == ExtraUtils.enderQuarry) {
            final Box b = new Box(0.125f, 0.0f, 0.125f, 0.875f, 0.0625f, 0.875f);
            b.rotateToSide(dir);
            b.texture = this.arms;
            model.add(b);
        }
    }
    return model;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:15,代码来源:BlockQuarryUpgrades.java

示例10: getWorldModel

public BoxModel getWorldModel(final IBlockAccess world, final int x, final int y, final int z) {
    final int metadata = world.getBlockMetadata(x, y, z);
    final BoxModel model = this.getInventoryModel(metadata);
    if (metadata == 2 || metadata == 3) {
        model.fillIcons(this, metadata);
        for (final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
            if (world.isSideSolid(x + d.offsetX, y + d.offsetY, z + d.offsetZ, d.getOpposite(), false)) {
                model.rotateToSideTex(d);
                return model;
            }
        }
    }
    return model;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:14,代码来源:BlockEnderConstructor.java

示例11: reloadBlockMasks

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,代码行数:9,代码来源:PipePart.java

示例12: reloadBlockMasks

public void reloadBlockMasks() {
    this.blockMasks = 0;
    for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
        TransferNodePart.dummyPipes[dir.ordinal()].h = 0.5f + this.baseSize();
        if (dir == this.getNodeDir()) {
            this.blockMasks |= this.flagmasks[dir.ordinal()];
        }
        else if (!this.tile().canAddPart((TMultiPart)TransferNodePart.dummyPipes[dir.ordinal()])) {
            this.blockMasks |= this.flagmasks[dir.ordinal()];
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:12,代码来源:TransferNodePart.java

示例13: getNextPipeType

public static int getNextPipeType(final IBlockAccess world, final int x, final int y, final int z, int metadata) {
    if ((metadata >= 8 && metadata < 15) || metadata > 15) {
        return metadata;
    }
    if (metadata == 7) {
        return 0;
    }
    if (metadata == 15) {
        return 7;
    }
    if (metadata == 6) {
        return 15;
    }
    metadata = (metadata + 1) % 8;
    final IPipe pipe = TNHelper.getPipe(world, x, y, z);
    if (pipe == null) {
        return metadata;
    }
    int numNeighbors = 0;
    for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
        if (TNHelper.canInput(world, x, y, z, dir) && TNHelper.canInput(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite())) {
            ++numNeighbors;
        }
    }
    if (numNeighbors <= 1) {
        if (metadata >= 1 && metadata <= 6) {
            return 15;
        }
    }
    else {
        for (ForgeDirection dir2 = ForgeDirection.getOrientation(metadata - 1); metadata >= 1 && metadata <= 6 && (!TNHelper.canInput(world, x, y, z, dir2) || !TNHelper.canInput(world, x + dir2.offsetX, y + dir2.offsetY, z + dir2.offsetZ, dir2.getOpposite())); dir2 = ForgeDirection.getOrientation(++metadata - 1)) {}
        if (metadata == 7) {
            return 15;
        }
    }
    return metadata;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:37,代码来源:StdPipes.java

示例14: getInventoryModel

public BoxModel getInventoryModel(final int metadata) {
    final BoxModel boxes = new BoxModel();
    final IPipe pipe = this.getPipe(metadata);
    if (pipe != null) {
        for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            boxes.add(new Box(0.375f, 0.0f, 0.375f, 0.625f, 0.375f, 0.625f).rotateToSide(dir).setTexture(((IPipeCosmetic)pipe).invPipeTexture(dir)).setLabel("pipe"));
        }
        if (((IPipeCosmetic)this.getPipe(metadata)).baseSize() > 0.125f) {
            boxes.add(new Box(0.5f - ((IPipeCosmetic)pipe).baseSize(), 0.5f - ((IPipeCosmetic)pipe).baseSize(), 0.5f - ((IPipeCosmetic)pipe).baseSize(), 0.5f + ((IPipeCosmetic)pipe).baseSize(), 0.5f + ((IPipeCosmetic)pipe).baseSize(), 0.5f + ((IPipeCosmetic)pipe).baseSize()).setTexture(((IPipeCosmetic)this.getPipe(metadata)).baseTexture()).setLabel("base"));
        }
    }
    return boxes;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:13,代码来源:BlockTransferPipe.java

示例15: transmitEnergy

private void transmitEnergy() {
    for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
        final TileEntity tile = this.worldObj.getTileEntity(this.x() + side.offsetX, this.y() + side.offsetY, this.z() + side.offsetZ);
        if (!(tile instanceof TileEntityGenerator)) {
            if (tile instanceof IEnergyReceiver) {
                this.getStorage().extractEnergy(((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), this.getStorage().extractEnergy(this.transferLimit() * this.getMultiplier(), true), false), false);
            }
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:10,代码来源:TileEntityGenerator.java


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