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


Java ForgeDirection.VALID_DIRECTIONS属性代码示例

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


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

示例1: onNeighborBlockChange

@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int neighborID)
{
    for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
    {
        if (world.getBlockId(x + side.offsetX, y + side.offsetY, z + side.offsetZ) == this.blockID)
        {
            if (this.passBlockChange(world, new Vector3(x, y, z), new ArrayList<Vector3>()))
                return;
        } else if (world.getBlockId(x + side.offsetX, y + side.offsetY, z + side.offsetZ) == ModBlocks.factoryController.blockID)
        {
            ModBlocks.factoryController.onNeighborBlockChange(world, x + side.offsetX, y + side.offsetY, z + side.offsetZ, world.getBlockId(x, y, z));
            return;
        }
    }
}
 
开发者ID:PaleoCrafter,项目名称:R0b0ts,代码行数:16,代码来源:BlockFactory.java

示例2: passBlockChange

private boolean passBlockChange(World world, Vector3 pos, ArrayList<Vector3> exceptions)
{
    int x = (int) pos.x;
    int y = (int) pos.y;
    int z = (int) pos.z;
    exceptions.add(pos);
    for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
    {
        if (!exceptions.contains(new Vector3(x + side.offsetX, y + side.offsetY, z + side.offsetZ)) && world.getBlockId(x + side.offsetX, y + side.offsetY, z + side.offsetZ) == this.blockID)
            return this.passBlockChange(world, new Vector3(x + side.offsetX, y + side.offsetY, z + side.offsetZ), exceptions);
        else if (world.getBlockId(x + side.offsetX, y + side.offsetY, z + side.offsetZ) == ModBlocks.factoryController.blockID)
        {
            ModBlocks.factoryController.onNeighborBlockChange(world, x + side.offsetX, y + side.offsetY, z + side.offsetZ, world.getBlockId(x, y, z));
            return true;
        }
    }

    return false;
}
 
开发者ID:PaleoCrafter,项目名称:R0b0ts,代码行数:19,代码来源:BlockFactory.java

示例3: tryPlantingCocoa

