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


Java ForgeDirection.NORTH屬性代碼示例

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


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

示例1: onBlockPlacedBy

@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
    int meta = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
    if (world.getTileEntity(x, y, z) instanceof MonoSwitch) {
        MonoSwitch monoSwitch = (MonoSwitch) world.getTileEntity(x, y, z);
        switch (meta) {
            case 0:
                monoSwitch.direction = ForgeDirection.SOUTH;
                break;
            case 1:
                monoSwitch.direction = ForgeDirection.WEST;
                break;
            case 2:
                monoSwitch.direction = ForgeDirection.NORTH;
                break;
            case 3:
                monoSwitch.direction = ForgeDirection.EAST;
                break;
            default:
                break;
        }
        if ((meta + 2) % 2 == 0) meta = 0;
        else meta = 1;
        world.setBlockMetadataWithNotify(x, y, z, meta, 2);
    }
}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:26,代碼來源:Rail3rdSwitch.java

示例2: canConnectRedstone

@Override
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side)
{
    TileEntity te = world.getTileEntity(x, y, z);
    ForgeDirection fd;
    switch (side)
    {
        case -1: fd = ForgeDirection.UP; break;
        case  0: fd = ForgeDirection.NORTH; break;
        case  1: fd = ForgeDirection.EAST; break;
        case  2: fd = ForgeDirection.SOUTH; break;
        case  3: fd = ForgeDirection.WEST; break;
        default: fd = ForgeDirection.UNKNOWN; break;
    }
    return te instanceof TileEntityTransistor && ((TileEntityTransistor)te).canConnectRedstone(fd);
}
 
開發者ID:XFactHD,項目名稱:RFUtilities,代碼行數:16,代碼來源:BlockTransistor.java

示例3: ReversalForgeDirection

public static ForgeDirection ReversalForgeDirection(ForgeDirection dir){
    if (dir == null) return null;
    switch (dir){
        case UP:
            return ForgeDirection.DOWN;
        case DOWN:
            return ForgeDirection.UP;
        case EAST:
            return ForgeDirection.WEST;
        case WEST:
            return ForgeDirection.EAST;
        case NORTH:
            return ForgeDirection.SOUTH;
        case SOUTH:
            return ForgeDirection.NORTH;
        default:
            return null;
    }
}
 
開發者ID:Team-Antimatter-Mod,項目名稱:AntiMatterMod,代碼行數:19,代碼來源:OreBlock.java

示例4: getPlayerDirection

/**
 * プレイヤーの向きを取得します
 *
 * @param player プレイヤー
 * @return 向きの {@link ForgeDirection}
 */
private static ForgeDirection getPlayerDirection(EntityLivingBase player) {
	int playerDirY = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
	int playerDirP = MathHelper.floor_double((double) (player.rotationPitch * 4.0F / 360.0F) + 0.5D) & 3;
	switch (playerDirP) {
		case 1:
			return ForgeDirection.DOWN;
		case 3:
			return ForgeDirection.UP;
		default:
	}
	
	switch (playerDirY) {
		case 0:
			return ForgeDirection.NORTH;
		case 1:
			return ForgeDirection.EAST;
		case 2:
			return ForgeDirection.SOUTH;
		case 3:
			return ForgeDirection.WEST;
	}
	return null;
}
 
開發者ID:Team-Antimatter-Mod,項目名稱:AntiMatterMod,代碼行數:29,代碼來源:MiningHammer.java

示例5: onBlockPlacedBy

