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


Java ForgeDirection.getOpposite方法代码示例

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


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

示例1: maintainGermlings

import net.minecraftforge.common.ForgeDirection; //导入方法依赖的package包/类
@Override
protected boolean maintainGermlings(int x, int ySaplings, int z, ForgeDirection direction, int extent) {
	
	for(int i = 0; i < extent; i++) {
		Vect position = translateWithOffset(x, ySaplings, z, direction, i);
		
		if(isAirBlock(position)) {
			ForgeDirection reverse = direction.getOpposite();
			Vect soilBelow = new Vect(position.x, position.y-1, position.z);
			Vect soilPrevious = new Vect(position.x*reverse.offsetX, position.y-1, position.z*reverse.offsetZ);
			if(!ground[0].isItemEqual(getAsItemStack(soilPrevious))
				&& ground[0].isItemEqual(getAsItemStack(soilBelow)))
				return plantSapling(position);
			
			if(ground[0].isItemEqual(getAsItemStack(soilBelow)))
				return plantSapling(position);
		}
		
	}
	
	return false;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:23,代码来源:FarmLogicArboreal.java

示例2: getAdjacentInventories

import net.minecraftforge.common.ForgeDirection; //导入方法依赖的package包/类
/**
 * Searches for inventories adjacent to block, excludes IPowerReceptor
 * 
 * @return
 */
public static IInventory[] getAdjacentInventories(World world, Vect blockPos, ForgeDirection from) {
	ArrayList<IInventory> inventories = new ArrayList<IInventory>();

	for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
		if(from != ForgeDirection.UNKNOWN && from != dir.getOpposite())
			continue;

		TileEntity entity = world.getBlockTileEntity(blockPos.x + dir.offsetX, blockPos.y + dir.offsetY, blockPos.z + dir.offsetZ);
		if (entity != null)
			if (entity instanceof IInventory)
				if (!(entity instanceof IPowerReceptor)) {
					inventories.add((IInventory) entity);
				}
	}

	return inventories.toArray(new IInventory[inventories.size()]);
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:23,代码来源:BlockUtil.java

示例3: getPipeDirections

import net.minecraftforge.common.ForgeDirection; //导入方法依赖的package包/类
/**
 * Returns a list of adjacent pipes.
 * 
 * @param world
 * @param blockPos
 * @return
 */
public static ForgeDirection[] getPipeDirections(World world, Vect blockPos, ForgeDirection from) {
	LinkedList<ForgeDirection> possiblePipes = new LinkedList<ForgeDirection>();

	for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
		if(from != ForgeDirection.UNKNOWN && from != dir.getOpposite())
			continue;
		
		Position posPipe = new Position(blockPos.x, blockPos.y, blockPos.z, dir);
		posPipe.moveForwards(1.0);

		TileEntity pipeEntry = world.getBlockTileEntity((int) posPipe.x, (int) posPipe.y, (int) posPipe.z);

		if (pipeEntry instanceof IPipeEntry && ((IPipeEntry) pipeEntry).acceptItems()) {
			if(from != ForgeDirection.UNKNOWN && pipeEntry instanceof IPipeConnection) {
				if(((IPipeConnection)pipeEntry).isPipeConnected(from))
					possiblePipes.add(dir);
			} else
				possiblePipes.add(dir);
		}
	}

	return possiblePipes.toArray(new ForgeDirection[0]);

}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:32,代码来源:BlockUtil.java

示例4: hasRedstoneSignal

import net.minecraftforge.common.ForgeDirection; //导入方法依赖的package包/类
private boolean hasRedstoneSignal(ForgeDirection direction) {
	Vect side = new Vect(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
	
	ForgeDirection opp = direction.getOpposite();
	int dir = opp.offsetZ < 0 ? 2 : opp.offsetZ > 0 ? 3 : opp.offsetX < 0 ? 4 : opp.offsetX > 0 ? 5 : 0;
	return worldObj.isBlockIndirectlyProvidingPowerTo(side.x, side.y, side.z, dir)
			|| worldObj.isBlockProvidingPowerTo(side.x, side.y, side.z, dir);
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:9,代码来源:TileControl.java


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