private boolean tryPlantingCocoa(Vect position) {
	
	Vect current = position;
	while(isWoodBlock(current) && BlockLog.limitToValidMetadata(getBlockMeta(current)) == 3) {
		
		for(ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
			if(direction == ForgeDirection.UP || direction == ForgeDirection.DOWN)
				continue;
			
			Vect candidate = new Vect(current.x + direction.offsetX, current.y, current.z + direction.offsetZ);
			if(isAirBlock(candidate))
				return housing.plantGermling(cocoa, world, candidate.x, candidate.y, candidate.z);
		}
		
		current = current.add(new Vect(0, 1, 0));
		if(current.y - position.y > 1)
			break;
	}
	
	return false;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:21,代码来源:FarmLogicCocoa.java

示例4: getAdjacentInventories

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

示例5: getPipeDirections

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

示例6: getAdjacentOxygenConnections

public static TileEntity[] getAdjacentOxygenConnections(TileEntity tile)
/*     */   {
/* 858 */     TileEntity[] adjacentConnections = new TileEntity[ForgeDirection.VALID_DIRECTIONS.length];
/*     */ 
/* 860 */     boolean isMekLoaded = NetworkConfigHandler.isMekanismLoaded();
/*     */ 
/* 862 */     BlockVec3 thisVec = new BlockVec3(tile);
/* 863 */     for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
/*     */     {
/* 865 */       TileEntity tileEntity = thisVec.getTileEntityOnSide(tile.field_70331_k, direction);
/*     */ 
/* 867 */       if ((tileEntity instanceof IConnector))
/*     */       {
/* 869 */         if (((IConnector)tileEntity).canConnect(direction.getOpposite(), NetworkType.OXYGEN))
/*     */         {
/* 871 */           adjacentConnections[direction.ordinal()] = tileEntity;
/*     */         }
/*     */       }
/* 874 */       else if (isMekLoaded)
/*     */       {
/* 876 */         if (((tileEntity instanceof ITubeConnection)) && ((!(tileEntity instanceof IGasTransmitter)) || (TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, tileEntity))))
/*     */         {
/* 878 */           if (((ITubeConnection)tileEntity).canTubeConnect(direction))
/*     */           {
/* 880 */             adjacentConnections[direction.ordinal()] = tileEntity;
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 886 */     return adjacentConnections;
/*     */   }
 
开发者ID:Nathor40000,项目名称:Connection,代码行数:32,代码来源:WorldUtil.java

示例7: func_96440_m

public void func_96440_m(int par1, int par2, int par3, int par4)
{
    for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
    {
        int j1 = par1 + dir.offsetX;
        int y = par2 + dir.offsetY;
        int k1 = par3 + dir.offsetZ;
        int l1 = getBlockId(j1, y, k1);
        Block block = Block.blocksList[l1];

        if(block != null)
        {
            block.onNeighborTileChange(this, j1, y, k1, par1, par2, par3);

            if(Block.isNormalCube(l1))
            {
                j1 += dir.offsetX;
                y += dir.offsetY;
                k1 += dir.offsetZ;
                l1 = getBlockId(j1, y, k1);
                block = Block.blocksList[l1];
                if(block != null && block.weakTileChanges())
                {
                    block.onNeighborTileChange(this, j1, y, k1, par1, par2, par3);
                }
            }
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:29,代码来源:World.java

示例8: getAdjacentPowerConnections

public static TileEntity[] getAdjacentPowerConnections(TileEntity tile)
/*     */   {
/* 891 */     TileEntity[] adjacentConnections = new TileEntity[6];
/*     */ 
/* 893 */     boolean isMekLoaded = NetworkConfigHandler.isMekanismLoaded();
/* 894 */     boolean isTELoaded = NetworkConfigHandler.isThermalExpansionLoaded();
/* 895 */     boolean isIC2Loaded = NetworkConfigHandler.isIndustrialCraft2Loaded();
/* 896 */     boolean isBCLoaded = NetworkConfigHandler.isBuildcraftLoaded();
/*     */ 
/* 898 */     BlockVec3 thisVec = new BlockVec3(tile);
/* 899 */     for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
/*     */     {
/* 901 */       TileEntity tileEntity = thisVec.getTileEntityOnSide(tile.field_70331_k, direction);
/*     */ 
/* 903 */       if ((tileEntity instanceof IConnector))
/*     */       {
/* 905 */         if (((IConnector)tileEntity).canConnect(direction.getOpposite(), NetworkType.POWER))
/*     */         {
/* 907 */           adjacentConnections[direction.ordinal()] = tileEntity;
/*     */         }
/*     */       }
/* 910 */       else if ((isMekLoaded) && ((tileEntity instanceof IStrictEnergyAcceptor)))
/*     */       {
/* 912 */         if (((IStrictEnergyAcceptor)tileEntity).canReceiveEnergy(direction.getOpposite()))
/*     */         {
/* 914 */           adjacentConnections[direction.ordinal()] = tileEntity;
/*     */         }
/*     */       }
/* 917 */       else if ((isTELoaded) && ((tileEntity instanceof IEnergyHandler)))
/*     */       {
/* 919 */         if (((IEnergyHandler)tileEntity).canInterface(direction.getOpposite()))
/*     */         {
/* 921 */           adjacentConnections[direction.ordinal()] = tileEntity;
/*     */         }
/*     */       }
/* 924 */       else if ((isIC2Loaded) && ((tileEntity instanceof IEnergyTile)))
/*     */       {
/* 926 */         if ((tileEntity instanceof IEnergyAcceptor))
/*     */         {
/* 928 */           if (((IEnergyAcceptor)tileEntity).acceptsEnergyFrom(tile, direction.getOpposite()))
/*     */           {
/* 930 */             adjacentConnections[direction.ordinal()] = tileEntity;
/* 931 */             continue;
/*     */           }
/*     */         }
/*     */ 
/* 935 */         if ((tileEntity instanceof IEnergyEmitter))
/*     */         {
/* 937 */           if (((IEnergyEmitter)tileEntity).emitsEnergyTo(tileEntity, direction.getOpposite()))
/*     */           {
/* 939 */             adjacentConnections[direction.ordinal()] = tileEntity;
/* 940 */             continue;
/*     */           }
/*     */         }
/*     */ 
/* 944 */         adjacentConnections[direction.ordinal()] = tileEntity;
/*     */       }
/* 946 */       else if ((isBCLoaded) && ((tileEntity instanceof IPowerReceptor)))
/*     */       {
/* 948 */         if (((IPowerReceptor)tileEntity).getPowerReceiver(direction.getOpposite()) != null)
/*     */         {
/* 950 */           adjacentConnections[direction.ordinal()] = tileEntity;
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 955 */     return adjacentConnections;
/*     */   }
 
开发者ID:Nathor40000,项目名称:Connection,代码行数:68,代码来源:WorldUtil.java

示例9: convertForgeDirectionToLocalFace

public int convertForgeDirectionToLocalFace(int forgeDirection)
{
	int rawDirection = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
	
	int direction = convertDirectionToForgeDirection(rawDirection);
	
	if(direction == ForgeDirection.NORTH.ordinal()) return forgeDirection;
	
	// Frente
	if(direction == forgeDirection) return ForgeDirection.NORTH.ordinal();
	
	ForgeDirection d = ForgeDirection.VALID_DIRECTIONS[direction]; 
	
	// Costas
	if(d.getOpposite().ordinal() == forgeDirection) return ForgeDirection.SOUTH.ordinal();
	
	// Cima
	if(d.getRotation(ForgeDirection.EAST).ordinal() == forgeDirection) return ForgeDirection.UP.ordinal();
	
	// Baixo
	if(d.getRotation(ForgeDirection.WEST).ordinal() == forgeDirection) return ForgeDirection.DOWN.ordinal();
	
	// Direita
	if(d.getRotation(ForgeDirection.UP).ordinal() == forgeDirection) return ForgeDirection.EAST.ordinal();
	
	// Esquerda
	if(d.getRotation(ForgeDirection.DOWN).ordinal() == forgeDirection) return ForgeDirection.WEST.ordinal();
	
	return 0;
}
 
开发者ID:joserobjr,项目名称:Project-Red-Peripheral,代码行数:30,代码来源:TileEntityProjectRedPeripheral.java

示例10: getEntityCardinalFacingFD

public static ForgeDirection getEntityCardinalFacingFD(EntityLivingBase living) {

		return ForgeDirection.VALID_DIRECTIONS[getEntityCardinalFacing(living)];
	}
 
开发者ID:PaleoCrafter,项目名称:R0b0ts,代码行数:4,代码来源:EntityHelper.java


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