@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
    int meta = MathHelper.floor_double((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
    if (world.getTileEntity(x, y, z) instanceof GateFrontN) {
        GateFrontN gateFrontN = (GateFrontN) world.getTileEntity(x, y, z);
        switch (meta) {
            case 0:
                gateFrontN.direction = ForgeDirection.SOUTH;
                break;
            case 1:
                gateFrontN.direction = ForgeDirection.WEST;
                break;
            case 2:
                gateFrontN.direction = ForgeDirection.NORTH;
                break;
            case 3:
                gateFrontN.direction = ForgeDirection.EAST;
                break;
            default:
                break;
        }
        world.setBlockMetadataWithNotify(x, y, z, meta, 2);
    }
}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:24,代碼來源:BlockGateFrontN.java

示例6: buildComponent

@Override
@SuppressWarnings("unchecked")
public void buildComponent(StructureComponent component, List list, Random random) {
	ComponentTiamatCenterLine componentE = new ComponentTiamatCenterLine(random, (this.boundingBox.minX >> 4) + 1, (this.boundingBox.minZ >> 4), ForgeDirection.EAST, 1);
	((ComponentTiamatCenter) component).structureComponents.add(componentE);
	list.add(componentE);
	ComponentTiamatCenterLine componentW = new ComponentTiamatCenterLine(random, (this.boundingBox.minX >> 4) - 1, (this.boundingBox.minZ >> 4), ForgeDirection.WEST, 1);
	((ComponentTiamatCenter) component).structureComponents.add(componentW);
	list.add(componentW);
	ComponentTiamatCenterLine componentS = new ComponentTiamatCenterLine(random, (this.boundingBox.minX >> 4), (this.boundingBox.minZ >> 4) + 1, ForgeDirection.SOUTH, 1);
	((ComponentTiamatCenter) component).structureComponents.add(componentS);
	list.add(componentS);
	ComponentTiamatCenterLine componentN = new ComponentTiamatCenterLine(random, (this.boundingBox.minX >> 4), (this.boundingBox.minZ >> 4) - 1, ForgeDirection.NORTH, 1);
	((ComponentTiamatCenter) component).structureComponents.add(componentN);
	list.add(componentN);
}
 
開發者ID:Team-Antimatter-Mod,項目名稱:AntiMatterMod,代碼行數:16,代碼來源:ComponentTiamatCenter.java

示例7: generateChorusPlant

public static void generateChorusPlant(World world, int x, int y, int z, int pass) {
	int height;
	for (height = 0; height < 4; height++) {
		if (!ChorusFlower.canPlantStay(world, x, y + height, z)) {
			world.setBlock(x, y + height, z, ModBlocks.chorus_flower, 5, 2);
			break;
		}
		world.setBlock(x, y + height, z, ModBlocks.chorus_plant);
	}
	if (height > 1) {
		world.setBlock(x, y + height, z, ModBlocks.chorus_plant);
		boolean grew = false;

		if (pass < 5) {
			ForgeDirection[] dirs = new ForgeDirection[] { ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.SOUTH };
			for (int j = 0; j < world.rand.nextInt(4); j++) {
				ForgeDirection dir = dirs[world.rand.nextInt(dirs.length)];
				int xx = x + dir.offsetX;
				int yy = y + height + dir.offsetY;
				int zz = z + dir.offsetZ;
				if (world.isAirBlock(xx, yy, zz) && ChorusFlower.isSpaceAroundFree(world, xx, yy, zz, dir.getOpposite())) {
					generateChorusPlant(world, xx, yy, zz, pass + 1);
					grew = true;
				}
			}
		}

		if (!grew)
			world.setBlock(x, y + height, z, ModBlocks.chorus_flower, 5, 2);
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:31,代碼來源:EtFuturumWorldGenerator.java

示例8: setBlockBoundsBasedOnState

@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
	ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));

	if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP)
		setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
	else if (dir == ForgeDirection.WEST || dir == ForgeDirection.EAST)
		setBlockBounds(0.0F, 0.375F, 0.375F, 1.0F, 0.625F, 0.625F);
	else if (dir == ForgeDirection.NORTH || dir == ForgeDirection.SOUTH)
		setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:11,代碼來源:EndRod.java

示例9: getDirection

public static ForgeDirection getDirection(int side){
    switch(side){
        case 0:
            return ForgeDirection.SOUTH;
        case 1:
            return ForgeDirection.WEST;
        case 2:
            return ForgeDirection.NORTH;
        case 3:
            return ForgeDirection.EAST;
    }
    return null;
}
 
開發者ID:Avaja,項目名稱:OpenTechnology,代碼行數:13,代碼來源:Utils.java

示例10: canConnectRedstone

public boolean canConnectRedstone(ForgeDirection fd)
{
    switch (worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
    {
        case 2: return (fd == ForgeDirection.WEST);
        case 3: return (fd == ForgeDirection.NORTH);
        case 4: return (fd == ForgeDirection.EAST);
        case 5: return (fd == ForgeDirection.SOUTH);
        default: return false;
    }
}
 
開發者ID:XFactHD,項目名稱:RFUtilities,代碼行數:11,代碼來源:TileEntityTransistor.java

示例11: canConnectEnergy

@Override
public boolean canConnectEnergy(ForgeDirection fd)
{
    switch (worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
    {
        case 0: return fd == ForgeDirection.DOWN;
        case 1: return fd == ForgeDirection.UP;
        case 2: return fd == ForgeDirection.WEST;
        case 3: return fd == ForgeDirection.NORTH;
        case 4: return fd == ForgeDirection.EAST;
        case 5: return fd == ForgeDirection.SOUTH;
        default: return false;
    }
}
 
開發者ID:XFactHD,項目名稱:RFUtilities,代碼行數:14,代碼來源:TileEntityInvisibleTesseract.java

示例12: canConnectEnergy

@Override
public boolean canConnectEnergy(ForgeDirection fd)
{
    switch (worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
    {
        case 2: return (fd == ForgeDirection.NORTH || fd == ForgeDirection.SOUTH);
        case 3: return (fd == ForgeDirection.EAST || fd == ForgeDirection.WEST);
        case 4: return (fd == ForgeDirection.NORTH || fd == ForgeDirection.SOUTH);
        case 5: return (fd == ForgeDirection.EAST || fd == ForgeDirection.WEST);
        default: return false;
    }
}
 
開發者ID:XFactHD,項目名稱:RFUtilities,代碼行數:12,代碼來源:TileEntityDiode.java

示例13: getLookDirection

public static ForgeDirection getLookDirection(EntityLivingBase livingBase){
    double side = MathHelper.floor_double((double)(livingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
    switch((int) side){
        case 0:
            return ForgeDirection.SOUTH;
        case 1:
            return ForgeDirection.WEST;
        case 2:
            return ForgeDirection.NORTH;
        case 3:
            return ForgeDirection.EAST;
    }
    return null;
}
 
開發者ID:Avaja,項目名稱:OpenTechnology,代碼行數:14,代碼來源:Utils.java

示例14: receiveEnergy

@Override
public int receiveEnergy(ForgeDirection fd, int amount, boolean simulate)
{
    switch (worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
    {
        case 2: if(fd == ForgeDirection.SOUTH) return storage.receiveEnergy(amount, simulate);
        case 3: if(fd == ForgeDirection.WEST)  return storage.receiveEnergy(amount, simulate);
        case 4: if(fd == ForgeDirection.NORTH) return storage.receiveEnergy(amount, simulate);
        case 5: if(fd == ForgeDirection.EAST)  return storage.receiveEnergy(amount, simulate);
        default: return 0;
    }
}
 
開發者ID:XFactHD,項目名稱:RFUtilities,代碼行數:12,代碼來源:TileEntityCapacitor.java

示例15: extractEnergy

@Override
public int extractEnergy(ForgeDirection fd, int amount, boolean simulate)
{
    switch (worldObj.getBlockMetadata(xCoord, yCoord, zCoord))
    {
        case 2: if(fd == ForgeDirection.NORTH) return storage.extractEnergy(amount, simulate);
        case 3: if(fd == ForgeDirection.EAST)  return storage.extractEnergy(amount, simulate);
        case 4: if(fd == ForgeDirection.SOUTH) return storage.extractEnergy(amount, simulate);
        case 5: if(fd == ForgeDirection.WEST)  return storage.extractEnergy(amount, simulate);
        default: return 0;
    }
}
 
開發者ID:XFactHD,項目名稱:RFUtilities,代碼行數:12,代碼來源:TileEntityCapacitor.java


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